Top Description Fields Constructors Methods
org.eclipse.jetty.plus.jndi

public abstract Class NamingEntry

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jetty.plus.jndi.Resource, org.eclipse.jetty.plus.jndi.Transaction, org.eclipse.jetty.plus.jndi.EnvEntry, org.eclipse.jetty.plus.jndi.Link
Imports
java.util.Set, javax.naming.Context, .InitialContext, .LinkRef, .Name, .NameParser, .NamingException, org.eclipse.jetty.util.jndi.NamingUtil, org.slf4j.Logger, .LoggerFactory

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

Modifier and TypeField and Description
public static final String
protected final String
protected String
protected String
protected final Object
private static final Logger

Constructor Summary

AccessConstructor and Description
protected
NamingEntry(Object
an object whose stringified form will be used as a node in the context tree under which the objectToBind will be bound
scope
,
String
the name associated with the objectToBind
jndiName
,
Object
the object to bind
objectToBind
)

Create a NamingEntry.

Method Summary

Modifier and TypeMethod and Description
public void
bindToENC(String
the local name to bind
localName
)

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

public String

Returns:

the unique jndi name of the object
getJndiName
()

Get the unique name of the object relative to the scope

public String

Returns:

the name of the object, fully qualified with the scope
getJndiNameInScope
()

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

public String
public void
release()

Unbind this NamingEntry entirely

protected void
save(Object
the object to save
object
)

Save the NamingEntry for later use.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
protected String
public void
unbindENC()

Unbind this NamingEntry from a java:comp/env

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

__contextNameback to summary
public static final String __contextName
_jndiNameback to summary
protected final String _jndiName
_namingEntryNameStringback to summary
protected String _namingEntryNameString
_objectNameStringback to summary
protected String _objectNameString
_scopeback to summary
protected final Object _scope
LOGback to summary
private static final Logger LOG

Constructor Detail

NamingEntryback to summary
protected NamingEntry(Object scope, String jndiName, Object objectToBind) 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
scope:Object

an object whose stringified form will be used as a node in the context tree under which the objectToBind will be bound

jndiName:String

the name associated with the objectToBind

objectToBind:Object

the object to bind

Exceptions
NamingException:
if there is no name or no objectToBind

Method Detail

bindToENCback to summary
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

Parameters
localName:String

the local name to bind

Exceptions
NamingException:
if unable to bind
getJndiNameback to summary
public String getJndiName()

Get the unique name of the object relative to the scope

Returns:String

the unique jndi name of the object

getJndiNameInScopeback to summary
public String getJndiNameInScope()

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

Returns:String

the name of the object, fully qualified with the scope

getNamingEntryNameInScopeback to summary
public String getNamingEntryNameInScope()
releaseback to summary
public void release()

Unbind this NamingEntry entirely

saveback to summary
protected void save(Object object) throws NamingException

Save the NamingEntry for later use.

Saving is done by binding both 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 scope/jndiName and the NamingEntry is bound at scope/__/jndiName.

eg

jdbc/foo    : DataSource
__/jdbc/foo : NamingEntry
Parameters
object:Object

the object to save

Exceptions
NamingException:
if unable to save
See Also
NamingEntryUtil#getNameForScope(Object)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
toStringMetaDataback to summary
protected String toStringMetaData()
unbindENCback to summary
public void unbindENC()

Unbind this NamingEntry from a java:comp/env