cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject cxf git commit: [CXF-6421] Restore a compatible exchange.get(Foo.class) thing for compatibily
Date Tue, 26 May 2015 20:38:39 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 8ab75c2dc -> 985b824e0


[CXF-6421] Restore a compatible exchange.get(Foo.class) thing for compatibily


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

Branch: refs/heads/master
Commit: 985b824e0997d65aeb969330cd71b7f8b8b02f9d
Parents: 8ab75c2
Author: Daniel Kulp <dkulp@apache.org>
Authored: Tue May 26 16:25:37 2015 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Tue May 26 16:25:37 2015 -0400

----------------------------------------------------------------------
 .../org/apache/cxf/message/ExchangeImpl.java    | 29 +++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/985b824e/core/src/main/java/org/apache/cxf/message/ExchangeImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/message/ExchangeImpl.java b/core/src/main/java/org/apache/cxf/message/ExchangeImpl.java
index a1ff3e1..d2abd7a 100644
--- a/core/src/main/java/org/apache/cxf/message/ExchangeImpl.java
+++ b/core/src/main/java/org/apache/cxf/message/ExchangeImpl.java
@@ -28,7 +28,11 @@ import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.PreexistingConduitSelector;
 import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.Session;
@@ -88,7 +92,30 @@ public class ExchangeImpl extends ConcurrentHashMap<String, Object>
 implements
     }
     
     public <T> T get(Class<T> key) {
-        return key.cast(get(key.getName()));
+        T t = key.cast(get(key.getName()));
+        
+        if (t == null) {
+            if (key == Bus.class) {
+                t = key.cast(bus);
+            } else if (key == OperationInfo.class && bindingOp != null) {
+                t = key.cast(bindingOp.getOperationInfo());
+            } else if (key == BindingOperationInfo.class) {
+                t = key.cast(bindingOp);
+            } else if (key == Endpoint.class) {
+                t = key.cast(endpoint);
+            } else if (key == Service.class) {
+                t = key.cast(service);
+            } else if (key == Binding.class) {
+                t = key.cast(binding);
+            } else if (key == BindingInfo.class && binding != null) {
+                t = key.cast(binding.getBindingInfo());
+            } else if (key == InterfaceInfo.class && endpoint != null) {
+                t = key.cast(endpoint.getEndpointInfo().getService().getInterface());
+            } else if (key == ServiceInfo.class && endpoint != null) {
+                t = key.cast(endpoint.getEndpointInfo().getService());
+            }
+        }
+        return t;
     }
 
     public void putAll(Map<? extends String, ?> m) {


Mime
View raw message