Package org.eclipse.jetty.plus.jndi
Class NamingEntryUtil
- java.lang.Object
-
- org.eclipse.jetty.plus.jndi.NamingEntryUtil
-
public class NamingEntryUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description NamingEntryUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
bindToENC(java.lang.Object scope, java.lang.String asName, java.lang.String mappedName)
Link a name in a webapp's java:/comp/evn namespace to a pre-existing resource.static javax.naming.Context
getContextForNamingEntries(java.lang.Object scope)
static javax.naming.Context
getContextForScope(java.lang.Object scope)
static javax.naming.Name
getNameForScope(java.lang.Object scope)
static java.lang.Object
lookup(java.lang.Object scope, java.lang.String jndiName)
static <T> java.util.List<? extends T>
lookupNamingEntries(java.lang.Object scope, java.lang.Class<T> clazz)
Get all NameEntries of a certain type in the given naming environment scope (server-wide names or context-specific names)static NamingEntry
lookupNamingEntry(java.lang.Object scope, java.lang.String jndiName)
Find a NamingEntry in the given scope.static javax.naming.Name
makeNamingEntryName(javax.naming.NameParser parser, java.lang.String jndiName)
static javax.naming.Name
makeNamingEntryName(javax.naming.NameParser parser, NamingEntry namingEntry)
-
-
-
Method Detail
-
bindToENC
public static boolean bindToENC(java.lang.Object scope, java.lang.String asName, java.lang.String mappedName) throws javax.naming.NamingException
Link a name in a webapp's java:/comp/evn namespace to a pre-existing resource. The pre-existing resource can be either in the webapp's naming environment, or in the container's naming environment. Webapp's environment takes precedence over the server's namespace.- Parameters:
scope
- the scope of the lookupasName
- the name to bind asmappedName
- the name from the environment to link to asName- Returns:
- true if bind success, false if not bound
- Throws:
javax.naming.NamingException
- if unable to bind
-
lookupNamingEntry
public static NamingEntry lookupNamingEntry(java.lang.Object scope, java.lang.String jndiName) throws javax.naming.NamingException
Find a NamingEntry in the given scope.- Parameters:
scope
- the object scopejndiName
- the jndi name- Returns:
- the naming entry for the given scope
- Throws:
javax.naming.NamingException
- if unable to lookup naming entry
-
lookup
public static java.lang.Object lookup(java.lang.Object scope, java.lang.String jndiName) throws javax.naming.NamingException
- Throws:
javax.naming.NamingException
-
lookupNamingEntries
public static <T> java.util.List<? extends T> lookupNamingEntries(java.lang.Object scope, java.lang.Class<T> clazz) throws javax.naming.NamingException
Get all NameEntries of a certain type in the given naming environment scope (server-wide names or context-specific names)- Parameters:
scope
- the object scopeclazz
- the type of the entry- Returns:
- all NameEntries of a certain type in the given naming environment scope (server-wide names or context-specific names)
- Throws:
javax.naming.NamingException
- if unable to lookup the naming entries
-
makeNamingEntryName
public static javax.naming.Name makeNamingEntryName(javax.naming.NameParser parser, NamingEntry namingEntry) throws javax.naming.NamingException
- Throws:
javax.naming.NamingException
-
makeNamingEntryName
public static javax.naming.Name makeNamingEntryName(javax.naming.NameParser parser, java.lang.String jndiName) throws javax.naming.NamingException
- Throws:
javax.naming.NamingException
-
getNameForScope
public static javax.naming.Name getNameForScope(java.lang.Object scope)
-
getContextForScope
public static javax.naming.Context getContextForScope(java.lang.Object scope) throws javax.naming.NamingException
- Throws:
javax.naming.NamingException
-
getContextForNamingEntries
public static javax.naming.Context getContextForNamingEntries(java.lang.Object scope) throws javax.naming.NamingException
- Throws:
javax.naming.NamingException
-
-