Author: akazakov
Date: 2012-08-27 20:02:01 -0400 (Mon, 27 Aug 2012)
New Revision: 43259
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23FacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
trunk/seam/tests/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetOnExistingProjectTest.java
Log:
https://issues.jboss.org/browse/JBIDE-12491 JBT Doesn't place the JDBC Driver
correctly
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2012-08-27
22:13:54 UTC (rev 43258)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2012-08-28
00:02:01 UTC (rev 43259)
@@ -242,10 +242,15 @@
String HIBERNATE_HBM2DDL_AUTO = "hibernate.hbm2ddl.auto"; //$NON-NLS-1$
/**
- * Driver file name
+ * Driver file names
*/
- String JDBC_DRIVER_JAR_PATH = "driver.file"; //$NON-NLS-1$
+ String JDBC_DRIVER_JAR_PATHS_ARRAY = "driver.files.array"; //$NON-NLS-1$
+ /**
+ * Driver file name
+ */
+ String JDBC_DRIVER_JAR_NAME = "driver.file"; //$NON-NLS-1$
+
// TODO: should be moved to org.jboss.tools.seam.ui.wizard.IParameter
// why is this a property when it is always derivable from sesion_bean_package_name ?
String SESSION_BEAN_PACKAGE_PATH = "action.package.path"; //$NON-NLS-1$
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23FacetInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23FacetInstallDelegate.java 2012-08-27
22:13:54 UTC (rev 43258)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23FacetInstallDelegate.java 2012-08-28
00:02:01 UTC (rev 43259)
@@ -191,7 +191,7 @@
* @param destFolder
*/
public static void copyDBDriverToProject(IProject project, IDataModel model, File
destFolder) {
- Object drvrs = model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH);
+ Object drvrs =
model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATHS_ARRAY);
if(drvrs!=null) {
String[] drvrsStrings = (String[])drvrs;
if(drvrsStrings.length>0) {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2012-08-27
22:13:54 UTC (rev 43258)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2012-08-28
00:02:01 UTC (rev 43259)
@@ -882,8 +882,8 @@
if(serverRuntimeName!=null) {
ejbFilterSet.addFilter("runtimeName", serverRuntimeName); //$NON-NLS-1$
}
- if (model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH) != null) {
- File driver = new File(((String[])
model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH))[0]);
+ if (model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATHS_ARRAY) !=
null) {
+ File driver = new File(((String[])
model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATHS_ARRAY))[0]);
ejbFilterSet.addFilter("driverJar", " " + driver.getName() +
"\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
viewFilterSetCollection.addFilterSet(getDriverFilterSet(model));
} else {
@@ -915,8 +915,8 @@
}
public static FilterSet getDriverFilterSet(IDataModel model) {
- if (model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH) != null) {
- File driver = new File(((String[])
model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH))[0]);
+ if (model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATHS_ARRAY) !=
null) {
+ File driver = new File(((String[])
model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATHS_ARRAY))[0]);
FilterSet dbTypeFilterSet = new FilterSet();
dbTypeFilterSet.addFilter("database.type", driver.getName());
return dbTypeFilterSet;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2012-08-27
22:13:54 UTC (rev 43258)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2012-08-28
00:02:01 UTC (rev 43259)
@@ -72,7 +72,8 @@
names.add(ISeamFacetDataModelProperties.DB_ALREADY_EXISTS);
names.add(ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY);
- names.add(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH);
+ names.add(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATHS_ARRAY);
+ names.add(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_NAME);
// Code generation group
names.add(ISeamFacetDataModelProperties.SESSION_BEAN_SOURCE_FOLDER);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreInstallDelegate.java 2012-08-27
22:13:54 UTC (rev 43258)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreInstallDelegate.java 2012-08-28
00:02:01 UTC (rev 43259)
@@ -11,6 +11,7 @@
package org.jboss.tools.seam.internal.core.project.facet;
+import java.io.File;
import java.util.Properties;
import org.eclipse.core.resources.IProject;
@@ -99,8 +100,12 @@
DriverInstance i = DriverManager.getInstance().getDriverInstanceByID(props.get(
"org.eclipse.datatools.connectivity.driverDefinitionID").toString());
//$NON-NLS-1$
if(i != null) {
- model.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH,
- i.getJarListAsArray());
+ String[] drivers = i.getJarListAsArray();
+ model.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATHS_ARRAY,
drivers);
+ if(drivers.length>0) {
+ File file = new File(drivers[0]);
+ model.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_NAME,
file.getName());
+ }
}
}
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2012-08-27
22:13:54 UTC (rev 43258)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2012-08-28
00:02:01 UTC (rev 43259)
@@ -216,8 +216,8 @@
ejbFilterSet.addFilter("testProjectName", testProjectName); //$NON-NLS-1$
ejbFilterSet.addFilter("runtimeName",
WtpUtils.getServerRuntimeName(seamWebProject)); //$NON-NLS-1$
- if (model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH) != null) {
- File driver = new File(((String[])
model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH))[0]);
+ if (model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATHS_ARRAY) !=
null) {
+ File driver = new File(((String[])
model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATHS_ARRAY))[0]);
ejbFilterSet.addFilter("driverJar", " " + driver.getName() +
"\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else {
ejbFilterSet.addFilter("driverJar", ""); //$NON-NLS-1$
//$NON-NLS-2$
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2012-08-27
22:13:54 UTC (rev 43258)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2012-08-28
00:02:01 UTC (rev 43259)
@@ -423,7 +423,7 @@
if (server != null) {
IDeployableServer jbs = (IDeployableServer)
server.loadAdapter(IDeployableServer.class, new NullProgressMonitor());
if (jbs != null) {
- String[] driverJars = (String[])
model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH);
+ String[] driverJars = (String[])
model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATHS_ARRAY);
if(driverJars!=null) {
String configFolder = jbs.getConfigDirectory();
if(model.getStringProperty(ISeamFacetDataModelProperties.SEAM_LIBRARY_PROVIDER).equals(SeamCoreMessages.SEAM_INSTALL_WIZARD_PAGE_COPY_LIBRARIES)){
Modified:
trunk/seam/tests/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2012-08-27
22:13:54 UTC (rev 43258)
+++
trunk/seam/tests/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2012-08-28
00:02:01 UTC (rev 43259)
@@ -202,7 +202,8 @@
config.setStringProperty(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME,
"org.entity.beans");
config.setStringProperty(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME,
"org.test.beans");
config.setStringProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
"noop-connection");
- config.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH, new String[] {
"noop-driver.jar" });
+ config.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATHS_ARRAY, new
String[] { "noop-driver.jar" });
+ config.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_NAME,
"noop-driver.jar");
config.setBooleanProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING,
true);
config.setBooleanProperty(ISeamFacetDataModelProperties.SEAM_TEMPLATES_AND_LIBRARIES_COPYING,
true);
return config;
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetOnExistingProjectTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetOnExistingProjectTest.java 2012-08-27
22:13:54 UTC (rev 43258)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetOnExistingProjectTest.java 2012-08-28
00:02:01 UTC (rev 43259)
@@ -75,7 +75,8 @@
config.setStringProperty(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME,
"org.entity.beans");
config.setStringProperty(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME,
"org.test.beans");
config.setStringProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
"noop-connection");
- config.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH, new String[] {
"noop-driver.jar" });
+ config.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATHS_ARRAY, new
String[] { "noop-driver.jar" });
+ config.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_NAME,
"noop-driver.jar");
config.setBooleanProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING,
true);
return config;
}