Hi,

We simply test if sourceInterfaceClass.isAssignableFrom(targetInterfaceClass) 
in the ConnectorImpl to decide if a source can be wired to a target. I'm 
getting a BuilderConfigException if I try to wire a reference to a component 
with a compatible interface defined by the SCA spec. A similar problem (Java 
vs.WSDL) was reported by Scott in the JIRA issue TUSCANY-686.

org.apache.tuscany.spi.builder.BuilderConfigException: Incompatible source and 
target interfaces
 at 
org.apache.tuscany.core.builder.ConnectorImpl.connect(ConnectorImpl.java:331)
 at 
org.apache.tuscany.core.builder.ConnectorImpl.connect(ConnectorImpl.java:116)
 at 
org.apache.tuscany.core.implementation.composite.AbstractCompositeComponent.prepare(AbstractCompositeComponent.java:244)
 at org.apache.tuscany.core.deployer.DeployerImpl.deploy(DeployerImpl.java:86)
 at 
org.apache.tuscany.core.launcher.LauncherImpl.bootApplication(LauncherImpl.java:193)
 at org.apache.tuscany.test.SCATestCase.setUp(SCATestCase.java:65)
 at echo.BootstrapTestCase.setUp(BootstrapTestCase.java:41)
...

The following is quoted from the SCA spec:

"A wire may only connect a source to a target if the target implements an 
interface that is compatible with the interface required by the source. The 
source and the target are compatible if:
1. the source interface and the target interface MUST either both be remotable 
or they are both local
2. the methods on the target interface MUST be the same as or be a superset of 
the methods in the interface specified on the source
3. compatibility for the individual method is defined as compatibility of the 
signature, that is method name, input types, and output types MUST BE 
the same.
4. the order of the input and output types also MUST BE the same.
5. the set of Faults and Exceptions expected by the source MUST BE the same or 
be a superset of those specified by the service.
6. other specified attributes of the two interfaces MUST match, including Scope 
and Callback interface

A Wire can connect between different interface languages (eg. Java interfaces 
and WSDL portTypes) in either direction, as long as the 
operations defined by the two interface types are equivalent. They are 
equivalent if the operation(s), parameter(s), return value(s) and 
faults/exceptions map to each other."

I'm adding the following two methods to the ServiceContract and Operation 
models to implement the algorithm (I feel it should be different than 
equals()). But I wonder if they should be hosted by something else like 
"WireService". Any opinions?

boolean isCompatibleTarget(ServiceContract<?> targetServiceContract);

boolean isCompatibleTarget(Operation<?> operation);

Another interesting thing is that how databinding transformation will change 
the "compatiblity" story. Does it make sense to say "two operations are 
compatible if the they have the same name and input/output/fault types can be 
transformed from one to the other"? I guess the answer could impact the SCA 
spec.

Thanks,
Raymond


Reply via email to