summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java')
-rw-r--r--branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java82
1 files changed, 72 insertions, 10 deletions
diff --git a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
index e2a524c5e0..23f1eec8cf 100644
--- a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
+++ b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
@@ -151,10 +151,11 @@ public class InterfaceImpl implements Interface {
}
}
- if (op.isWrapperStyle()) {
- WrapperInfo wrapper = op.getWrapper();
- if (wrapper != null) {
- DataType<List<DataType>> unwrappedInputType = wrapper.getUnwrappedInputType();
+
+ if (op.isInputWrapperStyle()) {
+ WrapperInfo inputWrapperInfo = op.getInputWrapper();
+ if (inputWrapperInfo != null) {
+ DataType<List<DataType>> unwrappedInputType = inputWrapperInfo.getUnwrappedInputType();
if (unwrappedInputType != null) {
for (DataType d : unwrappedInputType.getLogical()) {
if (d.getDataBinding() == null) {
@@ -162,7 +163,13 @@ public class InterfaceImpl implements Interface {
}
}
}
- DataType unwrappedOutputType = wrapper.getUnwrappedOutputType();
+ }
+ }
+
+ if (op.isOutputWrapperStyle()) {
+ WrapperInfo outputWrapperInfo = op.getOutputWrapper();
+ if (outputWrapperInfo != null){
+ DataType unwrappedOutputType = outputWrapperInfo.getUnwrappedOutputType();
if (unwrappedOutputType != null && unwrappedOutputType.getDataBinding() == null) {
unwrappedOutputType.setDataBinding(dataBinding);
}
@@ -179,6 +186,54 @@ public class InterfaceImpl implements Interface {
dataType.setDataBinding(dataBinding);
}
}
+
+ public void resetInterfaceInputTypes(Interface newInterface){
+ for (int i = 0; i < getOperations().size(); i++) {
+ // TODO - same operation order is assumed. How to really
+ // find the right operation when we know that the
+ // data types will be different
+ Operation oldOperation = getOperations().get(i);
+ Operation newOperation = newInterface.getOperations().get(i);
+
+ if (!oldOperation.getName().equals(newOperation.getName())){
+ break;
+ }
+
+ // set input types
+ oldOperation.setInputType(newOperation.getInputType());
+
+ // set wrapper
+ if (newOperation.isInputWrapperStyle()) {
+ oldOperation.setInputWrapperStyle(true);
+ oldOperation.setInputWrapper(newOperation.getInputWrapper());
+ }
+ }
+ }
+
+ public void resetInterfaceOutputTypes(Interface newInterface){
+ for (int i = 0; i < getOperations().size(); i++) {
+ // TODO - same operation order is assumed. How to really
+ // find the right operation when we know that the
+ // data types will be different
+ Operation oldOperation = getOperations().get(i);
+ Operation newOperation = newInterface.getOperations().get(i);
+
+ if (!oldOperation.getName().equals(newOperation.getName())){
+ break;
+ }
+
+ // set output types
+ oldOperation.setOutputType(newOperation.getOutputType());
+
+ // set fault types
+ oldOperation.setFaultTypes(newOperation.getFaultTypes());
+
+ // set wrapper
+ if (newOperation.isOutputWrapperStyle()) {
+ oldOperation.setOutputWrapper(newOperation.getOutputWrapper());
+ }
+ }
+ }
public void resetDataBinding(String dataBinding) {
for (Operation op : getOperations()) {
@@ -200,16 +255,23 @@ 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 inputWrapperInfo = op.getInputWrapper();
+ if (inputWrapperInfo != null) {
+ DataType<List<DataType>> unwrappedInputType = inputWrapperInfo.getUnwrappedInputType();
if (unwrappedInputType != null) {
for (DataType d : unwrappedInputType.getLogical()) {
setDataBinding(d, dataBinding);
}
}
- DataType unwrappedOutputType = wrapper.getUnwrappedOutputType();
+ }
+ }
+
+ if (op.isOutputWrapperStyle()) {
+ WrapperInfo outputWrapperInfo = op.getOutputWrapper();
+ if (outputWrapperInfo != null){
+ DataType unwrappedOutputType = outputWrapperInfo.getUnwrappedOutputType();
if (unwrappedOutputType != null) {
setDataBinding(unwrappedOutputType, dataBinding);
}