|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cocoon.core.container.handler.AbstractComponentHandler
This class acts like a Factory to instantiate the correct version of the component handler that you need.
Field Summary | |
protected boolean |
disposed
State management boolean stating whether the Handler is disposed or not |
protected Logger |
logger
|
Constructor Summary | |
AbstractComponentHandler(ComponentInfo info,
Logger logger)
Creates a new ComponentHandler. |
Method Summary | |
boolean |
canBeDisposed()
Returns true if this component handler can safely be
disposed (i.e. none of the components it is handling are still
being used). |
void |
dispose()
Dispose of the component handler and any associated Pools and Factories. |
protected abstract Object |
doGet()
Concrete implementation of getting a component. |
protected abstract void |
doInitialize()
|
protected abstract void |
doPut(Object component)
Concrete implementation of putting back a component. |
Object |
get()
Get an instance of the type of component handled by this handler. |
static ComponentHandler |
getComponentHandler(Class clazz,
Logger logger,
Context context,
ServiceManager manager,
Configuration config)
Create a component handler (version used by XSP) TODO - perhaps we can remove this later? |
static ComponentHandler |
getComponentHandler(String role,
ComponentEnvironment componentEnv,
ComponentInfo info)
Looks up and returns a component handler for a given component class. |
ComponentInfo |
getInfo()
Get the service metadata for this handler |
void |
initialize()
Initialize this handler |
boolean |
isSingleton()
Default here is to return false |
void |
put(Object component)
Put back an instance of the type of component handled by this handler. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final Logger logger
protected boolean disposed
Constructor Detail |
public AbstractComponentHandler(ComponentInfo info, Logger logger)
Method Detail |
public static ComponentHandler getComponentHandler(String role, ComponentEnvironment componentEnv, ComponentInfo info) throws Exception
role
- the component's role. Can be null
if the role isn't known.componentEnv
- The component's creation environment.info
- The description of the component (configuration, lifecycle etc.)
Exception
- If there were any problems obtaining a ComponentHandlerpublic ComponentInfo getInfo()
ComponentHandler
getInfo
in interface ComponentHandler
public final Object get() throws Exception
Subclasses should not extend this method but rather the doGet method below otherwise reference counts will not be supported.
get
in interface ComponentHandler
Exception
- if an error occurspublic final void put(Object component) throws Exception
Subclasses should not extend this method but rather the doPut method below otherwise reference counts will not be supported.
put
in interface ComponentHandler
component
- a service
Exception
- if an error occursprotected abstract Object doGet() throws Exception
Exception
- if an error occursprotected abstract void doPut(Object component) throws Exception
component
- a Component
value
Exception
- if an error occurspublic boolean isSingleton()
false
isSingleton
in interface ComponentHandler
true
if managed object is a singletonpublic final boolean canBeDisposed()
true
if this component handler can safely be
disposed (i.e. none of the components it is handling are still
being used).
canBeDisposed
in interface ComponentHandler
true
if this component handler can safely be
disposed; false
otherwisepublic void dispose()
ComponentHandler
dispose
in interface ComponentHandler
public final void initialize() throws Exception
ComponentHandler
initialize
in interface ComponentHandler
Exception
protected abstract void doInitialize() throws Exception
Exception
public static ComponentHandler getComponentHandler(Class clazz, Logger logger, Context context, ServiceManager manager, Configuration config) throws Exception
Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |