## org.apache.catalina.core
Class NamingContextListener

    java.lang.Object
      org.apache.catalina.core.NamingContextListener

All Implemented Interfaces:
  ContainerListener, java.util.EventListener, LifecycleListener, java.beans.PropertyChangeListener

public class NamingContextListener
extends java.lang.Object
implements LifecycleListener, ContainerListener, java.beans.PropertyChangeListener

Helper class used to initialize and populate the JNDI context associated with each context and server.

Version:
  $Revision: 1.23 $ $Date: 2004/09/05 18:43:08 $
Author:
  Remy Maucherat

Field Summary
`protected javax.naming.Context` `compCtx` Comp context.
`protected java.lang.Object` `container` Associated container.
`protected int` `debug` Debugging level.
`protected javax.naming.Context` `envCtx` Env context.
`protected boolean` `initialized` Initialized flag.
`protected java.lang.String` `name` Name of the associated naming context.
`protected NamingContext` `namingContext` Associated JNDI context.
`protected NamingResources` `namingResources` Associated naming resources.
`protected static StringManager` `sm` The string manager for this package.

Constructor Summary
`NamingContextListener()` Create a new naming context listener.

Method Summary
`void` `addEjb(ContextEjb ejb)` Set the specified EJBs in the naming context.
`void` `addEnvironment(ContextEnvironment env)` Set the specified environment entries in the naming context.
`void` `addLocalEjb(ContextLocalEjb localEjb)` Set the specified local EJBs in the naming context.
`void` `addResource(ContextResource resource)` Set the specified resources in the naming context.
`void` `addResourceEnvRef(java.lang.String name, java.lang.String type)` Set the specified resources in the naming context.
`void` `addResourceLink(ContextResourceLink resourceLink)` Set the specified resource link in the naming context.
`void` `containerEvent(ContainerEvent event)` Acknowledge the occurrence of the specified event.
`int` `getDebug()` Return the "debug" property.
`java.lang.String` `getName()` Return the "name" property.
`NamingContext` `getNamingContext()` Return the associated naming context.
`void` `lifecycleEvent(LifecycleEvent event)` Acknowledge the occurrence of the specified event.
`protected void` `log(java.lang.String message)` Log the specified message to our current Logger (if any).
`protected void` `log(java.lang.String message, java.lang.Throwable throwable)` Log the specified message and exception to our current Logger (if any).
`protected java.lang.String` `logName()` Return the abbreviated name of this container for logging messsages
`void` `propertyChange(java.beans.PropertyChangeEvent event)` Process property change events.
`void` `removeEjb(java.lang.String name)` Set the specified EJBs in the naming context.
`void` `removeEnvironment(java.lang.String name)` Set the specified environment entries in the naming context.
`void` `removeLocalEjb(java.lang.String name)` Set the specified local EJBs in the naming context.
`void` `removeResource(java.lang.String name)` Set the specified resources in the naming context.
`void` `removeResourceEnvRef(java.lang.String name)` Set the specified resources in the naming context.
`void` `removeResourceLink(java.lang.String name)` Set the specified resources in the naming context.
`void` `setDebug(int debug)` Set the "debug" property.
`void` `setName(java.lang.String name)` Set the "name" property.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### name

    protected java.lang.String name

  Name of the associated naming context.

### container

    protected java.lang.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 javax.naming.Context compCtx

  Comp context.

### envCtx

    protected javax.naming.Context envCtx

  Env context.

### sm

    protected static StringManager sm

  The string manager for this package.

Constructor Detail

### NamingContextListener

    public NamingContextListener()

  Create a new naming context listener.

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 java.lang.String getName()

  Return the "name" property.

### setName

    public void setName(java.lang.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:
    `lifecycleEvent` in interface `LifecycleListener`
  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:
    `containerEvent` in interface `ContainerListener`
  Parameters:
    `event` - ContainerEvent that has occurred

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent event)

  Process property change events. Currently, only listens to such events on the `NamingResources` instance for the global naming resources.

  Specified by:
    `propertyChange` in interface `java.beans.PropertyChangeListener`
  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(java.lang.String name,
                                  java.lang.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(java.lang.String name)

  Set the specified EJBs in the naming context.

### removeEnvironment

    public void removeEnvironment(java.lang.String name)

  Set the specified environment entries in the naming context.

### removeLocalEjb

    public void removeLocalEjb(java.lang.String name)

  Set the specified local EJBs in the naming context.

### removeResource

    public void removeResource(java.lang.String name)

  Set the specified resources in the naming context.

### removeResourceEnvRef

    public void removeResourceEnvRef(java.lang.String name)

  Set the specified resources in the naming context.

### removeResourceLink

    public void removeResourceLink(java.lang.String name)

  Set the specified resources in the naming context.

### log

    protected void log(java.lang.String message)

  Log the specified message to our current Logger (if any).

  Parameters:
    `message` - Message to be logged

### log

    protected void log(java.lang.String message,
                       java.lang.Throwable throwable)

  Log the specified message and exception to our current Logger (if any).

  Parameters:
    `message` - Message to be logged
    `throwable` - Related exception

### logName

    protected java.lang.String logName()

  Return the abbreviated name of this container for logging messsages

Copyright ? 2000-2002 Apache Software Foundation. All Rights Reserved.