geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r957655 [11/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/config...
Date Thu, 24 Jun 2010 18:06:33 GMT
Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/security/SpecSecurityBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/security/SpecSecurityBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/security/SpecSecurityBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/security/SpecSecurityBuilder.java Thu Jun 24 18:06:24 2010
@@ -27,6 +27,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -36,7 +37,6 @@ import javax.security.jacc.WebResourcePe
 import javax.security.jacc.WebRoleRefPermission;
 import javax.security.jacc.WebUserDataPermission;
 import javax.servlet.HttpMethodConstraintElement;
-import javax.servlet.Servlet;
 import javax.servlet.ServletSecurityElement;
 import javax.servlet.annotation.HttpConstraint;
 import javax.servlet.annotation.HttpMethodConstraint;
@@ -47,17 +47,15 @@ import org.apache.geronimo.deployment.xm
 import org.apache.geronimo.kernel.util.JarUtils;
 import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.geronimo.security.jacc.ComponentPermissions;
-import org.apache.geronimo.xbeans.javaee6.AuthConstraintType;
-import org.apache.geronimo.xbeans.javaee6.RoleNameType;
-import org.apache.geronimo.xbeans.javaee6.SecurityConstraintType;
-import org.apache.geronimo.xbeans.javaee6.SecurityRoleRefType;
-import org.apache.geronimo.xbeans.javaee6.SecurityRoleType;
-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.WebAppDocument;
-import org.apache.geronimo.xbeans.javaee6.WebAppType;
-import org.apache.geronimo.xbeans.javaee6.WebResourceCollectionType;
+import org.apache.openejb.jee.AuthConstraint;
+import org.apache.openejb.jee.SecurityConstraint;
+import org.apache.openejb.jee.SecurityRoleRef;
+import org.apache.openejb.jee.SecurityRole;
+import org.apache.openejb.jee.ServletMapping;
+import org.apache.openejb.jee.Servlet;
+import org.apache.openejb.jee.UserDataConstraint;
+import org.apache.openejb.jee.WebApp;
+import org.apache.openejb.jee.WebResourceCollection;
 import org.apache.xbean.osgi.bundle.util.BundleUtils;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
@@ -93,7 +91,7 @@ public class SpecSecurityBuilder {
     /**
      * webApp is xmlbean object of the initial web.xml ( May be merged all the web-fragment.xml files)
      */
-    private WebAppType initialWebApp;
+    private WebApp initialWebApp;
 
     private Bundle bundle;
 
@@ -104,18 +102,18 @@ public class SpecSecurityBuilder {
     /**
      *   dynamicSecurityWebApp contains all the servlet security constraints configured by ServletRegistration.Dynamic interface
      */
-    private WebAppType dynamicSecurityWebApp;
+    private WebApp dynamicSecurityWebApp;
 
     /**
      * annotationSecurityWebApp contains all the servlet security constraints configured by ServletConstraint annotation
      */
-    private WebAppType annotationSecurityWebApp;
+    private WebApp annotationSecurityWebApp;
 
-    public SpecSecurityBuilder(WebAppType webApp) {
+    public SpecSecurityBuilder(WebApp webApp) {
         this(webApp, null, false);
     }
 
-    public SpecSecurityBuilder(WebAppType initialWebApp, Bundle bundle, boolean annotationScanRequired) {
+    public SpecSecurityBuilder(WebApp initialWebApp, Bundle bundle, boolean annotationScanRequired) {
         this.initialWebApp = initialWebApp;
         if (annotationScanRequired && bundle == null) {
             throw new IllegalArgumentException("Bundle parameter could not be null while annotation scanning is required");
@@ -125,46 +123,6 @@ public class SpecSecurityBuilder {
         initialize();
     }
 
-    public SpecSecurityBuilder(Bundle bundle, boolean annotationScanRequired) {
-        this.bundle = bundle;
-        this.annotationScanRequired = annotationScanRequired;
-        URL specDDUrl = BundleUtils.getEntry(bundle, "WEB-INF/web.xml");
-        if (specDDUrl == null) {
-            initialWebApp = WebAppType.Factory.newInstance();
-        } else {
-            try {
-                String specDD = JarUtils.readAll(specDDUrl);
-                XmlObject parsed = XmlBeansUtil.parse(specDD);
-                WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed);
-                initialWebApp = webAppDoc.getWebApp();
-            } catch (XmlException e) {
-                throw new IllegalArgumentException("Error parsing web.xml for " + bundle.getSymbolicName(), e);
-            } catch (Exception e) {
-                throw new IllegalArgumentException("Error reading web.xml for " + bundle.getSymbolicName(), e);
-            }
-        }
-        initialize();
-    }
-
-    public SpecSecurityBuilder(Bundle bundle, String deploymentDescriptor, boolean annotationScanRequired) {
-        this.bundle = bundle;
-        this.annotationScanRequired = annotationScanRequired;
-        if (deploymentDescriptor == null || deploymentDescriptor.length() == 0) {
-            initialWebApp = WebAppType.Factory.newInstance();
-        } else {
-            try {
-                XmlObject parsed = XmlBeansUtil.parse(deploymentDescriptor);
-                WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed);
-                initialWebApp = webAppDoc.getWebApp();
-            } catch (XmlException e) {
-                throw new IllegalArgumentException("Error parsing web.xml for " + bundle.getSymbolicName(), e);
-            } catch (Exception e) {
-                throw new IllegalArgumentException("Error reading web.xml for " + bundle.getSymbolicName(), e);
-            }
-        }
-        initialize();
-    }
-
     public void declareRoles(String... roleNames) {
         //Let's go ahead to directly add the roles to the securityRoles set. The set will be used in the collectRoleNames method.
         for (String roleName : roleNames) {
@@ -177,7 +135,7 @@ public class SpecSecurityBuilder {
 
     public Set<String> setServletSecurity(ServletSecurityElement constraint, Collection<String> urlPatterns) {
         if (dynamicSecurityWebApp == null) {
-            dynamicSecurityWebApp = WebAppType.Factory.newInstance();
+            dynamicSecurityWebApp = new WebApp();
         }
         Set<String> uneffectedUrlPatterns = new HashSet<String>();
         for (String urlPattern : urlPatterns) {
@@ -217,25 +175,25 @@ public class SpecSecurityBuilder {
         return uneffectedUrlPatterns;
     }
 
-    private void overrideSecurityConstraints(WebAppType webApp, Collection<String> urlPatterns) {
-        for (SecurityConstraintType securityConstraint : webApp.getSecurityConstraintArray()) {
+    private void overrideSecurityConstraints(WebApp webApp, Collection<String> urlPatterns) {
+        for (SecurityConstraint securityConstraint : webApp.getSecurityConstraint()) {
             int iCurrentWebResourceCollectionIndex = 0;
-            for (WebResourceCollectionType webResourceCollection : securityConstraint.getWebResourceCollectionArray()) {
+            for (WebResourceCollection webResourceCollection : securityConstraint.getWebResourceCollection()) {
                 Set<String> validateAnnotationUrlPatterns = new HashSet<String>();
-                for (UrlPatternType urlPattern : webResourceCollection.getUrlPatternArray()) {
-                    if (!urlPatterns.contains(urlPattern.getStringValue())) {
-                        validateAnnotationUrlPatterns.add(urlPattern.getStringValue());
+                for (String urlPattern : webResourceCollection.getUrlPattern()) {
+                    if (!urlPatterns.contains(urlPattern)) {
+                        validateAnnotationUrlPatterns.add(urlPattern);
                     }
                 }
                 if (validateAnnotationUrlPatterns.size() == 0) {
-                    securityConstraint.removeWebResourceCollection(iCurrentWebResourceCollectionIndex);
+                    securityConstraint.getWebResourceCollection().remove(iCurrentWebResourceCollectionIndex);
                     continue;
-                } else if (validateAnnotationUrlPatterns.size() < webResourceCollection.getUrlPatternArray().length) {
-                    for (int i = 0, iLoopSize = webResourceCollection.getUrlPatternArray().length; i < iLoopSize; i++) {
-                        webResourceCollection.removeUrlPattern(0);
+                } else if (validateAnnotationUrlPatterns.size() < webResourceCollection.getUrlPattern().size()) {
+                    for (int i = 0, iLoopSize = webResourceCollection.getUrlPattern().size(); i < iLoopSize; i++) {
+                        webResourceCollection.getUrlPattern().remove(0);
                     }
                     for (String validateAnnotationUrlPattern : validateAnnotationUrlPatterns) {
-                        webResourceCollection.addNewUrlPattern().setStringValue(validateAnnotationUrlPattern);
+                        webResourceCollection.getUrlPattern().add(validateAnnotationUrlPattern);
                     }
                 }
                 iCurrentWebResourceCollectionIndex++;
@@ -245,23 +203,23 @@ public class SpecSecurityBuilder {
 
     public ComponentPermissions buildSpecSecurityConfig() {
         if (dynamicSecurityWebApp != null) {
-            for (SecurityConstraintType securityConstraint : dynamicSecurityWebApp.getSecurityConstraintArray()) {
-                initialWebApp.addNewSecurityConstraint().set(securityConstraint);
+            for (SecurityConstraint securityConstraint : dynamicSecurityWebApp.getSecurityConstraint()) {
+                initialWebApp.getSecurityConstraint().add(securityConstraint);
             }
         }
         if (annotationSecurityWebApp != null) {
-            for (SecurityConstraintType securityConstraint : annotationSecurityWebApp.getSecurityConstraintArray()) {
-                initialWebApp.addNewSecurityConstraint().set(securityConstraint);
+            for (SecurityConstraint securityConstraint : annotationSecurityWebApp.getSecurityConstraint()) {
+                initialWebApp.getSecurityConstraint().add(securityConstraint);
             }
         }
-        collectRoleNames(initialWebApp.getSecurityRoleArray());
+        collectRoleNames(initialWebApp.getSecurityRole());
         try {
-            for (ServletType servletType : initialWebApp.getServletArray()) {
-                processRoleRefPermissions(servletType);
+            for (Servlet Servlet : initialWebApp.getServlet()) {
+                processRoleRefPermissions(Servlet);
             }
             //add the role-ref permissions for unmapped jsps
             addUnmappedJSPPermissions();
-            analyzeSecurityConstraints(initialWebApp.getSecurityConstraintArray());
+            analyzeSecurityConstraints(initialWebApp.getSecurityConstraint());
             removeExcludedDups();
             return buildComponentPermissions();
         } catch (PolicyContextException e) {
@@ -269,11 +227,11 @@ public class SpecSecurityBuilder {
         }
     }
 
-    private void analyzeSecurityConstraints(SecurityConstraintType[] securityConstraintArray) {
-        for (SecurityConstraintType securityConstraintType : securityConstraintArray) {
+    private void analyzeSecurityConstraints(List<SecurityConstraint> securityConstraintArray) {
+        for (SecurityConstraint SecurityConstraint : securityConstraintArray) {
             Map<String, URLPattern> currentPatterns;
-            if (securityConstraintType.isSetAuthConstraint()) {
-                if (securityConstraintType.getAuthConstraint().getRoleNameArray().length == 0) {
+            if (SecurityConstraint.getAuthConstraint() != null) {
+                if (SecurityConstraint.getAuthConstraint().getRoleName().size() == 0) {
                     currentPatterns = excludedPatterns;
                 } else {
                     currentPatterns = rolesPatterns;
@@ -281,33 +239,33 @@ public class SpecSecurityBuilder {
             } else {
                 currentPatterns = uncheckedPatterns;
             }
-            String transport = "";
-            if (securityConstraintType.isSetUserDataConstraint()) {
-                transport = securityConstraintType.getUserDataConstraint().getTransportGuarantee().getStringValue().trim().toUpperCase();
+            org.apache.openejb.jee.TransportGuarantee transport = org.apache.openejb.jee.TransportGuarantee.NONE;
+            if (SecurityConstraint.getUserDataConstraint() != null) {
+                transport = SecurityConstraint.getUserDataConstraint().getTransportGuarantee();
             }
-            WebResourceCollectionType[] webResourceCollectionTypeArray = securityConstraintType.getWebResourceCollectionArray();
-            for (WebResourceCollectionType webResourceCollectionType : webResourceCollectionTypeArray) {
+            List<WebResourceCollection> WebResourceCollectionArray = SecurityConstraint.getWebResourceCollection();
+            for (WebResourceCollection WebResourceCollection : WebResourceCollectionArray) {
                 //Calculate HTTP methods list
                 Set<String> httpMethods = new HashSet<String>();
                 //While using HTTP omission methods and empty methods (which means all methods) as the configurations, isExcluded value is true
                 //While using HTTP methods as the configurations, isExcluded value is false
                 boolean isExcludedList = true;
-                if (webResourceCollectionType.getHttpMethodArray().length > 0) {
+                if (WebResourceCollection.getHttpMethod().size() > 0) {
                     isExcludedList = false;
-                    for (String httpMethod : webResourceCollectionType.getHttpMethodArray()) {
+                    for (String httpMethod : WebResourceCollection.getHttpMethod()) {
                         if (httpMethod != null) {
                             httpMethods.add(httpMethod.trim());
                         }
                     }
-                } else if (webResourceCollectionType.getHttpMethodOmissionArray().length > 0) {
-                    for (String httpMethodOmission : webResourceCollectionType.getHttpMethodOmissionArray()) {
+                } else if (WebResourceCollection.getHttpMethodOmission().size() > 0) {
+                    for (String httpMethodOmission : WebResourceCollection.getHttpMethodOmission()) {
                         if (httpMethodOmission != null) {
                             httpMethods.add(httpMethodOmission.trim());
                         }
                     }
                 }
-                for (UrlPatternType urlPatternType : webResourceCollectionType.getUrlPatternArray()) {
-                    String url = urlPatternType.getStringValue().trim();
+                for (String urlPatternType : WebResourceCollection.getUrlPattern()) {
+                    String url = urlPatternType.trim();
                     URLPattern pattern = currentPatterns.get(url);
                     if (pattern == null) {
                         pattern = new URLPattern(url, httpMethods, isExcludedList);
@@ -324,9 +282,9 @@ public class SpecSecurityBuilder {
                         allPattern.addMethods(httpMethods, isExcludedList);
                     }
                     if (currentPatterns == rolesPatterns) {
-                        RoleNameType[] roleNameTypeArray = securityConstraintType.getAuthConstraint().getRoleNameArray();
-                        for (RoleNameType roleNameType : roleNameTypeArray) {
-                            String role = roleNameType.getStringValue().trim();
+                        List<String> roleNameTypeArray = SecurityConstraint.getAuthConstraint().getRoleName();
+                        for (String roleNameType : roleNameTypeArray) {
+                            String role = roleNameType.trim();
                             if (role.equals("*")) {
                                 pattern.addAllRoles(securityRoles);
                             } else {
@@ -334,7 +292,7 @@ public class SpecSecurityBuilder {
                             }
                         }
                     }
-                    pattern.setTransport(transport);
+                    pattern.setTransport(transport.value());
                 }
             }
         }
@@ -433,14 +391,14 @@ public class SpecSecurityBuilder {
         }
     }
 
-    protected void processRoleRefPermissions(ServletType servletType) throws PolicyContextException {
-        String servletName = servletType.getServletName().getStringValue().trim();
+    protected void processRoleRefPermissions(Servlet Servlet) throws PolicyContextException {
+        String servletName = Servlet.getServletName().trim();
         //WebRoleRefPermissions
-        SecurityRoleRefType[] securityRoleRefTypeArray = servletType.getSecurityRoleRefArray();
+        List<SecurityRoleRef> SecurityRoleRefArray = Servlet.getSecurityRoleRef();
         Set<String> unmappedRoles = new HashSet<String>(securityRoles);
-        for (SecurityRoleRefType securityRoleRefType : securityRoleRefTypeArray) {
-            String roleName = securityRoleRefType.getRoleName().getStringValue().trim();
-            String roleLink = securityRoleRefType.getRoleLink().getStringValue().trim();
+        for (SecurityRoleRef SecurityRoleRef : SecurityRoleRefArray) {
+            String roleName = SecurityRoleRef.getRoleName().trim();
+            String roleLink = SecurityRoleRef.getRoleLink().trim();
             //jacc 3.1.3.2
             /*   The name of the WebRoleRefPermission must be the servlet-name in whose
             * context the security-role-ref is defined. The actions of the  WebRoleRefPermission
@@ -463,9 +421,9 @@ public class SpecSecurityBuilder {
         }
     }
 
-    protected void collectRoleNames(SecurityRoleType[] securityRoles) {
-        for (SecurityRoleType securityRole : securityRoles) {
-            this.securityRoles.add(securityRole.getRoleName().getStringValue().trim());
+    protected void collectRoleNames(List<SecurityRole> securityRoles) {
+        for (SecurityRole securityRole : securityRoles) {
+            this.securityRoles.add(securityRole.getRoleName());
         }
     }
 
@@ -475,16 +433,16 @@ public class SpecSecurityBuilder {
      */
     private void initialize() {
         // Initialize urlPatternsConfiguredInDeploymentPlans map, which contains all the url patterns configured in portable deployment plan
-        for (SecurityConstraintType secuirtyConstrait : initialWebApp.getSecurityConstraintArray()) {
-            for (WebResourceCollectionType webResourceCollection : secuirtyConstrait.getWebResourceCollectionArray()) {
-                for (UrlPatternType urlPattern : webResourceCollection.getUrlPatternArray()) {
-                    urlPatternsConfiguredInDeploymentPlans.add(urlPattern.getStringValue());
+        for (SecurityConstraint secuirtyConstrait : initialWebApp.getSecurityConstraint()) {
+            for (WebResourceCollection webResourceCollection : secuirtyConstrait.getWebResourceCollection()) {
+                for (String urlPattern : webResourceCollection.getUrlPattern()) {
+                    urlPatternsConfiguredInDeploymentPlans.add(urlPattern);
                 }
             }
         }
         //Scan ServletConstraint annotations if required
         if (annotationScanRequired) {
-            annotationSecurityWebApp = WebAppType.Factory.newInstance();
+            annotationSecurityWebApp = new WebApp();
             scanServletConstraintAnnotations();
         }
     }
@@ -492,11 +450,11 @@ public class SpecSecurityBuilder {
     private void scanServletConstraintAnnotations() {
         try {
             Map<String, Set<String>> servletClassNameUrlPatternsMap = genetateServletClassUrlPatternsMap();
-            for (ServletType servlet : initialWebApp.getServletArray()) {
-                if (servlet.getServletClass() == null || servlet.getServletClass().getStringValue().isEmpty()) {
+            for (Servlet servlet : initialWebApp.getServlet()) {
+                if (servlet.getServletClass() == null || servlet.getServletClass().isEmpty()) {
                     continue;
                 }
-                String servletClassName = servlet.getServletClass().getStringValue();
+                String servletClassName = servlet.getServletClass();
                 Class<?> cls = bundle.loadClass(servletClassName);
                 if (!Servlet.class.isAssignableFrom(cls)) {
                     continue;
@@ -540,61 +498,56 @@ public class SpecSecurityBuilder {
      * @param rolesAllowed
      * @param transportGuarantee
      * @param emptyRoleSemantic
+     * @param force
      * @return null when emptyRoleSemantic=PERMIT AND rolesAllowed={} AND transportGuarantee=NONE
      */
-    private SecurityConstraintType addNewSecurityConstraint(WebAppType webApp, String[] rolesAllowed, TransportGuarantee transportGuarantee, ServletSecurity.EmptyRoleSemantic emptyRoleSemantic) {
+    private SecurityConstraint addNewSecurityConstraint(WebApp webApp, String[] rolesAllowed, TransportGuarantee transportGuarantee, ServletSecurity.EmptyRoleSemantic emptyRoleSemantic, boolean force) {
         //IF emptyRoleSemantic=PERMIT AND rolesAllowed={} AND transportGuarantee=NONE then
         //  No Constraint
         //END IF
-        if (rolesAllowed.length > 0 || transportGuarantee.equals(TransportGuarantee.CONFIDENTIAL) || emptyRoleSemantic.equals(ServletSecurity.EmptyRoleSemantic.DENY)) {
-            SecurityConstraintType securityConstraint = webApp.addNewSecurityConstraint();
+        if (force || rolesAllowed.length > 0 || transportGuarantee.equals(TransportGuarantee.CONFIDENTIAL) || emptyRoleSemantic.equals(ServletSecurity.EmptyRoleSemantic.DENY)) {
+            SecurityConstraint securityConstraint = new SecurityConstraint();
+            WebResourceCollection webResourceCollection = new WebResourceCollection();
+            securityConstraint.getWebResourceCollection().add(webResourceCollection);
+            webApp.getSecurityConstraint().add(securityConstraint);
             if (transportGuarantee.equals(TransportGuarantee.CONFIDENTIAL)) {
-                securityConstraint.addNewUserDataConstraint().addNewTransportGuarantee().setStringValue(TransportGuarantee.CONFIDENTIAL.name());
+                UserDataConstraint udc = new UserDataConstraint();
+                udc.setTransportGuarantee(org.apache.openejb.jee.TransportGuarantee.fromValue(TransportGuarantee.CONFIDENTIAL.name()));
+                securityConstraint.setUserDataConstraint(udc);
             }
             if (emptyRoleSemantic.equals(ServletSecurity.EmptyRoleSemantic.DENY)) {
-                securityConstraint.addNewAuthConstraint();
+                securityConstraint.setAuthConstraint(new AuthConstraint());
             } else {
-                AuthConstraintType authConstraint = securityConstraint.addNewAuthConstraint();
+                AuthConstraint authConstraint = new AuthConstraint();
                 for (String roleAllowed : rolesAllowed) {
-                    authConstraint.addNewRoleName().setStringValue(roleAllowed);
+                    authConstraint.getRoleName().add(roleAllowed);
                 }
+                securityConstraint.setAuthConstraint(authConstraint);
             }
             return securityConstraint;
         }
         return null;
     }
 
-    private SecurityConstraintType addNewHTTPSecurityConstraint(WebAppType webApp, String[] rolesAllowed, TransportGuarantee transportGuarantee, ServletSecurity.EmptyRoleSemantic emptyRoleSemantic,
+    private SecurityConstraint addNewHTTPSecurityConstraint(WebApp webApp, String[] rolesAllowed, TransportGuarantee transportGuarantee, ServletSecurity.EmptyRoleSemantic emptyRoleSemantic,
             String[] omissionMethods, Collection<String> urlPatterns) {
-        SecurityConstraintType securityConstraint = addNewSecurityConstraint(webApp, rolesAllowed, transportGuarantee, emptyRoleSemantic);
-        if (omissionMethods.length > 0 || securityConstraint != null) {
-            if (securityConstraint == null) {
-                securityConstraint = webApp.addNewSecurityConstraint();
-            }
-            WebResourceCollectionType webResourceCollection = securityConstraint.getWebResourceCollectionArray().length == 0 ? securityConstraint.addNewWebResourceCollection() : securityConstraint
-                    .getWebResourceCollectionArray(0);
+        SecurityConstraint securityConstraint = addNewSecurityConstraint(webApp, rolesAllowed, transportGuarantee, emptyRoleSemantic, omissionMethods.length > 0);
+        if (securityConstraint != null) {
+            WebResourceCollection webResourceCollection = securityConstraint.getWebResourceCollection().get(0);
             for (String omissionMethod : omissionMethods) {
-                webResourceCollection.addNewHttpMethodOmission().setStringValue(omissionMethod);
-            }
-            for (String urlPattern : urlPatterns) {
-                webResourceCollection.addNewUrlPattern().setStringValue(urlPattern);
+                webResourceCollection.getHttpMethodOmission().add(omissionMethod);
             }
+            webResourceCollection.getUrlPattern().addAll(urlPatterns);
         }
         return securityConstraint;
     }
 
-    private SecurityConstraintType addNewHTTPMethodSecurityConstraint(WebAppType webApp, String[] rolesAllowed, TransportGuarantee transportGuarantee,
+    private SecurityConstraint addNewHTTPMethodSecurityConstraint(WebApp webApp, String[] rolesAllowed, TransportGuarantee transportGuarantee,
             ServletSecurity.EmptyRoleSemantic emptyRoleSemantic, String httpMethod, Collection<String> urlPatterns) {
-        SecurityConstraintType securityConstraint = addNewSecurityConstraint(webApp, rolesAllowed, transportGuarantee, emptyRoleSemantic);
-        if (securityConstraint == null) {
-            securityConstraint = webApp.addNewSecurityConstraint();
-        }
-        WebResourceCollectionType webResourceCollection = securityConstraint.getWebResourceCollectionArray().length == 0 ? securityConstraint.addNewWebResourceCollection() : securityConstraint
-                .getWebResourceCollectionArray(0);
-        for (String urlPattern : urlPatterns) {
-            webResourceCollection.addNewUrlPattern().setStringValue(urlPattern);
-        }
-        webResourceCollection.addNewHttpMethod().setStringValue(httpMethod);
+        SecurityConstraint securityConstraint = addNewSecurityConstraint(webApp, rolesAllowed, transportGuarantee, emptyRoleSemantic, true);
+        WebResourceCollection webResourceCollection = securityConstraint.getWebResourceCollection().get(0);
+        webResourceCollection.getUrlPattern().addAll(urlPatterns);
+        webResourceCollection.getHttpMethod().add(httpMethod);
         return securityConstraint;
     }
 
@@ -605,31 +558,31 @@ public class SpecSecurityBuilder {
      */
     private Map<String, Set<String>> genetateServletClassUrlPatternsMap() {
         Map<String, Set<String>> servletNameUrlPatternsMap = new HashMap<String, Set<String>>();
-        for (ServletMappingType servletMapping : initialWebApp.getServletMappingArray()) {
-            String servletName = servletMapping.getServletName().getStringValue();
+        for (ServletMapping servletMapping : initialWebApp.getServletMapping()) {
+            String servletName = servletMapping.getServletName();
             Set<String> urlPatterns = servletNameUrlPatternsMap.get(servletName);
             if (urlPatterns == null) {
                 urlPatterns = new HashSet<String>();
                 servletNameUrlPatternsMap.put(servletName, urlPatterns);
             }
-            for (UrlPatternType urlPattern : servletMapping.getUrlPatternArray()) {
-                if (!urlPatternsConfiguredInDeploymentPlans.contains(urlPattern.getStringValue())) {
-                    urlPatterns.add(urlPattern.getStringValue());
+            for (String urlPattern : servletMapping.getUrlPattern()) {
+                if (!urlPatternsConfiguredInDeploymentPlans.contains(urlPattern)) {
+                    urlPatterns.add(urlPattern);
                 }
             }
         }
         Map<String, Set<String>> servletClassUrlPatternsMap = new HashMap<String, Set<String>>();
-        for (ServletType servlet : initialWebApp.getServletArray()) {
-            if (servlet.getServletClass() == null || servlet.getServletClass().getStringValue().isEmpty()) {
+        for (Servlet servlet : initialWebApp.getServlet()) {
+            if (servlet.getServletClass() == null || servlet.getServletClass().isEmpty()) {
                 continue;
             }
-            String servletClassName = servlet.getServletClass().getStringValue();
-            Set<String> urlPatterns = servletClassUrlPatternsMap.get(servlet.getServletClass().getStringValue());
+            String servletClassName = servlet.getServletClass();
+            Set<String> urlPatterns = servletClassUrlPatternsMap.get(servlet.getServletClass());
             if (urlPatterns == null) {
                 urlPatterns = new HashSet<String>();
                 servletClassUrlPatternsMap.put(servletClassName, urlPatterns);
             }
-            Set<String> servletMappingUrlPatterns = servletNameUrlPatternsMap.get(servlet.getServletName().getStringValue());
+            Set<String> servletMappingUrlPatterns = servletNameUrlPatternsMap.get(servlet.getServletName());
             if (servletMappingUrlPatterns != null) {
                 urlPatterns.addAll(servletMappingUrlPatterns);
             }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/security/URLPattern.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/security/URLPattern.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/security/URLPattern.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/security/URLPattern.java Thu Jun 24 18:06:24 2010
@@ -99,7 +99,7 @@ public class URLPattern {
      * Add a method to the union of HTTP methods associated with this URL pattern.  An empty Set  is short hand for
      * the set of all HTTP methods.
      *
-     * @param method the HTTP methods to be added to the set.
+     * @param methods the HTTP methods to be added to the set.
      */
     public void addMethods(Set<String> methods, boolean isExcluded) {
         httpMethods.add(methods, isExcluded);

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web/src/test/java/org/apache/geronimo/web/security/SecurityConfigTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web/src/test/java/org/apache/geronimo/web/security/SecurityConfigTest.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web/src/test/java/org/apache/geronimo/web/security/SecurityConfigTest.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web/src/test/java/org/apache/geronimo/web/security/SecurityConfigTest.java Thu Jun 24 18:06:24 2010
@@ -17,13 +17,14 @@
 
 package org.apache.geronimo.web.security;
 
+import java.io.InputStream;
 import java.net.URL;
 
+import javax.xml.bind.JAXBException;
 import org.apache.geronimo.security.jacc.ComponentPermissions;
 import org.apache.geronimo.testsupport.TestSupport;
-import org.apache.geronimo.xbeans.javaee6.WebAppDocument;
-import org.apache.geronimo.xbeans.javaee6.WebAppType;
-import org.apache.xmlbeans.XmlOptions;
+import org.apache.openejb.jee.JaxbJavaee;
+import org.apache.openejb.jee.WebApp;
 
 /**
  * @version $Rev$ $Date$
@@ -32,13 +33,16 @@ public class SecurityConfigTest extends 
 
     private ClassLoader classLoader = this.getClass().getClassLoader();
 
-    private XmlOptions options = new XmlOptions();
 
     public void testNoSecConstraint() throws Exception {
-        URL srcXml = classLoader.getResource("security/web-nosecurity.xml");
-        WebAppDocument webAppDoc = WebAppDocument.Factory.parse(srcXml, options);
-        WebAppType webApp = webAppDoc.getWebApp();
-        SpecSecurityBuilder builder = new SpecSecurityBuilder(webApp);
-        ComponentPermissions componentPermissions = builder.buildSpecSecurityConfig();
+        URL specDDUrl = classLoader.getResource("security/web-nosecurity.xml");
+        InputStream in = specDDUrl.openStream();
+        try {
+            WebApp webApp = (WebApp) JaxbJavaee.unmarshal(WebApp.class, in);
+            SpecSecurityBuilder builder = new SpecSecurityBuilder(webApp);
+            ComponentPermissions componentPermissions = builder.buildSpecSecurityConfig();
+        } finally {
+            in.close();
+        }
     }
 }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web/src/test/java/org/apache/geronimo/web/security/SpecSecurityParsingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web/src/test/java/org/apache/geronimo/web/security/SpecSecurityParsingTest.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web/src/test/java/org/apache/geronimo/web/security/SpecSecurityParsingTest.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web/src/test/java/org/apache/geronimo/web/security/SpecSecurityParsingTest.java Thu Jun 24 18:06:24 2010
@@ -20,6 +20,7 @@
 
 package org.apache.geronimo.web.security;
 
+import java.io.InputStream;
 import java.net.URL;
 import java.security.Permission;
 import java.security.PermissionCollection;
@@ -29,9 +30,8 @@ import javax.security.jacc.WebUserDataPe
 import junit.framework.TestCase;
 
 import org.apache.geronimo.security.jacc.ComponentPermissions;
-import org.apache.geronimo.xbeans.javaee6.WebAppDocument;
-import org.apache.geronimo.xbeans.javaee6.WebAppType;
-import org.apache.xmlbeans.XmlOptions;
+import org.apache.openejb.jee.JaxbJavaee;
+import org.apache.openejb.jee.WebApp;
 
 /**
  * @version $Rev$ $Date$
@@ -39,14 +39,11 @@ import org.apache.xmlbeans.XmlOptions;
 public class SpecSecurityParsingTest extends TestCase {
 
     private ClassLoader classLoader = this.getClass().getClassLoader();
-    private XmlOptions options = new XmlOptions();
 
 
     public void testParsing() throws Exception {
-        URL srcXml = classLoader.getResource("security/web1.xml");
-        WebAppDocument webAppDoc = WebAppDocument.Factory.parse(srcXml, options);
-        WebAppType webAppType = webAppDoc.getWebApp();
-        SpecSecurityBuilder builder = new SpecSecurityBuilder(webAppType);
+        WebApp webApp = parse("security/web1.xml");
+        SpecSecurityBuilder builder = new SpecSecurityBuilder(webApp);
         ComponentPermissions permissions = builder.buildSpecSecurityConfig();
         PermissionCollection unchecked = permissions.getUncheckedPermissions();
         assertTrue(unchecked.implies(new WebResourcePermission("/login.do", "!")));
@@ -62,10 +59,8 @@ public class SpecSecurityParsingTest ext
      * @throws Exception
      */
     public void testAllMethodsConstraint() throws Exception {
-        URL srcXml = classLoader.getResource("security/web2.xml");
-        WebAppDocument webAppDoc = WebAppDocument.Factory.parse(srcXml, options);
-        WebAppType webAppType = webAppDoc.getWebApp();
-        SpecSecurityBuilder builder = new SpecSecurityBuilder(webAppType);
+        WebApp webApp = parse("security/web2.xml");
+        SpecSecurityBuilder builder = new SpecSecurityBuilder(webApp);
         ComponentPermissions permissions = builder.buildSpecSecurityConfig();
         Permission p = new WebResourcePermission("/Test/Foo", "GET,POST");
         assertTrue(implies(p, permissions, "Admin"));
@@ -74,10 +69,8 @@ public class SpecSecurityParsingTest ext
     }
 
     public void testExcludedConstraint() throws Exception {
-        URL srcXml = classLoader.getResource("security/web3.xml");
-        WebAppDocument webAppDoc = WebAppDocument.Factory.parse(srcXml, options);
-        WebAppType webAppType = webAppDoc.getWebApp();
-        SpecSecurityBuilder builder = new SpecSecurityBuilder(webAppType);
+        WebApp webApp = parse("security/web3.xml");
+        SpecSecurityBuilder builder = new SpecSecurityBuilder(webApp);
         ComponentPermissions permissions = builder.buildSpecSecurityConfig();
         Permission p = new WebResourcePermission("/Test/Foo", "GET,POST");
         assertTrue(implies(p, permissions, "Admin"));
@@ -102,10 +95,8 @@ public class SpecSecurityParsingTest ext
         assertFalse(implies(p, permissions, "Peon"));
     }
     public void testExcludedRemovesRoleConstraint() throws Exception {
-        URL srcXml = classLoader.getResource("security/web4.xml");
-        WebAppDocument webAppDoc = WebAppDocument.Factory.parse(srcXml, options);
-        WebAppType webAppType = webAppDoc.getWebApp();
-        SpecSecurityBuilder builder = new SpecSecurityBuilder(webAppType);
+        WebApp webApp = parse("security/web4.xml");
+        SpecSecurityBuilder builder = new SpecSecurityBuilder(webApp);
         ComponentPermissions permissions = builder.buildSpecSecurityConfig();
         // test excluding longer path than allowed
         Permission p = new WebResourcePermission("/Foo/Baz", "GET");
@@ -133,10 +124,8 @@ public class SpecSecurityParsingTest ext
 
     //overlapping excluded and role constraint, excluded constraint wins.
     public void testExcludedAndRoleConstraint() throws Exception {
-        URL srcXml = classLoader.getResource("security/web5.xml");
-        WebAppDocument webAppDoc = WebAppDocument.Factory.parse(srcXml, options);
-        WebAppType webAppType = webAppDoc.getWebApp();
-        SpecSecurityBuilder builder = new SpecSecurityBuilder(webAppType);
+        WebApp webApp = parse("security/web5.xml");
+        SpecSecurityBuilder builder = new SpecSecurityBuilder(webApp);
         ComponentPermissions permissions = builder.buildSpecSecurityConfig();
         // test excluding longer path than allowed
         Permission p = new WebResourcePermission("/foo/Baz", "GET");
@@ -151,10 +140,8 @@ public class SpecSecurityParsingTest ext
     }
 
     public void testHTTPOmissionMethodsConstraint() throws Exception {
-        URL srcXml = classLoader.getResource("security/web6.xml");
-        WebAppDocument webAppDoc = WebAppDocument.Factory.parse(srcXml, options);
-        WebAppType webAppType = webAppDoc.getWebApp();
-        SpecSecurityBuilder builder = new SpecSecurityBuilder(webAppType);
+        WebApp webApp = parse("security/web6.xml");
+        SpecSecurityBuilder builder = new SpecSecurityBuilder(webApp);
         ComponentPermissions permissions = builder.buildSpecSecurityConfig();
         Permission p = new WebResourcePermission("/app/*", "GET");
         assertFalse(implies(p, permissions, null));
@@ -172,4 +159,15 @@ public class SpecSecurityParsingTest ext
         return rolePermissions != null && rolePermissions.implies(p);
     }
 
+    private WebApp parse(String resource) throws Exception {
+        URL specDDUrl = classLoader.getResource(resource);
+        InputStream in = specDDUrl.openStream();
+        try {
+            return (WebApp) JaxbJavaee.unmarshal(WebApp.class, in);
+        } finally {
+            in.close();
+        }
+
+    }
+
 }

Modified: geronimo/server/trunk/plugins/j2ee/j2ee-deployer/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/j2ee-deployer/pom.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/j2ee-deployer/pom.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/j2ee-deployer/pom.xml Thu Jun 24 18:06:24 2010
@@ -65,20 +65,20 @@
             <version>${project.version}</version>
         </dependency>
 
-        <dependency>
-            <groupId>org.apache.geronimo.schema</groupId>
-            <artifactId>geronimo-schema-javaee_6</artifactId>
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>org.apache.geronimo.schema</groupId>-->
+            <!--<artifactId>geronimo-schema-javaee_6</artifactId>-->
+        <!--</dependency>-->
 
-        <dependency>
-          <groupId>org.apache.geronimo.schema</groupId>
-          <artifactId>geronimo-schema-jee_5</artifactId>
-        </dependency>
+        <!--<dependency>-->
+          <!--<groupId>org.apache.geronimo.schema</groupId>-->
+          <!--<artifactId>geronimo-schema-jee_5</artifactId>-->
+        <!--</dependency>-->
 
-        <dependency>
-            <groupId>org.apache.geronimo.schema</groupId>
-            <artifactId>geronimo-schema-j2ee_1.4</artifactId>
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>org.apache.geronimo.schema</groupId>-->
+            <!--<artifactId>geronimo-schema-j2ee_1.4</artifactId>-->
+        <!--</dependency>-->
 
         <!--<dependency>-->
             <!--<groupId>org.apache.geronimo.modules</groupId>-->

Modified: geronimo/server/trunk/plugins/j2ee/j2ee-deployer/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/j2ee-deployer/src/main/history/dependencies.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/j2ee-deployer/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/j2ee-deployer/src/main/history/dependencies.xml Thu Jun 24 18:06:24 2010
@@ -72,6 +72,11 @@
         <type>jar</type>
     </dependency>
     <dependency>
+        <groupId>org.apache.openejb</groupId>
+        <artifactId>openejb-jee</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.xbean</groupId>
         <artifactId>xbean-bundleutils</artifactId>
         <type>jar</type>

Modified: geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml Thu Jun 24 18:06:24 2010
@@ -27,8 +27,33 @@
         <type>jar</type>
     </dependency>
     <dependency>
+        <groupId>org.apache.geronimo.specs</groupId>
+        <artifactId>geronimo-osgi-registry</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.servicemix.bundles</groupId>
         <artifactId>org.apache.servicemix.bundles.howl</artifactId>
         <type>jar</type>
     </dependency>
+    <dependency>
+        <groupId>org.apache.servicemix.bundles</groupId>
+        <artifactId>org.apache.servicemix.bundles.xpp3</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-bundleutils</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-finder</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-reflect</artifactId>
+        <type>jar</type>
+    </dependency>
 </plugin-artifact>

Modified: geronimo/server/trunk/plugins/j2ee/jsr88-ear-configurer/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/jsr88-ear-configurer/src/main/history/dependencies.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/jsr88-ear-configurer/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/jsr88-ear-configurer/src/main/history/dependencies.xml Thu Jun 24 18:06:24 2010
@@ -57,21 +57,6 @@
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.geronimo.schema</groupId>
-        <artifactId>geronimo-schema-j2ee_1.4</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.schema</groupId>
-        <artifactId>geronimo-schema-javaee_6</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.schema</groupId>
-        <artifactId>geronimo-schema-jee_5</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
         <groupId>org.apache.geronimo.specs</groupId>
         <artifactId>geronimo-annotation_1.1_spec</artifactId>
         <type>jar</type>
@@ -122,6 +107,11 @@
         <type>jar</type>
     </dependency>
     <dependency>
+        <groupId>org.apache.openejb</groupId>
+        <artifactId>openejb-jee</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.servicemix.bundles</groupId>
         <artifactId>org.apache.servicemix.bundles.howl</artifactId>
         <type>jar</type>

Modified: geronimo/server/trunk/plugins/j2ee/jsr88-war-configurer/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/jsr88-war-configurer/src/main/history/dependencies.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/jsr88-war-configurer/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/jsr88-war-configurer/src/main/history/dependencies.xml Thu Jun 24 18:06:24 2010
@@ -157,21 +157,6 @@
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.geronimo.schema</groupId>
-        <artifactId>geronimo-schema-j2ee_1.4</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.schema</groupId>
-        <artifactId>geronimo-schema-javaee_6</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.schema</groupId>
-        <artifactId>geronimo-schema-jee_5</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
         <groupId>org.apache.geronimo.specs</groupId>
         <artifactId>geronimo-activation_1.1_spec</artifactId>
         <type>jar</type>
@@ -262,6 +247,11 @@
         <type>jar</type>
     </dependency>
     <dependency>
+        <groupId>org.apache.openejb</groupId>
+        <artifactId>openejb-jee</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.servicemix.bundles</groupId>
         <artifactId>org.apache.servicemix.bundles.cglib</artifactId>
         <type>jar</type>

Modified: geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/pom.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/pom.xml (original)
+++ geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/pom.xml Thu Jun 24 18:06:24 2010
@@ -44,6 +44,10 @@
             <artifactId>geronimo-web-2.5-builder</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.openejb</groupId>
+            <artifactId>openejb-jee</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.geronimo.modules</groupId>

Modified: geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java (original)
+++ geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java Thu Jun 24 18:06:24 2010
@@ -17,7 +17,7 @@
 
 package org.apache.geronimo.jasper.deployment;
 
-import java.io.IOException;
+import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -32,15 +32,12 @@ import java.util.Map;
 import java.util.Set;
 import java.util.jar.JarFile;
 
-import javax.xml.namespace.QName;
-
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.Deployable;
 import org.apache.geronimo.deployment.DeployableBundle;
 import org.apache.geronimo.deployment.DeployableJarFile;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
-import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
@@ -61,17 +58,15 @@ import org.apache.geronimo.kernel.GBeanA
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder;
-import org.apache.geronimo.xbeans.javaee.TagType;
-import org.apache.geronimo.xbeans.javaee.TaglibDocument;
-import org.apache.geronimo.xbeans.javaee.TldTaglibType;
-import org.apache.geronimo.xbeans.javaee6.JspConfigType;
-import org.apache.geronimo.xbeans.javaee6.TaglibType;
-import org.apache.geronimo.xbeans.javaee6.WebAppType;
+import org.apache.openejb.jee.JaxbJavaee;
+import org.apache.openejb.jee.JspConfig;
+import org.apache.openejb.jee.Listener;
+import org.apache.openejb.jee.Tag;
+import org.apache.openejb.jee.Taglib;
+import org.apache.openejb.jee.TldTaglib;
+import org.apache.openejb.jee.WebApp;
 import org.apache.xbean.finder.ClassFinder;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -93,15 +88,6 @@ public class JspModuleBuilderExtension i
 
     private static final Logger log = LoggerFactory.getLogger(JspModuleBuilderExtension.class);
 
-    private static final QName TLIB_VERSION = new QName(SchemaConversionUtils.JAVAEE_NAMESPACE, "tlib-version");
-    private static final QName SHORT_NAME = new QName(SchemaConversionUtils.JAVAEE_NAMESPACE, "short-name");
-    private static final QName TAG_CLASS = new QName(SchemaConversionUtils.JAVAEE_NAMESPACE, "tag-class");
-    private static final QName TEI_CLASS = new QName(SchemaConversionUtils.JAVAEE_NAMESPACE, "tei-class");
-    private static final QName BODY_CONTENT = new QName(SchemaConversionUtils.JAVAEE_NAMESPACE, "body-content");
-
-    private static final String SCHEMA_LOCATION_URL = "http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd";
-    private static final String VERSION = "2.1";
-
     private final Environment defaultEnvironment;
     private final NamingBuilder namingBuilders;
 
@@ -132,7 +118,7 @@ public class JspModuleBuilderExtension i
         EnvironmentBuilder.mergeEnvironments(module.getEnvironment(), defaultEnvironment);
 
         WebModule webModule = (WebModule) module;
-        WebAppType webApp = (WebAppType) webModule.getSpecDD();
+        WebApp webApp = webModule.getSpecDD();
 
         EARContext moduleContext = module.getEarContext();
         Map sharedContext = module.getSharedContext();
@@ -188,7 +174,7 @@ public class JspModuleBuilderExtension i
         }
     }
 
-    protected ClassFinder createJspClassFinder(WebAppType webApp, WebModule webModule, Set<String> listenerNames) throws DeploymentException {
+    protected ClassFinder createJspClassFinder(WebApp webApp, WebModule webModule, Set<String> listenerNames) throws DeploymentException {
         Collection<URL> urls = getTldFiles(webApp, webModule);
         List<Class> classes = getListenerClasses(webApp, webModule, urls, listenerNames);
         return new ClassFinder(classes);
@@ -212,7 +198,7 @@ public class JspModuleBuilderExtension i
      * @return list of the URL(s) for the TLD files
      * @throws DeploymentException if there's a problem finding a tld file
      */
-    private LinkedHashSet<URL> getTldFiles(WebAppType webApp, WebModule webModule) throws DeploymentException {
+    private LinkedHashSet<URL> getTldFiles(WebApp webApp, WebModule webModule) throws DeploymentException {
         if (log.isDebugEnabled()) {
             log.debug("getTldFiles( " + webApp.toString() + "," + webModule.getName() + " ): Entry");
         }
@@ -220,12 +206,12 @@ public class JspModuleBuilderExtension i
         LinkedHashSet<URL> tldURLs = new LinkedHashSet<URL>();
 
         // 1. web.xml <taglib> entries
-        JspConfigType[] jspConfigs = webApp.getJspConfigArray();
-        for (JspConfigType jspConfig : jspConfigs) {
-            TaglibType[] taglibs = jspConfig.getTaglibArray();
-            for (TaglibType taglib : taglibs) {
-                String uri = taglib.getTaglibUri().getStringValue().trim();
-                String location = taglib.getTaglibLocation().getStringValue().trim();
+        List<JspConfig> jspConfigs = webApp.getJspConfig();
+        for (JspConfig jspConfig : jspConfigs) {
+            List<Taglib> taglibs = jspConfig.getTaglib();
+            for (Taglib taglib : taglibs) {
+                String uri = taglib.getTaglibUri().trim();
+                String location = taglib.getTaglibLocation().trim();
                 if (!location.equals("")) {
                     if (location.startsWith("/")) {
                         location = location.substring(1);
@@ -254,7 +240,6 @@ public class JspModuleBuilderExtension i
         return tldURLs;
     }
 
-
     /**
      * scanModule(): Scan the module being deployed for JAR files or TLD files in the WEB-INF
      * directory
@@ -298,7 +283,7 @@ public class JspModuleBuilderExtension i
         return tldURLs;
     }
     
-    private List<Class> getListenerClasses(WebAppType webApp, WebModule webModule, Collection<URL> urls, Set<String> listenerNames) throws DeploymentException {
+    private List<Class> getListenerClasses(WebApp webApp, WebModule webModule, Collection<URL> urls, Set<String> listenerNames) throws DeploymentException {
         if (log.isDebugEnabled()) {
             log.debug("getListenerClasses( " + webApp.toString() + "," + '\n' +
                     webModule.getName() + " ): Entry");
@@ -318,20 +303,22 @@ public class JspModuleBuilderExtension i
         return classes;
     }
 
-
     private void parseTldFile(URL url, Bundle bundle, List<Class> classes, Set<String> listenerNames) throws DeploymentException {
         log.debug("parseTLDFile( " + url.toString() + " ): Entry");
 
         try {
-            XmlObject xml = XmlBeansUtil.parse(url, null);
-            TaglibDocument tld = convertToTaglibSchema(xml);
-            TldTaglibType tl = tld.getTaglib();
+            InputStream in = url.openStream();
+            TldTaglib tl;
+            try {
+                tl = (TldTaglib) JaxbJavaee.unmarshalTaglib(TldTaglib.class, in);
+            } finally {
+                in.close();
+            }
 
             // Get all the listeners from the TLD file
-            org.apache.geronimo.xbeans.javaee.ListenerType[] listeners = tl.getListenerArray();
-            for (org.apache.geronimo.xbeans.javaee.ListenerType listener : listeners) {
-                org.apache.geronimo.xbeans.javaee.FullyQualifiedClassType cls = listener.getListenerClass();
-                String className = cls.getStringValue().trim();
+            List<Listener> listeners = tl.getListener();
+            for (Listener listener : listeners) {
+                String className = listener.getListenerClass();
                 try {
                     Class clas = bundle.loadClass(className);
                     classes.add(clas);
@@ -343,10 +330,9 @@ public class JspModuleBuilderExtension i
             }
 
             // Get all the tags from the TLD file
-            TagType[] tags = tl.getTagArray();
-            for (TagType tag : tags) {
-                org.apache.geronimo.xbeans.javaee.FullyQualifiedClassType cls = tag.getTagClass();
-                String className = cls.getStringValue().trim();
+            List<Tag> tags = tl.getTag();
+            for (Tag tag : tags) {
+                String className = tag.getTagClass();
                 try {
                     Class clas = bundle.loadClass(className);
                     classes.add(clas);
@@ -355,229 +341,13 @@ public class JspModuleBuilderExtension i
                     log.warn("JspModuleBuilderExtension: Could not load tag class: " + className + " mentioned in TLD file at " + url.toString());
                 }
             }
-        }
-        catch (XmlException xmle) {
-            throw new DeploymentException("Could not parse TLD file at " + url.toString(), xmle);
-        }
-        catch (IOException ioe) {
+        } catch (Exception ioe) {
             throw new DeploymentException("Could not find TLD file at " + url.toString(), ioe);
         }
 
         log.debug("parseTLDFile(): Exit");
     }
 
-
-    /**
-     * convertToTaglibSchema(): Convert older TLD files based on the 1.1 and 1.2 DTD or the 2.0 XSD
-     * schemas
-     * <p/>
-     * <p><strong>Note(s):</strong>
-     * <ul>
-     * <li>Those tags from the 1.1 and 1.2 DTD that are no longer valid (e.g., jsp-version) are
-     * removed
-     * <li>Valid  tags from the 1.1 and 1.2 DTD are converted (e.g., tlibversion to
-     * tlib-version)
-     * <li>The <taglib> root and the <tag> root elements are reordered as necessary (i.e.,
-     * description, display-name)
-     * <li>The <rtexprvalue> tag is inserted in the &lt;attribute> tag if necessary since it was
-     * not required to preceed <type> in 2.0 schema. Default value of false is used.
-     * </ul>
-     *
-     * @param xmlObject possibly old-style tag lib document
-     * @return converted TagLibDocument in the new shiny schema
-     * @throws XmlException if something goes horribly wrong
-     */
-    protected static TaglibDocument convertToTaglibSchema(XmlObject xmlObject) throws XmlException {
-        if (log.isDebugEnabled()) {
-            log.debug("convertToTaglibSchema( " + xmlObject.toString() + " ): Entry");
-        }
-
-        XmlCursor cursor = xmlObject.newCursor();
-        XmlCursor moveable = xmlObject.newCursor();
-        try {
-            cursor.toStartDoc();
-            cursor.toFirstChild();
-            if (SchemaConversionUtils.JAVAEE_NAMESPACE.equals(cursor.getName().getNamespaceURI())) {
-                log.debug("Nothing to do");
-            } else if (SchemaConversionUtils.J2EE_NAMESPACE.equals(cursor.getName().getNamespaceURI())) {
-                log.debug("Converting XSD 2.0 to 2.1 schema");
-                SchemaConversionUtils.convertSchemaVersion(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, SCHEMA_LOCATION_URL, VERSION);
-                cursor.toStartDoc();
-                cursor.toChild(SchemaConversionUtils.JAVAEE_NAMESPACE, "taglib");
-                cursor.toFirstChild();
-                do {
-                    String name = cursor.getName().getLocalPart();
-                    if ("tag".equals(name)) {
-                        cursor.push();
-                        cursor.toFirstChild();
-                        SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
-                        do {
-                            name = cursor.getName().getLocalPart();
-                            boolean rtexprvalueFound = false;
-                            boolean typeFound = false;
-                            if ("attribute".equals(name)) {
-                                cursor.push();
-                                cursor.toFirstChild();
-                                do {
-                                    name = cursor.getName().getLocalPart();
-                                    if ("rtexprvalue".equals(name)) {
-                                        rtexprvalueFound = true;
-                                    }
-                                    if ("type".equals(name)) {
-                                        typeFound = true;
-                                    }
-                                } while (cursor.toNextSibling());
-                                cursor.pop();
-                                if (typeFound && !rtexprvalueFound) {
-                                    //--------------------------------------------------------------
-                                    // Handle the case where the <type> tag must now be preceded by
-                                    // the <rtexprvalue> tag in the 2.1 schema. Cases are:
-                                    // 1: Only type found:
-                                    //      We are currently positioned directly after the attribute
-                                    //      tag (via the pop) so just insert the rtexprvalue tag
-                                    //      with the default value. The tags will be properly
-                                    //      ordered below.
-                                    // 2: Both type and rtexprvalue found:
-                                    //      The tags will be properly ordered below with the
-                                    //      convertToAttributeGroup() call, so nothing to do
-                                    // 3: Only rtexprvalue found:
-                                    //      Nothing to do
-                                    // 4: Neither found:
-                                    //      Nothing to do
-                                    //--------------------------------------------------------------
-                                    cursor.push();
-                                    cursor.toFirstChild();
-                                    cursor.insertElementWithText("rtexprvalue", SchemaConversionUtils.JAVAEE_NAMESPACE, "false");
-                                    cursor.pop();
-                                }
-                                cursor.push();
-                                cursor.toFirstChild();
-                                SchemaConversionUtils.convertToTldAttribute(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
-                                cursor.pop();
-                            }
-                        } while (cursor.toNextSibling());
-                        cursor.pop();
-                        // Do this conversion last after the other tags have been converted
-                        SchemaConversionUtils.convertToTldTag(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
-                    }
-                } while (cursor.toNextSibling());
-            } else {
-                log.debug("Converting DTD to 2.1 schema");
-                SchemaConversionUtils.convertToSchema(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, SCHEMA_LOCATION_URL, VERSION);
-                cursor.toStartDoc();
-                cursor.toChild(SchemaConversionUtils.JAVAEE_NAMESPACE, "taglib");
-                cursor.toFirstChild();
-                SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
-                do {
-                    String name = cursor.getName().getLocalPart();
-                    if ("jsp-version".equals(name) ||
-                            "jspversion".equals(name) ||
-                            "info".equals(name)) {
-                        cursor.removeXmlContents();
-                        cursor.removeXml();
-                    }
-                    if ("tlibversion".equals(name)) {
-                        cursor.setName(TLIB_VERSION);
-                    }
-                    if ("tlibversion".equals(name)) {
-                        cursor.setName(TLIB_VERSION);
-                    }
-                    if ("shortname".equals(name)) {
-                        cursor.setName(SHORT_NAME);
-                    }
-                    if ("tag".equals(name)) {
-                        cursor.push();
-                        cursor.toFirstChild();
-                        SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
-                        boolean bodyContentFound = false;
-                        do {
-                            name = cursor.getName().getLocalPart();
-                            if ("tagclass".equals(name)) {
-                                cursor.setName(TAG_CLASS);
-                            }
-                            if ("teiclass".equals(name)) {
-                                cursor.setName(TEI_CLASS);
-                            }
-                            if ("bodycontent".equals(name)) {
-                                cursor.setName(BODY_CONTENT);
-                                bodyContentFound = true;
-                            }
-                            if ("body-content".equals(name)) {
-                                bodyContentFound = true;
-                            }
-                            if ("attribute".equals(name)) {
-                                cursor.push();
-                                cursor.toFirstChild();
-                                SchemaConversionUtils.convertToTldAttribute(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
-                                cursor.pop();
-                            }
-                            if ("variable".equals(name)) {
-                                cursor.push();
-                                cursor.toFirstChild();
-                                SchemaConversionUtils.convertToTldVariable(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
-                                cursor.pop();
-                            }
-                            if ("info".equals(name)) {
-                                cursor.removeXmlContents();
-                                cursor.removeXml();
-                            }
-                        } while (cursor.toNextSibling());
-                        cursor.pop();
-                        if (!bodyContentFound) {
-                            //--------------------------------------------------------------
-                            // Handle the case where the <body-content> tag is missing. We
-                            // are currently positioned directly after the <tag> attribute
-                            // (via the pop) so just insert the <body-content> tag with the
-                            // default value. The tags will be properly ordered below.
-                            //--------------------------------------------------------------
-                            cursor.push();
-                            cursor.toFirstChild();
-                            cursor.insertElementWithText("body-content", SchemaConversionUtils.JAVAEE_NAMESPACE, "scriptless");
-                            cursor.pop();
-                        }
-                        // Do this conversion last after the other tags have been converted
-                        cursor.push();
-                        cursor.toFirstChild();
-                        SchemaConversionUtils.convertToTldTag(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
-                        cursor.pop();
-                    }
-                    if ("validator".equals(name)) {
-                        cursor.push();
-                        cursor.toFirstChild();
-                        SchemaConversionUtils.convertToTldValidator(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
-                        cursor.pop();
-                    }
-                } while (cursor.toNextSibling());
-            }
-        }
-        finally {
-            cursor.dispose();
-            moveable.dispose();
-        }
-        XmlObject result = xmlObject.changeType(TaglibDocument.type);
-        if (result != null) {
-            try {
-                XmlBeansUtil.validateDD(result);
-            } catch (XmlException e) {
-                log.warn("Invalid transformed taglib", e);
-            }
-            if (log.isDebugEnabled()) {
-                log.debug("convertToTaglibSchema( " + result.toString() + " ): Exit 1");
-            }
-            return (TaglibDocument) result;
-        }
-        try {
-            XmlBeansUtil.validateDD(xmlObject);
-        } catch (XmlException e) {
-            log.warn("Invalid transformed taglib", e);
-        }
-        if (log.isDebugEnabled()) {
-            log.debug("convertToTaglibSchema( " + xmlObject.toString() + " ): Exit 2");
-        }
-        return (TaglibDocument) xmlObject;
-    }
-
-
     private URI createURI(String path) throws URISyntaxException {
         path = path.replaceAll(" ", "%20");
         return new URI(path);

Modified: geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java (original)
+++ geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java Thu Jun 24 18:06:24 2010
@@ -145,14 +145,15 @@ public class SchemaConversionTest extend
      * Common logic
      */
     private void parseAndCompare(URL srcXML, URL expectedXML) throws Exception {
-        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
-        xmlObject = JspModuleBuilderExtension.convertToTaglibSchema(xmlObject);
-        XmlObject expected = XmlObject.Factory.parse(expectedXML);
-        List problems = new ArrayList();
-        boolean ok = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences: " + problems, ok);
-        xmlObject = JspModuleBuilderExtension.convertToTaglibSchema(xmlObject);
-        boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences: " + problems, ok2);
+        //TODO move this to openejb-jee.
+//        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
+//        xmlObject = JspModuleBuilderExtension.convertToTaglibSchema(xmlObject);
+//        XmlObject expected = XmlObject.Factory.parse(expectedXML);
+//        List problems = new ArrayList();
+//        boolean ok = compareXmlObjects(xmlObject, expected, problems);
+//        assertTrue("Differences: " + problems, ok);
+//        xmlObject = JspModuleBuilderExtension.convertToTaglibSchema(xmlObject);
+//        boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
+//        assertTrue("Differences: " + problems, ok2);
     }
 }

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/pom.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/pom.xml (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/pom.xml Thu Jun 24 18:06:24 2010
@@ -45,6 +45,10 @@
             <artifactId>geronimo-naming-builder</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.openejb</groupId>
+            <artifactId>openejb-jee</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java Thu Jun 24 18:06:24 2010
@@ -27,12 +27,12 @@ import org.apache.geronimo.j2ee.deployme
 import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.jaxws.JAXWSUtils;
 import org.apache.geronimo.jaxws.PortInfo;
-import org.apache.geronimo.xbeans.javaee6.ServletMappingType;
-import org.apache.geronimo.xbeans.javaee6.ServletType;
-import org.apache.geronimo.xbeans.javaee6.WebAppType;
+import org.apache.openejb.jee.Servlet;
+import org.apache.openejb.jee.ServletMapping;
+import org.apache.openejb.jee.WebApp;
+import org.osgi.framework.Bundle;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.osgi.framework.Bundle;
 
 public class AdvancedWARWebServiceFinder implements WebServiceFinder {
 
@@ -52,14 +52,14 @@ public class AdvancedWARWebServiceFinder
                                          Map<String, PortInfo> map)
         throws DeploymentException {
         Bundle bundle = module.getEarContext().getDeploymentBundle();
-        WebAppType webApp = (WebAppType) module.getSpecDD();
+        WebApp webApp = (WebApp) module.getSpecDD();
 
-        if (webApp.isSetMetadataComplete()) {
+        if (webApp.isMetadataComplete()) {
             // full web.xml, just examine all servlet entries for web services
 
-            ServletType[] servletTypes = webApp.getServletArray();
-            for (ServletType servletType : servletTypes) {
-                String servletName = servletType.getServletName().getStringValue().trim();
+            List<Servlet> servletTypes = webApp.getServlet();
+            for (Servlet servletType : servletTypes) {
+                String servletName = servletType.getServletName().trim();
                 PortInfo portInfo = getPortInfo(servletType, bundle, portLocations);
                 if (portInfo != null) {
                     LOG.debug("Found POJO Web Service: {}", servletName);
@@ -87,17 +87,19 @@ public class AdvancedWARWebServiceFinder
 
                     LOG.debug("POJO Web Service class {} is not mapped to any servlet", service.getName());
 
-                    ServletType servlet = webApp.addNewServlet();
-                    servlet.addNewServletName().setStringValue(service.getName());
-                    servlet.addNewServletClass().setStringValue(service.getName());
+                    Servlet servlet = new Servlet();
+                    servlet.setServletName(service.getName());
+                    servlet.setServletClass(service.getName());
+                    webApp.getServlet().add(servlet);
 
                     String location = (String)portLocations.get(service.getName());
                     if (location == null) {
                         // add new <servlet-mapping/> element
                         location = "/" + JAXWSUtils.getServiceName(service);
-                        ServletMappingType servletMapping = webApp.addNewServletMapping();
-                        servletMapping.addNewServletName().setStringValue(service.getName());
-                        servletMapping.addNewUrlPattern().setStringValue(location);
+                        ServletMapping servletMapping = new ServletMapping();
+                        servletMapping.setServletName(service.getName());
+                        servletMapping.getUrlPattern().add(location);
+                        webApp.getServletMapping().add(servletMapping);
                     } else {
                         // weird, there was no servlet entry for this class but
                         // servlet-mapping exists
@@ -119,9 +121,9 @@ public class AdvancedWARWebServiceFinder
             }
 
             // double check servlets in case we missed something
-            ServletType[] servletTypes = webApp.getServletArray();
-            for (ServletType servletType : servletTypes) {
-                String servletName = servletType.getServletName().getStringValue().trim();
+            List<Servlet> servletTypes = webApp.getServlet();
+            for (Servlet servletType : servletTypes) {
+                String servletName = servletType.getServletName().trim();
                 if (map.get(servletName) == null) {
                     PortInfo portInfo = getPortInfo(servletType, bundle, portLocations);
                     if (portInfo != null) {
@@ -133,16 +135,16 @@ public class AdvancedWARWebServiceFinder
         }
     }
 
-    private PortInfo getPortInfo(ServletType servletType,
+    private PortInfo getPortInfo(Servlet servletType,
                                  Bundle bundle,
                                  Map portLocations) throws DeploymentException {
         PortInfo portInfo = null;
-        if (servletType.isSetServletClass()) {
-            String servletClassName = servletType.getServletClass().getStringValue().trim();
+        if (servletType.getServletClass() != null) {
+            String servletClassName = servletType.getServletClass().trim();
             try {
                 Class servletClass = bundle.loadClass(servletClassName);
                 if (JAXWSUtils.isWebService(servletClass)) {
-                    String servletName = servletType.getServletName().getStringValue().trim();
+                    String servletName = servletType.getServletName().trim();
                     portInfo = createPortInfo(servletName, portLocations);
                 }
             } catch (ClassNotFoundException e) {
@@ -165,15 +167,15 @@ public class AdvancedWARWebServiceFinder
     /*
      * Create servlet-class to servlet-names mapping
      */
-    private Map<String, List<String>> createClassServetMap(WebAppType webApp) {
+    private Map<String, List<String>> createClassServetMap(WebApp webApp) {
         Map<String, List<String>> map = new HashMap<String, List<String>>();
 
-        ServletType[] servletTypes = webApp.getServletArray();
+        List<Servlet> servletTypes = webApp.getServlet();
         if (servletTypes != null) {
-            for (ServletType servletType : servletTypes) {
-                String servletName = servletType.getServletName().getStringValue().trim();
-                if (servletType.isSetServletClass()) {
-                    String servletClassName = servletType.getServletClass().getStringValue().trim();
+            for (Servlet servletType : servletTypes) {
+                String servletName = servletType.getServletName().trim();
+                if (servletType.getServletClass() != null) {
+                    String servletClassName = servletType.getServletClass().trim();
                     List<String> servlets = map.get(servletClassName);
                     if (servlets == null) {
                         servlets = new ArrayList<String>();

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/EndpointInfoBuilder.java Thu Jun 24 18:06:24 2010
@@ -26,7 +26,6 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 
 import javax.wsdl.Binding;
 import javax.wsdl.Definition;
@@ -41,7 +40,6 @@ import javax.wsdl.xml.WSDLLocator;
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceClient;
-
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.jaxws.JAXWSUtils;
@@ -51,13 +49,11 @@ import org.apache.geronimo.jaxws.wsdl.Ca
 import org.apache.geronimo.xbeans.geronimo.naming.GerPortPropertyType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerPortType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefType;
-import org.apache.geronimo.xbeans.javaee6.PortComponentRefType;
+import org.apache.openejb.jee.PortComponentRef;
 import org.apache.xml.resolver.Catalog;
 import org.apache.xml.resolver.CatalogManager;
 import org.apache.xml.resolver.tools.CatalogResolver;
-
 import org.osgi.framework.Bundle;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -79,11 +75,11 @@ public class EndpointInfoBuilder {
 
     private Map<Object, EndpointInfo> portInfoMap = new HashMap<Object, EndpointInfo>();
 
-    private Map<Class, PortComponentRefType> portComponentRefMap;
+    private Map<Class, PortComponentRef> portComponentRefMap;
 
     public EndpointInfoBuilder(Class serviceClass,
                                GerServiceRefType serviceRefType,
-                               Map<Class, PortComponentRefType> portComponentRefMap,
+                               Map<Class, PortComponentRef> portComponentRefMap,
                                Module module,
                                Bundle bundle,
                                URI wsdlURI,
@@ -356,14 +352,14 @@ public class EndpointInfoBuilder {
 
     private boolean isMTOMEnabled(QName portType) {
         boolean mtomEnabled = false;
-        PortComponentRefType portRef = getPortComponentRef(portType);
-        if (portRef != null && portRef.isSetEnableMtom()) {
-            mtomEnabled = portRef.getEnableMtom().getBooleanValue();
+        PortComponentRef portRef = getPortComponentRef(portType);
+        if (portRef != null) {
+            mtomEnabled = portRef.isEnableMtom();
         }
         return mtomEnabled;
     }
 
-    private PortComponentRefType getPortComponentRef(QName portType) {
+    private PortComponentRef getPortComponentRef(QName portType) {
         if (this.portComponentRefMap == null) {
             return null;
         }
@@ -381,14 +377,14 @@ public class EndpointInfoBuilder {
 
     private boolean isMTOMEnabled(String portName) {
         boolean mtomEnabled = false;
-        PortComponentRefType portRef = getPortComponentRef(portName);
-        if (portRef != null && portRef.isSetEnableMtom()) {
-            mtomEnabled = portRef.getEnableMtom().getBooleanValue();
+        PortComponentRef portRef = getPortComponentRef(portName);
+        if (portRef != null) {
+            mtomEnabled = portRef.isEnableMtom();
         }
         return mtomEnabled;
     }
 
-    private PortComponentRefType getPortComponentRef(String portName) {
+    private PortComponentRef getPortComponentRef(String portName) {
         if (this.portComponentRefMap == null) {
             return null;
         }



Mime
View raw message