com.interface21.context.support
Class StaticApplicationContext

java.lang.Object
  |
  +--com.interface21.context.support.AbstractApplicationContext
        |
        +--com.interface21.context.support.StaticApplicationContext
All Implemented Interfaces:
ApplicationContext, BeanFactory, ListableBeanFactory, MessageSource
Direct Known Subclasses:
StaticUiApplicationContext

public class StaticApplicationContext
extends AbstractApplicationContext

ApplicationContext to allow concrete registration of Java objects in code, rather than from external configuration sources. Mainly useful for testing.

Version:
$RevisionId$
Author:
Rod Johnson

Fields inherited from class com.interface21.context.support.AbstractApplicationContext
logger, MESSAGE_SOURCE_BEAN_NAME, OPTIONS_BEAN_NAME
 
Constructor Summary
StaticApplicationContext()
           
StaticApplicationContext(ApplicationContext parent)
           
 
Method Summary
 void addMessage(java.lang.String code, java.util.Locale locale, java.lang.String defaultMessage)
          Associate the given message with the given code.
protected  ListableBeanFactory getBeanFactory()
          Unimplemented interface method.
protected  BeanFactory loadBeanFactory(java.lang.String namespace)
          Return the BeanFactory for this namespace
 void rebuild()
          Must invoke when finished
protected  void refreshBeanFactory()
          Do nothing: we rely on callers to update our public methods
 void registerPrototype(java.lang.String name, java.lang.Class clazz, PropertyValues pvs)
           
 void registerSingleton(java.lang.String name, java.lang.Class clazz, PropertyValues pvs)
          Register a bean with the default bean factory
 
Methods inherited from class com.interface21.context.support.AbstractApplicationContext
addListener, configureManagedObject, getAliases, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getDisplayName, getMessage, getMessage, getMessage, getOptions, getParent, getResourceAsStream, getResourceBasePath, getResourceByPath, getStartupDate, isSingleton, onRefresh, publishEvent, refresh, removeSharedObject, setDisplayName, setParent, sharedObject, shareObject, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StaticApplicationContext

public StaticApplicationContext()
                         throws BeansException,
                                ApplicationContextException

StaticApplicationContext

public StaticApplicationContext(ApplicationContext parent)
                         throws BeansException,
                                ApplicationContextException
Method Detail

rebuild

public void rebuild()
             throws ApplicationContextException
Must invoke when finished

loadBeanFactory

protected BeanFactory loadBeanFactory(java.lang.String namespace)
                               throws ApplicationContextException
Return the BeanFactory for this namespace

refreshBeanFactory

protected void refreshBeanFactory()
                           throws ApplicationContextException
Do nothing: we rely on callers to update our public methods
Overrides:
refreshBeanFactory in class AbstractApplicationContext

getBeanFactory

protected ListableBeanFactory getBeanFactory()
Description copied from class: AbstractApplicationContext
Unimplemented interface method. Subclasses must implement this efficiently, so that it can be called repeatedly without a performance penalty.
Overrides:
getBeanFactory in class AbstractApplicationContext
Following copied from class: com.interface21.context.support.AbstractApplicationContext
Returns:
this application context's default BeanFactory

registerSingleton

public void registerSingleton(java.lang.String name,
                              java.lang.Class clazz,
                              PropertyValues pvs)
                       throws BeansException
Register a bean with the default bean factory

registerPrototype

public void registerPrototype(java.lang.String name,
                              java.lang.Class clazz,
                              PropertyValues pvs)
                       throws BeansException

addMessage

public void addMessage(java.lang.String code,
                       java.util.Locale locale,
                       java.lang.String defaultMessage)
Associate the given message with the given code.
Parameters:
code - lookup code
locale - locale message should be found within
defaultMessage - message associated with this lookup code


Rod Johnson and Spring contributors 2001-2003.