com.aurorasoftworks.signal.runtime.core.context
Class Context

java.lang.Object
  extended by com.aurorasoftworks.signal.runtime.core.context.Context
All Implemented Interfaces:
IContext

public class Context
extends java.lang.Object
implements IContext

A default implementation of the IContext interface. This class is thread-safe.

Author:
Marek

Constructor Summary
Context()
          Creates a new Context instance.
 
Method Summary
 boolean containsBean(java.lang.String name)
          Determines whether a bean with the specified name already exists.
protected  void doRegisterBean(java.lang.String name, java.lang.Object bean)
           
 java.lang.Object getBean(java.lang.Class beanClass)
          
 java.lang.Object getBean(java.lang.String name)
          Retrieves a bean previously registered with the specified name.
 java.util.Vector getBeanNames(java.lang.Class beanClass)
          Returns names of the beans of the specified type
protected  IBeanReference getBeanReference(java.lang.String name)
          
 java.util.Vector getBeans(java.lang.Class beanClass)
          
static IProxyFactory getDefaultProxyFactory()
           
 IProxyFactory getProxyFactory()
          
protected  void processBean(IBeanReference ref, java.lang.Object processedResult)
          Handles a bean or a bean reference returned by a IBeanProcessor.
 java.lang.Object processLazyBean(java.lang.Object processedResult)
           
 void registerBean(java.lang.String name, java.lang.Object bean)
          Registers a bean using the provided name.
protected  void registerBeanReference(IBeanReference ref)
          Registers a bean reference.
static void setDefaultProxyFactory(IProxyFactory defaultProxyFactory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Context

public Context()
Creates a new Context instance.

Method Detail

getDefaultProxyFactory

public static IProxyFactory getDefaultProxyFactory()

setDefaultProxyFactory

public static void setDefaultProxyFactory(IProxyFactory defaultProxyFactory)

containsBean

public boolean containsBean(java.lang.String name)
Determines whether a bean with the specified name already exists.

Specified by:
containsBean in interface IContext
Parameters:
name - a name of a bean to be located in the context
Returns:
true if a bean with the provided name exists, false otherwise

getBean

public java.lang.Object getBean(java.lang.String name)
                         throws ContextException
Retrieves a bean previously registered with the specified name.

Specified by:
getBean in interface IContext
Parameters:
name - name of a bean to be retrieved
Returns:
a bean with the provided name or null if one does not exist
Throws:
ContextException

getBeanReference

protected IBeanReference getBeanReference(java.lang.String name)


getBeanNames

public java.util.Vector getBeanNames(java.lang.Class beanClass)
                              throws ContextException
Returns names of the beans of the specified type

Specified by:
getBeanNames in interface IContext
Returns:
Throws:
ContextException

getBeans

public java.util.Vector getBeans(java.lang.Class beanClass)
                          throws ContextException

Specified by:
getBeans in interface IContext
Throws:
ContextException

getBean

public java.lang.Object getBean(java.lang.Class beanClass)
                         throws ContextException

Specified by:
getBean in interface IContext
Throws:
ContextException

processLazyBean

public java.lang.Object processLazyBean(java.lang.Object processedResult)
                                 throws ContextException
Throws:
ContextException

processBean

protected void processBean(IBeanReference ref,
                           java.lang.Object processedResult)
                    throws ContextException
Handles a bean or a bean reference returned by a IBeanProcessor.

Parameters:
ref - a bean reference passed to a IBeanProcessor
processedResult - a result returned by a IBeanProcessor (a bean or a IBeanReference object)
Throws:
ContextException - if an error is encountered while registering a new bean or a new bean reference

registerBean

public void registerBean(java.lang.String name,
                         java.lang.Object bean)
                  throws ContextException
Registers a bean using the provided name. If the provided name is already in use, the previous bean is replaced with the new one in this context. Note that this does not affect injected references to the previous bean.

Specified by:
registerBean in interface IContext
Parameters:
name - a name of the bean being registered
bean - a bean to be registered
Throws:
ContextException

doRegisterBean

protected void doRegisterBean(java.lang.String name,
                              java.lang.Object bean)
                       throws ContextException
Throws:
ContextException

registerBeanReference

protected void registerBeanReference(IBeanReference ref)
                              throws ContextException
Registers a bean reference. Refer to IBeanReference for more information.

Parameters:
ref - a bean reference to be registered
Throws:
ContextException

getProxyFactory

public IProxyFactory getProxyFactory()

Specified by:
getProxyFactory in interface IContext


Copyright © 2010. All Rights Reserved.