cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-7135] Updating JMS ConnectionFactoryFeature to support InterceptorProvider
Date Mon, 21 Nov 2016 10:02:36 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 4466cf3b9 -> 2e027aee0


[CXF-7135] Updating JMS ConnectionFactoryFeature to support InterceptorProvider


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2e027aee
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2e027aee
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2e027aee

Branch: refs/heads/master
Commit: 2e027aee0e7989fa1037bc22014b4ab6017e9147
Parents: 4466cf3
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Nov 21 10:02:19 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Nov 21 10:02:19 2016 +0000

----------------------------------------------------------------------
 .../transport/jms/ConnectionFactoryFeature.java | 31 +++++++++++++-------
 1 file changed, 21 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2e027aee/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ConnectionFactoryFeature.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ConnectionFactoryFeature.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ConnectionFactoryFeature.java
index dca3e43..ee0dfaa 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ConnectionFactoryFeature.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ConnectionFactoryFeature.java
@@ -26,6 +26,7 @@ import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.InterceptorProvider;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
@@ -47,17 +48,14 @@ public class ConnectionFactoryFeature extends AbstractFeature {
 
     @Override
     public void initialize(Client client, Bus bus) {
-        client.getEndpoint().getOutInterceptors().add(new AbstractPhaseInterceptor<Message>(Phase.PREPARE_SEND)
{
-            public void handleMessage(Message message) throws Fault {
-                Conduit conduit = message.getExchange().getConduit(message);
-                if (conduit instanceof JMSConduit) {
-                    JMSConduit jmsConduit = (JMSConduit)conduit;
-                    jmsConduit.getJmsConfig().setConnectionFactory(connectionFactory);
-                }
-            }
-        });
+        client.getEndpoint().getOutInterceptors().add(new JMSConduitConfigOutInterceptor());
         super.initialize(client, bus);
     }
+    @Override
+    public void initialize(InterceptorProvider provider, Bus bus) {
+        provider.getOutInterceptors().add(new JMSConduitConfigOutInterceptor());
+        super.initialize(provider, bus);
+    }
 
     @Override
     public void initialize(Server server, Bus bus) {
@@ -68,5 +66,18 @@ public class ConnectionFactoryFeature extends AbstractFeature {
         }
         super.initialize(server, bus);
     }
-    
+    private class JMSConduitConfigOutInterceptor extends AbstractPhaseInterceptor<Message>
{
+        JMSConduitConfigOutInterceptor() {
+            super(Phase.PREPARE_SEND);
+        }
+
+        @Override
+        public void handleMessage(Message message) throws Fault {
+            Conduit conduit = message.getExchange().getConduit(message);
+            if (conduit instanceof JMSConduit) {
+                JMSConduit jmsConduit = (JMSConduit)conduit;
+                jmsConduit.getJmsConfig().setConnectionFactory(connectionFactory);
+            }
+        }
+    }
 }


Mime
View raw message