geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r493058 [2/2] - in /geronimo/devtools/eclipse-plugin/trunk: ./ plugins/ plugins/org.apache.geronimo.runtime.v12/ plugins/org.apache.geronimo.runtime.v12/META-INF/ plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ plugins/...
Date Fri, 05 Jan 2007 16:04:47 GMT
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServer.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServer.java?view=auto&rev=493058
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServer.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServer.java Fri Jan  5 08:04:44 2007
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v12.core;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.factories.DeploymentFactory;
+
+import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
+import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
+import org.apache.geronimo.st.core.GeronimoServerDelegate;
+import org.apache.geronimo.st.core.IGeronimoVersionHandler;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.util.SocketUtil;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoServer extends GeronimoServerDelegate {
+	
+	public static final String PROPERTY_IN_PLACE_SHARED_LIB = "inPlaceSharedLib";
+	public static final String PROPERTY_RUN_FROM_WORKSPACE = "runFromWorkspace";
+
+	private static IGeronimoVersionHandler versionHandler = null;
+	
+	private static DeploymentFactory deploymentFactory;
+	
+	static {
+		deploymentFactory = new DeploymentFactoryImpl();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.core.GenericGeronimoServer#getContextRoot(org.eclipse.wst.server.core.IModule)
+	 */
+	public String getContextRoot(IModule module) {
+		return GeronimoV12Utils.getContextRoot(module);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoServer#getDeployerURL()
+	 */
+	public String getDeployerURL() {
+		return "deployer:geronimo:jmx://" + getServer().getHost() + ":" + getRMINamingPort();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoServer#getJMXServiceURL()
+	 */
+	public String getJMXServiceURL() {
+		String host = getServer().getHost();
+		return "service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":" + getRMINamingPort() + "/JMXConnector";
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoServer#getJSR88DeployerJar()
+	 */
+	public IPath getJSR88DeployerJar() {
+		return getServer().getRuntime().getLocation().append("/lib/geronimo-deploy-jsr88-1.1.jar");
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoServer#getDeploymentFactory()
+	 */
+	public DeploymentFactory getDeploymentFactory() {
+		return deploymentFactory;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoServer#configureDeploymentManager(javax.enterprise.deploy.spi.DeploymentManager)
+	 */
+	public void configureDeploymentManager(DeploymentManager dm) {
+		((JMXDeploymentManager) dm).setLogConfiguration(true, true);
+		boolean enableInPlace = SocketUtil.isLocalhost(getServer().getHost()) && isRunFromWorkspace();
+		setInPlaceDeployment(dm, enableInPlace);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoServer#getVersionHandler()
+	 */
+	public IGeronimoVersionHandler getVersionHandler() {
+		if (versionHandler == null)
+			versionHandler = new GeronimoV12VersionHandler();
+		return versionHandler;
+	}
+
+	public void setInPlaceDeployment(DeploymentManager dm, boolean enable) {
+		((JMXDeploymentManager) dm).setInPlace(enable);
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.core.IGeronimoServer#isInPlace()
+	 */
+	public boolean isInPlaceSharedLib() {
+		return getAttribute(PROPERTY_IN_PLACE_SHARED_LIB, false);
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.core.IGeronimoServer#isRunFromWorkspace()
+	 */
+	public boolean isRunFromWorkspace() {
+		return getAttribute(PROPERTY_RUN_FROM_WORKSPACE, false);
+	}
+	
+	public void setInPlaceSharedLib(boolean enable) {
+		setAttribute(PROPERTY_IN_PLACE_SHARED_LIB, enable);
+	}
+	
+	public void setRunFromWorkspace(boolean enable) {
+		setAttribute(PROPERTY_RUN_FROM_WORKSPACE, enable);
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.core.GeronimoServerDelegate#setDefaults(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public void setDefaults(IProgressMonitor monitor) {
+		super.setDefaults(monitor);
+		setInPlaceSharedLib(false);
+		setRunFromWorkspace(false);
+	}
+
+}
\ No newline at end of file

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServer.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServerBehaviour.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServerBehaviour.java?view=auto&rev=493058
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServerBehaviour.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServerBehaviour.java Fri Jan  5 08:04:44 2007
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v12.core;
+
+import java.net.URL;
+import java.util.Set;
+
+import javax.management.MBeanServerConnection;
+import javax.naming.directory.NoSuchAttributeException;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.InternalKernelException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.PersistentConfigurationList;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.st.core.Activator;
+import org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate;
+import org.apache.geronimo.st.v12.core.internal.Trace;
+import org.apache.geronimo.system.jmx.KernelDelegate;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.IModulePublishHelper;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoServerBehaviour extends GeronimoServerBehaviourDelegate implements IModulePublishHelper {
+
+	private Kernel kernel = null;
+
+	public GeronimoServerBehaviour() {
+		super();
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate#stopKernel()
+	 */
+	protected void stopKernel() {
+		if (kernel != null) {
+			kernel.shutdown();
+			kernel = null;
+		}
+	}
+
+	/**
+	 * @return
+	 * @throws SecurityException
+	 */
+	protected Kernel getKernel() throws SecurityException {
+		if (kernel == null) {
+			try {
+				MBeanServerConnection connection = getServerConnection();
+				if (connection != null)
+					kernel = new KernelDelegate(connection);
+			} catch (SecurityException e) {
+				throw e;
+			} catch (Exception e) {
+				Trace.trace(Trace.WARNING, "Kernel connection failed. "
+						+ e.getMessage());
+			}
+		}
+		return kernel;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoServerBehavior#isKernelAlive()
+	 */
+	public boolean isKernelAlive() {
+		try {
+			return getKernel() != null && kernel.isRunning();
+		} catch (SecurityException e) {
+			Activator.log(Status.ERROR, "Invalid username and/or password.", e);
+			pingThread.interrupt();
+			if (getServer().getServerState() != IServer.STATE_STOPPED) {
+				stop(true);
+			}
+		} catch (Exception e) {
+			Activator.log(Status.WARNING, "Geronimo Server may have been terminated manually outside of workspace.", e);
+			kernel = null;
+		}
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoServerBehavior#isFullyStarted()
+	 */
+	public boolean isFullyStarted() {
+		if (isKernelAlive()) {
+			AbstractNameQuery query = new AbstractNameQuery(PersistentConfigurationList.class.getName());
+			Set configLists = kernel.listGBeans(query);
+			if (!configLists.isEmpty()) {
+				AbstractName on = (AbstractName) configLists.toArray()[0];
+				try {
+					Boolean b = (Boolean) kernel.getAttribute(on, "kernelFullyStarted");
+					return b.booleanValue();
+				} catch (GBeanNotFoundException e) {
+					// ignore
+				} catch (NoSuchAttributeException e) {
+					// ignore
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+			} else {
+				Trace.trace(Trace.INFO, "configLists is empty");
+			}
+		}
+		return false;
+	}
+
+	public IPath getPublishDirectory(IModule[] module) {
+		if (module == null || module.length == 0)
+			return null;
+
+		if (getGeronimoServer().isRunFromWorkspace()) {
+			// TODO fix me, see if project root, component root, or output
+			// container should be returned
+			return module[module.length - 1].getProject().getLocation();
+		} else {
+			ClassLoader old = Thread.currentThread().getContextClassLoader();
+			try {
+				Thread.currentThread().setContextClassLoader(getContextClassLoader());
+				String configId = getConfigId(module[0]);
+				Artifact artifact = Artifact.create(configId);
+				AbstractName name = Configuration.getConfigurationAbstractName(artifact);
+				GBeanData data = kernel.getGBeanData(name);
+				URL url = (URL) data.getAttribute("baseURL");
+				return getModulePath(module, url);
+			} catch (InvalidConfigException e) {
+				e.printStackTrace();
+			} catch (GBeanNotFoundException e) {
+				e.printStackTrace();
+			} catch (InternalKernelException e) {
+				e.printStackTrace();
+			} finally {
+				Thread.currentThread().setContextClassLoader(old);
+			}
+		}
+
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.GenericGeronimoServerBehaviour#getContextClassLoader()
+	 */
+	protected ClassLoader getContextClassLoader() {
+		return Kernel.class.getClassLoader();
+	}
+}
\ No newline at end of file

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServerBehaviour.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServerBehaviour.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoServerBehaviour.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12Utils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12Utils.java?view=auto&rev=493058
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12Utils.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12Utils.java Fri Jan  5 08:04:44 2007
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v12.core;
+
+import java.io.IOException;
+
+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.xml.ns.deployment.ArtifactType;
+import org.apache.geronimo.xml.ns.deployment.DeploymentPackage;
+import org.apache.geronimo.xml.ns.deployment.EnvironmentType;
+import org.apache.geronimo.xml.ns.j2ee.application.ApplicationPackage;
+import org.apache.geronimo.xml.ns.j2ee.application.ApplicationType;
+import org.apache.geronimo.xml.ns.j2ee.application.util.ApplicationResourceFactoryImpl;
+import org.apache.geronimo.xml.ns.j2ee.connector.ConnectorPackage;
+import org.apache.geronimo.xml.ns.j2ee.connector.ConnectorType;
+import org.apache.geronimo.xml.ns.j2ee.connector.util.ConnectorResourceFactoryImpl;
+import org.apache.geronimo.xml.ns.j2ee.web.DocumentRoot;
+import org.apache.geronimo.xml.ns.j2ee.web.WebAppType;
+import org.apache.geronimo.xml.ns.j2ee.web.WebPackage;
+import org.apache.geronimo.xml.ns.j2ee.web.util.WebResourceFactoryImpl;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.server.core.IModule;
+import org.openejb.xml.ns.openejb.jar.JarPackage;
+import org.openejb.xml.ns.openejb.jar.OpenejbJarType;
+import org.openejb.xml.ns.openejb.jar.util.JarResourceFactoryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoV12Utils 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 getQualifiedConfigID(String groupId, String artifactId, String version, String type) {
+		return groupId + "/" + artifactId + "/" + version + "/" + type;
+	}
+
+	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;
+	}
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12Utils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12Utils.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12Utils.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12VersionHandler.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12VersionHandler.java?view=auto&rev=493058
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12VersionHandler.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12VersionHandler.java Fri Jan  5 08:04:44 2007
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v12.core;
+
+import javax.enterprise.deploy.spi.TargetModuleID;
+
+import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
+import org.apache.geronimo.st.core.IGeronimoVersionHandler;
+import org.eclipse.wst.server.core.IModule;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoV12VersionHandler implements IGeronimoVersionHandler {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoVersionHandler#getConfigID(org.eclipse.wst.server.core.IModule)
+	 */
+	public String getConfigID(IModule module) {
+		return GeronimoV12Utils.getConfigId2(module);
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.core.IGeronimoVersionHandler#createTargetModuleId(java.lang.String)
+	 */
+	public TargetModuleID createTargetModuleId(String configId) {
+		return new TargetModuleIDImpl(null, configId);
+	}
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12VersionHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12VersionHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/GeronimoV12VersionHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/internal/Trace.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/internal/Trace.java?view=auto&rev=493058
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/internal/Trace.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/internal/Trace.java Fri Jan  5 08:04:44 2007
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v12.core.internal;
+
+import org.apache.geronimo.st.v12.core.Activator;
+
+/**
+ * Helper class to route trace output.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Trace {
+
+	/**
+	 * Finest trace event.
+	 */
+	public static byte INFO = 0;
+
+	/**
+	 * Warning trace event.
+	 */
+	public static byte WARNING = 1;
+
+	/**
+	 * Severe trace event.
+	 */
+	public static byte SEVERE = 2;
+
+	/**
+	 * Trace constructor comment.
+	 */
+	private Trace() {
+		super();
+	}
+
+	/**
+	 * Trace the given text.
+	 * 
+	 * @param level
+	 *            the trace level
+	 * @param s
+	 *            a message
+	 */
+	public static void trace(byte level, String s) {
+		trace(level, s, null);
+	}
+
+	/**
+	 * Trace the given message and exception.
+	 * 
+	 * @param level
+	 *            the trace level
+	 * @param s
+	 *            a message
+	 * @param t
+	 *            a throwable
+	 */
+	public static void trace(byte level, String s, Throwable t) {
+		if (!Activator.getDefault().isDebugging())
+			return;
+
+		System.out.println(Activator.PLUGIN_ID + ":  " + s);
+		if (t != null)
+			t.printStackTrace();
+	}
+}
\ No newline at end of file

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/internal/Trace.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/internal/Trace.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/internal/Trace.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/GeronimoV12FacetInstallDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/GeronimoV12FacetInstallDelegate.java?view=auto&rev=493058
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/GeronimoV12FacetInstallDelegate.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/GeronimoV12FacetInstallDelegate.java Fri Jan  5 08:04:44 2007
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v12.core.operations;
+
+import org.apache.geronimo.st.core.GeronimoFacetInstallDelegate;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.common.project.facet.JavaProjectFacetCreationDataModelProvider;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoV12FacetInstallDelegate extends GeronimoFacetInstallDelegate {
+
+	public IDataModelOperation createDeploymentPlanCreationOp(IProject project, Object config) {
+		IDataModel model = DataModelFactory.createDataModel(new JavaProjectFacetCreationDataModelProvider());
+		model.setStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, project.getName());
+		return new V12DeploymentPlanCreationOperation(model, config);
+	}
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/GeronimoV12FacetInstallDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/GeronimoV12FacetInstallDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/GeronimoV12FacetInstallDelegate.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/V12DeploymentPlanCreationOperation.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/V12DeploymentPlanCreationOperation.java?view=auto&rev=493058
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/V12DeploymentPlanCreationOperation.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/V12DeploymentPlanCreationOperation.java Fri Jan  5 08:04:44 2007
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v12.core.operations;
+
+import org.apache.geronimo.st.core.GeronimoSchemaNS;
+import org.apache.geronimo.st.core.operations.DeploymentPlanCreationOperation;
+import org.apache.geronimo.st.v12.core.DeploymentPlanInstallConfig;
+import org.apache.geronimo.st.v12.core.GeronimoV12Utils;
+import org.apache.geronimo.xml.ns.deployment.ArtifactType;
+import org.apache.geronimo.xml.ns.deployment.DependenciesType;
+import org.apache.geronimo.xml.ns.deployment.DependencyType;
+import org.apache.geronimo.xml.ns.deployment.DeploymentFactory;
+import org.apache.geronimo.xml.ns.deployment.DeploymentPackage;
+import org.apache.geronimo.xml.ns.deployment.DocumentRoot;
+import org.apache.geronimo.xml.ns.deployment.EnvironmentType;
+import org.apache.geronimo.xml.ns.deployment.ModuleType;
+import org.apache.geronimo.xml.ns.deployment.util.DeploymentResourceFactoryImpl;
+import org.apache.geronimo.xml.ns.j2ee.application.ApplicationFactory;
+import org.apache.geronimo.xml.ns.j2ee.application.ApplicationPackage;
+import org.apache.geronimo.xml.ns.j2ee.application.ApplicationType;
+import org.apache.geronimo.xml.ns.j2ee.application.util.ApplicationResourceFactoryImpl;
+import org.apache.geronimo.xml.ns.j2ee.connector.ConnectorFactory;
+import org.apache.geronimo.xml.ns.j2ee.connector.ConnectorPackage;
+import org.apache.geronimo.xml.ns.j2ee.connector.ConnectorType;
+import org.apache.geronimo.xml.ns.j2ee.connector.util.ConnectorResourceFactoryImpl;
+import org.apache.geronimo.xml.ns.j2ee.web.WebAppType;
+import org.apache.geronimo.xml.ns.j2ee.web.WebFactory;
+import org.apache.geronimo.xml.ns.j2ee.web.WebPackage;
+import org.apache.geronimo.xml.ns.j2ee.web.util.WebResourceFactoryImpl;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.openejb.xml.ns.openejb.jar.JarFactory;
+import org.openejb.xml.ns.openejb.jar.JarPackage;
+import org.openejb.xml.ns.openejb.jar.OpenejbJarType;
+import org.openejb.xml.ns.openejb.jar.util.JarResourceFactoryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class V12DeploymentPlanCreationOperation extends DeploymentPlanCreationOperation {
+
+	DeploymentPlanInstallConfig cfg;
+
+	public V12DeploymentPlanCreationOperation(IDataModel model, Object config) {
+		super(model, config);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.operations.IDeploymentPlanCreationOp#createGeronimoApplicationDeploymentPlan(org.eclipse.core.resources.IFile)
+	 */
+	public EObject createGeronimoApplicationDeploymentPlan(IFile dpFile) {
+		URI uri = URI.createPlatformResourceURI(dpFile.getFullPath().toString());
+
+		ResourceSet resourceSet = new ResourceSetImpl();
+		GeronimoV12Utils.register(resourceSet, new ApplicationResourceFactoryImpl(), ApplicationPackage.eINSTANCE, ApplicationPackage.eNS_URI);
+
+		Resource resource = resourceSet.createResource(uri);
+		org.apache.geronimo.xml.ns.j2ee.application.DocumentRoot documentRoot = ApplicationFactory.eINSTANCE.createDocumentRoot();
+		ApplicationType root = ApplicationFactory.eINSTANCE.createApplicationType();
+
+		EMap map = documentRoot.getXMLNSPrefixMap();
+		map.put("", GeronimoSchemaNS.GERONIMO_APP_NS_1_1);
+		map.put("sec", GeronimoSchemaNS.GERONIMO_SECURITY_NS_1_1);
+		map.put("sys", GeronimoSchemaNS.GERONIMO_DEPLOYMENT_NS_1_1);
+
+		root.setApplicationName(getProject().getName());
+		root.setEnvironment(getConfigEnvironment());
+
+		documentRoot.setApplication(root);
+		resource.getContents().add(documentRoot);
+
+		save(resource);
+
+		return root;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.operations.IDeploymentPlanCreationOp#createGeronimoWebDeploymentPlan(org.eclipse.core.resources.IFile)
+	 */
+	public EObject createGeronimoWebDeploymentPlan(IFile dpFile) {
+
+		URI uri = URI.createPlatformResourceURI(dpFile.getFullPath().toString());
+
+		ResourceSet resourceSet = new ResourceSetImpl();
+		GeronimoV12Utils.register(resourceSet, new WebResourceFactoryImpl(), WebPackage.eINSTANCE, WebPackage.eNS_URI);
+
+		Resource resource = resourceSet.createResource(uri);
+		org.apache.geronimo.xml.ns.j2ee.web.DocumentRoot documentRoot = WebFactory.eINSTANCE.createDocumentRoot();
+
+		EMap map = documentRoot.getXMLNSPrefixMap();
+		map.put("", GeronimoSchemaNS.GERONIMO_WEB_NS_1_1);
+		map.put("sec", GeronimoSchemaNS.GERONIMO_SECURITY_NS_1_1);
+		map.put("nam", GeronimoSchemaNS.GERONIMO_NAMING_NS_1_1);
+		map.put("sys", GeronimoSchemaNS.GERONIMO_DEPLOYMENT_NS_1_1);
+
+		WebAppType root = WebFactory.eINSTANCE.createWebAppType();
+
+		root.setEnvironment(getConfigEnvironment());
+		root.setContextRoot("/" + getProject().getName());
+		// root.setContextPriorityClassloader(false); //TODO Replace this with
+		// inverse-classloading
+
+		documentRoot.setWebApp(root);
+		resource.getContents().add(documentRoot);
+
+		save(resource);
+
+		return root;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.operations.IDeploymentPlanCreationOp#createOpenEjbDeploymentPlan(org.eclipse.core.resources.IFile)
+	 */
+	public EObject createOpenEjbDeploymentPlan(IFile dpFile) {
+		URI uri = URI.createPlatformResourceURI(dpFile.getFullPath().toString());
+
+		ResourceSet resourceSet = new ResourceSetImpl();
+		GeronimoV12Utils.register(resourceSet, new JarResourceFactoryImpl(), JarPackage.eINSTANCE, JarPackage.eNS_URI);
+
+		Resource resource = resourceSet.createResource(uri);
+		org.openejb.xml.ns.openejb.jar.DocumentRoot documentRoot = JarFactory.eINSTANCE.createDocumentRoot();
+		OpenejbJarType root = JarFactory.eINSTANCE.createOpenejbJarType();
+
+		EMap map = documentRoot.getXMLNSPrefixMap();
+		map.put("", GeronimoSchemaNS.GERONIMO_OPENEJB_NS_2_1);
+		map.put("sec", GeronimoSchemaNS.GERONIMO_SECURITY_NS_1_1);
+		map.put("nam", GeronimoSchemaNS.GERONIMO_NAMING_NS_1_1);
+		map.put("sys", GeronimoSchemaNS.GERONIMO_DEPLOYMENT_NS_1_1);
+		map.put("pkgen", GeronimoSchemaNS.GERONIMO_PKGEN_NS_2_0);
+
+		root.setEnvironment(getConfigEnvironment());
+		root.setEnterpriseBeans(JarFactory.eINSTANCE.createEnterpriseBeansType());
+
+		documentRoot.setOpenejbJar(root);
+		resource.getContents().add(documentRoot);
+
+		save(resource);
+
+		return root;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.operations.IDeploymentPlanCreationOp#createConnectorDeploymentPlan(org.eclipse.core.resources.IFile)
+	 */
+	public EObject createConnectorDeploymentPlan(IFile dpFile) {
+		URI uri = URI.createPlatformResourceURI(dpFile.getFullPath().toString());
+
+		ResourceSet resourceSet = new ResourceSetImpl();
+		GeronimoV12Utils.register(resourceSet, new ConnectorResourceFactoryImpl(), ConnectorPackage.eINSTANCE, ConnectorPackage.eNS_URI);
+
+		Resource resource = resourceSet.createResource(uri);
+		org.apache.geronimo.xml.ns.j2ee.connector.DocumentRoot documentRoot = ConnectorFactory.eINSTANCE.createDocumentRoot();
+		ConnectorType root = ConnectorFactory.eINSTANCE.createConnectorType();
+
+		EMap map = documentRoot.getXMLNSPrefixMap();
+		map.put("", GeronimoSchemaNS.GERONIMO_CONNECTOR_NS_1_1);
+		map.put("nam", GeronimoSchemaNS.GERONIMO_NAMING_NS_1_1);
+		map.put("sys", GeronimoSchemaNS.GERONIMO_DEPLOYMENT_NS_1_1);
+
+		root.setEnvironment(getConfigEnvironment());
+		documentRoot.setConnector(root);
+		resource.getContents().add(documentRoot);
+
+		save(resource);
+
+		return root;
+	}
+
+	public EObject createServiceDeploymentPlan(IFile dpFile) {
+		URI uri = URI.createPlatformResourceURI(dpFile.getFullPath().toString());
+
+		ResourceSet resourceSet = new ResourceSetImpl();
+		GeronimoV12Utils.register(resourceSet, new DeploymentResourceFactoryImpl(), DeploymentPackage.eINSTANCE, DeploymentPackage.eNS_URI);
+
+		Resource resource = resourceSet.createResource(uri);
+		DocumentRoot documentRoot = DeploymentFactory.eINSTANCE.createDocumentRoot();
+		ModuleType root = DeploymentFactory.eINSTANCE.createModuleType();
+
+		EMap map = documentRoot.getXMLNSPrefixMap();
+		map.put("sys", GeronimoSchemaNS.GERONIMO_DEPLOYMENT_NS_1_1);
+
+		root.setEnvironment(getConfigEnvironment());
+		documentRoot.setModule(root);
+		resource.getContents().add(documentRoot);
+
+		save(resource);
+
+		return root;
+	}
+
+	public EnvironmentType getConfigEnvironment() {
+		if (config != null && config instanceof DeploymentPlanInstallConfig) {
+			cfg = (DeploymentPlanInstallConfig) config;
+		}
+
+		String groupId = cfg != null && hasValue(cfg.getGroupId()) ? cfg.getGroupId()
+				: "default";
+		String artifactId = cfg != null && hasValue(cfg.getArtifactId()) ? cfg.getArtifactId()
+				: getProject().getName();
+		String version = cfg != null && hasValue(cfg.getVersion()) ? cfg.getVersion()
+				: "1.0";
+		String type = cfg != null && hasValue(cfg.getType()) ? cfg.getType()
+				: "car";
+
+		ArtifactType artifact = createArtifactType(groupId, artifactId, version, type);
+		EnvironmentType env = DeploymentFactory.eINSTANCE.createEnvironmentType();
+		env.setModuleId(artifact);
+
+		if (cfg != null && cfg.isSharedLib()) {
+			DependenciesType dt = DeploymentFactory.eINSTANCE.createDependenciesType();
+			ArtifactType sharedLib = createDependencyType("geronimo", "sharedlib", null, "car");
+			dt.getDependency().add(sharedLib);
+			env.setDependencies(dt);
+		}
+
+		return env;
+	}
+
+	public static ArtifactType createArtifactType(String groupId, String artifactId, String version, String type) {
+		ArtifactType artifact = DeploymentFactory.eINSTANCE.createArtifactType();
+		if (groupId != null)
+			artifact.setGroupId(groupId);
+		if (artifactId != null)
+			artifact.setArtifactId(artifactId);
+		if (version != null)
+			artifact.setVersion(version);
+		artifact.setType(type);
+		return artifact;
+	}
+
+	public static ArtifactType createDependencyType(String groupId, String artifactId, String version, String type) {
+		DependencyType artifact = DeploymentFactory.eINSTANCE.createDependencyType();
+		if (groupId != null)
+			artifact.setGroupId(groupId);
+		if (artifactId != null)
+			artifact.setArtifactId(artifactId);
+		if (version != null)
+			artifact.setVersion(version);
+		artifact.setType(type);
+		return artifact;
+	}
+
+	private static boolean hasValue(String attribute) {
+		return attribute != null && attribute.trim().length() != 0;
+	}
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/V12DeploymentPlanCreationOperation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/V12DeploymentPlanCreationOperation.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v12.core/src/org/apache/geronimo/st/v12/core/operations/V12DeploymentPlanCreationOperation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml?view=diff&rev=493058&r1=493057&r2=493058
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml Fri Jan  5 08:04:44 2007
@@ -123,6 +123,7 @@
         <module>org.apache.geronimo.st.core</module>
         <module>org.apache.geronimo.st.v1.core</module>
         <module>org.apache.geronimo.st.v11.core</module>
+        <module>org.apache.geronimo.st.v12.core</module>
         <module>org.apache.geronimo.st.ui</module>
         <module>org.apache.geronimo.st.v1.ui</module>
         <module>org.apache.geronimo.st.v11.ui</module>
@@ -135,6 +136,6 @@
         <module>org.apache.geronimo.runtime.common</module>
         <module>org.apache.geronimo.runtime.v1</module>
         <module>org.apache.geronimo.runtime.v11</module>
-        <!--<module>org.apache.geronimo.runtime.v12</module>-->
+        <module>org.apache.geronimo.runtime.v12</module>
     </modules>
 </project>

Modified: geronimo/devtools/eclipse-plugin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/pom.xml?view=diff&rev=493058&r1=493057&r2=493058
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/pom.xml Fri Jan  5 08:04:44 2007
@@ -73,6 +73,7 @@
         <org.apache.geronimo.st.core_version>1.1.0</org.apache.geronimo.st.core_version>
         <org.apache.geronimo.st.v1.core_version>1.1.0</org.apache.geronimo.st.v1.core_version>
         <org.apache.geronimo.st.v11.core_version>1.1.0</org.apache.geronimo.st.v11.core_version>
+        <org.apache.geronimo.st.v12.core_version>1.0.0</org.apache.geronimo.st.v12.core_version>
         <org.apache.geronimo.st.ui_version>1.1.0</org.apache.geronimo.st.ui_version>
         <org.apache.geronimo.st.v1.ui_version>1.1.0</org.apache.geronimo.st.v1.ui_version>
         <org.apache.geronimo.st.v11.ui_version>1.1.0</org.apache.geronimo.st.v11.ui_version>



Mime
View raw message