public class NamingUtils extends Object
Modifier and Type | Method and Description |
---|---|
static CannotProceedException |
cannotProceedException(Object resolvedObject,
Name remainingName)
Return a cannot-proceed exception.
|
static InvalidNameException |
emptyNameException()
Create an invalid name exception for an empty name.
|
static String |
getLastComponent(Name name)
Get the last component of a name.
|
static boolean |
isEmpty(Name name)
Determine if a name is empty, or if ot contains only one component which is the empty string.
|
static boolean |
isLastComponentEmpty(Name name)
Determine whether the last component is empty.
|
static NameAlreadyBoundException |
nameAlreadyBoundException(Name name)
Create a name-already-bound exception.
|
static NameNotFoundException |
nameNotFoundException(String name,
Name contextName)
Create a name-not-found exception.
|
static <T> NamingEnumeration<T> |
namingEnumeration(Collection<T> collection)
Return a naming enumeration over a collection.
|
static NamingException |
namingException(String message,
Throwable cause)
Return a general naming exception with a root cause.
|
static NamingException |
namingException(String message,
Throwable cause,
Name remainingName)
Return a general naming exception with a root cause and a remaining name field.
|
static NotContextException |
notAContextException(Name name)
Return a not-context exception for a name.
|
static void |
rebind(Context ctx,
Name name,
Object value)
Rebind val to name in ctx, and make sure that all intermediate contexts exist
|
static void |
rebind(Context ctx,
String name,
Object value)
Rebind val to name in ctx, and make sure that all intermediate contexts exist
|
static void |
unbind(Context ctx,
Name name)
Unbinds a name from ctx, and removes parents if they are empty
|
static void |
unbind(Context ctx,
String name)
Unbinds a name from ctx, and removes parents if they are empty
|
public static String getLastComponent(Name name)
name
- the namepublic static boolean isEmpty(Name name)
name
- the nametrue
if the name is empty or contains one empty componentpublic static boolean isLastComponentEmpty(Name name)
name
- the name to testtrue
if the last component is empty, or if the name is emptypublic static NameNotFoundException nameNotFoundException(String name, Name contextName)
name
- the namecontextName
- the context namepublic static NameAlreadyBoundException nameAlreadyBoundException(Name name)
name
- the namepublic static InvalidNameException emptyNameException()
public static NotContextException notAContextException(Name name)
name
- the namepublic static NamingException namingException(String message, Throwable cause)
message
- the messagecause
- the exception cause, or null
for nonepublic static NamingException namingException(String message, Throwable cause, Name remainingName)
message
- the messagecause
- the exception cause, or null
for noneremainingName
- the remaining namepublic static CannotProceedException cannotProceedException(Object resolvedObject, Name remainingName)
resolvedObject
- the resolved objectremainingName
- the remaining namepublic static <T> NamingEnumeration<T> namingEnumeration(Collection<T> collection)
T
- the member typecollection
- the collectionpublic static void rebind(Context ctx, String name, Object value) throws NamingException
ctx
- the parent JNDI Context under which value will be boundname
- the name relative to ctx where value will be boundvalue
- the value to bind.NamingException
- for any errorpublic static void rebind(Context ctx, Name name, Object value) throws NamingException
ctx
- the parent JNDI Context under which value will be boundname
- the name relative to ctx where value will be boundvalue
- the value to bind.NamingException
- for any errorpublic static void unbind(Context ctx, String name) throws NamingException
ctx
- the parent JNDI Context under which the name will be unboundname
- The name to unbindNamingException
- for any errorpublic static void unbind(Context ctx, Name name) throws NamingException
ctx
- the parent JNDI Context under which the name will be unboundname
- The name to unbindNamingException
- for any errorCopyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.