summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl')
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java38
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java58
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java73
3 files changed, 110 insertions, 59 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
index 7e51e38aaf..d04c8b4d97 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
@@ -245,36 +245,29 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper {
boolean passByValue = (source.getInterface().isRemotable()) && byValue;
- // if (source.getInterface().isRemotable()) {
- // return true;
- // }
-
// FIXME: We need to deal with wrapped<-->unwrapped conversion
- // Check output type
List<DataType> sourceOutputType = source.getOutputType().getLogical();
List<DataType> targetOutputType = target.getOutputType().getLogical();
- boolean checkSourceWrapper = true;
List<DataType> sourceInputType = source.getInputType().getLogical();
- if (source.isWrapperStyle() && source.getWrapper() != null) {
- sourceInputType = source.getWrapper().getUnwrappedInputType().getLogical();
- sourceOutputType = source.getWrapper().getUnwrappedOutputType().getLogical();
- checkSourceWrapper = false;
- }
- boolean checkTargetWrapper = true;
List<DataType> targetInputType = target.getInputType().getLogical();
- if (target.isWrapperStyle() && target.getWrapper() != null) {
- targetInputType = target.getWrapper().getUnwrappedInputType().getLogical();
- targetOutputType = target.getWrapper().getUnwrappedOutputType().getLogical();
- checkTargetWrapper = false;
+
+ if (source.isInputWrapperStyle() && source.getInputWrapper() != null) {
+ sourceInputType = source.getInputWrapper().getUnwrappedType().getLogical();
+ }
+
+ if (source.isOutputWrapperStyle() && source.getOutputWrapper() != null) {
+ sourceOutputType = source.getOutputWrapper().getUnwrappedType().getLogical();
}
- /* TODO - Why are we assuming compatibility if one side is wrapped and the other is not?
- if (checkSourceWrapper != checkTargetWrapper) {
- return true;
+ if (target.isInputWrapperStyle() && target.getInputWrapper() != null) {
+ targetInputType = target.getInputWrapper().getUnwrappedType().getLogical();
+ }
+
+ if (target.isOutputWrapperStyle() && target.getOutputWrapper() != null) {
+ targetOutputType = target.getOutputWrapper().getUnwrappedType().getLogical();
}
- */
if ( sourceOutputType.size() != targetOutputType.size()) {
if (audit != null){
@@ -294,7 +287,6 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper {
}
}
-
if (sourceInputType.size() != targetInputType.size()) {
if (audit != null){
audit.append("different number of input types");
@@ -348,7 +340,9 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper {
@Override
public boolean isCompatibleWithoutUnwrapByValue(Operation source, Operation target, Compatibility compatibilityType) {
- if (!source.isWrapperStyle() == target.isWrapperStyle()) {
+ if (!source.isInputWrapperStyle() == target.isInputWrapperStyle()) {
+ return false;
+ } else if (!source.isOutputWrapperStyle() == target.isOutputWrapperStyle()) {
return false;
} else {
return isCompatible(source, target, compatibilityType, true);
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
index 1daa6baf9c..ec7c784547 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
@@ -161,10 +161,10 @@ public class InterfaceImpl implements Interface {
}
}
- if (op.isWrapperStyle()) {
- WrapperInfo wrapper = op.getWrapper();
+ if (op.isInputWrapperStyle()) {
+ WrapperInfo wrapper = op.getInputWrapper();
if (wrapper != null) {
- DataType<List<DataType>> unwrappedInputType = wrapper.getUnwrappedInputType();
+ DataType<List<DataType>> unwrappedInputType = wrapper.getUnwrappedType();
if (unwrappedInputType != null) {
for (DataType d : unwrappedInputType.getLogical()) {
if (d.getDataBinding() == null) {
@@ -172,12 +172,21 @@ public class InterfaceImpl implements Interface {
}
}
}
- DataType unwrappedOutputType = wrapper.getUnwrappedOutputType();
- if (unwrappedOutputType != null && unwrappedOutputType.getDataBinding() == null) {
- unwrappedOutputType.setDataBinding(dataBinding);
- }
}
}
+ if (op.isOutputWrapperStyle()) {
+ WrapperInfo wrapper = op.getOutputWrapper();
+ if (wrapper != null) {
+ DataType<List<DataType>> unwrappedOutputType = wrapper.getUnwrappedType();
+ if (unwrappedOutputType != null){
+ for (DataType d : unwrappedOutputType.getLogical()) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBinding);
+ }
+ }
+ }
+ }
+ }
}
}
}
@@ -188,7 +197,7 @@ public class InterfaceImpl implements Interface {
} else {
dataType.setDataBinding(dataBinding);
}
- }
+ }
public void resetDataBinding(String dataBinding) {
for (Operation op : getOperations()) {
@@ -213,29 +222,34 @@ public class InterfaceImpl implements Interface {
setDataBinding((DataType) d.getLogical(), dataBinding);
}
}
- if (op.isWrapperStyle()) {
- WrapperInfo wrapper = op.getWrapper();
- if (wrapper != null) {
- DataType<List<DataType>> unwrappedInputType = wrapper.getUnwrappedInputType();
+ if (op.isInputWrapperStyle()) {
+ WrapperInfo inputWrapper = op.getInputWrapper();
+ if (inputWrapper != null) {
+ DataType<List<DataType>> unwrappedInputType = inputWrapper.getUnwrappedType();
if (unwrappedInputType != null) {
for (DataType d : unwrappedInputType.getLogical()) {
setDataBinding(d, dataBinding);
}
}
- DataType<List<DataType>> unwrappedOutputType = wrapper.getUnwrappedOutputType();
+ }
+ }
+ if (op.isOutputWrapperStyle()) {
+ WrapperInfo outputWrapper = op.getOutputWrapper();
+ if (outputWrapper != null) {
+ DataType<List<DataType>> unwrappedOutputType = outputWrapper.getUnwrappedType();
if (unwrappedOutputType != null) {
for (DataType d : unwrappedOutputType.getLogical()) {
setDataBinding(d, dataBinding);
}
}
}
- }
+ }
}
}
public void resetInterfaceInputTypes(Interface newInterface){
for (int i = 0; i < getOperations().size(); i++) {
- // only remote interfaces only have a data type model defined
+ // only remote interfaces have a data type model defined
// and in this case operations cannot be overloaded so match
// operations by name
Operation oldOperation = getOperations().get(i);
@@ -255,16 +269,16 @@ public class InterfaceImpl implements Interface {
oldOperation.setInputType(newOperation.getInputType());
// set wrapper
- if (newOperation.isWrapperStyle()) {
- oldOperation.setWrapperStyle(true);
- oldOperation.setWrapper(newOperation.getWrapper());
+ if (newOperation.isInputWrapperStyle()) {
+ oldOperation.setInputWrapperStyle(true);
+ oldOperation.setInputWrapper(newOperation.getInputWrapper());
}
}
}
public void resetInterfaceOutputTypes(Interface newInterface){
for (int i = 0; i < getOperations().size(); i++) {
- // only remote interfaces only have a data type model defined
+ // only remote interfaces have a data type model defined
// and in this case operations cannot be overloaded so match
// operations by name
Operation oldOperation = getOperations().get(i);
@@ -287,9 +301,9 @@ public class InterfaceImpl implements Interface {
oldOperation.setFaultTypes(newOperation.getFaultTypes());
// set wrapper
- if (newOperation.isWrapperStyle()) {
- oldOperation.setWrapperStyle(true);
- oldOperation.setWrapper(newOperation.getWrapper());
+ if (newOperation.isOutputWrapperStyle()) {
+ oldOperation.setOutputWrapperStyle(true);
+ oldOperation.setOutputWrapper(newOperation.getOutputWrapper());
}
}
}
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
index b820f95fcf..8d6cbc6d86 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
@@ -51,8 +51,10 @@ public class OperationImpl implements Operation {
private Interface interfaze;
private List<ParameterMode> parameterModes = new ArrayList<ParameterMode>();
private boolean nonBlocking;
- private boolean wrapperStyle;
- private WrapperInfo wrapper;
+ private boolean inputWrapperStyle;
+ private boolean outputWrapperStyle;
+ private WrapperInfo inputWrapper;
+ private WrapperInfo outputWrapper;
private boolean dynamic;
private boolean notSubjectToWrapping;
@@ -167,38 +169,75 @@ public class OperationImpl implements Operation {
/**
* @return the wrapperInfo
*/
- public WrapperInfo getWrapper() {
- return wrapper;
+ public WrapperInfo getInputWrapper() {
+ return inputWrapper;
}
/**
* @param wrapperInfo the wrapperInfo to set
*/
- public void setWrapper(WrapperInfo wrapperInfo) {
- this.wrapper = wrapperInfo;
+ public void setInputWrapper(WrapperInfo wrapperInfo) {
+ this.inputWrapper = wrapperInfo;
}
+
+ /**
+ * @return the wrapperInfo
+ */
+ public WrapperInfo getOutputWrapper() {
+ return outputWrapper;
+ }
+
+ /**
+ * @param wrapperInfo the wrapperInfo to set
+ */
+ public void setOutputWrapper(WrapperInfo wrapperInfo) {
+ this.outputWrapper = wrapperInfo;
+ }
/**
* @return the wrapperStyle
*/
- public boolean isWrapperStyle() {
- return wrapperStyle;
+ public boolean isInputWrapperStyle() {
+ return inputWrapperStyle;
}
/**
* @param wrapperStyle the wrapperStyle to set
*/
- public void setWrapperStyle(boolean wrapperStyle) {
- this.wrapperStyle = wrapperStyle;
+ public void setInputWrapperStyle(boolean wrapperStyle) {
+ this.inputWrapperStyle = wrapperStyle;
+ }
+
+ /**
+ * @return the wrapperStyle
+ */
+ public boolean isOutputWrapperStyle() {
+ return outputWrapperStyle;
}
+ /**
+ * @param wrapperStyle the wrapperStyle to set
+ */
+ public void setOutputWrapperStyle(boolean wrapperStyle) {
+ this.outputWrapperStyle = wrapperStyle;
+ }
+
public String getDataBinding() {
- return wrapper != null ? wrapper.getDataBinding() : null;
+ if (inputWrapper != null){
+ return inputWrapper.getDataBinding();
+ }
+ if (outputWrapper != null){
+ return outputWrapper.getDataBinding();
+ }
+ return null;
}
public void setDataBinding(String dataBinding) {
- if (wrapper != null) {
- wrapper.setDataBinding(dataBinding);
+ if (inputWrapper != null) {
+ inputWrapper.setDataBinding(dataBinding);
+ }
+ if (outputWrapper != null) {
+ outputWrapper.setDataBinding(dataBinding);
}
}
@@ -258,8 +297,12 @@ public class OperationImpl implements Operation {
copy.attributes.putAll(attributes);
// [rfeng] We need to clone the wrapper as it holds the databinding information
- if (wrapper != null) {
- copy.wrapper = (WrapperInfo)wrapper.clone();
+ if (inputWrapper != null) {
+ copy.inputWrapper = (WrapperInfo)inputWrapper.clone();
+ }
+
+ if (outputWrapper != null) {
+ copy.outputWrapper = (WrapperInfo)outputWrapper.clone();
}
return copy;