You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ng...@apache.org on 2007/03/26 23:41:48 UTC

svn commit: r522637 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws: client/ client/async/ client/dispatch/ client/proxy/ spi/ spi/migrator/

Author: ngallardo
Date: Mon Mar 26 14:41:47 2007
New Revision: 522637

URL: http://svn.apache.org/viewvc?view=rev&rev=522637
Log:
AXIS2-2317

Implementation of plug-point for application context migrating.

Added:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/PropertyMigrator.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigrator.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigratorUtil.java
Removed:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ContextPropertyMigrator.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ContextPropertyMigratorUtil.java
Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/ClientUtils.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatch.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatchAsyncListener.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatch.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatchAsyncListener.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/ProxyAsyncListener.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Constants.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/ClientUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/ClientUtils.java?view=diff&rev=522637&r1=522636&r2=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/ClientUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/ClientUtils.java Mon Mar 26 14:41:47 2007
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.axis2.jaxws.client;
 
 import org.apache.axis2.jaxws.BindingProvider;

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/PropertyMigrator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/PropertyMigrator.java?view=auto&rev=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/PropertyMigrator.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/PropertyMigrator.java Mon Mar 26 14:41:47 2007
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.client;
+
+import java.util.Map;
+
+import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.spi.migrator.ApplicationContextMigrator;
+
+/**
+ * The PropertyMigrator implements the ApplicationContextMigrator in order to
+ * perform the necessary manipulations of properties during a request or 
+ * response flow.  
+ */
+public class PropertyMigrator implements ApplicationContextMigrator {
+
+    public void migratePropertiesFromMessageContext(Map<String, Object> userContext, MessageContext messageContext) {
+        
+    }
+
+    public void migratePropertiesToMessageContext(Map<String, Object> userContext, MessageContext messageContext) {
+        // Copy all of the properties from the request context into the MessageContext
+        messageContext.getProperties().putAll(userContext);
+    }
+
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java?view=diff&rev=522637&r1=522636&r2=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java Mon Mar 26 14:41:47 2007
@@ -30,6 +30,9 @@
 
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.ServiceDescription;
+import org.apache.axis2.jaxws.spi.Constants;
+import org.apache.axis2.jaxws.spi.migrator.ApplicationContextMigratorUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -51,13 +54,15 @@
     private MessageContext faultMessageContext;    
     private MessageContext response;
     
+    private ServiceDescription serviceDescription;
     private Map<String, Object> responseContext;
     
     private CountDownLatch latch;
     private boolean cacheValid = false;
     private Object cachedObject = null;
     
-    protected AsyncResponse() {
+    protected AsyncResponse(ServiceDescription sd) {
+        serviceDescription = sd;
         latch = new CountDownLatch(1);
     }
     
@@ -68,6 +73,7 @@
 
         fault = flt;
         faultMessageContext = faultCtx;
+        faultMessageContext.setServiceDescription(serviceDescription);
         
         // Probably a good idea to invalidate the cache
         cacheValid = false;
@@ -92,6 +98,7 @@
         }
         
         response = mc;
+        response.setServiceDescription(serviceDescription);
         latch.countDown();
         
         if (log.isDebugEnabled()) {
@@ -167,10 +174,6 @@
         return responseContext;
     }
     
-    private void initResponseContext() {
-        responseContext = new HashMap<String, Object>();
-    }
-    
     private Object processResponse() throws ExecutionException {
         // If the fault object is not null, then we've received a fault message and 
         // we need to process it in one of a number of forms.
@@ -220,7 +223,13 @@
             log.debug("Unmarshalled response object of type: " + obj.getClass());
         }
         
-        initResponseContext();
+        responseContext = new HashMap<String, Object>();
+        
+        // Migrate the properties from the response MessageContext back
+        // to the client response context bag.
+        ApplicationContextMigratorUtil.performMigrationFromMessageContext(
+                Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID, 
+                responseContext, response);
         
         return obj;
     }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java?view=diff&rev=522637&r1=522636&r2=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java Mon Mar 26 14:41:47 2007
@@ -44,7 +44,9 @@
 import org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils;
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.axis2.jaxws.message.XMLFault;
+import org.apache.axis2.jaxws.spi.Constants;
 import org.apache.axis2.jaxws.spi.ServiceDelegate;
+import org.apache.axis2.jaxws.spi.migrator.ApplicationContextMigratorUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -104,6 +106,7 @@
             // Create the MessageContext to hold the actual request message and its
             // associated properties
             MessageContext requestMsgCtx = new MessageContext();
+            requestMsgCtx.setServiceDescription(getEndpointDescription().getServiceDescription());
             invocationContext.setRequestMessageContext(requestMsgCtx);
             
             Message requestMsg = null;
@@ -117,13 +120,23 @@
             setupMessageProperties(requestMsg);
             requestMsgCtx.setMessage(requestMsg);            
             
-            // Copy the properties from the request context into the MessageContext
-            requestMsgCtx.getProperties().putAll(requestContext);
+            // Migrate the properties from the client request context bag to
+            // the request MessageContext.
+            ApplicationContextMigratorUtil.performMigrationToMessageContext(
+                    Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID, 
+                    getRequestContext(), requestMsgCtx);
             
             // Send the request using the InvocationController
             ic.invoke(invocationContext);
             
             MessageContext responseMsgCtx = invocationContext.getResponseMessageContext();
+            responseMsgCtx.setServiceDescription(requestMsgCtx.getServiceDescription());
+            
+            // Migrate the properties from the response MessageContext back
+            // to the client response context bag.
+            ApplicationContextMigratorUtil.performMigrationFromMessageContext(
+                    Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID, 
+                    getResponseContext(), responseMsgCtx);
             
             if (hasFaultResponse(responseMsgCtx)) {
                 WebServiceException wse = BaseDispatch.getFaultResponse(responseMsgCtx);
@@ -167,6 +180,7 @@
             // Create the MessageContext to hold the actual request message and its
             // associated properties
             MessageContext requestMsgCtx = new MessageContext();
+            requestMsgCtx.setServiceDescription(getEndpointDescription().getServiceDescription());
             invocationContext.setRequestMessageContext(requestMsgCtx);
             
             Message requestMsg = null;
@@ -180,8 +194,11 @@
             setupMessageProperties(requestMsg);
             requestMsgCtx.setMessage(requestMsg);
             
-            // Copy the properties from the request context into the MessageContext
-            requestMsgCtx.getProperties().putAll(requestContext);
+            // Migrate the properties from the client request context bag to
+            // the request MessageContext.
+            ApplicationContextMigratorUtil.performMigrationToMessageContext(
+                    Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID, 
+                    getRequestContext(), requestMsgCtx);
             
             // Send the request using the InvocationController
             ic.invokeOneWay(invocationContext);
@@ -220,6 +237,7 @@
             // Create the MessageContext to hold the actual request message and its
             // associated properties
             MessageContext requestMsgCtx = new MessageContext();
+            requestMsgCtx.setServiceDescription(getEndpointDescription().getServiceDescription());
             invocationContext.setRequestMessageContext(requestMsgCtx);
             
             Message requestMsg = null;
@@ -233,8 +251,11 @@
             setupMessageProperties(requestMsg);
             requestMsgCtx.setMessage(requestMsg);
             
-            // Copy the properties from the request context into the MessageContext
-            requestMsgCtx.getProperties().putAll(requestContext);
+            // Migrate the properties from the client request context bag to
+            // the request MessageContext.
+            ApplicationContextMigratorUtil.performMigrationToMessageContext(
+                    Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID, 
+                    getRequestContext(), requestMsgCtx);
             
             // Setup the Executor that will be used to drive async responses back to 
             // the client.
@@ -284,6 +305,7 @@
             // Create the MessageContext to hold the actual request message and its
             // associated properties
             MessageContext requestMsgCtx = new MessageContext();
+            requestMsgCtx.setServiceDescription(getEndpointDescription().getServiceDescription());
             invocationContext.setRequestMessageContext(requestMsgCtx);
             
             Message requestMsg = null;
@@ -296,9 +318,12 @@
             
             setupMessageProperties(requestMsg);
             requestMsgCtx.setMessage(requestMsg);
-            
-            // Copy the properties from the request context into the MessageContext
-            requestMsgCtx.getProperties().putAll(requestContext);
+
+            // Migrate the properties from the client request context bag to
+            // the request MessageContext.
+            ApplicationContextMigratorUtil.performMigrationToMessageContext(
+                    Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID, 
+                    getRequestContext(), requestMsgCtx);
             
             // Setup the Executor that will be used to drive async responses back to 
             // the client.

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatch.java?view=diff&rev=522637&r1=522636&r2=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatch.java Mon Mar 26 14:41:47 2007
@@ -23,6 +23,7 @@
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.client.async.AsyncResponse;
 import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.message.Block;
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.axis2.jaxws.message.Protocol;
@@ -53,7 +54,8 @@
     }
     
     public AsyncResponse createAsyncResponseListener() {
-        JAXBDispatchAsyncListener listener = new JAXBDispatchAsyncListener();
+        ServiceDescription sd = getEndpointDescription().getServiceDescription();
+        JAXBDispatchAsyncListener listener = new JAXBDispatchAsyncListener(sd);
         listener.setJAXBContext(jaxbContext);
         listener.setMode(mode);
         return listener;

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatchAsyncListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatchAsyncListener.java?view=diff&rev=522637&r1=522636&r2=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatchAsyncListener.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/JAXBDispatchAsyncListener.java Mon Mar 26 14:41:47 2007
@@ -22,6 +22,7 @@
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.client.async.AsyncResponse;
 import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.message.Block;
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.axis2.jaxws.message.databinding.JAXBBlockContext;
@@ -38,8 +39,8 @@
     private Mode mode;
     private JAXBContext jaxbContext;
     
-    public JAXBDispatchAsyncListener() {
-        super();
+    public JAXBDispatchAsyncListener(ServiceDescription sd) {
+        super(sd);
     }
     
     public void setMode(Mode m) {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatch.java?view=diff&rev=522637&r1=522636&r2=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatch.java Mon Mar 26 14:41:47 2007
@@ -26,6 +26,7 @@
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.client.async.AsyncResponse;
 import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.message.Block;
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.axis2.jaxws.message.Protocol;
@@ -60,7 +61,9 @@
         if (log.isDebugEnabled()) {
             log.debug("Creating new AsyncListener for XMLDispatch");
         }
-        XMLDispatchAsyncListener al = new XMLDispatchAsyncListener();
+        
+        ServiceDescription sd = getEndpointDescription().getServiceDescription();
+        XMLDispatchAsyncListener al = new XMLDispatchAsyncListener(sd);
         al.setMode(mode);
         al.setType(type);
         al.setBlockFactoryType(blockFactoryType);

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatchAsyncListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatchAsyncListener.java?view=diff&rev=522637&r1=522636&r2=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatchAsyncListener.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/XMLDispatchAsyncListener.java Mon Mar 26 14:41:47 2007
@@ -8,6 +8,7 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.jaxws.client.async.AsyncResponse;
 import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.message.Block;
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.axis2.jaxws.message.factory.BlockFactory;
@@ -26,8 +27,8 @@
     private Class type;
     private Class blockFactoryType;
     
-    public XMLDispatchAsyncListener() {
-        super();
+    public XMLDispatchAsyncListener(ServiceDescription sd) {
+        super(sd);
     }
     
     public void setMode(Mode m) {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/ProxyAsyncListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/ProxyAsyncListener.java?view=diff&rev=522637&r1=522636&r2=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/ProxyAsyncListener.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/ProxyAsyncListener.java Mon Mar 26 14:41:47 2007
@@ -20,6 +20,7 @@
 import org.apache.axis2.jaxws.client.async.AsyncResponse;
 import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.description.OperationDescription;
+import org.apache.axis2.jaxws.description.ServiceDescription;
 
 
 /**
@@ -35,8 +36,8 @@
     OperationDescription operationDesc = null;
     
 	public ProxyAsyncListener(OperationDescription opDesc) {
-		super();
-        operationDesc = opDesc;
+	    super(opDesc.getEndpointInterfaceDescription().getEndpointDescription().getServiceDescription());
+            operationDesc = opDesc;
 	}
 	
 	public JAXWSProxyHandler getHandler() {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Constants.java?view=diff&rev=522637&r1=522636&r2=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Constants.java Mon Mar 26 14:41:47 2007
@@ -1,54 +1,58 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- *      
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.axis2.jaxws.spi;
-
-/**
- * JAXWS SPI Constants
- */
-public class Constants {
-    
-    // ----------------------------
-    // MessageContext Property Keys
-    // ----------------------------
-    
-    // Value = Boolean
-    // Usage: Setting this property to true will cause the entire request message
-    //   to be saved and restored. A reliable messaging inbound handler should set 
-    //   this flag if the entire message should be saved.  Setting this flag will substantially
-    //   degrade performance.
-    //
-    //   The default is to not save the entire message.  After server dispatch processing, the 
-    //   body of the request message will not be available.  This is acceptable in most scenarios.
-    //
-    // REVIEW Only honored on the server: Saved before inbound application handler processing and
-    //   restored after outbound application handler processing.
-    //
-    public static final String SAVE_REQUEST_MSG = "org.apache.axis2.jaxws.spi.SAVE_REQUEST_MSG";
-
-    // Value = String
-    // Usage: Value of saved request
-    //
-    public static final String SAVED_REQUEST_MSG_TEXT = "org.apache.axis2.jaxws.spi.SAVED_REQUEST_MSG_TEXT";
-    
-    /**
-     * Intentionally Private
-     */
-    private Constants() { }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.spi;
+
+/**
+ * JAXWS SPI Constants
+ */
+public class Constants {
+    
+    // ----------------------------
+    // MessageContext Property Keys
+    // ----------------------------
+    
+    // Value = Boolean
+    // Usage: Setting this property to true will cause the entire request message
+    //   to be saved and restored. A reliable messaging inbound handler should set 
+    //   this flag if the entire message should be saved.  Setting this flag will substantially
+    //   degrade performance.
+    //
+    //   The default is to not save the entire message.  After server dispatch processing, the 
+    //   body of the request message will not be available.  This is acceptable in most scenarios.
+    //
+    // REVIEW Only honored on the server: Saved before inbound application handler processing and
+    //   restored after outbound application handler processing.
+    //
+    public static final String SAVE_REQUEST_MSG = "org.apache.axis2.jaxws.spi.SAVE_REQUEST_MSG";
+
+    // Value = String
+    // Usage: Value of saved request
+    //
+    public static final String SAVED_REQUEST_MSG_TEXT = "org.apache.axis2.jaxws.spi.SAVED_REQUEST_MSG_TEXT";
+    
+    // Value = Collection
+    // Usage: A list of ApplicationContextMigrator objects that are to be called for an invocation.
+    public static final String APPLICATION_CONTEXT_MIGRATOR_LIST_ID = "org.apache.axis2.jaxws.spi.ApplicationContextMigrators";
+
+    /**
+     * Intentionally Private
+     */
+    private Constants() { }
+
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java?view=diff&rev=522637&r1=522636&r2=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java Mon Mar 26 14:41:47 2007
@@ -45,6 +45,7 @@
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.client.PropertyMigrator;
 import org.apache.axis2.jaxws.client.dispatch.JAXBDispatch;
 import org.apache.axis2.jaxws.client.dispatch.XMLDispatch;
 import org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler;
@@ -53,6 +54,7 @@
 import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
 import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.spi.migrator.ApplicationContextMigratorUtil;
 import org.apache.axis2.jaxws.util.WSDLWrapper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -85,6 +87,10 @@
             	throw ExceptionFactory.makeWebServiceException(Messages.getMessage("serviceDelegateConstruct0", serviceQname.toString(), url.toString()));
             }
         }
+        
+        // Register the necessary ApplicationContextMigrators
+        ApplicationContextMigratorUtil.addApplicationContextMigrator(serviceDescription.getAxisConfigContext(), 
+                Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID, new PropertyMigrator());
     }
     
     //================================================

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigrator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigrator.java?view=auto&rev=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigrator.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigrator.java Mon Mar 26 14:41:47 2007
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.spi.migrator;
+
+import java.util.Map;
+
+import org.apache.axis2.jaxws.core.MessageContext;
+
+/**
+ * The ContextPropertyMigrator is a utility interface that can be implemented to handle any 
+ * transformation or migration that needs to happen between the internal JAX-WS MessageContext 
+ * for a request or a response and the associated context for the client or the server.
+ * 
+ * client - On the client side, this will be called with the request or response context 
+ *          from the BindingProvider instance.
+ *          
+ * server - On the server side, this will be called with the javax.xml.ws.handler.MessageContext
+ *          instance that the service endpoint will see.  This is the same context that will
+ *          be injected 
+ *
+ */
+public interface ApplicationContextMigrator {
+    
+    /**
+     * Is called to handle property migration FROM the user context (BindingProvider client context or server
+     * MessageContext) TO a target internal org.apache.axis2.jaxws.core.MessageContext.
+     * 
+     * @param userContext    - The source context that contains the user context properties.
+     * @param messageContext - The target MessageContext to receive the properties.
+     */
+    public void migratePropertiesToMessageContext(Map<String, Object> userContext, MessageContext messageContext);
+    
+    /**
+     * Is called to handle property migratom FROM the internal org.apache.axis2.jaxws.core.MessageContext TO a 
+     * target user context (BindingProvider client context or server MessageContext) that the user will access.
+     * 
+     * @param userContext     - The target user context to receive the properties.
+     * @param messageContext  - The source MessageContext that contains the property values.
+     */
+    public void migratePropertiesFromMessageContext(Map<String, Object> userContext, MessageContext messageContext);
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigratorUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigratorUtil.java?view=auto&rev=522637
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigratorUtil.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigratorUtil.java Mon Mar 26 14:41:47 2007
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.spi.migrator;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.ServiceDescription;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class ApplicationContextMigratorUtil {
+    
+    private static final Log log = LogFactory.getLog(ApplicationContextMigrator.class);
+    
+    /**
+     * Register a new ContextPropertyMigrator.
+     * 
+     * @param configurationContext
+     * @param contextMigratorListID The name of the property in the
+     *                              ConfigurationContext that contains
+     *                              the list of migrators.
+     * @param migrator
+     */
+    public static void addApplicationContextMigrator(ConfigurationContext configurationContext, 
+                                                  String contextMigratorListID, 
+                                                  ApplicationContextMigrator migrator) {
+        List<ApplicationContextMigrator> migratorList = (List<ApplicationContextMigrator>) configurationContext.getProperty(contextMigratorListID);
+
+        if (migratorList == null) {
+            migratorList = new LinkedList<ApplicationContextMigrator>();
+            configurationContext.setProperty(contextMigratorListID, migratorList);
+        }
+      
+        if (log.isDebugEnabled()) {
+            log.debug("Adding ApplicationContextMigrator: " + migrator.getClass().getName());
+        }
+        migratorList.add(migrator);
+    }
+
+    /**
+     * 
+     * @param contextMigratorListID
+     * @param requestContext
+     * @param messageContext
+     */
+    public static void performMigrationToMessageContext(String contextMigratorListID,
+                                                        Map<String, Object> requestContext,
+                                                        MessageContext messageContext) {
+        if (messageContext == null) {
+            throw ExceptionFactory.makeWebServiceException("Null MessageContext");
+        }
+        
+        ServiceDescription sd = messageContext.getServiceDescription();
+        if (sd != null) {
+            ConfigurationContext configCtx = sd.getAxisConfigContext();
+            List<ApplicationContextMigrator> migratorList = (List<ApplicationContextMigrator>) configCtx.getProperty(contextMigratorListID);
+        
+            if (migratorList != null) {
+                ListIterator<ApplicationContextMigrator> itr = migratorList.listIterator();
+                while (itr.hasNext()) {
+                    ApplicationContextMigrator cpm = itr.next();
+                    if (log.isDebugEnabled()) {
+                        log.debug("migrator: " + cpm.getClass().getName() + ".migratePropertiesToMessageContext");
+                    }
+                    cpm.migratePropertiesToMessageContext(requestContext, messageContext);
+                }
+            }
+        }
+    }
+    
+    /**
+     * 
+     * @param contextMigratorListID
+     * @param responseContext
+     * @param messageContext
+     */
+    public static void performMigrationFromMessageContext(String contextMigratorListID,
+                                                          Map<String, Object> responseContext,
+                                                          MessageContext messageContext) {
+        if (messageContext == null) {
+            throw ExceptionFactory.makeWebServiceException("Null MessageContext");
+        }
+        
+        ServiceDescription sd = messageContext.getServiceDescription();
+        if (sd != null) {
+            ConfigurationContext configCtx = sd.getAxisConfigContext();
+            List<ApplicationContextMigrator> migratorList = (List<ApplicationContextMigrator>) configCtx.getProperty(contextMigratorListID);
+            
+            if (migratorList != null) {
+                ListIterator<ApplicationContextMigrator> itr = migratorList.listIterator();
+                while (itr.hasNext()) {
+                    ApplicationContextMigrator cpm = itr.next();
+                    if (log.isDebugEnabled()) {
+                        log.debug("migrator: " + cpm.getClass().getName() + ".migratePropertiesFromMessageContext");
+                    }
+                    cpm.migratePropertiesFromMessageContext(responseContext, messageContext);
+                }
+            }            
+        }        
+    }
+}



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