com.interface21.context.support
Class ApplicationObjectSupport

java.lang.Object
  |
  +--com.interface21.context.support.ApplicationObjectSupport
All Implemented Interfaces:
ApplicationContextAware
Direct Known Subclasses:
AbstractCachingViewResolver, AbstractHandlerMapping, AbstractView, BeanNameViewResolver, SimpleControllerHandlerAdapter, VelocityConfigurer, WebContentGenerator

public abstract class ApplicationObjectSupport
extends java.lang.Object
implements ApplicationContextAware

Convenient superclass for web application objects such as controllers. Saves WebApplicationContext and provides an initialization hook method. There is no requirement to subclass this class: It just makes things a little easier.

Author:
Rod Johnson, Juergen Hoeller

Field Summary
protected  org.apache.commons.logging.Log logger
          Logger that is available to subclasses
 
Constructor Summary
ApplicationObjectSupport()
           
 
Method Summary
 ApplicationContext getApplicationContext()
          Return the ApplicationContext instance used by this object.
protected  void initApplicationContext()
          Subclasses can override this for custom initialization behavior.
 void setApplicationContext(ApplicationContext ctx)
          Set the ApplicationContext used by this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Logger that is available to subclasses
Constructor Detail

ApplicationObjectSupport

public ApplicationObjectSupport()
Method Detail

setApplicationContext

public final void setApplicationContext(ApplicationContext ctx)
                                 throws ApplicationContextException
Description copied from interface: ApplicationContextAware
Set the ApplicationContext used by this object. Normally this call will be used to initialize the object. Note that this call can occur multiple times: The implementation must check itself that if it is already initialized resp. if it wants to perform reinitialization.
Specified by:
setApplicationContext in interface ApplicationContextAware
Following copied from interface: com.interface21.context.ApplicationContextAware
Parameters:
ctx - ApplicationContext object used by this object
Throws:
ApplicationContextException - if initialization attempted by this object after it has access to the WebApplicatinContext fails

getApplicationContext

public final ApplicationContext getApplicationContext()
Return the ApplicationContext instance used by this object.

initApplicationContext

protected void initApplicationContext()
                               throws ApplicationContextException
Subclasses can override this for custom initialization behavior. Gets called by setApplicationContext() after setting the context instance.


Rod Johnson and Spring contributors 2001-2003.