geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r505359 - /geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/SwitchingServiceRefBuilder.java
Date Fri, 09 Feb 2007 16:41:36 GMT
Author: dims
Date: Fri Feb  9 08:41:35 2007
New Revision: 505359

URL: http://svn.apache.org/viewvc?view=rev&rev=505359
Log:
Fix for GERONIMO-2813 - SwitchingServiceRefBuilder environment fix

Modified:
    geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/SwitchingServiceRefBuilder.java

Modified: geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/SwitchingServiceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/SwitchingServiceRefBuilder.java?view=diff&rev=505359&r1=505358&r2=505359
==============================================================================
--- geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/SwitchingServiceRefBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/SwitchingServiceRefBuilder.java
Fri Feb  9 08:41:35 2007
@@ -53,8 +53,6 @@
 
     private final Collection jaxwsBuilders;
 
-    private Environment environment;
-
     public SwitchingServiceRefBuilder(String[] eeNamespaces,
                                       Collection jaxrpcBuilders,
                                       Collection jaxwsBuilders) {
@@ -68,7 +66,41 @@
                                  XmlObject plan,
                                  Environment environment)
             throws DeploymentException {
-        this.environment = environment;
+        // Since we don't have a classloader at this point do simple string-based
+        // check for Service classes, and if it does not match either merge
+        // both environments
+        
+        boolean mergedJAXRPCEnv = false;
+        boolean mergedJAXWSEnv = false;
+        
+        XmlObject[] serviceRefs = specDD.selectChildren(serviceRefQNameSet);
+        for (XmlObject serviceRef : serviceRefs) {
+            ServiceRefType serviceRefType = 
+                (ServiceRefType) convert(serviceRef, JEE_CONVERTER, ServiceRefType.type);
+            String serviceInterfaceName = getStringValue(serviceRefType.getServiceInterface());
+            if ("javax.xml.rpc.Service".equals(serviceInterfaceName)) {
+                if (!mergedJAXRPCEnv) {
+                    mergeEnvironment(environment, getJAXRCPBuilder());
+                    mergedJAXRPCEnv = true;
+                }
+            } else if ("javax.xml.ws.Service".equals(serviceInterfaceName)) {
+                if (!mergedJAXWSEnv) {
+                    mergeEnvironment(environment, getJAXWSBuilder());
+                    mergedJAXWSEnv = true;
+                }
+            } else {
+                // does not match either Service class, merge both environments
+                if (!mergedJAXRPCEnv) {
+                    mergeEnvironment(environment, getJAXRCPBuilder());
+                    mergedJAXRPCEnv = true;
+                }
+                if (!mergedJAXWSEnv) {
+                    mergeEnvironment(environment, getJAXWSBuilder());
+                    mergedJAXWSEnv = true;
+                }
+                break;
+            }                    
+        }        
     }
 
     public void buildNaming(XmlObject specDD,
@@ -81,9 +113,6 @@
         Class jaxrpcClass = loadClass("javax.xml.rpc.Service", cl);
         Class jaxwsClass = loadClass("javax.xml.ws.Service", cl);
 
-        boolean mergedJAXRPCEnv = false;
-        boolean mergedJAXWSEnv = false;
-
         XmlObject[] serviceRefs = specDD.selectChildren(serviceRefQNameSet);
 
         XmlObject[] gerServiceRefsUntyped = plan == null ? NO_REFS : plan
@@ -107,19 +136,11 @@
                 ServiceRefBuilder jaxrpcBuilder = getJAXRCPBuilder();
                 jaxrpcBuilder.buildNaming(serviceRef, gerServiceRefType,
                         module, componentContext);
-                if (!mergedJAXRPCEnv) {
-                    mergeEnvironment(jaxrpcBuilder);
-                    mergedJAXRPCEnv = true;
-                }
             } else if (jaxwsClass.isAssignableFrom(serviceInterfaceClass)) {
                 // calll jaxws handler
                 ServiceRefBuilder jaxwsBuilder = getJAXWSBuilder();
                 jaxwsBuilder.buildNaming(serviceRef, gerServiceRefType, module,
                         componentContext);
-                if (!mergedJAXWSEnv) {
-                    mergeEnvironment(jaxwsBuilder);
-                    mergedJAXWSEnv = true;
-                }
             } else {
                 throw new DeploymentException(serviceInterfaceName
                                               + " does not extend "
@@ -153,10 +174,10 @@
         return jaxrpcBuilder;
     }
 
-    private void mergeEnvironment(ServiceRefBuilder builder) {
+    private void mergeEnvironment(Environment environment, ServiceRefBuilder builder) {
         Environment env = builder.getEnvironment();
         if (env != null) {
-            EnvironmentBuilder.mergeEnvironments(this.environment, env);
+            EnvironmentBuilder.mergeEnvironments(environment, env);
         }
     }
 



Mime
View raw message