## org.mortbay.jetty.plus.naming
Class NamingEntry

    java.lang.Object
      org.mortbay.jetty.plus.naming.NamingEntry

Direct Known Subclasses:
  EnvEntry, Link, Resource, Transaction

    public abstract class NamingEntry

extends 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 String` `__contextName`
`protected String` `jndiName`
`protected String` `namingEntryNameString`
`protected String` `objectNameString`
`protected Object` `objectToBind`

Constructor Summary
`NamingEntry(Object scope, String jndiName, Object object)`
`NamingEntry(String jndiName, Object object)` Create a NamingEntry.

Method Summary
`void` `bindToENC(String localName)` Add a java:comp/env binding for the object represented by this NamingEntry, but bind it as the name supplied
`String` `getJndiName()` Get the unique name of the object relative to the scope
`String` `getJndiNameInScope()` Get the name of the object, fully qualified with the scope
`Object` `getObjectToBind()` Get the object that is to be bound
`void` `release()` Unbind this NamingEntry entirely
`protected void` `save(Object scope)` Save the NamingEntry for later use.
`void` `unbindENC()` Unbind this NamingEntry from a java:comp/env

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

Field Detail

### __contextName

    public static final String __contextName

See Also:
  Constant Field Values

### jndiName

    protected String jndiName

### objectToBind

    protected Object objectToBind

### namingEntryNameString

    protected String namingEntryNameString

### objectNameString

    protected String objectNameString

Constructor Detail

### NamingEntry

    public NamingEntry(Object scope,
                       String jndiName,
                       Object object)
                throws NamingException

Throws:
  `NamingException`

### NamingEntry

    public NamingEntry(String jndiName,
                       Object object)
                throws 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
    `object` - the object to be bound
  Throws:
    `NamingException`

Method Detail

### bindToENC

    public void bindToENC(String localName)
                   throws NamingException

  Add a java:comp/env binding for the object represented by this NamingEntry, but bind it as the name supplied

  Throws:
    `NamingException`

### unbindENC

    public void unbindENC()

  Unbind this NamingEntry from a java:comp/env

### release

    public void release()

  Unbind this NamingEntry entirely

### getJndiName

    public String getJndiName()

  Get the unique name of the object relative to the scope

  Returns:

### getObjectToBind

    public Object getObjectToBind()
                           throws NamingException

  Get the object that is to be bound

  Returns:
  Throws:
    `NamingException`

### getJndiNameInScope

    public String getJndiNameInScope()

  Get the name of the object, fully qualified with the scope

  Returns:

### save

    protected void save(Object scope)
                 throws 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:
    `NamingException`

Copyright © 1995-2008 Mort Bay Consulting. All Rights Reserved.