Package org.eclipse.jetty.plus.jndi
Class NamingEntry
java.lang.Object
org.eclipse.jetty.plus.jndi.NamingEntry
- Direct Known Subclasses:
EnvEntry
,Link
,Resource
,Transaction
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
-
Constructor Summary
ModifierConstructorDescriptionprotected
NamingEntry
(Object scope, String jndiName, Object objectToBind) Create a NamingEntry. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add ajava:comp/env
binding for the object represented by this NamingEntry, but bind it as the name suppliedGet the unique name of the object relative to the scopeGet the name of the object, fully qualified with the scopevoid
release()
Unbind this NamingEntry entirelyprotected void
Save the NamingEntry for later use.toString()
protected String
void
Unbind this NamingEntry from a java:comp/env
-
Field Details
-
__contextName
- See Also:
-
_scope
-
_jndiName
-
_namingEntryNameString
-
_objectNameString
-
-
Constructor Details
-
NamingEntry
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
- an object whose stringified form will be used as a node in the context tree under which the objectToBind will be boundjndiName
- the name associated with the objectToBindobjectToBind
- the object to bind- Throws:
NamingException
- if there is no name or no objectToBind
-
-
Method Details
-
bindToENC
Add ajava:comp/env
binding for the object represented by this NamingEntry, but bind it as the name supplied- Parameters:
localName
- the local name to bind- Throws:
NamingException
- if unable to bind
-
unbindENC
public void unbindENC()Unbind this NamingEntry from a java:comp/env -
release
public void release()Unbind this NamingEntry entirely -
getJndiName
Get the unique name of the object relative to the scope- Returns:
- the unique jndi name of the object
-
getJndiNameInScope
Get the name of the object, fully qualified with the scope- Returns:
- the name of the object, fully qualified with the scope
-
getNamingEntryNameInScope
-
save
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
- the object to save- Throws:
NamingException
- if unable to save- See Also:
-
toStringMetaData
-
toString
-