Package org.apache.catalina.core
Class NamingContextListener
- java.lang.Object
-
- org.apache.catalina.core.NamingContextListener
-
- All Implemented Interfaces:
PropertyChangeListener,EventListener,ContainerListener,LifecycleListener
public class NamingContextListener extends Object implements LifecycleListener, ContainerListener, PropertyChangeListener
Helper class used to initialize and populate the JNDI context associated with each context and server.- Version:
- $Revision: 1.7 $ $Date: 2006/11/06 21:13:38 $
- Author:
- Remy Maucherat
-
-
Field Summary
Fields Modifier and Type Field Description protected ContextcompCtxComp context.protected ObjectcontainerAssociated container.protected intdebugDebugging level.protected ContextenvCtxEnv context.protected booleaninitializedInitialized flag.protected StringnameName of the associated naming context.protected NamingContextnamingContextAssociated JNDI context.protected NamingResourcesnamingResourcesAssociated naming resources.
-
Constructor Summary
Constructors Constructor Description NamingContextListener()Create a new naming context listener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEjb(ContextEjb ejb)Set the specified EJBs in the naming context.voidaddEnvironment(ContextEnvironment env)Set the specified environment entries in the naming context.voidaddLocalEjb(ContextLocalEjb localEjb)Set the specified local EJBs in the naming context.voidaddResource(ContextResource resource)Set the specified resources in the naming context.voidaddResourceEnvRef(String name, String type)Set the specified resources in the naming context.voidaddResourceLink(ContextResourceLink resourceLink)Set the specified resource link in the naming context.voidcontainerEvent(ContainerEvent event)Acknowledge the occurrence of the specified event.intgetDebug()Return the "debug" property.StringgetName()Return the "name" property.NamingContextgetNamingContext()Return the associated naming context.voidlifecycleEvent(LifecycleEvent event)Acknowledge the occurrence of the specified event.protected voidlog(String message)Log the specified message to our current Logger (if any).protected voidlog(String message, Throwable t)Log the specified message and exception to our current Logger (if any).protected StringlogName()Return the abbreviated name of this container for logging messsagesvoidpropertyChange(PropertyChangeEvent event)Process property change events.voidremoveEjb(String name)Set the specified EJBs in the naming context.voidremoveEnvironment(String name)Set the specified environment entries in the naming context.voidremoveLocalEjb(String name)Set the specified local EJBs in the naming context.voidremoveResource(String name)Set the specified resources in the naming context.voidremoveResourceEnvRef(String name)Set the specified resources in the naming context.voidremoveResourceLink(String name)Set the specified resources in the naming context.voidsetDebug(int debug)Set the "debug" property.voidsetName(String name)Set the "name" property.
-
-
-
Field Detail
-
name
protected String name
Name of the associated naming context.
-
container
protected Object container
Associated container.
-
debug
protected int debug
Debugging level.
-
initialized
protected boolean initialized
Initialized flag.
-
namingResources
protected NamingResources namingResources
Associated naming resources.
-
namingContext
protected NamingContext namingContext
Associated JNDI context.
-
compCtx
protected Context compCtx
Comp context.
-
envCtx
protected Context envCtx
Env context.
-
-
Method Detail
-
getDebug
public int getDebug()
Return the "debug" property.
-
setDebug
public void setDebug(int debug)
Set the "debug" property.- Parameters:
debug- The new debug level
-
getName
public String getName()
Return the "name" property.
-
setName
public void setName(String name)
Set the "name" property.- Parameters:
name- The new name
-
getNamingContext
public NamingContext getNamingContext()
Return the associated naming context.
-
lifecycleEvent
public void lifecycleEvent(LifecycleEvent event)
Acknowledge the occurrence of the specified event.- Specified by:
lifecycleEventin interfaceLifecycleListener- Parameters:
event- LifecycleEvent that has occurred
-
containerEvent
public void containerEvent(ContainerEvent event)
Acknowledge the occurrence of the specified event. Note: Will never be called when the listener is associated to a Server, since it is not a Container.- Specified by:
containerEventin interfaceContainerListener- Parameters:
event- ContainerEvent that has occurred
-
propertyChange
public void propertyChange(PropertyChangeEvent event)
Process property change events.- Specified by:
propertyChangein interfacePropertyChangeListener- Parameters:
event- The property change event that has occurred
-
addEjb
public void addEjb(ContextEjb ejb)
Set the specified EJBs in the naming context.
-
addEnvironment
public void addEnvironment(ContextEnvironment env)
Set the specified environment entries in the naming context.
-
addLocalEjb
public void addLocalEjb(ContextLocalEjb localEjb)
Set the specified local EJBs in the naming context.
-
addResource
public void addResource(ContextResource resource)
Set the specified resources in the naming context.
-
addResourceEnvRef
public void addResourceEnvRef(String name, String type)
Set the specified resources in the naming context.
-
addResourceLink
public void addResourceLink(ContextResourceLink resourceLink)
Set the specified resource link in the naming context.
-
removeEjb
public void removeEjb(String name)
Set the specified EJBs in the naming context.
-
removeEnvironment
public void removeEnvironment(String name)
Set the specified environment entries in the naming context.
-
removeLocalEjb
public void removeLocalEjb(String name)
Set the specified local EJBs in the naming context.
-
removeResource
public void removeResource(String name)
Set the specified resources in the naming context.
-
removeResourceEnvRef
public void removeResourceEnvRef(String name)
Set the specified resources in the naming context.
-
removeResourceLink
public void removeResourceLink(String name)
Set the specified resources in the naming context.
-
log
protected void log(String message)
Log the specified message to our current Logger (if any).- Parameters:
message- Message to be logged
-
log
protected void log(String message, Throwable t)
Log the specified message and exception to our current Logger (if any).- Parameters:
message- Message to be loggedt- Related exception
-
logName
protected String logName()
Return the abbreviated name of this container for logging messsages
-
-