|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjfun.yan.web.YanLoader
public class YanLoader
This class is responsible for setting up web integration for Yan.
| Field Summary | |
|---|---|
static java.lang.String |
CONFIG_FILE_PARAM
Name of servlet context parameter that can specify the configuration file for the root container, falling back to DEFAULT_CONFIG_FILE
otherwise. |
static java.lang.String |
CONTAINER_ROOT
The name of the servlet context attribut that holds the Container instance. |
static java.lang.String |
DEFAULT_CONFIG_FILE
The default location of the yan configuration file. |
static java.lang.String |
DEFAULT_NUTS_FILE
The default xml file that configures the non-spring nut classes. |
static java.lang.String |
DEFAULT_SPRING_NUTS_FILE
The default xml file that configures spring aware nut classes. |
static java.lang.String |
LIFECYCLE_MANAGER_ROOT
The name of the servlet context attribute that holds the life cycle manager instance. |
static java.lang.String |
SERVLET_CONTEXT_KEY
The service key for the ServletContext object. |
static java.lang.String |
TRUE
The value "true" that should be specified for USE_SPRING
if Spring framework integration is desired. |
static java.lang.String |
USE_SPRING
Name of the servlet context parameter that specifies whether Spring framework integration is required. |
| Constructor Summary | |
|---|---|
YanLoader()
|
|
| Method Summary | |
|---|---|
protected void |
decorateProcessor(NutsProcessor processor,
javax.servlet.ServletContext ctxt)
Decorate a NutsProcessor object by adding or removing features. |
void |
destroy(javax.servlet.ServletContext servletContext)
Destroy the container. |
protected NutsProcessor |
getNutsProcessor(java.lang.ClassLoader cloader,
ResourceLoader rloader,
javax.servlet.ServletContext ctxt)
Construct a NutsProcessor object based on the configuration information stored in ServletContext. |
Container |
initContainer(java.lang.ClassLoader cloader,
javax.servlet.ServletContext servletContext)
Initialize this object by instantiating container and life cycle manager. |
Container |
initContainer(javax.servlet.ServletContext ctxt)
Initialize this object by instantiating container and life cycle manager. |
protected Container |
loadParentContainer(javax.servlet.ServletContext servletContext)
Load the parent Container object that's shared among web applications. |
protected NutsProcessor |
process(java.lang.ClassLoader cloader,
javax.servlet.ServletContext ctxt)
Create a NutsProcessor object based on the configuration in ServletContext. |
protected static void |
registerServletContext(Container container,
javax.servlet.ServletContext ctxt)
Register the ServletContext into the container using either WebUtils.DEFAULT_SERVLET_CONTEXT_PROPERTY or
else ServletContext.class as long as there's no ServletContext
component already registered. |
protected void |
setSpringAware(NutsProcessor processor,
javax.servlet.ServletContext ctxt)
Decorate NutsProcessor object with nut classes that integrates Spring framework and also aware of the web infrastructure, i.e. |
protected void |
setWebAware(NutsProcessor processor,
javax.servlet.ServletContext ctxt)
Decorate NutsProcessor object with nut classes that are aware of the web infrastructure, i.e. |
void |
start()
Call start on the life cycle manager. |
void |
stop()
Call stop on the life cycle manager. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CONFIG_FILE_PARAM
DEFAULT_CONFIG_FILE
otherwise.
public static final java.lang.String USE_SPRING
public static final java.lang.String TRUE
USE_SPRING
if Spring framework integration is desired.
public static final java.lang.String DEFAULT_CONFIG_FILE
public static final java.lang.String SERVLET_CONTEXT_KEY
public static final java.lang.String CONTAINER_ROOT
Container.
public static final java.lang.String LIFECYCLE_MANAGER_ROOT
LifecycleManager.
public static final java.lang.String DEFAULT_NUTS_FILE
public static final java.lang.String DEFAULT_SPRING_NUTS_FILE
| Constructor Detail |
|---|
public YanLoader()
| Method Detail |
|---|
public Container initContainer(javax.servlet.ServletContext ctxt)
ctxt - the servlet context object.
public void start()
throws java.lang.Throwable
java.lang.Throwable
public void stop()
throws java.lang.Throwable
java.lang.Throwable
public Container initContainer(java.lang.ClassLoader cloader,
javax.servlet.ServletContext servletContext)
This implementation calls process(ClassLoader, ServletContext)
for interpreting the configuration file and obtaining the Container instance
and LifecycleManager instance.
cloader - the ClassLoader used to load component classes.servletContext - the servlet context object.
protected Container loadParentContainer(javax.servlet.ServletContext servletContext)
throws java.lang.Exception
servletContext - the servlet context.
java.lang.Exception
protected NutsProcessor process(java.lang.ClassLoader cloader,
javax.servlet.ServletContext ctxt)
throws java.lang.Exception
This default implementation delegates to getNutsProcessor(ClassLoader, ResourceLoader, ServletContext)
for constructing the NutsProcessor object.
If no ServletContext component is registered, the current ServletContext object is registered as a component in the container.
cloader - the ClassLoader object used to load component classes.ctxt - the ServletContext object.
java.lang.Exception - any error.
protected static void registerServletContext(Container container,
javax.servlet.ServletContext ctxt)
WebUtils.DEFAULT_SERVLET_CONTEXT_PROPERTY or
else ServletContext.class as long as there's no ServletContext
component already registered.
container - the Yan container object.ctxt - the ServletContext object.
protected NutsProcessor getNutsProcessor(java.lang.ClassLoader cloader,
ResourceLoader rloader,
javax.servlet.ServletContext ctxt)
throws java.lang.Exception
decorateProcessor(NutsProcessor, ServletContext)
to decorate it.
cloader - the ClassLoader object used to load component class.rloader - the ResourceLoader object used to load resource.ctxt - the ServletContext object.
java.lang.Exception - any error.
protected void decorateProcessor(NutsProcessor processor,
javax.servlet.ServletContext ctxt)
throws java.lang.Exception
This default implementation replaces <bean>, <ctor> and <method> tags with the ones that're aware of the ServletContext.
It does so by registering the ServletContext as a service under SERVLET_CONTEXT_KEY.
The customized tags then look up this service and call "setServletContext()" or
any other specified receiver method to set this dependency.
Based on whether USE_SPRING parameter is set in ServletContext,
this implementation calls either setSpringAware(NutsProcessor, ServletContext)
or setWebAware(NutsProcessor, ServletContext) to do the decoration.
Subclasses can override this method to provide customized decoration.
processor - the NutsProcessor object to decorate.ctxt - the ServletContext object.
java.lang.Exception - any error.
protected void setSpringAware(NutsProcessor processor,
javax.servlet.ServletContext ctxt)
throws java.lang.Exception
processor - the NutsProcessor object to decorate.ctxt - the ServletContext object.
java.lang.Exception - any error.
protected void setWebAware(NutsProcessor processor,
javax.servlet.ServletContext ctxt)
throws java.lang.Exception
processor - the NutsProcessor object to decorate.ctxt - the ServletContext object.
java.lang.Exception - any error.public void destroy(javax.servlet.ServletContext servletContext)
servletContext - the servlet context.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||