Author: akazakov
Date: 2012-05-03 20:01:57 -0400 (Thu, 03 May 2012)
New Revision: 40774
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ResourceDeployer.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23ProjectCreator.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/DataSourceXmlDeployer.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/messages.properties
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/SeamProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
Log:
https://issues.jboss.org/browse/JBIDE-11490 deploy DB driver for Seam 2.3
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/messages.properties
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/messages.properties 2012-05-03
22:59:08 UTC (rev 40773)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/messages.properties 2012-05-04
00:01:57 UTC (rev 40774)
@@ -9,7 +9,7 @@
DATA_SOURCE_XML_DEPLOYER_DEPLOYING_DATASOURCE_TO_SERVER=Deploying datasource to server
DATA_SOURCE_XML_DEPLOYER_NO_SERVER_SELECTED_TO_DEPLOY_DATASOURCE_TO=No server selected to
deploy datasource to
DATA_SOURCE_XML_DEPLOYER_SERVER_DID_NOT_SUPPORT_DEPLOY_OF_DATASOURCE=Server did not
support deploy of datasource.
-DATA_SOURCE_XML_DEPLOYER_COULD_NOT_DEPLOY_DATASOURCE=Could not deploy datasource
+DATA_SOURCE_XML_DEPLOYER_COULD_NOT_DEPLOY_DATASOURCE=Could not deploy
JAVA_SCANNER_CANNOT_GET_COMPILATION_UNIT_FOR=Cannot get compilation unit for
''{0}''
LIBRARY_SCANNER_CANNOT_PROCESS_JAVA_CLASSES=Cannot process Java Classes
SEAM_VALIDATION_CONTEXT_LINKED_RESOURCE_PATH_MUST_NOT_BE_NULL=Linked resource path must
not be null\!
Deleted:
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 2012-05-03
22:59:08 UTC (rev 40773)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/DataSourceXmlDeployer.java 2012-05-04
00:01:57 UTC (rev 40774)
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.internal.core.project.facet;
-
-import org.eclipse.core.resources.IProject;
-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;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.internal.ChainedJob;
-import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
-import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
-import org.jboss.tools.seam.core.SeamCoreMessages;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-
-/**
- * This class is provided to deploy data source descriptor to JBoss AS for Seam
- * Web Project in WAR and EAR deployment configurations.
- *
- * @author eskimo
- *
- */
-public class DataSourceXmlDeployer extends ChainedJob {
- IProject project = null;
- IServer s = null;
- IPath deploy = null;
- public DataSourceXmlDeployer(IProject project, IServer s, IPath deploy) {
- super(SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_DEPLOYING_DATASOURCE_TO_SERVER, s);
- 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(ResourcesPlugin.getWorkspace().getRoot());
- this.s = s;
- this.deploy = deploy;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
-
- if (s == null) {
- return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
- SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_NO_SERVER_SELECTED_TO_DEPLOY_DATASOURCE_TO);
- }
- // convert it to a DeployableServer instance
- DeployableServerBehavior deployer = (DeployableServerBehavior) s
- .loadAdapter(DeployableServerBehavior.class, null);
-
- // if its not null, the adaptation worked.
- if (deployer == null) {
- return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
- SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_SERVER_DID_NOT_SUPPORT_DEPLOY_OF_DATASOURCE);
- }
-
- IPath projectPath = new Path("/" //$NON-NLS-1$
- + project.getName());
- IPath append = projectPath.append(deploy); //$NON-NLS-1$
-
- if (SingleDeployableFactory.makeDeployable(append)) {
- try {
- IModule module = SingleDeployableFactory.findModule(append);
- IServerWorkingCopy copy = s.createWorkingCopy();
- copy.modifyModules(new IModule[]{module}, new IModule[0], new
NullProgressMonitor());
- IServer saved = copy.save(false, new NullProgressMonitor());
- saved.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor());
- } catch( CoreException ce ) {
- return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
- SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_COULD_NOT_DEPLOY_DATASOURCE + append,
ce);
- }
- return Status.OK_STATUS;
- } else {
- return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
- SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_COULD_NOT_DEPLOY_DATASOURCE + append);
//$NON-NLS-1$
- }
- }
-}
Copied:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ResourceDeployer.java
(from rev 40717,
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/ResourceDeployer.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ResourceDeployer.java 2012-05-04
00:01:57 UTC (rev 40774)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.project.facet;
+
+import org.eclipse.core.resources.IProject;
+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;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.internal.ChainedJob;
+import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
+import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
+import org.jboss.tools.seam.core.SeamCoreMessages;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+
+/**
+ * This class is provided to deploy data source descriptor or any other resource to JBoss
AS for Seam
+ * Web Project in WAR and EAR deployment configurations.
+ *
+ * @author eskimo
+ *
+ */
+public class ResourceDeployer extends ChainedJob {
+ IProject project = null;
+ IServer s = null;
+ IPath deploy = null;
+
+ public ResourceDeployer(IProject project, IServer s, IPath deploy) {
+ super(SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_DEPLOYING_DATASOURCE_TO_SERVER, s);
+ this.project = project;
+ // is must be user since ds.xml (or other resource which is being deployed) has the
same behaviour for EAR
+ // deployment. It should run after ear project created and imported into
+ // workspace
+ setUser(true);
+ setRule(ResourcesPlugin.getWorkspace().getRoot());
+ this.s = s;
+ this.deploy = deploy;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+
+ if (s == null) {
+ return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
+ SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_NO_SERVER_SELECTED_TO_DEPLOY_DATASOURCE_TO);
+ }
+ // convert it to a DeployableServer instance
+ DeployableServerBehavior deployer = (DeployableServerBehavior) s
+ .loadAdapter(DeployableServerBehavior.class, null);
+
+ // if its not null, the adaptation worked.
+ if (deployer == null) {
+ return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
+ SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_SERVER_DID_NOT_SUPPORT_DEPLOY_OF_DATASOURCE);
+ }
+
+ IPath projectPath = new Path("/" //$NON-NLS-1$
+ + project.getName());
+ IPath append = projectPath.append(deploy); //$NON-NLS-1$
+
+ if (SingleDeployableFactory.makeDeployable(append)) {
+ try {
+ IModule module = SingleDeployableFactory.findModule(append);
+ IServerWorkingCopy copy = s.createWorkingCopy();
+ copy.modifyModules(new IModule[]{module}, new IModule[0], new
NullProgressMonitor());
+ IServer saved = copy.save(false, new NullProgressMonitor());
+ saved.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor());
+ } catch( CoreException ce ) {
+ return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
+ SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_COULD_NOT_DEPLOY_DATASOURCE + append,
ce);
+ }
+ return Status.OK_STATUS;
+ } else {
+ return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
+ SeamCoreMessages.DATA_SOURCE_XML_DEPLOYER_COULD_NOT_DEPLOY_DATASOURCE + append);
//$NON-NLS-1$
+ }
+ }
+}
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ResourceDeployer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-05-03
22:59:08 UTC (rev 40773)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23FacetInstallDelegate.java 2012-05-04
00:01:57 UTC (rev 40774)
@@ -10,13 +10,20 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.project.facet;
+import java.io.File;
+
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.datatools.connectivity.IConnectionProfile;
-import org.eclipse.datatools.connectivity.ProfileManager;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.ChainedJob;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.tools.jst.web.server.RegistrationHelper;
+import org.jboss.tools.seam.core.SeamCorePlugin;
/**
* @author Alexey Kazakov
@@ -34,12 +41,58 @@
return;
}
if(isWarConfiguration(model)) {
-
+ File destFolder = new File(project.getLocation().toFile(), "resources");
//$NON-NLS-1$
+ copyDBDriverToProject(project, model, destFolder);
}
}
- protected static void copyDBDriverToProject() {
- String connectionProfileName = null;
- IConnectionProfile connProfile =
ProfileManager.getInstance().getProfileByName(connectionProfileName.toString());
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.Seam2FacetInstallDelegate#getProjectCreator(org.eclipse.wst.common.frameworks.datamodel.IDataModel,
org.eclipse.core.resources.IProject)
+ */
+ @Override
+ protected SeamProjectCreator getProjectCreator(IDataModel model, IProject project) {
+ return new Seam23ProjectCreator(model, project);
}
+
+ /**
+ * Copies and deploys the driver jar from connection profile to the server.
+ * @param project
+ * @param model
+ * @param destFolder
+ */
+ public static void copyDBDriverToProject(IProject project, IDataModel model, File
destFolder) {
+ Object drvrs = model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH);
+ if(drvrs!=null) {
+ String[] drvrsStrings = (String[])drvrs;
+ if(drvrsStrings.length>0) {
+ File driver = new File(drvrsStrings[0]);
+ if(driver.exists()) {
+ File dest = new File(destFolder, driver.getName());
+ AntCopyUtils.copyFileToFile(driver, dest, null, false);
+ IFile resource = null;
+ IFile[] files =
project.getWorkspace().getRoot().findFilesForLocationURI(dest.toURI());
+ for (IFile file : files) {
+ if(project.equals(file.getProject())) {
+ resource = file;
+ break;
+ }
+ }
+ if(resource != null) {
+ try {
+ resource.refreshLocal(IResource.DEPTH_ZERO, null);
+ } catch (CoreException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ }
+ JBossServer server = getJBossServer(model);
+ if (server != null) {
+ ChainedJob dsJob = new ResourceDeployer(project, server.getServer(),
resource.getFullPath().removeFirstSegments(1));
+ dsJob.setNextJob(RegistrationHelper.getRegisterInServerJob(project, new
IServer[]{server.getServer()}, null));
+ dsJob.schedule();
+ }
+ }
+ }
+ }
+ }
+ }
}
\ No newline at end of file
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23ProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23ProjectCreator.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23ProjectCreator.java 2012-05-04
00:01:57 UTC (rev 40774)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.project.facet;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class Seam23ProjectCreator extends Seam2ProjectCreator {
+
+ public Seam23ProjectCreator(IDataModel model, IProject seamWebProject) {
+ super(model, seamWebProject);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.SeamProjectCreator#execute(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void execute(IProgressMonitor monitor) throws CoreException {
+ super.execute(monitor);
+ if(ISeamFacetDataModelProperties.DEPLOY_AS_EAR.equals(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS)))
{
+ IProject earProject =
seamWebProject.getWorkspace().getRoot().getProject(earProjectName);
+ File destFolder = new File(earProjectFolder, "resources");
+ Seam23FacetInstallDelegate.copyDBDriverToProject(earProject, model, destFolder);
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23ProjectCreator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-05-03
22:59:08 UTC (rev 40773)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2012-05-04
00:01:57 UTC (rev 40774)
@@ -87,6 +87,9 @@
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCoreMessages;
@@ -1323,4 +1326,42 @@
protected boolean shouldCopyLibraries(IDataModel model){
return
model.getBooleanProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING);
}
+
+ /**
+ * Returns the server defined in the model.
+ * @param model
+ * @return
+ */
+ public static IServer getServer(IDataModel model) {
+ Object serverObject =
model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER);
+ IServer server = null;
+ if(serverObject instanceof String) {
+ IServer[] servers = ServerCore.getServers();
+ for (IServer i : servers) {
+ if(serverObject.equals(i.getName())) {
+ server = i;
+ break;
+ }
+ }
+ } else if(serverObject instanceof IServer) {
+ server = (IServer)serverObject;
+ }
+ return server;
+ }
+
+ /**
+ * If the server defined in the model is a JBoss AS then return it.
+ * @param model
+ * @return
+ */
+ public static JBossServer getJBossServer(IDataModel model) {
+ IServer server = getServer(model);
+ if(server!=null) {
+ JBossServer jbs = (JBossServer) server.loadAdapter(JBossServer.class, new
NullProgressMonitor());
+ if (jbs != null) {
+ return jbs;
+ }
+ }
+ return null;
+ }
}
\ No newline at end of file
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-05-03
22:59:08 UTC (rev 40773)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2012-05-04
00:01:57 UTC (rev 40774)
@@ -35,7 +35,6 @@
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.IFilteredStep;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
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-05-03
22:59:08 UTC (rev 40773)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2012-05-04
00:01:57 UTC (rev 40774)
@@ -78,15 +78,16 @@
import org.eclipse.wst.server.ui.ServerUIUtil;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.tools.jst.web.server.RegistrationHelper;
-import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamCoreMessages;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamProjectPreferences;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.AntCopyUtils;
-import org.jboss.tools.seam.internal.core.project.facet.DataSourceXmlDeployer;
+import org.jboss.tools.seam.internal.core.project.facet.ResourceDeployer;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate;
import org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDelegate;
import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetProjectCreationDataModelProvider;
import org.jboss.tools.seam.ui.ISeamHelpContextIds;
@@ -411,19 +412,7 @@
// register project on the selected server;
// deploy datasource xml file to the selected server;
- Object serverObject =
model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER);
- IServer server = null;
- if(serverObject instanceof String) {
- IServer[] servers = ServerCore.getServers();
- for (IServer i : servers) {
- if(serverObject.equals(i.getName())) {
- server = i;
- break;
- }
- }
- } else if(serverObject instanceof IServer) {
- server = (IServer)serverObject;
- }
+ IServer server = SeamFacetAbstractInstallDelegate.getServer(model);
if (server != null) {
JBossServer jbs = (JBossServer) server.loadAdapter(JBossServer.class, new
NullProgressMonitor());
if (jbs != null) {
@@ -435,19 +424,19 @@
}
}
}
-
+
IPath filePath = new Path("resources").append(warProject.getName() +
"-ds.xml");
ChainedJob dsJob = null;
if (deployAsEar) {
- dsJob = new DataSourceXmlDeployer(earProject, server, filePath);
+ dsJob = new ResourceDeployer(earProject, server, filePath);
} else {
- dsJob = new DataSourceXmlDeployer(warProject, server, filePath);
+ dsJob = new ResourceDeployer(warProject, server, filePath);
}
dsJob.setNextJob(RegistrationHelper.getRegisterInServerJob(warProject, new
IServer[]{server}, null));
dsJob.schedule();
}
}
-
+
private void provideClassPath(List<IProject> projects, IProject ejbProject)
throws CoreException {
if(ejbProject == null) return;
int k = 0;