[113621] Facets and flexible project cleanup
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/J2EEUtil.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/J2EEUtil.java
index 506384c..9cc9b80 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/J2EEUtil.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/J2EEUtil.java
@@ -22,6 +22,7 @@
* Utility class for dealing with J2EE modules.
*/
public class J2EEUtil {
+ private static final String EAR_MODULE = "jst.ear";
/**
* Returns the enterprise applications that the module is contained within.
*
@@ -32,7 +33,7 @@
*/
public static IModule[] getEnterpriseApplications(IJ2EEModule module, IProgressMonitor monitor) {
List list = new ArrayList();
- IModule[] modules = ServerUtil.getModules("j2ee.ear");
+ IModule[] modules = ServerUtil.getModules(EAR_MODULE);
if (modules != null) {
int size = modules.length;
for (int i = 0; i < size; i++) {
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/cactus/CactusModuleArtifactAdapterDelegate.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/cactus/CactusModuleArtifactAdapterDelegate.java
index af5ecb0..bbb513d 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/cactus/CactusModuleArtifactAdapterDelegate.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/cactus/CactusModuleArtifactAdapterDelegate.java
@@ -133,7 +133,7 @@
protected static IModule getModule(IProject project) {
IModule deployable = null;
- Iterator iterator = Arrays.asList(ServerUtil.getModules("j2ee.web")).iterator();
+ Iterator iterator = Arrays.asList(ServerUtil.getModules("jst.web")).iterator();
while (iterator.hasNext()) {
Object next = iterator.next();
if (next instanceof IModule) {
diff --git a/plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServer.java b/plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServer.java
index 8a13de1..6b77055 100644
--- a/plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServer.java
+++ b/plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServer.java
@@ -143,8 +143,6 @@
return new IModule[0];
}
-
-
/*
* (non-Javadoc)
*
@@ -152,13 +150,14 @@
*/
public IModule[] getChildModules(IModule[] module) {
if (module[0] != null && module[0].getModuleType() != null) {
- String type = module[0].getModuleType().getId();
- if (module.length == 1 && "j2ee.ear".equals(type)) {
+ if (module.length == 1) {
IEnterpriseApplication enterpriseApplication = (IEnterpriseApplication) module[0]
.loadAdapter(IEnterpriseApplication.class, null);
- IModule[] earModules =enterpriseApplication.getModules();
- if ( earModules != null) {
- return earModules;
+ if (enterpriseApplication != null) {
+ IModule[] earModules = enterpriseApplication.getModules();
+ if ( earModules != null) {
+ return earModules;
+ }
}
}
}
@@ -268,45 +267,41 @@
public IModule[] getRootModules(IModule module) throws CoreException {
String type = module.getModuleType().getId();
- if (type.equals("j2ee.ejb")) {
- IEJBModule ejbModule = (IEJBModule) module.loadAdapter(IEJBModule.class,null);
- if (ejbModule != null) {
- IStatus status = canModifyModules(new IModule[] { module }, null);
- if (status == null || !status.isOK())
- throw new CoreException(status);
- IModule[] childs = doGetChildModules(module);
- if(childs.length>0)
- return childs;
- return new IModule[] { module };
- }
- }
- if (type.equals("j2ee.ear")) {
- IEnterpriseApplication enterpriseApplication = (IEnterpriseApplication) module.loadAdapter(IEnterpriseApplication.class,null);
- if (enterpriseApplication.getModules() != null) {
- IStatus status = canModifyModules(new IModule[] { module },null);
- if (status == null || !status.isOK())
- throw new CoreException(status);
- return new IModule[] { module };
- }
- }
- if (type.equals("j2ee.web")) {
- IWebModule webModule = (IWebModule) module.loadAdapter(IWebModule.class,null);
- if (webModule != null) {
- IStatus status = canModifyModules(new IModule[] { module },null);
- if (status == null || !status.isOK())
- throw new CoreException(status);
- IModule[] childs = doGetChildModules(module);
- if(childs.length>0)
- return childs;
- return new IModule[] { module };
- }
- }
+
+ IEJBModule ejbModule = (IEJBModule) module.loadAdapter(IEJBModule.class,null);
+ if (ejbModule != null) {
+ IStatus status = canModifyModules(new IModule[] { module }, null);
+ if (status == null || !status.isOK())
+ throw new CoreException(status);
+ IModule[] childs = doGetChildModules(module);
+ if(childs.length>0)
+ return childs;
+ return new IModule[] { module };
+ }
+
+ IEnterpriseApplication enterpriseApplication = (IEnterpriseApplication) module.loadAdapter(IEnterpriseApplication.class,null);
+ if (enterpriseApplication.getModules() != null) {
+ IStatus status = canModifyModules(new IModule[] { module },null);
+ if (status == null || !status.isOK())
+ throw new CoreException(status);
+ return new IModule[] { module };
+ }
+
+ IWebModule webModule = (IWebModule) module.loadAdapter(IWebModule.class,null);
+ if (webModule != null) {
+ IStatus status = canModifyModules(new IModule[] { module },null);
+ if (status == null || !status.isOK())
+ throw new CoreException(status);
+ IModule[] childs = doGetChildModules(module);
+ if(childs.length>0)
+ return childs;
+ return new IModule[] { module };
+ }
return null;
}
-
private IModule[] doGetChildModules(IModule module) {
- IModule[] ears = ServerUtil.getModules("j2ee.ear");
+ IModule[] ears = ServerUtil.getModules("jst.ear");
ArrayList list = new ArrayList();
for (int i = 0; i < ears.length; i++) {
IEnterpriseApplication ear = (IEnterpriseApplication)ears[i].loadAdapter(IEnterpriseApplication.class,null);
@@ -339,7 +334,7 @@
{
String path= (String)getServerInstanceProperties().get(property.getId());
if(path!=null && !pathExist(path))
- return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, 0, GenericServerCoreMessages.bind(GenericServerCoreMessages.invalidPath,path), null);
+ return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, 0, GenericServerCoreMessages.bind(GenericServerCoreMessages.invalidPath,path), null);
}
}
return new Status(IStatus.OK, CorePlugin.PLUGIN_ID, 0, "", null);
diff --git a/plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/publishers/AntPublisher.java b/plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/publishers/AntPublisher.java
index 55123ad..eea0a36 100644
--- a/plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/publishers/AntPublisher.java
+++ b/plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/publishers/AntPublisher.java
@@ -140,7 +140,7 @@
private void packModule(IPath modulePath, IModule module, IPath destination)throws CoreException {
String name =guessModuleName(module);
- if ("j2ee.web".equals(module.getModuleType().getId())) {
+ if ("jst.web".equals(module.getModuleType().getId())) {
name += ".war";
} else {
name += ".jar";
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModuleType.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModuleType.java
index 90898c4..5b44bd6 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModuleType.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModuleType.java
@@ -29,7 +29,7 @@
* <p>
* The module type id is a "." separated string uniquely identifying the
* type of module. Like a java package name, it should scope the type from
- * most general to specific. For instance, "j2ee.web".
+ * most general to specific. For instance, "jst.web".
* </p>
*
* @return the module type id
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeContentProvider.java
index 2c7b16b..88f77ce 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeContentProvider.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeContentProvider.java
@@ -68,7 +68,7 @@
ele.contents.add(runtimeType);
elementToParentMap.put(runtimeType, ele);
} else if (style == STYLE_MODULE_TYPE) {
- // TODO: does not handle "j2ee.*" format
+ // TODO: does not handle "jst.*" format
IModuleType[] moduleTypes = runtimeType.getModuleTypes();
if (moduleTypes != null) {
int size2 = moduleTypes.length;