cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1230685 [1/2] - in /cxf/trunk: api/src/main/java/org/apache/cxf/ws/addressing/ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/ rt/ws/addr/src/main/java/org/apache/cxf/ws/ad...
Date Thu, 12 Jan 2012 18:31:50 GMT
Author: dkulp
Date: Thu Jan 12 18:31:47 2012
New Revision: 1230685

URL: http://svn.apache.org/viewvc?rev=1230685&view=rev
Log:
Fix the split package issue for org.apache.cxf.ws.addressing
Move impls into impl subpackage, put some stubs in addressing
Make sure more classes don't use the impls (still some in RM)

Added:
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java   (with props)
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java   (with props)
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/MessageIdCache.java
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MessageIdCache.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/Messages.properties
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/Names.java   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingBuilderImpl.java   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingBuilderImpl.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingConstantsImpl.java   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingConstantsImpl.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingFeatureApplier.java   (with props)
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingPropertiesImpl.java   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingPropertiesImpl.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingWSDLExtensionLoader.java   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingWSDLExtensionLoader.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/DefaultMessageIdCache.java   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/DefaultMessageIdCache.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java   (with props)
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorImpl.java   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorImplLoader.java   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MessageIdCache.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/Messages.properties   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties
    cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/impl/
    cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/impl/ContextUtilsTest.java   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/ContextUtilsTest.java
    cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorTest.java   (contents, props changed)
      - copied, changed from r1230569, cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
Removed:
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/APIMessages.properties
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingBuilderImpl.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingConstantsImpl.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingPropertiesImpl.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingWSDLExtensionLoader.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/DefaultMessageIdCache.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MessageIdCache.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java
    cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/ContextUtilsTest.java
    cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingBuilder.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingConstants.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingProperties.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/OneWayDecoupledFaultHandler.java
    cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/bus-extensions.txt
    cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/AddressingBuilderImplTest.java
    cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/AddressingConstantsImplTest.java
    cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
    cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/OneWayDecoupledFaultHandlerTest.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMUtils.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMContextUtilsTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ServantTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/SoapFaultFactoryTest.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSInvoker.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/interceptor/SCTOutInterceptor.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/spring/WSAFeatureXmlTest.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingBuilder.java?rev=1230685&r1=1230684&r2=1230685&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingBuilder.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingBuilder.java Thu Jan 12 18:31:47 2012
@@ -24,6 +24,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import static org.apache.cxf.ws.addressing.JAXWSAConstants.DEFAULT_ADDRESSING_BUILDER;
 
@@ -39,7 +40,7 @@ import static org.apache.cxf.ws.addressi
 public abstract class AddressingBuilder implements AddressingType {
 
     private static final Logger LOG = 
-        LogUtils.getL7dLogger(AddressingBuilder.class, "APIMessages");
+        LogUtils.getL7dLogger(AddressingBuilder.class);
     private static AddressingBuilder builder;
 
     /**
@@ -58,7 +59,7 @@ public abstract class AddressingBuilder 
             if (builder == null) {
                 String className = DEFAULT_ADDRESSING_BUILDER;
                 try {
-                    Class<?> cls = Class.forName(className);
+                    Class<?> cls = ClassLoaderUtils.loadClass(className, AddressingBuilder.class);
                     builder = (AddressingBuilder)cls.newInstance();
                 } catch (ClassNotFoundException cnfe) {
                     cnfe.printStackTrace();

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingConstants.java?rev=1230685&r1=1230684&r2=1230685&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingConstants.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingConstants.java Thu Jan 12 18:31:47 2012
@@ -115,11 +115,6 @@ public interface AddressingConstants {
     QName getAddressQName();
     
     /**
-     * @return package name of the implementation
-     */
-    String getPackageName();
-    
-    /**
      * @return QName of the reference parameter marker
      */
     QName getIsReferenceParameterQName();

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingProperties.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingProperties.java?rev=1230685&r1=1230684&r2=1230685&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingProperties.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingProperties.java Thu Jan 12 18:31:47 2012
@@ -19,6 +19,10 @@
 
 package org.apache.cxf.ws.addressing;
 
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
 
 /**
  * Abstraction of Message Addressing Properties. 
@@ -120,4 +124,21 @@ public interface AddressingProperties ex
      * @param iri new value for Action property
      */
     void setAction(AttributedURIType iri);
+    
+    /**
+     * Used to specify a different WS-Addressing namespace URI, 
+     * so as to cause MAPs to be exposed (i.e. encoded in externalized
+     * message with a different WS-Addressing version).
+     * 
+     * @return WS-Addressing namespace URI
+     */
+    void exposeAs(String uri);
+    
+    
+    AddressingProperties createCompatibleResponseProperties();
+    
+    QName getDuplicate();
+    void setDuplicate(QName qn);
+    List<QName> getMustUnderstand();
+
 }

Added: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?rev=1230685&view=auto
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java (added)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java Thu Jan 12 18:31:47 2012
@@ -0,0 +1,643 @@
+/**
+ * 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.cxf.ws.addressing;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.jaxb.JAXBContextCache;
+import org.apache.cxf.jaxb.JAXBContextCache.CachedContextAndSchemas;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.ConduitInitiator;
+import org.apache.cxf.transport.ConduitInitiatorManager;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+
+import static org.apache.cxf.message.Message.ASYNC_POST_RESPONSE_DISPATCH;
+import static org.apache.cxf.message.Message.REQUESTOR_ROLE;
+
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES;
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND;
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND;
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND;
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND;
+
+
+/**
+ * Holder for utility methods relating to contexts.
+ */
+public final class ContextUtils {
+
+    public static final ObjectFactory WSA_OBJECT_FACTORY = new ObjectFactory();
+    public static final String ACTION = ContextUtils.class.getName() + ".ACTION";
+
+    private static final EndpointReferenceType NONE_ENDPOINT_REFERENCE = 
+        EndpointReferenceUtils.getEndpointReference(Names.WSA_NONE_ADDRESS);
+    
+    private static final Logger LOG = LogUtils.getL7dLogger(ContextUtils.class);
+    
+    /**
+     * Used to fabricate a Uniform Resource Name from a UUID string
+     */
+    private static final String URN_UUID = "urn:uuid:";
+    
+    private static JAXBContext jaxbContext;
+    private static Set<Class<?>> jaxbContextClasses;
+     
+    /**
+     * Used by MAPAggregator to cache bad MAP fault name
+     */
+    private static final String MAP_FAULT_NAME_PROPERTY = 
+        "org.apache.cxf.ws.addressing.map.fault.name";
+
+    /**
+     * Used by MAPAggregator to cache bad MAP fault reason
+     */
+    private static final String MAP_FAULT_REASON_PROPERTY = 
+        "org.apache.cxf.ws.addressing.map.fault.reason";
+    
+    /**
+     * Indicates a partial response has already been sent
+     */
+    private static final String PARTIAL_REPONSE_SENT_PROPERTY =
+        "org.apache.cxf.ws.addressing.partial.response.sent";
+ 
+   /**
+    * Prevents instantiation.
+    */
+    private ContextUtils() {
+    }
+
+   /**
+    * Determine if message is outbound.
+    *
+    * @param message the current Message
+    * @return true iff the message direction is outbound
+    */
+    public static boolean isOutbound(Message message) {
+        Exchange exchange = message.getExchange();
+        return message != null
+               && exchange != null
+               && (message == exchange.getOutMessage()
+                   || message == exchange.getOutFaultMessage());
+    }
+
+   /**
+    * Determine if message is fault.
+    *
+    * @param message the current Message
+    * @return true iff the message is a fault
+    */
+    public static boolean isFault(Message message) {
+        return message != null
+               && message.getExchange() != null
+               && (message == message.getExchange().getInFaultMessage()
+                   || message == message.getExchange().getOutFaultMessage());
+    }
+
+   /**
+    * Determine if current messaging role is that of requestor.
+    *
+    * @param message the current Message
+    * @return true if the current messaging role is that of requestor
+    */
+    public static boolean isRequestor(Message message) {
+        Boolean requestor = (Boolean)message.get(REQUESTOR_ROLE);
+        return requestor != null && requestor.booleanValue();
+    }
+
+    /**
+     * Get appropriate property name for message addressing properties.
+     *
+     * @param isProviderContext true if the binding provider request context 
+     * available to the client application as opposed to the message context 
+     * visible to handlers
+     * @param isRequestor true if the current messaging role is that of
+     * requestor
+     * @param isOutbound true if the message is outbound
+     * @return the property name to use when caching the MAPs in the context
+     */
+    public static String getMAPProperty(boolean isRequestor, 
+                                        boolean isProviderContext,
+                                        boolean isOutbound) {
+        return isRequestor
+                ? isProviderContext
+                 ? CLIENT_ADDRESSING_PROPERTIES
+                 : isOutbound
+                   ? CLIENT_ADDRESSING_PROPERTIES_OUTBOUND
+                   : CLIENT_ADDRESSING_PROPERTIES_INBOUND
+               : isOutbound
+                 ? SERVER_ADDRESSING_PROPERTIES_OUTBOUND
+                 : SERVER_ADDRESSING_PROPERTIES_INBOUND;
+    }
+
+    /**
+     * Store MAPs in the message.
+     *
+     * @param message the current message
+     * @param isOutbound true if the message is outbound
+     */
+    public static void storeMAPs(AddressingProperties maps,
+                                 Message message,
+                                 boolean isOutbound) {
+        storeMAPs(maps, message, isOutbound, isRequestor(message), false);
+    }
+
+    /**
+     * Store MAPs in the message.
+     *
+     * @param maps the MAPs to store
+     * @param message the current message
+     * @param isOutbound true if the message is outbound
+     * @param isRequestor true if the current messaging role is that of
+     * requestor
+     * @param handler true if HANDLER scope, APPLICATION scope otherwise
+     */
+    public static void storeMAPs(AddressingProperties maps,
+                                 Message message,
+                                 boolean isOutbound, 
+                                 boolean isRequestor) {
+        storeMAPs(maps, message, isOutbound, isRequestor, false);
+    }
+    
+    /**
+     * Store MAPs in the message.
+     *
+     * @param maps the MAPs to store
+     * @param message the current message
+     * @param isOutbound true if the message is outbound
+     * @param isRequestor true if the current messaging role is that of
+     * requestor
+     * @param handler true if HANDLER scope, APPLICATION scope otherwise
+     * @param isProviderContext true if the binding provider request context 
+     */
+    public static void storeMAPs(AddressingProperties maps,
+                                 Message message,
+                                 boolean isOutbound, 
+                                 boolean isRequestor,
+                                 boolean isProviderContext) {
+        if (maps != null) {
+            String mapProperty = getMAPProperty(isRequestor, isProviderContext, isOutbound);
+            LOG.log(Level.FINE,
+                    "associating MAPs with context property {0}",
+                    mapProperty);
+            message.put(mapProperty, maps);
+        }
+    }
+    
+    /**
+     * @param message the current message
+     * @param isProviderContext true if the binding provider request context
+     * available to the client application as opposed to the message context
+     * visible to handlers
+     * @param isOutbound true if the message is outbound
+     * @return the current addressing properties
+     */
+    public static AddressingProperties retrieveMAPs(
+                                                   Message message, 
+                                                   boolean isProviderContext,
+                                                   boolean isOutbound) {
+        return retrieveMAPs(message, isProviderContext, isOutbound, true);
+    }
+
+    /**
+     * @param message the current message
+     * @param isProviderContext true if the binding provider request context
+     * available to the client application as opposed to the message context
+     * visible to handlers
+     * @param isOutbound true if the message is outbound
+     * @param warnIfMissing log a warning  message if properties cannot be retrieved
+     * @return the current addressing properties
+     */
+    public static AddressingProperties retrieveMAPs(
+                                                   Message message, 
+                                                   boolean isProviderContext,
+                                                   boolean isOutbound,
+                                                   boolean warnIfMissing) {
+        boolean isRequestor = ContextUtils.isRequestor(message);
+        String mapProperty =
+            ContextUtils.getMAPProperty(isProviderContext, 
+                                        isRequestor,
+                                        isOutbound);
+        LOG.log(Level.FINE,
+                "retrieving MAPs from context property {0}",
+                mapProperty);
+        
+        AddressingProperties maps =
+            (AddressingProperties)message.get(mapProperty);
+        if (maps == null && isOutbound && !isRequestor
+            && message.getExchange() != null && message.getExchange().getInMessage() != null) { 
+            maps = (AddressingProperties)message.getExchange().getInMessage().get(mapProperty); 
+        }
+        
+        if (maps != null) {
+            LOG.log(Level.FINE, "current MAPs {0}", maps);
+        } else if (!isProviderContext) {
+            LogUtils.log(LOG, warnIfMissing ? Level.WARNING : Level.FINE, 
+                "MAPS_RETRIEVAL_FAILURE_MSG");         
+        }
+        return maps;
+    }
+
+    /**
+     * Helper method to get an attributed URI.
+     *
+     * @param uri the URI
+     * @return an AttributedURIType encapsulating the URI
+     */
+    public static AttributedURIType getAttributedURI(String uri) {
+        AttributedURIType attributedURI = 
+            WSA_OBJECT_FACTORY.createAttributedURIType();
+        attributedURI.setValue(uri);
+        return attributedURI;
+    }
+
+    /**
+     * Helper method to get a RealtesTo instance.
+     *
+     * @param uri the related URI
+     * @return a RelatesToType encapsulating the URI
+     */
+    public static RelatesToType getRelatesTo(String uri) {
+        RelatesToType relatesTo =
+            WSA_OBJECT_FACTORY.createRelatesToType();
+        relatesTo.setValue(uri);
+        return relatesTo;
+    }
+
+    /**
+     * Helper method to determine if an EPR address is generic (either null,
+     * none or anonymous).
+     *
+     * @param ref the EPR under test
+     * @return true if the address is generic
+     */
+    public static boolean isGenericAddress(EndpointReferenceType ref) {
+        return ref == null 
+               || ref.getAddress() == null
+               || Names.WSA_ANONYMOUS_ADDRESS.equals(ref.getAddress().getValue())
+               || Names.WSA_NONE_ADDRESS.equals(ref.getAddress().getValue());
+    }
+    
+    /**
+     * Helper method to determine if an EPR address is none.
+     *
+     * @param ref the EPR under test
+     * @return true if the address is generic
+     */
+    public static boolean isNoneAddress(EndpointReferenceType ref) {
+        return ref != null 
+               && ref.getAddress() != null
+               && Names.WSA_NONE_ADDRESS.equals(ref.getAddress().getValue());
+    }
+
+    /**
+     * Helper method to determine if an MAPs Action is empty (a null action
+     * is considered empty, whereas a zero length action suppresses
+     * the propagation of the Action property).
+     *
+     * @param ref the MAPs Action under test
+     * @return true if the Action is empty
+     */
+    public static boolean hasEmptyAction(AddressingProperties maps) {
+        boolean empty = maps.getAction() == null;
+        if (maps.getAction() != null 
+            && maps.getAction().getValue().length() == 0) {
+            maps.setAction(null);
+            empty = false;
+        } 
+        return empty;
+    }
+    
+    
+    /**
+     * Propagate inbound MAPs onto full reponse & fault messages.
+     * 
+     * @param inMAPs the inbound MAPs
+     * @param exchange the current Exchange
+     */
+    public static void propogateReceivedMAPs(AddressingProperties inMAPs,
+                                              Exchange exchange) {
+        if (exchange.getOutMessage() == null) {
+            exchange.setOutMessage(createMessage(exchange));
+        }
+        propogateReceivedMAPs(inMAPs, exchange.getOutMessage());
+        if (exchange.getOutFaultMessage() == null) {
+            exchange.setOutFaultMessage(createMessage(exchange));
+        }
+        propogateReceivedMAPs(inMAPs, exchange.getOutFaultMessage());
+    }
+
+    /**
+     * Propogate inbound MAPs onto reponse message if applicable
+     * (not applicable for oneways).
+     * 
+     * @param inMAPs the inbound MAPs
+     * @param responseMessage
+     */
+    public static void propogateReceivedMAPs(AddressingProperties inMAPs,
+                                             Message responseMessage) {
+        if (responseMessage != null) {
+            storeMAPs(inMAPs, responseMessage, false, false, false);
+        }
+    }
+
+    
+    /**
+     * Store bad MAP fault name in the message.
+     *
+     * @param faultName the fault name to store
+     * @param message the current message
+     */
+    public static void storeMAPFaultName(String faultName, 
+                                         Message message) {
+        message.put(MAP_FAULT_NAME_PROPERTY, faultName);
+    }
+
+    /**
+     * Retrieve MAP fault name from the message.
+     *
+     * @param message the current message
+     * @returned the retrieved fault name
+     */
+    public static String retrieveMAPFaultName(Message message) {
+        return (String)message.get(MAP_FAULT_NAME_PROPERTY);
+    }
+
+    /**
+     * Store MAP fault reason in the message.
+     *
+     * @param reason the fault reason to store
+     * @param message the current message
+     */
+    public static void storeMAPFaultReason(String reason, 
+                                           Message message) {
+        message.put(MAP_FAULT_REASON_PROPERTY, reason);
+    }
+
+    /**
+     * Retrieve MAP fault reason from the message.
+     *
+     * @param message the current message
+     * @returned the retrieved fault reason
+     */
+    public static String retrieveMAPFaultReason(Message message) {
+        return (String)message.get(MAP_FAULT_REASON_PROPERTY);
+    }
+    
+    /**
+     * Store an indication that a partial response has been sent.
+     * Relavant if *both* the replyTo & faultTo are decoupled,
+     * and a fault occurs, then we would already have sent the
+     * partial response (pre-dispatch) for the replyTo, so
+     * no need to send again.
+     *
+     * @param message the current message
+     */
+    public static void storePartialResponseSent(Message message) {
+        message.put(PARTIAL_REPONSE_SENT_PROPERTY, Boolean.TRUE);
+    }
+
+    /**
+     * Retrieve indication that a partial response has been sent.
+     *
+     * @param message the current message
+     * @returned the retrieved indication that a partial response
+     * has been sent
+     */
+    public static boolean retrievePartialResponseSent(Message message) {
+        Boolean ret = (Boolean)message.get(PARTIAL_REPONSE_SENT_PROPERTY);
+        return ret != null && ret.booleanValue();
+    }
+
+    /**
+     * Store indication that a deferred uncorrelated message abort is
+     * supported
+     *
+     * @param message the current message
+     */
+    public static void storeDeferUncorrelatedMessageAbort(Message message) {
+        if (message.getExchange() != null) { 
+            message.getExchange().put("defer.uncorrelated.message.abort", Boolean.TRUE);
+        }
+    }
+
+    /**
+     * Retrieve indication that a deferred uncorrelated message abort is
+     * supported
+     *
+     * @param message the current message
+     * @returned the retrieved indication 
+     */
+    public static boolean retrieveDeferUncorrelatedMessageAbort(Message message) {
+        Boolean ret = message.getExchange() != null 
+                      ? (Boolean)message.getExchange().get("defer.uncorrelated.message.abort")
+                      : null;
+        return ret != null && ret.booleanValue();
+    }
+
+    /**
+     * Store indication that a deferred uncorrelated message abort should
+     * occur
+     *
+     * @param message the current message
+     */
+    public static void storeDeferredUncorrelatedMessageAbort(Message message) {
+        if (message.getExchange() != null) { 
+            message.getExchange().put("deferred.uncorrelated.message.abort", Boolean.TRUE);
+        }
+    }
+
+    /**
+     * Retrieve indication that a deferred uncorrelated message abort should
+     * occur.
+     *
+     * @param message the current message
+     * @returned the retrieved indication 
+     */
+    public static boolean retrieveDeferredUncorrelatedMessageAbort(Message message) {
+        Boolean ret = message.getExchange() != null 
+                      ? (Boolean)message.getExchange().get("deferred.uncorrelated.message.abort")
+                      : null;
+        return ret != null && ret.booleanValue();
+    }
+
+    /**
+     * Retrieve indication that an async post-response service invocation
+     * is required.
+     * 
+     * @param message the current message
+     * @returned the retrieved indication that an async post-response service
+     * invocation is required.
+     */
+    public static boolean retrieveAsyncPostResponseDispatch(Message message) {
+        Boolean ret = (Boolean)message.get(ASYNC_POST_RESPONSE_DISPATCH);
+        return ret != null && ret.booleanValue();
+    }
+    
+    /**
+     * Retrieve a JAXBContext for marshalling and unmarshalling JAXB generated
+     * types.
+     *
+     * @return a JAXBContext 
+     */
+    public static JAXBContext getJAXBContext() throws JAXBException {
+        synchronized (ContextUtils.class) {
+            if (jaxbContext == null || jaxbContextClasses == null) {
+                Set<Class<?>> tmp = new HashSet<Class<?>>();
+                JAXBContextCache.addPackage(tmp, WSA_OBJECT_FACTORY.getClass().getPackage().getName(), 
+                                            WSA_OBJECT_FACTORY.getClass().getClassLoader());
+                JAXBContextCache.scanPackages(tmp);
+                CachedContextAndSchemas ccs 
+                    = JAXBContextCache.getCachedContextAndSchemas(tmp, null, null, null, false);
+                jaxbContextClasses = ccs.getClasses();
+                jaxbContext = ccs.getContext();
+            }
+        }
+        return jaxbContext;
+    }
+
+    /**
+     * Set the encapsulated JAXBContext (used by unit tests).
+     * 
+     * @param ctx JAXBContext 
+     */
+    public static void setJAXBContext(JAXBContext ctx) throws JAXBException {
+        synchronized (ContextUtils.class) {
+            jaxbContext = ctx;
+            jaxbContextClasses = new HashSet<Class<?>>();
+        }
+    }
+    
+    
+    /**
+     * @return a generated UUID
+     */
+    public static String generateUUID() {
+        return URN_UUID + UUID.randomUUID();
+    }
+    
+    /**
+     * Retreive Conduit from Exchange if not already available
+     * 
+     * @param conduit the current value for the Conduit
+     * @param message the current message
+     * @return the Conduit if available
+     */
+    public static Conduit getConduit(Conduit conduit, Message message) {
+        if (conduit == null) {
+            Exchange exchange = message.getExchange();
+            conduit = exchange != null ? exchange.getConduit(message) : null;
+        }
+        return conduit;
+    }
+    
+    public static EndpointReferenceType getNoneEndpointReference() {
+        return NONE_ENDPOINT_REFERENCE;
+    }
+
+    public static void applyReferenceParam(EndpointReferenceType toEpr, Object el) {
+        if (null == toEpr.getReferenceParameters()) {
+            toEpr.setReferenceParameters(WSA_OBJECT_FACTORY.createReferenceParametersType());
+        }
+        toEpr.getReferenceParameters().getAny().add(el);
+    }
+
+    /**
+     * Create a Binding specific Message.
+     * 
+     * @param message the current message
+     * @return the Method from the BindingOperationInfo
+     */
+    public static Message createMessage(Exchange exchange) {
+        Endpoint ep = exchange.get(Endpoint.class);
+        Message msg = null;
+        if (ep != null) {
+            msg = new MessageImpl();
+            msg.setExchange(exchange);
+            if (ep.getBinding() != null) {
+                msg = ep.getBinding().createMessage(msg);
+            }
+        }
+        return msg;
+    }
+    
+    public static Destination createDecoupledDestination(Exchange exchange, 
+                                                         final EndpointReferenceType reference) {
+        final EndpointInfo ei = exchange.get(Endpoint.class).getEndpointInfo();
+        return new Destination() {
+            public EndpointReferenceType getAddress() {
+                return reference;
+            }
+            public Conduit getBackChannel(Message inMessage, Message partialResponse,
+                                          EndpointReferenceType address) throws IOException {
+                Bus bus = inMessage.getExchange().get(Bus.class);
+                //this is a response targeting a decoupled endpoint.   Treat it as a oneway so
+                //we don't wait for a response.
+                inMessage.getExchange().setOneWay(true);
+                ConduitInitiator conduitInitiator 
+                    = bus.getExtension(ConduitInitiatorManager.class)
+                        .getConduitInitiatorForUri(reference.getAddress().getValue());
+                if (conduitInitiator != null) {
+                    Conduit c = conduitInitiator.getConduit(ei, reference);
+                    //ensure decoupled back channel input stream is closed
+                    c.setMessageObserver(new MessageObserver() {
+                        public void onMessage(Message m) {
+                            InputStream is = m.getContent(InputStream.class);
+                            if (is != null) {
+                                try {
+                                    is.close();
+                                } catch (Exception e) {
+                                    //ignore
+                                }
+                            }
+                        }
+                    });
+                    return c;
+                }
+                return null;
+            }
+            public MessageObserver getMessageObserver() {
+                return null;
+            }
+            public void shutdown() {
+            }
+            public void setMessageObserver(MessageObserver observer) {
+            }
+        };
+    }    
+}

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java?rev=1230685&r1=1230684&r2=1230685&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java Thu Jan 12 18:31:47 2012
@@ -79,7 +79,7 @@ public final class JAXWSAConstants {
      * Used by AddressingBuilder factory method.
      */
     public static final String DEFAULT_ADDRESSING_BUILDER =
-        "org.apache.cxf.ws.addressing.AddressingBuilderImpl";
+        "org.apache.cxf.ws.addressing.impl.AddressingBuilderImpl";
 
     /**
      * Prevents instantiation. 

Added: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=1230685&view=auto
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java (added)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java Thu Jan 12 18:31:47 2012
@@ -0,0 +1,221 @@
+/**
+ * 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.cxf.ws.addressing;
+
+import java.util.Collection;
+
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.PhaseInterceptor;
+
+/**
+ * Logical Handler responsible for aggregating the Message Addressing 
+ * Properties for outgoing messages.
+ */
+public class MAPAggregator extends AbstractPhaseInterceptor<Message> {
+    public static final String USING_ADDRESSING = MAPAggregator.class.getName() + ".usingAddressing";
+    public static final String ADDRESSING_DISABLED = MAPAggregator.class.getName() + ".addressingDisabled";
+    public static final String DECOUPLED_DESTINATION = MAPAggregator.class.getName() 
+        + ".decoupledDestination";
+    public static final String ACTION_VERIFIED = MAPAggregator.class.getName() + ".actionVerified";
+    
+    public interface MAPAggregatorLoader {
+        MAPAggregator createImplementation(MAPAggregator mag);
+    }
+
+    protected MessageIdCache messageIdCache;
+    protected boolean usingAddressingAdvisory = true;
+    protected boolean addressingRequired;
+    protected boolean allowDuplicates = true;
+    protected WSAddressingFeature.AddressingResponses addressingResponses 
+        = WSAddressingFeature.AddressingResponses.ALL;
+
+    /**
+     * The real implementation of the MAPAggregator interceptor
+     */
+    private MAPAggregator impl;
+
+    /**
+     * Constructor.
+     */
+    public MAPAggregator() {
+        super(MAPAggregator.class.getName(), Phase.PRE_LOGICAL);
+        addBefore("org.apache.cxf.interceptor.OneWayProcessorInterceptor");
+    }
+    
+    /**
+     * Indicates if duplicate messageIDs are allowed.
+     * @return true if duplicate messageIDs are allowed
+     */
+    public boolean allowDuplicates() {
+        if (impl != null) {
+            return impl.allowDuplicates();
+        }
+        return allowDuplicates;
+    }
+
+    /**
+     * Allows/disallows duplicate messageIdDs.  
+     * @param ad whether duplicate messageIDs are allowed
+     */
+    public void setAllowDuplicates(boolean ad) {
+        if (impl != null) {
+            impl.setAllowDuplicates(ad);
+        }
+        allowDuplicates = ad;
+    }
+
+    /**
+     * Whether the presence of the <wsaw:UsingAddressing> element
+     * in the WSDL is purely advisory, i.e. its absence doesn't prevent
+     * the encoding of WS-A headers.
+     *
+     * @return true if the presence of the <wsaw:UsingAddressing> element is 
+     * advisory
+     */
+    public boolean isUsingAddressingAdvisory() {
+        if (impl != null) {
+            return impl.isUsingAddressingAdvisory();
+        }
+        return usingAddressingAdvisory;
+    }
+
+    /**
+     * Controls whether the presence of the <wsaw:UsingAddressing> element
+     * in the WSDL is purely advisory, i.e. its absence doesn't prevent
+     * the encoding of WS-A headers.
+     *
+     * @param advisory true if the presence of the <wsaw:UsingAddressing>
+     * element is to be advisory
+     */
+    public void setUsingAddressingAdvisory(boolean advisory) {
+        if (impl != null) {
+            impl.setUsingAddressingAdvisory(advisory);
+        }
+        usingAddressingAdvisory = advisory;
+    }
+    
+    /**
+     * Whether the use of addressing is completely required for this endpoint
+     *
+     * @return true if addressing is required
+     */
+    public boolean isAddressingRequired() {
+        if (impl != null) {
+            return impl.addressingRequired;
+        }
+        return addressingRequired;
+    }
+    /**
+     * Sets whether the use of addressing is completely required for this endpoint
+     *
+     */
+    public void setAddressingRequired(boolean required) {
+        if (impl != null) {
+            impl.setAddressingRequired(required);
+        }
+        addressingRequired = required;
+    }
+    
+    /**
+     * Sets Addresing Response 
+     *
+     */
+    public void setAddressingResponses(WSAddressingFeature.AddressingResponses responses) {
+        if (impl != null) {
+            impl.setAddressingResponses(responses);
+        }
+        addressingResponses = responses;
+    }
+    
+    /**
+     * Returns the cache used to enforce duplicate message IDs when
+     * {@link #allowDuplicates()} returns {@code false}.
+     *
+     * @return the cache used to enforce duplicate message IDs
+     */
+    public MessageIdCache getMessageIdCache() {
+        if (impl != null) {
+            return impl.getMessageIdCache();
+        }
+        return messageIdCache;
+    }
+
+    /**
+     * Sets the cache used to enforce duplicate message IDs when
+     * {@link #allowDuplicates()} returns {@code false}.
+     *
+     * @param messageIdCache the cache to use
+     *
+     * @throws NullPointerException if {@code messageIdCache} is {@code null}
+     */
+    public void setMessageIdCache(MessageIdCache messageIdCache) {
+        if (messageIdCache == null) {
+            throw new NullPointerException("messageIdCache cannot be null.");
+        }
+        if (impl != null) {
+            impl.setMessageIdCache(messageIdCache);
+        }
+        this.messageIdCache = messageIdCache;
+    }
+    
+    /**
+     * Sets Addressing Response 
+     *
+     */
+    public WSAddressingFeature.AddressingResponses getAddressingResponses() {
+        if (impl != null) {
+            return impl.getAddressingResponses();
+        }
+        return addressingResponses;
+    }
+    
+    /**
+     * Invoked for normal processing of inbound and outbound messages.
+     *
+     * @param message the current message
+     */
+    public void handleMessage(Message message) {
+        if (impl == null) {
+            //load impl
+            MAPAggregatorLoader loader = message.getExchange().getBus()
+                .getExtension(MAPAggregatorLoader.class);
+            impl = loader.createImplementation(this);
+        }
+        impl.handleMessage(message);
+    }
+    
+    public void handleFault(Message message) {
+        if (impl != null) {
+            impl.handleFault(message);
+        }
+    }
+    
+    
+    public Collection<PhaseInterceptor<? extends Message>> getAdditionalInterceptors() {
+        if (impl != null) {
+            return impl.getAdditionalInterceptors();
+        }
+        return super.getAdditionalInterceptors();
+    }
+    
+
+}

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/MessageIdCache.java (from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MessageIdCache.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/MessageIdCache.java?p2=cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/MessageIdCache.java&p1=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MessageIdCache.java&r1=1230569&r2=1230685&rev=1230685&view=diff
==============================================================================
    (empty)

Copied: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/Messages.properties (from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties)
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/Messages.properties?p2=cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/Messages.properties&p1=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties&r1=1230569&r2=1230685&rev=1230685&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/Messages.properties Thu Jan 12 18:31:47 2012
@@ -18,6 +18,8 @@
 #    under the License.
 #
 #
+BUILDER_CLASS_NOT_FOUND_MSG = WS-Addressing builder class {0} not found 
+BUILDER_INSTANTIATION_FAILED_MSG = WS-Addressing builder {0} could not be instantiated:
 MAPS_RETRIEVAL_FAILURE_MSG = WS-Addressing - failed to retrieve Message Addressing Properties from context
 ACTION_NOT_SUPPORTED_MSG = Action {0} not supported
 DESTINATION_UNREACHABLE_MSG = Destination {0} unreachable

Copied: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/Names.java (from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/Names.java?p2=cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/Names.java&p1=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java&r1=1230569&r2=1230685&rev=1230685&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/Names.java Thu Jan 12 18:31:47 2012
@@ -25,8 +25,6 @@ import java.util.HashSet;
 import java.util.Set;
 import javax.xml.namespace.QName;
 
-import org.apache.cxf.binding.soap.SoapBindingConstants;
-
 
 /**
  * Holder for WS-Addressing names (of headers, namespaces etc.).
@@ -180,7 +178,7 @@ public final class Names {
     public static final String SOAP12HTTP_ADDRESSING_BINDING = 
         "http://www.w3.org/2003/05/soap-envelope?addressing=ms";
     
-    public static final String SOAP_ACTION_HEADER = SoapBindingConstants.SOAP_ACTION;
+    public static final String SOAP_ACTION_HEADER = "SOAPAction";
     
     /**
      * The set of headers understood by the protocol binding.

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/Names.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/Names.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java (from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java?p2=cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java&p1=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java&r1=1230569&r2=1230685&rev=1230685&view=diff
==============================================================================
    (empty)

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java (from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java?p2=cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java&p1=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java&r1=1230569&r2=1230685&rev=1230685&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java Thu Jan 12 18:31:47 2012
@@ -22,50 +22,52 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.interceptor.InterceptorProvider;
-import org.apache.cxf.ws.addressing.soap.MAPCodec;
 
 @NoJSR250Annotations
 public class WSAddressingFeature extends AbstractFeature {
-    private MAPAggregator mapAggregator = new MAPAggregator();
-    private MAPCodec mapCodec = new MAPCodec();
+    public static enum AddressingResponses {
+        ALL,
+        NON_ANONYMOUS,
+        ANONYMOUS,
+    }
+    
+    public interface WSAddressingFeatureApplier {
+        void initializeProvider(WSAddressingFeature feature, InterceptorProvider provider, Bus bus);
+    }
+    
+    boolean allowDuplicates = true;
+    boolean usingAddressingAdvisory = true;
+    boolean required;
+    MessageIdCache cache;
+    AddressingResponses responses = AddressingResponses.ALL;
     
     @Override
     protected void initializeProvider(InterceptorProvider provider, Bus bus) {
-        provider.getInInterceptors().add(mapAggregator);
-        provider.getInInterceptors().add(mapCodec);
-        
-        provider.getOutInterceptors().add(mapAggregator);
-        provider.getOutInterceptors().add(mapCodec);
-        
-        provider.getInFaultInterceptors().add(mapAggregator);
-        provider.getInFaultInterceptors().add(mapCodec);
-        
-        provider.getOutFaultInterceptors().add(mapAggregator);
-        provider.getOutFaultInterceptors().add(mapCodec);
+        bus.getExtension(WSAddressingFeatureApplier.class).initializeProvider(this, provider, bus);
     }
 
     public void setAllowDuplicates(boolean allow) {
-        mapAggregator.setAllowDuplicates(allow);
+        allowDuplicates = allow;
     }
     
     public boolean isAllowDuplicates() {
-        return mapAggregator.allowDuplicates();
+        return allowDuplicates;
     }
 
     public void setUsingAddressingAdvisory(boolean advisory) {
-        mapAggregator.setUsingAddressingAdvisory(advisory);
+        usingAddressingAdvisory = advisory;
     }
     
     public boolean isUsingAddressingAdvisory() {
-        return mapAggregator.isUsingAddressingAdvisory();
+        return usingAddressingAdvisory;
     }
     
 
     public boolean isAddressingRequired() {
-        return mapAggregator.isAddressingRequired();
+        return required;
     }
-    public void setAddressingRequired(boolean required) {
-        mapAggregator.setAddressingRequired(required);
+    public void setAddressingRequired(boolean r) {
+        required = r; 
     }
     
     /**
@@ -75,7 +77,7 @@ public class WSAddressingFeature extends
      * @return the cache used to enforce duplicate message IDs
      */
     public MessageIdCache getMessageIdCache() {
-        return mapAggregator.getMessageIdCache();
+        return cache;
     }
 
     /**
@@ -87,10 +89,17 @@ public class WSAddressingFeature extends
      * @throws NullPointerException if {@code messageIdCache} is {@code null}
      */
     public void setMessageIdCache(MessageIdCache messageIdCache) {
-        mapAggregator.setMessageIdCache(messageIdCache);
+        cache = messageIdCache;
     }
-    
-    public void setResponses(String responses) {
-        mapAggregator.setAddressingResponses(responses);
+
+    public void setResponses(AddressingResponses r) {
+        responses = r;
+    }
+    public void setResponses(String r) {
+        responses = AddressingResponses.valueOf(r);
     }
+    public AddressingResponses getResponses() {
+        return responses;
+    }
+    
 }

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingBuilderImpl.java (from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingBuilderImpl.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingBuilderImpl.java?p2=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingBuilderImpl.java&p1=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingBuilderImpl.java&r1=1230569&r2=1230685&rev=1230685&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingBuilderImpl.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingBuilderImpl.java Thu Jan 12 18:31:47 2012
@@ -17,7 +17,12 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.addressing;
+package org.apache.cxf.ws.addressing.impl;
+
+import org.apache.cxf.ws.addressing.AddressingBuilder;
+import org.apache.cxf.ws.addressing.AddressingConstants;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.Names;
 
 
 /**

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingBuilderImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingConstantsImpl.java (from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingConstantsImpl.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingConstantsImpl.java?p2=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingConstantsImpl.java&p1=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingConstantsImpl.java&r1=1230569&r2=1230685&rev=1230685&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingConstantsImpl.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingConstantsImpl.java Thu Jan 12 18:31:47 2012
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.addressing;
+package org.apache.cxf.ws.addressing.impl;
 
 
 import java.util.ResourceBundle;
@@ -26,6 +26,8 @@ import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.util.PackageUtils;
+import org.apache.cxf.ws.addressing.AddressingConstants;
+import org.apache.cxf.ws.addressing.Names;
 
 /**
  * Encapsulation of version-specific WS-Addressing constants.

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingConstantsImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingConstantsImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingFeatureApplier.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingFeatureApplier.java?rev=1230685&view=auto
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingFeatureApplier.java (added)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingFeatureApplier.java Thu Jan 12 18:31:47 2012
@@ -0,0 +1,61 @@
+/**
+ * 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.cxf.ws.addressing.impl;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.interceptor.InterceptorProvider;
+import org.apache.cxf.ws.addressing.WSAddressingFeature;
+import org.apache.cxf.ws.addressing.soap.MAPCodec;
+
+
+/**
+ * 
+ */
+@NoJSR250Annotations
+public class AddressingFeatureApplier implements WSAddressingFeature.WSAddressingFeatureApplier {
+
+    @Override
+    public void initializeProvider(WSAddressingFeature feature, InterceptorProvider provider, Bus bus) {
+        MAPCodec mapCodec = new MAPCodec();
+        MAPAggregatorImpl mapAggregator = new MAPAggregatorImpl();
+        
+        mapAggregator.setAllowDuplicates(feature.isAllowDuplicates());
+        mapAggregator.setUsingAddressingAdvisory(feature.isUsingAddressingAdvisory());
+        mapAggregator.setAddressingRequired(feature.isAddressingRequired());
+        if (feature.getMessageIdCache() != null) {
+            mapAggregator.setMessageIdCache(feature.getMessageIdCache());
+        }
+        mapAggregator.setAddressingResponses(feature.getResponses());
+        
+        provider.getInInterceptors().add(mapAggregator);
+        provider.getInInterceptors().add(mapCodec);
+        
+        provider.getOutInterceptors().add(mapAggregator);
+        provider.getOutInterceptors().add(mapCodec);
+        
+        provider.getInFaultInterceptors().add(mapAggregator);
+        provider.getInFaultInterceptors().add(mapCodec);
+        
+        provider.getOutFaultInterceptors().add(mapAggregator);
+        provider.getOutFaultInterceptors().add(mapCodec);
+    }
+
+}

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingFeatureApplier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingFeatureApplier.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingPropertiesImpl.java (from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingPropertiesImpl.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingPropertiesImpl.java?p2=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingPropertiesImpl.java&p1=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingPropertiesImpl.java&r1=1230569&r2=1230685&rev=1230685&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingPropertiesImpl.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingPropertiesImpl.java Thu Jan 12 18:31:47 2012
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.addressing;
+package org.apache.cxf.ws.addressing.impl;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -25,6 +25,12 @@ import java.util.List;
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.AttributedURIType;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.Names;
+import org.apache.cxf.ws.addressing.RelatesToType;
+
 /**
  * Abstraction of Message Addressing Properties. 
  */
@@ -271,5 +277,10 @@ public class AddressingPropertiesImpl im
         buf.append("]");
         return buf.toString();
         
+    } 
+    
+    public AddressingProperties createCompatibleResponseProperties() {
+        return new AddressingPropertiesImpl(getNamespaceURI());
     }
+
 }

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingPropertiesImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingPropertiesImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingWSDLExtensionLoader.java (from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingWSDLExtensionLoader.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingWSDLExtensionLoader.java?p2=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingWSDLExtensionLoader.java&p1=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingWSDLExtensionLoader.java&r1=1230569&r2=1230685&rev=1230685&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingWSDLExtensionLoader.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingWSDLExtensionLoader.java Thu Jan 12 18:31:47 2012
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.addressing;
+package org.apache.cxf.ws.addressing.impl;
 
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.xml.bind.JAXBException;

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingWSDLExtensionLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/AddressingWSDLExtensionLoader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/DefaultMessageIdCache.java (from r1230569, cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/DefaultMessageIdCache.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/DefaultMessageIdCache.java?p2=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/DefaultMessageIdCache.java&p1=cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/DefaultMessageIdCache.java&r1=1230569&r2=1230685&rev=1230685&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/DefaultMessageIdCache.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/DefaultMessageIdCache.java Thu Jan 12 18:31:47 2012
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.ws.addressing;
+package org.apache.cxf.ws.addressing.impl;
 
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.cxf.ws.addressing.MessageIdCache;
+
 /**
  * An implementation that uses a simple set to store received message IDs.
  * Note that this implementation does not make any attempt to flush older

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/DefaultMessageIdCache.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/DefaultMessageIdCache.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java?rev=1230685&view=auto
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java (added)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java Thu Jan 12 18:31:47 2012
@@ -0,0 +1,423 @@
+/**
+ * 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.cxf.ws.addressing.impl;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.concurrent.Executor;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.binding.soap.SoapBindingConstants;
+import org.apache.cxf.binding.soap.model.SoapOperationInfo;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.endpoint.ConduitSelector;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.NullConduitSelector;
+import org.apache.cxf.endpoint.PreexistingConduitSelector;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.InterceptorChain;
+import org.apache.cxf.interceptor.OutgoingChainInterceptor;
+import org.apache.cxf.io.DelegatingInputStream;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.BindingFaultInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.Extensible;
+import org.apache.cxf.service.model.FaultInfo;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.ConduitInitiator;
+import org.apache.cxf.transport.ConduitInitiatorManager;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.workqueue.OneShotAsyncExecutor;
+import org.apache.cxf.workqueue.SynchronousExecutor;
+import org.apache.cxf.workqueue.WorkQueueManager;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.AttributedURIType;
+import org.apache.cxf.ws.addressing.ContextUtils;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.addressing.Names;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+
+
+
+/**
+ * Holder for utility methods relating to contexts.
+ */
+final class InternalContextUtils {
+    private static final Logger LOG = LogUtils.getL7dLogger(InternalContextUtils.class);
+
+   /**
+    * Prevents instantiation.
+    */
+    private InternalContextUtils() {
+    }
+
+    
+    /**
+     * Rebase response on replyTo
+     * 
+     * @param reference the replyTo reference
+     * @param inMAPs the inbound MAPs
+     * @param inMessage the current message
+     */
+    public static void rebaseResponse(EndpointReferenceType reference,
+                                      AddressingProperties inMAPs,
+                                      final Message inMessage) {
+        
+        String namespaceURI = inMAPs.getNamespaceURI();
+        if (!ContextUtils.retrievePartialResponseSent(inMessage)) {
+            ContextUtils.storePartialResponseSent(inMessage);
+            Exchange exchange = inMessage.getExchange();
+            Message fullResponse = exchange.getOutMessage();
+            Message partialResponse = ContextUtils.createMessage(exchange);
+            ensurePartialResponseMAPs(partialResponse, namespaceURI);
+            
+            // ensure the inbound MAPs are available in the partial response
+            // message (used to determine relatesTo etc.)
+            ContextUtils.propogateReceivedMAPs(inMAPs, partialResponse);
+            partialResponse.put(Message.PARTIAL_RESPONSE_MESSAGE, Boolean.TRUE);
+            partialResponse.put(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE, Boolean.TRUE);
+            Destination target = inMessage.getDestination();
+            if (target == null) {
+                return;
+            }
+            
+            try {
+                if (reference == null) {
+                    reference = ContextUtils.getNoneEndpointReference();
+                }
+                exchange.setOutMessage(partialResponse);
+                Conduit backChannel = target.getBackChannel(inMessage,
+                                                            partialResponse,
+                                                            reference);
+
+                if (backChannel != null) {
+                    // set up interceptor chains and send message
+                    InterceptorChain chain =
+                        fullResponse != null
+                        ? fullResponse.getInterceptorChain()
+                        : OutgoingChainInterceptor.getOutInterceptorChain(exchange);
+                    partialResponse.setInterceptorChain(chain);
+                    exchange.put(ConduitSelector.class,
+                                 new PreexistingConduitSelector(backChannel,
+                                                                exchange.get(Endpoint.class)));
+
+                    if (chain != null && !chain.doIntercept(partialResponse) 
+                        && partialResponse.getContent(Exception.class) != null) {
+                        if (partialResponse.getContent(Exception.class) instanceof Fault) {
+                            throw (Fault)partialResponse.getContent(Exception.class);
+                        } else {
+                            throw new Fault(partialResponse.getContent(Exception.class));
+                        }
+                    }
+                    if (chain != null) {
+                        chain.reset();                        
+                    }
+                    exchange.put(ConduitSelector.class, new NullConduitSelector());
+                    
+                    if (fullResponse == null) {
+                        fullResponse = ContextUtils.createMessage(exchange);
+                    }
+                    exchange.setOutMessage(fullResponse);
+                    
+                    Destination destination = createDecoupledDestination(
+                        exchange, 
+                        reference);
+                    exchange.setDestination(destination);
+                         
+                    
+                    if (ContextUtils.retrieveAsyncPostResponseDispatch(inMessage)) {
+                        //need to suck in all the data from the input stream as
+                        //the transport might discard any data on the stream when this 
+                        //thread unwinds or when the empty response is sent back
+                        DelegatingInputStream in = inMessage.getContent(DelegatingInputStream.class);
+                        if (in != null) {
+                            in.cacheInput();
+                        }
+                        
+                        // async service invocation required *after* a response
+                        // has been sent (i.e. to a oneway, or a partial response
+                        // to a decoupled twoway)
+                        
+        
+                        // pause dispatch on current thread ...
+                        inMessage.getInterceptorChain().pause();
+
+                        // ... and resume on executor thread
+                        getExecutor(inMessage).execute(new Runnable() {
+                            public void run() {
+                                inMessage.getInterceptorChain().resume();
+                            }
+                        });
+                    }
+                }
+            } catch (Exception e) {
+                LOG.log(Level.WARNING, "SERVER_TRANSPORT_REBASE_FAILURE_MSG", e);
+            }
+        }
+    }
+
+    public static Destination createDecoupledDestination(
+        Exchange exchange, final EndpointReferenceType reference) {
+
+        final EndpointInfo ei = exchange.get(Endpoint.class).getEndpointInfo();
+        return new Destination() {
+            public EndpointReferenceType getAddress() {
+                return reference;
+            }
+            public Conduit getBackChannel(Message inMessage, Message partialResponse,
+                                          EndpointReferenceType address) throws IOException {
+                Bus bus = inMessage.getExchange().get(Bus.class);
+                //this is a response targeting a decoupled endpoint.   Treat it as a oneway so
+                //we don't wait for a response.
+                inMessage.getExchange().setOneWay(true);
+                ConduitInitiator conduitInitiator 
+                    = bus.getExtension(ConduitInitiatorManager.class)
+                        .getConduitInitiatorForUri(reference.getAddress().getValue());
+                if (conduitInitiator != null) {
+                    Conduit c = conduitInitiator.getConduit(ei, reference);
+                    // ensure decoupled back channel input stream is closed
+                    c.setMessageObserver(new MessageObserver() {
+                        public void onMessage(Message m) {
+                            InputStream is = m.getContent(InputStream.class);
+                            if (is != null) {
+                                try {
+                                    is.close();
+                                } catch (Exception e) {
+                                    // ignore
+                                }
+                            }
+                        }
+                    });
+                    return c;
+                }
+                return null;
+            }
+            public MessageObserver getMessageObserver() {
+                return null;
+            }
+            public void shutdown() {
+            }
+            public void setMessageObserver(MessageObserver observer) {
+            }
+        };
+    }
+    
+    /**
+     * Construct and store MAPs for partial response.
+     * 
+     * @param partialResponse the partial response message
+     * @param namespaceURI the current namespace URI
+     */
+    private static void ensurePartialResponseMAPs(Message partialResponse,
+                                                 String namespaceURI) {
+        // ensure there is a MAPs instance available for the outbound
+        // partial response that contains appropriate To and ReplyTo
+        // properties (i.e. anonymous & none respectively)
+        AddressingPropertiesImpl maps = new AddressingPropertiesImpl();
+        maps.setTo(EndpointReferenceUtils.getAnonymousEndpointReference());
+        maps.setReplyTo(ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType());
+        maps.getReplyTo().setAddress(ContextUtils.getAttributedURI(Names.WSA_NONE_ADDRESS));
+        maps.setAction(ContextUtils.getAttributedURI(""));
+        maps.exposeAs(namespaceURI);
+        ContextUtils.storeMAPs(maps, partialResponse, true, true, false);
+    }
+
+
+
+    
+    /**
+     * Construct the Action URI.
+     * 
+     * @param message the current message
+     * @return the Action URI
+     */
+    public static AttributedURIType getAction(Message message) {
+        String action = null;
+        LOG.fine("Determining action");
+        Exception fault = message.getContent(Exception.class);
+
+        // REVISIT: add support for @{Fault}Action annotation (generated
+        // from the wsaw:Action WSDL element). For the moment we just
+        // pick up the wsaw:Action attribute by walking the WSDL model
+        // directly 
+        action = getActionFromServiceModel(message, fault);
+        LOG.fine("action: " + action);
+        return action != null ? ContextUtils.getAttributedURI(action) : null;
+    }
+
+    /**
+     * Get action from service model.
+     *
+     * @param message the current message
+     * @param fault the fault if one is set
+     */
+    private static String getActionFromServiceModel(Message message,
+                                                    Exception fault) {
+        String action = null;
+        BindingOperationInfo bindingOpInfo =
+            message.getExchange().get(BindingOperationInfo.class);
+        if (bindingOpInfo != null) {
+            if (bindingOpInfo.isUnwrappedCapable()) {
+                bindingOpInfo = bindingOpInfo.getUnwrappedOperation();
+            }
+            if (fault == null) {
+                action = (String)message.get(ContextUtils.ACTION);
+                if (StringUtils.isEmpty(action)) {
+                    action = (String) message.get(SoapBindingConstants.SOAP_ACTION);
+                }
+                if (action == null || "".equals(action)) {
+                    MessageInfo msgInfo = 
+                        ContextUtils.isRequestor(message)
+                        ? bindingOpInfo.getOperationInfo().getInput()
+                        : bindingOpInfo.getOperationInfo().getOutput();
+                    String cachedAction = (String)msgInfo.getProperty(ContextUtils.ACTION);
+                    if (cachedAction == null) {
+                        action = getActionFromMessageAttributes(msgInfo);
+                    } else {
+                        action = cachedAction;
+                    }
+                    if (action == null && ContextUtils.isRequestor(message)) {
+                        SoapOperationInfo soi = getSoapOperationInfo(bindingOpInfo);
+                        action = soi == null ? null : soi.getAction();
+                        action = StringUtils.isEmpty(action) ? null : action; 
+                    }
+                }
+            } else {
+                Throwable t = fault.getCause();
+                
+                // FaultAction attribute is not defined in 
+                // http://www.w3.org/2005/02/addressing/wsdl schema
+                for (BindingFaultInfo bfi : bindingOpInfo.getFaults()) {
+                    FaultInfo fi = bfi.getFaultInfo();
+                    Class<?> fiTypeClass = fi.getMessagePart(0).getTypeClass();
+                    if (t != null 
+                            && fiTypeClass != null
+                            && t.getClass().isAssignableFrom(fiTypeClass)) {
+                        if (fi.getExtensionAttributes() == null) {
+                            continue;
+                        }
+                        String attr = (String)
+                            fi.getExtensionAttributes().get(Names.WSAW_ACTION_QNAME);
+                        if (attr == null) {
+                            attr = (String)        
+                                fi.getExtensionAttributes()
+                                    .get(new QName(Names.WSA_NAMESPACE_WSDL_NAME_OLD,
+                                                    Names.WSAW_ACTION_NAME));                            
+                        }
+                        if (attr != null) {
+                            action = attr;
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        LOG.fine("action determined from service model: " + action);
+        return action;
+    }
+
+    public static SoapOperationInfo getSoapOperationInfo(BindingOperationInfo bindingOpInfo) {
+        SoapOperationInfo soi = bindingOpInfo.getExtensor(SoapOperationInfo.class);
+        if (soi == null && bindingOpInfo.isUnwrapped()) {
+            soi = bindingOpInfo.getWrappedOperation()
+                .getExtensor(SoapOperationInfo.class);
+        }
+        return soi;
+    }
+
+    /**
+     * Get action from attributes on MessageInfo
+     *
+     * @param bindingOpInfo the current BindingOperationInfo
+     * @param msgInfo the current MessageInfo
+     * @return the action if set
+     */
+    private static String getActionFromMessageAttributes(MessageInfo msgInfo) {
+        String action = null;
+        if (msgInfo != null
+            && msgInfo.getExtensionAttributes() != null) {
+            String attr = getAction(msgInfo);
+            if (!StringUtils.isEmpty(attr)) {
+                action = attr;
+                msgInfo.setProperty(ContextUtils.ACTION, action);
+            }
+        }
+        return action;
+    }
+
+    public static String getAction(Extensible ext) {
+        Object o = ext.getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME);
+        if (o == null) {
+            o = ext.getExtensionAttributes().get(new QName(Names.WSA_NAMESPACE_WSDL_METADATA,
+                                                           Names.WSAW_ACTION_NAME));
+        }
+        if (o == null) {
+            o = ext.getExtensionAttributes().get(new QName(JAXWSAConstants.NS_WSA, Names.WSAW_ACTION_NAME));
+        }
+        if (o == null) {
+            o = ext.getExtensionAttributes().get(new QName(Names.WSA_NAMESPACE_WSDL_NAME_OLD,
+                                                   Names.WSAW_ACTION_NAME));
+        }
+        if (o instanceof QName) {
+            return ((QName)o).getLocalPart();
+        }
+        return o == null ? null : o.toString();
+    }
+
+    /**
+     * Get the Executor for this invocation.
+     * @param endpoint
+     * @return
+     */
+    private static Executor getExecutor(final Message message) {
+        Endpoint endpoint = message.getExchange().get(Endpoint.class);
+        Executor executor = endpoint.getService().getExecutor();
+        
+        if (executor == null || SynchronousExecutor.isA(executor)) {
+            // need true asynchrony
+            Bus bus = message.getExchange().get(Bus.class);
+            if (bus != null) {
+                WorkQueueManager workQueueManager =
+                    bus.getExtension(WorkQueueManager.class);
+                Executor autoWorkQueue =
+                    workQueueManager.getNamedWorkQueue("ws-addressing");
+                executor = autoWorkQueue != null
+                           ? autoWorkQueue
+                           :  workQueueManager.getAutomaticWorkQueue();
+            } else {
+                executor = OneShotAsyncExecutor.getInstance();
+            }
+        }
+        message.getExchange().put(Executor.class, executor);
+        return executor;
+    }
+ 
+}

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message