org.figure8.join.core
Class ContainerContextHandler

java.lang.Object
  extended by org.figure8.join.core.ContainerContextHandler

public class ContainerContextHandler
extends java.lang.Object

This is a wrapper around Spring applicative main context.

Version:
$Revision: 1.2 $
Author:
Laurent Broudoux

Method Summary
protected  void contextReloaded()
          Publish a ContextRefreshedEvent on applicationContext
 org.springframework.context.ApplicationContext getApplicationContext()
           
 java.lang.Object getComponent(java.lang.String key)
          Retrieve a component from Spring handled context.
static ContainerContextHandler getInstance()
           
 javax.servlet.ServletContext getServletContext()
           
 boolean isSetup()
           
 void refresh()
          Refresh or create the handled String applicative context.
 void registerComponent(java.lang.String key, java.lang.Object component)
          Register a component as a singleton within Spring handled application context and the web tier servlet context if present.
 void setApplicationContext(org.springframework.context.ApplicationContext appContext)
          Set the handled Spring applicative context.
 void setServletContext(javax.servlet.ServletContext context)
          Assign the servlet context for whom Spring context will be handled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isSetup

public boolean isSetup()
Returns:
true if context is setup (ie. applicatinoContext not null)

setServletContext

public void setServletContext(javax.servlet.ServletContext context)
Assign the servlet context for whom Spring context will be handled

Parameters:
context - The servlet context for whom handling Spring context

getServletContext

public javax.servlet.ServletContext getServletContext()
Returns:
The servlet context for whom Spring context is handled

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext appContext)
                           throws org.springframework.context.ApplicationContextException
Set the handled Spring applicative context.

Parameters:
appContext - The context to wrapp
Throws:
org.springframework.context.ApplicationContextException - if problem occurs during beanFactory initialization

getApplicationContext

public org.springframework.context.ApplicationContext getApplicationContext()
Returns:
Handled String context (if any)

getComponent

public java.lang.Object getComponent(java.lang.String key)
                              throws java.lang.IllegalStateException,
                                     InvalidParameterException
Retrieve a component from Spring handled context.

Parameters:
key - Key identifier of the component to retrieve
Returns:
The component denoted by key
Throws:
java.lang.IllegalStateException - if no Spring context is handled
InvalidParameterException - if key is null or component cannot be found.

registerComponent

public void registerComponent(java.lang.String key,
                              java.lang.Object component)
                       throws java.lang.IllegalStateException,
                              InvalidParameterException
Register a component as a singleton within Spring handled application context and the web tier servlet context if present.

Parameters:
key - The key to use for registring singleton
component - The component to register
Throws:
java.lang.IllegalStateException - if no Spring context is handled
InvalidParameterException - if key is null or component already exists

refresh

public void refresh()
Refresh or create the handled String applicative context. If it exists, it is first closed. Then, it is loaded using the ContainerContextLoader implementation.


getInstance

public static ContainerContextHandler getInstance()
Returns:
The running instance of ContainerContextHandler

contextReloaded

protected void contextReloaded()
Publish a ContextRefreshedEvent on applicationContext



Copyright © 2005-2008 Join. All Rights Reserved.