Author: dgolovin
Date: 2007-10-18 20:33:29 -0400 (Thu, 18 Oct 2007)
New Revision: 4356
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1000
now it copies the driver jar file to
<<JBossHome>>/server/<<configuration>>/lib dir
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-10-19
00:07:42 UTC (rev 4355)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-10-19
00:33:29 UTC (rev 4356)
@@ -341,10 +341,6 @@
project.getLocation().toFile(),
hibernateDialectFilterSet, true);
- // Copy JDBC driver if there is any
- if(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH)!=null)
- AntCopyUtils.copyFiles((String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH),
webLibFolder);
-
WtpUtils.setClasspathEntryAsExported(project, new
Path("org.eclipse.jst.j2ee.internal.web.container"), monitor); //$NON-NLS-1$
Job create = new DataSourceXmlDeployer(project);
@@ -459,11 +455,6 @@
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)));
-
-
- if(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH)!=null)
- AntCopyUtils.copyFiles((String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH),
earContentsFolder);
-
try {
File[] earJars = earContentsFolder.listFiles(new FilenameFilter() {
@@ -500,41 +491,26 @@
createSeamProjectPreferenes(project, model);
-// try {
- EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
- project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- String wsPath = project.getLocation().removeLastSegments(1)
- .toFile().getAbsoluteFile().getPath();
- IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+ EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ String wsPath = project.getLocation().removeLastSegments(1)
+ .toFile().getAbsoluteFile().getPath();
- if(!isWarConfiguration(model)) {
-// ResourcesUtils.importProject(
-// wsPath+"/"+project.getName()+"-ejb", monitor); //$NON-NLS-1$
//$NON-NLS-2$
-
- IProject ejbProjectToBeImported =
wsRoot.getProject(project.getName()+"-ejb");
- ResourcesUtils.importExistingProject(ejbProjectToBeImported,
wsPath+"/"+project.getName()+"-ejb",
project.getName()+"-ejb");
-
-// ResourcesUtils.importProject(
-// wsPath+"/"+project.getName()+"-ear", monitor); //$NON-NLS-1$
//$NON-NLS-2$
+ IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
- IProject earProjectToBeImported =
wsRoot.getProject(project.getName()+"-ear");
- ResourcesUtils.importExistingProject(earProjectToBeImported,
wsPath+"/"+project.getName()+"-ear",
project.getName()+"-ear");
- }
+ if(!isWarConfiguration(model)) {
-// ResourcesUtils.importProject(
-// wsPath+"/"+project.getName()+"-test", monitor); //$NON-NLS-1$
//$NON-NLS-2$
-
- IProject testProjectToBeImported =
wsRoot.getProject(project.getName()+"-test");
- ResourcesUtils.importExistingProject(testProjectToBeImported,
wsPath+"/"+project.getName()+"-test",
project.getName()+"-test");
+ IProject ejbProjectToBeImported =
wsRoot.getProject(project.getName()+"-ejb");
+ ResourcesUtils.importExistingProject(ejbProjectToBeImported,
wsPath+"/"+project.getName()+"-ejb",
project.getName()+"-ejb");
-// } catch (IOException e) {
-// SeamCorePlugin.getPluginLog().logError(e);
-// } catch (InvocationTargetException e) {
-// SeamCorePlugin.getPluginLog().logError(e);
-// } catch (InterruptedException e) {
-// SeamCorePlugin.getPluginLog().logError(e);
-// }
+ IProject earProjectToBeImported =
wsRoot.getProject(project.getName()+"-ear");
+ ResourcesUtils.importExistingProject(earProjectToBeImported,
wsPath+"/"+project.getName()+"-ear",
project.getName()+"-ear");
+ }
+
+ IProject testProjectToBeImported =
wsRoot.getProject(project.getName()+"-test");
+ ResourcesUtils.importExistingProject(testProjectToBeImported,
wsPath+"/"+project.getName()+"-test",
project.getName()+"-test");
+
}
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-19
00:07:42 UTC (rev 4355)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java 2007-10-19
00:33:29 UTC (rev 4356)
@@ -20,6 +20,7 @@
import org.eclipse.core.runtime.CoreException;
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.core.runtime.jobs.Job;
@@ -33,6 +34,7 @@
import org.eclipse.wst.common.project.facet.core.IDelegate;
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.jst.web.server.RegistrationHelper;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.osgi.service.prefs.BackingStoreException;
@@ -49,42 +51,15 @@
*/
public void execute(final IProject project, IProjectFacetVersion fv,
Object config, IProgressMonitor monitor) throws CoreException {
- IEclipsePreferences prefs = SeamCorePlugin.getSeamPreferences(project);
final IDataModel model = (IDataModel)config;
-
- prefs.put(JBOSS_AS_DEPLOY_AS, model.getProperty(JBOSS_AS_DEPLOY_AS).toString());
-
- prefs.put(SEAM_RUNTIME_NAME, model.getProperty(SEAM_RUNTIME_NAME).toString());
-
- prefs.put(SEAM_CONNECTION_PROFILE,model.getProperty(SEAM_CONNECTION_PROFILE).toString());
-
- prefs.put(SESION_BEAN_PACKAGE_NAME,
model.getProperty(SESION_BEAN_PACKAGE_NAME).toString());
-
- prefs.put(ENTITY_BEAN_PACKAGE_NAME,
model.getProperty(ENTITY_BEAN_PACKAGE_NAME).toString());
-
- prefs.put(TEST_CASES_PACKAGE_NAME,
model.getProperty(TEST_CASES_PACKAGE_NAME).toString());
- prefs.put(SEAM_TEST_PROJECT,
- model.getProperty(SEAM_TEST_PROJECT)==null?
- "":model.getProperty(SEAM_TEST_PROJECT).toString()); //$NON-NLS-1$
-
- if(DEPLOY_AS_EAR.equals(model.getProperty(JBOSS_AS_DEPLOY_AS))) {
- prefs.put(SEAM_EJB_PROJECT,
- model.getProperty(SEAM_EJB_PROJECT)==null?
- "":model.getProperty(SEAM_EJB_PROJECT).toString()); //$NON-NLS-1$
-
- prefs.put(SEAM_EAR_PROJECT,
- model.getProperty(SEAM_EAR_PROJECT)==null?
- "":model.getProperty(SEAM_EAR_PROJECT).toString()); //$NON-NLS-1$
- }
-
- try {
- prefs.flush();
- } catch (BackingStoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
-
IServer server = (IServer)model.getProperty(JBOSS_AS_TARGET_SERVER);
+ JBossServer jbs = (JBossServer)server.loadAdapter(JBossServer.class, new
NullProgressMonitor());
+ if( jbs != null ) {
+ String[] driverJars =
(String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH);
+ String configFolder = jbs.getConfigDirectory();
+ AntCopyUtils.copyFiles(driverJars, new File(configFolder,"lib"));
+ }
if (server != null) {
RegistrationHelper.runRegisterInServerJob(project, server);
}