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

public Class NamingEntryUtil

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .List, javax.naming.Binding, .Context, .InitialContext, .Name, .NameNotFoundException, .NameParser, .NamingEnumeration, .NamingException, org.eclipse.jetty.util.StringUtil, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if bind success, false if not bound
bindToENC
(Object
the scope of the lookup
scope
,
String
the name to bind as
asName
,
String
the name from the environment to link to asName
mappedName
)

Link a name in a webapp's java:/comp/env namespace to a pre-existing resource.

private static String
public static void
public static Context
public static Name
public static Object
lookup(Object scope, String jndiName)

public static <T> List<? extends T>

Returns:

all NameEntries of a certain type in the given naming environment scope (server-wide names or context-specific names)
lookupNamingEntries
(Object
the object scope
scope
,
Class<T>
the type of the entry
clazz
)

Get all NameEntries of a certain type in the given naming environment scope (server-wide names or context-specific names)

private static List<Object>
lookupNamingEntries(List<Object> list, Context context, Class<?> clazz)

Build up a list of NamingEntry objects that are of a specific type.

public static NamingEntry

Returns:

the naming entry for the given scope
lookupNamingEntry
(Object
the object scope
scope
,
String
the jndi name
jndiName
)

Find a NamingEntry in the given scope.

public static Name
public static Name
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final Logger LOG

Constructor Detail

NamingEntryUtilback to summary
public NamingEntryUtil()

Method Detail

bindToENCback to summary
public static boolean bindToENC(Object scope, String asName, String mappedName) throws NamingException

Link a name in a webapp's java:/comp/env 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:Object

the scope of the lookup

asName:String

the name to bind as

mappedName:String

the name from the environment to link to asName

Returns:boolean

true if bind success, false if not bound

Exceptions
NamingException:
if unable to bind
canonicalizeScopeback to summary
private static String canonicalizeScope(Object scope)
destroyContextForScopeback to summary
public static void destroyContextForScope(Object scope) throws NamingException
getContextForScopeback to summary
public static Context getContextForScope(Object scope) throws NamingException
getNameForScopeback to summary
public static Name getNameForScope(Object scope)
lookupback to summary
public static Object lookup(Object scope, String jndiName) throws NamingException
lookupNamingEntriesback to summary
public static <T> List<? extends T> lookupNamingEntries(Object scope, Class<T> clazz) throws NamingException

Get all NameEntries of a certain type in the given naming environment scope (server-wide names or context-specific names)

Parameters
scope:Object

the object scope

clazz:Class<T>

the type of the entry

Returns:List<? extends T>

all NameEntries of a certain type in the given naming environment scope (server-wide names or context-specific names)

Exceptions
NamingException:
if unable to lookup the naming entries
lookupNamingEntriesback to summary
private static List<Object> lookupNamingEntries(List<Object> list, Context context, Class<?> clazz) throws NamingException

Build up a list of NamingEntry objects that are of a specific type.

lookupNamingEntryback to summary
public static NamingEntry lookupNamingEntry(Object scope, String jndiName) throws NamingException

Find a NamingEntry in the given scope.

Parameters
scope:Object

the object scope

jndiName:String

the jndi name

Returns:NamingEntry

the naming entry for the given scope

Exceptions
NamingException:
if unable to lookup naming entry
makeNamingEntryNameback to summary
public static Name makeNamingEntryName(NameParser parser, NamingEntry namingEntry) throws NamingException
makeNamingEntryNameback to summary
public static Name makeNamingEntryName(NameParser parser, String jndiName) throws NamingException