Tuscany Core

org.apache.tuscany.core.extension
Class WireBuilderSupport<T extends ContextFactory<?>>

java.lang.Object
  extended by org.apache.tuscany.core.extension.WireBuilderSupport<T>
All Implemented Interfaces:
WireBuilder

public abstract class WireBuilderSupport<T extends ContextFactory<?>>
extends java.lang.Object
implements WireBuilder

A base class for WireBuilder implementations

Version:
$$Rev$$ $$Date$$

Field Summary
protected  RuntimeContext runtimeContext
           
protected  java.lang.Class targetClass
           
 
Constructor Summary
WireBuilderSupport()
           
 
Method Summary
 void completeTargetChain(TargetWireFactory targetFactory, java.lang.Class targetType, ScopeContext targetScopeContext)
          Finishes processing the target side wire chain.
 void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, java.lang.Class targetType, boolean downScope, ScopeContext targetScopeContext)
          Connects wire configurations of the source proxy factory to corresponding ones in the target proxy to factory
protected abstract  TargetInvoker createInvoker(QualifiedName targetName, java.lang.reflect.Method operation, ScopeContext context, boolean downScope)
          Callback to create the specific TargetInvoker type for dispatching to the target type
 void init()
           
 void setRuntimeContext(RuntimeContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

runtimeContext

protected RuntimeContext runtimeContext

targetClass

protected java.lang.Class targetClass
Constructor Detail

WireBuilderSupport

public WireBuilderSupport()
Method Detail

setRuntimeContext

public void setRuntimeContext(RuntimeContext context)

init

public void init()
          throws java.lang.Exception
Throws:
java.lang.Exception

connect

public void connect(SourceWireFactory sourceFactory,
                    TargetWireFactory targetFactory,
                    java.lang.Class targetType,
                    boolean downScope,
                    ScopeContext targetScopeContext)
             throws BuilderConfigException
Description copied from interface: WireBuilder
Connects wire configurations of the source proxy factory to corresponding ones in the target proxy to factory

Specified by:
connect in interface WireBuilder
Parameters:
sourceFactory - the proxy factory used in constructing the source side of the wire chain
targetFactory - the proxy factory used in constructing the target side of the wire chain
targetType - the context type of the target. Used to determine if a paricular wire builder should construct the wire
downScope - true if the component containing the reference (source side) is of a lesser scope than the target service
targetScopeContext - the scope context responsible for managing intance contexts of the target component type
Throws:
BuilderConfigException - if an error occurs during the wire buildSource process

completeTargetChain

public void completeTargetChain(TargetWireFactory targetFactory,
                                java.lang.Class targetType,
                                ScopeContext targetScopeContext)
                         throws BuilderConfigException
Description copied from interface: WireBuilder
Finishes processing the target side wire chain. For example, a TargetInvoker used by target-side proxies is usually set during this phase.

Specified by:
completeTargetChain in interface WireBuilder
Parameters:
targetFactory - the target-side proxy factory
targetType - the target context type
targetScopeContext - the target scope
Throws:
BuilderConfigException - if an error occurs during the wire buildSource process

createInvoker

protected abstract TargetInvoker createInvoker(QualifiedName targetName,
                                               java.lang.reflect.Method operation,
                                               ScopeContext context,
                                               boolean downScope)
Callback to create the specific TargetInvoker type for dispatching to the target type

Parameters:
targetName - the fully qualified name of the wire target
operation - the operation the invoker will be associated with
context - the scope context that manages the target context
downScope - whether the wire source scope is "longer" than the target

Tuscany Core

-