Author: dennyxu
Date: 2009-09-21 23:25:29 -0400 (Mon, 21 Sep 2009)
New Revision: 17686
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/component/
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/component/ESBVirtualComponent.java
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/.settings/org.eclipse.jdt.core.prefs
trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.xml
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/IJBossESBFacetDataModelProperties.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleDelegate.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleFactory.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java
Log:
JBIDE-4320: apply the patch --ESB Projects does not respect WTP module dependency rules
JBIDE-4767: Add Support for JBoss ESB v4.6
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/.settings/org.eclipse.jdt.core.prefs 2009-09-21
21:23:29 UTC (rev 17685)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/.settings/org.eclipse.jdt.core.prefs 2009-09-22
03:25:29 UTC (rev 17686)
@@ -1,5 +1,6 @@
-#Wed Aug 27 16:17:18 CST 2008
+#Thu Sep 10 17:06:26 CST 2009
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.xml 2009-09-21 21:23:29 UTC
(rev 17685)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.xml 2009-09-22 03:25:29 UTC
(rev 17686)
@@ -81,6 +81,24 @@
</and>
</constraint>
</project-facet-version>
+ <project-facet-version
+ facet="jst.jboss.esb"
+ version="4.6">
+ <group-member
+ id="modules">
+ </group-member>
+ <constraint>
+ <and>
+ <conflicts
+ group="modules">
+ </conflicts>
+ <requires
+ facet="jst.java"
+ version="[5.0">
+ </requires>
+ </and>
+ </constraint>
+ </project-facet-version>
<action
facet="jst.jboss.esb"
id="jst.jboss.esb.install"
@@ -110,21 +128,21 @@
<supported>
<facet
id="jst.jboss.esb"
- version="4.2,4.3,4.4,4.5">
+ version="4.2,4.3,4.4,4.5,4.6">
</facet>
<runtime-component
id="org.jboss.ide.eclipse.as.runtime.component"
- version="4.2">
+ version="4.2,5.0,5.1">
</runtime-component>
</supported>
<supported>
<facet
id="jst.jboss.esb"
- version="4.2,4.3,4.4,4.5">
+ version="4.2,4.3,4.4,4.5,4.6">
</facet>
<runtime-component
id="org.jboss.ide.eclipse.eap.runtime.component"
- version="4.3">
+ version="4.3,5.0">
</runtime-component>
</supported>
</extension>
@@ -163,7 +181,7 @@
projects="true">
<moduleType
types="jst.jboss.esb"
- versions="4.2,4.3,4.4,4.5">
+ versions="4.2,4.3,4.4,4.5,4.6">
</moduleType>
</moduleFactory>
</extension>
@@ -209,4 +227,14 @@
containerID="org.jboss.esb.runtime.classpath">
</filteredClasspathContainer>
</extension>
+
+
+ <extension
+ point="org.eclipse.wst.common.modulecore.componentimpl">
+ <componentimpl
+ typeID="jst.jboss.esb"
+ class="org.jboss.tools.esb.core.component.ESBVirtualComponent">
+ </componentimpl>
+ </extension>
+
</plugin>
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/component/ESBVirtualComponent.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/component/ESBVirtualComponent.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/component/ESBVirtualComponent.java 2009-09-22
03:25:29 UTC (rev 17686)
@@ -0,0 +1,7 @@
+package org.jboss.tools.esb.core.component;
+
+import org.jboss.ide.eclipse.as.wtp.core.vcf.JBTVirtualComponent;
+
+public class ESBVirtualComponent extends JBTVirtualComponent {
+
+}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/IJBossESBFacetDataModelProperties.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/IJBossESBFacetDataModelProperties.java 2009-09-21
21:23:29 UTC (rev 17685)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/IJBossESBFacetDataModelProperties.java 2009-09-22
03:25:29 UTC (rev 17686)
@@ -27,6 +27,7 @@
public static final QualifiedName QNAME_ESB_CONTENT_FOLDER = new
QualifiedName("jboss", ESB_CONTENT_FOLDER);
public static final QualifiedName QNAME_ESB_SRC_FOLDER = new
QualifiedName("jboss", ESB_SOURCE_FOLDER);
+ public static final String ESB_PROJECT_VERSION =
"jboss.esb.project.project.version";
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java 2009-09-21
21:23:29 UTC (rev 17685)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java 2009-09-22
03:25:29 UTC (rev 17686)
@@ -11,7 +11,6 @@
package org.jboss.tools.esb.core.facet;
import java.io.ByteArrayInputStream;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.eclipse.core.resources.IFile;
@@ -19,11 +18,14 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
@@ -35,6 +37,8 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.jboss.tools.esb.core.ESBProjectCorePlugin;
+import org.osgi.service.prefs.BackingStoreException;
public class JBossESBFacetInstallationDelegate implements IDelegate {
@@ -126,6 +130,19 @@
private void createProjectStructure(IProject project) throws CoreException{
String strContentFolder =
model.getStringProperty(IJBossESBFacetDataModelProperties.ESB_CONTENT_FOLDER);
project.setPersistentProperty(IJBossESBFacetDataModelProperties.QNAME_ESB_CONTENT_FOLDER,
strContentFolder);
+
+ String qualifier =
ESBProjectCorePlugin.getDefault().getDescriptor().getUniqueIdentifier();
+ IScopeContext context = new ProjectScope(project);
+ IEclipsePreferences node = context.getNode(qualifier);
+ if (node != null)
+ node.putDouble(IJBossESBFacetDataModelProperties.ESB_PROJECT_VERSION, 2.0);
+
+ try {
+ node.flush();
+ } catch (BackingStoreException e) {
+ e.printStackTrace();
+ }
+
IFolder esbContent = project.getFolder(strContentFolder);
if(!esbContent.exists()) {
esbContent.create(true, true, null);
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleDelegate.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleDelegate.java 2009-09-21
21:23:29 UTC (rev 17685)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleDelegate.java 2009-09-22
03:25:29 UTC (rev 17686)
@@ -14,41 +14,51 @@
import java.util.List;
import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
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.server.core.IModule;
import org.eclipse.wst.server.core.model.IModuleResource;
-import org.eclipse.wst.server.core.util.ModuleFile;
-import org.eclipse.wst.server.core.util.ModuleFolder;
-import org.eclipse.wst.server.core.util.ProjectModule;
+import org.jboss.ide.eclipse.as.wtp.core.modules.IJBTModule;
+import org.jboss.ide.eclipse.as.wtp.core.modules.JBTProjectModuleDelegate;
+import org.jboss.tools.esb.core.ESBProjectCorePlugin;
import org.jboss.tools.esb.core.StatusUtils;
+import org.jboss.tools.esb.core.facet.IJBossESBFacetDataModelProperties;
-public class JBossESBModuleDelegate extends ProjectModule {
+public class JBossESBModuleDelegate extends JBTProjectModuleDelegate implements
IJBTModule {
public JBossESBModuleDelegate(IProject project){
super(project);
}
- @Override
- public IModule[] getChildModules() {
- return null;
- }
public IModuleResource[] members() throws CoreException {
+ IProject p = getProject();
+ String qualifier =
ESBProjectCorePlugin.getDefault().getDescriptor().getUniqueIdentifier();
+ IScopeContext context = new ProjectScope(p);
+ IEclipsePreferences node = context.getNode(qualifier);
+ if (node != null) {
+ double d = node.getDouble(IJBossESBFacetDataModelProperties.ESB_PROJECT_VERSION,
1.0);
+ if( d < 2.0 )
+ return super.members();
+ }
+ return legacyMembers();
+ }
+
+ public IModuleResource[] legacyMembers() throws CoreException {
IProject project = getProject();
final IVirtualComponent c = ComponentCore.createComponent(project);
IVirtualFolder vf = c.getRootFolder();
IContainer[] folders = vf.getUnderlyingFolders();
+
if(folders == null || folders.length == 0){
throw new CoreException(StatusUtils.errorStatus("The project is not a valid JBoss
ESB project."));
}
@@ -57,8 +67,8 @@
//in the JBT CR1, the length of folders will be 1.
IContainer contentFolder = folders.length > 1? folders[1] : folders[0];
- IFolder configFolder = project.getFolder(contentFolder.getProjectRelativePath());
- IJavaProject javaPrj = JavaCore.create(project);
+ IFolder configFolder = getProject().getFolder(contentFolder.getProjectRelativePath());
+ IJavaProject javaPrj = JavaCore.create(getProject());
IPath output = javaPrj.getOutputLocation();
// if the jboss-esb.xml file is not in META-INF folder, try to get it from other folder
of the project
// block this logic as Max's suggestion
@@ -67,7 +77,7 @@
List<IModuleResource> mrs = new ArrayList<IModuleResource>();
IModuleResource[] esbContent = getModuleResources(Path.EMPTY, configFolder);
- IModuleResource[] classes = getModuleResources(Path.EMPTY,
project.getWorkspace().getRoot().getFolder(output));
+ IModuleResource[] classes = getModuleResources(Path.EMPTY,
getProject().getWorkspace().getRoot().getFolder(output));
IModuleResource[] allResource = new IModuleResource[esbContent.length + classes.length
+ mrs.size()];
System.arraycopy(esbContent, 0, allResource, 0, esbContent.length);
System.arraycopy(classes, 0, allResource, esbContent.length, classes.length);
@@ -77,40 +87,9 @@
}
return allResource;
}
-
-
-
- @Override
- public IStatus validate() {
- return null;
- }
@Override
- protected IModuleResource[] getModuleResources(IPath path, IContainer container) throws
CoreException {
-
- IResource[] resources = container.members();
- if (resources != null) {
- int size = resources.length;
- List<IModuleResource> list = new ArrayList<IModuleResource>(size);
- for (int i = 0; i < size; i++) {
- IResource resource = resources[i];
- if (resource != null && resource.exists()) {
- String name = resource.getName();
- if (resource instanceof IContainer) {
- IContainer container2 = (IContainer) resource;
- ModuleFolder mf = new ModuleFolder(container2, name, path);
- mf.setMembers(getModuleResources(path.append(name), container2));
- list.add(mf);
- } else if (resource instanceof IFile) {
- list.add(new ModuleFile((IFile) resource, name, path));
- }
- }
- }
- IModuleResource[] moduleResources = new IModuleResource[list.size()];
- list.toArray(moduleResources);
- return moduleResources;
- }
- return new IModuleResource[0];
+ protected String getFactoryId() {
+ return JBossESBModuleFactory.FACTORY_ID;
}
-
}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleFactory.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleFactory.java 2009-09-21
21:23:29 UTC (rev 17685)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleFactory.java 2009-09-22
03:25:29 UTC (rev 17686)
@@ -10,92 +10,29 @@
******************************************************************************/
package org.jboss.tools.esb.core.module;
-import java.util.HashMap;
-
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.internal.ModuleFactory;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.model.ModuleDelegate;
-import org.eclipse.wst.server.core.util.ProjectModuleFactoryDelegate;
+import org.jboss.ide.eclipse.as.wtp.core.modules.JBTProjectModuleDelegate;
+import org.jboss.ide.eclipse.as.wtp.core.modules.JBTProjectModuleFactory;
import org.jboss.tools.esb.core.ESBProjectConstant;
-import org.jboss.tools.esb.core.ESBProjectCorePlugin;
import org.jboss.tools.esb.core.facet.IJBossESBFacetDataModelProperties;
-public class JBossESBModuleFactory extends ProjectModuleFactoryDelegate {
+public class JBossESBModuleFactory extends JBTProjectModuleFactory {
public static final String FACTORY_ID =
"org.jboss.tools.esb.project.core.moduleFactory";
public static final String MODULE_TYPE =
IJBossESBFacetDataModelProperties.JBOSS_ESB_FACET_ID;
- public static final String MODULE_ID_PREFIX =
IJBossESBFacetDataModelProperties.JBOSS_ESB_FACET_ID + ".";
- private static ModuleFactory factory;
private static JBossESBModuleFactory factDelegate;
public static JBossESBModuleFactory getFactory() {
- if (factDelegate == null) {
- ModuleFactory[] factories = ServerPlugin.getModuleFactories();
- for (int i = 0; i < factories.length; i++) {
- if (factories[i].getId().equals(FACTORY_ID)) {
- Object o = factories[i]
- .getDelegate(new NullProgressMonitor());
- if (o instanceof JBossESBModuleFactory) {
- factory = factories[i];
- factDelegate = (JBossESBModuleFactory) o;
- return factDelegate;
- }
- }
- }
- }
+ if (factDelegate == null)
+ factDelegate = (JBossESBModuleFactory)getFactory(FACTORY_ID);
return factDelegate;
}
-
- private HashMap<IModule, JBossESBModuleDelegate> moduleToDelegate;
public JBossESBModuleFactory() {
- moduleToDelegate = new HashMap<IModule, JBossESBModuleDelegate>();
+ super(MODULE_TYPE, ESBProjectConstant.ESB_PROJECT_FACET);
}
- @Override
- protected void clearCache(IProject project) {
- super.clearCache(project);
- moduleToDelegate.remove(project);
+ protected JBTProjectModuleDelegate createDelegate(IProject project) {
+ return new JBossESBModuleDelegate(project);
}
-
- @Override
- public ModuleDelegate getModuleDelegate(IModule module) {
- return moduleToDelegate.get(module);
- }
- protected IModule[] createModules(IProject project) {
- IFacetedProject facetProject;
- try {
- facetProject = ProjectFacetsManager.create(project);
- if (facetProject == null) {
- return null;
- }
- IProjectFacet esbFacet = ProjectFacetsManager
- .getProjectFacet(ESBProjectConstant.ESB_PROJECT_FACET);
-
- if (facetProject.hasProjectFacet(esbFacet)) {
- IProjectFacetVersion version = facetProject.getProjectFacetVersion(esbFacet);
- IModule module = createModule(
- MODULE_ID_PREFIX + project.getName(),
- project.getName(),
- MODULE_TYPE,
- version.getVersionString(),
- project);
- moduleToDelegate.put(module, new JBossESBModuleDelegate(project));
- return new IModule[] { module };
- }
- } catch (CoreException e) {
- ESBProjectCorePlugin.getDefault().getLog().log(e.getStatus());
- }
- return null;
-
- }
-
}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java 2009-09-21
21:23:29 UTC (rev 17685)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java 2009-09-22
03:25:29 UTC (rev 17686)
@@ -644,7 +644,14 @@
protected void initializeConfigVersionCombo(Combo cmVersions, String currentName, String
version) {
cmVersions.removeAll();
cmVersions.add("1.0.1"); //$NON-NLS-1$
- if(version != null && version.equals("4.5")) { //$NON-NLS-1$
+ double versionNumber = 0.0;
+ try{
+ versionNumber = Double.valueOf(version);
+ }
+ catch(NumberFormatException ex){
+ versionNumber = 0.0;
+ }
+ if(versionNumber >= 4.5) { //$NON-NLS-1$
cmVersions.add("1.1.0"); //$NON-NLS-1$
}
int index = cmVersions.getItemCount() - 1;