org.eclipse.jetty.plus.jndi
Class NamingEntry

java.lang.Object
  extended by org.eclipse.jetty.plus.jndi.NamingEntry
Direct Known Subclasses:
EnvEntry, Link, Resource, Transaction

public abstract class NamingEntry
extends java.lang.Object

NamingEntry Base class for all jndi related entities. Instances of subclasses of this class are declared in jetty.xml or in a webapp's WEB-INF/jetty-env.xml file. NOTE: that all NamingEntries will be bound in a single namespace. The "global" level is just in the top level context. The "local" level is a context specific to a webapp.


Field Summary
static java.lang.String __contextName
           
protected  java.lang.String _jndiName
           
protected  java.lang.String _namingEntryNameString
           
protected  java.lang.String _objectNameString
           
protected  java.lang.Object _scope
           
 
Constructor Summary
protected NamingEntry(java.lang.Object scope, java.lang.String jndiName)
           
protected NamingEntry(java.lang.String jndiName)
          Create a NamingEntry.
 
Method Summary
 void bindToENC(java.lang.String localName)
          Add a java:comp/env binding for the object represented by this NamingEntry, but bind it as the name supplied
 java.lang.String getJndiName()
          Get the unique name of the object relative to the scope
 java.lang.String getJndiNameInScope()
          Get the name of the object, fully qualified with the scope
 void release()
          Unbind this NamingEntry entirely
protected  void save(java.lang.Object object)
          Save the NamingEntry for later use.
 java.lang.String toString()
           
 void unbindENC()
          Unbind this NamingEntry from a java:comp/env
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

__contextName

public static final java.lang.String __contextName
See Also:
Constant Field Values

_scope

protected final java.lang.Object _scope

_jndiName

protected final java.lang.String _jndiName

_namingEntryNameString

protected java.lang.String _namingEntryNameString

_objectNameString

protected java.lang.String _objectNameString
Constructor Detail

NamingEntry

protected NamingEntry(java.lang.Object scope,
                      java.lang.String jndiName)
               throws javax.naming.NamingException
Throws:
javax.naming.NamingException

NamingEntry

protected NamingEntry(java.lang.String jndiName)
               throws javax.naming.NamingException
Create a NamingEntry. A NamingEntry is a name associated with a value which can later be looked up in JNDI by a webapp. We create the NamingEntry and put it into JNDI where it can be linked to the webapp's env-entry, resource-ref etc entries.

Parameters:
jndiName - the name of the object which will eventually be in java:comp/env
Throws:
javax.naming.NamingException
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

bindToENC

public void bindToENC(java.lang.String localName)
               throws javax.naming.NamingException
Add a java:comp/env binding for the object represented by this NamingEntry, but bind it as the name supplied

Throws:
javax.naming.NamingException

unbindENC

public void unbindENC()
Unbind this NamingEntry from a java:comp/env


release

public void release()
Unbind this NamingEntry entirely


getJndiName

public java.lang.String getJndiName()
Get the unique name of the object relative to the scope

Returns:
the unique jndi name of the object

getJndiNameInScope

public java.lang.String getJndiNameInScope()
Get the name of the object, fully qualified with the scope

Returns:
the name of the object, fully qualified with the scope

save

protected void save(java.lang.Object object)
             throws javax.naming.NamingException
Save the NamingEntry for later use. Saving is done by binding the NamingEntry itself, and the value it represents into JNDI. In this way, we can link to the value it represents later, but also still retrieve the NamingEntry itself too. The object is bound at the jndiName passed in. This NamingEntry is bound at __/jndiName. eg jdbc/foo : DataSource __/jdbc/foo : NamingEntry

Throws:
javax.naming.NamingException


Copyright © 2013. All Rights Reserved.