public abstract class NamingEntry extends Object
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.
Modifier and Type | Field and Description |
---|---|
static String |
__contextName |
protected String |
_jndiName |
protected String |
_namingEntryNameString |
protected String |
_objectNameString |
protected Object |
_scope |
Modifier | Constructor and Description |
---|---|
protected |
NamingEntry(Object scope,
String jndiName) |
protected |
NamingEntry(String jndiName)
Create a NamingEntry.
|
Modifier and Type | Method and Description |
---|---|
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
|
void |
release()
Unbind this NamingEntry entirely
|
protected void |
save(Object object)
Save the NamingEntry for later use.
|
String |
toString() |
void |
unbindENC()
Unbind this NamingEntry from a java:comp/env
|
public static final String __contextName
protected final Object _scope
protected final String _jndiName
protected String _namingEntryNameString
protected String _objectNameString
protected NamingEntry(Object scope, String jndiName) throws NamingException
NamingException
protected NamingEntry(String jndiName) throws NamingException
jndiName
- the name of the object which will eventually be in java:comp/envNamingException
- if unable to create naming entrypublic void bindToENC(String localName) throws NamingException
java:comp/env
binding for the object represented by this NamingEntry,
but bind it as the name suppliedlocalName
- the local name to bindNamingException
- if unable to bindpublic void unbindENC()
public void release()
public String getJndiName()
public String getJndiNameInScope()
protected void save(Object object) throws NamingException
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
object
- the object to saveNamingException
- if unable to saveCopyright © 1995-2016 Webtide. All Rights Reserved.