axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prad...@apache.org
Subject svn commit: r636754 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws: framework/JAXWSDeployer.java server/EndpointController.java
Date Thu, 13 Mar 2008 13:15:32 GMT
Author: pradine
Date: Thu Mar 13 06:15:30 2008
New Revision: 636754

URL: http://svn.apache.org/viewvc?rev=636754&view=rev
Log:
Some work on AXIS2-3576.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java?rev=636754&r1=636753&r2=636754&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
Thu Mar 13 06:15:30 2008
@@ -30,9 +30,15 @@
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.Parameter;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.addressing.util.EndpointContextMap;
+import org.apache.axis2.jaxws.addressing.util.EndpointContextMapManager;
+import org.apache.axis2.jaxws.addressing.util.EndpointKey;
 import org.apache.axis2.jaxws.description.DescriptionFactory;
+import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.server.JAXWSMessageReceiver;
 import org.apache.axis2.util.Loader;
 import org.apache.commons.io.FileUtils;
@@ -40,6 +46,7 @@
 import org.apache.commons.logging.LogFactory;
 
 import javax.jws.WebService;
+import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceProvider;
 import java.io.File;
 import java.io.FileInputStream;
@@ -64,8 +71,8 @@
 
     private static Log log = LogFactory.getLog(JAXWSDeployer.class);
 
-    protected ConfigurationContext configCtx = null;
-    protected AxisConfiguration axisConfig = null;
+    protected ConfigurationContext configCtx;
+    protected AxisConfiguration axisConfig;
 
     //To initialize the deployer
     public void init(ConfigurationContext configCtx) {
@@ -172,7 +179,7 @@
     protected AxisServiceGroup deployClasses(String groupName, URL location, ClassLoader
classLoader, List classList)
             throws ClassNotFoundException, InstantiationException, IllegalAccessException,
AxisFault {
         ArrayList axisServiceList = new ArrayList();
-        for (int i = 0; i < classList.size(); i++) {
+        for (int i = 0, size = classList.size(); i < size; i++) {
             String className = (String) classList.get(i);
             Class pojoClass = Loader.loadClass(classLoader, className);
             WebService wsAnnotation = (WebService) pojoClass.getAnnotation(WebService.class);
@@ -197,17 +204,18 @@
                 }
             }
         }
-        int count = axisServiceList.size();
-        if (count <= 0) {
+        int size = axisServiceList.size();
+        if (size <= 0) {
             return null;
         }
         AxisServiceGroup serviceGroup = new AxisServiceGroup();
         serviceGroup.setServiceGroupName(groupName);
-        for (int i = 0; i < axisServiceList.size(); i++) {
+        for (int i = 0; i < size; i++) {
             AxisService axisService = (AxisService) axisServiceList.get(i);
             serviceGroup.addService(axisService);
         }
         axisConfig.addServiceGroup(serviceGroup);
+        configureAddressing(serviceGroup);
         return serviceGroup;
     }
 
@@ -275,10 +283,10 @@
                     axisOperation.setMessageReceiver(new JAXWSMessageReceiver());
                 }
             }
+            axisService.setElementFormDefault(false);
+            axisService.setFileName(serviceLocation);
+            axisService.setClassLoader(classLoader);
         }
-        axisService.setElementFormDefault(false);
-        axisService.setFileName(serviceLocation);
-        axisService.setClassLoader(classLoader);
         return axisService;
     }
 
@@ -327,6 +335,31 @@
 
     private boolean isEmpty(String string) {
         return (string == null || "".equals(string));
+    }
+    
+    //Store the address URIs that we will need to create endpoint references at runtime.
+    private void configureAddressing(AxisServiceGroup serviceGroup) throws AxisFault {
+        EndpointContextMap map =
+            (EndpointContextMap) configCtx.getProperty(org.apache.axis2.jaxws.Constants.ENDPOINT_CONTEXT_MAP);
+        
+        if (map == null) {
+            map = EndpointContextMapManager.getEndpointContextMap();
+            configCtx.setProperty(org.apache.axis2.jaxws.Constants.ENDPOINT_CONTEXT_MAP,
map);
+        }
+        
+        Iterator iterator = serviceGroup.getServices();
+        
+        while (iterator.hasNext()) {
+            AxisService axisService = (AxisService) iterator.next();
+            Parameter param =
+                axisService.getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER);
+            EndpointDescription ed = (EndpointDescription) param.getValue();
+            QName serviceName = ed.getServiceQName();
+            QName portName = ed.getPortQName();
+            EndpointKey key = new EndpointKey(serviceName, portName);
+            
+            map.put(key, axisService.getEPRs()[0]);
+        }
     }
 }
 

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java?rev=636754&r1=636753&r2=636754&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java
Thu Mar 13 06:15:30 2008
@@ -211,7 +211,7 @@
             MessageContext request = eic.getRequestMessageContext();
             
             Class serviceEndpoint = getServiceImplementation(request);
-            EndpointDescription endpointDesc = getEndpointDescription(request, serviceEndpoint);
+            EndpointDescription endpointDesc = getEndpointDescription(request);
             request.setEndpointDescription(endpointDesc);
             
             //  TODO: review: make sure the handlers are set on the InvocationContext
@@ -421,30 +421,21 @@
     }
 
     /*
-    * Gets the ServiceDescription associated with the request that is currently
+    * Gets the EndpointDescription associated with the request that is currently
     * being processed.
     */
-    private EndpointDescription getEndpointDescription(MessageContext mc, Class implClass)
{
+    private EndpointDescription getEndpointDescription(MessageContext mc) {
         AxisService axisSvc = mc.getAxisMessageContext().getAxisService();
-
-        //Make sure that a ServiceDescription was created and added to the AxisService
-
         Parameter param = axisSvc.getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER);
-        if (param != null) {
-            EndpointDescription ed = (EndpointDescription)param.getValue();
-            param = axisSvc.getParameter(EndpointContextMap.class.getCanonicalName());
-            if(param != null) {
-                EndpointContextMap map = (EndpointContextMap) param.getValue();
-                EndpointContextMapManager.setEndpointContextMap(map);
-            }
-            
-            return ed;
-        } else {
+        
+        if (param == null) {
         	// If we've made it here, its very likely that although the AxisService was deployed,
the 
         	// associated ServiceDescription was not created successfully
             throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescErr1"));
-
         }
+        
+        EndpointDescription ed = (EndpointDescription) param.getValue();
+        return ed;
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message