Class NamingContextListener

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

    public class NamingContextListener
    extends java.lang.Object
    implements LifecycleListener, java.beans.PropertyChangeListener
    Helper class used to initialize and populate the JNDI context associated with each context and server.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.naming.Context compCtx
      Comp context.
      protected java.lang.Object container
      Associated container.
      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 NamingResourcesImpl namingResources
      Associated naming resources.
      protected java.util.HashMap<java.lang.String,​javax.management.ObjectName> objectNames
      Objectnames Map.
      protected static StringManager sm
      The string manager for this class.
    • Field Detail

      • sm

        protected static final StringManager sm
        The string manager for this class.
      • name

        protected java.lang.String name
        Name of the associated naming context.
      • container

        protected java.lang.Object container
        Associated container.
      • initialized

        protected boolean initialized
        Initialized flag.
      • namingContext

        protected NamingContext namingContext
        Associated JNDI context.
      • compCtx

        protected javax.naming.Context compCtx
        Comp context.
      • envCtx

        protected javax.naming.Context envCtx
        Env context.
      • objectNames

        protected java.util.HashMap<java.lang.String,​javax.management.ObjectName> objectNames
        Objectnames Map.
    • Constructor Detail

      • NamingContextListener

        public NamingContextListener()
        Default constructor.
    • Method Detail

      • getExceptionOnFailedWrite

        public boolean getExceptionOnFailedWrite()
        Return whether or not an attempt to modify the JNDI context will trigger an exception.
        Returns:
        whether or not an attempt to modify the JNDI context will trigger an exception
      • 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

        public java.lang.String getName()
        Return the "name" property.
        Returns:
        the "name" property
      • setName

        public void setName​(java.lang.String name)
        Set the "name" property.
        Parameters:
        name - The new name
      • getEnvContext

        public javax.naming.Context getEnvContext()
        Return the naming environment context.
        Returns:
        the naming environment context
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent event)
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
      • createObjectName

        protected javax.management.ObjectName createObjectName​(ContextResource resource)
                                                        throws javax.management.MalformedObjectNameException
        Create an ObjectName for this ContextResource object.
        Parameters:
        resource - The resource
        Returns:
        ObjectName The object name
        Throws:
        javax.management.MalformedObjectNameException - if a name cannot be created
      • addEjb

        public void addEjb​(ContextEjb ejb)
        Set the specified EJBs in the naming context.
        Parameters:
        ejb - the EJB descriptor
      • addEnvironment

        public void addEnvironment​(ContextEnvironment env)
        Set the specified environment entries in the naming context.
        Parameters:
        env - the environment entry
      • addLocalEjb

        public void addLocalEjb​(ContextLocalEjb localEjb)
        Set the specified local EJBs in the naming context.
        Parameters:
        localEjb - the local EJB descriptor (unused)
      • addMessageDestinationRef

        public void addMessageDestinationRef​(MessageDestinationRef mdr)
        Set the specified message destination refs in the naming context.
        Parameters:
        mdr - the message destination ref descriptor (unused)
      • addService

        public void addService​(ContextService service)
        Set the specified web service in the naming context.
        Parameters:
        service - the web service descriptor
      • addResource

        public void addResource​(ContextResource resource)
        Set the specified resources in the naming context.
        Parameters:
        resource - the resource descriptor
      • addResourceEnvRef

        public void addResourceEnvRef​(ContextResourceEnvRef resourceEnvRef)
        Set the specified resources in the naming context.
        Parameters:
        resourceEnvRef - the resource reference
      • addResourceLink

        public void addResourceLink​(ContextResourceLink resourceLink)
        Set the specified resource link in the naming context.
        Parameters:
        resourceLink - the resource link
      • removeEjb

        public void removeEjb​(java.lang.String name)
        Remove the specified EJB from the naming context.
        Parameters:
        name - the name of the EJB which should be removed
      • removeEnvironment

        public void removeEnvironment​(java.lang.String name)
        Remove the specified environment entry from the naming context.
        Parameters:
        name - the name of the environment entry which should be removed
      • removeLocalEjb

        public void removeLocalEjb​(java.lang.String name)
        Remove the specified local EJB from the naming context.
        Parameters:
        name - the name of the EJB which should be removed
      • removeMessageDestinationRef

        public void removeMessageDestinationRef​(java.lang.String name)
        Remove the specified message destination ref from the naming context.
        Parameters:
        name - the name of the message destination ref which should be removed
      • removeService

        public void removeService​(java.lang.String name)
        Remove the specified web service from the naming context.
        Parameters:
        name - the name of the web service which should be removed
      • removeResource

        public void removeResource​(java.lang.String name)
        Remove the specified resource from the naming context.
        Parameters:
        name - the name of the resource which should be removed
      • removeResourceEnvRef

        public void removeResourceEnvRef​(java.lang.String name)
        Remove the specified resource environment reference from the naming context.
        Parameters:
        name - the name of the resource environment reference which should be removed
      • removeResourceLink

        public void removeResourceLink​(java.lang.String name)
        Remove the specified resource link from the naming context.
        Parameters:
        name - the name of the resource link which should be removed