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.
- Author:
- Remy Maucherat
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContextComp context.protected ObjectAssociated container.protected ContextEnv context.protected booleanInitialized flag.protected StringName of the associated naming context.protected NamingContextAssociated JNDI context.protected NamingResourcesImplAssociated naming resources.protected HashMap<String, ObjectName> Objectnames Map.protected static final StringManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEjb(ContextEjb ejb) Set the specified EJBs in the naming context.voidSet the specified environment entries in the naming context.voidaddLocalEjb(ContextLocalEjb localEjb) Set the specified local EJBs in the naming context.voidSet the specified message destination refs in the naming context.voidaddResource(ContextResource resource) Set the specified resources in the naming context.voidaddResourceEnvRef(ContextResourceEnvRef resourceEnvRef) Set the specified resources in the naming context.voidaddResourceLink(ContextResourceLink resourceLink) Set the specified resource link in the naming context.voidaddService(ContextService service) Set the specified web service in the naming context.voidcontainerEvent(ContainerEvent event) Deprecated.protected ObjectNamecreateObjectName(ContextResource resource) Create anObjectNamefor thisContextResourceobject.booleangetName()voidlifecycleEvent(LifecycleEvent event) Acknowledge the occurrence of the specified event.voidvoidRemove the specified EJB from the naming context.voidremoveEnvironment(String name) Remove the specified environment entry from the naming context.voidremoveLocalEjb(String name) Remove the specified local EJB from the naming context.voidRemove the specified message destination ref from the naming context.voidremoveResource(String name) Remove the specified resource from the naming context.voidremoveResourceEnvRef(String name) Remove the specified resource environment reference from the naming context.voidremoveResourceLink(String name) Remove the specified resource link from the naming context.voidremoveService(String name) Remove the specified web service from the naming context.voidsetExceptionOnFailedWrite(boolean exceptionOnFailedWrite) Controls whether or not an attempt to modify the JNDI context will trigger an exception or if the request will be ignored.voidSet the "name" property.
-
Field Details
-
sm
-
name
Name of the associated naming context. -
container
Associated container. -
initialized
protected boolean initializedInitialized flag. -
namingResources
Associated naming resources. -
namingContext
Associated JNDI context. -
compCtx
Comp context. -
envCtx
Env context. -
objectNames
Objectnames Map.
-
-
Constructor Details
-
NamingContextListener
public NamingContextListener()
-
-
Method Details
-
getExceptionOnFailedWrite
public boolean getExceptionOnFailedWrite()- Returns:
- whether or not an attempt to modify the JNDI context will trigger an exception or if the request will be ignored.
-
setExceptionOnFailedWrite
public void setExceptionOnFailedWrite(boolean exceptionOnFailedWrite) Controls whether or not an attempt to modify the JNDI context will trigger an exception or if the request will be ignored.- Parameters:
exceptionOnFailedWrite- The new value
-
getName
- Returns:
- the "name" property.
-
setName
-
getEnvContext
- Returns:
- the naming environment context.
-
lifecycleEvent
Description copied from interface:LifecycleListenerAcknowledge the occurrence of the specified event.- Specified by:
lifecycleEventin interfaceLifecycleListener- Parameters:
event- LifecycleEvent that has occurred
-
containerEvent
Deprecated.TheContainerListenerinterface and implementing methods will be removed from this class for Tomcat 10 onwards.NO-OP.- Specified by:
containerEventin interfaceContainerListener- Parameters:
event- ContainerEvent that has occurred
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
createObjectName
Create anObjectNamefor thisContextResourceobject.- Parameters:
resource- The resource- Returns:
- ObjectName The object name
- Throws:
MalformedObjectNameException- if a name cannot be created
-
addEjb
Set the specified EJBs in the naming context.- Parameters:
ejb- the EJB descriptor
-
addEnvironment
Set the specified environment entries in the naming context.- Parameters:
env- the environment entry
-
addLocalEjb
Set the specified local EJBs in the naming context.- Parameters:
localEjb- the local EJB descriptor (unused)
-
addMessageDestinationRef
Set the specified message destination refs in the naming context.- Parameters:
mdr- the message destination ref descriptor (unused)
-
addService
Set the specified web service in the naming context.- Parameters:
service- the web service descriptor
-
addResource
Set the specified resources in the naming context.- Parameters:
resource- the resource descriptor
-
addResourceEnvRef
Set the specified resources in the naming context.- Parameters:
resourceEnvRef- the resource reference
-
addResourceLink
Set the specified resource link in the naming context.- Parameters:
resourceLink- the resource link
-
removeEjb
Remove the specified EJB from the naming context.- Parameters:
name- the name of the EJB which should be removed
-
removeEnvironment
Remove the specified environment entry from the naming context.- Parameters:
name- the name of the environment entry which should be removed
-
removeLocalEjb
Remove the specified local EJB from the naming context.- Parameters:
name- the name of the EJB which should be removed
-
removeMessageDestinationRef
Remove the specified message destination ref from the naming context.- Parameters:
name- the name of the message destination ref which should be removed
-
removeService
Remove the specified web service from the naming context.- Parameters:
name- the name of the web service which should be removed
-
removeResource
Remove the specified resource from the naming context.- Parameters:
name- the name of the resource which should be removed
-
removeResourceEnvRef
Remove the specified resource environment reference from the naming context.- Parameters:
name- the name of the resource environment reference which should be removed
-
removeResourceLink
Remove the specified resource link from the naming context.- Parameters:
name- the name of the resource link which should be removed
-
ContainerListenerinterface and implementing methods will be removed from this class for Tomcat 10 onwards.