org.apache.catalina.core

Class NamingContextListener

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: 892860 $ $Date: 2009-12-21 17:22:00 +0100 (Mon, 21 Dec 2009) $

Author: Remy Maucherat

Field Summary
protected ContextcompCtx
Comp context.
protected Objectcontainer
Associated container.
protected ContextenvCtx
Env context.
protected booleaninitialized
Initialized flag.
protected Loglogger
protected Stringname
Name of the associated naming context.
protected NamingContextnamingContext
Associated JNDI context.
protected NamingResourcesnamingResources
Associated naming resources.
protected HashMapobjectNames
Objectnames hashtable.
protected static StringManagersm
The string manager for this package.
Method Summary
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(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)
Acknowledge the occurrence of the specified event.
protected ObjectNamecreateObjectName(ContextResource resource)
Create an ObjectName for this ContextResource object.
ContextgetCompContext()
Return the comp context.
ContextgetEnvContext()
Return the env context.
StringgetName()
Return the "name" property.
NamingContextgetNamingContext()
Return the associated naming context.
voidlifecycleEvent(LifecycleEvent event)
Acknowledge the occurrence of the specified event.
voidpropertyChange(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.
voidremoveService(String name)
Set the specified web services in the naming context.
voidsetName(String name)
Set the "name" property.

Field Detail

compCtx

protected Context compCtx
Comp context.

container

protected Object container
Associated container.

envCtx

protected Context envCtx
Env context.

initialized

protected boolean initialized
Initialized flag.

logger

protected Log logger

name

protected String name
Name of the associated naming context.

namingContext

protected NamingContext namingContext
Associated JNDI context.

namingResources

protected NamingResources namingResources
Associated naming resources.

objectNames

protected HashMap objectNames
Objectnames hashtable.

sm

protected static StringManager sm
The string manager for this package.

Method Detail

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(ContextResourceEnvRef resourceEnvRef)
Set the specified resources in the naming context.

addResourceLink

public void addResourceLink(ContextResourceLink resourceLink)
Set the specified resource link in the naming context.

addService

public void addService(ContextService service)
Set the specified web service in the naming context.

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.

Parameters: event ContainerEvent that has occurred

createObjectName

protected ObjectName createObjectName(ContextResource resource)
Create an ObjectName for this ContextResource object.

Parameters: resource The resource

Returns: ObjectName The object name

Throws: MalformedObjectNameException if a name cannot be created

getCompContext

public Context getCompContext()
Return the comp context.

getEnvContext

public Context getEnvContext()
Return the env context.

getName

public String getName()
Return the "name" property.

getNamingContext

public NamingContext getNamingContext()
Return the associated naming context.

lifecycleEvent

public void lifecycleEvent(LifecycleEvent event)
Acknowledge the occurrence of the specified event.

Parameters: event LifecycleEvent that has occurred

propertyChange

public void propertyChange(PropertyChangeEvent event)
Process property change events.

Parameters: event The property change event that has occurred

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.

removeService

public void removeService(String name)
Set the specified web services in the naming context.

setName

public void setName(String name)
Set the "name" property.

Parameters: name The new name

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.