geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From de...@apache.org
Subject svn commit: r824070 [1/3] - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.j2ee.v11.jaxbmodel/src/main/java/org/apache/geronimo/xml/ns/j2ee/application_client_1/ org.apache.geronimo.st.core/ org.apache.geronimo.st.core/META-INF...
Date Sun, 11 Oct 2009 13:27:38 GMT
Author: delos
Date: Sun Oct 11 13:27:37 2009
New Revision: 824070

URL: http://svn.apache.org/viewvc?rev=824070&view=rev
Log:
GERONIMODEVTOOLS-596 Re-factor related code to separate JAXBUtils of 1.1 server adapter from 2.1 server adapter.Add extension point jaxb/IJAXBUtilsProvider.java,jaxb/JAXB11Utils.java and jaxb/JAXB21Utils.java

Added:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/schema/JAXBUtilsProvider.exsd
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/IJAXBUtilsProvider.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXB21Utils.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/LICENSE.txt
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/NOTICE.txt
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyManager.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/jaxb/JAXB11Utils.java
Removed:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/jaxb/JAXBObjectFactory.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/jaxb/JAXBUtils.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/pages/AppClientSecurityPage.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/AppClientSecuritySection.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/LicenseWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/SecurityRunAsSubjectWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ServerCustomAssemblyWizard.java
Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/src/main/java/org/apache/geronimo/xml/ns/j2ee/application_client_1/ApplicationClientType.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/plugin.xml
    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.v11.core/META-INF/MANIFEST.MF
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/plugin.xml
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/GeronimoServerInfo.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/GeronimoV11Utils.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/jaxb/JAXBObjectFactoryImpl.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/GeronimoV11FacetInstallDelegate.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/V11DeploymentPlanCreationOperation.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/META-INF/MANIFEST.MF
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/plugin.xml
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/editors/GeronimoFormContentLoader.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/pages/AppClientGeneralPage.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/pages/AppGeneralPage.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/pages/DeploymentPage.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/pages/EjbOverviewPage.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/pages/NamingFormPage.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/pages/SecurityPage.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/pages/WebGeneralPage.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/CommonGeneralSection.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/WebGeneralSection.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/AdminObjectWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbLocalRefWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbRefWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ExtModuleWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/GBeanRefWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/GBeanWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ModuleWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ResourceEnvRefWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ResourceRefWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/SecurityRoleMappingWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ServiceRefWizard.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/src/main/java/org/apache/geronimo/xml/ns/j2ee/application_client_1/ApplicationClientType.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/src/main/java/org/apache/geronimo/xml/ns/j2ee/application_client_1/ApplicationClientType.java?rev=824070&r1=824069&r2=824070&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/src/main/java/org/apache/geronimo/xml/ns/j2ee/application_client_1/ApplicationClientType.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/src/main/java/org/apache/geronimo/xml/ns/j2ee/application_client_1/ApplicationClientType.java Sun Oct 11 13:27:37 2009
@@ -124,6 +124,7 @@
      */
     public void setClientEnvironment(EnvironmentType value) {
         this.clientEnvironment = value;
+        this.clientEnvironment.getModuleId().setArtifactId(value.getModuleId().getArtifactId()+"ClientSide");
     }
 
     /**
@@ -148,6 +149,7 @@
      */
     public void setServerEnvironment(EnvironmentType value) {
         this.serverEnvironment = value;
+        this.serverEnvironment.getModuleId().setArtifactId(value.getModuleId().getArtifactId()+"ServerSide");
     }
 
     /**

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF?rev=824070&r1=824069&r2=824070&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF Sun Oct 11 13:27:37 2009
@@ -9,7 +9,6 @@
 Require-Bundle: org.apache.geronimo.runtime.common,
  org.apache.geronimo.runtime.v22,
  org.apache.geronimo.jee.v21.jaxbmodel,
- org.apache.geronimo.j2ee.v11.jaxbmodel,
  org.eclipse.core.runtime,
  org.eclipse.wst.server.core,
  org.eclipse.jst.j2ee,

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/plugin.xml?rev=824070&r1=824069&r2=824070&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/plugin.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/plugin.xml Sun Oct 11 13:27:37 2009
@@ -20,8 +20,8 @@
 <!-- $Rev$ $Date$ -->
 
 <plugin>
-
     <extension-point id="sourcePathComputerMapping" name="Geronimo Deployment Plan Loader" schema="schema/sourcePathComputerMapping.exsd"/>
+    <extension-point id="JAXBUtilsProvider" name="Geronimo JAXB Utils" schema="schema/JAXBUtilsProvider.exsd"/>
 
     <extension point="org.eclipse.debug.core.launchConfigurationTypes">
         <launchConfigurationType
@@ -195,7 +195,10 @@
                </configuration>            
            </mechanism>    
        </association>
-           
+   </extension>
+   
+   <extension point="org.apache.geronimo.st.core.JAXBUtilsProvider">
+       <provider class="org.apache.geronimo.st.core.jaxb.JAXB21Utils" version="2.0,2.1,2.2"/>
    </extension>
  
 </plugin>

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/schema/JAXBUtilsProvider.exsd
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/schema/JAXBUtilsProvider.exsd?rev=824070&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/schema/JAXBUtilsProvider.exsd (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/schema/JAXBUtilsProvider.exsd Sun Oct 11 13:27:37 2009
@@ -0,0 +1,106 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.apache.geronimo.st.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appInfo>
+         <meta.schema plugin="org.apache.geronimo.st.core" id="JAXBUtilsProvider" name="Geronimo JAXB Utils"/>
+      </appInfo>
+      <documentation>
+         Provide JAXB Util implementation of specified version
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appInfo>
+            <meta.element />
+         </appInfo>
+      </annotation>
+      <complexType>
+         <sequence>
+            <element ref="provider"/>
+         </sequence>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appInfo>
+                  <meta.attribute translatable="true"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="provider">
+      <complexType>
+         <attribute name="class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="version" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="since"/>
+      </appInfo>
+      <documentation>
+         [Enter the first release in which this extension point appears.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="examples"/>
+      </appInfo>
+      <documentation>
+         [Enter extension point usage example here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="apiinfo"/>
+      </appInfo>
+      <documentation>
+         [Enter API information here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="implementation"/>
+      </appInfo>
+      <documentation>
+         [Enter information about supplied implementation of this extension point.]
+      </documentation>
+   </annotation>
+
+
+</schema>

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/IJAXBUtilsProvider.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/IJAXBUtilsProvider.java?rev=824070&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/IJAXBUtilsProvider.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/IJAXBUtilsProvider.java Sun Oct 11 13:27:37 2009
@@ -0,0 +1,17 @@
+package org.apache.geronimo.st.core.jaxb;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+
+import org.eclipse.core.resources.IFile;
+
+public interface IJAXBUtilsProvider {
+	 public JAXBContext getJAXBContext();
+	 public void marshalDeploymentPlan(JAXBElement jaxbElement, IFile file) throws Exception;
+	 public void marshalPlugin(JAXBElement jaxbElement, OutputStream outputStream) throws Exception;
+	 public JAXBElement unmarshalFilterDeploymentPlan(IFile file) throws Exception;
+	 public JAXBElement unmarshalPlugin(InputStream inputStream);
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXB21Utils.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/JAXB21Utils.java?rev=824070&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXB21Utils.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/JAXB21Utils.java Sun Oct 11 13:27:37 2009
@@ -0,0 +1,298 @@
+/*
+ * 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 java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Method;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.geronimo.st.core.Activator;
+import org.apache.geronimo.st.core.internal.Trace;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * @version $Rev: 817996 $ $Date: 2009-09-23 16:04:12 +0800 (Wed, 23 Sep 2009) $
+ */
+public class JAXB21Utils implements IJAXBUtilsProvider{
+
+    // JAXBContext instantiation is costly - must be done only once!
+    private static final JAXBContext jaxbContext = newJAXBContext();
+    private static final JAXBContext jaxbPluginContext = newJAXBPluginContext();
+    private static final MarshallerListener marshallerListener = new MarshallerListener();
+    //private static JAXB21Utils _instance = new JAXB21Utils();
+    
+    private static JAXBContext newJAXBContext() {
+        try {
+            return JAXBContext.newInstance( 
+                    "org.apache.geronimo.jee.connector:" +
+                    "org.apache.geronimo.jee.loginconfig:" +
+                    "org.apache.geronimo.jee.openejb:" +
+                    "org.apache.geronimo.jee.web:" +
+                    "org.apache.geronimo.jee.application:" +
+                    "org.apache.geronimo.jee.applicationclient:" +
+                    "org.apache.geronimo.jee.deployment:" +
+                    "org.apache.geronimo.jee.naming:" +
+                    "org.apache.geronimo.jee.security:", Activator.class.getClassLoader() );
+        } catch (JAXBException e) {
+            Trace.tracePoint("JAXBException", "JAXBContext.newInstance");
+            e.printStackTrace();
+        }
+        return null;
+    }
+    
+    /*private JAXB21Utils(){
+    }
+    
+    public static JAXB21Utils getInstance(){
+    	return _instance;
+    }*/
+    
+    public JAXBContext getJAXBContext(){
+        return jaxbContext;
+    }
+
+    private static JAXBContext newJAXBPluginContext() {
+        try {
+            return JAXBContext.newInstance( 
+                    "org.apache.geronimo.system.plugin.model", Activator.class.getClassLoader() );
+        } catch (JAXBException e) {
+            Trace.tracePoint("JAXBException", "JAXBContext.newInstance");
+            e.printStackTrace();
+        }
+        return null;
+    }
+    
+    public void marshalDeploymentPlan(JAXBElement jaxbElement, IFile file) throws Exception {
+        try {
+            Marshaller marshaller = jaxbContext.createMarshaller();
+            marshaller.setListener(marshallerListener);
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document doc = db.newDocument(); 
+
+            marshaller.marshal(jaxbElement, doc);
+
+            TransformerFactory xf = TransformerFactory.newInstance();
+            try {
+            	xf.setAttribute("indent-number", new Integer(4));
+            } catch (IllegalArgumentException iae) {
+                //ignore this. http://forums.sun.com/thread.jspa?threadID=562510&messageID=2841867
+            }
+            Transformer xformer = xf.newTransformer();
+            xformer.setOutputProperty(OutputKeys.METHOD, "xml");
+            xformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            xformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+            xformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "4"); 
+
+            ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
+            Result out = new StreamResult(new OutputStreamWriter(outBuffer,"UTF-8"));
+            NamespacePrefix.processPrefix(doc);
+
+            xformer.transform(new DOMSource(doc), out);
+            ByteArrayInputStream inBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
+            if(file.exists()) {
+                file.setContents(inBuffer, true, false, null);
+            } else {
+                prepareFolder(file.getParent());
+                file.create(inBuffer, true, null);
+            }
+        } catch (JAXBException jaxbException) {
+            Trace.tracePoint("JAXBException", "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
+            throw jaxbException;
+        } catch (CoreException coreException) {
+            Trace.tracePoint("CoreException", "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
+            throw coreException;
+        } catch (ParserConfigurationException e) {
+        	Trace.tracePoint("ParserConfigurationException", "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
+        	throw e;
+		} catch (TransformerConfigurationException e) {
+			Trace.tracePoint("TransformerConfigurationException", "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
+			throw e;
+		} catch (UnsupportedEncodingException e) {
+			Trace.tracePoint("UnsupportedEncodingException", "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
+			throw e;
+		} catch (TransformerException e) {
+			Trace.tracePoint("TransformerException", "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
+			throw e;
+		}
+    }
+
+    public JAXBElement unmarshalFilterDeploymentPlan(IFile file) throws Exception {
+        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());
+            throw e;
+        } catch (CoreException e) {
+            Trace.tracePoint("CoreException", "JAXBUtils.unmarshalFilterDeploymentPlan()", file.getFullPath());
+            throw e;
+        } catch (ParserConfigurationException e) {
+            Trace.tracePoint("ParserConfigurationException", "JAXBUtils.unmarshalFilterDeploymentPlan()", file.getFullPath());
+            throw e;
+        } catch (SAXException e) {
+            Trace.tracePoint("SAXException", "JAXBUtils.unmarshalFilterDeploymentPlan()", file.getFullPath());
+            throw e;
+        }
+    }
+
+    public void marshalPlugin(JAXBElement jaxbElement, OutputStream outputStream) throws Exception {
+        try {
+            Marshaller marshaller = jaxbPluginContext.createMarshaller();
+            marshaller.setListener(marshallerListener);
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document doc = db.newDocument(); 
+
+            marshaller.marshal(jaxbElement, doc);
+
+            TransformerFactory xf = TransformerFactory.newInstance();
+            try {
+                xf.setAttribute("indent-number", new Integer(4));
+            } catch (IllegalArgumentException iae) {
+                //ignore this. http://forums.sun.com/thread.jspa?threadID=562510&messageID=2841867
+            }
+            Transformer xformer = xf.newTransformer();
+            xformer.setOutputProperty(OutputKeys.METHOD, "xml");
+            xformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            xformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+            xformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "4"); 
+
+            ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
+            Result out = new StreamResult(new OutputStreamWriter(outBuffer,"UTF-8"));
+
+            xformer.transform(new DOMSource(doc), out);
+            ByteArrayInputStream inBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
+            outputStream.write(outBuffer.toByteArray());
+        } catch (JAXBException jaxbException) {
+            Trace.tracePoint("JAXBException", "JAXBUtils.marshalDeploymentPlan()");
+            throw jaxbException;
+        } catch (IOException coreException) {
+            Trace.tracePoint("IOException", "JAXBUtils.marshalDeploymentPlan()");
+            throw coreException;
+        } catch (ParserConfigurationException e) {
+            Trace.tracePoint("ParserConfigurationException", "JAXBUtils.marshalDeploymentPlan()");
+            throw e;
+        } catch (TransformerConfigurationException e) {
+            Trace.tracePoint("TransformerConfigurationException", "JAXBUtils.marshalDeploymentPlan()");
+            throw e;
+        } catch (TransformerException e) {
+            Trace.tracePoint("TransformerException", "JAXBUtils.marshalDeploymentPlan()");
+            throw e;
+        }
+    }
+
+    public JAXBElement unmarshalPlugin(InputStream inputStream) {
+        try {
+            Unmarshaller unmarshaller = jaxbPluginContext.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(inputStream));
+            JAXBElement plan = (JAXBElement) unmarshaller.unmarshal(source);
+            return plan;
+        } catch (JAXBException e) {
+            Trace.tracePoint("JAXBException", "JAXBUtils.unmarshalFilterDeploymentPlan()");
+            e.printStackTrace();
+        } catch (ParserConfigurationException e) {
+            Trace.tracePoint("ParserConfigurationException", "JAXBUtils.unmarshalFilterDeploymentPlan()");
+            e.printStackTrace();
+        } catch (SAXException e) {
+            Trace.tracePoint("SAXException", "JAXBUtils.unmarshalFilterDeploymentPlan()");
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    private void prepareFolder(IContainer folder) throws CoreException {
+        if (folder.exists() || !(folder instanceof IFolder)) {
+            return;
+        }
+        // prepare the upper level folders recursively
+        prepareFolder(folder.getParent());
+        ((IFolder) folder).create(true, true, null);
+    }
+
+    public Object getValue( Object element, String name ) throws Exception {
+        try {
+            if (String.class.isInstance(element))
+                return (String)element;
+            Method method = element.getClass().getMethod( "get" + name, null);
+            return method.invoke(element, null);
+        } catch ( Exception e ) {
+            throw e;
+        }
+    }
+    
+    public void setValue( Object element, String name, Object value ) throws Exception {
+        try {
+            Method[] methods = element.getClass().getMethods();
+            for ( Method method: methods) {
+                if ( method.getName().equals( "set" + name ) ) {
+                    method.invoke( element, value );
+                    return;
+                }
+            }
+        } catch (Exception e) {
+            throw e;
+        }
+        System.out.println( "============== No such method set" + name + " in class " + element.getClass().getName() );
+    }
+}

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=824070&r1=824069&r2=824070&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 Sun Oct 11 13:27:37 2009
@@ -16,251 +16,124 @@
  */
 package org.apache.geronimo.st.core.jaxb;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
+import java.io.OutputStream;
 import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamResult;
 
 import org.apache.geronimo.st.core.Activator;
 import org.apache.geronimo.st.core.internal.Trace;
-import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jst.server.core.FacetUtil;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.server.core.IRuntime;
 
 /**
  * @version $Rev$ $Date$
  */
 public class JAXBUtils {
 
-    // JAXBContext instantiation is costly - must be done only once!
-    private static final JAXBContext jaxbContext = newJAXBContext();
-    private static final JAXBContext jaxbPluginContext = newJAXBPluginContext();
-    private static final MarshallerListener marshallerListener = new MarshallerListener();
+    private static Map<String,IJAXBUtilsProvider> providers = new HashMap<String,IJAXBUtilsProvider>();
+    
+	static {
+		loadExtensionPoints();
+	}
+	
+	private static synchronized void loadExtensionPoints() {
+        Trace.tracePoint("ENTRY", "JAXBUtils.loadExtensionPoints");
+
+		IExtensionRegistry registry = Platform.getExtensionRegistry();
+		IConfigurationElement[] cf = registry.getConfigurationElementsFor(Activator.PLUGIN_ID, "JAXBUtilsProvider");
+		for (int i = 0; i < cf.length; i++) {
+			IConfigurationElement element = cf[i];
+			if ("provider".equals(element.getName())) {
+				try {
+					IJAXBUtilsProvider provider = (IJAXBUtilsProvider) element.createExecutableExtension("class");
+					String versions = element.getAttribute("version");
+					String[] versionArray = versions.split(",");
+					for (int j=0;j<versionArray.length;j++) {
+						providers.put(versionArray[j], provider);
+					}
+				} catch (CoreException e) {
+                    Trace.tracePoint("CoreException", "JAXBUtils.loadExtensionPoints");
+					e.printStackTrace();
+				}
+			}
+		}
 
-    private static JAXBContext newJAXBContext() {
-        try {
-            return JAXBContext.newInstance( 
-                    "org.apache.geronimo.jee.connector:" +
-                    "org.apache.geronimo.jee.loginconfig:" +
-                    "org.apache.geronimo.jee.openejb:" +
-                    "org.apache.geronimo.jee.web:" +
-                    "org.apache.geronimo.jee.application:" +
-                    "org.apache.geronimo.jee.applicationclient:" +
-                    "org.apache.geronimo.jee.deployment:" +
-                    "org.apache.geronimo.jee.naming:" +
-                    "org.apache.geronimo.jee.security:", Activator.class.getClassLoader() );
-        } catch (JAXBException e) {
-            Trace.tracePoint("JAXBException", "JAXBContext.newInstance");
-            e.printStackTrace();
-        }
-        return null;
-    }
+        Trace.tracePoint("EXIT", "JAXBUtils.loadExtensionPoints");
+	}
     
-    public static JAXBContext getJAXBContext(){
-        return jaxbContext;
+    public static List<JAXBContext> getJAXBContext(){
+    	List<JAXBContext> contextList = new ArrayList<JAXBContext>();
+    	
+    	Collection<IJAXBUtilsProvider> jaxbutils =  providers.values();
+    	Iterator<IJAXBUtilsProvider> iterator = jaxbutils.iterator();
+    	while (iterator.hasNext()){
+    		IJAXBUtilsProvider provider = iterator.next();
+    		contextList.add(provider.getJAXBContext());
+    	}
+    	return contextList;
     }
+    
+    private static IJAXBUtilsProvider getProvider(IFile plan) {
+        Trace.tracePoint("ENTRY", "JAXBUtils.getProvider");
 
-    private static JAXBContext newJAXBPluginContext() {
-        try {
-            return JAXBContext.newInstance( 
-                    "org.apache.geronimo.system.plugin.model", Activator.class.getClassLoader() );
-        } catch (JAXBException e) {
-            Trace.tracePoint("JAXBException", "JAXBContext.newInstance");
-            e.printStackTrace();
+        IJAXBUtilsProvider provider = null;
+        if (plan != null) {
+				IProject project = plan.getProject();
+				try {
+					IFacetedProject fp = ProjectFacetsManager.create(project);
+					if (fp == null) return null;
+					IRuntime runtime = FacetUtil.getRuntime(fp.getPrimaryRuntime());
+					if (runtime == null) return null;
+					String version = runtime.getRuntimeType().getVersion();
+					provider = (IJAXBUtilsProvider) providers.get(version);
+				} catch (CoreException e) {
+                    Trace.tracePoint("CoreException", "JAXBUtils.getProvider");
+					e.printStackTrace();
+				} catch (IllegalArgumentException ie) {
+                    Trace.tracePoint("IllegalArgumentException", "JAXBUtils.getProvider");
+				    throw new IllegalArgumentException("The project [" + project.getName() + "] does not have a Targeted Runtime specified.");
+                }
         }
-        return null;
-    }
-    
-    public static void marshalDeploymentPlan(JAXBElement jaxbElement, IFile file) throws Exception {
-        try {
-            Marshaller marshaller = jaxbContext.createMarshaller();
-            marshaller.setListener(marshallerListener);
+        
+        Trace.tracePoint("EXIT", "JAXBUtils.getProvider", provider);
+		return provider;
+	}
 
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document doc = db.newDocument(); 
-
-            marshaller.marshal(jaxbElement, doc);
-
-            TransformerFactory xf = TransformerFactory.newInstance();
-            try {
-            	xf.setAttribute("indent-number", new Integer(4));
-            } catch (IllegalArgumentException iae) {
-                //ignore this. http://forums.sun.com/thread.jspa?threadID=562510&messageID=2841867
-            }
-            Transformer xformer = xf.newTransformer();
-            xformer.setOutputProperty(OutputKeys.METHOD, "xml");
-            xformer.setOutputProperty(OutputKeys.INDENT, "yes");
-            xformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
-            xformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "4"); 
-
-            ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
-            Result out = new StreamResult(new OutputStreamWriter(outBuffer,"UTF-8"));
-            NamespacePrefix.processPrefix(doc);
-
-            xformer.transform(new DOMSource(doc), out);
-            ByteArrayInputStream inBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
-            if(file.exists()) {
-                file.setContents(inBuffer, true, false, null);
-            } else {
-                prepareFolder(file.getParent());
-                file.create(inBuffer, true, null);
-            }
-        } catch (JAXBException jaxbException) {
-            Trace.tracePoint("JAXBException", "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
-            throw jaxbException;
-        } catch (CoreException coreException) {
-            Trace.tracePoint("CoreException", "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
-            throw coreException;
-        } catch (ParserConfigurationException e) {
-        	Trace.tracePoint("ParserConfigurationException", "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
-        	throw e;
-		} catch (TransformerConfigurationException e) {
-			Trace.tracePoint("TransformerConfigurationException", "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
-			throw e;
-		} catch (UnsupportedEncodingException e) {
-			Trace.tracePoint("UnsupportedEncodingException", "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
-			throw e;
-		} catch (TransformerException e) {
-			Trace.tracePoint("TransformerException", "JAXBUtils.marshalDeploymentPlan()", file.getFullPath());
-			throw e;
-		}
+    public static void marshalDeploymentPlan(JAXBElement jaxbElement, IFile file) throws Exception {
+        	IJAXBUtilsProvider provider = getProvider(file);
+        	provider.marshalDeploymentPlan(jaxbElement, file);
     }
 
     public static JAXBElement unmarshalFilterDeploymentPlan(IFile file) throws Exception {
-        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());
-            throw e;
-        } catch (CoreException e) {
-            Trace.tracePoint("CoreException", "JAXBUtils.unmarshalFilterDeploymentPlan()", file.getFullPath());
-            throw e;
-        } catch (ParserConfigurationException e) {
-            Trace.tracePoint("ParserConfigurationException", "JAXBUtils.unmarshalFilterDeploymentPlan()", file.getFullPath());
-            throw e;
-        } catch (SAXException e) {
-            Trace.tracePoint("SAXException", "JAXBUtils.unmarshalFilterDeploymentPlan()", file.getFullPath());
-            throw e;
-        }
+    	IJAXBUtilsProvider provider = getProvider(file);
+    	return provider.unmarshalFilterDeploymentPlan(file);
     }
 
     public static void marshalPlugin(JAXBElement jaxbElement, OutputStream outputStream) throws Exception {
-        try {
-            Marshaller marshaller = jaxbPluginContext.createMarshaller();
-            marshaller.setListener(marshallerListener);
-
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document doc = db.newDocument(); 
-
-            marshaller.marshal(jaxbElement, doc);
-
-            TransformerFactory xf = TransformerFactory.newInstance();
-            try {
-                xf.setAttribute("indent-number", new Integer(4));
-            } catch (IllegalArgumentException iae) {
-                //ignore this. http://forums.sun.com/thread.jspa?threadID=562510&messageID=2841867
-            }
-            Transformer xformer = xf.newTransformer();
-            xformer.setOutputProperty(OutputKeys.METHOD, "xml");
-            xformer.setOutputProperty(OutputKeys.INDENT, "yes");
-            xformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
-            xformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "4"); 
-
-            ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
-            Result out = new StreamResult(new OutputStreamWriter(outBuffer,"UTF-8"));
-
-            xformer.transform(new DOMSource(doc), out);
-            ByteArrayInputStream inBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
-            outputStream.write(outBuffer.toByteArray());
-        } catch (JAXBException jaxbException) {
-            Trace.tracePoint("JAXBException", "JAXBUtils.marshalDeploymentPlan()");
-            throw jaxbException;
-        } catch (IOException coreException) {
-            Trace.tracePoint("IOException", "JAXBUtils.marshalDeploymentPlan()");
-            throw coreException;
-        } catch (ParserConfigurationException e) {
-            Trace.tracePoint("ParserConfigurationException", "JAXBUtils.marshalDeploymentPlan()");
-            throw e;
-        } catch (TransformerConfigurationException e) {
-            Trace.tracePoint("TransformerConfigurationException", "JAXBUtils.marshalDeploymentPlan()");
-            throw e;
-        } catch (TransformerException e) {
-            Trace.tracePoint("TransformerException", "JAXBUtils.marshalDeploymentPlan()");
-            throw e;
-        }
+        //currently only JAXB21Utils provide this method,so invoke it directly
+    	providers.get("2.1").marshalPlugin(jaxbElement, outputStream);
     }
 
     public static JAXBElement unmarshalPlugin(InputStream inputStream) {
-        try {
-            Unmarshaller unmarshaller = jaxbPluginContext.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(inputStream));
-            JAXBElement plan = (JAXBElement) unmarshaller.unmarshal(source);
-            return plan;
-        } catch (JAXBException e) {
-            Trace.tracePoint("JAXBException", "JAXBUtils.unmarshalFilterDeploymentPlan()");
-            e.printStackTrace();
-        } catch (ParserConfigurationException e) {
-            Trace.tracePoint("ParserConfigurationException", "JAXBUtils.unmarshalFilterDeploymentPlan()");
-            e.printStackTrace();
-        } catch (SAXException e) {
-            Trace.tracePoint("SAXException", "JAXBUtils.unmarshalFilterDeploymentPlan()");
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-    private static void prepareFolder(IContainer folder) throws CoreException {
-        if (folder.exists() || !(folder instanceof IFolder)) {
-            return;
-        }
-        // prepare the upper level folders recursively
-        prepareFolder(folder.getParent());
-        ((IFolder) folder).create(true, true, null);
+    	//currently only JAXB21Utils provide this method,so invoke it directly
+    	return providers.get("2.1").unmarshalPlugin(inputStream);
     }
 
     public static Object getValue( Object element, String name ) throws Exception {

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/LICENSE.txt?rev=824070&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/LICENSE.txt (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/LICENSE.txt Sun Oct 11 13:27:37 2009
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/META-INF/MANIFEST.MF?rev=824070&r1=824069&r2=824070&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/META-INF/MANIFEST.MF (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/META-INF/MANIFEST.MF Sun Oct 11 13:27:37 2009
@@ -16,7 +16,8 @@
  org.eclipse.wst.common.project.facet.core,
  org.eclipse.jst.common.frameworks,
  org.eclipse.wst.common.modulecore,
- org.eclipse.jst.j2ee
+ org.eclipse.jst.j2ee,
+ org.eclipse.jem.util
 Bundle-ActivationPolicy: lazy
 Export-Package: org.apache.geronimo.st.v11.core,
  org.apache.geronimo.st.v11.core.internal,

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/NOTICE.txt?rev=824070&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/NOTICE.txt (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/NOTICE.txt Sun Oct 11 13:27:37 2009
@@ -0,0 +1,12 @@
+Apache Geronimo 
+Copyright 2003-2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of the Eclipse Geronimo Server Adapter were originally developed by
+International Business Machines Corporation and are
+licensed to the Apache Software Foundation under the
+"Software Grant and Corporate Contribution License Agreement",
+informally known as the "Eclipse Geronimo Server Adapter CLA".
+

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/plugin.xml?rev=824070&r1=824069&r2=824070&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/plugin.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/plugin.xml Sun Oct 11 13:27:37 2009
@@ -110,4 +110,7 @@
         </default-facets>
     </extension>
   
+    <extension point="org.apache.geronimo.st.core.JAXBUtilsProvider">
+        <provider class="org.apache.geronimo.st.v11.core.jaxb.JAXB11Utils" version="1.1"/>
+    </extension>
 </plugin>

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/GeronimoServerInfo.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/GeronimoServerInfo.java?rev=824070&r1=824069&r2=824070&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/GeronimoServerInfo.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/GeronimoServerInfo.java Sun Oct 11 13:27:37 2009
@@ -38,7 +38,7 @@
 import org.apache.geronimo.kernel.NoSuchOperationException;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate;
-import org.apache.geronimo.st.v21.core.internal.Trace;
+import org.apache.geronimo.st.v11.core.internal.Trace;
 import org.apache.geronimo.system.jmx.KernelDelegate;
 import org.apache.geronimo.xml.ns.deployment_1.DependencyType;
 import org.apache.geronimo.xml.ns.naming_1.PatternType;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/GeronimoV11Utils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/GeronimoV11Utils.java?rev=824070&r1=824069&r2=824070&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/GeronimoV11Utils.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/GeronimoV11Utils.java Sun Oct 11 13:27:37 2009
@@ -20,7 +20,7 @@
 
 import org.apache.geronimo.st.core.GeronimoUtils;
 import org.apache.geronimo.st.core.internal.Trace;
-import org.apache.geronimo.st.v11.core.jaxb.JAXBUtils;
+import org.apache.geronimo.st.core.jaxb.JAXBUtils;
 import org.apache.geronimo.xml.ns.deployment_1.ArtifactType;
 import org.apache.geronimo.xml.ns.deployment_1.EnvironmentType;
 import org.apache.geronimo.xml.ns.j2ee.application_1.ApplicationType;



Mime
View raw message