cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1496566 [2/2] - in /cxf/trunk: api/src/main/java/org/apache/cxf/endpoint/ api/src/main/java/org/apache/cxf/transport/ api/src/main/java/org/apache/cxf/ws/addressing/ rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/ rt/bindings...
Date Tue, 25 Jun 2013 18:07:11 GMT
Modified: cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java?rev=1496566&r1=1496565&r2=1496566&view=diff
==============================================================================
--- cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
(original)
+++ cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
Tue Jun 25 18:07:10 2013
@@ -30,8 +30,6 @@ import java.util.concurrent.ConcurrentMa
 import java.util.concurrent.Executor;
 import java.util.logging.Logger;
 
-import javax.annotation.Resource;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.logging.LogUtils;
@@ -48,7 +46,7 @@ import org.apache.cxf.ws.addressing.Attr
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl.http.AddressType;
 
-@NoJSR250Annotations(unlessNull = { "bus" })
+@NoJSR250Annotations
 public class LocalTransportFactory extends AbstractTransportFactory
     implements DestinationFactory, ConduitInitiator {
    
@@ -80,10 +78,7 @@ public class LocalTransportFactory exten
     private volatile Executor executor;
 
     public LocalTransportFactory() {
-        this(null);
-    }
-    public LocalTransportFactory(Bus b) {
-        super(DEFAULT_NAMESPACES, null);
+        super(DEFAULT_NAMESPACES);
         
         messageFilterProperties = new HashSet<String>();
         messageIncludeProperties = new HashSet<String>();
@@ -96,22 +91,15 @@ public class LocalTransportFactory exten
         messageIncludeProperties.add(Message.RESPONSE_CODE);
         messageIncludeProperties.add(Message.REQUEST_URI);
         messageIncludeProperties.add(Message.HTTP_REQUEST_METHOD);
-        
-        bus = b;
-        register();
-    }
-    
-    @Resource(name = "cxf")
-    public void setBus(Bus b) {
-        super.setBus(b);
     }
 
-    public Destination getDestination(EndpointInfo ei) throws IOException {
-        return getDestination(ei, createReference(ei));
+    public Destination getDestination(EndpointInfo ei, Bus bus) throws IOException {
+        return getDestination(ei, createReference(ei), bus);
     }
 
     protected Destination getDestination(EndpointInfo ei,
-                                         EndpointReferenceType reference)
+                                         EndpointReferenceType reference,
+                                         Bus bus)
         throws IOException {
         Destination d = null;
         String addr = reference.getAddress().getValue();
@@ -126,7 +114,7 @@ public class LocalTransportFactory exten
         }
         d = destinations.get(addr);
         if (d == null) {
-            d = createDestination(ei, reference);
+            d = createDestination(ei, reference, bus);
             Destination tmpD = destinations.putIfAbsent(addr, d);
             if (tmpD != null) {
                 d = tmpD;
@@ -135,9 +123,9 @@ public class LocalTransportFactory exten
         return d;
     }
 
-    private Destination createDestination(EndpointInfo ei, EndpointReferenceType reference)
{
+    private Destination createDestination(EndpointInfo ei, EndpointReferenceType reference,
Bus bus) {
         LOG.info("Creating destination for address " + reference.getAddress().getValue());
-        return new LocalDestination(this, reference, ei);
+        return new LocalDestination(this, reference, ei, bus);
     }
 
     void remove(LocalDestination destination) {
@@ -148,18 +136,15 @@ public class LocalTransportFactory exten
         }
     }
     
-    public Executor getExecutor() {
+    public Executor getExecutor(Bus bus) {
         if (executor == null && bus != null) {
-            synchronized (this) {
-                if (executor == null) {
-                    WorkQueueManager manager = bus.getExtension(WorkQueueManager.class);
-                    if (manager != null) {
-                        executor =  manager.getNamedWorkQueue("local-transport");
-                        if (executor == null) {
-                            executor = manager.getAutomaticWorkQueue();
-                        }
-                    }
+            WorkQueueManager manager = bus.getExtension(WorkQueueManager.class);
+            if (manager != null) {
+                Executor ex =  manager.getNamedWorkQueue("local-transport");
+                if (ex == null) {
+                    ex = manager.getAutomaticWorkQueue();
                 }
+                return ex;
             }
         }
         return executor;
@@ -169,12 +154,12 @@ public class LocalTransportFactory exten
         this.executor = executor;
     }
 
-    public Conduit getConduit(EndpointInfo ei) throws IOException {
-        return new LocalConduit(this, (LocalDestination)getDestination(ei));
+    public Conduit getConduit(EndpointInfo ei, Bus bus) throws IOException {
+        return new LocalConduit(this, (LocalDestination)getDestination(ei, bus));
     }
 
-    public Conduit getConduit(EndpointInfo ei, EndpointReferenceType target) throws IOException
{
-        return new LocalConduit(this, (LocalDestination)getDestination(ei, target));
+    public Conduit getConduit(EndpointInfo ei, EndpointReferenceType target, Bus bus) throws
IOException {
+        return new LocalConduit(this, (LocalDestination)getDestination(ei, target, bus));
     }
 
     EndpointReferenceType createReference(EndpointInfo ei) {

Modified: cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java?rev=1496566&r1=1496565&r2=1496566&view=diff
==============================================================================
--- cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
(original)
+++ cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
Tue Jun 25 18:07:10 2013
@@ -27,6 +27,8 @@ import java.io.OutputStream;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -50,16 +52,16 @@ public class LocalTransportFactoryTest e
     private void testInvocation(boolean isDirectDispatch) throws Exception {
         // Need to create a DefaultBus
         Bus bus = BusFactory.getDefaultBus();
-        LocalTransportFactory factory = new LocalTransportFactory(bus);
+        LocalTransportFactory factory = new LocalTransportFactory();
         
         EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http");
         ei.setAddress("http://localhost/test");
 
-        LocalDestination d = (LocalDestination) factory.getDestination(ei);
+        LocalDestination d = (LocalDestination) factory.getDestination(ei, bus);
         d.setMessageObserver(new EchoObserver());
         
         // Set up a listener for the response
-        Conduit conduit = factory.getConduit(ei);
+        Conduit conduit = factory.getConduit(ei, bus);
         TestMessageObserver obs = new TestMessageObserver();
         conduit.setMessageObserver(obs);
         
@@ -68,6 +70,9 @@ public class LocalTransportFactoryTest e
             m.put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
         }    
         m.setDestination(d);
+        Exchange ex = new ExchangeImpl();
+        ex.put(Bus.class, bus);
+        m.setExchange(ex);
         conduit.prepare(m);
         
         OutputStream out = m.getContent(OutputStream.class);

Modified: cxf/trunk/rt/transports/udp/src/main/java/org/apache/cxf/transport/udp/UDPTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/udp/src/main/java/org/apache/cxf/transport/udp/UDPTransportFactory.java?rev=1496566&r1=1496565&r2=1496566&view=diff
==============================================================================
--- cxf/trunk/rt/transports/udp/src/main/java/org/apache/cxf/transport/udp/UDPTransportFactory.java
(original)
+++ cxf/trunk/rt/transports/udp/src/main/java/org/apache/cxf/transport/udp/UDPTransportFactory.java
Tue Jun 25 18:07:10 2013
@@ -27,8 +27,6 @@ import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.annotation.Resource;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.logging.LogUtils;
@@ -41,7 +39,7 @@ import org.apache.cxf.transport.Destinat
 import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 
-@NoJSR250Annotations(unlessNull = { "bus" })
+@NoJSR250Annotations
 public class UDPTransportFactory extends AbstractTransportFactory
     implements DestinationFactory, ConduitInitiator {
    
@@ -58,25 +56,16 @@ public class UDPTransportFactory extends
     private Set<String> uriPrefixes = new HashSet<String>(URI_PREFIXES);
 
     public UDPTransportFactory() {
-        this(null);
-    }
-    public UDPTransportFactory(Bus b) {
-        super(DEFAULT_NAMESPACES, null);
-        bus = b;
-        register();
+        super(DEFAULT_NAMESPACES);
     }
     
-    @Resource(name = "cxf")
-    public void setBus(Bus b) {
-        super.setBus(b);
-    }
-
-    public Destination getDestination(EndpointInfo ei) throws IOException {
-        return getDestination(ei, null);
+    public Destination getDestination(EndpointInfo ei, Bus bus) throws IOException {
+        return getDestination(ei, null, bus);
     }
 
     protected Destination getDestination(EndpointInfo ei,
-                                         EndpointReferenceType reference)
+                                         EndpointReferenceType reference,
+                                         Bus bus)
         throws IOException {
         if (reference == null) {
             reference = createReference(ei);
@@ -85,11 +74,11 @@ public class UDPTransportFactory extends
     }
 
 
-    public Conduit getConduit(EndpointInfo ei) throws IOException {
-        return getConduit(ei, null);
+    public Conduit getConduit(EndpointInfo ei, Bus bus) throws IOException {
+        return getConduit(ei, null, bus);
     }
 
-    public Conduit getConduit(EndpointInfo ei, EndpointReferenceType target) throws IOException
{
+    public Conduit getConduit(EndpointInfo ei, EndpointReferenceType target, Bus bus) throws
IOException {
         LOG.log(Level.FINE, "Creating conduit for {0}", ei.getAddress());
         if (target == null) {
             target = createReference(ei);

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java?rev=1496566&r1=1496565&r2=1496566&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
(original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
Tue Jun 25 18:07:10 2013
@@ -301,7 +301,7 @@ final class InternalContextUtils {
                     = bus.getExtension(ConduitInitiatorManager.class)
                         .getConduitInitiatorForUri(reference.getAddress().getValue());
                 if (conduitInitiator != null) {
-                    Conduit c = conduitInitiator.getConduit(ei, reference);
+                    Conduit c = conduitInitiator.getConduit(ei, reference, bus);
                     // ensure decoupled back channel input stream is closed
                     c.setMessageObserver(new MessageObserver() {
                         public void onMessage(Message m) {

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorImpl.java?rev=1496566&r1=1496565&r2=1496566&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorImpl.java
(original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorImpl.java
Tue Jun 25 18:07:10 2013
@@ -990,7 +990,7 @@ public class MAPAggregatorImpl extends M
             ei.setName(new QName(ep.getEndpointInfo().getName().getNamespaceURI(),
                                  ep.getEndpointInfo().getName().getLocalPart() + ".decoupled"));
             ei.setAddress(address);
-            destination = factory.getDestination(ei);
+            destination = factory.getDestination(ei, bus);
             Conduit conduit = ContextUtils.getConduit(null, message);
             if (conduit != null) {
                 MessageObserver ob = ((Observable)conduit).getMessageObserver();

Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java?rev=1496566&r1=1496565&r2=1496566&view=diff
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java
(original)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java
Tue Jun 25 18:07:10 2013
@@ -125,7 +125,7 @@ public class MtomPolicyTest extends Abst
 
         ConduitInitiatorManager conduitMgr = getStaticBus().getExtension(ConduitInitiatorManager.class);
         ConduitInitiator conduitInit = conduitMgr.getConduitInitiator("http://schemas.xmlsoap.org/soap/http");
-        Conduit conduit = conduitInit.getConduit(ei);
+        Conduit conduit = conduitInit.getConduit(ei, getStaticBus());
 
         TestUtilities.TestMessageObserver obs = new TestUtilities.TestMessageObserver();
         conduit.setMessageObserver(obs);

Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java?rev=1496566&r1=1496565&r2=1496566&view=diff
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
(original)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
Tue Jun 25 18:07:10 2013
@@ -82,7 +82,7 @@ public class MtomServerTest extends Abst
 
         ConduitInitiatorManager conduitMgr = getStaticBus().getExtension(ConduitInitiatorManager.class);
         ConduitInitiator conduitInit = conduitMgr.getConduitInitiator("http://schemas.xmlsoap.org/soap/http");
-        Conduit conduit = conduitInit.getConduit(ei);
+        Conduit conduit = conduitInit.getConduit(ei, getStaticBus());
 
         TestUtilities.TestMessageObserver obs = new TestUtilities.TestMessageObserver();
         conduit.setMessageObserver(obs);
@@ -148,7 +148,7 @@ public class MtomServerTest extends Abst
 
         ConduitInitiatorManager conduitMgr = getStaticBus().getExtension(ConduitInitiatorManager.class);
         ConduitInitiator conduitInit = conduitMgr.getConduitInitiator("http://schemas.xmlsoap.org/soap/http");
-        Conduit conduit = conduitInit.getConduit(ei);
+        Conduit conduit = conduitInit.getConduit(ei, getStaticBus());
 
         TestUtilities.TestMessageObserver obs = new TestUtilities.TestMessageObserver();
         conduit.setMessageObserver(obs);
@@ -209,7 +209,7 @@ public class MtomServerTest extends Abst
         EndpointInfo ei = new EndpointInfo();
         ei.setAddress(add);
 
-        Destination d = df.getDestination(ei);
+        Destination d = df.getDestination(ei, bus);
         d.setMessageObserver(null);
 
     }
@@ -227,7 +227,7 @@ public class MtomServerTest extends Abst
         EndpointInfo ei = new EndpointInfo();
         ei.setAddress(add);
 
-        Destination d = df.getDestination(ei);
+        Destination d = df.getDestination(ei, bus);
         d.setMessageObserver(new MessageObserver() {
 
             public void onMessage(Message message) {

Modified: cxf/trunk/testutils/src/main/java/org/apache/cxf/test/TestUtilities.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/test/TestUtilities.java?rev=1496566&r1=1496565&r2=1496566&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/java/org/apache/cxf/test/TestUtilities.java (original)
+++ cxf/trunk/testutils/src/main/java/org/apache/cxf/test/TestUtilities.java Tue Jun 25 18:07:10
2013
@@ -194,7 +194,7 @@ public class TestUtilities {
 
         ConduitInitiatorManager conduitMgr = getBus().getExtension(ConduitInitiatorManager.class);
         ConduitInitiator conduitInit = conduitMgr.getConduitInitiator(transport);
-        Conduit conduit = conduitInit.getConduit(ei);
+        Conduit conduit = conduitInit.getConduit(ei, getBus());
 
         TestMessageObserver obs = new TestMessageObserver();
         conduit.setMessageObserver(obs);
@@ -226,7 +226,7 @@ public class TestUtilities {
 
         ConduitInitiatorManager conduitMgr = getBus().getExtension(ConduitInitiatorManager.class);
         ConduitInitiator conduitInit = conduitMgr.getConduitInitiator(transport);
-        Conduit conduit = conduitInit.getConduit(ei);
+        Conduit conduit = conduitInit.getConduit(ei, getBus());
 
         TestMessageObserver obs = new TestMessageObserver();
         conduit.setMessageObserver(obs);



Mime
View raw message