cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r446583 [1/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/binding/ api/src/main/java/org/apache/cxf/interceptor/ api/src/main/java/org/apache/cxf/message/ api/src/main/java/org/apache/cxf/phase/ api/src/main/java/org/apache/...
Date Fri, 15 Sep 2006 11:51:44 GMT
Author: dandiep
Date: Fri Sep 15 04:51:40 2006
New Revision: 446583

URL: http://svn.apache.org/viewvc?view=rev&rev=446583
Log:
o Completed logic to turn a SoapFault into a message on the wire.
  Still need to convert JAX-WS exceptions to SoapFaults (see 
  OutFaultConverterInterceptor)
o Added Session class
o Added Factory/Invokers to support different scopes. Some of these
  factory classes probably aren't needed. I need to do a second
  run through and figure out exactly what the requirements are.
o Return a better error message in AbstractCXFTest if the resource 
  isn't there.

Added:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Session.java   (with props)
    incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/
    incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/AbstractPool.java   (with props)
    incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/CachingPool.java   (with props)
    incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Factory.java   (with props)
    incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Pool.java   (with props)
    incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/PooledFactory.java   (with props)
    incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/ThreadSingletonPool.java   (with props)
    incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/package.html   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ApplicationScopePolicy.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/BeanInvoker.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/LocalFactory.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/RequestScopePolicy.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicy.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicyEditor.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionScopePolicy.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/OutFaultConverterInterceptor.java   (with props)
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPSession.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/GreeterGetFaultMessage.xml   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/SoapFaultTest.java   (with props)
Removed:
    incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindings/
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SimpleMethodInvoker.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/Messages.properties
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptors/
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/Binding.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Fault.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapFault.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AttachmentOutInterceptor.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FaultChainIntiatorInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/OutgoingChainInterceptorTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBeanTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/GreeterTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/Binding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/Binding.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/Binding.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/Binding.java Fri Sep 15 04:51:40 2006
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.binding;
 
-import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.interceptor.InterceptorProvider;
 import org.apache.cxf.message.Message;
 
@@ -28,8 +27,4 @@
     Message createMessage();
 
     Message createMessage(Message m);
-    
-    Interceptor getOutFaultInterceptor();
-    
-    Interceptor getInFaultInterceptor();
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Fault.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Fault.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Fault.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Fault.java Fri Sep 15 04:51:40 2006
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.interceptor;
 
+import org.w3c.dom.Element;
+
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.i18n.UncheckedException;
 
@@ -26,6 +28,8 @@
  * A Fault that occurs during invocation processing.
  */
 public class Fault extends UncheckedException {
+
+    private Element detail;
     
     public Fault(Message message, Throwable throwable) {
         super(message, throwable);
@@ -39,5 +43,34 @@
         super(t);
     }
 
+    
+    /**
+     * Returns the detail node. If no detail node has been set, an empty
+     * <code>&lt;detail&gt;</code> is created.
+     * 
+     * @return the detail node.
+     */
+    public Element getDetail() {
+        return detail;
+    }
+
+    /**
+     * Sets a details <code>Node</code> on this fault.
+     * 
+     * @param details the detail node.
+     */
+    public void setDetail(Element details) {
+        detail = details;
+    }
+
+    /**
+     * Indicates whether this fault has a detail message.
+     * 
+     * @return <code>true</code> if this fault has a detail message;
+     *         <code>false</code> otherwise.
+     */
+    public boolean hasDetails() {
+        return detail == null ? false : true;
+    }
 
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java Fri Sep 15 04:51:40 2006
@@ -149,5 +149,9 @@
     public <T> void put(Class<T> key, T value) {
         message.put(key, value);
     }
+
+    public Object getContextualProperty(String key) {
+        return message.getContextualProperty(key);
+    }
     
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java Fri Sep 15 04:51:40 2006
@@ -23,6 +23,7 @@
 
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.Session;
 
 public interface Exchange extends Map<String, Object> {
     Message getInMessage();
@@ -30,6 +31,11 @@
     
     Message getOutMessage();
     void setOutMessage(Message m);
+    
+    Message getFaultMessage();
+    void setFaultMessage(Message m);
+    
+    Session getSession();
     
     /**
      * @return the associated incoming Destination (may be anonymous)

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java Fri Sep 15 04:51:40 2006
@@ -23,6 +23,7 @@
 
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.Session;
 
 public class ExchangeImpl extends HashMap<String, Object> implements Exchange {
 
@@ -32,7 +33,9 @@
     
     private Message inMessage;
     private Message outMessage;
+    private Message faultMessage;
     
+    private Session session;
     
     public Destination getDestination() {
         return destination;
@@ -50,6 +53,15 @@
         return outMessage;
     }
 
+    public Message getFaultMessage() {
+        return faultMessage;
+    }
+
+    public void setFaultMessage(Message m) {
+        this.faultMessage = m;
+        m.setExchange(this);
+    }
+
     public void setDestination(Destination d) {
         destination = d;
     }
@@ -84,4 +96,11 @@
         oneWay = b;
     }
 
+    public Session getSession() {
+        return session;
+    }
+
+    public void setSession(Session session) {
+        this.session = session;
+    }
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java Fri Sep 15 04:51:40 2006
@@ -97,9 +97,7 @@
     /**
      * @return the set of currently encapsulated content formats
      */
-    Set<Class<?>> getContentFormats();   
-    
-    
+    Set<Class<?>> getContentFormats();
     
     /**
      * Convienience method for storing/retrieving typed objects from the map.
@@ -114,5 +112,7 @@
      * @param <T> key
      * @return
      */
-    <T> void put(Class<T> key, T value);    
+    <T> void put(Class<T> key, T value);
+    
+    Object getContextualProperty(String key);
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java Fri Sep 15 04:51:40 2006
@@ -27,6 +27,9 @@
 import java.util.Set;
 
 import org.apache.cxf.interceptor.InterceptorChain;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 
@@ -107,4 +110,37 @@
     public <T> void put(Class<T> key, T value) {
         put(key.getName(), value);
     }
+
+    public Object getContextualProperty(String key) {
+        Object val = get(key);
+        
+        if (val == null) {
+            val = getExchange().get(key);
+        }
+        
+        if (val == null) {
+            OperationInfo ep = get(OperationInfo.class); 
+            if (ep != null) {
+                val = ep.getProperty(key);
+            }
+        }
+        
+        if (val == null) {
+            EndpointInfo ep = get(EndpointInfo.class); 
+            if (ep != null) {
+                val = ep.getProperty(key);
+            }
+        }
+        
+        if (val == null) {
+            Service ep = get(Service.class); 
+            if (ep != null) {
+                val = ep.get(key);
+            }
+        }
+        
+        return val;
+    }
+    
+    
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java Fri Sep 15 04:51:40 2006
@@ -126,10 +126,9 @@
             try {
                 Interceptor currentInterceptor = iterator.next();
                
-                if (LOG.isLoggable(Level.FINE)) {
-                    LOG.fine("Invoking handleMessage on interceptor " + currentInterceptor);
+                if (LOG.isLoggable(Level.INFO)) {
+                    LOG.info("Invoking handleMessage on interceptor " + currentInterceptor);
                 }
-                //System.out.println("current interceptor is " + currentInterceptor.getClass().getName());
                 currentInterceptor.handleMessage(message);
             } catch (Exception ex) {
                 if (LOG.isLoggable(Level.INFO)) {

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Session.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Session.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Session.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Session.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,43 @@
+/**
+ * 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.transport;
+
+/**
+ * A Session which can be bound to HTTP, WS-Adddressing, etc.
+ * 
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+public interface Session {
+    /**
+     * Get a variable from the session by the key.
+     * 
+     * @param key
+     * @return Value
+     */
+    Object get(Object key);
+
+    /**
+     * Put a variable into the session with a key.
+     * 
+     * @param key
+     * @param value
+     */
+    void put(Object key, Object value);
+}
\ No newline at end of file

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Session.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Session.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Session.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/AbstractPool.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/AbstractPool.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/AbstractPool.java (added)
+++ incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/AbstractPool.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,77 @@
+/**
+ * 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.common.util.factory;
+
+/**
+ * A simple implementation of Pool that uses null to indicate non-existent pool
+ * entry.
+ * <p>
+ * This implementation synchronizes on {@link #getMutex()} for thread safety.
+ * </p>
+ * 
+ * @author Ben Yu Feb 2, 2006 3:14:45 PM
+ */
+public abstract class AbstractPool implements Pool {
+    public Object getInstance(Factory factory) throws Throwable {
+        synchronized (getMutex()) {
+            Object ret = get();
+            if (ret == null) {
+                ret = factory.create();
+                set(ret);
+            }
+            return ret;
+        }
+    }
+
+    public Object getPooledInstance(Object def) {
+        synchronized (getMutex()) {
+            return ifnull(get(), def);
+        }
+    }
+
+    public boolean isPooled() {
+        synchronized (getMutex()) {
+            return get() != null;
+        }
+    }
+
+    protected static Object ifnull(Object obj, Object def) {
+        return obj == null ? def : obj;
+    }
+
+    /**
+     * Get the pooled instance. null if not found.
+     * 
+     * @return the pooled instance.
+     */
+    public abstract Object get();
+
+    /**
+     * set an value to the pool.
+     * 
+     * @param val the value to be pooled.
+     */
+    public abstract void set(Object val);
+
+    /**
+     * Get the object that can be used to synchronize.
+     */
+    protected abstract Object getMutex();
+}

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/AbstractPool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/AbstractPool.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/AbstractPool.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/CachingPool.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/CachingPool.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/CachingPool.java (added)
+++ incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/CachingPool.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,56 @@
+/**
+ * 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.common.util.factory;
+
+/**
+ * A thread-unsafe implementation of Pool that does simple caching.
+ * <p>
+ * 
+ * @author Ben Yu Feb 2, 2006 12:13:08 PM
+ */
+public class CachingPool implements Pool {
+    private transient Object v;
+
+    private transient boolean pooled;
+
+    private void readObject(java.io.ObjectInputStream in) throws ClassNotFoundException, java.io.IOException {
+        in.defaultReadObject();
+        this.pooled = false;
+    }
+
+    public Object getInstance(Factory factory) throws Throwable {
+        if (!pooled) {
+            v = factory.create();
+            pooled = true;
+        }
+        return v;
+    }
+
+    public Object getPooledInstance(Object def) {
+        return pooled ? v : def;
+    }
+
+    /**
+     * Is this pool currently having something in cache?
+     */
+    public boolean isPooled() {
+        return pooled;
+    }
+}

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/CachingPool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/CachingPool.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/CachingPool.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Factory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Factory.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Factory.java (added)
+++ incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Factory.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,29 @@
+/**
+ * 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.common.util.factory;
+
+/**
+ * Represents an object factory.
+ * <p>
+ * 
+ * @author Ben Yu Jan 6, 2006 12:38:18 AM
+ */
+public interface Factory {
+    Object create() throws Throwable;
+}

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Factory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Factory.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Factory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Pool.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Pool.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Pool.java (added)
+++ incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Pool.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,48 @@
+/**
+ * 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.common.util.factory;
+
+/**
+ * Represents a pooling strategy for certain object instance.
+ * 
+ * @author Ben Yu
+ */
+public interface Pool extends java.io.Serializable {
+    /**
+     * Apply the pooling strategy and return an instance from either the pool or
+     * the factory.
+     * 
+     * @param factory the factory to create the object instance.
+     * @return the object instance.
+     */
+    Object getInstance(Factory factory) throws Throwable;
+
+    /**
+     * Get the instance that's already pooled.
+     * 
+     * @param def the default value to return if there's no pooled instance.
+     * @return the pooled instance or the default object.
+     */
+    Object getPooledInstance(Object def);
+
+    /**
+     * Is this pool currently having something in cache?
+     */
+    boolean isPooled();
+}

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Pool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Pool.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/Pool.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/PooledFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/PooledFactory.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/PooledFactory.java (added)
+++ incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/PooledFactory.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,43 @@
+/**
+ * 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.common.util.factory;
+
+/**
+ * This class decorates a Factory object that uses a Pool strategy to cache the
+ * factory result;
+ * <p>
+ * 
+ * @author Ben Yu Feb 2, 2006 11:57:12 AM
+ */
+public class PooledFactory implements Factory {
+    private final Factory factory;
+
+    private final Pool pool;
+
+    public PooledFactory(Factory factory, Pool pool) {
+        this.factory = factory;
+        this.pool = pool;
+    }
+    
+    public Object create() throws Throwable {
+        return pool.getInstance(factory);
+    }
+
+}

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/PooledFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/PooledFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/PooledFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/ThreadSingletonPool.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/ThreadSingletonPool.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/ThreadSingletonPool.java (added)
+++ incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/ThreadSingletonPool.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,59 @@
+/**
+ * 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.common.util.factory;
+
+/**
+ * Represents a pooling strategy that pools the data into a ThreadLocal object.
+ * 
+ * @author Ben Yu
+ */
+public class ThreadSingletonPool implements Pool {
+    private static final class ThreadLocalCache extends ThreadLocal {
+        protected Object initialValue() {
+            return new CachingPool();
+        }
+
+        CachingPool getPool() {
+            return (CachingPool)this.get();
+        }
+    }
+
+    private transient ThreadLocalCache cache = new ThreadLocalCache();
+
+    private void readObject(java.io.ObjectInputStream in) throws ClassNotFoundException, java.io.IOException {
+        in.defaultReadObject();
+        cache = new ThreadLocalCache();
+    }
+
+    public Object getInstance(Factory factory) throws Throwable {
+        return cache.getPool().getInstance(factory);
+        /*
+         * Object v = cache.get(); if(v==null){ v = factory.create();
+         * cache.set(v); } return v;
+         */
+    }
+
+    public Object getPooledInstance(Object def) {
+        return cache.getPool().getPooledInstance(def);
+    }
+
+    public boolean isPooled() {
+        return cache.getPool().isPooled();
+    }
+}

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/ThreadSingletonPool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/ThreadSingletonPool.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/ThreadSingletonPool.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/package.html
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/package.html?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/package.html (added)
+++ incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/package.html Fri Sep 15 04:51:40 2006
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+  @(#)package.html	1.60 04/11/24
+
+  This is a simple Factory related package.
+
+-->
+</head>
+<body bgcolor="white">
+
+This package provides interfaces and classes for factory and pool functionality.
+
+</body>
+</html>

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/package.html
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/package.html
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/common/src/main/java/org/apache/cxf/common/util/factory/package.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java Fri Sep 15 04:51:40 2006
@@ -23,8 +23,6 @@
 import java.util.List;
 
 import org.apache.cxf.binding.Binding;
-import org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor;
-import org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor;
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.message.Message;
@@ -35,16 +33,11 @@
     private List<Interceptor> in;
     private List<Interceptor> out;
     private List<Interceptor> fault;
-    private Interceptor outFaultInterceptor;
-    private Interceptor inFaultInterceptor;
     
     public SoapBinding() {
         in = new ArrayList<Interceptor>();
         out = new ArrayList<Interceptor>();
         fault = new ArrayList<Interceptor>();
-        
-        outFaultInterceptor = new Soap11FaultOutInterceptor();
-        inFaultInterceptor = new Soap11FaultInInterceptor();
     }
     
     public Message createMessage() {
@@ -65,13 +58,5 @@
 
     public List<Interceptor> getOutInterceptors() {
         return out;
-    }
-
-    public Interceptor getInFaultInterceptor() {
-        return inFaultInterceptor;
-    }
-
-    public Interceptor getOutFaultInterceptor() {
-        return outFaultInterceptor;
     }
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Fri Sep 15 04:51:40 2006
@@ -45,6 +45,8 @@
 import org.apache.cxf.binding.soap.interceptor.RPCInInterceptor;
 import org.apache.cxf.binding.soap.interceptor.RPCOutInterceptor;
 import org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor;
+import org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor;
+import org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor;
 import org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor;
 import org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor;
 import org.apache.cxf.binding.soap.model.SoapBindingInfo;
@@ -122,6 +124,8 @@
         sb.getInInterceptors().add(new MustUnderstandInterceptor());
         sb.getInInterceptors().add(new StaxInInterceptor());
 
+        sb.getInFaultInterceptors().add(new Soap11FaultInInterceptor());
+        
         sb.getOutInterceptors().add(new AttachmentOutInterceptor());
         sb.getOutInterceptors().add(new StaxOutInterceptor());
         sb.getOutInterceptors().add(new SoapPreProtocolOutInterceptor());
@@ -129,8 +133,8 @@
 
         sb.getOutFaultInterceptors().add(new StaxOutInterceptor());
         sb.getOutFaultInterceptors().add(new SoapOutInterceptor());
-        sb.getOutFaultInterceptors().add(sb.getOutFaultInterceptor());
-
+        sb.getOutFaultInterceptors().add(new Soap11FaultOutInterceptor());
+        
         if (SoapConstants.BINDING_STYLE_RPC.equalsIgnoreCase(bindingStyle)) {
             sb.getInInterceptors().add(new RPCInInterceptor());
             sb.getOutInterceptors().add(new RPCOutInterceptor());

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapFault.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapFault.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapFault.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapFault.java Fri Sep 15 04:51:40 2006
@@ -25,8 +25,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.w3c.dom.Element;
-
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.interceptor.Fault;
 
@@ -60,7 +58,6 @@
     private QName faultCode;
     private QName subCode;
     private String role;
-    private Element detail;
     private Map<String, String> namespaces = new HashMap<String, String>();
     
     public SoapFault(Message message, Throwable throwable, QName type) {
@@ -77,25 +74,6 @@
         super(new Message(message, (ResourceBundle)null));
         this.faultCode = faultCode;
     }
-    
-    /**
-     * Returns the detail node. If no detail node has been set, an empty
-     * <code>&lt;detail&gt;</code> is created.
-     * 
-     * @return the detail node.
-     */
-    public Element getDetail() {
-        return detail;
-    }
-
-    /**
-     * Sets a details <code>Node</code> on this fault.
-     * 
-     * @param details the detail node.
-     */
-    public void setDetail(Element details) {
-        detail = details;
-    }
 
     /**
      * Returns the fault code of this fault.
@@ -154,22 +132,23 @@
     public void setSubCode(QName subCode) {
         this.subCode = subCode;
     }
-
-    /**
-     * Indicates whether this fault has a detail message.
-     * 
-     * @return <code>true</code> if this fault has a detail message;
-     *         <code>false</code> otherwise.
-     */
-    public boolean hasDetails() {
-        return detail == null ? false : true;
-    }
-
+    
     public Map<String, String> getNamespaces() {
         return namespaces;
     }
 
     public void setNamespaces(Map<String, String> namespaces) {
         this.namespaces = namespaces;
+    }
+
+    public static SoapFault createFault(Fault f) {
+        if (f instanceof SoapFault) {
+            return (SoapFault) f;
+        }
+        
+        SoapFault soapFault = new SoapFault(new Message(f.getMessage(), (ResourceBundle)null), f
+            .getCause(), RECEIVER);
+        
+        return soapFault;
     }
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AttachmentOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AttachmentOutInterceptor.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AttachmentOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AttachmentOutInterceptor.java Fri Sep 15 04:51:40 2006
@@ -47,7 +47,13 @@
     public void handleMessage(SoapMessage message) throws Fault {
         // Calling for soap out interceptor        
         message.getInterceptorChain().doIntercept(message);
-        AbstractCachedOutputStream ops = (AbstractCachedOutputStream)message.getContent(OutputStream.class);
+        OutputStream os = message.getContent(OutputStream.class);
+        
+        if (!(os instanceof AbstractCachedOutputStream)) {
+            return;
+        }
+        
+        AbstractCachedOutputStream ops = (AbstractCachedOutputStream) os;
         try {
             Collection<Attachment> attachments = message.getAttachments();
             if (attachments.size() > 0) {
@@ -61,6 +67,4 @@
                                 SoapFault.ATTACHMENT_IO);
         }
     }
-
-
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java Fri Sep 15 04:51:40 2006
@@ -34,14 +34,22 @@
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.phase.Phase;
 import org.apache.cxf.staxutils.StaxUtils;
 
 public class Soap11FaultOutInterceptor extends AbstractSoapInterceptor {
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(Soap11FaultOutInterceptor.class);
 
+    public Soap11FaultOutInterceptor() {
+        super();
+        setPhase(Phase.MARSHAL);
+    }
+
     public void handleMessage(SoapMessage message) throws Fault {
         XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
-        SoapFault fault = (SoapFault)message.getContent(Exception.class);
+        Fault f = (Fault)message.getContent(Exception.class);
+
+        SoapFault fault = SoapFault.createFault(f);
 
         try {
             Map<String, String> namespaces = fault.getNamespaces();
@@ -82,7 +90,11 @@
             writer.writeEndElement();
 
             writer.writeStartElement("faultstring");
-            writer.writeCharacters(fault.getMessage());
+            if (fault.getMessage() != null) {
+                writer.writeCharacters(fault.getMessage());
+            } else {
+                writer.writeCharacters("Fault occurred while processing.");
+            }
             writer.writeEndElement();
 
             if (fault.hasDetails()) {

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java Fri Sep 15 04:51:40 2006
@@ -67,6 +67,7 @@
             message.setContent(XMLStreamWriter.class, xtw);
             SoapVersion soapVersion = message.getVersion();
             
+            xtw.setPrefix(soapVersion.getPrefix(), soapVersion.getNamespace());
             xtw.writeStartElement(soapVersion.getPrefix(), 
                                   soapVersion.getEnvelope().getLocalPart(),
                                   soapVersion.getNamespace());
@@ -92,7 +93,6 @@
             
             xtw.flush();
         } catch (XMLStreamException e) {
-            //e.printStackTrace();
             throw new SoapFault(
                 new org.apache.cxf.common.i18n.Message("XML_WRITE_EXC", BUNDLE), e, SoapFault.SENDER);
         }
@@ -129,6 +129,10 @@
  
         if (countParts > 0) {
             List<?> objs = message.getContent(List.class);
+            if (objs == null) {
+                return;
+            }
+            
             Object[] args = objs.toArray();
             Object[] els = parts.toArray();
  

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Fri Sep 15 04:51:40 2006
@@ -255,8 +255,6 @@
     
     protected void setOutMessageProperties(Message message, BindingOperationInfo boi) {
         message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
-        // when configuration is ready, using config bean instead
-        message.put(Message.MTOM_ENABLED, Boolean.TRUE);
         message.put(BindingMessageInfo.class, boi.getInput());
         message.put(MessageInfo.class, boi.getOperationInfo().getInput());
     }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java Fri Sep 15 04:51:40 2006
@@ -31,6 +31,7 @@
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
+import org.apache.cxf.interceptor.FaultChainIntiatorInterceptor;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingInfo;
@@ -52,6 +53,7 @@
         this.bus = bus;
         service = s;
         endpointInfo = ei;
+        faultInterceptor = new FaultChainIntiatorInterceptor(this, bus);
         createBinding(endpointInfo.getBinding());
     }
 

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FaultChainIntiatorInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FaultChainIntiatorInterceptor.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FaultChainIntiatorInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FaultChainIntiatorInterceptor.java Fri Sep 15 04:51:40 2006
@@ -20,14 +20,10 @@
 package org.apache.cxf.interceptor;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.binding.Binding;
 import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.message.Exchange;
-import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.phase.PhaseManager;
-import org.apache.cxf.service.Service;
 
 public class FaultChainIntiatorInterceptor implements Interceptor<Message> {
     Endpoint endpoint;
@@ -40,29 +36,21 @@
     }
 
     public void handleMessage(Message m) {
-        Message message = endpoint.getBinding().createMessage(m);
-        Exchange exchange = new ExchangeImpl();
-        exchange.setInMessage(message);
-        message.setExchange(exchange);
-        
-        exchange.put(Endpoint.class, endpoint);
-        exchange.put(Service.class, endpoint.getService());
-        exchange.put(Binding.class, endpoint.getBinding());
-        exchange.put(Bus.class, bus);
-        exchange.setDestination(m.getDestination());
+        Message message = m.getExchange().getFaultMessage();
+        message.setContent(Exception.class, m.getContent(Exception.class));
         
         // setup chain
         PhaseInterceptorChain chain = new PhaseInterceptorChain(bus.getExtension(PhaseManager.class)
-            .getInPhases());
+            .getOutPhases());
         chain.add(bus.getOutFaultInterceptors());
         chain.add(endpoint.getOutFaultInterceptors());
         chain.add(endpoint.getBinding().getOutFaultInterceptors());
         chain.add(endpoint.getService().getOutFaultInterceptors());
 
-        chain.doIntercept(message);        
+        message.setInterceptorChain(chain);
+        chain.doIntercept(message);
     }
 
     public void handleFault(Message message) {
     }
-   
-}
+}
\ No newline at end of file

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java Fri Sep 15 04:51:40 2006
@@ -20,7 +20,9 @@
 package org.apache.cxf.interceptor;
 
 import java.io.IOException;
+import java.util.ResourceBundle;
 
+import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
@@ -28,9 +30,9 @@
 
 /**
  * Takes the Conduit from the exchange and sends the message through it.
- *
  */
 public class MessageSenderInterceptor extends AbstractPhaseInterceptor<Message> {
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(MessageSenderInterceptor.class);
 
     public MessageSenderInterceptor() {
         super();
@@ -42,16 +44,15 @@
         if (conduit == null) {
             conduit = message.getExchange().getConduit();
         }
-        
+
         try {
             conduit.send(message);
-            
+
             message.getInterceptorChain().doIntercept(message);
-            
+
             conduit.close(message);
         } catch (IOException ex) {
-            // TODO: wrap in runtime exception
-            ex.printStackTrace();
+            throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_SEND", BUNDLE), ex);
         }
     }
 }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties Fri Sep 15 04:51:40 2006
@@ -4,4 +4,5 @@
 NO_OPERATION=No such operation: {0}
 NO_DATAREADER=No DataReader is available for Service: {0}
 NO_DATAWRITER=No DataWriter is available for Service: {0}
-COULD_NOT_UNRWAP=Could not unrwap message parts.
\ No newline at end of file
+COULD_NOT_UNRWAP=Could not unrwap message parts.
+COULD_NOT_SEND=Could not send Message.
\ No newline at end of file

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java Fri Sep 15 04:51:40 2006
@@ -66,6 +66,12 @@
             outMessage = ep.getBinding().createMessage();
             ex.setOutMessage(outMessage);
         }
+
+        Message faultMessage = message.getExchange().getFaultMessage();
+        if (faultMessage == null) {
+            faultMessage = ep.getBinding().createMessage();
+            ex.setFaultMessage(faultMessage);
+        }
         
         if (outMessage.getConduit() == null
             && ex.getConduit() == null

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java?view=diff&rev=446583&r1=446582&r2=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java Fri Sep 15 04:51:40 2006
@@ -41,6 +41,7 @@
         service.getInInterceptors().add(new OutgoingChainSetupInterceptor());
         service.getInInterceptors().add(new OutgoingChainInterceptor());
         service.getOutInterceptors().add(new MessageSenderInterceptor());
+        service.getOutFaultInterceptors().add(new MessageSenderInterceptor());
     }
     
     protected void initializeDataBindings() {

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,133 @@
+/**
+ * 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.service.invoker;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.service.model.BindingOperationInfo;
+
+/**
+ * Abstract implementation of Invoker.
+ * <p>
+ * 
+ * @author Ben Yu Feb 10, 2006 10:57:23 PM
+ */
+public abstract class AbstractInvoker implements Invoker {
+
+    public Object invoke(Exchange exchange, Object o) {
+
+        final Object serviceObject = getServiceObject(exchange);
+
+        BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
+
+        Method m = (Method)bop.getOperationInfo().getProperty(Method.class.getName());
+        m = matchMethod(m, serviceObject);
+        List<Object> params = CastUtils.cast((List<?>)o);
+
+        Object res;
+        try {
+            Object[] paramArray = params.toArray();
+            res = m.invoke(serviceObject, paramArray);
+            if (exchange.isOneWay()) {
+                return null;
+            }
+            List<Object> retList = new ArrayList<Object>();
+            if (!((Class)m.getReturnType()).getName().equals("void")) {
+                retList.add(res);
+            }
+            return Arrays.asList(retList.toArray());
+        } catch (Exception e) {
+            throw new Fault(e);
+        }
+    }
+
+    /**
+     * Creates and returns a service object depending on the scope.
+     */
+    public abstract Object getServiceObject(final Exchange context);
+
+    /**
+     * Returns a Method that has the same declaring class as the class of
+     * targetObject to avoid the IllegalArgumentException when invoking the
+     * method on the target object. The methodToMatch will be returned if the
+     * targetObject doesn't have a similar method.
+     * 
+     * @param methodToMatch The method to be used when finding a matching method
+     *            in targetObject
+     * @param targetObject The object to search in for the method.
+     * @return The methodToMatch if no such method exist in the class of
+     *         targetObject; otherwise, a method from the class of targetObject
+     *         matching the matchToMethod method.
+     */
+    private static Method matchMethod(Method methodToMatch, Object targetObject) {
+        if (isJdkDynamicProxy(targetObject)) {
+            Class[] interfaces = targetObject.getClass().getInterfaces();
+            for (int i = 0; i < interfaces.length; i++) {
+                Method m = getMostSpecificMethod(methodToMatch, interfaces[i]);
+                if (!methodToMatch.equals(m)) {
+                    return m;
+                }
+            }
+        }
+        return methodToMatch;
+    }
+
+    /**
+     * Return whether the given object is a J2SE dynamic proxy.
+     * 
+     * @param object the object to check
+     * @see java.lang.reflect.Proxy#isProxyClass
+     */
+    public static boolean isJdkDynamicProxy(Object object) {
+        return object != null && Proxy.isProxyClass(object.getClass());
+    }
+
+    /**
+     * Given a method, which may come from an interface, and a targetClass used
+     * in the current AOP invocation, find the most specific method if there is
+     * one. E.g. the method may be IFoo.bar() and the target class may be
+     * DefaultFoo. In this case, the method may be DefaultFoo.bar(). This
+     * enables attributes on that method to be found.
+     * 
+     * @param method method to be invoked, which may come from an interface
+     * @param targetClass target class for the curren invocation. May be
+     *            <code>null</code> or may not even implement the method.
+     * @return the more specific method, or the original method if the
+     *         targetClass doesn't specialize it or implement it or is null
+     */
+    public static Method getMostSpecificMethod(Method method, Class targetClass) {
+        if (method != null && targetClass != null) {
+            try {
+                method = targetClass.getMethod(method.getName(), method.getParameterTypes());
+            } catch (NoSuchMethodException ex) {
+                // Perhaps the target class doesn't implement this method:
+                // that's fine, just use the original method
+            }
+        }
+        return method;
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ApplicationScopePolicy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ApplicationScopePolicy.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ApplicationScopePolicy.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ApplicationScopePolicy.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,49 @@
+/**
+ * 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.service.invoker;
+
+import org.apache.cxf.common.util.factory.CachingPool;
+import org.apache.cxf.common.util.factory.Factory;
+import org.apache.cxf.common.util.factory.Pool;
+import org.apache.cxf.common.util.factory.PooledFactory;
+import org.apache.cxf.message.Exchange;
+
+/**
+ * This scope policy implements one servant instance per service.
+ * <p>
+ * 
+ * @author Ben Yu Feb 6, 2006 11:38:08 AM
+ */
+public class ApplicationScopePolicy implements ScopePolicy {
+
+    private final Pool pool = new CachingPool();
+
+    public Factory applyScope(Factory f, Exchange ex) {
+        return new PooledFactory(f, pool);
+    }
+
+    public String toString() {
+        return "application scope";
+    }
+
+    public static ScopePolicy instance() {
+        return new ApplicationScopePolicy();
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ApplicationScopePolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ApplicationScopePolicy.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ApplicationScopePolicy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/BeanInvoker.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/BeanInvoker.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/BeanInvoker.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/BeanInvoker.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,41 @@
+/**
+ * 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.service.invoker;
+
+import org.apache.cxf.message.Exchange;
+
+/**
+ * Invoker for externally created service objects.
+ * 
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ * @author <a href="mailto:ajoo.email@gmail.com">Ben Yu</a>
+ * @since Feb 9, 2005
+ */
+public class BeanInvoker extends AbstractInvoker {
+    private Object proxy;
+
+    public BeanInvoker(Object proxy) {
+        this.proxy = proxy;
+    }
+
+    public Object getServiceObject(Exchange ex) {
+        return proxy;
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/BeanInvoker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/BeanInvoker.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/BeanInvoker.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,64 @@
+/**
+ * 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.service.invoker;
+
+import java.util.ResourceBundle;
+
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.util.factory.Factory;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Exchange;
+
+/**
+ * This invoker implementation calls a Factory to create the service object and
+ * then applies a scope policy for caching.
+ * 
+ * @author Ben Yu Feb 2, 2006 12:55:59 PM
+ */
+public class FactoryInvoker extends AbstractInvoker {
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(FactoryInvoker.class);
+
+    private final Factory factory;
+    private final ScopePolicy scope;
+
+    /**
+     * Create a FactoryInvoker object.
+     * 
+     * @param factory the factory used to create service object.
+     * @param scope the scope policy. Null for default.
+     */
+    public FactoryInvoker(Factory factory, ScopePolicy scope) {
+        this.factory = factory;
+        this.scope = scope == null ? new ApplicationScopePolicy() : scope;
+    }
+
+    public Object getServiceObject(Exchange ex) {
+        try {
+            return getScopedFactory(ex).create();
+        } catch (Throwable e) {
+            throw new Fault(new Message("CREATE_SERVICE_OBJECT_EXC", BUNDLE), e);
+        }
+    }
+
+    private Factory getScopedFactory(Exchange ex) {
+        return scope.applyScope(factory, ex);
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/LocalFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/LocalFactory.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/LocalFactory.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/LocalFactory.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,62 @@
+/**
+ * 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.service.invoker;
+
+import java.lang.reflect.Modifier;
+import java.util.ResourceBundle;
+
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.util.factory.Factory;
+import org.apache.cxf.interceptor.Fault;
+
+/**
+ * The XFire implementation of {@link Factory} interface.
+ * <p>
+ * 
+ * @author Ben Yu Feb 10, 2006 11:31:27 PM
+ */
+public class LocalFactory implements Factory {
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(LocalFactory.class);
+
+    private final Class svcClass;
+
+    public LocalFactory(final Class svcClass) {
+        super();
+        this.svcClass = svcClass;
+    }
+
+    public Object create() throws Fault {
+        try {
+            if (svcClass.isInterface()) {
+                throw new Fault(new Message("SVC_CLASS_IS_INTERFACE", BUNDLE, svcClass.getName()));
+            }
+
+            if (Modifier.isAbstract(svcClass.getModifiers())) {
+                throw new Fault(new Message("SVC_CLASS_IS_ABSTRACT", BUNDLE, svcClass.getName()));
+            }
+            return svcClass.newInstance();
+        } catch (InstantiationException e) {
+            throw new Fault(new Message("COULD_NOT_INSTANTIATE", BUNDLE));
+        } catch (IllegalAccessException e) {
+            throw new Fault(new Message("ILLEGAL_ACCESS", BUNDLE));
+        }
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/LocalFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/LocalFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/LocalFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties Fri Sep 15 04:51:40 2006
@@ -0,0 +1,4 @@
+SVC_CLASS_IS_INTERFACE=Could not instantiate service class {0} because it is an interface.
+SVC_CLASS_IS_ABSTRACT=Could not instantiate service class {0} because it is abstract.
+COULD_NOT_INSTANTIATE=Couldn't instantiate service object.
+ILLEGAL_ACCESS=Couldn't access service object.
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/RequestScopePolicy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/RequestScopePolicy.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/RequestScopePolicy.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/RequestScopePolicy.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,41 @@
+/**
+ * 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.service.invoker;
+
+import org.apache.cxf.common.util.factory.Factory;
+import org.apache.cxf.message.Exchange;
+
+/**
+ * This scope policy implements one servant instance per request.
+ * <p>
+ * 
+ * @author Ben Yu Feb 6, 2006 11:38:08 AM
+ */
+public class RequestScopePolicy implements ScopePolicy {
+    private static final RequestScopePolicy SINGLETON = new RequestScopePolicy();
+
+    public Factory applyScope(Factory f, Exchange ex) {
+        return f;
+    }
+
+    public static ScopePolicy instance() {
+        return SINGLETON;
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/RequestScopePolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/RequestScopePolicy.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/RequestScopePolicy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicy.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicy.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicy.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.service.invoker;
+
+import org.apache.cxf.common.util.factory.Factory;
+import org.apache.cxf.message.Exchange;
+
+/**
+ * This interface represents a scoping policy that caches servant instances
+ * created by a Factory.
+ * <p>
+ * 
+ * @author Ben Yu Feb 6, 2006 12:47:38 PM
+ */
+public interface ScopePolicy {
+    /**
+     * Apply scope policy to a Factory object so that the instance created by
+     * the Factory object can be cached properly.
+     * 
+     * @param f the Factory object.
+     * @param exchange The message exchange which the scope is applied to.
+     * @return the Factory object that honors the scope.
+     */
+    Factory applyScope(Factory f, Exchange exchange);
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicy.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicyEditor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicyEditor.java?view=auto&rev=446583
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicyEditor.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicyEditor.java Fri Sep 15 04:51:40 2006
@@ -0,0 +1,68 @@
+/**
+ * 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.service.invoker;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ * This class is responsible for converting string to ScopePolicy object.
+ * <p>
+ * 
+ * @author Ben Yu Feb 12, 2006 12:40:31 AM
+ */
+public class ScopePolicyEditor extends PropertyEditorSupport {
+    /**
+     * To get the default scope policy when no policy is specified. This
+     * implementation uses "application" as default.
+     */
+    public static ScopePolicy getDefaultScope() {
+        return ApplicationScopePolicy.instance();
+    }
+
+    /**
+     * Convert a policy name to ScopePolicy object.
+     * 
+     * @param policy the policy name.
+     * @return the ScopePolicy object.
+     */
+    public static ScopePolicy toScopePolicy(String policy) {
+        if (policy == null) {
+            return getDefaultScope();
+        }
+
+        policy = policy.trim();
+
+        if (policy.length() == 0) {
+            return getDefaultScope();
+        } else if ("application".equals(policy)) {
+            return ApplicationScopePolicy.instance();
+        } else if ("session".equals(policy)) {
+            return SessionScopePolicy.instance();
+        } else if ("request".equals(policy)) {
+            return RequestScopePolicy.instance();
+        } else {
+            throw new IllegalArgumentException("Scope " + policy + " is invalid.");
+        }
+    }
+
+    public void setAsText(String text) {
+        setValue(toScopePolicy(text));
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicyEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicyEditor.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/ScopePolicyEditor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message