Author: dgolovin
Date: 2008-12-12 01:42:18 -0500 (Fri, 12 Dec 2008)
New Revision: 12564
Modified:
branches/jbosstools-3.0.0.CR1/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun/JBossASAdapterInitializer.java
Log:
https://jira.jboss.org/jira/browse/JBDS-516 fixed
Modified:
branches/jbosstools-3.0.0.CR1/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun/JBossASAdapterInitializer.java
===================================================================
---
branches/jbosstools-3.0.0.CR1/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun/JBossASAdapterInitializer.java 2008-12-12
06:12:55 UTC (rev 12563)
+++
branches/jbosstools-3.0.0.CR1/jst/plugins/org.jboss.tools.jst.firstrun/src/org/jboss/tools/jst/firstrun/JBossASAdapterInitializer.java 2008-12-12
06:42:18 UTC (rev 12564)
@@ -11,7 +11,9 @@
package org.jboss.tools.jst.firstrun;
+import java.io.BufferedInputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
@@ -27,13 +29,13 @@
import org.eclipse.datatools.connectivity.ConnectionProfileConstants;
import org.eclipse.datatools.connectivity.ConnectionProfileException;
import org.eclipse.datatools.connectivity.ProfileManager;
-import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
-import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants;
import org.eclipse.datatools.connectivity.drivers.DriverInstance;
import org.eclipse.datatools.connectivity.drivers.DriverManager;
import org.eclipse.datatools.connectivity.drivers.IDriverMgmtConstants;
import org.eclipse.datatools.connectivity.drivers.IPropertySet;
import org.eclipse.datatools.connectivity.drivers.PropertySetImpl;
+import org.eclipse.datatools.connectivity.drivers.jdbc.IJDBCConnectionProfileConstants;
+import org.eclipse.datatools.connectivity.drivers.jdbc.IJDBCDriverDefinitionConstants;
import org.eclipse.datatools.connectivity.drivers.models.TemplateDescriptor;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;
@@ -52,38 +54,29 @@
/**
* @author eskimo
- *
+ *
*/
public class JBossASAdapterInitializer implements IStartup {
- public static final String JBOSS_AS_HOME = "../../../../jboss-eap/jboss-as";
// JBoss AS home directory (relative to plugin)- <RHDS_HOME>/jbossas.
-
+ public static final String JBOSS_AS_HOME = "../../../../jboss-eap/jboss-as";
// JBoss
public static final String SERVERS_FILE =
"../../../../studio/application_platforms.properties";
-
-
- // This constants are made to avoid dependency with org.jboss.ide.eclipse.as.core
plugin
+
+ // This constants are made to avoid dependency with
+ // org.jboss.ide.eclipse.as.core plugin
public static final String JBOSS_AS_RUNTIME_TYPE_ID[] = {
- "org.jboss.ide.eclipse.as.runtime.32",
- "org.jboss.ide.eclipse.as.runtime.40",
- "org.jboss.ide.eclipse.as.runtime.42",
- "org.jboss.ide.eclipse.as.runtime.50"
- };
+ "org.jboss.ide.eclipse.as.runtime.32",
+ "org.jboss.ide.eclipse.as.runtime.40",
+ "org.jboss.ide.eclipse.as.runtime.42",
+ "org.jboss.ide.eclipse.as.runtime.50" };
public static final String JBOSS_AS_TYPE_ID[] = {
- "org.jboss.ide.eclipse.as.32",
- "org.jboss.ide.eclipse.as.40",
- "org.jboss.ide.eclipse.as.42",
- "org.jboss.ide.eclipse.as.50"
- };
-
+ "org.jboss.ide.eclipse.as.32", "org.jboss.ide.eclipse.as.40",
+ "org.jboss.ide.eclipse.as.42", "org.jboss.ide.eclipse.as.50" };
public static final String JBOSS_AS_NAME[] = {
- "JBoss Application Server 3.2",
- "JBoss Application Server 4.0",
- "JBoss Application Server 4.2",
- "JBoss Application Server 5.0"
- };
-
+ "JBoss Application Server 3.2", "JBoss Application Server 4.0",
+ "JBoss Application Server 4.2", "JBoss Application Server 5.0" };
+
private static final int installedASIndex = 2;
public static final String JBOSS_AS_HOST = "localhost";
@@ -92,93 +85,81 @@
public static final String FIRST_START_PREFERENCE_NAME = "FIRST_START";
- public static final String HSQL_DRIVER_DEFINITION_ID
- = "DriverDefn.Hypersonic DB";
+ public static final String HSQL_DRIVER_DEFINITION_ID = "DriverDefn.Hypersonic
DB";
public static final String HSQL_DRIVER_NAME = "Hypersonic DB";
- public static final String HSQL_DRIVER_TEMPLATE_ID
- = "org.eclipse.datatools.enablement.hsqldb.1_8.driver";
+ public static final String HSQL_DRIVER_TEMPLATE_ID =
"org.eclipse.datatools.enablement.hsqldb.1_8.driver";
- public static final String DTP_DB_URL_PROPERTY_ID
- = "org.eclipse.datatools.connectivity.db.URL";
+ public static final String DTP_DB_URL_PROPERTY_ID =
"org.eclipse.datatools.connectivity.db.URL";
+
/**
* @see org.eclipse.ui.IStartup#earlyStartup()
*/
public void earlyStartup() {
/*
- * If there are any problems with EAP not functioning the same as
+ * If there are any problems with EAP not functioning the same as
* servers created from scratch, THIS is the method to go to.
*
* Compare this method with JBossServerWizardFragment#performFinish()
*/
try {
- JstFirstRunPlugin.getDefault().getPreferenceStore().setDefault(FIRST_START_PREFERENCE_NAME,
true);
- boolean firstStart =
JstFirstRunPlugin.getDefault().getPreferenceStore().getBoolean(FIRST_START_PREFERENCE_NAME);
+ JstFirstRunPlugin.getDefault().getPreferenceStore().setDefault(
+ FIRST_START_PREFERENCE_NAME, true);
+ boolean firstStart = JstFirstRunPlugin.getDefault()
+ .getPreferenceStore().getBoolean(
+ FIRST_START_PREFERENCE_NAME);
+
if (!firstStart) {
return;
}
- JstFirstRunPlugin.getDefault().getPreferenceStore().setValue(FIRST_START_PREFERENCE_NAME,
false);
- String pluginLocation =
FileLocator.resolve(JstFirstRunPlugin.getDefault().getBundle().getEntry("/")).getPath();
- File serversFile = new File(pluginLocation, SERVERS_FILE).getCanonicalFile();
- if(serversFile.exists()){
- String str = FileUtil.readFile(serversFile);
+ JstFirstRunPlugin.getDefault().getPreferenceStore().setValue(
+ FIRST_START_PREFERENCE_NAME, false);
+ String pluginLocation = FileLocator.resolve(
+ JstFirstRunPlugin.getDefault().getBundle().getEntry("/"))
+ .getPath();
+ File serversFile = new File(pluginLocation, SERVERS_FILE)
+ .getCanonicalFile();
+ if (serversFile.exists()) {
+ Properties servers = new Properties();
+ servers.load(new BufferedInputStream(new FileInputStream(serversFile)));
int position = 0;
- while(true){
+ for (Object iterable_element : servers.keySet()) {
+ String str = servers.getProperty(iterable_element.toString());
String jbossASLocation = null;
-
- // server name
- int namePosition = str.indexOf("=",position+1);
- if(namePosition < 0) break;
-
- // server type
- int typePosition = str.indexOf(",",namePosition+1);
- if(position < 0) break;
-
- String name = str.substring(namePosition+1,typePosition).trim();
+ String[] params = str.split(",");
- // server version
- int versionPosition = str.indexOf(",",typePosition+1);
- if(versionPosition < 0) break;
+ String name = params[0];
+ String type = params[1];
+ String version = params[2];
+ jbossASLocation = params[3].trim();
- String type = str.substring(typePosition+1,versionPosition).trim();
-
- // server location
- position = str.indexOf(",",versionPosition+1);
- if(position < 0) break;
-
- String version = str.substring(versionPosition+1,position);
-
int index = 0;
- if(type.startsWith("AS")){
- if(version.startsWith("3.2"))
+ if (type.startsWith("AS")) {
+ if (version.startsWith("3.2")) {
index = 0;
- else if(version.startsWith("4.0"))
+ } else if (version.startsWith("4.0")) {
index = 1;
- else if(version.startsWith("4.2") ||
version.startsWith("4.3"))
+ } else if (version.startsWith("4.2")
+ || version.startsWith("4.3")) {
index = 2;
- else if(version.startsWith("5.0"))
+ } else if (version.startsWith("5.0")) {
index = 3;
- }else
+ }
+ } else {
index = 2;
+ }
+
+ if (!"AS".equals(type)) {
+ jbossASLocation = jbossASLocation + File.separatorChar + "jboss-as";
+ }
- int next = str.indexOf("server",position+1);
+ IRuntime runtime = createRuntime(name + " Runtime",
+ jbossASLocation, new NullProgressMonitor(), index);
- if(next < 0)
- jbossASLocation = str.substring(position+1,str.length()-1);
- else
- jbossASLocation = str.substring(position+1,next);
-
- jbossASLocation = jbossASLocation.trim();
-
- IRuntime runtime = null;
- IProgressMonitor progressMonitor = new NullProgressMonitor();
- if (runtime == null) {
- runtime = createRuntime(name + " Runtime", jbossASLocation,
progressMonitor, index);
- }
if (runtime != null) {
- createServer(progressMonitor, runtime, index, name);
+ createServer(new NullProgressMonitor(), runtime, index, name);
}
createDriver(jbossASLocation);
@@ -186,8 +167,9 @@
}
String jbossASLocation = null;
-
- File jbossASDir = new File(pluginLocation, JBOSS_AS_HOME).getCanonicalFile();
+
+ File jbossASDir = new File(pluginLocation, JBOSS_AS_HOME)
+ .getCanonicalFile();
if (jbossASDir.isDirectory()) {
jbossASLocation = jbossASDir.getAbsolutePath();
} else {
@@ -199,7 +181,8 @@
IServer[] servers = ServerCore.getServers();
for (int i = 0; i < servers.length; i++) {
IRuntime runtime = servers[i].getRuntime();
- if(runtime != null && runtime.getLocation().equals(jbossAsLocationPath)) {
+ if (runtime != null
+ && runtime.getLocation().equals(jbossAsLocationPath)) {
return;
}
}
@@ -215,7 +198,8 @@
IProgressMonitor progressMonitor = new NullProgressMonitor();
if (runtime == null) {
- runtime = createRuntime(null, jbossASLocation, progressMonitor, 2);
+ runtime = createRuntime(null, jbossASLocation, progressMonitor,
+ 2);
}
if (runtime != null) {
createServer(progressMonitor, runtime, 2, null);
@@ -223,28 +207,42 @@
createDriver(jbossASLocation);
} catch (CoreException e) {
- JstFirstRunPlugin.getPluginLog().log(new Status(IStatus.ERROR,
- JstFirstRunPlugin.PLUGIN_ID, "Can't create new JBoss Server", e));
+ JstFirstRunPlugin.getPluginLog().log(
+ new Status(IStatus.ERROR, JstFirstRunPlugin.PLUGIN_ID,
+ "Can't create new JBoss Server", e));
} catch (IOException e) {
- JstFirstRunPlugin.getPluginLog().log(new Status(IStatus.ERROR,
- JstFirstRunPlugin.PLUGIN_ID, "Can't create new JBoss Server", e));
+ JstFirstRunPlugin.getPluginLog().log(
+ new Status(IStatus.ERROR, JstFirstRunPlugin.PLUGIN_ID,
+ "Can't create new JBoss Server", e));
} catch (ConnectionProfileException e) {
- JstFirstRunPlugin.getPluginLog().log(new Status(IStatus.ERROR,
- JstFirstRunPlugin.PLUGIN_ID, "Can't create new DTP "
- + "Connection Profile for JBoss AS Hypersonic embedded database", e));
+ JstFirstRunPlugin
+ .getPluginLog()
+ .log(
+ new Status(
+ IStatus.ERROR,
+ JstFirstRunPlugin.PLUGIN_ID,
+ "Can't create new DTP "
+ + "Connection Profile for JBoss AS Hypersonic embedded database",
+ e));
}
}
/**
* Creates new JBoss AS Runtime, Server and hsqldb driver
- * @param jbossASLocation location of JBoss Server
- * @param progressMonitor to report progress
+ *
+ * @param jbossASLocation
+ * location of JBoss Server
+ * @param progressMonitor
+ * to report progress
* @return server working copy
* @throws CoreException
* @throws ConnectionProfileException
*/
- public static IServerWorkingCopy initJBossAS(String jbossASLocation, IProgressMonitor
progressMonitor) throws CoreException, ConnectionProfileException {
- IRuntime runtime = createRuntime(null, jbossASLocation, progressMonitor, 2);
+ public static IServerWorkingCopy initJBossAS(String jbossASLocation,
+ IProgressMonitor progressMonitor) throws CoreException,
+ ConnectionProfileException {
+ IRuntime runtime = createRuntime(null, jbossASLocation,
+ progressMonitor, 2);
IServerWorkingCopy server = null;
if (runtime != null) {
server = createServer(progressMonitor, runtime, 2, null);
@@ -255,31 +253,40 @@
/**
* Creates new JBoss AS Runtime
- * @param jbossASLocation location of JBoss AS
+ *
+ * @param jbossASLocation
+ * location of JBoss AS
* @param progressMonitor
* @return runtime working copy
* @throws CoreException
*/
- private static IRuntime createRuntime(String runtimeName, String jbossASLocation,
IProgressMonitor progressMonitor, int index) throws CoreException {
+ private static IRuntime createRuntime(String runtimeName,
+ String jbossASLocation, IProgressMonitor progressMonitor, int index)
+ throws CoreException {
IRuntimeWorkingCopy runtime = null;
String type = null;
String version = null;
String runtimeId = null;
IPath jbossAsLocationPath = new Path(jbossASLocation);
- IRuntimeType[] runtimeTypes = ServerUtil.getRuntimeTypes(type, version,
JBOSS_AS_RUNTIME_TYPE_ID[index]);
+ IRuntimeType[] runtimeTypes = ServerUtil.getRuntimeTypes(type, version,
+ JBOSS_AS_RUNTIME_TYPE_ID[index]);
if (runtimeTypes.length > 0) {
runtime = runtimeTypes[0].createRuntime(runtimeId, progressMonitor);
runtime.setLocation(jbossAsLocationPath);
- if(runtimeName!=null) {
- runtime.setName(runtimeName);
+ if (runtimeName != null) {
+ runtime.setName(runtimeName);
}
IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();
// IJBossServerRuntime.PROPERTY_VM_ID
- ((RuntimeWorkingCopy) runtime).setAttribute("PROPERTY_VM_ID",
defaultVM.getId());
+ ((RuntimeWorkingCopy) runtime).setAttribute("PROPERTY_VM_ID",
+ defaultVM.getId());
// IJBossServerRuntime.PROPERTY_VM_TYPE_ID
- ((RuntimeWorkingCopy) runtime).setAttribute("PROPERTY_VM_TYPE_ID",
defaultVM.getVMInstallType().getId());
+ ((RuntimeWorkingCopy) runtime).setAttribute("PROPERTY_VM_TYPE_ID",
+ defaultVM.getVMInstallType().getId());
// IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME
- ((RuntimeWorkingCopy)
runtime).setAttribute("org.jboss.ide.eclipse.as.core.runtime.configurationName",
JBOSS_AS_DEFAULT_CONFIGURATION_NAME);
+ ((RuntimeWorkingCopy) runtime).setAttribute(
+ "org.jboss.ide.eclipse.as.core.runtime.configurationName",
+ JBOSS_AS_DEFAULT_CONFIGURATION_NAME);
return runtime.save(false, progressMonitor);
}
@@ -288,32 +295,49 @@
/**
* Creates new JBoss Server
+ *
* @param progressMonitor
- * @param runtime parent JBoss AS Runtime
+ * @param runtime
+ * parent JBoss AS Runtime
* @return server working copy
* @throws CoreException
*/
- private static IServerWorkingCopy createServer(IProgressMonitor progressMonitor,
IRuntime runtime, int index, String name) throws CoreException {
- IServerType serverType = ServerCore.findServerType(JBOSS_AS_TYPE_ID[index]);
- IServerWorkingCopy server = serverType.createServer(null, null, runtime,
progressMonitor);
+ private static IServerWorkingCopy createServer(
+ IProgressMonitor progressMonitor, IRuntime runtime, int index,
+ String name) throws CoreException {
+ IServerType serverType = ServerCore
+ .findServerType(JBOSS_AS_TYPE_ID[index]);
+ IServerWorkingCopy server = serverType.createServer(null, null,
+ runtime, progressMonitor);
server.setHost(JBOSS_AS_HOST);
- if(name != null)
+ if (name != null) {
server.setName(name);
- else
+ } else {
server.setName(JBOSS_AS_NAME[installedASIndex]);
-
+ }
+
// JBossServer.DEPLOY_DIRECTORY
- String deployVal =
runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("deploy").toOSString();
- ((ServerWorkingCopy)
server).setAttribute("org.jboss.ide.eclipse.as.core.server.deployDirectory",
deployVal);
+ String deployVal = runtime.getLocation().append("server").append(
+ JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("deploy")
+ .toOSString();
+ ((ServerWorkingCopy) server).setAttribute(
+ "org.jboss.ide.eclipse.as.core.server.deployDirectory",
+ deployVal);
// IDeployableServer.TEMP_DEPLOY_DIRECTORY
- String deployTmpFolderVal =
runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("tmp").append("jbosstoolsTemp").toOSString();
- ((ServerWorkingCopy)
server).setAttribute("org.jboss.ide.eclipse.as.core.server.tempDeployDirectory",
deployTmpFolderVal);
+ String deployTmpFolderVal = runtime.getLocation().append("server")
+ .append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("tmp")
+ .append("jbosstoolsTemp").toOSString();
+ ((ServerWorkingCopy) server).setAttribute(
+ "org.jboss.ide.eclipse.as.core.server.tempDeployDirectory",
+ deployTmpFolderVal);
// If we'd need to set up a username / pw for JMX, do it here.
-// ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_USERNAME, authUser);
-// ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_PASSWORD, authPass);
+ // ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_USERNAME,
+ // authUser);
+ // ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_PASSWORD,
+ // authPass);
server.save(false, progressMonitor);
return server;
@@ -323,28 +347,36 @@
/**
* Creates HSQL DB Driver
- * @param jbossASLocation location of JBoss AS
+ *
+ * @param jbossASLocation
+ * location of JBoss AS
* @throws ConnectionProfileException
* @return driver instance
*/
- private static void createDriver(String jbossASLocation) throws
ConnectionProfileException {
- if(driverIsCreated) {
+ private static void createDriver(String jbossASLocation)
+ throws ConnectionProfileException {
+ if (driverIsCreated) {
// Don't create the driver a few times
return;
}
String driverPath;
try {
- driverPath = new File(jbossASLocation +
"/server/default/lib/hsqldb.jar").getCanonicalPath();
+ driverPath = new File(jbossASLocation
+ + "/server/default/lib/hsqldb.jar").getCanonicalPath();
} catch (IOException e) {
- JstFirstRunPlugin.getPluginLog().log(new Status(IStatus.ERROR,
- JstFirstRunPlugin.PLUGIN_ID, "Can't create new HSQL DB Driver.", e));
+ JstFirstRunPlugin.getPluginLog().log(
+ new Status(IStatus.ERROR, JstFirstRunPlugin.PLUGIN_ID,
+ "Can't create new HSQL DB Driver.", e));
return;
}
- DriverInstance driver =
DriverManager.getInstance().getDriverInstanceByName(HSQL_DRIVER_NAME);
+ DriverInstance driver = DriverManager.getInstance()
+ .getDriverInstanceByName(HSQL_DRIVER_NAME);
if (driver == null) {
- TemplateDescriptor descr =
TemplateDescriptor.getDriverTemplateDescriptor(HSQL_DRIVER_TEMPLATE_ID);
- IPropertySet instance = new PropertySetImpl(HSQL_DRIVER_NAME,
HSQL_DRIVER_DEFINITION_ID);
+ TemplateDescriptor descr = TemplateDescriptor
+ .getDriverTemplateDescriptor(HSQL_DRIVER_TEMPLATE_ID);
+ IPropertySet instance = new PropertySetImpl(HSQL_DRIVER_NAME,
+ HSQL_DRIVER_DEFINITION_ID);
instance.setName(HSQL_DRIVER_NAME);
instance.setID(HSQL_DRIVER_DEFINITION_ID);
Properties props = new Properties();
@@ -358,8 +390,10 @@
props.setProperty(id, value == null ? "" : value);
}
props.setProperty(DTP_DB_URL_PROPERTY_ID, "jdbc:hsqldb:.");
- props.setProperty(IDriverMgmtConstants.PROP_DEFN_TYPE, descr.getId());
- props.setProperty(IDriverMgmtConstants.PROP_DEFN_JARLIST, driverPath);
+ props.setProperty(IDriverMgmtConstants.PROP_DEFN_TYPE, descr
+ .getId());
+ props.setProperty(IDriverMgmtConstants.PROP_DEFN_JARLIST,
+ driverPath);
instance.setBaseProperties(props);
DriverManager.getInstance().removeDriverInstance(instance.getID());
@@ -367,24 +401,59 @@
DriverManager.getInstance().addDriverInstance(instance);
}
- driver = DriverManager.getInstance().getDriverInstanceByName(HSQL_DRIVER_NAME);
- if (driver != null &&
ProfileManager.getInstance().getProfileByName("DefaultDS") == null) {
+ driver = DriverManager.getInstance().getDriverInstanceByName(
+ HSQL_DRIVER_NAME);
+ if (driver != null
+ && ProfileManager.getInstance().getProfileByName("DefaultDS") ==
null) {
// create profile
Properties props = new Properties();
- props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID,
HSQL_DRIVER_DEFINITION_ID);
- props.setProperty(IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID,
"");
- props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID,
driver.getProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID));
- props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID));
- props.setProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID,
driver.getProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID));
- props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID,
"Default");
- props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, "");
- props.setProperty(IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID,
"false");
- props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID,
driver.getProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID));
- props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID,
driver.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID));
+ props.setProperty(
+ ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID,
+ HSQL_DRIVER_DEFINITION_ID);
+ props
+ .setProperty(
+ IJDBCConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID,
+ "");
+ props
+ .setProperty(
+ IJDBCDriverDefinitionConstants.DRIVER_CLASS_PROP_ID,
+ driver
+ .getProperty(IJDBCDriverDefinitionConstants.DRIVER_CLASS_PROP_ID));
+ props
+ .setProperty(
+ IJDBCDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID,
+ driver
+ .getProperty(IJDBCDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID));
+ props
+ .setProperty(
+ IJDBCDriverDefinitionConstants.DATABASE_VERSION_PROP_ID,
+ driver
+ .getProperty(IJDBCDriverDefinitionConstants.DATABASE_VERSION_PROP_ID));
+ props.setProperty(
+ IJDBCDriverDefinitionConstants.DATABASE_NAME_PROP_ID,
+ "Default");
+ props.setProperty(IJDBCDriverDefinitionConstants.PASSWORD_PROP_ID,
+ "");
+ props.setProperty(
+ IJDBCConnectionProfileConstants.SAVE_PASSWORD_PROP_ID,
+ "false");
+ props
+ .setProperty(
+ IJDBCDriverDefinitionConstants.USERNAME_PROP_ID,
+ driver
+ .getProperty(IJDBCDriverDefinitionConstants.USERNAME_PROP_ID));
+ props
+ .setProperty(
+ IJDBCDriverDefinitionConstants.URL_PROP_ID,
+ driver
+ .getProperty(IJDBCDriverDefinitionConstants.URL_PROP_ID));
- ProfileManager.getInstance().createProfile("DefaultDS", "The JBoss AS
Hypersonic embedded database", IDBConnectionProfileConstants.CONNECTION_PROFILE_ID,
props, "", false);
+ ProfileManager.getInstance().createProfile("DefaultDS",
+ "The JBoss AS Hypersonic embedded database",
+ IJDBCConnectionProfileConstants.CONNECTION_PROFILE_ID,
+ props, "", false);
}
- if(driver!=null) {
+ if (driver != null) {
driverIsCreated = true;
}
}