Author: akazakov
Date: 2012-05-04 20:06:49 -0400 (Fri, 04 May 2012)
New Revision: 40811
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamLibFileSetProvider.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntime.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/Seam23ProjectCreator.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/Seam2ProjectCreator.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/SeamFacetInstallDelegate.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/dialog/WarFileSetProvider.java
trunk/seam/tests/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
Log:
https://issues.jboss.org/browse/JBIDE-11490 use *list files from Seam runtime to pick up
the list of required jars
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntime.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntime.java 2012-05-04
23:17:23 UTC (rev 40810)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntime.java 2012-05-05
00:06:49 UTC (rev 40811)
@@ -133,6 +133,27 @@
}
/**
+ * Calculate path to seam-gen/build-scripts
+ *
+ * @return absolute path to seam-gen/build-scripts folder
+ */
+ public String getBuildScriptsDir() {
+ return getSeamGenDir() + "/build-scripts"; //$NON-NLS-1$
+ }
+
+ public String getDeployedJarsEarListFile() {
+ return getBuildScriptsDir() + "/deployed-jars-ear.list"; //$NON-NLS-1$
+ }
+
+ public String getDeployedJarsEarWarListFile() {
+ return getBuildScriptsDir() + "/deployed-jars-ear-war.list"; //$NON-NLS-1$
+ }
+
+ public String getDeployedJarsWarListFile() {
+ return getBuildScriptsDir() + "/deployed-jars-war.list"; //$NON-NLS-1$
+ }
+
+ /**
* Calculate path to lib folder
*
* @return absolute path to lib folder
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-04
23:17:23 UTC (rev 40810)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23FacetInstallDelegate.java 2012-05-05
00:06:49 UTC (rev 40811)
@@ -11,6 +11,11 @@
package org.jboss.tools.seam.internal.core.project.facet;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -24,6 +29,8 @@
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.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
/**
* @author Alexey Kazakov
@@ -56,8 +63,8 @@
* @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);
+ protected SeamProjectCreator getProjectCreator(IDataModel model, IProject project,
SeamFacetAbstractInstallDelegate seamFacetInstallDelegate) {
+ return new Seam23ProjectCreator(model, project, seamFacetInstallDelegate);
}
/*
@@ -69,6 +76,88 @@
return JBOOS_WAR_WEBINF_SET;
}
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.Seam2FacetInstallDelegate#getEarLibFileSet()
+ */
+ @Override
+ public AntCopyUtils.FileSet getEarLibFileSet() {
+ return getEarLibFileSet(facetModel);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.Seam2FacetInstallDelegate#getWarLibFileSet()
+ */
+ @Override
+ public AntCopyUtils.FileSet getWarLibFileSet() {
+ return getWarLibFileSet(facetModel);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.Seam2FacetInstallDelegate#getWarLibFileSetForEar()
+ */
+ @Override
+ public AntCopyUtils.FileSet getWarLibFileSetForEar() {
+ return getWarLibFileSetForEar(facetModel);
+ }
+
+ public static AntCopyUtils.FileSet getEarLibFileSet(IDataModel model) {
+ SeamRuntime runtime = getSeamRuntime(model);
+ String path = runtime.getDeployedJarsEarListFile();
+ return getFileSetOfJars(path);
+ }
+
+ public static AntCopyUtils.FileSet getWarLibFileSet(IDataModel model) {
+ SeamRuntime runtime = getSeamRuntime(model);
+ String path = runtime.getDeployedJarsWarListFile();
+ return getFileSetOfJars(path);
+ }
+
+ public static AntCopyUtils.FileSet getWarLibFileSetForEar(IDataModel model) {
+ SeamRuntime runtime = getSeamRuntime(model);
+ String path = runtime.getDeployedJarsEarWarListFile();
+ return getFileSetOfJars(path);
+ }
+
+ private static AntCopyUtils.FileSet getFileSetOfJars(String path) {
+ AntCopyUtils.FileSet fileSet = new AntCopyUtils.FileSet();
+ File listFile = new File(path);
+ if(listFile.exists()) {
+ FileInputStream fis = null;
+ try {
+ Properties list = new Properties();
+ fis = new FileInputStream(listFile);
+ list.load(fis);
+ Set<String> jarList = list.stringPropertyNames();
+ for (String jar : jarList) {
+ fileSet.include(jar);
+ }
+ } catch (FileNotFoundException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ } catch (IOException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ } finally {
+ if(fis!=null) {
+ try {
+ fis.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ } else {
+ SeamCorePlugin.getDefault().logError(path + " doesn't exist. Can't get
the list of the JARs to copy to the project.");
+ }
+ return fileSet;
+ }
+
+ private static SeamRuntime getSeamRuntime(IDataModel model) {
+ Object runtimeName =
model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME);
+ SeamRuntime runtime =
SeamRuntimeManager.getInstance().findRuntimeByName(runtimeName.toString());
+ return runtime;
+ }
+
/**
* Copies and deploys the driver jar from connection profile to the server.
* @param project
Modified:
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 2012-05-04
23:17:23 UTC (rev 40810)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23ProjectCreator.java 2012-05-05
00:06:49 UTC (rev 40811)
@@ -22,8 +22,8 @@
*/
public class Seam23ProjectCreator extends Seam2ProjectCreator {
- public Seam23ProjectCreator(IDataModel model, IProject seamWebProject) {
- super(model, seamWebProject);
+ public Seam23ProjectCreator(IDataModel model, IProject seamWebProject,
SeamLibFileSetProvider seamLibFileSetProvider) {
+ super(model, seamWebProject, seamLibFileSetProvider);
}
/*
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 2012-05-04
23:17:23 UTC (rev 40810)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2012-05-05
00:06:49 UTC (rev 40811)
@@ -36,12 +36,12 @@
import org.w3c.dom.Element;
// TODO: why not just *one* global filter set to avoid any missing names ? (assert for it
in our unittests!
-public class Seam2FacetInstallDelegate extends SeamFacetAbstractInstallDelegate{
+public class Seam2FacetInstallDelegate extends SeamFacetAbstractInstallDelegate {
public static final AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new
AntCopyUtils.FileSet()
.include("jboss-seam.jar"); //$NON-NLS-1$
- public static final AntCopyUtils.FileSet JBOSS_EAR_LIB = new AntCopyUtils.FileSet()
+ public static final AntCopyUtils.FileSet SEAM2_JBOSS_EAR_LIB = new
AntCopyUtils.FileSet()
.include("antlr-runtime.jar") //$NON-NLS-1$
.include("commons-beanutils.*\\.jar") //$NON-NLS-1$
.include("drools-compiler.*\\.jar") //$NON-NLS-1$
@@ -53,7 +53,7 @@
.include("jbpm-jpdl.*\\.jar") //$NON-NLS-1$
.include("richfaces-api.*\\.jar"); //$NON-NLS-1$
- public static final AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_WAR_CONFIG = new
AntCopyUtils.FileSet()
+ public static final AntCopyUtils.FileSet SEAM2_JBOSS_WAR_LIB_FILESET_WAR_CONFIG = new
AntCopyUtils.FileSet()
.include("ajax4jsf.*\\.jar") //$NON-NLS-1$
.include("richfaces.*\\.jar")
.include("antlr-runtime.*\\.jar") //$NON-NLS-1$
@@ -86,7 +86,7 @@
.include("jfreechart.*\\.jar") //$NON-NLS-1$
.include("jcommon.*\\.jar"); //$NON-NLS-1$
- public static final AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new
AntCopyUtils.FileSet()
+ public static final AntCopyUtils.FileSet SEAM2_JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new
AntCopyUtils.FileSet()
.include("richfaces-impl\\.jar") //$NON-NLS-1$
.include("richfaces-ui\\.jar") //$NON-NLS-1$
.include("commons-digester\\.jar") //$NON-NLS-1$
@@ -106,6 +106,33 @@
/*
* (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#getEarLibFileSet()
+ */
+ @Override
+ public AntCopyUtils.FileSet getEarLibFileSet() {
+ return SEAM2_JBOSS_EAR_LIB;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#getWarLibFileSet()
+ */
+ @Override
+ public AntCopyUtils.FileSet getWarLibFileSet() {
+ return SEAM2_JBOSS_WAR_LIB_FILESET_WAR_CONFIG;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#getWarLibFileSetForEar()
+ */
+ @Override
+ public AntCopyUtils.FileSet getWarLibFileSetForEar() {
+ return SEAM2_JBOSS_WAR_LIB_FILESET_EAR_CONFIG;
+ }
+
+ /*
+ * (non-Javadoc)
* @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#doExecuteForEjb(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion,
org.eclipse.wst.common.frameworks.datamodel.IDataModel,
org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
@@ -133,20 +160,20 @@
final File droolsLibFolder = new File(seamHomePath, DROOLS_LIB_SEAM_RELATED_PATH);
if(isWarConfiguration(model)) {
if (!SeamCorePlugin.getDefault().hasM2Facet(project) &&
shouldCopyLibraries(model)) {
- AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamHomeFolder)));
- AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(getWarLibFileSet()).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(getWarLibFileSet()).dir(seamLibFolder)));
}
final IContainer source = warActionSrcRootFolder.getUnderlyingFolder();
File actionsSrc = new File(project.getLocation().toFile(),
source.getFullPath().removeFirstSegments(1).toString());
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "seam.properties"),
actionsSrc, true); //$NON-NLS-1$
if (!SeamCorePlugin.getDefault().hasM2Facet(project) &&
shouldCopyLibraries(model)) {
- AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(droolsLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(getWarLibFileSet()).dir(droolsLibFolder)));
}
} else {
if (!SeamCorePlugin.getDefault().hasM2Facet(project) &&
shouldCopyLibraries(model)) {
- AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamHomeFolder)));
- AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(droolsLibFolder)));
+ AntCopyUtils.copyFiles(seamHomeFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(getWarLibFileSetForEar()).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(getWarLibFileSetForEar()).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(getWarLibFileSetForEar()).dir(droolsLibFolder)));
}
}
}
@@ -165,7 +192,7 @@
AntCopyUtils.copyFiles(seamHomeFolder, earContentsFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamHomeFolder)), false);
if(shouldCopyLibraries(model)){
AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)), false);
- AntCopyUtils.copyFiles(seamLibFolder, earLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_EAR_LIB).dir(seamLibFolder)), false);
+ AntCopyUtils.copyFiles(seamLibFolder, earLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(getEarLibFileSet()).dir(seamLibFolder)), false);
AntCopyUtils.copyFiles(droolsLibFolder, earContentsFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(droolsLibFolder)), false);
}
AntCopyUtils.copyFiles(seamGenResFolder, earContentsFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamGenResFolder)), false);
@@ -302,10 +329,9 @@
// Security
addSecurityConstraint(webApp);
}
-
+
@Override
- protected SeamProjectCreator getProjectCreator(IDataModel model,
- IProject project) {
- return new Seam2ProjectCreator(model,project);
+ protected SeamProjectCreator getProjectCreator(IDataModel model, IProject project,
SeamFacetAbstractInstallDelegate seamFacetInstallDelegate) {
+ return new Seam2ProjectCreator(model,project, this);
}
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2012-05-04
23:17:23 UTC (rev 40810)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2012-05-05
00:06:49 UTC (rev 40811)
@@ -77,8 +77,8 @@
* @param model Seam facet data model
* @param seamWebProject Seam web project
*/
- public Seam2ProjectCreator(IDataModel model, IProject seamWebProject) {
- super(model, seamWebProject);
+ public Seam2ProjectCreator(IDataModel model, IProject seamWebProject,
SeamLibFileSetProvider seamLibFileSetProvider) {
+ super(model, seamWebProject, seamLibFileSetProvider);
viewFilterSetCollection.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
droolsLibFolder = new File(seamHomePath,
Seam2FacetInstallDelegate.DROOLS_LIB_SEAM_RELATED_PATH);
}
@@ -93,7 +93,7 @@
if (!SeamCorePlugin.getDefault().hasM2Facet(seamWebProject) &&
shouldCopyLibrariesAndTemplates(model) && shouldCopyLibraries(model)) {
File earContentsFolder = new File(earProjectFolder, "EarContent");
//$NON-NLS-1$
File earLibFolder = new File(earContentsFolder, "lib"); //$NON-NLS-1$
- AntCopyUtils.copyFiles(seamLibFolder, earLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(Seam2FacetInstallDelegate.JBOSS_EAR_LIB).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder, earLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(seamLibFileSetProvider.getEarLibFileSet()).dir(seamLibFolder)));
}
}
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-04
23:17:23 UTC (rev 40810)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2012-05-05
00:06:49 UTC (rev 40811)
@@ -106,8 +106,7 @@
* @author eskimo
*
*/
-public abstract class SeamFacetAbstractInstallDelegate implements ILogListener,
- IDelegate,ISeamFacetDataModelProperties {
+public abstract class SeamFacetAbstractInstallDelegate implements ILogListener,
IDelegate, ISeamFacetDataModelProperties, SeamLibFileSetProvider {
public static final String MOJARRA_1_2 = "Mojarra-1.2"; //$NON-NLS-1$
public static final String ORG_JBOSS_JBOSSFACES_JSF_CONFIG_NAME =
"org.jboss.jbossfaces.JSF_CONFIG_NAME"; //$NON-NLS-1$
@@ -129,6 +128,7 @@
public static String SEAM_LIB_RELATED_PATH = "lib"; //$NON-NLS-1$
public static final String DEV_WAR_PROFILE = "dev-war"; //$NON-NLS-1$
public static final String DEV_EAR_PROFILE = "dev"; //$NON-NLS-1$
+ protected IDataModel facetModel;
public static AntCopyUtils.FileSet JBOOS_EJB_WEB_INF_CLASSES_SET = new
AntCopyUtils.FileSet()
.include("import\\.sql") //$NON-NLS-1$
@@ -195,12 +195,13 @@
// untouched, this abstract class just listen to eclipse log and show an
// error dialog if there were records logged from seam.core plugin
startListening();
+ IDataModel model = (IDataModel) config;
+ facetModel = model;
doExecute(project,fv,config,monitor);
- IDataModel model = (IDataModel) config;
boolean createEarProjects =
model.getBooleanProperty(ISeamFacetDataModelProperties.CREATE_EAR_PROJECTS);
if (createEarProjects) {
// Create ear, ejb, test projects JBIDE-3782
- getProjectCreator(model, project).execute(monitor);
+ getProjectCreator(model, project, this).execute(monitor);
}
} finally {
stopListening();
@@ -1321,7 +1322,7 @@
return (WebApp)modelObject;
}
- protected abstract SeamProjectCreator getProjectCreator(IDataModel model, IProject
project);
+ protected abstract SeamProjectCreator getProjectCreator(IDataModel model, IProject
project, SeamFacetAbstractInstallDelegate seamFacetInstallDelegate);
protected boolean shouldCopyLibrariesAndTemplates(IDataModel model){
return
model.getBooleanProperty(ISeamFacetDataModelProperties.SEAM_TEMPLATES_AND_LIBRARIES_COPYING);
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 2012-05-04
23:17:23 UTC (rev 40810)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2012-05-05
00:06:49 UTC (rev 40811)
@@ -31,6 +31,7 @@
import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.jboss.tools.seam.internal.core.project.facet.AntCopyUtils.FileSet;
/**
* Install delegate for seam facet version 1.2
@@ -311,8 +312,22 @@
}
@Override
- protected SeamProjectCreator getProjectCreator(IDataModel model,
- IProject project) {
- return new SeamProjectCreator(model,project);
+ protected SeamProjectCreator getProjectCreator(IDataModel model, IProject project,
SeamFacetAbstractInstallDelegate seamFacetInstallDelegate) {
+ return new SeamProjectCreator(model, project, seamFacetInstallDelegate);
}
+
+ @Override
+ public FileSet getEarLibFileSet() {
+ return JBOSS_EAR_CONTENT;
+ }
+
+ @Override
+ public FileSet getWarLibFileSet() {
+ return JBOSS_WAR_LIB_FILESET_WAR_CONFIG;
+ }
+
+ @Override
+ public FileSet getWarLibFileSetForEar() {
+ return JBOSS_WAR_LIB_FILESET_EAR_CONFIG;
+ }
}
\ No newline at end of file
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamLibFileSetProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamLibFileSetProvider.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamLibFileSetProvider.java 2012-05-05
00:06:49 UTC (rev 40811)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface SeamLibFileSetProvider {
+
+ AntCopyUtils.FileSet getEarLibFileSet();
+
+ AntCopyUtils.FileSet getWarLibFileSet();
+
+ AntCopyUtils.FileSet getWarLibFileSetForEar();
+}
\ 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/SeamLibFileSetProvider.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/SeamProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2012-05-04
23:17:23 UTC (rev 40810)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2012-05-05
00:06:49 UTC (rev 40811)
@@ -85,6 +85,7 @@
protected IDataModel model;
protected IProject seamWebProject;
+ protected SeamLibFileSetProvider seamLibFileSetProvider;
protected SeamRuntime seamRuntime;
protected String seamHomePath;
protected File seamHomeFolder;
@@ -141,9 +142,10 @@
* @param model Seam facet data model
* @param seamWebProject Seam web project
*/
- public SeamProjectCreator(IDataModel model, IProject seamWebProject) {
+ public SeamProjectCreator(IDataModel model, IProject seamWebProject,
SeamLibFileSetProvider seamLibFileSetProvider) {
this.model = model;
this.seamWebProject = seamWebProject;
+ this.seamLibFileSetProvider = seamLibFileSetProvider;
earProjectName =
model.getStringProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT);
ejbProjectName =
model.getStringProperty(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/WarFileSetProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/WarFileSetProvider.java 2012-05-04
23:17:23 UTC (rev 40810)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/WarFileSetProvider.java 2012-05-05
00:06:49 UTC (rev 40811)
@@ -44,13 +44,13 @@
if (SeamVersion.SEAM_1_2.equals(version)) {
return SeamFacetInstallDelegate.JBOSS_WAR_LIB_FILESET_WAR_CONFIG;
} else {
- return Seam2FacetInstallDelegate.JBOSS_WAR_LIB_FILESET_WAR_CONFIG;
+ return Seam2FacetInstallDelegate.SEAM2_JBOSS_WAR_LIB_FILESET_WAR_CONFIG;
}
} else {
if (SeamVersion.SEAM_1_2.equals(version)) {
return SeamFacetInstallDelegate.JBOSS_WAR_LIB_FILESET_EAR_CONFIG;
} else {
- return Seam2FacetInstallDelegate.JBOSS_WAR_LIB_FILESET_EAR_CONFIG;
+ return Seam2FacetInstallDelegate.SEAM2_JBOSS_WAR_LIB_FILESET_EAR_CONFIG;
}
}
}
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-05-04
23:17:23 UTC (rev 40810)
+++
trunk/seam/tests/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2012-05-05
00:06:49 UTC (rev 40811)
@@ -4,9 +4,7 @@
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import junit.framework.TestCase;
@@ -30,9 +28,14 @@
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.FileSet;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.internal.core.project.facet.Seam23FacetInstallDelegate;
+import org.jboss.tools.seam.internal.core.project.facet.Seam23ProjectCreator;
+import org.jboss.tools.seam.internal.core.project.facet.Seam2FacetInstallDelegate;
import org.jboss.tools.seam.internal.core.project.facet.Seam2ProjectCreator;
import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider;
+import org.jboss.tools.seam.internal.core.project.facet.SeamLibFileSetProvider;
import org.jboss.tools.seam.internal.core.project.facet.SeamProjectCreator;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
@@ -243,12 +246,52 @@
SeamVersion seamVersion = SeamVersion.parseFromString(seamVersionString);
SeamProjectCreator creator = null;
if(seamVersion == SeamVersion.SEAM_1_2) {
- creator = new SeamProjectCreator(config, proj);
+ creator = new SeamProjectCreator(config, proj, new SeamLibFileSetProvider() {
+ @Override
+ public FileSet getEarLibFileSet() {
+ return null;
+ }
+ @Override
+ public FileSet getWarLibFileSet() {
+ return null;
+ }
+ @Override
+ public FileSet getWarLibFileSetForEar() {
+ return null;
+ }
+ });
} else if(seamVersion == SeamVersion.SEAM_2_0 ||
seamVersion == SeamVersion.SEAM_2_1 ||
- seamVersion == SeamVersion.SEAM_2_2 ||
- seamVersion == SeamVersion.SEAM_2_3) {
- creator = new Seam2ProjectCreator(config, proj);
+ seamVersion == SeamVersion.SEAM_2_2) {
+ creator = new Seam2ProjectCreator(config, proj, new SeamLibFileSetProvider() {
+ @Override
+ public FileSet getEarLibFileSet() {
+ return Seam2FacetInstallDelegate.SEAM2_JBOSS_EAR_LIB;
+ }
+ @Override
+ public FileSet getWarLibFileSet() {
+ return Seam2FacetInstallDelegate.SEAM2_JBOSS_WAR_LIB_FILESET_WAR_CONFIG;
+ }
+ @Override
+ public FileSet getWarLibFileSetForEar() {
+ return Seam2FacetInstallDelegate.SEAM2_JBOSS_WAR_LIB_FILESET_WAR_CONFIG;
+ }
+ });
+ } else if(seamVersion == SeamVersion.SEAM_2_3) {
+ creator = new Seam23ProjectCreator(config, proj, new SeamLibFileSetProvider() {
+ @Override
+ public FileSet getEarLibFileSet() {
+ return Seam23FacetInstallDelegate.getEarLibFileSet(config);
+ }
+ @Override
+ public FileSet getWarLibFileSet() {
+ return Seam23FacetInstallDelegate.getWarLibFileSet(config);
+ }
+ @Override
+ public FileSet getWarLibFileSetForEar() {
+ return Seam23FacetInstallDelegate.getWarLibFileSetForEar(config);
+ }
+ });
} else {
throw new RuntimeException("Can't get seam version from seam facet
model");
}