You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Raymond Feng <en...@gmail.com> on 2006/06/26 20:35:28 UTC

Question about Bindings

Hi,

To my understanding, bindings can apply to services and references of a composite. A binding can be used for:

1) Both services and references
2) References only
3) Services only

In some cases, a binding may take different set of metadata depending on whether it's used by a service or a reference. For example, for a TCP/IP binding, the reference needs to know the host name and port number of the target TCP/IP server. But if you wants to publish your component as a service over TCP/IP, maybe only the port number (hostname is always localhost) is good enough.

<reference>
    <tcpip:binding.tcpip host="a.com" port="8888"/>
</reference>

<service>
    <tcpip:binding.tcpip port="8888"/>
</service>

What's the best practice here to model TCP/IP binding? I can imagine three ways:

1) One TCP/IP binding to contain all properties required for both services and references
2) One base TCP/IP binding and two sub types: TCP/IP reference binding and TCP/IP service binding
3) Two different TCP/IP bindings, one for references and one for services


What's the implication on the BindingBuilder SPI if the binding is asymetric for references and services? I assume one of the following build() methods will be NOP if a given binding can only be used by either references or services. 

public interface BindingBuilder<B extends Binding> {
    SCAObject build(CompositeComponent parent,
                    BoundServiceDefinition<B> boundServiceDefinition,
                    DeploymentContext deploymentContext);

    SCAObject build(CompositeComponent parent,
                    BoundReferenceDefinition<B> boundReferenceDefinition,
                    DeploymentContext deploymentContext);
}

Please clarify if I misunderstand something here.

Thanks,
Raymond