summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-04-30 12:29:50 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-04-30 12:29:50 +0000
commit34766b4b32027392eb927557cdb6230061803e7c (patch)
treea64214a0e0c9bbb3bdbdc4f0b0dd941d33f3f0b6 /branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java
parent1936c49187913656f82d289f5e72bdf536c142bf (diff)
TUSCANY-2996 - Add support for wrapSingle attribute that, when set true, ensures that single parameters are wrapped in an array on the wire. When set false single parameters will not be wrapped on the wire. Multiple parameters will always be wrapped.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@770201 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java')
-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.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/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 e5887ec1b7..dc4726f4b7 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/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
@@ -20,12 +20,16 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime;
+import java.util.HashMap;
+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.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
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.provider.WireFormatProvider;
@@ -41,6 +45,8 @@ public class WireFormatJMSObjectServiceProvider implements WireFormatProvider {
private RuntimeComponentService service;
private JMSBinding binding;
private InterfaceContract interfaceContract;
+ private HashMap<String,Class<?>> singleArgMap;
+ private boolean wrapSingle = true;
public WireFormatJMSObjectServiceProvider(ExtensionPointRegistry registry,
RuntimeComponent component,
@@ -51,6 +57,7 @@ public class WireFormatJMSObjectServiceProvider implements WireFormatProvider {
this.component = component;
this.service = service;
this.binding = (JMSBinding)binding;
+ this.singleArgMap = new HashMap<String,Class<?>>();
// configure the service based on this wire format
@@ -59,6 +66,17 @@ public class WireFormatJMSObjectServiceProvider implements WireFormatProvider {
// any message processors specified in the SCDL in this case
if (this.binding.getRequestWireFormat() instanceof WireFormatJMSObject){
this.binding.setRequestMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME);
+
+ List<Operation> opList = service.getService().getInterfaceContract().getInterface().getOperations();
+
+ for (Operation op: opList) {
+ if (op.getInputType().getLogical().size() == 1){
+ this.singleArgMap.put(op.getName(), op.getInputType().getLogical().get(0).getPhysical());
+ }
+ }
+
+ wrapSingle = ((WireFormatJMSObject) this.binding.getRequestWireFormat()).isWrappedSingleInput();
+
}
if (this.binding.getResponseWireFormat() instanceof WireFormatJMSObject){
this.binding.setResponseMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME);
@@ -67,6 +85,8 @@ public class WireFormatJMSObjectServiceProvider implements WireFormatProvider {
// just point to the reference interface contract so no
// databinding transformation takes place
interfaceContract = service.getInterfaceContract();
+
+
}
public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
@@ -88,9 +108,9 @@ public class WireFormatJMSObjectServiceProvider implements WireFormatProvider {
/**
*/
public Interceptor createInterceptor() {
- return new WireFormatJMSObjectServiceInterceptor((JMSBinding)binding,
- null,
- service.getRuntimeWire(binding));
+
+ return new WireFormatJMSObjectServiceInterceptor((JMSBinding)binding, null,service.getRuntimeWire(binding),
+ this.singleArgMap, wrapSingle );
}
/**