geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcco...@apache.org
Subject svn commit: r648451 - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/application/ org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee...
Date Tue, 15 Apr 2008 23:10:14 GMT
Author: mcconne
Date: Tue Apr 15 16:10:08 2008
New Revision: 648451

URL: http://svn.apache.org/viewvc?rev=648451&view=rev
Log:
GERONIMODEVTOOLS-312 Re-implementd the function with a new conversion helper class rather
than associating with the conversion process with a particular runtime instance of Geronimo

Added:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/ConversionHelper.java
  (with props)
Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/application/GeronimoApplicationTest.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/applicationclient/GeronimoApplicationClientTest.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/connector/GeronimoRaTest.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/web/GeronimoWebTest.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/NamespaceFilter.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/operations/ImportDeploymentPlanOperation.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/V21DeploymentPlanCreationOperation.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/application/GeronimoApplicationTest.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/application/GeronimoApplicationTest.java?rev=648451&r1=648450&r2=648451&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/application/GeronimoApplicationTest.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/application/GeronimoApplicationTest.java
Tue Apr 15 16:10:08 2008
@@ -144,7 +144,7 @@
     }
 
 
-    private void convertNamespace(String fileExample,String fileExpected) throws Exception
{
+    private void convertNamespace(String fileExample, String fileExpected) throws Exception
{
 
         // 
         // Create unmarshaller and marshaller

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/applicationclient/GeronimoApplicationClientTest.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/applicationclient/GeronimoApplicationClientTest.java?rev=648451&r1=648450&r2=648451&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/applicationclient/GeronimoApplicationClientTest.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/applicationclient/GeronimoApplicationClientTest.java
Tue Apr 15 16:10:08 2008
@@ -145,7 +145,7 @@
     }
 
 
-    private void convertNamespace(String fileExample,String fileExpected) throws Exception
{
+    private void convertNamespace(String fileExample, String fileExpected) throws Exception
{
 
         // 
         // Create unmarshaller and marshaller

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/connector/GeronimoRaTest.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/connector/GeronimoRaTest.java?rev=648451&r1=648450&r2=648451&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/connector/GeronimoRaTest.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/connector/GeronimoRaTest.java
Tue Apr 15 16:10:08 2008
@@ -144,7 +144,7 @@
     }
 
 
-    private void convertNamespace(String fileExample,String fileExpected) throws Exception
{
+    private void convertNamespace(String fileExample, String fileExpected) throws Exception
{
 
         // 
         // Create unmarshaller and marshaller

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/web/GeronimoWebTest.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/web/GeronimoWebTest.java?rev=648451&r1=648450&r2=648451&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/web/GeronimoWebTest.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.deployment.v21.jaxbmodel/src/test/java/org/apache/geronimo/jee/web/GeronimoWebTest.java
Tue Apr 15 16:10:08 2008
@@ -147,7 +147,7 @@
     }
 
 
-    private void convertNamespace(String fileExample,String fileExpected) throws Exception
{
+    private void convertNamespace(String fileExample, String fileExpected) throws Exception
{
 
         // 
         // Create unmarshaller and marshaller

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/ConversionHelper.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/ConversionHelper.java?rev=648451&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/ConversionHelper.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/ConversionHelper.java
Tue Apr 15 16:10:08 2008
@@ -0,0 +1,154 @@
+/*
+ * 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.core.jaxb;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+
+import org.apache.geronimo.st.core.internal.Trace;
+import org.eclipse.core.resources.IFile;
+
+/**
+ * <strong>ConversionHelper</strong> is a helper class with numerous static
+ * methods to aid in the conversion of Geronimo-specific deployment plans from 
+ * one JAXB version to another (e.g., v1.1 to v2.1)<p> 
+ * 
+ * <p><strong>Note(s):</strong>
+ * <ul>
+ * <li>Although this helper class will likely alter the deployment plans passed 
+ * to it, it will not save them; the caller is responsible for persisting them 
+ * <li>This helper class will validate any changes it makes to the deployment descriptor.
An
+ * exception will be thrown if it fails to parse
+ * </ul>
+ * 
+ * 
+ * @version $Rev$ $Date$ 
+ */
+public class ConversionHelper {
+
+    /**
+     * Convert a geronimo-web.xml deployment plan file (if necessary)
+     * and return the JAXB representation
+     * 
+     * @param plan Geronimo deployment plan
+     * 
+     * @exception JAXBException if JAXB error
+     */
+    public static void convertGeronimoWebFile( IFile plan ) throws JAXBException {
+        Trace.tracePoint("Entry", "ConversionHelper.convertGeronimoWebFile", plan);
+
+        convertNamespace( plan );
+
+        Trace.tracePoint("Exit ", "ConversionHelper.convertGeronimoWebFile");
+    }
+
+
+    /**
+     * Convert a geronimo-openejb.xml deployment plan file (if necessary)
+     * and return the JAXB representation
+     * 
+     * @param plan Geronimo deployment plan
+     * 
+     * @exception JAXBException if JAXB error
+     */
+    public static void convertGeronimoOpenEjbFile( IFile plan ) throws JAXBException {
+        Trace.tracePoint("Entry", "ConversionHelper.convertGeronimoOpenEjbFile", plan);
+
+        convertNamespace( plan );
+
+        Trace.tracePoint("Exit ", "ConversionHelper.convertGeronimoOpenEjbFile");
+    }
+
+
+    /**
+     * Convert a geronimo-application.xml deployment plan file (if necessary)
+     * and return the JAXB representation
+     * 
+     * @param plan Geronimo deployment plan
+     * 
+     * @exception JAXBException if JAXB error
+     */
+    public static void convertGeronimoApplicationFile( IFile plan ) throws Exception {
+        Trace.tracePoint("Entry", "ConversionHelper.convertGeronimoApplicationFile", plan);
+
+        convertNamespace( plan );
+
+        Trace.tracePoint("Exit ", "ConversionHelper.convertGeronimoApplicationFile");
+    }
+
+
+    /**
+     * Convert a geronimo-ra.xml deployment plan file (if necessary)
+     * and return the JAXB representation
+     * 
+     * @param plan Geronimo deployment plan
+     * 
+     * @exception JAXBException if JAXB error
+     */
+    public static void convertGeronimoRaFile( IFile plan ) throws Exception {
+        Trace.tracePoint("Entry", "ConversionHelper.convertGeronimoRaFile", plan);
+
+        convertNamespace( plan );
+
+        Trace.tracePoint("Exit ", "ConversionHelper.convertGeronimoRaFile");
+    }
+
+
+    /**
+     * Convert a geronimo-application-client.xml deployment plan file
+     * and return the JAXB representation
+     * 
+     * @param plan Geronimo deployment plan
+     * 
+     * @exception JAXBException if JAXB error
+     */
+    public static void convertGeronimoApplicationClientFile( IFile plan ) throws Exception
{
+        Trace.tracePoint("Entry", "ConversionHelper.convertGeronimoApplicationClientFile",
plan);
+
+        convertNamespace( plan );
+
+        Trace.tracePoint("Exit ", "ConversionHelper.convertGeronimoApplicationClientFile");
+    }
+
+
+    /*------------------------------------------------------------------------*\
+    |                                                                          |
+    |  Private method(s)                                                       | 
+    |                                                                          |
+    \*------------------------------------------------------------------------*/
+
+
+    /**
+     * Convert the namespace of the Geronimo deployment plan and then save the 
+     * deployment plan 
+     * 
+     * @param plan Geronimo deployment plan
+     */
+    private static void convertNamespace( IFile plan ) {
+
+        // 
+        // Unmarshall and filter the deployment plan 
+        // 
+        JAXBElement jaxbElement = JAXBUtils.unmarshalFilterDeploymentPlan(plan);
+
+        // 
+        // Marshall and save the deployment plan from the jaxbElement
+        // 
+        JAXBUtils.marshalDeploymentPlan( jaxbElement, plan );
+    }
+}
\ No newline at end of file

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

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/ConversionHelper.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

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

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java?rev=648451&r1=648450&r2=648451&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXBUtils.java
Tue Apr 15 16:10:08 2008
@@ -26,6 +26,10 @@
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.sax.SAXSource;
 
 import org.apache.geronimo.st.core.Activator;
 import org.apache.geronimo.st.core.internal.Trace;
@@ -33,6 +37,8 @@
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.runtime.CoreException;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
 
 /**
  * @version $Rev$ $Date$
@@ -94,6 +100,33 @@
 			Trace.tracePoint("CoreException", "JAXBUtils.unmarshalDeploymentPlan()", file.getFullPath());
 			e.printStackTrace();
 		}
+		return null;
+	}
+
+	public static JAXBElement unmarshalFilterDeploymentPlan(IFile file) {
+		try {
+			Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            factory.setNamespaceAware(true);
+            factory.setValidating(false);
+            SAXParser parser = factory.newSAXParser();
+            NamespaceFilter xmlFilter = new NamespaceFilter(parser.getXMLReader());
+            SAXSource source = new SAXSource(xmlFilter, new InputSource( file.getContents()));
+            JAXBElement plan = (JAXBElement) unmarshaller.unmarshal(source);
+			return plan;
+		} catch (JAXBException e) {
+			Trace.tracePoint("JAXBException", "JAXBUtils.unmarshalFilterDeploymentPlan()", file.getFullPath());
+			e.printStackTrace();
+		} catch (CoreException e) {
+			Trace.tracePoint("CoreException", "JAXBUtils.unmarshalFilterDeploymentPlan()", file.getFullPath());
+			e.printStackTrace();
+        } catch (ParserConfigurationException e) {
+            Trace.tracePoint("ParserConfigurationException", "JAXBUtils.unmarshalFilterDeploymentPlan()",
file.getFullPath());
+            e.printStackTrace();
+        } catch (SAXException e) {
+            Trace.tracePoint("SAXException", "JAXBUtils.unmarshalFilterDeploymentPlan()",
file.getFullPath());
+            e.printStackTrace();
+        }
 		return null;
 	}
 

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/NamespaceFilter.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/NamespaceFilter.java?rev=648451&r1=648450&r2=648451&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/NamespaceFilter.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/NamespaceFilter.java
Tue Apr 15 16:10:08 2008
@@ -17,6 +17,10 @@
 
 package org.apache.geronimo.st.core.jaxb;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.geronimo.st.core.internal.Trace;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
@@ -32,23 +36,50 @@
  */
 public class NamespaceFilter extends XMLFilterImpl {
 
+    private static Map<String, String> namespace = new HashMap<String, String>();
+
+    static {
+        namespace.put("http://geronimo.apache.org/xml/ns/deployment-1.1", 
+                      "http://geronimo.apache.org/xml/ns/deployment-1.2");
+
+        namespace.put("http://geronimo.apache.org/xml/ns/j2ee/application-1.2", 
+                      "http://geronimo.apache.org/xml/ns/j2ee/application-2.0");
+
+        namespace.put("http://geronimo.apache.org/xml/ns/j2ee/application-client-1.1", 
+                      "http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0");
+
+        namespace.put("http://geronimo.apache.org/xml/ns/j2ee/connector-1.1", 
+                      "http://geronimo.apache.org/xml/ns/j2ee/connector-1.2");
+
+        namespace.put("http://geronimo.apache.org/xml/ns/j2ee/web-1.1", 
+                      "http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1");
+
+        namespace.put("http://geronimo.apache.org/xml/ns/j2ee/web-2.0", 
+                      "http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1");
+
+        namespace.put("http://geronimo.apache.org/xml/ns/naming-1.1", 
+                      "http://geronimo.apache.org/xml/ns/naming-1.2");
+
+        namespace.put("http://geronimo.apache.org/xml/ns/security-1.1", 
+                      "http://geronimo.apache.org/xml/ns/security-2.0");
+
+        namespace.put("http://geronimo.apache.org/xml/ns/security-1.2", 
+                      "http://geronimo.apache.org/xml/ns/security-2.0");
+    }
+
     public NamespaceFilter(XMLReader xmlReader) {
         super(xmlReader);
+        Trace.tracePoint("Constructor", "NamespaceFilter", xmlReader);
     }
 
-
     public void startElement(String uri, String localName, String qname, Attributes atts)
throws SAXException {
+        Trace.tracePoint("Entry", "NamespaceFilter.startElement", uri, localName, qname,
atts);
 
-        if (uri.equals("http://geronimo.apache.org/xml/ns/j2ee/application-1.2")) {
-            uri = "http://geronimo.apache.org/xml/ns/j2ee/application-2.0";
-        }
-        else if (uri.equals("http://geronimo.apache.org/xml/ns/j2ee/application-client-1.1"))
{
-            uri = "http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0";
-        }
-        else if (uri.equals("http://geronimo.apache.org/xml/ns/deployment-1.1")) {
-            uri = "http://geronimo.apache.org/xml/ns/deployment-1.2";
+        if (namespace.containsKey( uri )) {
+            uri = namespace.get( uri );
         }
 
+        Trace.tracePoint("Exit ", "NamespaceFilter.startElement", uri, localName, qname,
atts);
         super.startElement(uri, localName, qname, atts);
     }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/operations/ImportDeploymentPlanOperation.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/operations/ImportDeploymentPlanOperation.java?rev=648451&r1=648450&r2=648451&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/operations/ImportDeploymentPlanOperation.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/operations/ImportDeploymentPlanOperation.java
Tue Apr 15 16:10:08 2008
@@ -16,13 +16,12 @@
  */
 package org.apache.geronimo.st.core.operations;
 
-import java.io.IOException;
-
 import org.apache.geronimo.st.core.GeronimoUtils;
 import org.apache.geronimo.st.core.IGeronimoRuntime;
+import org.apache.geronimo.st.core.internal.Trace;
+import org.apache.geronimo.st.core.jaxb.ConversionHelper;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
@@ -38,65 +37,67 @@
  */
 public class ImportDeploymentPlanOperation extends AbstractGeronimoJ2EEComponentOperation
{
 
-	/**
-	 * 
-	 */
-	public ImportDeploymentPlanOperation() {
-		super();
-	}
-
-	/**
-	 * @param model
-	 */
-	public ImportDeploymentPlanOperation(IDataModel model) {
-		super(model);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor,
-	 *      org.eclipse.core.runtime.IAdaptable)
-	 */
-	public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
{
-		if (!isGeronimoRuntimeTarget())
-			return Status.OK_STATUS;
-
-		IGeronimoRuntime runtime = (IGeronimoRuntime) getRuntime().loadAdapter(IGeronimoRuntime.class,
null);
-		IVirtualComponent comp = ComponentCore.createComponent(getProject());
-		String type = J2EEProjectUtilities.getJ2EEProjectType(getProject());
-
-		IFile planFile = null;
-		
-		//try {
-			if (type.equals(IModuleConstants.JST_WEB_MODULE)) {
-				planFile = GeronimoUtils.getWebDeploymentPlanFile(comp);
-				//runtime.fixGeronimoWebSchema(planFile);	
-			} else if (type.equals(IModuleConstants.JST_EJB_MODULE)) {
-				planFile = GeronimoUtils.getOpenEjbDeploymentPlanFile(comp);
-				//runtime.fixGeronimoEjbSchema(planFile);
-			} else if (type.equals(IModuleConstants.JST_EAR_MODULE)) {
-				planFile = GeronimoUtils.getApplicationDeploymentPlanFile(comp);
-				//runtime.fixGeronimoEarSchema(planFile);
-			} else if (type.equals(IModuleConstants.JST_CONNECTOR_MODULE)) {
-				planFile = GeronimoUtils.getConnectorDeploymentPlanFile(comp);
-				//runtime.fixGeronimoConnectorSchema(planFile);
-			}
-		//} catch (XmlException e) {
-		//	throw new ExecutionException("Error fixing plan., e");
-		//}
-
-		return Status.OK_STATUS;
-	}
-
-	//private void save(XmlObject object, IFile file) {
-	//	try {
-	//		object.save(file.getLocation().toFile());
-	//		file.refreshLocal(IFile.DEPTH_ONE, null);
-	//	} catch (IOException e) {
-	//		e.printStackTrace();
-	//	} catch (CoreException e) {
-	//		e.printStackTrace();
-	//	}
-	//}
+    /**
+     * 
+     */
+    public ImportDeploymentPlanOperation() {
+        super();
+        Trace.tracePoint("Constructor", "ImportDeploymentPlanOperation");
+    }
+
+    /**
+     * @param model
+     */
+    public ImportDeploymentPlanOperation(IDataModel model) {
+        super(model);
+        Trace.tracePoint("Constructor", "ImportDeploymentPlanOperation", model);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor,
+     *      org.eclipse.core.runtime.IAdaptable)
+     */
+    public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
{
+        Trace.tracePoint("Entry", "ImportDeploymentPlanOperation.execute", monitor, info);
+
+        if (!isGeronimoRuntimeTarget())
+            return Status.OK_STATUS;
+
+        IGeronimoRuntime runtime = (IGeronimoRuntime) getRuntime().loadAdapter(IGeronimoRuntime.class,
null);
+        IVirtualComponent comp = ComponentCore.createComponent(getProject());
+        String type = J2EEProjectUtilities.getJ2EEProjectType(getProject());
+
+        IFile planFile = null;
+
+        try {
+            if (type.equals(IModuleConstants.JST_WEB_MODULE)) {
+                planFile = GeronimoUtils.getWebDeploymentPlanFile(comp);
+                ConversionHelper.convertGeronimoWebFile(planFile);    
+            }
+            else if (type.equals(IModuleConstants.JST_EJB_MODULE)) {
+                planFile = GeronimoUtils.getOpenEjbDeploymentPlanFile(comp);
+                ConversionHelper.convertGeronimoOpenEjbFile(planFile);
+            }
+            else if (type.equals(IModuleConstants.JST_EAR_MODULE)) {
+                planFile = GeronimoUtils.getApplicationDeploymentPlanFile(comp);
+                ConversionHelper.convertGeronimoApplicationFile(planFile);
+            }
+            else if (type.equals(IModuleConstants.JST_CONNECTOR_MODULE)) {
+                planFile = GeronimoUtils.getConnectorDeploymentPlanFile(comp);
+                ConversionHelper.convertGeronimoRaFile(planFile);
+            }
+            else if (type.equals(IModuleConstants.JST_APPCLIENT_MODULE)) {
+                planFile = GeronimoUtils.getApplicationClientDeploymentPlanFile(comp);
+                ConversionHelper.convertGeronimoApplicationClientFile(planFile);
+            }
+        }
+        catch (Exception e) {
+            throw new ExecutionException("ImportDeploymentPlanOperation.execute(): Error
converting plan: " + planFile.getFullPath() );
+        }
+
+        Trace.tracePoint("Exit ", "ImportDeploymentPlanOperation.execute", Status.OK_STATUS);
+        return Status.OK_STATUS;
+    }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/V21DeploymentPlanCreationOperation.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/V21DeploymentPlanCreationOperation.java?rev=648451&r1=648450&r2=648451&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/V21DeploymentPlanCreationOperation.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/V21DeploymentPlanCreationOperation.java
Tue Apr 15 16:10:08 2008
@@ -60,7 +60,7 @@
 
 	public V21DeploymentPlanCreationOperation(IDataModel model, Object config) {
 		super(model, config);
-  		Trace.tracePoint("Constructor Entry/Exit", "V21DeploymentPlanCreationOperation", model,
config);
+  		Trace.tracePoint("Constructor", "V21DeploymentPlanCreationOperation", model, config);
 	}
 	
 	



Mime
View raw message