geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1076284 - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.jaxbmodel.common/ org.apache.geronimo.jaxbmodel.common/src/main/java/org/apache/geronimo/jaxbmodel/common/operations/ org.apache.geronimo.st.core/schema/ org...
Date Wed, 02 Mar 2011 16:41:54 GMT
Author: gawor
Date: Wed Mar  2 16:41:53 2011
New Revision: 1076284

URL: http://svn.apache.org/viewvc?rev=1076284&view=rev
Log:
GERONIMODEVTOOLS-720: Handle bad Geronimo plan files a little bit more gracefully. Plus other
fixes & improvements

Removed:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/schema/JAXBUtilsProvider.exsd
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/schema/JAXBUtilsProvider.exsd
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/schema/loader.exsd
Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.jaxbmodel.common/pom.xml
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.jaxbmodel.common/src/main/java/org/apache/geronimo/jaxbmodel/common/operations/JAXBUtils.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.ui/src/main/java/org/apache/geronimo/st/ui/editors/AbstractGeronimoJAXBBasedEditor.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/plugin.xml
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/jaxb/IJAXBUtilsProvider.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/jaxb/JAXBUtils.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.jaxbmodel.common/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.jaxbmodel.common/pom.xml?rev=1076284&r1=1076283&r2=1076284&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.jaxbmodel.common/pom.xml
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.jaxbmodel.common/pom.xml
Wed Mar  2 16:41:53 2011
@@ -87,6 +87,21 @@
                 </includes>
             </resource>
             <resource>
+                <directory>.</directory>
+                <includes>
+                    <include>.options</include>
+                    <include>plugin.xml</include>
+                    <include>plugin.properties</include>
+                </includes>
+            </resource>
+            <resource>
+                <targetPath>schema/</targetPath>
+                <directory>schema/</directory>
+                <includes>
+                    <include>*.exsd</include>
+                </includes>
+            </resource>
+            <resource>
                 <targetPath>about_files</targetPath>
                 <directory>.</directory>
                 <includes>

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.jaxbmodel.common/src/main/java/org/apache/geronimo/jaxbmodel/common/operations/JAXBUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.jaxbmodel.common/src/main/java/org/apache/geronimo/jaxbmodel/common/operations/JAXBUtils.java?rev=1076284&r1=1076283&r2=1076284&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.jaxbmodel.common/src/main/java/org/apache/geronimo/jaxbmodel/common/operations/JAXBUtils.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.jaxbmodel.common/src/main/java/org/apache/geronimo/jaxbmodel/common/operations/JAXBUtils.java
Wed Mar  2 16:41:53 2011
@@ -16,8 +16,6 @@
  */
 package org.apache.geronimo.jaxbmodel.common.operations;
 
-import java.io.InputStream;
-import java.io.OutputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -78,7 +76,7 @@ public class JAXBUtils {
         Trace.tracePoint("EXIT", "JAXBUtils.loadExtensionPoints");
 	}
     
-    public static List<JAXBContext> getJAXBContext(){
+    public static List<JAXBContext> getJAXBContext() {
     	List<JAXBContext> contextList = new ArrayList<JAXBContext>();
     	
     	Collection<IJAXBUtilsProvider> jaxbutils =  providers.values();
@@ -90,12 +88,12 @@ public class JAXBUtils {
     	return contextList;
     }
     
-    private static IJAXBUtilsProvider getProvider(IFile plan) {
+    public static IJAXBUtilsProvider getProvider(IFile plan) {
         Trace.tracePoint("ENTRY", "JAXBUtils.getProvider");
 
         IJAXBUtilsProvider provider = null;
         if (plan != null) {
-				IProject project = plan.getProject();
+				IProject project = plan.getProject();				
 				try {
 					IFacetedProject fp = ProjectFacetsManager.create(project);
 					if (fp == null) return null;
@@ -116,13 +114,17 @@ public class JAXBUtils {
 		return provider;
 	}
 
+    public static IJAXBUtilsProvider getProvider(String version) {
+        return providers.get(version);
+    }
+    
     public static void marshalDeploymentPlan(JAXBElement jaxbElement, IFile file) throws
Exception {
-        	IJAXBUtilsProvider provider = getProvider(file);
-        	provider.marshalDeploymentPlan(jaxbElement, file);
+        IJAXBUtilsProvider provider = getProvider(file);
+        provider.marshalDeploymentPlan(jaxbElement, file);
     }
 
     public static JAXBElement unmarshalFilterDeploymentPlan(IFile file) throws Exception
{
-    	IJAXBUtilsProvider provider = getProvider(file);
+        IJAXBUtilsProvider provider = getProvider(file);
     	return provider.unmarshalFilterDeploymentPlan(file);
     }
 

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=1076284&r1=1076283&r2=1076284&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
Wed Mar  2 16:41:53 2011
@@ -36,11 +36,14 @@ import org.eclipse.wst.common.frameworks
  */
 public class ImportDeploymentPlanOperation extends AbstractGeronimoJ2EEComponentOperation
{
 
+    private final IFile plan;
+    
     /**
      * 
      */
     public ImportDeploymentPlanOperation() {
         super();
+        this.plan = null;
         Trace.tracePoint("Constructor", "ImportDeploymentPlanOperation");
     }
 
@@ -49,8 +52,18 @@ public class ImportDeploymentPlanOperati
      */
     public ImportDeploymentPlanOperation(IDataModel model) {
         super(model);
+        this.plan = null;
         Trace.tracePoint("Constructor", "ImportDeploymentPlanOperation", model);
     }
+    
+    /**
+     * @param model
+     */
+    public ImportDeploymentPlanOperation(IDataModel model, IFile plan) {
+        super(model);
+        this.plan = plan;
+        Trace.tracePoint("Constructor", "ImportDeploymentPlanOperation", model, plan);
+    }
 
     /*
      * (non-Javadoc)
@@ -71,28 +84,28 @@ public class ImportDeploymentPlanOperati
 
         try {
             if (type.equals(IModuleConstants.JST_WEB_MODULE)) {
-                planFile = GeronimoUtils.getWebDeploymentPlanFile(comp);
+                planFile = (plan == null) ? GeronimoUtils.getWebDeploymentPlanFile(comp)
: plan;
                 ConversionHelper.convertGeronimoWebFile(planFile);    
             }
             else if (type.equals(IModuleConstants.JST_EJB_MODULE)) {
-                planFile = GeronimoUtils.getOpenEjbDeploymentPlanFile(comp);
+                planFile = (plan == null) ? GeronimoUtils.getOpenEjbDeploymentPlanFile(comp)
: plan;
                 ConversionHelper.convertOpenEjbJarFile(planFile);
             }
             else if (type.equals(IModuleConstants.JST_EAR_MODULE)) {
-                planFile = GeronimoUtils.getApplicationDeploymentPlanFile(comp);
+                planFile = (plan == null) ? GeronimoUtils.getApplicationDeploymentPlanFile(comp)
: plan;
                 ConversionHelper.convertGeronimoApplicationFile(planFile);
             }
             else if (type.equals(IModuleConstants.JST_CONNECTOR_MODULE)) {
-                planFile = GeronimoUtils.getConnectorDeploymentPlanFile(comp);
+                planFile = (plan == null) ? GeronimoUtils.getConnectorDeploymentPlanFile(comp)
: plan;
                 ConversionHelper.convertGeronimoRaFile(planFile);
             }
             else if (type.equals(IModuleConstants.JST_APPCLIENT_MODULE)) {
-                planFile = GeronimoUtils.getApplicationClientDeploymentPlanFile(comp);
+                planFile = (plan == null) ? GeronimoUtils.getApplicationClientDeploymentPlanFile(comp)
: plan;
                 ConversionHelper.convertGeronimoApplicationClientFile(planFile);
             }
         }
         catch (Exception e) {
-            throw new ExecutionException("ImportDeploymentPlanOperation.execute(): Error
converting plan: " + planFile.getFullPath() );
+            throw new ExecutionException("ImportDeploymentPlanOperation.execute(): Error
converting plan: " + planFile.getFullPath(), e);
         }
 
         Trace.tracePoint("Exit ", "ImportDeploymentPlanOperation.execute", Status.OK_STATUS);

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/editors/AbstractGeronimoJAXBBasedEditor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/editors/AbstractGeronimoJAXBBasedEditor.java?rev=1076284&r1=1076283&r2=1076284&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/editors/AbstractGeronimoJAXBBasedEditor.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/editors/AbstractGeronimoJAXBBasedEditor.java
Wed Mar  2 16:41:53 2011
@@ -185,11 +185,10 @@ public abstract class AbstractGeronimoJA
             IFileEditorInput fei = (IFileEditorInput) input;
             try {
                 rootJAXBElement = loadFile(fei.getFile());
-            } catch (Exception e1) {
-                // throw new PartInitException("Error in loading deployment plan");
+            } catch (Exception e) {
                 // if catching an exception , it will try to correct the plan 
                 // or open the plan with default editor
-                e1.printStackTrace();
+                Trace.trace(Trace.WARNING, "Error loading deployment plan", e);
             }
             
             boolean fix = false;
@@ -198,22 +197,29 @@ public abstract class AbstractGeronimoJA
             }
             
             if(fix) {
+                boolean converted = false;
+                
                 IProject project = fei.getFile().getProject();
                 IDataModel model = DataModelFactory.createDataModel(new ImportDeploymentPlanDataModelProvider());
                 model.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, project.getName());
                 try {
                     IFacetedProject facetedProject = ProjectFacetsManager.create(project);
                     model.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME,
facetedProject.getPrimaryRuntime());
-                    IDataModelOperation op = new ImportDeploymentPlanOperation(model);
+                    IDataModelOperation op = new ImportDeploymentPlanOperation(model, fei.getFile());
                     op.execute(new NullProgressMonitor(), null);
+                    converted = true;
                 } catch (Exception e) {
-                   throw new PartInitException(e.getMessage());
+                    // conversion failed somehow
+                    Trace.trace(Trace.WARNING, "Error converting deployment plan", e);
                 }
                 
-                try {
-                    rootJAXBElement = loadFile(fei.getFile());
-                } catch (Exception e) {
-                    throw new PartInitException(e.getMessage());
+                if (converted) {
+                    try {
+                        rootJAXBElement = loadFile(fei.getFile());
+                    } catch (Exception e) {
+                        // still can't load it
+                        Trace.trace(Trace.WARNING, "Error loading converted deployment plan",
e);
+                    }
                 }
                 
                 if (rootJAXBElement == null) {    

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/plugin.xml?rev=1076284&r1=1076283&r2=1076284&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/plugin.xml
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/plugin.xml
Wed Mar  2 16:41:53 2011
@@ -429,8 +429,7 @@
      ##                                                                                 
                             ##
      ###################################################################################################################
      -->
-     <extension-point id="JAXBUtilsProvider" name="Geronimo JAXB Utils" schema="schema/JAXBUtilsProvider.exsd"/>
-     <extension point="org.apache.geronimo.st.v30.core.JAXBUtilsProvider">
+     <extension point="org.apache.geronimo.jaxbmodel.common.JAXBUtilsProvider">
          <provider class="org.apache.geronimo.st.v30.core.jaxb.JAXBUtilsProvider" version="3.0"/>
      </extension>
 

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/jaxb/IJAXBUtilsProvider.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/jaxb/IJAXBUtilsProvider.java?rev=1076284&r1=1076283&r2=1076284&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/jaxb/IJAXBUtilsProvider.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/jaxb/IJAXBUtilsProvider.java
Wed Mar  2 16:41:53 2011
@@ -19,18 +19,12 @@ package org.apache.geronimo.st.v30.core.
 import java.io.InputStream;
 import java.io.OutputStream;
 
-import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 
-import org.eclipse.core.resources.IFile;
-
 /**
  * @version $Rev$ $Date$
  */
-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 interface IJAXBUtilsProvider extends org.apache.geronimo.jaxbmodel.common.operations.IJAXBUtilsProvider
{        
+     public void marshalPlugin(JAXBElement jaxbElement, OutputStream outputStream) throws
Exception;     
      public JAXBElement unmarshalPlugin(InputStream inputStream);
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/jaxb/JAXBUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/jaxb/JAXBUtils.java?rev=1076284&r1=1076283&r2=1076284&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/jaxb/JAXBUtils.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/jaxb/JAXBUtils.java
Wed Mar  2 16:41:53 2011
@@ -18,147 +18,49 @@ package org.apache.geronimo.st.v30.core.
 
 import java.io.InputStream;
 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 org.apache.geronimo.st.v30.core.Activator;
-import org.apache.geronimo.st.v30.core.internal.Trace;
 import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-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 {
 
-    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();
-                }
-            }
-        }
-
-        Trace.tracePoint("EXIT", "JAXBUtils.loadExtensionPoints");
+    public static List<JAXBContext> getJAXBContext() {
+        return org.apache.geronimo.jaxbmodel.common.operations.JAXBUtils.getJAXBContext();
     }
-    
-    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");
-
-        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.");
-                }
-        }
-        
-        Trace.tracePoint("EXIT", "JAXBUtils.getProvider", provider);
-        return provider;
-    }
-
+       
     public static void marshalDeploymentPlan(JAXBElement jaxbElement, IFile file) throws
Exception {
-            IJAXBUtilsProvider provider = getProvider(file);
-            provider.marshalDeploymentPlan(jaxbElement, file);
+        org.apache.geronimo.jaxbmodel.common.operations.IJAXBUtilsProvider provider = org.apache.geronimo.jaxbmodel.common.operations.JAXBUtils.getProvider(file);
+        provider.marshalDeploymentPlan(jaxbElement, file);
     }
 
     public static JAXBElement unmarshalFilterDeploymentPlan(IFile file) throws Exception
{
-        IJAXBUtilsProvider provider = getProvider(file);
+        org.apache.geronimo.jaxbmodel.common.operations.IJAXBUtilsProvider provider = org.apache.geronimo.jaxbmodel.common.operations.JAXBUtils.getProvider(file);
         return provider.unmarshalFilterDeploymentPlan(file);
     }
 
     public static void marshalPlugin(JAXBElement jaxbElement, OutputStream outputStream)
throws Exception {
         //for 3.0 jaxb provider,invoke it directly
-       providers.get("3.0").marshalPlugin(jaxbElement, outputStream);
+        IJAXBUtilsProvider provider = (IJAXBUtilsProvider) org.apache.geronimo.jaxbmodel.common.operations.JAXBUtils.getProvider("3.0");
+        provider.marshalPlugin(jaxbElement, outputStream);
     }
 
     public static JAXBElement unmarshalPlugin(InputStream inputStream) {
         //for 3.0 jaxb provider,invoke it directly
-    	return providers.get("3.0").unmarshalPlugin(inputStream);
+        IJAXBUtilsProvider provider = (IJAXBUtilsProvider) org.apache.geronimo.jaxbmodel.common.operations.JAXBUtils.getProvider("3.0");
+    	return provider.unmarshalPlugin(inputStream);
     }
 
     public static 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;
-        }
+        return org.apache.geronimo.jaxbmodel.common.operations.JAXBUtils.getValue(element,
name);
     }
     
     public static 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()
);
+        org.apache.geronimo.jaxbmodel.common.operations.JAXBUtils.setValue(element, name,
value);
     }
 }



Mime
View raw message