cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r707195 - in /cxf/branches/2.0.x-fixes: rt/core/src/main/java/org/apache/cxf/attachment/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/ rt/frontend/simple/src/main/java/or...
Date Wed, 22 Oct 2008 21:13:10 GMT
Author: dkulp
Date: Wed Oct 22 14:13:10 2008
New Revision: 707195

URL: http://svn.apache.org/viewvc?rev=707195&view=rev
Log:
More stuff to get the async stuff ported to 2.0.x.

Modified:
    cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/LazyAttachmentCollection.java
    cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
    cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
    cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java

Modified: cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/LazyAttachmentCollection.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/LazyAttachmentCollection.java?rev=707195&r1=707194&r2=707195&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/LazyAttachmentCollection.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/LazyAttachmentCollection.java
Wed Oct 22 14:13:10 2008
@@ -19,14 +19,22 @@
 package org.apache.cxf.attachment;
 
 import java.io.IOException;
+import java.util.AbstractCollection;
+import java.util.AbstractSet;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.activation.DataHandler;
 
 import org.apache.cxf.message.Attachment;
 
-public class LazyAttachmentCollection implements Collection<Attachment> {
+public class LazyAttachmentCollection 
+    implements Collection<Attachment> {
+    
     private AttachmentDeserializer deserializer;
     private final List<Attachment> attachments = new ArrayList<Attachment>();
     
@@ -140,7 +148,175 @@
         
         return attachments.toArray(arg0);
     }
+    
+    public Map<String, DataHandler> createDataHandlerMap() {
+        return new LazyAttachmentMap(this);
+    }
+
+    private static class LazyAttachmentMap implements Map<String, DataHandler> {
+        LazyAttachmentCollection collection;
+        
+        LazyAttachmentMap(LazyAttachmentCollection c) {
+            collection = c;
+        }
+        
+        public void clear() {
+            collection.clear();
+        }
+
+        public boolean containsKey(Object key) {
+            Iterator<Attachment> it = collection.iterator();
+            while (it.hasNext()) {
+                Attachment at = it.next();
+                if (key.equals(at.getId())) {
+                    return true;
+                }
+            }
+            return false;
+        }
 
+        public boolean containsValue(Object value) {
+            Iterator<Attachment> it = collection.iterator();
+            while (it.hasNext()) {
+                Attachment at = it.next();
+                if (value.equals(at.getDataHandler())) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public DataHandler get(Object key) {
+            Iterator<Attachment> it = collection.iterator();
+            while (it.hasNext()) {
+                Attachment at = it.next();
+                if (key.equals(at.getId())) {
+                    return at.getDataHandler();
+                }
+            }
+            return null;
+        }
+
+        public boolean isEmpty() {
+            return collection.isEmpty();
+        }
+        public int size() {
+            return collection.size();
+        }
+        
+        public DataHandler remove(Object key) {
+            Iterator<Attachment> it = collection.iterator();
+            while (it.hasNext()) {
+                Attachment at = it.next();
+                if (key.equals(at.getId())) {
+                    collection.remove(at);
+                    return at.getDataHandler();
+                }
+            }
+            return null;
+        }
+        public DataHandler put(String key, DataHandler value) {
+            Attachment at = new AttachmentImpl(key, value);
+            collection.add(at);
+            return value;
+        }
+
+        public void putAll(Map<? extends String, ? extends DataHandler> t) {
+            for (Map.Entry<? extends String, ? extends DataHandler> ent : t.entrySet())
{
+                put(ent.getKey(), ent.getValue());
+            }
+        }
+
+        
+        public Set<Map.Entry<String, DataHandler>> entrySet() {
+            return new AbstractSet<Map.Entry<String, DataHandler>>() {
+                public Iterator<Map.Entry<String, DataHandler>> iterator() {
+                    return new Iterator<Map.Entry<String, DataHandler>>() {
+                        Iterator<Attachment> it = collection.iterator();
+                        public boolean hasNext() {
+                            return it.hasNext();
+                        }
+                        public Map.Entry<String, DataHandler> next() {
+                            return new Map.Entry<String, DataHandler>() {
+                                Attachment at = it.next();
+                                public String getKey() {
+                                    return at.getId();
+                                }
+                                public DataHandler getValue() {
+                                    return at.getDataHandler();
+                                }
+                                public DataHandler setValue(DataHandler value) {
+                                    if (at instanceof AttachmentImpl) {
+                                        DataHandler h = at.getDataHandler();
+                                        ((AttachmentImpl)at).setDataHandler(value);
+                                        return h;
+                                    } else {
+                                        throw new UnsupportedOperationException();
+                                    }
+                                }
+                            };
+                        }
+                        public void remove() {
+                            it.remove();
+                        }
+                    };
+                }
+                public int size() {
+                    return collection.size();
+                }
+            };
+        }
+
+        public Set<String> keySet() {
+            return new AbstractSet<String>() {
+                public Iterator<String> iterator() {
+                    return new Iterator<String>() {
+                        Iterator<Attachment> it = collection.iterator();
+                        public boolean hasNext() {
+                            return it.hasNext();
+                        }
+
+                        public String next() {
+                            return it.next().getId();
+                        }
+
+                        public void remove() {
+                            it.remove();
+                        }
+                    };
+                }
+
+                public int size() {
+                    return collection.size();
+                }
+            };
+        }
+
+
+        public Collection<DataHandler> values() {
+            return new AbstractCollection<DataHandler>() {
+                public Iterator<DataHandler> iterator() {
+                    return new Iterator<DataHandler>() {
+                        Iterator<Attachment> it = collection.iterator();
+                        public boolean hasNext() {
+                            return it.hasNext();
+                        }
+                        public DataHandler next() {
+                            return it.next().getDataHandler();
+                        }
+                        public void remove() {
+                            it.remove();
+                        }
+                    };
+                }
+
+                public int size() {
+                    return collection.size();
+                }
+            };
+        }
+        
+    }
 
 
 }

Modified: cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java?rev=707195&r1=707194&r2=707195&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
Wed Oct 22 14:13:10 2008
@@ -105,6 +105,9 @@
 
         client.getRequestContext().put(Method.class.getName(), method);
         boolean isAsync = method.getName().endsWith("Async");
+        
+        // need to do context mapping from jax-ws to cxf message
+        ContextPropertiesMapping.mapRequestfromJaxws2Cxf(client.getRequestContext());
 
         Object result = null;
         try {
@@ -269,11 +272,11 @@
 
     
     public Map<String, Object> getRequestContext() {
-        return new WrappedMessageContext(this.getClient().getRequestContext(),
+        return new WrappedMessageContext(this.getClient().getRequestContext(), null,
                                          Scope.APPLICATION);
     }
     public Map<String, Object> getResponseContext() {
-        return new WrappedMessageContext(this.getClient().getResponseContext(),
+        return new WrappedMessageContext(this.getClient().getResponseContext(), null,
                                                           Scope.APPLICATION);
     }
 
@@ -281,16 +284,4 @@
         return binding;
     }
 
-    /*
-    //  TODO JAX-WS 2.1
-    public EndpointReference getEndpointReference() {
-        // TODO
-        throw new UnsupportedOperationException();
-    }
-
-    public <T extends EndpointReference> T getEndpointReference(Class<T> clazz)
{
-        // TODO
-        throw new UnsupportedOperationException();
-    }    
-    */
 }

Modified: cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java?rev=707195&r1=707194&r2=707195&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java
Wed Oct 22 14:13:10 2008
@@ -20,129 +20,381 @@
 package org.apache.cxf.jaxws.context;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
 
+import javax.activation.DataHandler;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
 
+import org.apache.cxf.attachment.LazyAttachmentCollection;
+import org.apache.cxf.binding.soap.SoapBindingConstants;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 
 public class WrappedMessageContext implements MessageContext {
     public static final String SCOPES = WrappedMessageContext.class.getName() + ".SCOPES";
     
-    private final Map<String, Object> contextMap;
-    private final Message message;
+    private static Map<String, String> cxf2jaxwsMap = new HashMap<String, String>();
+    private static Map<String, String> jaxws2cxfMap = new HashMap<String, String>();
+    
+    static {
+        cxf2jaxwsMap.put(Message.ENDPOINT_ADDRESS, 
+                          BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+        cxf2jaxwsMap.put(Message.MAINTAIN_SESSION,
+                         BindingProvider.SESSION_MAINTAIN_PROPERTY);
+        
+        cxf2jaxwsMap.put(Message.HTTP_REQUEST_METHOD,
+                          MessageContext.HTTP_REQUEST_METHOD);
+        cxf2jaxwsMap.put(Message.RESPONSE_CODE, 
+                          MessageContext.HTTP_RESPONSE_CODE);        
+        cxf2jaxwsMap.put(Message.PATH_INFO, 
+                          MessageContext.PATH_INFO);
+        cxf2jaxwsMap.put(Message.QUERY_STRING, 
+                          MessageContext.QUERY_STRING);
+        cxf2jaxwsMap.put("HTTP.REQUEST", 
+                         MessageContext.SERVLET_REQUEST);
+        cxf2jaxwsMap.put("HTTP.RESPONSE", 
+                         MessageContext.SERVLET_RESPONSE);
+        cxf2jaxwsMap.put("HTTP.CONTEXT", 
+                         MessageContext.SERVLET_CONTEXT);
+       
+        jaxws2cxfMap.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
+                         Message.ENDPOINT_ADDRESS);
+        jaxws2cxfMap.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, 
+                         Message.MAINTAIN_SESSION);
+                
+        jaxws2cxfMap.put(MessageContext.HTTP_REQUEST_METHOD,
+                         Message.HTTP_REQUEST_METHOD);
+        jaxws2cxfMap.put(MessageContext.HTTP_RESPONSE_CODE,
+                         Message.RESPONSE_CODE);        
+        jaxws2cxfMap.put(MessageContext.PATH_INFO,
+                         Message.PATH_INFO);
+        jaxws2cxfMap.put(MessageContext.QUERY_STRING,
+                         Message.QUERY_STRING);
+        
+        jaxws2cxfMap.put(MessageContext.SERVLET_REQUEST, 
+                         "HTTP.REQUEST"); 
+        jaxws2cxfMap.put(MessageContext.SERVLET_RESPONSE, 
+                         "HTTP.RESPONSE");
+        jaxws2cxfMap.put(MessageContext.SERVLET_CONTEXT, 
+                        "HTTP.CONTEXT");
+        
+        jaxws2cxfMap.put(BindingProvider.SOAPACTION_URI_PROPERTY, SoapBindingConstants.SOAP_ACTION);
+    }
+
+    private final Map<String, Object> message;
+    private final Map<String, Object> reqMessage;
+    private final Exchange exchange;
     private Map<String, Scope> scopes;
     private Scope defaultScope;
 
     public WrappedMessageContext(Message m) {
-        this(m, m, Scope.HANDLER);
+        this(m, Scope.HANDLER);
     }
     public WrappedMessageContext(Message m, Scope defScope) {
-        this(m, m, defScope);
-    }
-    
-    public WrappedMessageContext(Map<String, Object> m, Scope defScope) {
-        this(null, m, defScope);
-    }
-    
-    public WrappedMessageContext(Message m, Map<String, Object> map, Scope defScope)
{
+        this(m, m.getExchange(), defScope);
+    }    
+    public WrappedMessageContext(Map<String, Object> m, Exchange ex, Scope defScope)
{
         message = m;
-        contextMap = map;
+        exchange = ex;
         defaultScope = defScope;
-        scopes = CastUtils.cast((Map<?, ?>)contextMap.get(SCOPES));
-        if (scopes == null && message != null && message.getExchange() !=
null) { 
-            if (isRequestor() && !isOutbound() && m.getExchange().getOutMessage()
!= null) {
-                scopes = CastUtils.cast((Map<?, ?>)m.getExchange().getOutMessage().get(SCOPES));
-                copyScopedProperties(m.getExchange().getOutMessage());
-                m.put(SCOPES, scopes);
-            } else if (!isRequestor() && isOutbound() && m.getExchange().getInMessage()
!= null) {
-                scopes = CastUtils.cast((Map<?, ?>)m.getExchange().getInMessage().get(SCOPES));
-                copyScopedProperties(m.getExchange().getInMessage());
+        scopes = CastUtils.cast((Map<?, ?>)message.get(SCOPES));
+        
+        if (isResponse() && exchange != null) {
+            if (isRequestor()) {
+                reqMessage = exchange.getOutMessage();
+            } else {
+                reqMessage = exchange.getInMessage();
+            }
+        } else {
+            reqMessage = null;
+        }
+        
+        if (scopes == null && reqMessage != null) {
+            scopes = CastUtils.cast((Map<?, ?>)reqMessage.get(SCOPES));
+            if (scopes != null) {
                 m.put(SCOPES, scopes);
+                copyScoped(reqMessage);
             }
         }
         if (scopes == null) {
             scopes = new HashMap<String, Scope>();
-            contextMap.put(SCOPES, scopes);
+            message.put(SCOPES, scopes);
+        }
+    }
+    private void copyScoped(Map<String, Object> msg) {
+        for (String s : scopes.keySet()) {
+            message.put(s, msg.get(s));
         }
     }
     
-    protected final void copyScopedProperties(Message m) {
-        for (String k : scopes.keySet()) {
-            if (!contextMap.containsKey(k)
-                && !MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(k)) {
-                contextMap.put(k, m.get(k));
-            }
+    private String mapKey(String key) {
+        String k2 = jaxws2cxfMap.get(key);
+        if (k2 != null) {
+            return k2;
         }
+        return key;
+    }
+    private String mapKeyReverse(String key) {
+        String k2 = cxf2jaxwsMap.get(key);
+        if (k2 != null) {
+            return k2;
+        }
+        if (Message.PROTOCOL_HEADERS.equals(key)) {
+            return isResponse() ? MessageContext.HTTP_RESPONSE_HEADERS : MessageContext.HTTP_REQUEST_HEADERS;
+        }
+        return key;
+    }
+    
+    
+    protected final boolean isResponse() {
+        return isOutbound() ^ isRequestor();
     }
     protected final boolean isRequestor() {
-        return Boolean.TRUE.equals(contextMap.containsKey(Message.REQUESTOR_ROLE));
+        return Boolean.TRUE.equals(message.containsKey(Message.REQUESTOR_ROLE));
     }
     protected final boolean isOutbound() {
-        Exchange ex = message.getExchange();
         return message != null 
-            && (message == ex.getOutMessage()
-                || message == ex.getOutFaultMessage());
+            && exchange != null
+            && (message == exchange.getOutMessage()
+                || message == exchange.getOutFaultMessage());
     }
     
     public final Message getWrappedMessage() {
-        return message;
+        return message instanceof Message ? (Message)message : null;
     }
     public final Map<String, Object> getWrappedMap() {
         return message;
     }
     
     public void clear() {
-        contextMap.clear();      
+        //just clear the JAXWS things....
+        for (String key : jaxws2cxfMap.keySet()) {
+            remove(key);
+        }
     }
 
     public final boolean containsKey(Object key) {
-        return contextMap.containsKey(key);
+        return message.containsKey(mapKey((String)key));
     }
 
     public final boolean containsValue(Object value) {
-        return contextMap.containsValue(value);
-    }
-
-    public final Set<Entry<String, Object>> entrySet() {
-        return contextMap.entrySet();
+        return message.containsValue(value);
     }
 
-    public final Object get(Object key) {
-        Object ret = contextMap.get(key);
-        if (ret == null
-            && Message.class.getName().equals(key)) {
-            return message;
+    public Object get(Object key) {
+        String mappedkey = mapKey((String)key);
+        Object ret = message.get(mappedkey);
+        if (ret == null) {
+            if (Message.class.getName().equals(mappedkey)) {
+                return message;
+            }
+            if (exchange != null) {
+                ret = exchange.get(mappedkey);
+                if (ret != null) {
+                    return ret;
+                }
+            }
+            if (MessageContext.INBOUND_MESSAGE_ATTACHMENTS.equals(key)) {
+                if (isOutbound()) {
+                    ret = reqMessage.get(key);
+                }
+                ret = createAttachments(getWrappedMessage(), MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
+            } else if (MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS.equals(key)) {
+                ret = createAttachments(isRequestor() ? getWrappedMessage() : createResponseMessage(),
+                    MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+            } else if (MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(key)) {
+                ret = isOutbound();
+            } else if (MessageContext.HTTP_REQUEST_HEADERS.equals(key)) {
+                if (!isResponse()) {
+                    ret = message.get(Message.PROTOCOL_HEADERS);
+                } else if (reqMessage != null && !isRequestor()) {
+                    ret = reqMessage.get(Message.PROTOCOL_HEADERS);
+                }
+            } else if (MessageContext.HTTP_RESPONSE_HEADERS.equals(key)) {
+                Map mp = null;
+                if (isResponse()) {
+                    mp = (Map)message.get(Message.PROTOCOL_HEADERS);
+                } else if (exchange != null) {
+                    //may have to create the out message and add the headers
+                    Message tmp = createResponseMessage();
+                    if (tmp != null) {
+                        ret = (Map)tmp.get(Message.PROTOCOL_HEADERS);
+                    }
+                }
+                ret = mp;
+            } else if (BindingProvider.USERNAME_PROPERTY.equals(key)) {
+                AuthorizationPolicy authPolicy =
+                    (AuthorizationPolicy)message.get(AuthorizationPolicy.class.getName());
+                if (authPolicy != null) {
+                    ret = authPolicy.getUserName();
+                }
+            } else if (BindingProvider.PASSWORD_PROPERTY.equals(key)) {
+                AuthorizationPolicy authPolicy =
+                    (AuthorizationPolicy)message.get(AuthorizationPolicy.class.getName());
+                if (authPolicy != null) {
+                    ret = authPolicy.getPassword();
+                }
+            }
+            
+            if (ret == null && reqMessage != null) { 
+                ret = reqMessage.get(mappedkey);
+            }
         }
         return ret;
     }
 
+    private Message createResponseMessage() {
+        if (exchange == null || exchange.isOneWay()) {
+            return null;
+        }
+        if (isResponse()) {
+            return getWrappedMessage();
+        }
+        Message m = null;
+        if (isRequestor()) {
+            m = exchange.getInFaultMessage();
+            if (m == null) {
+                m = exchange.getInMessage();
+            }
+            if (m == null) {
+                Endpoint ep = exchange.get(Endpoint.class);
+                m = ep.getBinding().createMessage();
+                exchange.setInMessage(m);
+            }
+        } else {
+            m = exchange.getOutMessage();
+            if (m == null) {
+                m = exchange.getOutFaultMessage();
+            }
+            if (m == null) {
+                Endpoint ep = exchange.get(Endpoint.class);
+                m = ep.getBinding().createMessage();
+                exchange.setOutMessage(m);
+            }
+        }
+        return m;
+    }
+    private Object createAttachments(Message mc, String propertyName) {
+        if (mc == null) {
+            return null;
+        }
+        Collection<Attachment> attachments = mc.getAttachments();
+        Map<String, DataHandler> dataHandlers = getDHMap(attachments);
+        mc.put(propertyName, 
+               dataHandlers);
+        scopes.put(propertyName, Scope.APPLICATION);
+        return dataHandlers;
+    }    
+    private static Map<String, DataHandler> getDHMap(Collection<Attachment> attachments)
{
+        Map<String, DataHandler> dataHandlers = null;
+        if (attachments != null) {
+            if (attachments instanceof LazyAttachmentCollection) {
+                dataHandlers = ((LazyAttachmentCollection)attachments).createDataHandlerMap();
+            } else {
+                //preserve the order of iteration
+                dataHandlers = new LinkedHashMap<String, DataHandler>();
+                for (Attachment attachment : attachments) {
+                    dataHandlers.put(attachment.getId(), attachment.getDataHandler());
+                }
+            }
+        }
+        return dataHandlers == null ? new LinkedHashMap<String, DataHandler>() : dataHandlers;
+    }    
     public final boolean isEmpty() {
-        return contextMap.isEmpty();
+        return message.isEmpty();
     }
 
+    // map to jaxws
     public final Set<String> keySet() {
-        return contextMap.keySet();
+        Set<String> set = new HashSet<String>();
+        for (String s : message.keySet()) {
+            set.add(s);
+            set.add(mapKeyReverse(s));
+        }
+        return Collections.unmodifiableSet(set);
+    }
+    public final Set<Entry<String, Object>> entrySet() {
+        Set<Entry<String, Object>> set = new HashSet<Entry<String, Object>>();
+        for (Map.Entry<String, Object> s : message.entrySet()) {
+            set.add(s);
+            
+            final String s2 = mapKeyReverse(s.getKey());
+            final Object o = s.getValue();
+            if (s2.equals(s.getKey())) {
+                Map.Entry<String, Object> entry = new Map.Entry<String, Object>()
{
+                    public String getKey() {
+                        return s2;
+                    }
+                    public Object getValue() {
+                        return o;
+                    }
+                    public Object setValue(Object value) {
+                        throw new UnsupportedOperationException();
+                    }
+                };
+                set.add(entry);
+            }
+        }
+        return Collections.unmodifiableSet(set);
     }
 
+
     public final Object put(String key, Object value) {
-        if (!MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(key)
-            && !scopes.containsKey(key)) {
-            scopes.put(key, defaultScope);
-        }
-        return contextMap.put(key, value);
+        return put(key, value, defaultScope);
     }
     public final Object put(String key, Object value, Scope scope) {
-        if (!MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(key)) {
-            scopes.put(key, scope);
+        String mappedKey = mapKey(key);
+        if (!MessageContext.MESSAGE_OUTBOUND_PROPERTY.equals(mappedKey)) {
+            scopes.put(mappedKey, scope);
+        }
+        if ((MessageContext.HTTP_RESPONSE_HEADERS.equals(key)
+            || MessageContext.HTTP_RESPONSE_CODE.equals(key)
+            || MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS.equals(key)
+            || MessageContext.HTTP_RESPONSE_CODE.equals(key))
+            && !isResponse() && !isRequestor()) { 
+            Message tmp = createResponseMessage();
+            if (tmp != null) {
+                if (MessageContext.HTTP_RESPONSE_HEADERS.equals(key)) {
+                    return tmp.put(Message.PROTOCOL_HEADERS, value);
+                } else {
+                    return tmp.put(mappedKey, value);
+                }
+            }
+            return null;
+        } else if (BindingProvider.USERNAME_PROPERTY.equals(key)) {
+            AuthorizationPolicy authPolicy =
+                (AuthorizationPolicy)message.get(AuthorizationPolicy.class.getName());
+            if (authPolicy == null) {
+                authPolicy = new AuthorizationPolicy();
+                message.put(AuthorizationPolicy.class.getName(), authPolicy);
+            }
+            String ret = authPolicy.getUserName();
+            authPolicy.setUserName((String)value);
+            return ret;
+        } else if (BindingProvider.PASSWORD_PROPERTY.equals(key)) {
+            AuthorizationPolicy authPolicy =
+                (AuthorizationPolicy)message.get(AuthorizationPolicy.class.getName());
+            if (authPolicy == null) {
+                authPolicy = new AuthorizationPolicy();
+                message.put(AuthorizationPolicy.class.getName(), authPolicy);
+            }
+            String ret = authPolicy.getPassword();
+            authPolicy.setPassword((String)value);
+            return ret;
+        } else {
+            return message.put(mappedKey, value);
         }
-        return contextMap.put(key, value);
     }
 
     public final void putAll(Map<? extends String, ? extends Object> t) {
@@ -152,6 +404,7 @@
     }
 
     public final Object remove(Object key) {
+        key = mapKey((String)key);
         scopes.remove(key);
         if (BindingProvider.PASSWORD_PROPERTY.equals(key) 
             || BindingProvider.USERNAME_PROPERTY.equals(key)) {
@@ -161,11 +414,11 @@
     }
 
     public final int size() {
-        return contextMap.size();
+        return message.size();
     }
 
     public final Collection<Object> values() {
-        return contextMap.values();
+        return message.values();
     }
 
     public final void setScope(String key, Scope arg1) {

Modified: cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=707195&r1=707194&r2=707195&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Wed Oct 22 14:13:10 2008
@@ -279,8 +279,8 @@
     }
     
     protected void buildServiceFromWSDL(String url) {
-        if (LOG.isLoggable(Level.FINE)) {
-            LOG.fine("Creating Service " + getServiceQName() + " from WSDL: " + url);
+        if (LOG.isLoggable(Level.INFO)) {
+            LOG.info("Creating Service " + getServiceQName() + " from WSDL: " + url);
         }
         populateFromClass = false;
         WSDLServiceFactory factory = new WSDLServiceFactory(getBus(), url, getServiceQName());
@@ -302,8 +302,8 @@
     }
 
     protected void buildServiceFromClass() {
-        if (LOG.isLoggable(Level.FINE)) {
-            LOG.fine("Creating Service " + getServiceQName() + " from class " + getServiceClass().getName());
+        if (LOG.isLoggable(Level.INFO)) {
+            LOG.info("Creating Service " + getServiceQName() + " from class " + getServiceClass().getName());
         }
         populateFromClass = true;
 

Modified: cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java?rev=707195&r1=707194&r2=707195&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java
(original)
+++ cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java
Wed Oct 22 14:13:10 2008
@@ -41,10 +41,6 @@
         return CONFIG;
     }
     
-    @Test
-    public void foo() {
-        
-    }
     
     @Test
     public void testUsingKeepAliveConnection() throws Exception {



Mime
View raw message