geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r957655 [6/15] - in /geronimo/server/trunk: ./ framework/configs/geronimo-gbean-deployer-bootstrap/src/main/history/ framework/configs/geronimo-gbean-deployer/src/main/history/ framework/configs/jsr88-cli/src/main/history/ framework/configs...
Date Thu, 24 Jun 2010 18:06:33 GMT
Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ENCHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ENCHelper.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ENCHelper.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ENCHelper.java Thu Jun 24 18:06:24 2010
@@ -19,25 +19,20 @@ package org.apache.geronimo.naming.deplo
 
 import java.util.HashMap;
 import java.util.Map;
+
 import javax.enterprise.deploy.model.DDBean;
 import javax.enterprise.deploy.spi.DConfigBean;
 import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException;
 import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
-
 import org.apache.geronimo.xbeans.geronimo.naming.GerEjbLocalRefType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerEjbRefType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceEnvRefType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
-import org.apache.xmlbeans.SchemaTypeLoader;
-import org.apache.xmlbeans.XmlBeans;
 
 /**
  * @version $Rev$ $Date$
  */
 public class ENCHelper {
-    static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderUnion(new SchemaTypeLoader[]{
-        XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.javaee6.String.class.getClassLoader()),
-    });
 
 
     public static final String[][] ENC_XPATHS = {

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java Thu Jun 24 18:06:24 2010
@@ -19,6 +19,7 @@ package org.apache.geronimo.naming.deplo
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -32,7 +33,6 @@ import org.apache.geronimo.gbean.annotat
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
-import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.j2ee.deployment.annotation.ResourceAnnotationHelper;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.naming.reference.ClassReference;
@@ -40,12 +40,10 @@ import org.apache.geronimo.naming.refere
 import org.apache.geronimo.naming.reference.KernelReference;
 import org.apache.geronimo.xbeans.geronimo.naming.GerEnvEntryDocument;
 import org.apache.geronimo.xbeans.geronimo.naming.GerEnvEntryType;
-import org.apache.geronimo.xbeans.javaee6.DescriptionType;
-import org.apache.geronimo.xbeans.javaee6.EnvEntryType;
-import org.apache.geronimo.xbeans.javaee6.EnvEntryTypeValuesType;
-import org.apache.geronimo.xbeans.javaee6.InjectionTargetType;
-import org.apache.geronimo.xbeans.javaee6.JndiNameType;
-import org.apache.geronimo.xbeans.javaee6.XsdStringType;
+import org.apache.openejb.jee.EnvEntry;
+import org.apache.openejb.jee.InjectionTarget;
+import org.apache.openejb.jee.JndiConsumer;
+import org.apache.openejb.jee.Text;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.Bundle;
@@ -87,14 +85,14 @@ public class EnvironmentEntryBuilder ext
         doStop();
     }
 
-    public void buildNaming(XmlObject specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> sharedContext) throws DeploymentException {
+    public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> sharedContext) throws DeploymentException {
 
         // Discover and process any @Resource annotations (if !metadata-complete)
         if ((module != null) && (module.getClassFinder() != null)) {
 
             // Process all the annotations for this naming builder type
             try {
-                ResourceAnnotationHelper.processAnnotations(module.getAnnotatedApp(), module.getClassFinder(), EnvEntryRefProcessor.INSTANCE);
+                ResourceAnnotationHelper.processAnnotations(specDD, module.getClassFinder(), EnvEntryRefProcessor.INSTANCE);
             }
             catch (Exception e) {
                 log.warn("Unable to process @Resource annotations for module" + module.getName(), e);
@@ -102,10 +100,10 @@ public class EnvironmentEntryBuilder ext
         }
 
         Bundle bundle = module.getEarContext().getDeploymentBundle();
-        List<EnvEntryType> envEntriesUntyped = convert(specDD.selectChildren(envEntryQNameSet), JEE_CONVERTER, EnvEntryType.class, EnvEntryType.type);
+        Collection<EnvEntry> envEntriesUntyped = specDD.getEnvEntry();
         XmlObject[] gerEnvEntryUntyped = plan == null ? NO_REFS : plan.selectChildren(GER_ENV_ENTRY_QNAME_SET);
         Map<String, String> envEntryMap = mapEnvEntries(gerEnvEntryUntyped);
-        for (EnvEntryType envEntry : envEntriesUntyped) {
+        for (EnvEntry envEntry : envEntriesUntyped) {
             String name = getStringValue(envEntry.getEnvEntryName());
             String type = getStringValue(envEntry.getEnvEntryType());
 
@@ -114,10 +112,10 @@ public class EnvironmentEntryBuilder ext
             String strValueOverride = envEntryMap.remove(name);
             String strValue = null;
             if (strValueOverride == null) {
-                strValue = getUntrimmedStringValue(envEntry.getEnvEntryValue());
+                strValue = envEntry.getEnvEntryValue();
                 String lookupName = getStringValue(envEntry.getLookupName());
                 if (strValue != null && lookupName != null) {
-                    throw new DeploymentException("You must specify an environment entry value or lookup name but not both. Component: " + module.getAnnotatedApp().toString() + ", name: " + name + ", env-entry-value: " + strValue + ", lookup-name: " + lookupName + "");
+                    throw new DeploymentException("You must specify an environment entry value or lookup name but not both. Component: " + module.toString() + ", name: " + name + ", env-entry-value: " + strValue + ", lookup-name: " + lookupName + "");
                 }
                 if (lookupName != null) {
                     //TODO better circular reference checking
@@ -130,7 +128,7 @@ public class EnvironmentEntryBuilder ext
                 strValue = strValueOverride;
             }
 
-            type = inferAndCheckType(module, bundle, envEntry.getInjectionTargetArray(), name, type);
+            type = inferAndCheckType(module, bundle, envEntry.getInjectionTarget(), name, type);
 
 
             if (value == null) {
@@ -185,7 +183,7 @@ public class EnvironmentEntryBuilder ext
             // perform resource injection only if there is a value specified
             // see Java EE 5 spec, section EE.5.4.1.3
             if (value != null) {
-                addInjections(name, envEntry.getInjectionTargetArray(), sharedContext);
+                addInjections(name, envEntry.getInjectionTarget(), sharedContext);
                 put(name, value, module.getJndiContext());
             }
         }
@@ -222,7 +220,7 @@ public class EnvironmentEntryBuilder ext
         private EnvEntryRefProcessor() {
         }
 
-        public boolean processResource(AnnotatedApp annotatedApp, Resource annotation, Class cls, Method method, Field field) {
+        public boolean processResource(JndiConsumer annotatedApp, Resource annotation, Class cls, Method method, Field field) {
             String resourceName = getResourceName(annotation, method, field);
             Class resourceType = getResourceTypeClass(annotation, method, field);
             if (resourceType.equals(String.class) ||
@@ -240,14 +238,14 @@ public class EnvironmentEntryBuilder ext
                 log.debug("addResource(): <env-entry> found");
 
                 boolean exists = false;
-                EnvEntryType[] envEntries = annotatedApp.getEnvEntryArray();
-                for (EnvEntryType envEntry : envEntries) {
+                Collection<EnvEntry> envEntries = annotatedApp.getEnvEntry();
+                for (EnvEntry envEntry : envEntries) {
                     if (getStringValue(envEntry.getEnvEntryName()).equals(resourceName)) {
                         exists = true;
                         if (method != null || field != null) {
-                            InjectionTargetType[] targets = envEntry.getInjectionTargetArray();
+                            List<InjectionTarget> targets = envEntry.getInjectionTarget();
                             if (!hasTarget(method, field, targets)) {
-                                configureInjectionTarget(envEntry.addNewInjectionTarget(), method, field);
+                                targets.add(configureInjectionTarget(method, field));
                             }
                         }
                         break;
@@ -259,25 +257,22 @@ public class EnvironmentEntryBuilder ext
                         log.debug("addResource(): Does not exist in DD: " + resourceName);
 
                         // Doesn't exist in deployment descriptor -- add new
-                        EnvEntryType envEntry = annotatedApp.addNewEnvEntry();
+                        EnvEntry envEntry = new EnvEntry();
 
                         //------------------------------------------------------------------------------
                         // <env-entry> required elements:
                         //------------------------------------------------------------------------------
 
                         // env-entry-name
-                        JndiNameType envEntryName = envEntry.addNewEnvEntryName();
-                        envEntryName.setStringValue(resourceName);
+                        envEntry.setEnvEntryName(resourceName);
 
                         if (!resourceType.equals(Object.class)) {
                             // env-entry-type
-                            EnvEntryTypeValuesType envEntryType = envEntry.addNewEnvEntryType();
-                            envEntryType.setStringValue(resourceType.getCanonicalName());
+                            envEntry.setEnvEntryType(resourceType.getCanonicalName());
                         }
                         if (method != null || field != null) {
                             // injectionTarget
-                            InjectionTargetType injectionTarget = envEntry.addNewInjectionTarget();
-                            configureInjectionTarget(injectionTarget, method, field);
+                            envEntry.getInjectionTarget().add(configureInjectionTarget(method, field));
                         }
 
                         //------------------------------------------------------------------------------
@@ -287,23 +282,21 @@ public class EnvironmentEntryBuilder ext
                         // mappedName
                         String mappdedNameAnnotation = annotation.mappedName();
                         if (!mappdedNameAnnotation.equals("")) {
-                            XsdStringType mappedName = envEntry.addNewMappedName();
-                            mappedName.setStringValue(mappdedNameAnnotation);
+                            envEntry.setMappedName(mappdedNameAnnotation);
                         }
 
                         // description
                         String descriptionAnnotation = annotation.description();
                         if (!descriptionAnnotation.equals("")) {
-                            DescriptionType description = envEntry.addNewDescription();
-                            description.setStringValue(descriptionAnnotation);
+                            envEntry.setDescriptions(new Text[] {new Text(null, descriptionAnnotation)});
                         }
 
                         // lookup
                         String lookup = annotation.lookup();
                         if (!lookup.equals("")) {
-                            XsdStringType lookupName = envEntry.addNewLookupName();
-                            lookupName.setStringValue(lookup);
+                            envEntry.setLookupName(lookup);
                         }
+                        annotatedApp.getEnvEntry().add(envEntry);
                     }
                     catch (Exception anyException) {
                         log.debug("ResourceAnnotationHelper: Exception caught while processing <env-entry>");

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java Thu Jun 24 18:06:24 2010
@@ -36,6 +36,7 @@ import org.apache.geronimo.naming.refere
 import org.apache.geronimo.xbeans.geronimo.naming.GerGbeanRefDocument;
 import org.apache.geronimo.xbeans.geronimo.naming.GerGbeanRefType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
+import org.apache.openejb.jee.JndiConsumer;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.Bundle;
@@ -49,7 +50,7 @@ public class GBeanRefBuilder extends Abs
     private static final QNameSet GBEAN_REF_QNAME_SET = QNameSet.singleton(GBEAN_REF_QNAME);
 
     @Override
-    public void buildNaming(XmlObject specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> sharedContext) throws DeploymentException {
+    public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> sharedContext) throws DeploymentException {
         if (plan == null) {
             return;
         }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java Thu Jun 24 18:06:24 2010
@@ -21,6 +21,7 @@
 package org.apache.geronimo.naming.deployment;
 
 import java.lang.reflect.Method;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -34,12 +35,10 @@ import org.apache.geronimo.j2ee.annotati
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
-import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.config.ConfigurationModuleType;
-import org.apache.geronimo.xbeans.javaee6.FullyQualifiedClassType;
-import org.apache.geronimo.xbeans.javaee6.JavaIdentifierType;
-import org.apache.geronimo.xbeans.javaee6.LifecycleCallbackType;
+import org.apache.openejb.jee.JndiConsumer;
+import org.apache.openejb.jee.Lifecycle;
+import org.apache.openejb.jee.LifecycleCallback;
 import org.apache.xbean.finder.AbstractFinder;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
@@ -51,31 +50,30 @@ import org.apache.xmlbeans.XmlObject;
 public class LifecycleMethodBuilder extends AbstractNamingBuilder {
 
     @Override
-    public void buildNaming(XmlObject specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> sharedContext) throws DeploymentException {
+    public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> sharedContext) throws DeploymentException {
         // skip ejb modules... they have already been processed
         //skip ears, they have no standalone components
-        if (module.getType() == ConfigurationModuleType.EJB || module.getType() == ConfigurationModuleType.EAR) {
+//        if (module.getType() == ConfigurationModuleType.EJB || module.getType() == ConfigurationModuleType.EAR) {
+//            return;
+//        }
+        if (!(specDD instanceof Lifecycle)) {
             return;
         }
-
+        Lifecycle lifecycle = (Lifecycle) specDD;
         AbstractFinder classFinder = module.getClassFinder();
-        AnnotatedApp annotatedApp = module.getAnnotatedApp();
-        if (annotatedApp == null) {
-            throw new NullPointerException("No AnnotatedApp supplied");
-        }
-        Map<String, LifecycleCallbackType> postConstructMap = mapLifecycleCallbacks(annotatedApp.getPostConstructArray(), annotatedApp.getComponentType());
-        Map<String, LifecycleCallbackType> preDestroyMap = mapLifecycleCallbacks(annotatedApp.getPreDestroyArray(), annotatedApp.getComponentType());
+        //TODO what is the component type???
+        Map<String, LifecycleCallback> postConstructMap = mapLifecycleCallbacks(lifecycle.getPostConstruct(), null/*annotatedApp.getComponentType()*/);
+        Map<String, LifecycleCallback> preDestroyMap = mapLifecycleCallbacks(lifecycle.getPreDestroy(), null/*annotatedApp.getComponentType()*/);
         if (module.getClassFinder() != null) {
             List<Method> postConstructs = classFinder.findAnnotatedMethods(PostConstruct.class);
             for (Method m : postConstructs) {
                 String methodName = m.getName();
                 String className = m.getDeclaringClass().getName();
                 if (!postConstructMap.containsKey(className)) {
-                    LifecycleCallbackType callback = annotatedApp.addPostConstruct();
-                    FullyQualifiedClassType classType = callback.addNewLifecycleCallbackClass();
-                    classType.setStringValue(className);
-                    JavaIdentifierType method = callback.addNewLifecycleCallbackMethod();
-                    method.setStringValue(methodName);
+                    LifecycleCallback callback = new LifecycleCallback();
+                    callback.setLifecycleCallbackClass(className);
+                    callback.setLifecycleCallbackMethod(methodName);
+                    lifecycle.getPostConstruct().add(callback);
                     postConstructMap.put(className, callback);
                 }
             }
@@ -84,12 +82,11 @@ public class LifecycleMethodBuilder exte
                 String methodName = m.getName();
                 String className = m.getDeclaringClass().getName();
                 if (!preDestroyMap.containsKey(className)) {
-                    LifecycleCallbackType callback = annotatedApp.addPreDestroy();
-                    FullyQualifiedClassType classType = callback.addNewLifecycleCallbackClass();
-                    classType.setStringValue(className);
-                    JavaIdentifierType method = callback.addNewLifecycleCallbackMethod();
-                    method.setStringValue(methodName);
+                    LifecycleCallback callback = new LifecycleCallback();
+                    callback.setLifecycleCallbackClass(className);
+                    callback.setLifecycleCallbackMethod(methodName);
                     preDestroyMap.put(className, callback);
+                    lifecycle.getPreDestroy().add(callback);
                 }
             }
         }
@@ -100,26 +97,26 @@ public class LifecycleMethodBuilder exte
         holder.addPreDestroys(preDestroys);
     }
 
-    private Map<String, LifecycleMethod> map(Map<String, LifecycleCallbackType> lifecycleCallbackTypes) {
-        if (lifecycleCallbackTypes.isEmpty()) {
+    private Map<String, LifecycleMethod> map(Map<String, LifecycleCallback> LifecycleCallbacks) {
+        if (LifecycleCallbacks.isEmpty()) {
             return null;
         }
         Map<String, LifecycleMethod> map = new HashMap<String, LifecycleMethod>();
-        for (Map.Entry<String, LifecycleCallbackType> entry : lifecycleCallbackTypes.entrySet()) {
+        for (Map.Entry<String, LifecycleCallback> entry : LifecycleCallbacks.entrySet()) {
             String className = entry.getKey();
-            LifecycleCallbackType callback = entry.getValue();
-            LifecycleMethod method = new LifecycleMethod(className, callback.getLifecycleCallbackMethod().getStringValue().trim());
+            LifecycleCallback callback = entry.getValue();
+            LifecycleMethod method = new LifecycleMethod(className, callback.getLifecycleCallbackMethod().trim());
             map.put(className, method);
         }
         return map;
     }
 
-    private Map<String, LifecycleCallbackType> mapLifecycleCallbacks(LifecycleCallbackType[] callbackArray, String componentType) throws DeploymentException {
-        Map<String, LifecycleCallbackType> map = new HashMap<String, LifecycleCallbackType>();
-        for (LifecycleCallbackType callback : callbackArray) {
+    private Map<String, LifecycleCallback> mapLifecycleCallbacks(Collection<LifecycleCallback> callbackArray, String componentType) throws DeploymentException {
+        Map<String, LifecycleCallback> map = new HashMap<String, LifecycleCallback>();
+        for (LifecycleCallback callback : callbackArray) {
             String className;
-            if (callback.isSetLifecycleCallbackClass()) {
-                className = callback.getLifecycleCallbackClass().getStringValue().trim();
+            if (callback.getLifecycleCallbackClass() != null) {
+                className = callback.getLifecycleCallbackClass().trim();
             } else {
                 if (componentType == null) {
                     throw new DeploymentException("No component type available and none in  lifecycle callback");

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LocalRefDConfigBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LocalRefDConfigBean.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LocalRefDConfigBean.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LocalRefDConfigBean.java Thu Jun 24 18:06:24 2010
@@ -74,6 +74,6 @@ public class LocalRefDConfigBean extends
     }
 
     protected SchemaTypeLoader getSchemaTypeLoader() {
-        return ENCHelper.SCHEMA_TYPE_LOADER;
+        return null;// ENCHelper.SCHEMA_TYPE_LOADER;
     }
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/RemoteRefDConfigBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/RemoteRefDConfigBean.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/RemoteRefDConfigBean.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/RemoteRefDConfigBean.java Thu Jun 24 18:06:24 2010
@@ -75,6 +75,6 @@ public class RemoteRefDConfigBean extend
     }
 
     protected SchemaTypeLoader getSchemaTypeLoader() {
-        return ENCHelper.SCHEMA_TYPE_LOADER;
+        return null;// ENCHelper.SCHEMA_TYPE_LOADER;
     }
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentSetter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentSetter.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentSetter.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentSetter.java Thu Jun 24 18:06:24 2010
@@ -16,6 +16,10 @@
  */
 package org.apache.geronimo.naming.deployment;
 
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.openejb.jee.ResourceRef;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
 import org.apache.geronimo.common.DeploymentException;
@@ -25,6 +29,6 @@ import org.apache.geronimo.common.Deploy
  */
 public interface ResourceEnvironmentSetter {
 
-    void setResourceEnvironment(ResourceEnvironmentBuilder builder, XmlObject[] resourceRefs, GerResourceRefType[] gerResourceRefs) throws DeploymentException;
+    void setResourceEnvironment(ResourceEnvironmentBuilder builder, Collection<ResourceRef> resourceRefs, GerResourceRefType[] gerResourceRefs) throws DeploymentException;
 
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ServiceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ServiceRefBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ServiceRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ServiceRefBuilder.java Thu Jun 24 18:06:24 2010
@@ -21,19 +21,20 @@ import java.util.Map;
 
 import org.apache.geronimo.common.DeploymentException;
 
+import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 
 import org.apache.geronimo.kernel.repository.Environment;
 
 import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefType;
 
-import org.apache.xmlbeans.XmlObject;
+import org.apache.openejb.jee.ServiceRef;
 
 public interface ServiceRefBuilder {
-    void buildNaming(XmlObject serviceRef,
+    void buildNaming(ServiceRef serviceRef,
                      GerServiceRefType serviceRefType,
                      Module module,
-                     Map componentContext) throws DeploymentException;
+                     Map<EARContext.Key, Object> componentContext) throws DeploymentException;
 
     Environment getEnvironment();
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/SwitchingServiceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/SwitchingServiceRefBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/SwitchingServiceRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/SwitchingServiceRefBuilder.java Thu Jun 24 18:06:24 2010
@@ -21,6 +21,7 @@ import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.annotation.Resource;
@@ -31,19 +32,16 @@ import org.apache.geronimo.gbean.GBeanIn
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
-import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.j2ee.deployment.annotation.ResourceAnnotationHelper;
 import org.apache.geronimo.j2ee.deployment.annotation.WebServiceRefAnnotationHelper;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefDocument;
 import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefType;
-import org.apache.geronimo.xbeans.javaee6.DescriptionType;
-import org.apache.geronimo.xbeans.javaee6.FullyQualifiedClassType;
-import org.apache.geronimo.xbeans.javaee6.InjectionTargetType;
-import org.apache.geronimo.xbeans.javaee6.JndiNameType;
-import org.apache.geronimo.xbeans.javaee6.ServiceRefType;
-import org.apache.geronimo.xbeans.javaee6.XsdStringType;
+import org.apache.openejb.jee.InjectionTarget;
+import org.apache.openejb.jee.JndiConsumer;
+import org.apache.openejb.jee.ServiceRef;
+import org.apache.openejb.jee.Text;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.Bundle;
@@ -75,7 +73,7 @@ public class SwitchingServiceRefBuilder 
         this.serviceRefQNameSet = buildQNameSet(eeNamespaces, "service-ref");
     }
 
-    public void buildEnvironment(XmlObject specDD,
+    public void buildEnvironment(JndiConsumer specDD,
             XmlObject plan,
             Environment environment)
             throws DeploymentException {
@@ -87,57 +85,52 @@ public class SwitchingServiceRefBuilder 
         }
     }
 
-    public void buildNaming(XmlObject specDD,
+    public void buildNaming(JndiConsumer specDD,
             XmlObject plan,
             Module module,
             Map<EARContext.Key, Object> sharedContext) throws DeploymentException {
 
         // Discover and process any @WebServiceRef annotations (if !metadata-complete)
         if ((module != null) && (module.getClassFinder() != null)) {
-            processAnnotations(module);
+            processAnnotations(specDD, module);
         }
 
         Bundle bundle = module.getEarContext().getDeploymentBundle();
         Class jaxrpcClass = null;
         Class jaxwsClass = null;
 
-        XmlObject[] serviceRefs = specDD.selectChildren(serviceRefQNameSet);
+        Collection<ServiceRef> serviceRefs = specDD.getServiceRef();
 
         XmlObject[] gerServiceRefsUntyped = plan == null ? NO_REFS : plan
                 .selectChildren(GER_SERVICE_REF_QNAME_SET);
         Map serviceRefMap = mapServiceRefs(gerServiceRefsUntyped);
 
-        for (XmlObject serviceRef : serviceRefs) {
+        for (ServiceRef serviceRef : serviceRefs) {
             if (jaxrpcClass == null) {
                 jaxrpcClass = loadClass("javax.xml.rpc.Service", bundle);
             }
             if (jaxwsClass == null) {
                 jaxwsClass = loadClass("javax.xml.ws.Service", bundle);
             }
-            ServiceRefType serviceRefType = (ServiceRefType) convert(
-                    serviceRef, JEE_CONVERTER, ServiceRefType.type);
 
-            String name = getStringValue(serviceRefType.getServiceRefName());
+            String name = getStringValue(serviceRef.getServiceRefName());
             GerServiceRefType gerServiceRefType = (GerServiceRefType) serviceRefMap.get(name);
             serviceRefMap.remove(name);
 
-            String serviceInterfaceName = getStringValue(serviceRefType
-                    .getServiceInterface());
+            String serviceInterfaceName = serviceRef.getServiceInterface();
             Class serviceInterfaceClass = loadClass(serviceInterfaceName, bundle);
 
-            InjectionTargetType[] injections = serviceRefType.getInjectionTargetArray();
+            List<InjectionTarget> injections = serviceRef.getInjectionTarget();
             addInjections(name, injections, sharedContext);
 
             if (jaxrpcClass.isAssignableFrom(serviceInterfaceClass)) {
                 // class jaxrpc handler
                 ServiceRefBuilder jaxrpcBuilder = getJAXRCPBuilder();
-                jaxrpcBuilder.buildNaming(serviceRef, gerServiceRefType,
-                        module, sharedContext);
+                jaxrpcBuilder.buildNaming(serviceRef, gerServiceRefType, module, sharedContext);
             } else if (jaxwsClass.isAssignableFrom(serviceInterfaceClass)) {
                 // calll jaxws handler
                 ServiceRefBuilder jaxwsBuilder = getJAXWSBuilder();
-                jaxwsBuilder.buildNaming(serviceRef, gerServiceRefType, module,
-                        sharedContext);
+                jaxwsBuilder.buildNaming(serviceRef, gerServiceRefType, module, sharedContext);
             } else {
                 throw new DeploymentException(serviceInterfaceName
                         + " does not extend "
@@ -205,13 +198,13 @@ public class SwitchingServiceRefBuilder 
         return refMap;
     }
 
-    private void processAnnotations(Module module) throws DeploymentException {
+    private void processAnnotations(JndiConsumer specDD, Module module) throws DeploymentException {
 
         // Process all the annotations for this naming builder type
         //At the moment the only exception thrown is if the resulting doc is not valid.  Bail now.
         try {
-            WebServiceRefAnnotationHelper.processAnnotations(module.getAnnotatedApp(), module.getClassFinder());
-            ResourceAnnotationHelper.processAnnotations(module.getAnnotatedApp(), module.getClassFinder(), ServiceRefProcessor.INSTANCE);
+            WebServiceRefAnnotationHelper.processAnnotations(specDD, module.getClassFinder());
+            ResourceAnnotationHelper.processAnnotations(specDD, module.getClassFinder(), ServiceRefProcessor.INSTANCE);
         }
         catch (Exception e) {
             log.warn("Unable to process @Resource annotations for module" + module.getName(), e);
@@ -233,8 +226,8 @@ public class SwitchingServiceRefBuilder 
         private ServiceRefProcessor() {
         }
 
-        public boolean processResource(AnnotatedApp annotatedApp, Resource annotation, Class cls, Method method, Field field) {
-            log.debug("processResource( [annotatedApp] " + annotatedApp.toString() + "," + '\n' +
+        public boolean processResource(JndiConsumer jndiConsumer, Resource annotation, Class cls, Method method, Field field) {
+            log.debug("processResource( [annotatedApp] " + jndiConsumer.toString() + "," + '\n' +
                     "[annotation] " + annotation.toString() + "," + '\n' +
                     "[cls] " + (cls != null ? cls.getName() : null) + "," + '\n' +
                     "[method] " + (method != null ? method.getName() : null) + "," + '\n' +
@@ -253,13 +246,13 @@ public class SwitchingServiceRefBuilder 
                 log.debug("processResource(): <service-ref> found");
 
                 boolean exists = false;
-                ServiceRefType[] serviceRefs = annotatedApp.getServiceRefArray();
-                for (ServiceRefType serviceRef : serviceRefs) {
-                    if (serviceRef.getServiceRefName().getStringValue().trim().equals(resourceName)) {
+                Collection<ServiceRef> serviceRefs = jndiConsumer.getServiceRef();
+                for (ServiceRef serviceRef : serviceRefs) {
+                    if (serviceRef.getServiceRefName().trim().equals(resourceName)) {
                         if (method != null || field != null) {
-                            InjectionTargetType[] targets = serviceRef.getInjectionTargetArray();
+                            List<InjectionTarget> targets = serviceRef.getInjectionTarget();
                             if (!hasTarget(method, field, targets)) {
-                                configureInjectionTarget(serviceRef.addNewInjectionTarget(), method, field);
+                                serviceRef.getInjectionTarget().add(configureInjectionTarget(method, field));
                             }
                         }
                         exists = true;
@@ -272,21 +265,17 @@ public class SwitchingServiceRefBuilder 
                         log.debug("processResource(): Does not exist in DD: " + resourceName);
 
                         // Doesn't exist in deployment descriptor -- add new
-                        ServiceRefType serviceRef = annotatedApp.addNewServiceRef();
+                        ServiceRef serviceRef = new ServiceRef();
 
                         //------------------------------------------------------------------------------
                         // <service-ref> required elements:
                         //------------------------------------------------------------------------------
 
                         // service-ref-name
-                        JndiNameType serviceRefName = serviceRef.addNewServiceRefName();
-                        serviceRefName.setStringValue(resourceName);
-                        serviceRef.setServiceRefName(serviceRefName);
+                        serviceRef.setServiceRefName(resourceName);
 
                         // service-ref-interface
-                        FullyQualifiedClassType serviceRefInterfaceClass = serviceRef.addNewServiceInterface();
-                        serviceRefInterfaceClass.setStringValue(resourceType);
-                        serviceRef.setServiceInterface(serviceRefInterfaceClass);
+                        serviceRef.setServiceInterface(resourceType);
 
                         //------------------------------------------------------------------------------
                         // <service-ref> optional elements:
@@ -295,29 +284,24 @@ public class SwitchingServiceRefBuilder 
                         // description
                         String descriptionAnnotation = annotation.description();
                         if (!descriptionAnnotation.equals("")) {
-                            DescriptionType description = serviceRef.addNewDescription();
-                            description.setStringValue(descriptionAnnotation);
+                            serviceRef.setDescriptions(new Text[] {new Text(null, descriptionAnnotation)  });
                         }
 
                         // service-ref-type
-                        if (!serviceRef.isSetServiceRefType()) {
-                            FullyQualifiedClassType serviceRefTypeClass = serviceRef.addNewServiceRefType();
-                            serviceRefTypeClass.setStringValue(resourceType);
-                            serviceRef.setServiceRefType(serviceRefTypeClass);
+                        if (serviceRef.getServiceRefType() == null) {
+                            serviceRef.setServiceRefType(resourceType);
                         }
 
                         // injectionTarget
                         if (method != null || field != null) {
-                            InjectionTargetType injectionTarget = serviceRef.addNewInjectionTarget();
-                            configureInjectionTarget(injectionTarget, method, field);
+                            serviceRef.getInjectionTarget().add(configureInjectionTarget(method, field));
                         }
                         
                         // mappedName
-                        if (!serviceRef.isSetMappedName() && annotation.mappedName().trim().length() > 0) {
-                            XsdStringType mappedName = serviceRef.addNewMappedName();
-                            mappedName.setStringValue(annotation.mappedName().trim());
-                            serviceRef.setMappedName(mappedName);
+                        if (serviceRef.getMappedName() == null && annotation.mappedName().trim().length() > 0) {
+                            serviceRef.setMappedName(annotation.mappedName().trim());
                         }
+                        jndiConsumer.getServiceRef().add(serviceRef);
                     }
                     catch (Exception anyException) {
                         log.debug("SwitchServiceRefBuilder: Exception caught while processing <service-ref>");

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/UserTransactionRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/UserTransactionRefBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/UserTransactionRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/UserTransactionRefBuilder.java Thu Jun 24 18:06:24 2010
@@ -25,6 +25,7 @@ import org.apache.geronimo.gbean.GBeanIn
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.openejb.jee.JndiConsumer;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 
@@ -33,7 +34,7 @@ import org.apache.xmlbeans.XmlObject;
  */
 public class UserTransactionRefBuilder extends AbstractNamingBuilder {
 
-    public void buildNaming(XmlObject specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> sharedContext) throws DeploymentException {
+    public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> sharedContext) throws DeploymentException {
 //        EARContext rootContext = module.getRootEarContext();
 //        UserTransaction userTransaction = rootContext.getUserTransaction();
 //        if (userTransaction != null) {

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java Thu Jun 24 18:06:24 2010
@@ -17,7 +17,9 @@
 
 package org.apache.geronimo.naming.deployment;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
+import java.io.InputStream;
 import java.net.URI;
 import java.net.URL;
 import java.util.Arrays;
@@ -49,6 +51,8 @@ import org.apache.geronimo.kernel.osgi.M
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
+import org.apache.openejb.jee.JaxbJavaee;
+import org.apache.openejb.jee.WebApp;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.BundleContext;
@@ -60,7 +64,7 @@ public class EnvironmentEntryBuilderTest
     private Map<EARContext.Key, Object> componentContext = new HashMap<EARContext.Key, Object>();
     private NamingBuilder environmentEntryBuilder = new EnvironmentEntryBuilder(new String[]{AbstractNamingBuilder.JEE_NAMESPACE});
 
-    private static final String TEST = "<tmp xmlns=\"http://java.sun.com/xml/ns/javaee\">" +
+    private static final String TEST = "<web-app xmlns=\"http://java.sun.com/xml/ns/javaee\">" +
             "<env-entry>" +
             "<env-entry-name>string</env-entry-name>" +
             "<env-entry-type>java.lang.String</env-entry-type>" +
@@ -126,7 +130,7 @@ public class EnvironmentEntryBuilderTest
             "<env-entry-type>java.util.concurrent.TimeUnit</env-entry-type>" +
             "<env-entry-value>NANOSECONDS</env-entry-value>" +
             "</env-entry>" +
-            "</tmp>";
+            "</web-app>";
 
     private static final String TEST_PLAN = "<tmp xmlns=\"http://geronimo.apache.org/xml/ns/naming-1.2\">" +
             "<env-entry>" +
@@ -195,7 +199,7 @@ public class EnvironmentEntryBuilderTest
         locations.put(null, artifact);
         BundleContext bundleContext = new MockBundleContext(getClass().getClassLoader(), "", null, locations);
         Artifact id = new Artifact("test", "test", "", "car");
-        module  = new ConnectorModule(false, new AbstractName(id, Collections.singletonMap("name", "test")), null, null, null, "foo", null, null, null, null, null, null);
+        module  = new ConnectorModule(false, new AbstractName(id, Collections.singletonMap("name", "test")), null, null, null, "foo", null, null, null, null, null);
         ConfigurationManager configurationManager = new MockConfigurationManager();
         EARContext earContext = new EARContext(new File("foo"),
             null,
@@ -226,15 +230,8 @@ public class EnvironmentEntryBuilderTest
         Double doubleVal = new Double(12345.6789);
         Boolean booleanVal = Boolean.TRUE;
 
-        XmlObject doc = XmlObject.Factory.parse(TEST);
-        XmlCursor cursor = doc.newCursor();
-        try {
-            cursor.toFirstChild();
-            doc = cursor.getObject();
-        } finally {
-            cursor.dispose();
-        }
-        environmentEntryBuilder.buildNaming(doc, null, module, componentContext);
+        WebApp webApp = load(TEST, WebApp.class);
+        environmentEntryBuilder.buildNaming(webApp, null, module, componentContext);
         Context context = EnterpriseNamingContext.livenReferences(module.getJndiScope(JndiScope.comp), null, null, getClass().getClassLoader(), null, "comp/");
         Set actual = new HashSet();
         for (NamingEnumeration e = context.listBindings("comp/env"); e.hasMore();) {
@@ -268,23 +265,16 @@ public class EnvironmentEntryBuilderTest
         Double doubleVal = new Double(9876.54321);
         Boolean booleanVal = Boolean.FALSE;
 
-        XmlObject doc = XmlObject.Factory.parse(TEST);
-        XmlCursor cursor = doc.newCursor();
-        try {
-            cursor.toFirstChild();
-            doc = cursor.getObject();
-        } finally {
-            cursor.dispose();
-        }
+        WebApp webApp = load(TEST, WebApp.class);
         XmlObject plan = XmlObject.Factory.parse(TEST_PLAN);
-        cursor = plan.newCursor();
+        XmlCursor cursor = plan.newCursor();
         try {
             cursor.toFirstChild();
             plan = cursor.getObject();
         } finally {
             cursor.dispose();
         }
-        environmentEntryBuilder.buildNaming(doc, plan, module, componentContext);
+        environmentEntryBuilder.buildNaming(webApp, plan, module, componentContext);
         Context context = EnterpriseNamingContext.livenReferences(module.getJndiScope(JndiScope.comp), null, null, getClass().getClassLoader(), null, "comp/");
         Set actual = new HashSet();
         for (NamingEnumeration e = context.listBindings("comp/env"); e.hasMore();) {
@@ -311,4 +301,15 @@ public class EnvironmentEntryBuilderTest
         Context env = (Context) context.lookup("comp/env");
         assertNotNull(env);
     }
+
+    private <T> T load(String text, Class<T> clazz) throws Exception {
+        InputStream in = new ByteArrayInputStream(text.getBytes());
+        try {
+            return (T) JaxbJavaee.unmarshal(clazz, in);
+        } finally {
+            in.close();
+        }
+    }
+
+
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/annotation/AnnotationHelperTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/annotation/AnnotationHelperTest.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/annotation/AnnotationHelperTest.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/annotation/AnnotationHelperTest.java Thu Jun 24 18:06:24 2010
@@ -17,6 +17,7 @@
 
 package org.apache.geronimo.naming.deployment.annotation;
 
+import java.io.InputStream;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.net.URL;
@@ -25,16 +26,16 @@ import java.util.List;
 
 import javax.annotation.Resource;
 import javax.annotation.Resources;
-
+import javax.xml.bind.JAXBException;
 import org.apache.geronimo.j2ee.deployment.annotation.ResourceAnnotationHelper;
-import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedWebApp;
 import org.apache.geronimo.naming.deployment.EnvironmentEntryBuilder;
 import org.apache.geronimo.naming.deployment.SwitchingServiceRefBuilder;
 import org.apache.geronimo.testsupport.XmlBeansTestSupport;
-import org.apache.geronimo.xbeans.javaee6.WebAppDocument;
-import org.apache.geronimo.xbeans.javaee6.WebAppType;
-import org.apache.xmlbeans.XmlObject;
+import org.apache.openejb.jee.JaxbJavaee;
+import org.apache.openejb.jee.WebApp;
 import org.apache.xbean.finder.ClassFinder;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 
 /**
@@ -76,35 +77,56 @@ public class AnnotationHelperTest extend
         //
         // 2. env-entry
         //
-        URL srcXML = classLoader.getResource("annotation/empty-web-src.xml");
-        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
-        WebAppDocument webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
-        WebAppType webApp = webAppDoc.getWebApp();
-        AnnotatedWebApp annotatedWebApp = new AnnotatedWebApp(webApp);
-        ResourceAnnotationHelper.processAnnotations(annotatedWebApp, classFinder, EnvironmentEntryBuilder.EnvEntryRefProcessor.INSTANCE);
+//        URL srcXML = classLoader.getResource("annotation/empty-web-src.xml");
+//        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
+//        WebAppDocument webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
+//        WebAppType webApp = webAppDoc.getWebApp();
+//        AnnotatedWebApp annotatedWebApp = new AnnotatedWebApp(webApp);
+        WebApp webApp = load("annotation/empty-web-src.xml", WebApp.class);
+        ResourceAnnotationHelper.processAnnotations(webApp, classFinder, EnvironmentEntryBuilder.EnvEntryRefProcessor.INSTANCE);
         URL expectedXML = classLoader.getResource("annotation/env-entry-expected.xml");
         XmlObject expected = XmlObject.Factory.parse(expectedXML);
-        log.debug("[@Resource <env-entry> Source XML] " + '\n' + webApp.toString() + '\n');
-        log.debug("[@Resource <env-entry> Expected XML]" + '\n' + expected.toString() + '\n');
+//        log.debug("[@Resource <env-entry> Source XML] " + '\n' + webApp.toString() + '\n');
+//        log.debug("[@Resource <env-entry> Expected XML]" + '\n' + expected.toString() + '\n');
         List problems = new ArrayList();
         boolean ok = compareXmlObjects(webApp, expected, problems);
         assertTrue("Differences: " + problems, ok);
         //
         // 3. service-ref
         //
-        srcXML = classLoader.getResource("annotation/empty-web-src.xml");
-        xmlObject = XmlObject.Factory.parse(srcXML, options);
-        webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
-        webApp = webAppDoc.getWebApp();
-        annotatedWebApp = new AnnotatedWebApp(webApp);
-        ResourceAnnotationHelper.processAnnotations(annotatedWebApp, classFinder, SwitchingServiceRefBuilder.ServiceRefProcessor.INSTANCE);
+//        srcXML = classLoader.getResource("annotation/empty-web-src.xml");
+//        xmlObject = XmlObject.Factory.parse(srcXML, options);
+//        webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
+//        webApp = webAppDoc.getWebApp();
+//        annotatedWebApp = new AnnotatedWebApp(webApp);
+        webApp = load("annotation/empty-web-src.xml", WebApp.class);
+        ResourceAnnotationHelper.processAnnotations(webApp, classFinder, SwitchingServiceRefBuilder.ServiceRefProcessor.INSTANCE);
         expectedXML = classLoader.getResource("annotation/service-ref-expected.xml");
         expected = XmlObject.Factory.parse(expectedXML);
-        log.debug("[@Resource <service-ref> Source XML] " + '\n' + webApp.toString() + '\n');
-        log.debug("[@Resource <service-ref> Expected XML]" + '\n' + expected.toString() + '\n');
+//        log.debug("[@Resource <service-ref> Source XML] " + '\n' + webApp.toString() + '\n');
+//        log.debug("[@Resource <service-ref> Expected XML]" + '\n' + expected.toString() + '\n');
         problems = new ArrayList();
         ok = compareXmlObjects(webApp, expected, problems);
         assertTrue("Differences: " + problems, ok);
     }
 
+    
+    private boolean compareXmlObjects(WebApp webApp, XmlObject expected, List problems) throws JAXBException, XmlException {
+        String xml = JaxbJavaee.marshal(WebApp.class, webApp);
+        log.debug("[Source XML] " + '\n' + xml + '\n');
+        log.debug("[Expected XML]" + '\n' + expected.toString() + '\n');
+        XmlObject actual = XmlObject.Factory.parse(xml);
+        return compareXmlObjects(actual, expected, problems);
+    }
+
+    private <T> T load(String url, Class<T> clazz) throws Exception {
+        URL srcXml = classLoader.getResource(url);
+        InputStream in = srcXml.openStream();
+        try {
+            return (T) JaxbJavaee.unmarshal(clazz, in);
+        } finally {
+            in.close();
+        }
+    }
+
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/annotation/ResourceAnnotationExample.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/annotation/ResourceAnnotationExample.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/annotation/ResourceAnnotationExample.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/annotation/ResourceAnnotationExample.java Thu Jun 24 18:06:24 2010
@@ -37,8 +37,6 @@ public class ResourceAnnotationExample {
 
     @Resource(name = "Resource3",
               type = java.lang.Object.class,
-              authenticationType = Resource.AuthenticationType.CONTAINER,
-              shareable = true,
               mappedName = "mappedName3")
     boolean annotatedField1;
 

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/resources/annotation/env-entry-expected.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/resources/annotation/env-entry-expected.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/resources/annotation/env-entry-expected.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/resources/annotation/env-entry-expected.xml Thu Jun 24 18:06:24 2010
@@ -17,12 +17,12 @@
 -->
 
 <web-app xmlns="http://java.sun.com/xml/ns/javaee"
-   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
-   version="3.0" >
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
 
-    <display-name>Empty web application</display-name>
     <description>Empty web application</description>
+    <display-name>Empty web application</display-name>
     <env-entry>
         <description>description1</description>
         <env-entry-name>Resource1</env-entry-name>
@@ -33,18 +33,26 @@
         <env-entry-name>org.apache.geronimo.j2ee.deployment.annotation.ResourceAnnotationTest/annotatedMethod2</env-entry-name>
         <env-entry-type>java.lang.String</env-entry-type>
         <injection-target>
-             <injection-target-class>org.apache.geronimo.naming.deployment.annotation.ResourceAnnotationExample</injection-target-class>
-             <injection-target-name>annotatedMethod2</injection-target-name>
+            <injection-target-class>org.apache.geronimo.naming.deployment.annotation.ResourceAnnotationExample</injection-target-class>
+            <injection-target-name>annotatedMethod2</injection-target-name>
         </injection-target>
     </env-entry>
     <env-entry>
         <env-entry-name>org.apache.geronimo.j2ee.deployment.annotation.ResourceAnnotationTest/annotatedMethod3</env-entry-name>
         <env-entry-type>java.lang.String</env-entry-type>
         <injection-target>
-             <injection-target-class>org.apache.geronimo.naming.deployment.annotation.ResourceAnnotationExample</injection-target-class>
-             <injection-target-name>annotatedMethod3</injection-target-name>
+            <injection-target-class>org.apache.geronimo.naming.deployment.annotation.ResourceAnnotationExample</injection-target-class>
+            <injection-target-name>annotatedMethod3</injection-target-name>
         </injection-target>
         <lookup-name>java:app/foo</lookup-name>
     </env-entry>
-
+    <!--<env-entry>-->
+        <!--<env-entry-name>Resource3</env-entry-name>-->
+        <!--<env-entry-type>java.lang.Boolean</env-entry-type>-->
+        <!--<mapped-name>mappedName3</mapped-name>-->
+        <!--<injection-target>-->
+            <!--<injection-target-class>org.apache.geronimo.naming.deployment.annotation.ResourceAnnotationExample</injection-target-class>-->
+            <!--<injection-target-name>annotatedField1</injection-target-name>-->
+        <!--</injection-target>-->
+    <!--</env-entry>-->
 </web-app>

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/resources/annotation/service-ref-expected.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/resources/annotation/service-ref-expected.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/resources/annotation/service-ref-expected.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/resources/annotation/service-ref-expected.xml Thu Jun 24 18:06:24 2010
@@ -21,8 +21,8 @@
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5" >
 
-    <display-name>Empty web application</display-name>
     <description>Empty web application</description>
+    <display-name>Empty web application</display-name>
     <service-ref>
         <service-ref-name>Resource2</service-ref-name>
         <service-interface>javax.xml.ws.Service</service-interface>

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/pom.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/pom.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/pom.xml Thu Jun 24 18:06:24 2010
@@ -87,14 +87,6 @@
                         <_exportcontents>schemaorg_apache_xmlbeans*</_exportcontents>
                         <DynamicImport-Package>schemaorg_apache_xmlbeans.*</DynamicImport-Package>
                         <Import-Package>
-                            org.apache.geronimo.xbeans.javaee.impl,
-                            org.apache.geronimo.xbeans.javaee,
-                            org.apache.geronimo.xbeans.persistence.impl,
-                            org.apache.geronimo.xbeans.persistence,
-                            org.apache.geronimo.xbeans.j2ee.impl,
-                            org.apache.geronimo.xbeans.j2ee,
-                            org.w3.xml.x1998.namespace.impl,
-                            org.w3.xml.x1998.namespace,
                             org.apache.geronimo.deployment.xbeans.impl,
                             org.apache.geronimo.deployment.javabean.xbeans.impl,
                             org.apache.geronimo.deployment.xbeans,

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/pom.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/pom.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/pom.xml Thu Jun 24 18:06:24 2010
@@ -73,6 +73,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.openejb</groupId>
+            <artifactId>openejb-jee</artifactId>
+        </dependency>
+            
+        <dependency>
             <groupId>org.apache.xbean</groupId>
             <artifactId>xbean-bundleutils</artifactId>
         </dependency>
@@ -108,14 +113,6 @@
                         <_exportcontents>schemaorg_apache_xmlbeans*</_exportcontents>
                         <DynamicImport-Package>schemaorg_apache_xmlbeans.*</DynamicImport-Package>
                         <Import-Package>
-                            org.apache.geronimo.xbeans.javaee.impl,
-                            org.apache.geronimo.xbeans.javaee,
-                            org.apache.geronimo.xbeans.persistence.impl,
-                            org.apache.geronimo.xbeans.persistence,
-                            org.apache.geronimo.xbeans.j2ee.impl,
-                            org.apache.geronimo.xbeans.j2ee,
-                            org.w3.xml.x1998.namespace.impl,
-                            org.w3.xml.x1998.namespace,
                             org.apache.geronimo.deployment.xbeans.impl,
                             org.apache.geronimo.deployment.javabean.xbeans.impl,
                             org.apache.geronimo.deployment.xbeans,

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web/deployment/WebAppDConfigRoot.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web/deployment/WebAppDConfigRoot.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web/deployment/WebAppDConfigRoot.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web/deployment/WebAppDConfigRoot.java Thu Jun 24 18:06:24 2010
@@ -37,7 +37,6 @@ import org.apache.xmlbeans.XmlException;
  */
 public class WebAppDConfigRoot extends DConfigBeanRootSupport {
     static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderUnion(new SchemaTypeLoader[]{
-        XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.javaee6.String.class.getClassLoader()),
         XmlBeans.typeLoaderForClassLoader(GerWebAppDocument.class.getClassLoader())
     });
 

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java Thu Jun 24 18:06:24 2010
@@ -45,7 +45,6 @@ import javax.xml.parsers.ParserConfigura
 import javax.xml.stream.Location;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.components.jaspi.model.AuthModuleType;
 import org.apache.geronimo.components.jaspi.model.ConfigProviderType;
@@ -95,20 +94,14 @@ import org.apache.geronimo.web.security.
 import org.apache.geronimo.web25.deployment.merge.MergeHelper;
 import org.apache.geronimo.web25.deployment.security.AuthenticationWrapper;
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerSecurityDocument;
-import org.apache.geronimo.xbeans.javaee6.FilterType;
-import org.apache.geronimo.xbeans.javaee6.FullyQualifiedClassType;
-import org.apache.geronimo.xbeans.javaee6.ListenerType;
-import org.apache.geronimo.xbeans.javaee6.ServletMappingType;
-import org.apache.geronimo.xbeans.javaee6.ServletType;
-import org.apache.geronimo.xbeans.javaee6.UrlPatternType;
-import org.apache.geronimo.xbeans.javaee6.WebAppType;
+import org.apache.openejb.jee.JaxbJavaee;
+import org.apache.openejb.jee.ServletMapping;
+import org.apache.openejb.jee.WebApp;
 import org.apache.xbean.finder.AbstractFinder;
 import org.apache.xbean.finder.BundleAnnotationFinder;
-import org.apache.xbean.finder.ClassFinder;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlDocumentProperties;
 import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -280,25 +273,25 @@ public abstract class AbstractWebModuleB
      * @param contextRoot context root for web app from application.xml or geronimo plan
      * @return map of servlet names to path mapped to them.  Possibly inaccurate except for web services.
      */
-    protected Map<String, String> buildServletNameToPathMap(WebAppType webApp, String contextRoot) {
+    protected Map<String, String> buildServletNameToPathMap(WebApp webApp, String contextRoot) {
         if (contextRoot == null) {
             contextRoot = "";
         } else if (!contextRoot.startsWith("/")) {
             contextRoot = "/" + contextRoot;
         }
         Map<String, String> map = new HashMap<String, String>();
-        ServletMappingType[] servletMappings = webApp.getServletMappingArray();
-        for (ServletMappingType servletMapping : servletMappings) {
-            String servletName = servletMapping.getServletName().getStringValue().trim();
-            UrlPatternType[] urlPatterns = servletMapping.getUrlPatternArray();
-            for (int i = 0; urlPatterns != null && (i < urlPatterns.length); i++) {
-                map.put(servletName, contextRoot + urlPatterns[i].getStringValue().trim());
+        List<ServletMapping> servletMappings = webApp.getServletMapping();
+        for (ServletMapping servletMapping : servletMappings) {
+            String servletName = servletMapping.getServletName();
+            List<String> urlPatterns = servletMapping.getUrlPattern();
+            for (String urlPattern: urlPatterns) {
+                map.put(servletName, contextRoot + urlPattern);
             }
         }
         return map;
     }
 
-    protected String determineDefaultContextRoot(WebAppType webApp, boolean isStandAlone, JarFile moduleFile, String targetPath) {
+    protected String determineDefaultContextRoot(WebApp webApp, boolean isStandAlone, JarFile moduleFile, String targetPath) {
         if (webApp != null && webApp.getId() != null) {
             return webApp.getId();
         }
@@ -323,14 +316,6 @@ public abstract class AbstractWebModuleB
         return path;
     }
 
-    protected String getModuleName(WebAppType webApp) {
-        if (webApp.sizeOfModuleNameArray() > 0) {
-            return webApp.getModuleNameArray()[0].getStringValue().trim();
-        } else {
-            return null;
-        }
-    }
-
     public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repositories)
             throws DeploymentException {
         EARContext moduleContext;
@@ -432,9 +417,9 @@ public abstract class AbstractWebModuleB
         URI resolutionUri = invertURI(baseUri);
         earContext.getCompleteManifestClassPath(webModule.getDeployable(), baseUri, resolutionUri, manifestcp, moduleLocations);
         //Security Configuration Validation
-        WebAppType webApp = (WebAppType) webModule.getSpecDD();
+        WebApp webApp = webModule.getSpecDD();
         boolean hasSecurityRealmName = (Boolean) module.getEarContext().getGeneralData().get(WEB_MODULE_HAS_SECURITY_REALM);
-        if ((webApp.getSecurityConstraintArray().length > 0 || webApp.getSecurityRoleArray().length > 0)) {
+        if ((!webApp.getSecurityConstraint().isEmpty() || !webApp.getSecurityRole().isEmpty())) {
             if (!hasSecurityRealmName) {
                 throw new DeploymentException("web.xml for web app " + webModule.getName()
                         + " includes security elements but Geronimo deployment plan is not provided or does not contain <security-realm-name> element necessary to configure security accordingly.");
@@ -462,7 +447,7 @@ public abstract class AbstractWebModuleB
         }
         earContext.getGeneralData().put(INITIAL_WEB_XML_SCHEMA_VERSION, originalSpecDDVersion);
         //Process web fragments and annotations
-        if (INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()) >= 2.5f && !webApp.getMetadataComplete()) {
+        if (INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()) >= 2.5f && !webApp.isMetadataComplete()) {
             MergeHelper.processWebFragmentsAndAnnotations(earContext, webModule, bundle, webApp);
         }
         //TODO From my understanding, whether we scan ServletContainerInitializer has nothing to do with meta-complete/web.xml schema version
@@ -470,7 +455,7 @@ public abstract class AbstractWebModuleB
         MergeHelper.processServletContainerInitializer(earContext, webModule, bundle);
 
         //Process Web Service
-        Map servletNameToPathMap = buildServletNameToPathMap((WebAppType) webModule.getSpecDD(), webModule.getContextRoot());
+        Map servletNameToPathMap = buildServletNameToPathMap(webModule.getSpecDD(), webModule.getContextRoot());
         Map sharedContext = webModule.getSharedContext();
         for (WebServiceBuilder serviceBuilder : webServiceBuilder) {
             serviceBuilder.findWebServices(webModule, false, servletNameToPathMap, webModule.getEnvironment(), sharedContext);
@@ -486,24 +471,14 @@ public abstract class AbstractWebModuleB
         return resolutionUri;
     }
 
-    protected String getSpecDDAsString(WebModule module) {
-        StringWriter writer = new StringWriter();
-        XmlOptions options = new XmlOptions();
-        QName webQName = new QName("http://java.sun.com/xml/ns/javaee", "web-app");
-        options.setSaveSyntheticDocumentElement(webQName);
-        options.setSavePrettyPrint();
-        options.setSavePrettyPrintIndent(4);
-        try {
-            module.getSpecDD().save(writer, options);
-        } catch (IOException e) {
-            // ignore
-        }
-        return writer.toString();
+    protected String getSpecDDAsString(WebModule module) throws JAXBException {
+        return JaxbJavaee.marshal(WebApp.class, module.getSpecDD());
     }
 
     /**
      * Identify the spec DD schema version, and save it in the EARContext
      * @param originalSpecDD text of original spec dd
+     * @return spec dd version
      */
     private float identifySpecDDSchemaVersion(String originalSpecDD) {
         float schemaVersion = 0f;
@@ -535,14 +510,15 @@ public abstract class AbstractWebModuleB
                 try {
                     cursor.dispose();
                 } catch (Exception e) {
+                    //ignore
                 }
             }
         }
         return schemaVersion;
     }
 
-    protected ComponentPermissions buildSpecSecurityConfig(EARContext earContext, WebAppType webApp, Bundle bundle) {
-        SpecSecurityBuilder builder = new SpecSecurityBuilder(webApp, bundle, INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()) >= 2.5f && !webApp.getMetadataComplete());
+    protected ComponentPermissions buildSpecSecurityConfig(EARContext earContext, WebApp webApp, Bundle bundle) {
+        SpecSecurityBuilder builder = new SpecSecurityBuilder(webApp, bundle, INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()) >= 2.5f && !webApp.isMetadataComplete());
         return builder.buildSpecSecurityConfig();
     }
 
@@ -633,7 +609,7 @@ public abstract class AbstractWebModuleB
         return true;
     }
 
-    protected AbstractFinder createWebAppClassFinder(WebAppType webApp, WebModule webModule) throws DeploymentException {
+    protected AbstractFinder createWebAppClassFinder(WebApp webApp, WebModule webModule) throws DeploymentException {
         // Get the classloader from the module's EARContext
         Bundle bundle = webModule.getEarContext().getDeploymentBundle();
 //        return createWebAppClassFinder(webApp, bundle);
@@ -644,62 +620,6 @@ public abstract class AbstractWebModuleB
         }
     }
 
-//    public static ClassFinder createWebAppClassFinder(WebAppType webApp, Bundle bundle) throws DeploymentException {
-//        //------------------------------------------------------------------------------------
-//        // Find the list of classes from the web.xml we want to search for annotations in
-//        //------------------------------------------------------------------------------------
-//        List<Class> classes = new ArrayList<Class>();
-//        // Get all the servlets from the deployment descriptor
-//        ServletType[] servlets = webApp.getServletArray();
-//        for (ServletType servlet : servlets) {
-//            FullyQualifiedClassType cls = servlet.getServletClass();
-//            if (cls != null) { // Don't try this for JSPs
-//                Class<?> clas;
-//                try {
-//                    clas = bundle.loadClass(cls.getStringValue());
-//                } catch (ClassNotFoundException e) {
-//                    throw new DeploymentException("AbstractWebModuleBuilder: Could not load servlet class: " + cls.getStringValue(), e);
-//                }
-//                addClass(classes, clas);
-//            }
-//        }
-//        // Get all the listeners from the deployment descriptor
-//        ListenerType[] listeners = webApp.getListenerArray();
-//        for (ListenerType listener : listeners) {
-//            FullyQualifiedClassType cls = listener.getListenerClass();
-//            Class<?> clas;
-//            try {
-//                clas = bundle.loadClass(cls.getStringValue());
-//            } catch (ClassNotFoundException e) {
-//                throw new DeploymentException("AbstractWebModuleBuilder: Could not load listener class: " + cls.getStringValue(), e);
-//            }
-//            addClass(classes, clas);
-//        }
-//        // Get all the filters from the deployment descriptor
-//        FilterType[] filters = webApp.getFilterArray();
-//        for (FilterType filter : filters) {
-//            FullyQualifiedClassType cls = filter.getFilterClass();
-//            Class<?> clas;
-//            try {
-//                clas = bundle.loadClass(cls.getStringValue());
-//            } catch (ClassNotFoundException e) {
-//                throw new DeploymentException("AbstractWebModuleBuilder: Could not load filter class: " + cls.getStringValue(), e);
-//            }
-//            addClass(classes, clas);
-//        }
-//        // see https://issues.apache.org/jira/browse/GERONIMO-3421 .
-//        // if the user has botched her classloader config (perhaps by
-//        // not including a jar that her app needs) then ClassFinder
-//        // will throw NoClassDefFoundError.  we want to indicate that
-//        // it's the user's error and provide a little context to help
-//        // her fix it.
-//        try {
-//            return new ClassFinder(classes);
-//        } catch (NoClassDefFoundError e) {
-//            throw new DeploymentException("Classloader for " + webApp.getId() + "can't find " + e.getMessage(), e);
-//        }
-//    }
-
     private static void addClass(List<Class> classes, Class<?> clas) {
         while (clas != Object.class) {
             classes.add(clas);
@@ -707,12 +627,12 @@ public abstract class AbstractWebModuleB
         }
     }
 
-    protected void configureBasicWebModuleAttributes(WebAppType webApp, XmlObject vendorPlan, EARContext moduleContext, EARContext earContext, WebModule webModule, GBeanData webModuleData)
+    protected void configureBasicWebModuleAttributes(WebApp webApp, XmlObject vendorPlan, EARContext moduleContext, EARContext earContext, WebModule webModule, GBeanData webModuleData)
             throws DeploymentException {
         Map<EARContext.Key, Object> buildingContext = new HashMap<EARContext.Key, Object>();
         buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleContext.getModuleName());
         webModule.getJndiContext().get(JndiScope.module).put("module/ModuleName", webModule.getName());
-        if (!webApp.getMetadataComplete()) {
+        if (!webApp.isMetadataComplete()) {
             // Create a classfinder and populate it for the naming builder(s). The absence of a
             // classFinder in the module will convey whether metadata-complete is set (or not)
             webModule.setClassFinder(createWebAppClassFinder(webApp, webModule));
@@ -757,15 +677,6 @@ public abstract class AbstractWebModuleB
         webModuleData.setAttribute("modulePath", webModule.isStandAlone() || webModule.getEarContext() != webModule.getRootEarContext() ? null : webModule.getTargetPath());
     }
 
-    private static Map<String, Object> getJndiContext(Map<JndiKey, Map<String, Object>> contexts, JndiScope scope) {
-        Map<String, Object> context = contexts.get(scope);
-        if (context == null) {
-            context = new HashMap<String, Object>();
-            contexts.put(scope, context);
-        }
-        return context;
-    }
-
     private static class InternWrapper implements XMLStreamReader {
 
         private final XMLStreamReader delegate;

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeContext.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeContext.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeContext.java Thu Jun 24 18:06:24 2010
@@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHa
 
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.web25.deployment.merge.webfragment.WebFragmentEntry;
-import org.apache.geronimo.xbeans.javaee6.WebFragmentType;
+import org.apache.openejb.jee.WebFragment;
 import org.osgi.framework.Bundle;
 
 /**
@@ -46,7 +46,7 @@ public class MergeContext {
         return bundle;
     }
 
-    public WebFragmentType getCurrentWebFragment() {
+    public WebFragment getCurrentWebFragment() {
         return webFragmentEntry.getWebFragment();
     }
 



Mime
View raw message