Package org.apache.catalina.core
Class NamingContextListener
java.lang.Object
org.apache.catalina.core.NamingContextListener
- All Implemented Interfaces:
- PropertyChangeListener,- EventListener,- LifecycleListener
public class NamingContextListener
extends Object
implements LifecycleListener, PropertyChangeListener
Helper class used to initialize and populate the JNDI context associated with each context and server.
- Author:
- Remy Maucherat
- 
Field SummaryFieldsModifier 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 SummaryConstructors
- 
Method SummaryModifier 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.protected ObjectNamecreateObjectName(ContextResource resource) Create anObjectNamefor thisContextResourceobject.booleangetName()voidlifecycleEvent(LifecycleEvent event) Acknowledge the occurrence of the specified event.voidProcess property change events.voidRemove 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
- 
nameName of the associated naming context.
- 
containerAssociated container.
- 
initializedprotected boolean initializedInitialized flag.
- 
namingResourcesAssociated naming resources.
- 
namingContextAssociated JNDI context.
- 
compCtxComp context.
- 
envCtxEnv context.
- 
objectNamesObjectnames Map.
 
- 
- 
Constructor Details- 
NamingContextListenerpublic NamingContextListener()
 
- 
- 
Method Details- 
getExceptionOnFailedWritepublic boolean getExceptionOnFailedWrite()- Returns:
- whether or not an attempt to modify the JNDI context will trigger an exception or if the request will be ignored.
 
- 
setExceptionOnFailedWritepublic 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.
 
- 
setNameSet the "name" property.- Parameters:
- name- The new name
 
- 
getEnvContext- Returns:
- the naming environment context.
 
- 
lifecycleEventAcknowledge the occurrence of the specified event.- Specified by:
- lifecycleEventin interface- LifecycleListener
- Parameters:
- event- LifecycleEvent that has occurred
 
- 
propertyChangeProcess property change events.- Specified by:
- propertyChangein interface- PropertyChangeListener
- Parameters:
- event- The property change event that has occurred
 
- 
createObjectNameCreate anObjectNamefor thisContextResourceobject.- Parameters:
- resource- The resource
- Returns:
- ObjectName The object name
- Throws:
- MalformedObjectNameException- if a name cannot be created
 
- 
addEjbSet the specified EJBs in the naming context.- Parameters:
- ejb- the EJB descriptor
 
- 
addEnvironmentSet the specified environment entries in the naming context.- Parameters:
- env- the environment entry
 
- 
addLocalEjbSet the specified local EJBs in the naming context.- Parameters:
- localEjb- the local EJB descriptor (unused)
 
- 
addMessageDestinationRefSet the specified message destination refs in the naming context.- Parameters:
- mdr- the message destination ref descriptor (unused)
 
- 
addServiceSet the specified web service in the naming context.- Parameters:
- service- the web service descriptor
 
- 
addResourceSet the specified resources in the naming context.- Parameters:
- resource- the resource descriptor
 
- 
addResourceEnvRefSet the specified resources in the naming context.- Parameters:
- resourceEnvRef- the resource reference
 
- 
addResourceLinkSet the specified resource link in the naming context.- Parameters:
- resourceLink- the resource link
 
- 
removeEjbRemove the specified EJB from the naming context.- Parameters:
- name- the name of the EJB which should be removed
 
- 
removeEnvironmentRemove the specified environment entry from the naming context.- Parameters:
- name- the name of the environment entry which should be removed
 
- 
removeLocalEjbRemove the specified local EJB from the naming context.- Parameters:
- name- the name of the EJB which should be removed
 
- 
removeMessageDestinationRefRemove the specified message destination ref from the naming context.- Parameters:
- name- the name of the message destination ref which should be removed
 
- 
removeServiceRemove the specified web service from the naming context.- Parameters:
- name- the name of the web service which should be removed
 
- 
removeResourceRemove the specified resource from the naming context.- Parameters:
- name- the name of the resource which should be removed
 
- 
removeResourceEnvRefRemove the specified resource environment reference from the naming context.- Parameters:
- name- the name of the resource environment reference which should be removed
 
- 
removeResourceLinkRemove the specified resource link from the naming context.- Parameters:
- name- the name of the resource link which should be removed
 
 
-