Tuscany Core

org.apache.tuscany.core.extension
Class ExternalServiceContextFactory

java.lang.Object
  extended by org.apache.tuscany.core.extension.ExternalServiceContextFactory
All Implemented Interfaces:
ContextFactory<ExternalServiceContext>

public abstract class ExternalServiceContextFactory
extends Object
implements ContextFactory<ExternalServiceContext>

A template implementation that creates instances of ExternalServiceContext configured with the appropriate wire chains and bindings. This class is intended to be subclassed when contributing new bindings to the runtime. The subclass serves as a marker so the binding WireBuilder responsible for setting the proper TargetInvoker on the wire chains can be notified.

Version:
$Rev$ $Date$

Constructor Summary
ExternalServiceContextFactory(String name, ObjectFactory objectFactory)
           
 
Method Summary
 void addProperty(String propertyName, Object value)
          Adds a property to the context
 void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factory, boolean multiplicity)
          Adds a set of source-side wire factories for the given reference.
 void addSourceWireFactory(String referenceName, SourceWireFactory factory)
          Adds a source-side wire factory for the given reference.
 void addTargetWireFactory(String serviceName, TargetWireFactory factory)
          Adds a target-side wire factory for the given service name.
 ExternalServiceContext createContext()
          Creates a Context based on configuration supplied by a logical model assembly
 String getName()
          Returns the name of the Context produced by the current factory
 Scope getScope()
          Returns the scope identifier associated with the type of contexts produced by the current factory
 List<SourceWireFactory> getSourceWireFactories()
          Returns a collection of source-side wire factories for references.
 Map<String,TargetWireFactory> getTargetWireFactories()
          Returns a collection of target-side wire factories keyed by service name
 TargetWireFactory getTargetWireFactory(String serviceName)
          Returns the target-side wire factory associated with the given service name
 void prepare()
           
 void prepare(CompositeContext parent)
          Called to signal to the configuration that its parent context has been activated and that it shoud perform any required initialization steps
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalServiceContextFactory

public ExternalServiceContextFactory(String name,
                                     ObjectFactory objectFactory)
Method Detail

createContext

public ExternalServiceContext createContext()
                                     throws ContextCreationException
Description copied from interface: ContextFactory
Creates a Context based on configuration supplied by a logical model assembly

Specified by:
createContext in interface ContextFactory<ExternalServiceContext>
Returns:
a new instance context
Throws:
ContextCreationException - if an error occurs creating the context

getScope

public Scope getScope()
Description copied from interface: ContextFactory
Returns the scope identifier associated with the type of contexts produced by the current factory

Specified by:
getScope in interface ContextFactory<ExternalServiceContext>

getName

public String getName()
Description copied from interface: ContextFactory
Returns the name of the Context produced by the current factory

Specified by:
getName in interface ContextFactory<ExternalServiceContext>

prepare

public void prepare()

addTargetWireFactory

public void addTargetWireFactory(String serviceName,
                                 TargetWireFactory factory)
Description copied from interface: ContextFactory
Adds a target-side wire factory for the given service name. Target-side wire factories contain the invocation chains associated with the destination service of a wire and are responsible for generating proxies

Specified by:
addTargetWireFactory in interface ContextFactory<ExternalServiceContext>

getTargetWireFactory

public TargetWireFactory getTargetWireFactory(String serviceName)
Description copied from interface: ContextFactory
Returns the target-side wire factory associated with the given service name

Specified by:
getTargetWireFactory in interface ContextFactory<ExternalServiceContext>

getTargetWireFactories

public Map<String,TargetWireFactory> getTargetWireFactories()
Description copied from interface: ContextFactory
Returns a collection of target-side wire factories keyed by service name

Specified by:
getTargetWireFactories in interface ContextFactory<ExternalServiceContext>

addSourceWireFactory

public void addSourceWireFactory(String referenceName,
                                 SourceWireFactory factory)
Description copied from interface: ContextFactory
Adds a source-side wire factory for the given reference. Source-side wire factories contain the invocation chains for a reference in the implementation associated with the instance context created by this configuration. Source-side wire factories also produce proxies that are injected on a reference in a component implementation.

Specified by:
addSourceWireFactory in interface ContextFactory<ExternalServiceContext>

addSourceWireFactories

public void addSourceWireFactories(String referenceName,
                                   Class referenceInterface,
                                   List<SourceWireFactory> factory,
                                   boolean multiplicity)
Description copied from interface: ContextFactory
Adds a set of source-side wire factories for the given reference. Source-side wire factories contain the invocation chains for a reference in the implementation associated with the instance context created by this configuration. Source-side wire factories also produce proxies that are injected on a reference in a component implementation.

Specified by:
addSourceWireFactories in interface ContextFactory<ExternalServiceContext>

getSourceWireFactories

public List<SourceWireFactory> getSourceWireFactories()
Description copied from interface: ContextFactory
Returns a collection of source-side wire factories for references. There may 1..n wire factories per reference.

Specified by:
getSourceWireFactories in interface ContextFactory<ExternalServiceContext>

addProperty

public void addProperty(String propertyName,
                        Object value)
Description copied from interface: ContextFactory
Adds a property to the context

Specified by:
addProperty in interface ContextFactory<ExternalServiceContext>

prepare

public void prepare(CompositeContext parent)
Description copied from interface: ContextFactory
Called to signal to the configuration that its parent context has been activated and that it shoud perform any required initialization steps

Specified by:
prepare in interface ContextFactory<ExternalServiceContext>
Parameters:
parent - the parent context

Tuscany Core

-