[jboss-svn-commits] JBL Code SVN: r27754 - labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jul 8 13:42:45 EDT 2009
Author: dward
Date: 2009-07-08 13:42:45 -0400 (Wed, 08 Jul 2009)
New Revision: 27754
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java
Log:
Fix for JBESB-2721
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java 2009-07-08 17:42:42 UTC (rev 27753)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java 2009-07-08 17:42:45 UTC (rev 27754)
@@ -33,7 +33,6 @@
import org.jboss.system.ServiceMBeanSupport;
import org.jboss.system.server.ServerConfig;
import org.jboss.system.server.ServerConfigImplMBean;
-import org.jboss.system.server.ServerConfigLocator;
/**
* Integration with <a href="http://sourceforge.net/projects/hsqldb">HSQLDB</a>
@@ -543,7 +542,7 @@
// load (and link) the class only if needed
ClassLoader cl = Thread.currentThread().getContextClassLoader();
- Class clazz = Class.forName(databaseManagerClass, true, cl);
+ Class<?> clazz = Class.forName(databaseManagerClass, true, cl);
Method main = clazz.getMethod("main", new Class[] { args.getClass() });
main.invoke(null, new Object [] { args });
}
@@ -618,24 +617,10 @@
*/
private void startStandaloneDatabase() throws Exception
{
- // Get the server data directory
- File dataDir = ServerConfigLocator.locate().getServerDataDir();
+ final File hypersonicDir = checkDataDir() ;
+
+ dbPath = new File(hypersonicDir, name);
- // Get DB directory
- File hypersoniDir = new File(dataDir, HYPERSONIC_DATA_DIR);
-
- if (!hypersoniDir.exists())
- {
- hypersoniDir.mkdirs();
- }
-
- if (!hypersoniDir.isDirectory())
- {
- throw new IOException("Failed to create directory: " + hypersoniDir);
- }
-
- dbPath = new File(hypersoniDir, name);
-
String dbURL = JDBC_URL_PREFIX + getDatabasePath();
// hold a connection so hypersonic does not close the database
@@ -658,24 +643,9 @@
*/
private void startRemoteDatabase() throws Exception
{
- // Get the server data directory
- File dataDir = getDataDir();
+ final File hypersonicDir = checkDataDir() ;
+ dbPath = new File(hypersonicDir, name);
- // Get DB directory
- File hypersoniDir = new File(dataDir, HYPERSONIC_DATA_DIR);
-
- if (!hypersoniDir.exists())
- {
- hypersoniDir.mkdirs();
- }
-
- if (!hypersoniDir.isDirectory())
- {
- throw new IOException("Failed to create directory: " + hypersoniDir);
- }
-
- dbPath = new File(hypersoniDir, name);
-
// Start DB in new thread, or else it will block us
serverThread = new Thread("hypersonic-" + name)
{
@@ -686,7 +656,7 @@
// Create startup arguments
String[] args =
new String[] {
- "-database", dbPath.toString(),
+ "-database", dbPath.getAbsolutePath(),
"-port", String.valueOf(port),
"-address", address,
"-silent", String.valueOf(silent),
@@ -696,7 +666,7 @@
// Start server
ClassLoader cl = Thread.currentThread().getContextClassLoader();
- Class clazz = Class.forName(serverClass, true, cl);
+ Class<?> clazz = Class.forName(serverClass, true, cl);
Method main = clazz.getMethod("main", new Class[] { args.getClass() });
main.invoke(null, new Object[] { args } );
}
@@ -816,6 +786,30 @@
return connection;
}
+ /**
+ * Check the existence of the h2 data directory.
+ * @return The h2 data directory.
+ * @throws IOException For errors checking/creating the h2 data directory.
+ */
+ private File checkDataDir() throws IOException
+ {
+ // Get the server data directory
+ final File dataDir = getDataDir();
+
+ // Get DB directory
+ final File hypersonicDir = new File(dataDir, HYPERSONIC_DATA_DIR);
+
+ if (!hypersonicDir.exists())
+ {
+ hypersonicDir.mkdirs();
+ }
+ else if (!hypersonicDir.isDirectory())
+ {
+ throw new IOException("Failed to create directory: " + hypersonicDir);
+ }
+ return hypersonicDir ;
+ }
+
File getDataDir()
{
if (datadir == null)
More information about the jboss-svn-commits
mailing list