geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcco...@apache.org
Subject svn commit: r631818 - in /geronimo/devtools/eclipse-plugin/trunk: ./ plugins/org.apache.geronimo.runtime.common/META-INF/ plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ plugins/org.apache.geronimo.st.v21.core/src/org/apache/geroni...
Date Thu, 28 Feb 2008 02:07:57 GMT
Author: mcconne
Date: Wed Feb 27 18:07:49 2008
New Revision: 631818

URL: http://svn.apache.org/viewvc?rev=631818&view=rev
Log:
GERONIMODEVTOOLS-288 First of multiple patches for 288. This one will allow the configId to
be propertly returned for deployment-1.1 plans

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.common/META-INF/MANIFEST.MF
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ClasspathContainersHelper.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerRuntimeTargetHandler.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java
    geronimo/devtools/eclipse-plugin/trunk/pom.xml

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.common/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.common/META-INF/MANIFEST.MF?rev=631818&r1=631817&r2=631818&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.common/META-INF/MANIFEST.MF
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.common/META-INF/MANIFEST.MF
Wed Feb 27 18:07:49 2008
@@ -8,7 +8,7 @@
  lib/commons-logging-1.0.4.jar,
  lib/stax-api-1.0.jar,
  lib/cglib-nodep-2.1_3.jar,
- lib/xstream-1.2.1.jar,
+ lib/xstream-1.2.2.jar,
  lib/xmlbeans-2.3.0.jar,
  lib/xpp3-1.1.3.3.jar
 Export-Package: 

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ClasspathContainersHelper.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ClasspathContainersHelper.java?rev=631818&r1=631817&r2=631818&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ClasspathContainersHelper.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ClasspathContainersHelper.java
Wed Feb 27 18:07:49 2008
@@ -22,7 +22,6 @@
 import org.apache.geronimo.st.core.internal.Trace;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jdt.core.IClasspathContainer;
 import org.eclipse.jdt.core.IClasspathEntry;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerRuntimeTargetHandler.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerRuntimeTargetHandler.java?rev=631818&r1=631817&r2=631818&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerRuntimeTargetHandler.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerRuntimeTargetHandler.java
Wed Feb 27 18:07:49 2008
@@ -30,77 +30,99 @@
  * @version $Rev$ $Date$
  */
 public class GeronimoServerRuntimeTargetHandler extends RuntimeClasspathProviderDelegate
{
-	
-	/* (non-Javadoc)
-	 * @see org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate#getClasspathContainerLabel(org.eclipse.wst.server.core.IRuntime)
-	 */
-	public String getClasspathContainerLabel(IRuntime runtime) {
-		String version = runtime.getRuntimeType().getVersion();
-		if(version.equals("1.0")) {
-			return Messages.target10runtime;
-		} else if(version.equals("1.1")) {
-			return Messages.target11runtime;
-		} else if(version.equals("1.2")) {
-			return Messages.target12runtime;
-		}
-		return Messages.target12runtime;
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate#resolveClasspathContainer(org.eclipse.wst.server.core.IRuntime)
-	 */
-	public IClasspathEntry[] resolveClasspathContainer(IRuntime runtime) {
-		return getServerClassPathEntry(runtime);
-	}
-
-	public IClasspathEntry[] getServerClassPathEntry(IRuntime runtime) {
-		
-		List<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
-		IPath path = runtime.getLocation().append("lib");
-		addLibraryEntries(list, path.toFile(), true);
-		
-		String version = runtime.getRuntimeType().getVersion();
-		
-		if(version.equals("1.0")) {
-			IPath specPath = runtime.getLocation().append("repository/org.apache.geronimo.specs/jars/");
-			addLibraryEntries(list, specPath.toFile(), false);
-		} else if(version.equals("1.1")) {
-			IPath specPath = runtime.getLocation().append("repository/org/apache/geronimo/specs/geronimo-j2ee_1.4_spec/1.1/geronimo-j2ee_1.4_spec-1.1.jar");
-			//hack to add servlet/jsp spec jars to little G
-			if(!specPath.toFile().exists()) {
-				IPath servletSpec =runtime.getLocation().append("repository/org/apache/geronimo/specs/geronimo-servlet_2.4_spec/1.0.1/geronimo-servlet_2.4_spec-1.0.1.jar");
-				IPath jspSpec = runtime.getLocation().append("repository/org/apache/geronimo/specs/geronimo-jsp_2.0_spec/1.0.1/geronimo-jsp_2.0_spec-1.0.1.jar");
-				list.add(JavaCore.newLibraryEntry(servletSpec, null, null));
-				list.add(JavaCore.newLibraryEntry(jspSpec, null, null));
-			} else {
-				list.add(JavaCore.newLibraryEntry(specPath, null, null));
-			}
-		} else {
-			IPath specPath = runtime.getLocation().append("repository/org/apache/geronimo/specs/");
-			addLibraryEntries(list, specPath.toFile(), true);
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate#getClasspathContainerLabel(org.eclipse.wst.server.core.IRuntime)
+     */
+    public String getClasspathContainerLabel(IRuntime runtime) {
+        String version = runtime.getRuntimeType().getVersion();
+        if (version.equals("1.0")) {
+            return Messages.target10runtime;
+        }
+        else if (version.equals("1.1")) {
+            return Messages.target11runtime;
+        }
+        else if (version.equals("1.2")) {
+            return Messages.target12runtime;
+        }
+        return Messages.target12runtime;
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate#resolveClasspathContainer(org.eclipse.wst.server.core.IRuntime)
+     */
+    public IClasspathEntry[] resolveClasspathContainer(IRuntime runtime) {
+        return getServerClassPathEntry(runtime);
+    }
+
+    public IClasspathEntry[] getServerClassPathEntry(IRuntime runtime) {
+
+        List<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+        IPath path = runtime.getLocation().append("lib");
+        addLibraryEntries(list, path.toFile(), true);
+
+        String version = runtime.getRuntimeType().getVersion();
+
+        if (version.equals("1.0")) {
+            IPath specPath = runtime.getLocation().append("repository/org.apache.geronimo.specs/jars/");
+            addLibraryEntries(list, specPath.toFile(), false);
+        }
+        else if (version.equals("1.1")) {
+            IPath specPath = runtime.getLocation().append("repository/org/apache/geronimo/specs/geronimo-j2ee_1.4_spec/1.1/geronimo-j2ee_1.4_spec-1.1.jar");
+            //hack to add servlet/jsp spec jars to little G
+            if (!specPath.toFile().exists()) {
+                IPath servletSpec =runtime.getLocation().append("repository/org/apache/geronimo/specs/geronimo-servlet_2.4_spec/1.0.1/geronimo-servlet_2.4_spec-1.0.1.jar");
+                IPath jspSpec = runtime.getLocation().append("repository/org/apache/geronimo/specs/geronimo-jsp_2.0_spec/1.0.1/geronimo-jsp_2.0_spec-1.0.1.jar");
+                list.add(JavaCore.newLibraryEntry(servletSpec, null, null));
+                list.add(JavaCore.newLibraryEntry(jspSpec, null, null));
+            }
+            else {
+                list.add(JavaCore.newLibraryEntry(specPath, null, null));
+            }
+        }
+        else {
+            IPath specPath = runtime.getLocation().append("repository/org/apache/geronimo/specs/");
+            addLibraryEntries(list, specPath.toFile(), true);
+
             //
             // Add spec jars that are not in the specs directory (per Geronimo configs jee-specs)
             //
-            if (!version.startsWith("1")) {
-            	IPath javaMailSpec = runtime.getLocation().append("repository/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/");
-            	IPath jaxbApiSpec  = runtime.getLocation().append("repository/javax/xml/bind/jaxb-api/");
-            	IPath jabxImplSpec = runtime.getLocation().append("repository/com/sun/xml/bind/jaxb-impl/");
-            	IPath jaxwsApiSpec = runtime.getLocation().append("repository/org/apache/axis2/axis2-jaxws-api/");
-            	IPath saajApiSpec  = runtime.getLocation().append("repository/org/apache/axis2/axis2-saaj-api/");
-            	IPath jstlSpec     = runtime.getLocation().append("repository/jstl/jstl/");
-            	IPath myfacesSpec  = runtime.getLocation().append("repository/org/apache/myfaces/core/myfaces-api/");
-            	IPath jdbcSpec     = runtime.getLocation().append("repository/org/apache/geronimo/modules/geronimo-jdbc/");
-            	addLibraryEntries(list, javaMailSpec.toFile(), true);
-            	addLibraryEntries(list, jaxbApiSpec.toFile(),  true);
-            	addLibraryEntries(list, jabxImplSpec.toFile(), true);
-            	addLibraryEntries(list, jaxwsApiSpec.toFile(), true);
-            	addLibraryEntries(list, saajApiSpec.toFile(),  true);
-            	addLibraryEntries(list, jstlSpec.toFile(),     true);
-            	addLibraryEntries(list, myfacesSpec.toFile(),  true);
-            	addLibraryEntries(list, jdbcSpec.toFile(),     true);
+            if (version.startsWith("2.0")) {
+                IPath javaMailSpec = runtime.getLocation().append("repository/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/");
+                IPath jaxbApiSpec  = runtime.getLocation().append("repository/javax/xml/bind/jaxb-api/");
+                IPath jabxImplSpec = runtime.getLocation().append("repository/com/sun/xml/bind/jaxb-impl/");
+                IPath jaxwsApiSpec = runtime.getLocation().append("repository/org/apache/axis2/axis2-jaxws-api/");
+                IPath saajApiSpec  = runtime.getLocation().append("repository/org/apache/axis2/axis2-saaj-api/");
+                IPath jstlSpec     = runtime.getLocation().append("repository/jstl/jstl/");
+                IPath myfacesSpec  = runtime.getLocation().append("repository/org/apache/myfaces/core/myfaces-api/");
+                IPath jdbcSpec     = runtime.getLocation().append("repository/org/apache/geronimo/modules/geronimo-jdbc/");
+                addLibraryEntries(list, javaMailSpec.toFile(), true);
+                addLibraryEntries(list, jaxbApiSpec.toFile(),  true);
+                addLibraryEntries(list, jabxImplSpec.toFile(), true);
+                addLibraryEntries(list, jaxwsApiSpec.toFile(), true);
+                addLibraryEntries(list, saajApiSpec.toFile(),  true);
+                addLibraryEntries(list, jstlSpec.toFile(),     true);
+                addLibraryEntries(list, myfacesSpec.toFile(),  true);
+                addLibraryEntries(list, jdbcSpec.toFile(),     true);
             }
-		}
-		
-		return (IClasspathEntry[])list.toArray(new IClasspathEntry[list.size()]);
-	}
+            if (version.startsWith("2.1")) {
+                IPath javaMailSpec = runtime.getLocation().append("repository/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/");
+                IPath jaxbApiSpec  = runtime.getLocation().append("repository/javax/xml/bind/jaxb-api/");
+                IPath jabxImplSpec = runtime.getLocation().append("repository/com/sun/xml/bind/jaxb-impl/");
+                IPath jaxwsApiSpec = runtime.getLocation().append("repository/org/apache/axis2/axis2-jaxws-api/");
+                IPath jstlSpec     = runtime.getLocation().append("repository/jstl/jstl/");
+                IPath myfacesSpec  = runtime.getLocation().append("repository/org/apache/myfaces/core/myfaces-api/");
+                IPath jdbcSpec     = runtime.getLocation().append("repository/org/apache/geronimo/framework/geronimo-jdbc/");
+                addLibraryEntries(list, javaMailSpec.toFile(), true);
+                addLibraryEntries(list, jaxbApiSpec.toFile(),  true);
+                addLibraryEntries(list, jabxImplSpec.toFile(), true);
+                addLibraryEntries(list, jaxwsApiSpec.toFile(), true);
+                addLibraryEntries(list, jstlSpec.toFile(),     true);
+                addLibraryEntries(list, myfacesSpec.toFile(),  true);
+                addLibraryEntries(list, jdbcSpec.toFile(),     true);
+            }
+        }
+
+        return(IClasspathEntry[])list.toArray(new IClasspathEntry[list.size()]);
+    }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java?rev=631818&r1=631817&r2=631818&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoV21Utils.java
Wed Feb 27 18:07:49 2008
@@ -21,6 +21,7 @@
 import org.apache.geronimo.deployment.xbeans.EnvironmentDocument;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.st.core.GeronimoUtils;
+import org.apache.geronimo.st.core.internal.Trace;
 import org.apache.geronimo.xml.ns.deployment.ArtifactType;
 import org.apache.geronimo.xml.ns.deployment.DeploymentPackage;
 import org.apache.geronimo.xml.ns.deployment.EnvironmentType;
@@ -54,186 +55,228 @@
  * @version $Rev: 533836 $ $Date: 2007-04-30 15:39:14 -0400 (Mon, 30 Apr 2007) $
  */
 public class GeronimoV21Utils extends GeronimoUtils {
-	
-	public static EObject getDeploymentPlan(IFile file) {
-		if (!file.exists())
-			return null;
-
-		if (file.getName().equals(GeronimoUtils.APP_PLAN_NAME))
-			return getApplicationDeploymentPlan(file);
-		else if (file.getName().equals(GeronimoUtils.OPENEJB_PLAN_NAME))
-			return getOpenEjbDeploymentPlan(file);
-		else if (file.getName().equals(GeronimoUtils.WEB_PLAN_NAME))
-			return getWebDeploymentPlan(file);
-		else if (file.getName().equals(GeronimoUtils.CONNECTOR_PLAN_NAME))
-			return getConnectorDeploymentPlan(file);
-
-		return null;
-	}
-	
-	public static String getConfigId2(IModule module) {
-		
-		IFile planFile = null;
-		IVirtualComponent comp = ComponentCore.createComponent(module.getProject());
-		if (isWebModule(module)) {
-			planFile = GeronimoUtils.getWebDeploymentPlanFile(comp);
-		} else if (isEjbJarModule(module)) {
-			planFile = GeronimoUtils.getOpenEjbDeploymentPlanFile(comp);
-		} else if (isEarModule(module)) {
-			planFile = GeronimoUtils.getApplicationDeploymentPlanFile(comp);
-		} else if (isRARModule(module)) {
-			planFile = GeronimoUtils.getConnectorDeploymentPlanFile(comp);
-		}
-		
-		if(planFile != null) {
-			try {
-				XmlObject xmlObject = XmlBeansUtil.parse(planFile.getLocation().toFile());
-				XmlCursor cursor = xmlObject.newCursor();
-				cursor.toFirstChild();
-				xmlObject = cursor.getObject();
-				XmlObject result[] = xmlObject.selectChildren(QNameSet.singleton(EnvironmentDocument.type.getDocumentElementName()));
-				if(result != null && result.length > 0) {
-					org.apache.geronimo.deployment.xbeans.EnvironmentType env = (org.apache.geronimo.deployment.xbeans.EnvironmentType)
result[0].changeType(org.apache.geronimo.deployment.xbeans.EnvironmentType.type);
-					org.apache.geronimo.deployment.xbeans.ArtifactType moduleId = env.getModuleId();
-					return getQualifiedConfigID(moduleId);
-				}
-			} catch (IOException e) {
-				e.printStackTrace();
-			} catch (XmlException e) {
-				e.printStackTrace();
-			}
-		}
-		
-		return null;
-	}
-
-	public static String getConfigId(IModule module) {
-
-		EnvironmentType environment = null;
-		if (isWebModule(module)) {
-			WebAppType plan = getWebDeploymentPlan(module);
-			if (plan != null)
-				environment = plan.getEnvironment();
-		} else if (isEjbJarModule(module)) {
-			OpenejbJarType plan = getOpenEjbDeploymentPlan(module);
-			if (plan != null)
-				environment = plan.getEnvironment();
-		} else if (isEarModule(module)) {
-			ApplicationType plan = getApplicationDeploymentPlan(module);
-			if (plan != null)
-				environment = plan.getEnvironment();
-		} else if (isRARModule(module)) {
-			ConnectorType plan = getConnectorDeploymentPlan(module);
-			if (plan != null)
-				environment = plan.getEnvironment();
-		}
-
-		if (environment != null
-				&& environment.eIsSet(DeploymentPackage.eINSTANCE.getEnvironmentType_ModuleId()))
{
-			return getQualifiedConfigID(environment.getModuleId());
-		}
-
-		return getId(module);
-	}
-
-	public static String getQualifiedConfigID(ArtifactType artifact) {
-		return getQualifiedConfigID(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
artifact.getType());
-	}
-	
-	public static String getQualifiedConfigID(org.apache.geronimo.deployment.xbeans.ArtifactType
artifact) {
-		return getQualifiedConfigID(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
artifact.getType());
-	}
-
-	public static String getContextRoot(IModule module) {
-		String contextRoot = null;
-
-		WebAppType deploymentPlan = getWebDeploymentPlan(module);
-		if (deploymentPlan != null)
-			contextRoot = deploymentPlan.getContextRoot();
-
-		if (contextRoot == null)
-			contextRoot = GeronimoUtils.getContextRoot(module);
-
-		return contextRoot;
-	}
-
-	public static WebAppType getWebDeploymentPlan(IModule module) {
-		return getWebDeploymentPlan(getVirtualComponent(module));
-	}
-
-	public static ApplicationType getApplicationDeploymentPlan(IModule module) {
-		return getApplicationDeploymentPlan(getVirtualComponent(module));
-	}
-
-	public static OpenejbJarType getOpenEjbDeploymentPlan(IModule module) {
-		return getOpenEjbDeploymentPlan(getVirtualComponent(module));
-	}
-
-	public static ConnectorType getConnectorDeploymentPlan(IModule module) {
-		return getConnectorDeploymentPlan(getVirtualComponent(module));
-	}
-
-	public static ApplicationType getApplicationDeploymentPlan(IVirtualComponent comp) {
-		return getApplicationDeploymentPlan(getApplicationDeploymentPlanFile(comp));
-	}
-
-	public static WebAppType getWebDeploymentPlan(IVirtualComponent comp) {
-		return getWebDeploymentPlan(getWebDeploymentPlanFile(comp));
-	}
-
-	public static OpenejbJarType getOpenEjbDeploymentPlan(IVirtualComponent comp) {
-		return getOpenEjbDeploymentPlan(getOpenEjbDeploymentPlanFile(comp));
-	}
-
-	public static ConnectorType getConnectorDeploymentPlan(IVirtualComponent comp) {
-		return getConnectorDeploymentPlan(getConnectorDeploymentPlanFile(comp));
-	}
-
-	public static ApplicationType getApplicationDeploymentPlan(IFile file) {
-		if (file.getName().equals(APP_PLAN_NAME) && file.exists()) {
-			ResourceSet resourceSet = new ResourceSetImpl();
-			register(resourceSet, new ApplicationResourceFactoryImpl(), ApplicationPackage.eINSTANCE,
ApplicationPackage.eNS_URI);
-			Resource resource = load(file, resourceSet);
-			if (resource != null) {
-				return ((org.apache.geronimo.xml.ns.j2ee.application.DocumentRoot) resource.getContents().get(0)).getApplication();
-			}
-		}
-		return null;
-	}
-
-	public static WebAppType getWebDeploymentPlan(IFile file) {
-		if (file.getName().equals(WEB_PLAN_NAME) && file.exists()) {
-			ResourceSet resourceSet = new ResourceSetImpl();
-			register(resourceSet, new WebResourceFactoryImpl(), WebPackage.eINSTANCE, WebPackage.eNS_URI);
-			Resource resource = load(file, resourceSet);
-			if (resource != null) {
-				return ((DocumentRoot) resource.getContents().get(0)).getWebApp();
-			}
-		}
-		return null;
-	}
-
-	public static OpenejbJarType getOpenEjbDeploymentPlan(IFile file) {
-		if (file.getName().equals(OPENEJB_PLAN_NAME) && file.exists()) {
-			ResourceSet resourceSet = new ResourceSetImpl();
-			register(resourceSet, new JarResourceFactoryImpl(), JarPackage.eINSTANCE, JarPackage.eNS_URI);
-			Resource resource = load(file, resourceSet);
-			if (resource != null) {
-				return ((org.openejb.xml.ns.openejb.jar.DocumentRoot) resource.getContents().get(0)).getOpenejbJar();
-			}
-		}
-		return null;
-	}
-
-	public static ConnectorType getConnectorDeploymentPlan(IFile file) {
-		if (file.getName().equals(CONNECTOR_PLAN_NAME) && file.exists()) {
-			ResourceSet resourceSet = new ResourceSetImpl();
-			register(resourceSet, new ConnectorResourceFactoryImpl(), ConnectorPackage.eINSTANCE,
ConnectorPackage.eNS_URI);
-			Resource resource = load(file, resourceSet);
-			if (resource != null) {
-				return ((org.apache.geronimo.xml.ns.j2ee.connector.DocumentRoot) resource.getContents().get(0)).getConnector();
-			}
-		}
-		return null;
-	}
+
+    public static EObject getDeploymentPlan(IFile file) {
+        Trace.tracePoint("ENTRY", "GeronimoV21Utils.getDeploymentPlan", file);
+
+        if (!file.exists()) {
+            return null;
+        }
+
+        if (file.getName().equals(GeronimoUtils.APP_PLAN_NAME))
+            return getApplicationDeploymentPlan(file);
+        else if (file.getName().equals(GeronimoUtils.OPENEJB_PLAN_NAME))
+            return getOpenEjbDeploymentPlan(file);
+        else if (file.getName().equals(GeronimoUtils.WEB_PLAN_NAME))
+            return getWebDeploymentPlan(file);
+        else if (file.getName().equals(GeronimoUtils.CONNECTOR_PLAN_NAME))
+            return getConnectorDeploymentPlan(file);
+
+        Trace.tracePoint("EXIT", "GeronimoV21Utils.getDeploymentPlan", null);
+        return null;
+    }
+
+    public static String getConfigId2(IModule module) {
+        Trace.tracePoint("ENTRY", "GeronimoV21Utils.getConfigId2", module);
+
+        IFile planFile = null;
+        IVirtualComponent comp = ComponentCore.createComponent(module.getProject());
+        if (isWebModule(module)) {
+            planFile = GeronimoUtils.getWebDeploymentPlanFile(comp);
+        }
+        else if (isEjbJarModule(module)) {
+            planFile = GeronimoUtils.getOpenEjbDeploymentPlanFile(comp);
+        }
+        else if (isEarModule(module)) {
+            planFile = GeronimoUtils.getApplicationDeploymentPlanFile(comp);
+        }
+        else if (isRARModule(module)) {
+            planFile = GeronimoUtils.getConnectorDeploymentPlanFile(comp);
+        }
+
+        if (planFile != null) {
+            try {
+                XmlObject xmlObject = XmlBeansUtil.parse(planFile.getLocation().toFile());
+                XmlCursor cursor = xmlObject.newCursor();
+                cursor.toFirstChild();
+                xmlObject = cursor.getObject();
+                XmlObject result[] = xmlObject.selectChildren(QNameSet.singleton(EnvironmentDocument.type.getDocumentElementName()));
+                if (result != null && result.length > 0) {
+                    org.apache.geronimo.deployment.xbeans.EnvironmentType env = (org.apache.geronimo.deployment.xbeans.EnvironmentType)
result[0].changeType(org.apache.geronimo.deployment.xbeans.EnvironmentType.type);
+                    org.apache.geronimo.deployment.xbeans.ArtifactType moduleId = env.getModuleId();
+                    Trace.tracePoint("EXIT", "GeronimoV21Utils.getConfigId2", getQualifiedConfigID(moduleId));
+                    return getQualifiedConfigID(moduleId);
+                }
+                else {
+                    // 
+                    // FIXME -- Once GERONIMODEVTOOLS-263 is resolved
+                    // 
+                    String id = getConfigId(module);
+                    Trace.tracePoint("EXIT", "GeronimoV21Utils.getConfigId2", id);
+                    return id;
+                }
+            }
+            catch (IOException e) {
+                e.printStackTrace();
+            }
+            catch (XmlException e) {
+                e.printStackTrace();
+            }
+        }
+
+        Trace.tracePoint("EXIT", "GeronimoV21Utils.getConfigId2", null);
+        return null;
+    }
+
+    public static String getConfigId(IModule module) {
+        Trace.tracePoint("ENTRY", "GeronimoV21Utils.getConfigId", module);
+
+        EnvironmentType environment = null;
+        if (isWebModule(module)) {
+            WebAppType plan = getWebDeploymentPlan(module);
+            if (plan != null)
+                environment = plan.getEnvironment();
+        }
+        else if (isEjbJarModule(module)) {
+            OpenejbJarType plan = getOpenEjbDeploymentPlan(module);
+            if (plan != null)
+                environment = plan.getEnvironment();
+        }
+        else if (isEarModule(module)) {
+            ApplicationType plan = getApplicationDeploymentPlan(module);
+            if (plan != null)
+                environment = plan.getEnvironment();
+        }
+        else if (isRARModule(module)) {
+            ConnectorType plan = getConnectorDeploymentPlan(module);
+            if (plan != null)
+                environment = plan.getEnvironment();
+        }
+
+        if (environment != null
+            && environment.eIsSet(DeploymentPackage.eINSTANCE.getEnvironmentType_ModuleId()))
{
+            Trace.tracePoint("EXIT", "GeronimoV21Utils.getConfigId", getQualifiedConfigID(environment.getModuleId()));
+            return getQualifiedConfigID(environment.getModuleId());
+        }
+
+        Trace.tracePoint("EXIT", "GeronimoV21Utils.getConfigId", getId(module));
+        return getId(module);
+    }
+
+    public static String getQualifiedConfigID(ArtifactType artifact) {
+        return getQualifiedConfigID(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
artifact.getType());
+    }
+
+    public static String getQualifiedConfigID(org.apache.geronimo.deployment.xbeans.ArtifactType
artifact) {
+        return getQualifiedConfigID(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
artifact.getType());
+    }
+
+    public static String getContextRoot(IModule module) {
+        String contextRoot = null;
+
+        WebAppType deploymentPlan = getWebDeploymentPlan(module);
+        if (deploymentPlan != null)
+            contextRoot = deploymentPlan.getContextRoot();
+
+        if (contextRoot == null)
+            contextRoot = GeronimoUtils.getContextRoot(module);
+
+        return contextRoot;
+    }
+
+    public static WebAppType getWebDeploymentPlan(IModule module) {
+        return getWebDeploymentPlan(getVirtualComponent(module));
+    }
+
+    public static ApplicationType getApplicationDeploymentPlan(IModule module) {
+        return getApplicationDeploymentPlan(getVirtualComponent(module));
+    }
+
+    public static OpenejbJarType getOpenEjbDeploymentPlan(IModule module) {
+        return getOpenEjbDeploymentPlan(getVirtualComponent(module));
+    }
+
+    public static ConnectorType getConnectorDeploymentPlan(IModule module) {
+        return getConnectorDeploymentPlan(getVirtualComponent(module));
+    }
+
+    public static ApplicationType getApplicationDeploymentPlan(IVirtualComponent comp) {
+        return getApplicationDeploymentPlan(getApplicationDeploymentPlanFile(comp));
+    }
+
+    public static WebAppType getWebDeploymentPlan(IVirtualComponent comp) {
+        return getWebDeploymentPlan(getWebDeploymentPlanFile(comp));
+    }
+
+    public static OpenejbJarType getOpenEjbDeploymentPlan(IVirtualComponent comp) {
+        return getOpenEjbDeploymentPlan(getOpenEjbDeploymentPlanFile(comp));
+    }
+
+    public static ConnectorType getConnectorDeploymentPlan(IVirtualComponent comp) {
+        return getConnectorDeploymentPlan(getConnectorDeploymentPlanFile(comp));
+    }
+
+    public static ApplicationType getApplicationDeploymentPlan(IFile file) {
+        Trace.tracePoint("ENTRY", "GeronimoV21Utils.getApplicationDeploymentPlan", file);
+
+        if (file.getName().equals(APP_PLAN_NAME) && file.exists()) {
+            ResourceSet resourceSet = new ResourceSetImpl();
+            register(resourceSet, new ApplicationResourceFactoryImpl(), ApplicationPackage.eINSTANCE,
ApplicationPackage.eNS_URI);
+            Resource resource = load(file, resourceSet);
+            if (resource != null) {
+                return((org.apache.geronimo.xml.ns.j2ee.application.DocumentRoot) resource.getContents().get(0)).getApplication();
+            }
+        }
+
+        Trace.tracePoint("EXIT", "GeronimoV21Utils.getApplicationDeploymentPlan", null);
+        return null;
+    }
+
+    public static WebAppType getWebDeploymentPlan(IFile file) {
+        Trace.tracePoint("ENTRY", "GeronimoV21Utils.getWebDeploymentPlan", file);
+
+        if (file.getName().equals(WEB_PLAN_NAME) && file.exists()) {
+            ResourceSet resourceSet = new ResourceSetImpl();
+            register(resourceSet, new WebResourceFactoryImpl(), WebPackage.eINSTANCE, WebPackage.eNS_URI);
+            Resource resource = load(file, resourceSet);
+            if (resource != null) {
+                return((DocumentRoot) resource.getContents().get(0)).getWebApp();
+            }
+        }
+
+        Trace.tracePoint("EXIT", "GeronimoV21Utils.getWebDeploymentPlan", null);
+        return null;
+    }
+
+    public static OpenejbJarType getOpenEjbDeploymentPlan(IFile file) {
+        Trace.tracePoint("ENTRY", "GeronimoV21Utils.getOpenEjbDeploymentPlan", file);
+
+        if (file.getName().equals(OPENEJB_PLAN_NAME) && file.exists()) {
+            ResourceSet resourceSet = new ResourceSetImpl();
+            register(resourceSet, new JarResourceFactoryImpl(), JarPackage.eINSTANCE, JarPackage.eNS_URI);
+            Resource resource = load(file, resourceSet);
+            if (resource != null) {
+                return((org.openejb.xml.ns.openejb.jar.DocumentRoot) resource.getContents().get(0)).getOpenejbJar();
+            }
+        }
+
+        Trace.tracePoint("EXIT", "GeronimoV21Utils.getOpenEjbDeploymentPlan", null);
+        return null;
+    }
+
+    public static ConnectorType getConnectorDeploymentPlan(IFile file) {
+        Trace.tracePoint("ENTRY", "GeronimoV21Utils.getConnectorDeploymentPlan", file);
+
+        if (file.getName().equals(CONNECTOR_PLAN_NAME) && file.exists()) {
+            ResourceSet resourceSet = new ResourceSetImpl();
+            register(resourceSet, new ConnectorResourceFactoryImpl(), ConnectorPackage.eINSTANCE,
ConnectorPackage.eNS_URI);
+            Resource resource = load(file, resourceSet);
+            if (resource != null) {
+                return((org.apache.geronimo.xml.ns.j2ee.connector.DocumentRoot) resource.getContents().get(0)).getConnector();
+            }
+        }
+
+        Trace.tracePoint("EXIT", "GeronimoV21Utils.getConnectorDeploymentPlan", null);
+        return null;
+    }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/pom.xml?rev=631818&r1=631817&r2=631818&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/pom.xml Wed Feb 27 18:07:49 2008
@@ -98,7 +98,7 @@
             <dependency>
                 <groupId>com.thoughtworks.xstream</groupId>
                 <artifactId>xstream</artifactId>
-                <version>1.2.1</version>
+                <version>1.2.2</version>
             </dependency>
             <dependency>
                 <groupId>xpp3</groupId>



Mime
View raw message