|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.avalon.fortress.util.LifecycleExtensionManager
public final class LifecycleExtensionManager
LifecycleExtensionManager class. This class manages a list
of extensions objects that are executed on components during the various
stages of their lifecycles.
It provides methods for adding extension objects to the system, and a method for executing them on a particular component object. The current context is also passed in to the extension objects to facilitate the communication of any global values.
Extensions are stored internally in a list. This guarentees that the order in which they are executed matches the order in which they are inserted.
| Nested Class Summary | |
|---|---|
private class |
LifecycleExtensionManager.CachedArrayList
CachedArrayList class. |
private static class |
LifecycleExtensionManager.UnmodifiableIterator
Read only iterator. |
| Field Summary | |
|---|---|
protected static int |
ACCESS
|
protected static int |
CREATE
|
protected static int |
DESTROY
|
private LifecycleExtensionManager.CachedArrayList |
m_accessorExtensions
|
private LifecycleExtensionManager.CachedArrayList |
m_creatorExtensions
|
private boolean |
m_readOnly
|
protected static int |
RELEASE
|
static java.lang.String |
ROLE
|
| Constructor Summary | |
|---|---|
LifecycleExtensionManager()
|
|
| Method Summary | |
|---|---|
int |
accessorExtensionsCount()
Find out the total number of accessor extensions registered with this manager |
java.util.Iterator |
accessorExtensionsIterator()
Obtain an iterator. |
void |
addAccessorExtension(org.apache.avalon.lifecycle.Accessor extension)
Adds an accessor extension to the manager |
void |
addCreatorExtension(org.apache.avalon.lifecycle.Creator extension)
Adds a creator extension to the manager |
protected void |
checkWriteable()
Utility method to check if LifecycleExtensionsManager is writeable and if not throw exception. |
void |
clearAccessorExtensions()
Clears all accessor extensions registered with this manager |
void |
clearCreatorExtensions()
Clears all creator extensions registered with this manager |
int |
creatorExtensionsCount()
Find out the total number of creator extensions registered with this manager |
java.util.Iterator |
creatorExtensionsIterator()
Obtain an iterator. |
void |
executeAccessExtensions(java.lang.Object component,
org.apache.avalon.framework.context.Context context)
executeAccessExtensions method, executes all access
level extensions on the given component. |
void |
executeCreationExtensions(java.lang.Object component,
org.apache.avalon.framework.context.Context context)
executeCreationExtensions method, executes all creation
level extensions on the given component. |
void |
executeDestructionExtensions(java.lang.Object component,
org.apache.avalon.framework.context.Context context)
executeDestructionExtensions method, executes all
destruction level extensions on the given component. |
protected void |
executeExtensions(java.lang.Object[] extensions,
java.lang.Object component,
org.apache.avalon.framework.context.Context context,
int type)
executeExtensions method, executes a given array of
lifecycle interfaces on a given component. |
void |
executeReleaseExtensions(java.lang.Object component,
org.apache.avalon.framework.context.Context context)
executeReleaseExtensions method, executes all release
level extensions on the given component. |
org.apache.avalon.lifecycle.Accessor |
getAccessorExtension(int index)
Obtain the particular accessor extension at the given index |
org.apache.avalon.lifecycle.Creator |
getCreatorExtension(int index)
Obtain the particular creator extension at the given index |
void |
insertAccessorExtension(int position,
org.apache.avalon.lifecycle.Accessor extension)
Inserts an accessor extension at a given index in the manager |
void |
insertCreatorExtension(int position,
org.apache.avalon.lifecycle.Creator extension)
Inserts a creator extension at a given index in the manager |
void |
makeReadOnly()
Make the extension manager read only (immutable). |
org.apache.avalon.lifecycle.Accessor |
removeAccessorExtension(int position)
Removes a particular accessor extension from the manager |
org.apache.avalon.lifecycle.Creator |
removeCreatorExtension(int position)
Removes a particular creator extension from the manager |
LifecycleExtensionManager |
writeableCopy()
Create a copy; it will be writeable even if the original was not. |
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
|---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
| 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 ROLE
private final LifecycleExtensionManager.CachedArrayList m_accessorExtensions
private final LifecycleExtensionManager.CachedArrayList m_creatorExtensions
private boolean m_readOnly
protected static final int ACCESS
protected static final int RELEASE
protected static final int CREATE
protected static final int DESTROY
| Constructor Detail |
|---|
public LifecycleExtensionManager()
| Method Detail |
|---|
public void makeReadOnly()
public LifecycleExtensionManager writeableCopy()
public void executeAccessExtensions(java.lang.Object component,
org.apache.avalon.framework.context.Context context)
throws java.lang.Exception
executeAccessExtensions method, executes all access
level extensions on the given component.
component - a Component instancecontext - a Context instance
java.lang.Exception - if an error occurs
public void executeReleaseExtensions(java.lang.Object component,
org.apache.avalon.framework.context.Context context)
throws java.lang.Exception
executeReleaseExtensions method, executes all release
level extensions on the given component.
component - a Component instancecontext - a Context instance
java.lang.Exception - if an error occurs
public void executeCreationExtensions(java.lang.Object component,
org.apache.avalon.framework.context.Context context)
throws java.lang.Exception
executeCreationExtensions method, executes all creation
level extensions on the given component.
component - a Component instancecontext - a Context instance
java.lang.Exception - if an error occurs
public void executeDestructionExtensions(java.lang.Object component,
org.apache.avalon.framework.context.Context context)
throws java.lang.Exception
executeDestructionExtensions method, executes all
destruction level extensions on the given component.
component - a Component instancecontext - a Context instance
java.lang.Exception - if an error occurspublic void addAccessorExtension(org.apache.avalon.lifecycle.Accessor extension)
extension - a Accessor instancepublic void addCreatorExtension(org.apache.avalon.lifecycle.Creator extension)
extension - a Creator instance
public void insertAccessorExtension(int position,
org.apache.avalon.lifecycle.Accessor extension)
position - an int index valueextension - a Accessor instance
public void insertCreatorExtension(int position,
org.apache.avalon.lifecycle.Creator extension)
position - an int index valueextension - a Creator instancepublic org.apache.avalon.lifecycle.Accessor removeAccessorExtension(int position)
position - an int index value
Accessor instancepublic org.apache.avalon.lifecycle.Creator removeCreatorExtension(int position)
position - an int index value
Creator instancepublic java.util.Iterator accessorExtensionsIterator()
Iterator instancepublic java.util.Iterator creatorExtensionsIterator()
Iterator instancepublic int accessorExtensionsCount()
int valuepublic int creatorExtensionsCount()
int valuepublic org.apache.avalon.lifecycle.Accessor getAccessorExtension(int index)
index - an int index value
Accessor instancepublic org.apache.avalon.lifecycle.Creator getCreatorExtension(int index)
index - an int index value
Creator instancepublic void clearAccessorExtensions()
public void clearCreatorExtensions()
protected void executeExtensions(java.lang.Object[] extensions,
java.lang.Object component,
org.apache.avalon.framework.context.Context context,
int type)
throws java.lang.Exception
executeExtensions method, executes a given array of
lifecycle interfaces on a given component.
component - a Component instancecontext - a Context instancetype - a constant, referencing which phase the
extensions array adheres to
java.lang.Exception - if an error occurs
protected final void checkWriteable()
throws java.lang.IllegalStateException
java.lang.IllegalStateException - if context is read only
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||