diff options
Diffstat (limited to '')
3 files changed, 134 insertions, 30 deletions
diff --git a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java index 9e7d6882f7..149e6306e5 100644 --- a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java +++ b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java @@ -87,14 +87,14 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { boolean checkSourceWrapper = true; List<DataType> sourceInputType = source.getInputType().getLogical(); - if (source.isWrapperStyle() && source.getWrapper() != null) { - sourceInputType = source.getWrapper().getUnwrappedInputType().getLogical(); + if (source.isInputWrapperStyle() && source.getInputWrapper() != null) { + sourceInputType = source.getInputWrapper().getUnwrappedInputType().getLogical(); checkSourceWrapper = false; } boolean checkTargetWrapper = true; List<DataType> targetInputType = target.getInputType().getLogical(); - if (target.isWrapperStyle() && target.getWrapper() != null) { - targetInputType = target.getWrapper().getUnwrappedInputType().getLogical(); + if (target.isInputWrapperStyle() && target.getInputWrapper() != null) { + targetInputType = target.getInputWrapper().getUnwrappedInputType().getLogical(); checkTargetWrapper = false; } 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); } diff --git a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java index 00a5dc3065..4b61dbe7ea 100644 --- a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java +++ b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java @@ -50,8 +50,12 @@ public class OperationImpl implements Operation { private Interface interfaze; private ConversationSequence conversationSequence = ConversationSequence.CONVERSATION_NONE; private boolean nonBlocking; - private boolean wrapperStyle; - private WrapperInfo wrapper; + // TODO - WI + //private WrapperInfo wrapper; + private boolean inputWrapperStyle; + private boolean outputWrapperStyle; + private WrapperInfo inputWrapper; + private WrapperInfo outputWrapper; private boolean dynamic; private Map<QName, List<DataType<XMLType>>> faultBeans; @@ -238,38 +242,76 @@ public class OperationImpl implements Operation { /** * @return the wrapperInfo */ - public WrapperInfo getWrapper() { - return wrapper; - } + // TODO - WI + //public WrapperInfo getWrapper() { + // return wrapper; + //} /** * @param wrapperInfo the wrapperInfo to set */ - public void setWrapper(WrapperInfo wrapperInfo) { - this.wrapper = wrapperInfo; + // TODO - WI + //public void setWrapper(WrapperInfo wrapperInfo) { + // this.wrapper = wrapperInfo; + //} + + public WrapperInfo getInputWrapper() { + return inputWrapper; + } + + public void setInputWrapper(WrapperInfo inputWrapper) { + this.inputWrapper = inputWrapper; + } + + public WrapperInfo getOutputWrapper() { + return outputWrapper; + } + + public void setOutputWrapper(WrapperInfo outputWrapper) { + this.outputWrapper = outputWrapper; } /** - * @return the wrapperStyle + * @return the inputWrapperStyle */ - public boolean isWrapperStyle() { - return wrapperStyle; + public boolean isInputWrapperStyle() { + return inputWrapperStyle; } /** - * @param wrapperStyle the wrapperStyle to set + * @param inputWrapperStyle the wrapperStyle to set */ - public void setWrapperStyle(boolean wrapperStyle) { - this.wrapperStyle = wrapperStyle; + public void setInputWrapperStyle(boolean wrapperStyle) { + this.inputWrapperStyle = wrapperStyle; + } + + /** + * @return the outputWrapperStyle + */ + public boolean isOutputWrapperStyle() { + return inputWrapperStyle; } + /** + * @param outputWrapperStyle the wrapperStyle to set + */ + public void setOutputWrapperStyle(boolean wrapperStyle) { + this.inputWrapperStyle = wrapperStyle; + } + + // TODO - WI + // These are deprecated and are a little awkward now that + // we split input wrapper from output wrapper public String getDataBinding() { - return wrapper != null ? wrapper.getDataBinding() : null; + return inputWrapper != null ? inputWrapper.getDataBinding() : null; } public void setDataBinding(String dataBinding) { - if (wrapper != null) { - wrapper.setDataBinding(dataBinding); + if (inputWrapper != null) { + inputWrapper.setDataBinding(dataBinding); + } + if (outputWrapper != null) { + outputWrapper.setDataBinding(dataBinding); } } |