Tuscany Core

org.apache.tuscany.core.system.config
Class SystemObjectContextFactory

java.lang.Object
  extended by org.apache.tuscany.core.system.config.SystemObjectContextFactory
All Implemented Interfaces:
ContextFactory

public class SystemObjectContextFactory
extends Object
implements ContextFactory

A ContextFactory that contains the configuration needed to convert a simple Java Object into a component. The object is assumed to be fully initialized and will always be added with MODULE scope.

Version:
$Rev$ $Date$

Constructor Summary
SystemObjectContextFactory(String name, Object instance)
          Construct a ContextFactory for the supplied Java Object.
 
Method Summary
 void addProperty(String propertyName, Object value)
          Adds a property to the context
 void addSourceWireFactories(String referenceName, Class referenceInterface, List 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.
 Context 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<WireFactory> getSourceWireFactories()
          Returns a collection of source-side wire factories for references.
 Map 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(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

SystemObjectContextFactory

public SystemObjectContextFactory(String name,
                                  Object instance)
Construct a ContextFactory for the supplied Java Object.

Parameters:
name - the name to be assigned to the resulting component
instance - the Java Object that provides the implementation
Method Detail

createContext

public Context 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
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

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

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

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

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

getTargetWireFactories

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

Specified by:
getTargetWireFactories in interface ContextFactory

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

addSourceWireFactories

public void addSourceWireFactories(String referenceName,
                                   Class referenceInterface,
                                   List 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

getSourceWireFactories

public List<WireFactory> 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

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
Parameters:
parent - the parent context

Tuscany Core

-