diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-11 09:21:30 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-11 09:21:30 +0000 |
commit | 477822879b76d6c06714d37066cc6b1386c9028f (patch) | |
tree | 238820c4218d2303f51427abdd605d89fc1ef5d3 /java/sca/modules | |
parent | 3e808a35db995a7432a57a2b3795d4384b343f89 (diff) |
Copy methods to reset input/output types from 1.x to 2.x as used by JMS wireformats
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@813735 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
2 files changed, 77 insertions, 0 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java index 24f23e255d..b72cade0cc 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java @@ -82,6 +82,22 @@ public interface Interface extends Cloneable, PolicySubject { void resetDataBinding(String dataBinding); /** + * Set the interface input types by copying those from the + * interface provided + * + * @param newInterface + */ + public void resetInterfaceInputTypes(Interface newInterface); + + /** + * Set the interface output types by copying those from the + * interface provided + * + * @param newInterface + */ + public void resetInterfaceOutputTypes(Interface newInterface); + + /** * Returns true if the Interface is dynamic. * * @return true if the Interface is dynamic. diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java index 67aae7da4d..37929c3242 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java @@ -219,6 +219,67 @@ public class InterfaceImpl implements Interface { } } + public void resetInterfaceInputTypes(Interface newInterface){ + for (int i = 0; i < getOperations().size(); i++) { + // only remote interfaces only have a data type model defined + // and in this case operations cannot be overloaded so match + // operations by name + Operation oldOperation = getOperations().get(i); + Operation newOperation = null; + + for (Operation tmpOperation : newInterface.getOperations()){ + if (tmpOperation.getName().equals(oldOperation.getName())){ + newOperation = tmpOperation; + } + } + + if (newOperation == null){ + break; + } + + // set input types + oldOperation.setInputType(newOperation.getInputType()); + + // set wrapper + if (newOperation.isWrapperStyle()) { + oldOperation.setWrapperStyle(true); + oldOperation.setWrapper(newOperation.getWrapper()); + } + } + } + + public void resetInterfaceOutputTypes(Interface newInterface){ + for (int i = 0; i < getOperations().size(); i++) { + // only remote interfaces only have a data type model defined + // and in this case operations cannot be overloaded so match + // operations by name + Operation oldOperation = getOperations().get(i); + Operation newOperation = null; + + for (Operation tmpOperation : newInterface.getOperations()){ + if (tmpOperation.getName().equals(oldOperation.getName())){ + newOperation = tmpOperation; + } + } + + if (newOperation == null){ + break; + } + + // set output types + oldOperation.setOutputType(newOperation.getOutputType()); + + // set fault types + oldOperation.setFaultTypes(newOperation.getFaultTypes()); + + // set wrapper + if (newOperation.isWrapperStyle()) { + oldOperation.setWrapperStyle(true); + oldOperation.setWrapper(newOperation.getWrapper()); + } + } + } + public boolean isDynamic() { return false; } |