public abstract class NamingEntry
extends java.lang.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 java.lang.String |
__contextName |
protected java.lang.String |
_jndiName |
protected java.lang.String |
_namingEntryNameString |
protected java.lang.String |
_objectNameString |
protected java.lang.Object |
_scope |
Modifier | Constructor and Description |
---|---|
protected |
NamingEntry(java.lang.Object scope,
java.lang.String jndiName)
Create a naming entry.
|
protected |
NamingEntry(java.lang.String jndiName)
Create a NamingEntry.
|
Modifier and Type | Method and Description |
---|---|
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
|
public static final java.lang.String __contextName
protected final java.lang.Object _scope
protected final java.lang.String _jndiName
protected java.lang.String _namingEntryNameString
protected java.lang.String _objectNameString
protected NamingEntry(java.lang.Object scope, java.lang.String jndiName) throws javax.naming.NamingException
scope
- an object representing the scope of the name to be bound into jndi, where null means jvm scope.jndiName
- the name that will be associated with an object bound into jndijavax.naming.NamingException
- if jndiName is nullprotected NamingEntry(java.lang.String jndiName) throws javax.naming.NamingException
jndiName
- the name of the object which will eventually be in java:comp/envjavax.naming.NamingException
- if unable to create naming entrypublic java.lang.String toString()
toString
in class java.lang.Object
public void bindToENC(java.lang.String localName) throws javax.naming.NamingException
java:comp/env
binding for the object represented by this NamingEntry,
but bind it as the name suppliedlocalName
- the local name to bindjavax.naming.NamingException
- if unable to bindpublic void unbindENC()
public void release()
public java.lang.String getJndiName()
public java.lang.String getJndiNameInScope()
protected void save(java.lang.Object object) throws javax.naming.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 savejavax.naming.NamingException
- if unable to saveCopyright © 1995–2023 Webtide. All rights reserved.