Author: dennyxu
Date: 2009-11-26 04:11:32 -0500 (Thu, 26 Nov 2009)
New Revision: 18846
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.core/schema/
trunk/esb/plugins/org.jboss.tools.esb.project.core/schema/esbRuntimeResolver.xsd
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/AbstractESBRuntimeResolver.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/ESBRuntimeResolver_42.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/ESBRuntimeResolver_47.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/IESBRuntimeResolver.java
Modified:
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/ESBProjectCorePlugin.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeClassPathInitializer.java
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeManager.java
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/JBossESBRuntimeContainerPage.java
Log:
JBIDE-5229:Add support for ESB 4.7 contained in soa-p 5.0 in ESB project wziard
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.xml 2009-11-26 01:21:00 UTC
(rev 18845)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.xml 2009-11-26 09:11:32 UTC
(rev 18846)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
+ <extension-point id="esbRuntimeResolver" name="ESB Runtime
Resolver" schema="schema/esbRuntimeResolver.xsd"/>
<extension
point="org.eclipse.wst.common.project.facet.core.facets">
<project-facet
@@ -99,6 +100,24 @@
</and>
</constraint>
</project-facet-version>
+ <project-facet-version
+ facet="jst.jboss.esb"
+ version="4.7">
+ <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"
@@ -128,7 +147,7 @@
<supported>
<facet
id="jst.jboss.esb"
- version="4.2,4.3,4.4,4.5,4.6">
+ version="4.2,4.3,4.4,4.5,4.6,4.7">
</facet>
<runtime-component
id="org.jboss.ide.eclipse.as.runtime.component"
@@ -138,7 +157,7 @@
<supported>
<facet
id="jst.jboss.esb"
- version="4.2,4.3,4.4,4.5,4.6">
+ version="4.2,4.3,4.4,4.5,4.6,4.7">
</facet>
<runtime-component
id="org.jboss.ide.eclipse.eap.runtime.component"
@@ -236,5 +255,33 @@
class="org.jboss.tools.esb.core.component.ESBVirtualComponent">
</componentimpl>
</extension>
+ <extension
+ point="org.jboss.tools.esb.project.core.esbRuntimeResolver">
+ <Resolver
+ class="org.jboss.tools.esb.core.runtime.ESBRuntimeResolver_42"
+ esbVersion="4.2,4.3,4.4,4.5,4.6"
+ name="ESB runtime resolver">
+ <supportedRuntimeType
+ id="org.jboss.ide.eclipse.as.runtime.42">
+ </supportedRuntimeType>
+ <supportedRuntimeType
+ id="org.jboss.ide.eclipse.as.runtime.eap.43">
+ </supportedRuntimeType>
+ </Resolver>
+ <Resolver
+ class="org.jboss.tools.esb.core.runtime.ESBRuntimeResolver_47"
+ esbVersion="4.7"
+ name="ESB runtime resolver">
+ <supportedRuntimeType
+ id="org.jboss.ide.eclipse.as.runtime.eap.50">
+ </supportedRuntimeType>
+ <supportedRuntimeType
+ id="org.jboss.ide.eclipse.as.runtime.50">
+ </supportedRuntimeType>
+ <supportedRuntimeType
+ id="org.jboss.ide.eclipse.as.runtime.51">
+ </supportedRuntimeType>
+ </Resolver>
+ </extension>
</plugin>
Added: trunk/esb/plugins/org.jboss.tools.esb.project.core/schema/esbRuntimeResolver.xsd
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.core/schema/esbRuntimeResolver.xsd
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/schema/esbRuntimeResolver.xsd 2009-11-26
09:11:32 UTC (rev 18846)
@@ -0,0 +1,131 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.esb.project.core"
xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.esb.project.core"
id="esbRuntimeParser" name="ESB Runtime Parser"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="Resolver"/>
+ </sequence>
+ <attribute name="point" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="Resolver">
+ <complexType>
+ <sequence>
+ <element ref="supportedRuntimeType" minOccurs="0"
maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"
basedOn=":org.jboss.tools.esb.core.runtime.IESBRuntimeResolver"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="esbVersion" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="supportedRuntimeType">
+ <complexType>
+ <attribute name="id" type="string"
use="required">
+ <annotation>
+ <documentation>
+ Input supported Server runtime id
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/ESBProjectCorePlugin.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/ESBProjectCorePlugin.java 2009-11-26
01:21:00 UTC (rev 18845)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/ESBProjectCorePlugin.java 2009-11-26
09:11:32 UTC (rev 18846)
@@ -14,6 +14,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.tools.esb.core.runtime.JBossRuntimeManager;
import org.osgi.framework.BundleContext;
/**
@@ -40,6 +41,7 @@
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ JBossRuntimeManager.loadParsers();
}
/*
@@ -61,8 +63,12 @@
}
public static void log(String msg,Throwable e) {
+ log(msg, e, Status.ERROR);
+ }
+
+ public static void log(String msg,Throwable e, int serverity) {
ILog log = ESBProjectCorePlugin.getDefault().getLog();
- IStatus status = new Status(Status.ERROR,ESBProjectCorePlugin.PLUGIN_ID,msg,e);
+ IStatus status = new Status(serverity,ESBProjectCorePlugin.PLUGIN_ID,msg,e);
log.log(status);
- }
+ }
}
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/AbstractESBRuntimeResolver.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/AbstractESBRuntimeResolver.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/AbstractESBRuntimeResolver.java 2009-11-26
09:11:32 UTC (rev 18846)
@@ -0,0 +1,90 @@
+package org.jboss.tools.esb.core.runtime;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+public abstract class AbstractESBRuntimeResolver implements IESBRuntimeResolver {
+
+ protected final static String JBOSSESB_ESB = "jbossesb.esb"; //$NON-NLS-1$
+ protected final static String JBOSSESB_SAR = "jbossesb.sar"; //$NON-NLS-1$
+ protected final static String SOAP_AS_LOCATION = "jboss-as"; //$NON-NLS-1$
+ protected final static String ROSETTA_JAR = "jbossesb-rosetta.jar";
//$NON-NLS-1$
+
+ public List<IPath> getJarDirectories(String runtimeLocation) {
+ List<IPath> directories = new ArrayList<IPath>();
+
+ IPath rtHome = new Path(runtimeLocation);
+ IPath soapDeployPath =
rtHome.append(SOAP_AS_LOCATION).append("server").append("default").append(
+ "deploy");
+ IPath deployPath =
rtHome.append("server").append("default").append(
+ "deploy");
+
+ IPath esbPath = deployPath.append(JBOSSESB_ESB);
+ IPath sarPath = deployPath.append(JBOSSESB_SAR);
+
+
+ IPath libPath = rtHome.append("lib");
+
+ directories.add(esbPath);
+ directories.add(sarPath.append("lib"));
+ directories.add(libPath.append(JBOSSESB_ESB));
+ directories.add(libPath.append(JBOSSESB_SAR).append("lib"));
+ directories.add(soapDeployPath.append(JBOSSESB_ESB));
+ directories.add(soapDeployPath.append(JBOSSESB_SAR).append("lib"));
+
+ return directories;
+ }
+
+ public List<File> getAllRuntimeJars(String runtimeLocation) {
+ List<File> jarList = new ArrayList<File>();
+
+ for(IPath dir : getJarDirectories(runtimeLocation)){
+ List<File> tmpJarList = new ArrayList<File>();
+ if(dir.toFile().exists()){
+ tmpJarList = getJarsOfFolder(dir.toFile());
+ jarList = mergeJarList(jarList, tmpJarList);
+ }
+ }
+
+ return jarList;
+ }
+
+
+
+ private List<File> getJarsOfFolder(File folder){
+ List<File> jars = new ArrayList<File>();
+ if(folder.isDirectory()){
+ for(File file: folder.listFiles()){
+ if(file.isFile() && (file.getName().endsWith(".jar") ||
file.getName().endsWith(".zip"))){
+ jars.add(file);
+ }else if (folder.isDirectory()){
+ jars.addAll(getJarsOfFolder(file));
+ }
+ }
+ }
+
+ return jars;
+ }
+
+ // if two folders have the same jar file, one of them will be ignored.
+ private List<File> mergeJarList(List<File> jarList1, List<File>
jarList2){
+ List<File> duplicateList = new ArrayList<File>();
+
+ for(File file : jarList1){
+ for(File file2 : jarList2){
+ if(file.getName().equals(file2.getName())){
+ duplicateList.add(file);
+ }
+ }
+ }
+ jarList1.removeAll(duplicateList);
+ jarList1.addAll(jarList2);
+
+ return jarList1;
+ }
+
+}
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/ESBRuntimeResolver_42.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/ESBRuntimeResolver_42.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/ESBRuntimeResolver_42.java 2009-11-26
09:11:32 UTC (rev 18846)
@@ -0,0 +1,30 @@
+package org.jboss.tools.esb.core.runtime;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+public class ESBRuntimeResolver_42 extends AbstractESBRuntimeResolver implements
IESBRuntimeResolver {
+
+
+ private final static String CONFIG_MODEL_JAR =
"jbossesb-config-model-1.1.0.jar";
+
+
+ public boolean isValidESBRuntime(String location, String version){
+ List<String> jarNames = new ArrayList<String>();
+
+ for(File file : getAllRuntimeJars(location)){
+ jarNames.add(file.getName());
+ }
+
+ if("4.5".equals(version) || "4.6".equals(version)){
+ return jarNames.contains(ROSETTA_JAR) && jarNames.contains(CONFIG_MODEL_JAR);
+ }
+
+ return jarNames.contains(ROSETTA_JAR);
+ }
+
+}
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/ESBRuntimeResolver_47.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/ESBRuntimeResolver_47.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/ESBRuntimeResolver_47.java 2009-11-26
09:11:32 UTC (rev 18846)
@@ -0,0 +1,45 @@
+package org.jboss.tools.esb.core.runtime;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+public class ESBRuntimeResolver_47 extends AbstractESBRuntimeResolver implements
+ IESBRuntimeResolver {
+
+ private final static String CONFIG_MODEL_JAR_11 =
"jbossesb-config-model-1.1.0.jar";
+ private final static String CONFIG_MODEL_JAR_12 =
"jbossesb-config-model-1.2.0.jar";
+
+
+ public boolean isValidESBRuntime(String location, String version){
+ List<String> jarNames = new ArrayList<String>();
+
+ for(File file : getAllRuntimeJars(location)){
+ jarNames.add(file.getName());
+ }
+
+ return jarNames.contains(ROSETTA_JAR)
+ && jarNames.contains(CONFIG_MODEL_JAR_11)
+ && jarNames.contains(CONFIG_MODEL_JAR_12);
+ }
+
+
+ public List<IPath> getJarDirectories(String runtimeLocation) {
+ List<IPath> directories = super.getJarDirectories(runtimeLocation);
+ IPath rtHome = new Path(runtimeLocation);
+ IPath soapDeployPath =
rtHome.append(SOAP_AS_LOCATION).append("server").append("default").append(
+ "deployers").append("esb.deployer").append("lib");
+
+ IPath deployPath =
rtHome.append("server").append("default").append(
+ "deployers").append("esb.deployer").append("lib");
+ directories.add(soapDeployPath);
+ directories.add(deployPath);
+
+ return directories;
+ }
+
+
+}
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/IESBRuntimeResolver.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/IESBRuntimeResolver.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/IESBRuntimeResolver.java 2009-11-26
09:11:32 UTC (rev 18846)
@@ -0,0 +1,16 @@
+package org.jboss.tools.esb.core.runtime;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+
+public interface IESBRuntimeResolver {
+
+
+ public boolean isValidESBRuntime(String location, String version);
+
+ public List<IPath> getJarDirectories(String runtimeLocation);
+
+ public List<File> getAllRuntimeJars(String runtimeLocation);
+}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeClassPathInitializer.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeClassPathInitializer.java 2009-11-26
01:21:00 UTC (rev 18845)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeClassPathInitializer.java 2009-11-26
09:11:32 UTC (rev 18846)
@@ -23,11 +23,17 @@
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
+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.IRuntime;
import org.eclipse.wst.server.core.ServerCore;
import org.jboss.ide.eclipse.as.classpath.core.jee.AbstractClasspathContainer;
import
org.jboss.ide.eclipse.as.classpath.core.jee.AbstractClasspathContainerInitializer;
import org.jboss.ide.eclipse.as.classpath.core.xpl.ClasspathDecorations;
+import org.jboss.tools.esb.core.ESBProjectCorePlugin;
+import org.jboss.tools.esb.core.facet.IJBossESBFacetDataModelProperties;
import org.jboss.tools.esb.core.messages.JBossFacetCoreMessages;
/**
@@ -74,6 +80,23 @@
isServerSupplied).getClasspathEntries();
}
+// private String getVersionNumber(IJavaProject project){
+// try {
+// IFacetedProject fp = ProjectFacetsManager.create(project.getProject());
+// if(fp == null){
+// return "";
+// }
+// IProjectFacet facet =
ProjectFacetsManager.getProjectFacet(IJBossESBFacetDataModelProperties.JBOSS_ESB_FACET_ID);
+// IProjectFacetVersion pfVersion = fp.getProjectFacetVersion(facet);
+//
+// return pfVersion.getVersionString();
+//
+// } catch (CoreException e) {
+// ESBProjectCorePlugin.log(e.getLocalizedMessage(), e);
+// }
+// return "";
+// }
+
public class JBossRuntimeClasspathContainer extends
AbstractClasspathContainer {
private IPath path;
@@ -124,7 +147,7 @@
String runtimeLocation = serverRuntime.getLocation()
.toOSString();
jars = JBossRuntimeManager.getInstance().getAllRuntimeJars(
- runtimeLocation);
+ runtimeLocation, serverRuntime.getRuntimeType().getId());
} else {
@@ -132,7 +155,7 @@
.findRuntimeByName(segment);
if (jbws != null) {
jars = JBossRuntimeManager.getInstance().getAllRuntimeJars(
- jbws);
+ jbws, jbws.getVersion());
unbound = false;
}
else{
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeManager.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeManager.java 2009-11-26
01:21:00 UTC (rev 18845)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/runtime/JBossRuntimeManager.java 2009-11-26
09:11:32 UTC (rev 18846)
@@ -20,11 +20,14 @@
import java.util.Map;
import java.util.Set;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
@@ -43,10 +46,16 @@
private Map<String, JBossRuntime> runtimes = new HashMap<String,
JBossRuntime>();
- private final static String JBOSSESB_ESB = "jbossesb.esb";
- private final static String JBOSSESB_SAR = "jbossesb.sar";
- private final static String SOAP_AS_LOCATION = "jboss-as";
+ static final String PLUGIN_ID = "org.jboss.tools.esb.project.core";
//$NON-NLS-1$
+ static String ATT_CLASS = "class"; //$NON-NLS-1$
+ static String ATT_VERSION = "esbVersion"; //$NON-NLS-1$
+ static String ATT_ID = "id";
+ static String VERSION_SEPARATOR = ",";
+
+ static Map<String, IESBRuntimeResolver> parserMap = new HashMap<String,
IESBRuntimeResolver>();
+
+
/**
* Private constructor
*/
@@ -152,7 +161,7 @@
return rts.toArray(new JBossRuntime[]{});
}
- public List<String> getAllRuntimeJars(JBossRuntime rt){
+ public List<String> getAllRuntimeJars(JBossRuntime rt, String esbVersion){
List<String> jarList = new ArrayList<String>();
if (rt != null) {
if (rt.isUserConfigClasspath()) {
@@ -160,102 +169,33 @@
} else {
- jarList = getAllRuntimeJars(rt.getHomeDir());
+ jarList = getAllRuntimeJars(rt.getHomeDir(), esbVersion);
}
}
return jarList;
}
- public List<String> getAllRuntimeJars(String runtimeLocation) {
+ public List<String> getAllRuntimeJars(String runtimeLocation, String esbVersion)
{
List<String> jarList = new ArrayList<String>();
-
- IPath rtHome = new Path(runtimeLocation);
- IPath soapDeployPath =
rtHome.append(SOAP_AS_LOCATION).append("server").append("default").append(
- "deploy");
- IPath deployPath =
rtHome.append("server").append("default").append(
- "deploy");
-
- IPath esbPath = deployPath.append(JBOSSESB_ESB);
- IPath sarPath = deployPath.append(JBOSSESB_SAR);
-
- IPath libPath = rtHome.append("lib");
-
- //if it's not a normal jboss AS , try to treat it as standalone esb runtme
- if (!esbPath.toFile().exists() || !sarPath.toFile().exists()) {
- esbPath = libPath.append(JBOSSESB_ESB);
- sarPath = libPath.append(JBOSSESB_SAR);
+ IESBRuntimeResolver resolver = null;
+ if(parserMap.get(esbVersion) != null){
+ resolver = (IESBRuntimeResolver)parserMap.get(esbVersion);
}
- if (!esbPath.toFile().exists() || !sarPath.toFile().exists()) {
- esbPath = soapDeployPath.append(JBOSSESB_ESB);
- sarPath = soapDeployPath.append(JBOSSESB_SAR);
- }
-
- List<File> esblibs = getJarsOfFolder(esbPath.toFile());
- IPath sarLibPath = sarPath.append("lib");
- List<File> sarJars = getJarsOfFolder(sarLibPath.toFile());
- // /List<File> commonLibs = getJarsOfFolder(libPath.toFile());
- // List<File> tmpLibs = mergeTwoFileList(esblibs, sarJars);
- // libs.addAll(commonLibs);
-
- jarList = mergeTwoList(esblibs, sarJars);
-
- return jarList;
- }
-
- private List<File> getJarsOfFolder(File folder){
- List<File> jars = new ArrayList<File>();
- if(folder.isDirectory()){
- for(File file: folder.listFiles()){
- if(file.isFile() && (file.getName().endsWith(".jar") ||
file.getName().endsWith(".zip"))){
- jars.add(file);
- }else if (folder.isDirectory()){
- jars.addAll(getJarsOfFolder(file));
- }
+ if( resolver != null){
+ List<File> jars = resolver.getAllRuntimeJars(runtimeLocation);
+ for(File file : jars){
+ jarList.add(file.getAbsolutePath());
}
}
-
- return jars;
- }
-
- // if two folders have the same jar file, one of them will be ignored.
- private List<String> mergeTwoList(List<File> jarList1, List<File>
jarList2){
- List<String> rtList = new ArrayList<String>();
- List<String> distinctFileNames = new ArrayList<String>();
-
- for(File jarFile: jarList1){
- distinctFileNames.add(jarFile.getName());
- rtList.add(jarFile.getAbsolutePath());
+ else{
+ ESBProjectCorePlugin.log("No ESB runtime resolver defined for ESB "+
esbVersion, null, Status.WARNING);
}
- for(File jarFile: jarList2){
- if(!distinctFileNames.contains(jarFile.getName())){
- rtList.add(jarFile.getAbsolutePath());
- }
- }
- return rtList;
-
+ return jarList;
}
- private List<File> mergeTwoFileList(List<File> jarList1, List<File>
jarList2){
- List<File> rtList = new ArrayList<File>();
- List<String> distinctFileNames = new ArrayList<String>();
-
- for(File jarFile: jarList1){
- distinctFileNames.add(jarFile.getName());
- rtList.add(jarFile);
- }
- for(File jarFile: jarList2){
- if(!distinctFileNames.contains(jarFile.getName())){
- rtList.add(jarFile);
- }
- }
-
- return rtList;
-
- }
-
/**
* Remove given JBossWSRuntime from manager
*
@@ -418,53 +358,56 @@
}
public static boolean isValidESBServer(String path, String version){
- return getResttaJar(path, "" , version) ||
isValidSoapContainedESBRuntime(path, version);
+
+ return isValidESBStandaloneRuntimeDir(path, version);
}
- private static boolean isValidSoapContainedESBRuntime(String path, String version){
- return getResttaJar(path, SOAP_AS_LOCATION, version);
- }
+// private static boolean isValidSoapContainedESBRuntime(String path, String version){
+// return isValidESBStandaloneRuntimeDir(path, version);
+// }
+ @Deprecated
public static boolean getResttaJar(String path, String asFoldername, String version){
- IPath serverLocation = new Path(path);
- if(asFoldername != null && !"".equals(asFoldername)){
- serverLocation = serverLocation.append(asFoldername);
- }
- IPath sarLocation = serverLocation.append( "server" + File.separator +
"default"
- + File.separator + "deploy" + File.separator
- + "jbossesb.sar");
- IPath rosettaJar = sarLocation.append("lib" + File.separator +
"jbossesb-rosetta.jar");
-
- try{
- double versionNumber = Double.valueOf(version);
- if(versionNumber >= 4.5){
- return isVersion45(sarLocation);
- }
- }catch(NumberFormatException e){
- }
- return rosettaJar.toFile().exists();
+ return isValidESBStandaloneRuntimeDir(path, version);
}
+
+
+
public static boolean isValidESBStandaloneRuntimeDir(String path, String version) {
- IPath location = new Path(path);
- IPath esblocation = location.append("lib").append("jbossesb.esb");
- IPath sarLocation = location.append("lib").append("jbossesb.sar");
- if (!esblocation.toFile().isDirectory()) {
- return false;
+ IESBRuntimeResolver resolver = null;
+ if( parserMap.get(version) != null){
+ resolver = (IESBRuntimeResolver)parserMap.get(version);
}
- if (!sarLocation.toFile().isDirectory()) {
- return false;
- }
- try{
- double versionNumber = Double.valueOf(version);
- if(versionNumber >= 4.5){
- return isVersion45(sarLocation);
- }
- }catch(NumberFormatException e){
+ if(resolver != null){
+ return resolver.isValidESBRuntime(path, version);
}
-
- return true;
+ else{
+ ESBProjectCorePlugin.log("No ESB runtime resolver defined for ESB "+
version, null, Status.WARNING);
+ }
+
+ return false;
+
+// IPath location = new Path(path);
+// IPath esblocation =
location.append("lib").append("jbossesb.esb");
+// IPath sarLocation =
location.append("lib").append("jbossesb.sar");
+// if (!esblocation.toFile().isDirectory()) {
+// return false;
+// }
+// if (!sarLocation.toFile().isDirectory()) {
+// return false;
+// }
+//
+// try{
+// double versionNumber = Double.valueOf(version);
+// if(versionNumber >= 4.5){
+// return isVersion45(sarLocation);
+// }
+// }catch(NumberFormatException e){
+// }
+//
+// return true;
}
private static boolean isVersion45(IPath sarLocation){
@@ -479,4 +422,45 @@
}
+ public static void loadParsers() {
+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry()
+ .getExtensionPoint(PLUGIN_ID, "esbRuntimeResolver");
+ for (IConfigurationElement element : extensionPoint
+ .getConfigurationElements()) {
+ String clazz = element.getAttribute(ATT_CLASS);
+ String esbVersion = element.getAttribute(ATT_VERSION);
+
+ IConfigurationElement[] supportedRTs =
element.getChildren("supportedRuntimeType");
+ List<String> runtimeTypeIds = new ArrayList<String>();
+ for(IConfigurationElement supportedRT : supportedRTs){
+ runtimeTypeIds.add(supportedRT.getAttribute(ATT_ID));
+ }
+
+ if (clazz == null || (esbVersion == null && runtimeTypeIds.size() == 0)) {
+ continue;
+ }
+
+
+ IESBRuntimeResolver parser = null;
+ try {
+ parser = (IESBRuntimeResolver) element
+ .createExecutableExtension(ATT_CLASS);
+
+ if (esbVersion != null && !"".equals(esbVersion.trim())) {
+ String[] versions = esbVersion.split(VERSION_SEPARATOR);
+ for (String version : versions) {
+ parserMap.put(version, parser);
+ }
+ }
+
+ for(String typeId : runtimeTypeIds){
+ parserMap.put(typeId, parser);
+ }
+
+ } catch (CoreException e) {
+ ESBProjectCorePlugin.log(e.getLocalizedMessage(), e);
+ }
+ }
+ }
+
}
\ No newline at end of file
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-11-26
01:21:00 UTC (rev 18845)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java 2009-11-26
09:11:32 UTC (rev 18846)
@@ -654,6 +654,9 @@
if(versionNumber >= 4.5) { //$NON-NLS-1$
cmVersions.add("1.1.0"); //$NON-NLS-1$
}
+ if(versionNumber >= 4.7){
+ cmVersions.add("1.2.0"); //$NON-NLS-1$
+ }
int index = cmVersions.getItemCount() - 1;
String convigVersionName = cmVersions.getItem(index);
cmVersions.select(index);
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/JBossESBRuntimeContainerPage.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/JBossESBRuntimeContainerPage.java 2009-11-26
01:21:00 UTC (rev 18845)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/JBossESBRuntimeContainerPage.java 2009-11-26
09:11:32 UTC (rev 18846)
@@ -165,10 +165,10 @@
Object element) {
if(element instanceof IRuntime){
IPath location = ((IRuntime)element).getLocation();
-
+ String runtimeType = ((IRuntime)element).getRuntimeType().getId();
if(location == null) return false;
- return JBossRuntimeManager.isValidESBServer(location.toOSString(), "");
+ return JBossRuntimeManager.isValidESBServer(location.toOSString(), runtimeType);
}
return true;
}