summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README2
-rw-r--r--branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.composite2
-rw-r--r--branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.composite4
-rw-r--r--branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java2
-rw-r--r--branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDelimitedTestCase.java4
-rw-r--r--branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java2
-rw-r--r--branches/sca-java-1.x/itest/jms/pom.xml7
-rw-r--r--branches/sca-java-1.x/itest/policy-security-token/pom.xml2
-rw-r--r--branches/sca-java-1.x/itest/policy-security-token/src/main/java/helloworld/HelloWorldClientImpl.java3
-rw-r--r--branches/sca-java-1.x/itest/policy-security-token/src/main/java/helloworld/HelloWorldServiceImpl.java10
-rw-r--r--branches/sca-java-1.x/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/TokenAuthTestCase.java4
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-policy/pom.xml2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java45
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java11
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyInterceptor.java49
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyProvider.java11
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java10
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/pom.xml4
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java9
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java10
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProviderFactory.java)3
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceInterceptor.java)4
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceProvider.java)2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSBindingListener.java15
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java23
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java12
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java16
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java18
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingListener.java20
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java56
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java15
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java66
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextReferenceInterceptor.java)16
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java94
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java111
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java91
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectProviderFactory.java)3
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectReferenceInterceptor.java)5
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectReferenceProvider.java)2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectServiceInterceptor.java)8
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectServiceProvider.java)2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextProviderFactory.java)3
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java119
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextReferenceProvider.java)2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextServiceInterceptor.java)8
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextServiceProvider.java)2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLProviderFactory.java)2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLReferenceInterceptor.java)4
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLReferenceProvider.java)2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLServiceInterceptor.java)7
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java (renamed from branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLServiceProvider.java)2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory2
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory8
-rw-r--r--branches/sca-java-1.x/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java2
-rw-r--r--branches/sca-java-1.x/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java11
-rw-r--r--branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java5
-rw-r--r--branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java11
-rw-r--r--branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java7
-rw-r--r--branches/sca-java-1.x/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java7
60 files changed, 736 insertions, 245 deletions
diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README
index d266735183..81ea3edffb 100644
--- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README
+++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README
@@ -1,3 +1,3 @@
-This test uses an SCA composite to fake a scenario where the reference is and SCA reference but the
+This test uses an SCA composite to fake a scenario where the reference is an SCA reference but the
service is a non-SCA JMS endpoint. This gives us the opportunity to play about with the interface
configuration at the reference to see how the contents of the JMS message can be controlled. \ No newline at end of file
diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.composite b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.composite
index f487996324..6202e947f5 100644
--- a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.composite
+++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmsmessage/helloworld.composite
@@ -20,6 +20,7 @@
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://helloworld"
xmlns:hw="http://helloworld"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
name="helloworld">
<component name="HelloWorldReferenceComponent">
@@ -29,6 +30,7 @@
<interface.java interface="org.apache.tuscany.sca.binding.jms.format.jmsmessage.helloworld.HelloWorldServiceReferenceSide"/>
<binding.jms>
<destination name="HelloWorldService1"/>
+ <tuscany:wireFormat.jmsText/>
</binding.jms>
</reference>
</component>
diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.composite b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.composite
index 07507e0ebe..0d0b5aef65 100644
--- a/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.composite
+++ b/branches/sca-java-1.x/itest/jms-format/src/main/resources/jmstextxml/helloworld.composite
@@ -18,9 +18,9 @@
* under the License.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://helloworld"
+ targetNamespace="http://helloworld"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:hw="http://helloworld"
+ xmlns:hw="http://helloworld"
name="helloworld">
<component name="HelloWorldReferenceComponent">
diff --git a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java
index 3d40d4fa85..a242206080 100644
--- a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java
+++ b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java
@@ -51,7 +51,7 @@ public class FormatJMSBytesTestCase {
HelloWorldReference helloWorldService = ((SCAClient)node).getService(HelloWorldReference.class, "HelloWorldReferenceComponent");
System.out.println(helloWorldService.getGreetings("Fred Bloggs"));
- //assertEquals("Hello Fred Bloggs", helloWorldService.getGreetings("Fred Bloggs"));
+ assertEquals("Hello Fred Bloggs", helloWorldService.getGreetings("Fred Bloggs"));
}
diff --git a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDelimitedTestCase.java b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDelimitedTestCase.java
index 90b74146e5..9f365ba3c1 100644
--- a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDelimitedTestCase.java
+++ b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDelimitedTestCase.java
@@ -47,6 +47,10 @@ public class FormatJMSDelimitedTestCase {
node.start();
}
+ /**
+ * The delimited wrie format is not yet implemented
+ *
+ */
@Test
@Ignore
public void testHelloWorldCreate() throws Exception {
diff --git a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java
index 18955df933..c617a984ef 100644
--- a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java
+++ b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java
@@ -51,7 +51,7 @@ public class FormatJMSMessageTestCase {
HelloWorldReference helloWorldService = ((SCAClient)node).getService(HelloWorldReference.class, "HelloWorldReferenceComponent");
System.out.println(helloWorldService.getGreetings("Fred Bloggs"));
- //assertEquals("Hello Fred Bloggs", helloWorldService.getGreetings("Fred Bloggs"));
+ assertEquals("Hello Fred Bloggs", helloWorldService.getGreetings("Fred Bloggs"));
}
diff --git a/branches/sca-java-1.x/itest/jms/pom.xml b/branches/sca-java-1.x/itest/jms/pom.xml
index a5e0d7f063..a7aaf5a910 100644
--- a/branches/sca-java-1.x/itest/jms/pom.xml
+++ b/branches/sca-java-1.x/itest/jms/pom.xml
@@ -56,6 +56,13 @@
<version>1.4-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-policy</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
diff --git a/branches/sca-java-1.x/itest/policy-security-token/pom.xml b/branches/sca-java-1.x/itest/policy-security-token/pom.xml
index d15d737ff4..9e18c7d1d9 100644
--- a/branches/sca-java-1.x/itest/policy-security-token/pom.xml
+++ b/branches/sca-java-1.x/itest/policy-security-token/pom.xml
@@ -65,7 +65,7 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <artifactId>tuscany-binding-jms-policy</artifactId>
<version>1.4-SNAPSHOT</version>
</dependency>
diff --git a/branches/sca-java-1.x/itest/policy-security-token/src/main/java/helloworld/HelloWorldClientImpl.java b/branches/sca-java-1.x/itest/policy-security-token/src/main/java/helloworld/HelloWorldClientImpl.java
index 55b798edbe..769be60538 100644
--- a/branches/sca-java-1.x/itest/policy-security-token/src/main/java/helloworld/HelloWorldClientImpl.java
+++ b/branches/sca-java-1.x/itest/policy-security-token/src/main/java/helloworld/HelloWorldClientImpl.java
@@ -34,8 +34,7 @@ public class HelloWorldClientImpl implements HelloWorldService {
protected HelloWorldService helloworldJMS;
public String getGreetings(String name) {
- return "Hello " +
- helloworldWS.getGreetings(name) +
+ return helloworldWS.getGreetings(name) +
helloworldJMS.getGreetings(name);
}
diff --git a/branches/sca-java-1.x/itest/policy-security-token/src/main/java/helloworld/HelloWorldServiceImpl.java b/branches/sca-java-1.x/itest/policy-security-token/src/main/java/helloworld/HelloWorldServiceImpl.java
index 6372570d1f..60c07f6f73 100644
--- a/branches/sca-java-1.x/itest/policy-security-token/src/main/java/helloworld/HelloWorldServiceImpl.java
+++ b/branches/sca-java-1.x/itest/policy-security-token/src/main/java/helloworld/HelloWorldServiceImpl.java
@@ -18,6 +18,8 @@
*/
package helloworld;
+import java.security.Principal;
+
import javax.security.auth.Subject;
import org.osoa.sca.RequestContext;
@@ -39,7 +41,13 @@ public class HelloWorldServiceImpl implements HelloWorldService {
if (subject == null){
return "Hello " + name + " null subject";
} else {
- return "Hello " + name + " " + subject.toString();
+ String response = "Hello " + name + " ";
+
+ for (Principal principal : subject.getPrincipals()){
+ response += principal.getName();
+ }
+
+ return response + " ";
}
}
diff --git a/branches/sca-java-1.x/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/TokenAuthTestCase.java b/branches/sca-java-1.x/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/TokenAuthTestCase.java
index 167e45738f..b0ae00b639 100644
--- a/branches/sca-java-1.x/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/TokenAuthTestCase.java
+++ b/branches/sca-java-1.x/itest/policy-security-token/src/test/java/org/apache/tuscany/sca/itest/TokenAuthTestCase.java
@@ -65,7 +65,9 @@ public class TokenAuthTestCase {
//@Ignore
public void testViaSCAClient() {
String greetings = service.getGreetings("Simon");
- System.out.println(">>>" + greetings);
+ System.out.println("Tokens reported at component context security subject = ");
+ System.out.println(greetings);
+ Assert.assertEquals("Hello Simon SomeWSAuthorizationToken Hello Simon DummyTokenID ", greetings);
}
@Test
diff --git a/branches/sca-java-1.x/modules/binding-jms-policy/pom.xml b/branches/sca-java-1.x/modules/binding-jms-policy/pom.xml
index ba97f217f4..f44f06d262 100644
--- a/branches/sca-java-1.x/modules/binding-jms-policy/pom.xml
+++ b/branches/sca-java-1.x/modules/binding-jms-policy/pom.xml
@@ -56,7 +56,7 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jms</artifactId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
<version>1.4-SNAPSHOT</version>
</dependency>
diff --git a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java
index 17b5da42be..56fffeb817 100644
--- a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java
@@ -19,8 +19,12 @@
package org.apache.tuscany.sca.binding.jms.policy.authentication.token;
+import javax.jms.JMSException;
import javax.security.auth.Subject;
+import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
@@ -38,14 +42,12 @@ import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
public class JMSTokenAuthenticationReferencePolicyInterceptor implements Interceptor {
private Invoker next;
- private Operation operation;
private PolicySet policySet = null;
private String context;
private JMSTokenAuthenticationPolicy policy;
- public JMSTokenAuthenticationReferencePolicyInterceptor(String context, Operation operation, PolicySet policySet) {
+ public JMSTokenAuthenticationReferencePolicyInterceptor(String context, PolicySet policySet) {
super();
- this.operation = operation;
this.policySet = policySet;
this.context = context;
init();
@@ -63,20 +65,29 @@ public class JMSTokenAuthenticationReferencePolicyInterceptor implements Interce
}
public Message invoke(Message msg) {
- // could call out here to some 3rd party system to get credentials
-
- if ( policy.getTokenName() != null){
-
- Subject subject = SecurityUtil.getSubject(msg);
- TokenPrincipal principal = SecurityUtil.getPrincipal(subject, TokenPrincipal.class);
-
- if (principal == null){
- principal = new TokenPrincipal("SomeJMSAuthorizationToken");
- subject.getPrincipals().add(principal);
- }
- }
-
- return getNext().invoke(msg);
+ try {
+ javax.jms.Message jmsMsg = msg.getBody();
+
+ if ( policy.getTokenName() != null){
+
+ Subject subject = SecurityUtil.getSubject(msg);
+ TokenPrincipal principal = SecurityUtil.getPrincipal(subject, TokenPrincipal.class);
+
+ if (principal == null){
+ // should call out here to some 3rd party system to get credentials
+ // and correct token. Here we are just putting in the token name
+ principal = new TokenPrincipal("DummyTokenID");
+ subject.getPrincipals().add(principal);
+ }
+
+ jmsMsg.setStringProperty(policy.getTokenName().toString(), principal.getName());
+ }
+
+ return getNext().invoke(msg);
+
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
}
public Invoker getNext() {
diff --git a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java
index 610bf758d1..a982e69ffd 100644
--- a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java
+++ b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java
@@ -29,13 +29,14 @@ import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
import org.apache.tuscany.sca.policy.util.PolicyHandler;
import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderRRB;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
/**
* @version $Rev$ $Date$
*/
-public class JMSTokenAuthenticationReferencePolicyProvider implements PolicyProvider {
+public class JMSTokenAuthenticationReferencePolicyProvider implements PolicyProviderRRB {
private RuntimeComponent component;
private RuntimeComponentReference reference;
private Binding binding;
@@ -76,9 +77,13 @@ public class JMSTokenAuthenticationReferencePolicyProvider implements PolicyProv
* @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
*/
public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new JMSTokenAuthenticationReferencePolicyInterceptor(getContext(), operation, ps);
+ return null;
}
+
+ public Interceptor createBindingInterceptor() {
+ PolicySet ps = findPolicySet();
+ return ps == null ? null : new JMSTokenAuthenticationReferencePolicyInterceptor(getContext(), ps);
+ }
/**
* @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
diff --git a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyInterceptor.java
index ec3be6e165..c8d28ad5db 100644
--- a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyInterceptor.java
@@ -19,13 +19,13 @@
package org.apache.tuscany.sca.binding.jms.policy.authentication.token;
-import java.security.Principal;
+import javax.jms.JMSException;
import javax.security.auth.Subject;
-import javax.xml.namespace.QName;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
@@ -34,21 +34,19 @@ import org.apache.tuscany.sca.policy.SecurityUtil;
import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
/**
- * Policy handler to handle PolicySet related to Logging with the QName
+ * Policy handler to handle token based authentication
* {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
*
* @version $Rev$ $Date$
*/
public class JMSTokenAuthenticationServicePolicyInterceptor implements Interceptor {
private Invoker next;
- private Operation operation;
private PolicySet policySet = null;
private String context;
private JMSTokenAuthenticationPolicy policy;
- public JMSTokenAuthenticationServicePolicyInterceptor(String context, Operation operation, PolicySet policySet) {
+ public JMSTokenAuthenticationServicePolicyInterceptor(String context, PolicySet policySet) {
super();
- this.operation = operation;
this.policySet = policySet;
this.context = context;
init();
@@ -66,17 +64,30 @@ public class JMSTokenAuthenticationServicePolicyInterceptor implements Intercept
}
public Message invoke(Message msg) {
- Subject subject = SecurityUtil.getSubject(msg);
- TokenPrincipal principal = SecurityUtil.getPrincipal(subject, TokenPrincipal.class);
-
- if (principal != null) {
- System.out.println("Token: " + principal.getName());
-
- // call out here to some 3rd party system to do whatever you
- // need to authenticate the principal
- }
-
- return getNext().invoke(msg);
+ try{
+ // get the jms context
+ JMSBindingContext context = msg.getBindingContext();
+ javax.jms.Message jmsMsg = context.getJmsMsg();
+
+ String token = jmsMsg.getStringProperty(policy.getTokenName().toString());
+
+ Subject subject = SecurityUtil.getSubject(msg);
+ TokenPrincipal principal = SecurityUtil.getPrincipal(subject, TokenPrincipal.class);
+
+ if (principal == null){
+ principal = new TokenPrincipal(token);
+ subject.getPrincipals().add(principal);
+ }
+
+ System.out.println("JMS service received token: " + principal.getName());
+
+ // call out here to some 3rd party system to do whatever you
+ // need to authenticate the principal
+
+ return getNext().invoke(msg);
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
}
public Invoker getNext() {
diff --git a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyProvider.java b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyProvider.java
index 4278c1e595..209bd4becf 100644
--- a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyProvider.java
+++ b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyProvider.java
@@ -29,13 +29,14 @@ import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
import org.apache.tuscany.sca.policy.util.PolicyHandler;
import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderRRB;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
/**
* @version $Rev$ $Date$
*/
-public class JMSTokenAuthenticationServicePolicyProvider implements PolicyProvider {
+public class JMSTokenAuthenticationServicePolicyProvider implements PolicyProviderRRB {
private RuntimeComponent component;
private RuntimeComponentService service;
private Binding binding;
@@ -74,9 +75,13 @@ public class JMSTokenAuthenticationServicePolicyProvider implements PolicyProvid
* @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
*/
public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new JMSTokenAuthenticationServicePolicyInterceptor(getContext(), operation, ps);
+ return null;
}
+
+ public Interceptor createBindingInterceptor() {
+ PolicySet ps = findPolicySet();
+ return ps == null ? null : new JMSTokenAuthenticationServicePolicyInterceptor(getContext(), ps);
+ }
/**
* @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
diff --git a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java
index 19069378ef..58100cfb8d 100644
--- a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java
@@ -26,7 +26,9 @@ import javax.jms.JMSException;
import javax.security.auth.Subject;
import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
import org.apache.tuscany.sca.binding.jms.policy.JMSBindingDefinitionsProvider;
import org.apache.tuscany.sca.interfacedef.Operation;
@@ -80,6 +82,9 @@ public class JMSHeaderReferencePolicyInterceptor implements Interceptor {
public Message invoke(Message msg) {
try {
+ // get the jms context
+ JMSBindingContext context = msg.getBindingContext();
+
javax.jms.Message jmsMsg = msg.getBody();
String operationName = msg.getOperation().getName();
@@ -113,6 +118,11 @@ public class JMSHeaderReferencePolicyInterceptor implements Interceptor {
jmsMsg.setObjectProperty(propName, jmsHeaderPolicy.getProperties().get(propName));
}
}
+
+ if (jmsHeaderPolicy != null &&
+ jmsHeaderPolicy.getTimeToLive() != null) {
+ context.setTimeToLive(jmsHeaderPolicy.getTimeToLive());
+ }
return getNext().invoke(msg);
} catch (JMSException e) {
diff --git a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml
index 66ec011844..c87079dd54 100644
--- a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml
+++ b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml
@@ -72,7 +72,7 @@
<intent name="priority.medium">
<description>
- Messages are meduim priority
+ Messages are medium priority
</description>
</intent>
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/pom.xml b/branches/sca-java-1.x/modules/binding-jms-runtime/pom.xml
index e8527eda7f..ffa75a53f1 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/pom.xml
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/pom.xml
@@ -36,11 +36,11 @@
<version>1.4-SNAPSHOT</version>
</dependency>
- <dependency>
+ <!-- dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-jms-policy</artifactId>
<version>1.4-SNAPSHOT</version>
- </dependency>
+ </dependency-->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java
index bc2e783569..6370c9f575 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java
@@ -37,6 +37,7 @@ public class JMSBindingContext {
private Destination requestDestination;
private Destination replyToDestination;
private JMSResourceFactory jmsResourceFactory;
+ private long timeToLive;
public Message getJmsMsg() {
return jmsMsg;
@@ -79,4 +80,12 @@ public class JMSBindingContext {
public void setJmsResourceFactory(JMSResourceFactory jmsResourceFactory) {
this.jmsResourceFactory = jmsResourceFactory;
}
+
+ public long getTimeToLive() {
+ return timeToLive;
+ }
+
+ public void setTimeToLive(long timeToLive) {
+ this.timeToLive = timeToLive;
+ }
}
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java
index 8a73627ba3..a361d8159b 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java
@@ -83,8 +83,8 @@ public class HeaderReferenceInterceptor implements Interceptor {
public Message invokeRequest(Message tuscanyMsg) {
try {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)tuscanyMsg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
- javax.jms.Message jmsMsg = (javax.jms.Message)tuscanyMsg.getBody();
+ JMSBindingContext context = tuscanyMsg.getBindingContext();
+ javax.jms.Message jmsMsg = tuscanyMsg.getBody();
Operation operation = tuscanyMsg.getOperation();
String operationName = operation.getName();
@@ -144,6 +144,12 @@ public class HeaderReferenceInterceptor implements Interceptor {
}
}
+ if (jmsBinding.getOperationJMSTimeToLive(operationName) != null) {
+ context.setTimeToLive(jmsBinding.getOperationJMSTimeToLive(operationName) * 2);
+ } else {
+ context.setTimeToLive(JMSBindingConstants.DEFAULT_TIME_TO_LIVE);
+ }
+
return tuscanyMsg;
} catch (JMSException e) {
throw new JMSBindingException(e);
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProviderFactory.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.java
index a4d0ccafb3..64d01b2863 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProviderFactory.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.java
@@ -17,10 +17,11 @@
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault;
+package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java
index d765e08d79..a1319ad1f0 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault;
+package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.runtime;
import java.util.List;
@@ -81,7 +81,7 @@ public class OperationSelectorJMSDefaultServiceInterceptor implements Intercepto
public Message invokeRequest(Message msg) {
try {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
javax.jms.Message jmsMsg = context.getJmsMsg();
String operationName = requestMessageProcessor.getOperationName(jmsMsg);
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.java
index 54c3eb54eb..1cceb4e382 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultServiceProvider.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault;
+package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSBindingListener.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSBindingListener.java
index 9b8bee92c9..e9f49ba243 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSBindingListener.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSBindingListener.java
@@ -32,20 +32,14 @@ import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.Topic;
import javax.naming.NamingException;
-import javax.security.auth.Subject;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy;
import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
import org.apache.tuscany.sca.core.invocation.MessageImpl;
import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -68,7 +62,7 @@ public class DefaultJMSBindingListener implements MessageListener {
private JMSMessageProcessor responseMessageProcessor;
private String correlationScheme;
private List<Operation> serviceOperations;
- protected JMSTokenAuthenticationPolicy jmsTokenAuthenticationPolicy = null;
+ //protected JMSTokenAuthenticationPolicy jmsTokenAuthenticationPolicy = null;
public DefaultJMSBindingListener(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeComponentService service, Binding targetBinding) throws NamingException {
this.jmsBinding = jmsBinding;
@@ -81,6 +75,7 @@ public class DefaultJMSBindingListener implements MessageListener {
serviceOperations = service.getInterfaceContract().getInterface().getOperations();
// find out which policies are active
+/*
if (jmsBinding instanceof PolicySetAttachPoint) {
List<PolicySet> policySets = ((PolicySetAttachPoint)jmsBinding).getApplicablePolicySets();
for (PolicySet ps : policySets) {
@@ -92,7 +87,8 @@ public class DefaultJMSBindingListener implements MessageListener {
}
}
}
- }
+ }
+ */
}
@@ -205,7 +201,7 @@ public class DefaultJMSBindingListener implements MessageListener {
parameters.setCallbackID(callbackID);
}
}
-
+/*
if (jmsTokenAuthenticationPolicy != null) {
String token = requestJMSMsg.getStringProperty(jmsTokenAuthenticationPolicy.getTokenName().toString());
@@ -218,6 +214,7 @@ public class DefaultJMSBindingListener implements MessageListener {
}
}
+*/
}
protected void sendReply(Message requestJMSMsg, Object responsePayload, boolean isFault) {
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
index 9c5fba5de6..39f79dd70d 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
@@ -35,16 +35,12 @@ import javax.security.auth.Subject;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy;
-import org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicy;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -67,8 +63,8 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
protected Destination bindingRequestDest;
protected Destination bindingReplyDest;
protected RuntimeComponentReference reference;
- protected JMSTokenAuthenticationPolicy jmsTokenAuthenticationPolicy = null;
- protected JMSHeaderPolicy jmsHeaderPolicy = null;
+ //protected JMSTokenAuthenticationPolicy jmsTokenAuthenticationPolicy = null;
+ //protected JMSHeaderPolicy jmsHeaderPolicy = null;
public JMSBindingInvoker(JMSBinding jmsBinding, Operation operation, JMSResourceFactory jmsResourceFactory, RuntimeComponentReference reference) {
@@ -82,6 +78,7 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
// find out which policies are active
+/*
if (jmsBinding instanceof PolicySetAttachPoint) {
List<PolicySet> policySets = ((PolicySetAttachPoint)jmsBinding).getApplicablePolicySets();
for (PolicySet ps : policySets) {
@@ -96,6 +93,7 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
}
}
}
+*/
try {
@@ -327,7 +325,7 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
protected void setHeaders(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Message jmsMsg) throws JMSException {
requestMessageProcessor.setOperationName(jmsBinding.getNativeOperationName(operationName), jmsMsg);
-
+/*
if ((jmsHeaderPolicy != null) &&
(jmsHeaderPolicy.getDeliveryModePersistent() != null)) {
if (jmsHeaderPolicy.getDeliveryModePersistent()) {
@@ -383,12 +381,14 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY, callbackDestName);
}
}
-
+
+
if (jmsHeaderPolicy != null){
for (String propName : jmsHeaderPolicy.getProperties().keySet()) {
jmsMsg.setObjectProperty(propName, jmsHeaderPolicy.getProperties().get(propName));
}
}
+*/
for (String propName : jmsBinding.getPropertyNames()) {
Object value = jmsBinding.getProperty(propName);
@@ -402,7 +402,7 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
jmsMsg.setObjectProperty(propName, value);
}
}
-
+/*
if (jmsTokenAuthenticationPolicy != null) {
Subject subject = SecurityUtil.getSubject(tuscanyMsg);
TokenPrincipal principal = SecurityUtil.getPrincipal(subject, TokenPrincipal.class);
@@ -410,6 +410,7 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
jmsMsg.setStringProperty(jmsTokenAuthenticationPolicy.getTokenName().toString(), principal.getName());
}
}
+*/
}
protected boolean hasCallback() {
@@ -427,10 +428,10 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
MessageConsumer consumer = session.createConsumer(replyToDest, msgSelector);
long receiveWait;
- if ((jmsHeaderPolicy != null) &&
+ /* if ((jmsHeaderPolicy != null) &&
(jmsHeaderPolicy.getTimeToLive() != null)) {
receiveWait = jmsHeaderPolicy.getTimeToLive();
- } else if (jmsBinding.getOperationJMSTimeToLive(operationName) != null) {
+ } else */if (jmsBinding.getOperationJMSTimeToLive(operationName) != null) {
receiveWait = jmsBinding.getOperationJMSTimeToLive(operationName) * 2;
} else {
receiveWait = JMSBindingConstants.DEFAULT_TIME_TO_LIVE;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
index aa66542f38..e7562000e9 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
@@ -24,27 +24,18 @@ import java.util.List;
import javax.jms.JMSException;
-import org.apache.axiom.om.OMElement;
import org.apache.tuscany.sca.binding.jms.headers.HeaderReferenceInterceptor;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault;
import org.apache.tuscany.sca.binding.jms.transport.TransportReferenceInterceptor;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.OperationSelectorProvider;
-import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory;
import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.provider.ReferenceBindingProviderRRB;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
@@ -160,7 +151,8 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi
responseWireFormatProvider.createInterceptor());
}
- // add the header processor that comes after the wire formatter
+ // add the header processor that comes after the wire formatter but before the
+ // policy interceptors
bindingChain.addInterceptor(Phase.REFERENCE_BINDING_WIREFORMAT,
new HeaderReferenceInterceptor(jmsBinding,
jmsResourceFactory,
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
index da6c6d260d..0aabc9a7a5 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
@@ -19,7 +19,6 @@
package org.apache.tuscany.sca.binding.jms.provider;
-import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -33,33 +32,20 @@ import javax.jms.Session;
import javax.jms.Topic;
import javax.naming.NamingException;
-import org.apache.axiom.om.OMElement;
import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.OperationSelector;
-import org.apache.tuscany.sca.assembly.WireFormat;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault;
-import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefaultServiceInterceptor;
-import org.apache.tuscany.sca.binding.jms.transport.TransportReferenceInterceptor;
import org.apache.tuscany.sca.binding.jms.transport.TransportServiceInterceptor;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.OperationSelectorProvider;
import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory;
import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProviderRRB;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
@@ -330,7 +316,7 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR
}
/*
- * RRB test methods
+ * Adds JMS specific interceptors to the binding chain
*/
public void configureBindingChain(RuntimeWire runtimeWire) {
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
index b78f1f2044..96d6ab7c46 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
@@ -19,36 +19,20 @@
package org.apache.tuscany.sca.binding.jms.provider;
import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-import java.util.Map;
-import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.naming.NamingException;
-import javax.security.auth.Subject;
import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy;
-import org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicy;
import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.osoa.sca.ServiceRuntimeException;
@@ -206,7 +190,7 @@ public class RRBJMSBindingInvoker implements Invoker, DataExchangeSemantics {
// populate the message context with JMS binding information
JMSBindingContext context = new JMSBindingContext();
- tuscanyMsg.getHeaders().add(JMSBindingConstants.MSG_CTXT_POSITION, context);
+ tuscanyMsg.setBindingContext(context);
context.setJmsSession(session);
context.setRequestDestination(getRequestDestination(tuscanyMsg, session));
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingListener.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingListener.java
index 5306e050e7..4821943bd3 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingListener.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingListener.java
@@ -23,34 +23,16 @@ import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.Topic;
import javax.naming.NamingException;
-import javax.security.auth.Subject;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy;
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
/**
@@ -104,7 +86,7 @@ public class RRBJMSBindingListener implements MessageListener {
// populate the message context with JMS binding information
JMSBindingContext context = new JMSBindingContext();
- tuscanyMsg.getHeaders().add(context);
+ tuscanyMsg.setBindingContext(context);
context.setJmsMsg(requestJMSMsg);
context.setJmsResourceFactory(jmsResourceFactory);
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
index e84279cae1..62b51bd797 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
@@ -18,32 +18,23 @@
*/
package org.apache.tuscany.sca.binding.jms.transport;
-import java.util.List;
-
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.naming.NamingException;
-
import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy;
-import org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicy;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
/**
@@ -53,18 +44,14 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
* @version $Rev$ $Date$
*/
public class TransportReferenceInterceptor implements Interceptor {
-
- private static final String ON_MESSAGE_METHOD_NAME = "onMessage";
-
+
private Invoker next;
private RuntimeWire runtimeWire;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
private JMSMessageProcessor responseMessageProcessor;
- private RuntimeComponentReference reference;
- protected JMSHeaderPolicy jmsHeaderPolicy = null;
-
+ private RuntimeComponentReference reference;
public TransportReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
super();
@@ -73,26 +60,14 @@ public class TransportReferenceInterceptor implements Interceptor {
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- this.reference = (RuntimeComponentReference)runtimeWire.getSource().getContract();
-
- // find out if the header policy is active
- if (jmsBinding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)jmsBinding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (JMSHeaderPolicy.class.isInstance(p)) {
- jmsHeaderPolicy = (JMSHeaderPolicy)p;
- }
- }
- }
- }
+ this.reference = (RuntimeComponentReference)runtimeWire.getSource().getContract();
}
public Message invoke(Message msg) {
Message responseMsg = invokeRequest(msg);
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
if (context.getReplyToDestination() == null) {
responseMsg.setBody(null);
@@ -106,7 +81,7 @@ public class TransportReferenceInterceptor implements Interceptor {
public Message invokeRequest(Message msg) {
try {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
Session session = context.getJmsSession();
MessageProducer producer = session.createProducer(context.getRequestDestination());
@@ -129,34 +104,21 @@ public class TransportReferenceInterceptor implements Interceptor {
public Message invokeResponse(Message msg) {
try {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
Session session = context.getJmsSession();
javax.jms.Message requestMessage = (javax.jms.Message)msg.getBody();
-
- String operationName = msg.getOperation().getName();
-
+
String msgSelector = "JMSCorrelationID = '" +
requestMessage.getJMSMessageID() +
"'";
- MessageConsumer consumer = session.createConsumer(context.getReplyToDestination(), msgSelector);
-
- long receiveWait;
-
- if ((jmsHeaderPolicy != null) &&
- (jmsHeaderPolicy.getTimeToLive() != null)) {
- receiveWait = jmsHeaderPolicy.getTimeToLive();
- } else if (jmsBinding.getOperationJMSTimeToLive(operationName) != null) {
- receiveWait = jmsBinding.getOperationJMSTimeToLive(operationName) * 2;
- } else {
- receiveWait = JMSBindingConstants.DEFAULT_TIME_TO_LIVE;
- }
+ MessageConsumer consumer = session.createConsumer(context.getReplyToDestination(), msgSelector);
javax.jms.Message replyMsg;
try {
context.getJmsResourceFactory().startConnection();
//jmsResourceFactory.startConnection();
- replyMsg = consumer.receive(receiveWait);
+ replyMsg = consumer.receive(context.getTimeToLive());
} finally {
consumer.close();
}
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
index ed17140ac3..91868204ac 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
@@ -18,34 +18,25 @@
*/
package org.apache.tuscany.sca.binding.jms.transport;
-import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
-import javax.jms.Queue;
import javax.jms.Session;
-import javax.jms.Topic;
import javax.naming.NamingException;
-import javax.security.auth.Subject;
import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.DefaultJMSBindingListener;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -86,7 +77,7 @@ public class TransportServiceInterceptor implements Interceptor {
return invokeResponse(next.invoke(invokeRequest(msg)));
} catch (Throwable e) {
logger.log(Level.SEVERE, "Exception invoking service '" + service.getName(), e);
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
javax.jms.Message replyJMSMsg = responseMessageProcessor.createFaultMessage(context.getJmsSession(),
(Throwable)e);
msg.setBody(replyJMSMsg);
@@ -97,7 +88,7 @@ public class TransportServiceInterceptor implements Interceptor {
public Message invokeRequest(Message msg) {
try {
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
javax.jms.Message requestJMSMsg = context.getJmsMsg();
context.setJmsSession(context.getJmsResourceFactory().createSession());
@@ -121,7 +112,7 @@ public class TransportServiceInterceptor implements Interceptor {
public Message invokeResponse(Message msg) {
try {
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
Session session = context.getJmsSession();
javax.jms.Message requestJMSMsg = context.getJmsMsg();
javax.jms.Message responseJMSMsg = msg.getBody();
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java
new file mode 100644
index 0000000000..aa5df2b8bb
--- /dev/null
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java
@@ -0,0 +1,66 @@
+/*
+ * 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.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.WireFormatProvider;
+import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WireFormatJMSBytesProviderFactory implements WireFormatProviderFactory<WireFormatJMSBytes> {
+ private ExtensionPointRegistry registry;
+
+ public WireFormatJMSBytesProviderFactory(ExtensionPointRegistry registry) {
+ super();
+ this.registry = registry;
+ }
+
+ /**
+ */
+ public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ return new WireFormatJMSBytesReferenceProvider(registry, component, reference, binding);
+ }
+
+ /**
+ */
+ public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ return new WireFormatJMSBytesServiceProvider(registry, component, service, binding);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
+ */
+ public Class getModelType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextReferenceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java
index e317f42266..f0e835e916 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextReferenceInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstext;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime;
import javax.jms.JMSException;
@@ -30,7 +30,7 @@ import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
+import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
@@ -40,7 +40,7 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
*
* @version $Rev$ $Date$
*/
-public class WireFormatJMSTextReferenceInterceptor implements Interceptor {
+public class WireFormatJMSBytesReferenceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
@@ -49,23 +49,23 @@ public class WireFormatJMSTextReferenceInterceptor implements Interceptor {
private JMSMessageProcessor requestMessageProcessor;
private JMSMessageProcessor responseMessageProcessor;
- public WireFormatJMSTextReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
+ public WireFormatJMSBytesReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
+ this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
}
public Message invoke(Message msg) {
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSText){
+ if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSBytes){
msg = invokeRequest(msg);
}
msg = getNext().invoke(msg);
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSText){
+ if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSBytes){
msg = invokeResponse(msg);
}
@@ -75,7 +75,7 @@ public class WireFormatJMSTextReferenceInterceptor implements Interceptor {
public Message invokeRequest(Message msg) {
try {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
Session session = context.getJmsSession();
javax.jms.Message requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody());
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java
new file mode 100644
index 0000000000..00aa060ce7
--- /dev/null
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java
@@ -0,0 +1,94 @@
+/*
+ * 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.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime;
+
+import java.util.List;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
+import org.apache.tuscany.sca.binding.jms.provider.XMLTextMessageProcessor;
+import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.WireFormatProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WireFormatJMSBytesReferenceProvider implements WireFormatProvider {
+ private ExtensionPointRegistry registry;
+ private RuntimeComponent component;
+ private RuntimeComponentReference reference;
+ private JMSBinding binding;
+ private InterfaceContract interfaceContract;
+
+ public WireFormatJMSBytesReferenceProvider(ExtensionPointRegistry registry,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ super();
+ this.registry = registry;
+ this.component = component;
+ this.reference = reference;
+ this.binding = (JMSBinding)binding;
+
+ // configure the reference based on this wire format
+
+ // currently maintaining the message processor structure which
+ // contains the details of jms message processing however overried
+ // any message processors specied in the SCDL in this case
+ this.binding.setRequestMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME);
+ this.binding.setResponseMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME);
+
+ // just point to the reference interface contract so no
+ // databinding transformation takes place
+ interfaceContract = reference.getInterfaceContract();
+ }
+
+ public InterfaceContract getWireFormatInterfaceContract() {
+ return interfaceContract;
+ }
+
+ public Interceptor createInterceptor() {
+ return new WireFormatJMSBytesReferenceInterceptor(binding,
+ null,
+ reference.getRuntimeWire(binding));
+ }
+
+ public String getPhase() {
+ return Phase.REFERENCE_BINDING_WIREFORMAT;
+ }
+
+}
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java
new file mode 100644
index 0000000000..5a41a0f62f
--- /dev/null
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java
@@ -0,0 +1,111 @@
+/*
+ * 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.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime;
+
+import javax.jms.JMSException;
+import javax.jms.Session;
+
+import org.apache.tuscany.sca.assembly.WireFormat;
+import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
+import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Policy handler to handle PolicySet related to Logging with the QName
+ * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireFormatJMSBytesServiceInterceptor implements Interceptor {
+ private Invoker next;
+ private RuntimeWire runtimeWire;
+ private JMSResourceFactory jmsResourceFactory;
+ private JMSBinding jmsBinding;
+ private JMSMessageProcessor requestMessageProcessor;
+ private JMSMessageProcessor responseMessageProcessor;
+
+ public WireFormatJMSBytesServiceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
+ super();
+ this.jmsBinding = jmsBinding;
+ this.runtimeWire = runtimeWire;
+ this.jmsResourceFactory = jmsResourceFactory;
+ this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
+ this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
+ }
+
+ public Message invoke(Message msg) {
+ if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSBytes){
+ msg = invokeRequest(msg);
+ }
+
+ msg = getNext().invoke(msg);
+
+ if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSBytes){
+ msg = invokeResponse(msg);
+ }
+
+ return msg;
+ }
+
+ public Message invokeRequest(Message msg) {
+ // get the jms context
+ JMSBindingContext context = msg.getBindingContext();
+ javax.jms.Message jmsMsg = context.getJmsMsg();
+
+ Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
+ msg.setBody(requestPayload);
+
+ return msg;
+ }
+
+ public Message invokeResponse(Message msg) {
+ // get the jms context
+ JMSBindingContext context = msg.getBindingContext();
+ Session session = context.getJmsSession();
+
+ javax.jms.Message responseJMSMsg;
+ if (msg.isFault()) {
+ responseJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)msg.getBody());
+ } else {
+ Object[] response = {msg.getBody()};
+ responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, response);
+ }
+
+ msg.setBody(responseJMSMsg);
+
+ return msg;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+}
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java
new file mode 100644
index 0000000000..8cf1bc7e4d
--- /dev/null
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java
@@ -0,0 +1,91 @@
+/*
+ * 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.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.WireFormatProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WireFormatJMSBytesServiceProvider implements WireFormatProvider {
+ private ExtensionPointRegistry registry;
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private JMSBinding binding;
+ private InterfaceContract interfaceContract;
+
+ public WireFormatJMSBytesServiceProvider(ExtensionPointRegistry registry,
+ RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ super();
+ this.registry = registry;
+ this.component = component;
+ this.service = service;
+ this.binding = (JMSBinding)binding;
+
+ // configure the service based on this wire format
+
+ // currently maintaining the message processor structure which
+ // contains the details of jms message processing however overried
+ // any message processors specied in the SCDL in this case
+ this.binding.setRequestMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME);
+ this.binding.setResponseMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME);
+
+ // just point to the reference interface contract so no
+ // databinding transformation takes place
+ interfaceContract = service.getInterfaceContract();
+ }
+
+ public InterfaceContract getWireFormatInterfaceContract() {
+ return interfaceContract;
+ }
+
+ /**
+ */
+ public Interceptor createInterceptor() {
+ return new WireFormatJMSBytesServiceInterceptor((JMSBinding)binding,
+ null,
+ service.getRuntimeWire(binding));
+ }
+
+ /**
+ */
+ public String getPhase() {
+ return Phase.SERVICE_BINDING_WIREFORMAT;
+ }
+
+}
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectProviderFactory.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java
index 5811ca53e0..9e92bf40bf 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectProviderFactory.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java
@@ -17,9 +17,10 @@
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime;
import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectReferenceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java
index 9653c0d51e..e0df4f2296 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectReferenceInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime;
import javax.jms.JMSException;
@@ -30,6 +30,7 @@ import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
@@ -74,7 +75,7 @@ public class WireFormatJMSObjectReferenceInterceptor implements Interceptor {
public Message invokeRequest(Message msg) {
try {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
Session session = context.getJmsSession();
javax.jms.Message requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody());
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectReferenceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java
index b993ae9067..42719e842f 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectReferenceProvider.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime;
import java.util.List;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectServiceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java
index 4bfbd2be0e..b06886fae0 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectServiceInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime;
import javax.jms.JMSException;
import javax.jms.Session;
@@ -29,6 +29,7 @@ import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
@@ -73,7 +74,7 @@ public class WireFormatJMSObjectServiceInterceptor implements Interceptor {
public Message invokeRequest(Message msg) {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
javax.jms.Message jmsMsg = context.getJmsMsg();
Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
@@ -84,8 +85,7 @@ public class WireFormatJMSObjectServiceInterceptor implements Interceptor {
public Message invokeResponse(Message msg) {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
- javax.jms.Message requestJMSMsg = context.getJmsMsg();
+ JMSBindingContext context = msg.getBindingContext();
Session session = context.getJmsSession();
javax.jms.Message responseJMSMsg;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectServiceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java
index 9def71a6e0..9b1b405fac 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectServiceProvider.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime;
import java.util.List;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextProviderFactory.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java
index 5480cc8165..555dfb47b5 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextProviderFactory.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java
@@ -17,9 +17,10 @@
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstext;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime;
import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java
new file mode 100644
index 0000000000..fab51a08f0
--- /dev/null
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java
@@ -0,0 +1,119 @@
+/*
+ * 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.tuscany.sca.binding.jms.wireformat.jmstext.runtime;
+
+
+import javax.jms.JMSException;
+import javax.jms.Session;
+
+import org.apache.tuscany.sca.assembly.WireFormat;
+import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
+import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText;
+import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireFormatJMSTextReferenceInterceptor implements Interceptor {
+
+ private Invoker next;
+ private RuntimeWire runtimeWire;
+ private JMSResourceFactory jmsResourceFactory;
+ private JMSBinding jmsBinding;
+ private JMSMessageProcessor requestMessageProcessor;
+ private JMSMessageProcessor responseMessageProcessor;
+
+ public WireFormatJMSTextReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
+ super();
+ this.jmsBinding = jmsBinding;
+ this.runtimeWire = runtimeWire;
+ this.jmsResourceFactory = jmsResourceFactory;
+ this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
+ this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
+ }
+
+ public Message invoke(Message msg) {
+ if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSText){
+ msg = invokeRequest(msg);
+ }
+
+ msg = getNext().invoke(msg);
+
+ if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSText){
+ msg = invokeResponse(msg);
+ }
+
+ return msg;
+ }
+
+ public Message invokeRequest(Message msg) {
+ try {
+ // get the jms context
+ JMSBindingContext context = msg.getBindingContext();
+ Session session = context.getJmsSession();
+
+ Object[] requestParams = msg.getBody();
+ javax.jms.Message requestMsg = null;
+ if (requestParams != null && requestParams.length > 0 ){
+ requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, requestParams[0]);
+ } else {
+ requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, null);
+ }
+ msg.setBody(requestMsg);
+
+ requestMsg.setJMSReplyTo(context.getReplyToDestination());
+
+ return msg;
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+
+ public Message invokeResponse(Message msg) {
+ if (msg.getBody() != null){
+ Object[] response = (Object[])responseMessageProcessor.extractPayloadFromJMSMessage((javax.jms.Message)msg.getBody());
+ if (response != null && response.length > 0){
+ msg.setBody(response[0]);
+ } else {
+ msg.setBody(null);
+ }
+ }
+
+ return msg;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+}
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextReferenceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java
index 7e749a96d6..f7d125dd3e 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextReferenceProvider.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstext;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime;
import java.util.List;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextServiceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java
index 3dc2d0199d..43e0d3e772 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextServiceInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstext;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime;
import javax.jms.JMSException;
import javax.jms.Session;
@@ -29,6 +29,7 @@ import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
@@ -73,7 +74,7 @@ public class WireFormatJMSTextServiceInterceptor implements Interceptor {
public Message invokeRequest(Message msg) {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
javax.jms.Message jmsMsg = context.getJmsMsg();
Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
@@ -84,8 +85,7 @@ public class WireFormatJMSTextServiceInterceptor implements Interceptor {
public Message invokeResponse(Message msg) {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
- javax.jms.Message requestJMSMsg = context.getJmsMsg();
+ JMSBindingContext context = msg.getBindingContext();
Session session = context.getJmsSession();
javax.jms.Message responseJMSMsg;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextServiceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java
index 6f9f0c9da9..f8fff8e981 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextServiceProvider.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstext;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime;
import java.util.List;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLProviderFactory.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.java
index 6bef4e8160..44f490ee37 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLProviderFactory.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLReferenceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java
index 86a5bbb4b2..d0f10b8ba7 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLReferenceInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime;
@@ -88,7 +88,7 @@ public class WireFormatJMSTextXMLReferenceInterceptor implements Interceptor {
public Message invokeRequest(Message msg) {
try {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
Session session = context.getJmsSession();
javax.jms.Message requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody());
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLReferenceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java
index b97084b5ad..69369cd268 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLReferenceProvider.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime;
import java.util.List;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLServiceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java
index ffec9d67f8..778062d945 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLServiceInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime;
import javax.jms.JMSException;
import javax.jms.Session;
@@ -76,7 +76,7 @@ public class WireFormatJMSTextXMLServiceInterceptor implements Interceptor {
public Message invokeRequest(Message msg) {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
+ JMSBindingContext context = msg.getBindingContext();
javax.jms.Message jmsMsg = context.getJmsMsg();
if ("onMessage".equals(msg.getOperation().getName())) {
@@ -92,8 +92,7 @@ public class WireFormatJMSTextXMLServiceInterceptor implements Interceptor {
public Message invokeResponse(Message msg) {
// get the jms context
- JMSBindingContext context = (JMSBindingContext)msg.getHeaders().get(JMSBindingConstants.MSG_CTXT_POSITION);
- javax.jms.Message requestJMSMsg = context.getJmsMsg();
+ JMSBindingContext context = msg.getBindingContext();
Session session = context.getJmsSession();
javax.jms.Message responseJMSMsg;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLServiceProvider.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java
index 651a96f596..2a2332f5fb 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLServiceProvider.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml;
+package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime;
import java.util.List;
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory
index 50dfcdf9a0..99438fcd06 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory
@@ -16,4 +16,4 @@
# under the License.
# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefaultProviderFactory;model=org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault
+org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.runtime.OperationSelectorJMSDefaultProviderFactory;model=org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory
index c82d4e7cab..02ae135f16 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory
@@ -16,7 +16,7 @@
# under the License.
# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXMLProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML
-org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytesProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes
-org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSTextProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText
-org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObjectProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject
+org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime.WireFormatJMSTextXMLProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML
+org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime.WireFormatJMSBytesProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes
+org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime.WireFormatJMSTextProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText
+org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime.WireFormatJMSObjectProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject
diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java b/branches/sca-java-1.x/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java
index 43505a8d33..2928647445 100644
--- a/branches/sca-java-1.x/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java
+++ b/branches/sca-java-1.x/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java
@@ -71,7 +71,7 @@ public class Axis2TokenAuthenticationServicePolicyInterceptor implements Interce
Axis2SOAPHeaderString header = (Axis2SOAPHeaderString)Axis2HeaderPolicyUtil.getHeader(msg, policy.getTokenName());
if (header != null) {
- System.out.println("Token: " + header.getHeaderString());
+ System.out.println("Web service received token: " + header.getHeaderString());
// call out here to some 3rd party system to do whatever you
// need to turn header credentials into an authenticated principal
diff --git a/branches/sca-java-1.x/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java b/branches/sca-java-1.x/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
index 9c6f4a3500..16cb4132e4 100644
--- a/branches/sca-java-1.x/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
+++ b/branches/sca-java-1.x/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
@@ -113,4 +113,15 @@ public interface Message {
* @return
*/
List<Object> getHeaders();
+
+ /**
+ * Returns the binding context in force for this message
+ */
+ <T> T getBindingContext();
+
+ /**
+ * Set the binding context that is in force for this message
+ * @param bindingContext
+ */
+ <T> void setBindingContext(T bindingContext);
}
diff --git a/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java b/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
index b6f949f081..f03071ae88 100644
--- a/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
+++ b/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
@@ -238,7 +238,7 @@ public class RuntimeWireImpl implements RuntimeWire {
if (p instanceof PolicyProviderRRB) {
Interceptor interceptor = ((PolicyProviderRRB)p).createBindingInterceptor();
if (interceptor != null) {
- bindingInvocationChain.addInterceptor(p.getPhase(), interceptor);
+ bindingInvocationChain.addInterceptor(Phase.REFERENCE_BINDING_POLICY, interceptor);
}
}
}
@@ -263,13 +263,12 @@ public class RuntimeWireImpl implements RuntimeWire {
if (p instanceof PolicyProviderRRB) {
Interceptor interceptor = ((PolicyProviderRRB)p).createBindingInterceptor();
if (interceptor != null) {
- bindingInvocationChain.addInterceptor(p.getPhase(), interceptor);
+ bindingInvocationChain.addInterceptor(Phase.SERVICE_BINDING_POLICY, interceptor);
}
}
}
}
-
// TODO - add something on the end of the wire to invoke the
// invocation chain. Need to split out the runtime
// wire invoker into conversation, callback interceptors etc
diff --git a/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java b/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
index a45362a92d..ca2bf051c8 100644
--- a/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
+++ b/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
@@ -32,6 +32,7 @@ import org.apache.tuscany.sca.runtime.EndpointReference;
* @version $Rev $Date$
*/
public class MessageImpl implements Message {
+ private Object bindingContext;
private List<Object> headers = new ArrayList<Object>();
private Object body;
private Object messageID;
@@ -99,6 +100,14 @@ public class MessageImpl implements Message {
public List<Object> getHeaders() {
return headers;
- }
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getBindingContext() {
+ return (T)bindingContext;
+ }
+ public <T> void setBindingContext(T bindingContext) {
+ this.bindingContext = bindingContext;
+ }
}
diff --git a/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java b/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
index 582d1ee141..d6911281c8 100644
--- a/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
+++ b/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
@@ -189,6 +189,13 @@ public class NonBlockingInterceptor implements Interceptor {
public List<Object> getHeaders() {
return null;
+ }
+
+ public <T> T getBindingContext() {
+ return null;
+ }
+
+ public <T> void setBindingContext(T bindingContext) {
}
}
diff --git a/branches/sca-java-1.x/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java b/branches/sca-java-1.x/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java
index 7a3c4bdf5a..f5889e9679 100644
--- a/branches/sca-java-1.x/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java
+++ b/branches/sca-java-1.x/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java
@@ -94,5 +94,12 @@ public class ImmutableMessage implements Message {
public List<Object> getHeaders() {
return null;
}
+
+ public <T> T getBindingContext() {
+ return null;
+ }
+
+ public <T> void setBindingContext(T bindingContext) {
+ }
}