org.apache.tuscany.sca.assembly
Interface Contract

All Superinterfaces:
AbstractContract, Base, java.lang.Cloneable, Extensible, IntentAttachPoint, OperationsConfigurator, PolicySetAttachPoint
All Known Subinterfaces:
ComponentReference, ComponentService, CompositeReference, CompositeService, Reference, RuntimeComponentReference, RuntimeComponentService, Service
All Known Implementing Classes:
ComponentReferenceImpl, ComponentServiceImpl, CompositeReferenceImpl, CompositeServiceImpl, ReferenceImpl, RuntimeComponentReferenceImpl, RuntimeComponentServiceImpl, ServiceImpl

public interface Contract
extends AbstractContract, PolicySetAttachPoint, java.lang.Cloneable

Represents a contract. A contract can be either a service or a reference.


Method Summary
 java.lang.Object clone()
          Returns a clone of the contract.
<B> B
getBinding(java.lang.Class<B> bindingClass)
          Returns a binding of the specified type or null if there is no such binding configured on this contract.
 java.util.List<Binding> getBindings()
          Returns the bindings supported by this contract.
 Callback getCallback()
          Returns a callback definition of the bindings to use for callbacks.
<B> B
getCallbackBinding(java.lang.Class<B> bindingClass)
          Returns a callback binding of the specified type or null if there is no such callback binding configured on this contract.
 InterfaceContract getInterfaceContract(Binding binding)
          Returns the interface contract given a binding.
 void setCallback(Callback callback)
          Sets a callback definition of the bindings to use for callbacks
 
Methods inherited from interface org.apache.tuscany.sca.assembly.AbstractContract
getInterfaceContract, getName, isCallback, setInterfaceContract, setIsCallback, setName
 
Methods inherited from interface org.apache.tuscany.sca.assembly.Base
isUnresolved, setUnresolved
 
Methods inherited from interface org.apache.tuscany.sca.assembly.Extensible
getExtensions
 
Methods inherited from interface org.apache.tuscany.sca.assembly.OperationsConfigurator
getConfiguredOperations
 
Methods inherited from interface org.apache.tuscany.sca.policy.PolicySetAttachPoint
getApplicablePolicySets, getPolicySets
 
Methods inherited from interface org.apache.tuscany.sca.policy.IntentAttachPoint
getRequiredIntents, getType, setType
 

Method Detail

getBindings

java.util.List<Binding> getBindings()
Returns the bindings supported by this contract.

Returns:
the bindings supported by this contract

getBinding

<B> B getBinding(java.lang.Class<B> bindingClass)
Returns a binding of the specified type or null if there is no such binding configured on this contract.

Type Parameters:
B - the binding type
Parameters:
bindingClass - the binding type class
Returns:
the binding or null if there is no binding of the specified type

getCallbackBinding

<B> B getCallbackBinding(java.lang.Class<B> bindingClass)
Returns a callback binding of the specified type or null if there is no such callback binding configured on this contract.

Type Parameters:
B - the callback binding type
Parameters:
bindingClass - the callback binding type class
Returns:
the callback binding or null if there is no callback binding of the specified type

getCallback

Callback getCallback()
Returns a callback definition of the bindings to use for callbacks.

Returns:
a definition of the bindings to use for callbacks

setCallback

void setCallback(Callback callback)
Sets a callback definition of the bindings to use for callbacks

Parameters:
callback - a definition of the bindings to use for callbacks

clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the contract.

Returns:
a clone of the reference
Throws:
java.lang.CloneNotSupportedException

getInterfaceContract

InterfaceContract getInterfaceContract(Binding binding)
Returns the interface contract given a binding. Important in the case where a reference with multiplicity > 1 has been promoted and has it's list of resolved bindings extended by a promoting reference. Here the binding from the promoting reference may need the interface contract from the promoting reference and not the promoted reference. TODO - remove this wrinkle with better endpoint support.

Parameters:
binding - the binding for which the interface contract is required
Returns:
the interface contract