Author: dgolovin
Date: 2007-10-31 14:30:34 -0400 (Wed, 31 Oct 2007)
New Revision: 4603
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/DataSourceXmlDeployer.java
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/Seam2FacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreInstallDelegate.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1228
dialect combo removed from page
http://jira.jboss.org/jira/browse/JBIDE-1198
ds.xml now is placed in resources folder and published by JBoss AS adapter. So you can see
ds.xml in server view for WAR and EAR deployment configuration
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/DataSourceXmlDeployer.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/DataSourceXmlDeployer.java 2007-10-31
18:10:04 UTC (rev 4602)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/DataSourceXmlDeployer.java 2007-10-31
18:30:34 UTC (rev 4603)
@@ -22,6 +22,7 @@
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.server.core.IModule;
@@ -36,44 +37,30 @@
/**
* This class is provided to deploy data source descriptor to JBoss AS for Seam
- * Web Project in WAR deployment configuration.
+ * Web Project in WAR and EAR deployment configurations.
*
* @author eskimo
*
*/
public class DataSourceXmlDeployer extends Job {
IProject project = null;
-
- public DataSourceXmlDeployer(IProject project) {
+ IServer s = null;
+ IPath deploy = null;
+ public DataSourceXmlDeployer(IProject project, IServer s, IPath deploy) {
super(SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_DEPLOYING_DATASOURCE_TO_SERVER);
this.project = project;
+ // is must be user since ds.xml has the same behaviour for EAR
+ // deployment. It should run after ear project created and imported into
+ // workspace
+ setUser(true);
+ setRule(project);
+ this.s = s;
+ this.deploy = deploy;
}
@Override
protected IStatus run(IProgressMonitor monitor) {
- IFacetedProject facetedProject;
- try {
- facetedProject = ProjectFacetsManager.create(project);
- } catch (CoreException e) {
- return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
- SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_NO_SERVER_SELECTED_TO_DEPLOY_DATASOURCE_TO);
- }
- org.eclipse.wst.common.project.facet.core.runtime.IRuntime primaryRuntime =
facetedProject
- .getPrimaryRuntime();
- IServer s = null;
- IServer[] servers = ServerCore.getServers();
- for (IServer server : servers) {
- String primaryName = primaryRuntime.getName();
- IRuntime runtime = server.getRuntime();
- if (runtime != null) {
- String serverName = runtime.getName();
- if (primaryName.equals(serverName)) {
- s = server;
- }
- }
- }
-
if (s == null) {
return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_NO_SERVER_SELECTED_TO_DEPLOY_DATASOURCE_TO);
@@ -88,18 +75,10 @@
SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_SERVER_DID_NOT_SUPPORT_DEPLOY_OF_DATASOURCE);
}
- IVirtualComponent com = ComponentCore.createComponent(project);
- final IVirtualFolder srcRootFolder = com.getRootFolder().getFolder(
- new Path("/WEB-INF/classes")); //$NON-NLS-1$
- IContainer underlyingFolder = srcRootFolder.getUnderlyingFolder();
-
IPath projectPath = new Path("/" //$NON-NLS-1$
- + underlyingFolder.getProject().getName());
- IPath projectRelativePath = new Path("src/model"); //$NON-NLS-1$
+ + project.getName());
+ IPath append = projectPath.append(deploy); //$NON-NLS-1$
- IPath append = projectPath.append(projectRelativePath).append(
- project.getName() + "-ds.xml"); //$NON-NLS-1$
-
if (SingleDeployableFactory.makeDeployable(append)) {
IModule module = SingleDeployableFactory.findModule(append);
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 2007-10-31
18:10:04 UTC (rev 4602)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2007-10-31
18:30:34 UTC (rev 4603)
@@ -86,5 +86,8 @@
public static final String DEPLOY_AS_EAR = "ear"; //$NON-NLS-1$
public static final String JBOSS_AS_TARGET_SERVER =
"seam.project.deployment.target"; //$NON-NLS-1$
+
public static final String JBOSS_AS_TARGET_RUNTIME =
"seam.project.deployment.runtime"; //$NON-NLS-1$
+
+
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2007-10-31
18:10:04 UTC (rev 4602)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2007-10-31
18:30:34 UTC (rev 4603)
@@ -339,9 +339,10 @@
new File(srcFolder,"META-INF/persistence.xml"), //$NON-NLS-1$
viewFilterSetCollection, true);
+ File resources = new File(project.getLocation().toFile(),"resources");
AntCopyUtils.copyFileToFile(
dataSourceDsFile,
- new File(srcFolder,project.getName()+"-ds.xml"), //$NON-NLS-1$
+ new File(resources,project.getName()+"-ds.xml"), //$NON-NLS-1$
viewFilterSetCollection, true);
AntCopyUtils.copyFileToFile(
@@ -356,11 +357,6 @@
WtpUtils.setClasspathEntryAsExported(project, new
Path("org.eclipse.jst.j2ee.internal.web.container"), monitor); //$NON-NLS-1$
- Job create = new DataSourceXmlDeployer(project);
- create.setUser(true);
- create.setRule(ResourcesPlugin.getWorkspace().getRoot());
- create.schedule();
-
} else {
model.setProperty(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT,
project.getName()+"-ejb"); //$NON-NLS-1$
model.setProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT,
project.getName()+"-ear"); //$NON-NLS-1$
@@ -417,9 +413,10 @@
//
********************************************************************************************
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"),
new File(ejb,"ejbModule/"), true); //$NON-NLS-1$ //$NON-NLS-2$
+ File resources = new File(ear,"resources");
AntCopyUtils.copyFileToFile(
dataSourceDsFile,
- new File(ejb,"ejbModule/"+project.getName()+"-ds.xml"),
//$NON-NLS-1$ //$NON-NLS-2$
+ new File(resources,project.getName()+"-ds.xml"), //$NON-NLS-1$
//$NON-NLS-2$
viewFilterSetCollection, true);
AntCopyUtils.copyFileToFolder(
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2007-10-31
18:10:04 UTC (rev 4602)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2007-10-31
18:30:34 UTC (rev 4603)
@@ -332,9 +332,10 @@
new File(srcFolder,"META-INF/persistence.xml"), //$NON-NLS-1$
viewFilterSetCollection, true);
+ File resources = new File(project.getLocation().toFile(),"resources");
AntCopyUtils.copyFileToFile(
dataSourceDsFile,
- new File(srcFolder,project.getName()+"-ds.xml"), //$NON-NLS-1$
+ new File(resources,project.getName()+"-ds.xml"), //$NON-NLS-1$
viewFilterSetCollection, true);
AntCopyUtils.copyFileToFile(
@@ -349,11 +350,6 @@
WtpUtils.setClasspathEntryAsExported(project, new
Path("org.eclipse.jst.j2ee.internal.web.container"), monitor); //$NON-NLS-1$
- Job create = new DataSourceXmlDeployer(project);
- create.setUser(true);
- create.setRule(ResourcesPlugin.getWorkspace().getRoot());
- create.schedule();
-
} else {
model.setProperty(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT,
project.getName()+"-ejb"); //$NON-NLS-1$
model.setProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT,
project.getName()+"-ear"); //$NON-NLS-1$
@@ -410,10 +406,7 @@
//
********************************************************************************************
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"),
new File(ejb,"ejbModule/"), true); //$NON-NLS-1$ //$NON-NLS-2$
- AntCopyUtils.copyFileToFile(
- dataSourceDsFile,
- new File(ejb,"ejbModule/"+project.getName()+"-ds.xml"),
//$NON-NLS-1$ //$NON-NLS-2$
- viewFilterSetCollection, true);
+
AntCopyUtils.copyFileToFolder(
new File(seamGenResFolder,"META-INF/ejb-jar.xml"), //$NON-NLS-1$
@@ -461,6 +454,13 @@
AntCopyUtils.copyFiles(seamLibFolder,earContentsFolder,new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
AntCopyUtils.copyFiles(seamGenResFolder,earContentsFolder,new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamGenResFolder)));
+
+ File resources = new File(ear,"resources");
+ AntCopyUtils.copyFileToFile(
+ dataSourceDsFile,
+ new File(resources,project.getName()+"-ds.xml"), //$NON-NLS-1$
//$NON-NLS-2$
+ viewFilterSetCollection, true);
+
try {
File[] earJars = earContentsFolder.listFiles(new FilenameFilter() {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java 2007-10-31
18:10:04 UTC (rev 4602)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java 2007-10-31
18:30:34 UTC (rev 4603)
@@ -16,8 +16,10 @@
import org.apache.tools.ant.types.FilterSet;
import org.apache.tools.ant.types.FilterSetCollection;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -35,6 +37,7 @@
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.tools.common.util.ResourcesUtils;
import org.jboss.tools.jst.web.server.RegistrationHelper;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.osgi.service.prefs.BackingStoreException;
@@ -58,10 +61,20 @@
if( jbs != null ) {
String[] driverJars =
(String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH);
String configFolder = jbs.getConfigDirectory();
- AntCopyUtils.copyFiles(driverJars, new File(configFolder,"lib"));
+ AntCopyUtils.copyFiles(driverJars, new File(configFolder,"lib"),false);
}
if (server != null) {
RegistrationHelper.runRegisterInServerJob(project, server);
+
+ IPath filePath = new Path("resources").append(project.getName() +
"-ds.xml");
+
+ if(!isWarConfiguration(model)) {
+ IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IProject earProjectToBeImported =
wsRoot.getProject(project.getName()+"-ear");
+ new DataSourceXmlDeployer(earProjectToBeImported,server,filePath).schedule();
+ } else {
+ new DataSourceXmlDeployer(project,server,filePath).schedule();
+ }
}
}
@@ -70,4 +83,8 @@
*/
public Object create() throws CoreException {return null; }
+ public static boolean isWarConfiguration(IDataModel model) {
+ return
"war".equals(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS));
//$NON-NLS-1$
+ }
+
}
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 2007-10-31
18:10:04 UTC (rev 4602)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreInstallDelegate.java 2007-10-31
18:30:34 UTC (rev 4603)
@@ -31,30 +31,31 @@
public void execute(IProject project, IProjectFacetVersion fv,
Object config, IProgressMonitor monitor) throws CoreException {
IDataModel model = (IDataModel)config;
- if(model.getProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE)==null)
return;
- IConnectionProfile connProfile =
ProfileManager.getInstance().getProfileByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE).toString());
- Properties props = connProfile.getBaseProperties();
//Properties("org.eclipse.datatools.connectivity.db.generic.connectionProfile");
- // Collect properties name from DTP Connection Profile
- model.setProperty(ISeamFacetDataModelProperties.DB_USER_NAME,
- props.get("org.eclipse.datatools.connectivity.db.username")==null
//$NON-NLS-1$
- ?"":props.get("org.eclipse.datatools.connectivity.db.username").toString());
//$NON-NLS-1$ //$NON-NLS-2$
-
- model.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_CLASS_NAME,
- props.get("org.eclipse.datatools.connectivity.db.driverClass")==null
//$NON-NLS-1$
- ?"":props.get("org.eclipse.datatools.connectivity.db.driverClass").toString());
//$NON-NLS-1$ //$NON-NLS-2$
-
- model.setProperty(ISeamFacetDataModelProperties.DB_USER_PASSWORD,
- props.get("org.eclipse.datatools.connectivity.db.password")==null
//$NON-NLS-1$
- ?"":props.get("org.eclipse.datatools.connectivity.db.password").toString());
//$NON-NLS-1$ //$NON-NLS-2$
-
- model.setProperty(ISeamFacetDataModelProperties.JDBC_URL_FOR_DB,
- props.get("org.eclipse.datatools.connectivity.db.URL")==null //$NON-NLS-1$
- ?"":props.get("org.eclipse.datatools.connectivity.db.URL").toString());
//$NON-NLS-1$ //$NON-NLS-2$
-
- model.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH,
- DriverManager.getInstance().getDriverInstanceByID(
- props.get("org.eclipse.datatools.connectivity.driverDefinitionID").toString()).getJarListAsArray());
//$NON-NLS-1$
-
+ if(model.getProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE)!=null) {
+ IConnectionProfile connProfile =
ProfileManager.getInstance().getProfileByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE).toString());
+ Properties props = connProfile.getBaseProperties();
//Properties("org.eclipse.datatools.connectivity.db.generic.connectionProfile");
+
+ // Collect properties name from DTP Connection Profile
+ model.setProperty(ISeamFacetDataModelProperties.DB_USER_NAME,
+ props.get("org.eclipse.datatools.connectivity.db.username")==null
//$NON-NLS-1$
+ ?"":props.get("org.eclipse.datatools.connectivity.db.username").toString());
//$NON-NLS-1$ //$NON-NLS-2$
+
+ model.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_CLASS_NAME,
+ props.get("org.eclipse.datatools.connectivity.db.driverClass")==null
//$NON-NLS-1$
+ ?"":props.get("org.eclipse.datatools.connectivity.db.driverClass").toString());
//$NON-NLS-1$ //$NON-NLS-2$
+
+ model.setProperty(ISeamFacetDataModelProperties.DB_USER_PASSWORD,
+ props.get("org.eclipse.datatools.connectivity.db.password")==null
//$NON-NLS-1$
+ ?"":props.get("org.eclipse.datatools.connectivity.db.password").toString());
//$NON-NLS-1$ //$NON-NLS-2$
+
+ model.setProperty(ISeamFacetDataModelProperties.JDBC_URL_FOR_DB,
+ props.get("org.eclipse.datatools.connectivity.db.URL")==null
//$NON-NLS-1$
+ ?"":props.get("org.eclipse.datatools.connectivity.db.URL").toString());
//$NON-NLS-1$ //$NON-NLS-2$
+
+ model.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH,
+ DriverManager.getInstance().getDriverInstanceByID(
+ props.get("org.eclipse.datatools.connectivity.driverDefinitionID").toString()).getJarListAsArray());
//$NON-NLS-1$
+ }
}
}