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
This commit is contained in:
parent
3e808a35db
commit
477822879b
2 changed files with 77 additions and 0 deletions
java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef
|
@ -81,6 +81,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.
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue