Package org.jboss.util.naming
Class Util
- java.lang.Object
-
- org.jboss.util.naming.Util
-
public class Util extends java.lang.ObjectA static utility class for common JNDI operations.- Version:
- $Revision$
-
-
Field Summary
Fields Modifier and Type Field Description private static org.jboss.logging.Loggerlog
-
Constructor Summary
Constructors Constructor Description Util()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static voidappendClassInfo(java.lang.StringBuffer buffer, java.lang.Class clazz)Append Class Infostatic voidbind(javax.naming.Context ctx, java.lang.String name, java.lang.Object value)Bind val to name in ctx, and make sure that all intermediate contexts existstatic voidbind(javax.naming.Context ctx, javax.naming.Name name, java.lang.Object value)Bind val to name in ctx, and make sure that all intermediate contexts existprotected static voidcheckObject(javax.naming.Context context, java.lang.String name, java.lang.Object object, java.lang.Class clazz)Checks an object implements the given classstatic voidcreateLinkRef(java.lang.String fromName, java.lang.String toName)Create a linkstatic voidcreateLinkRef(javax.naming.Context ctx, java.lang.String fromName, java.lang.String toName)Create a linkstatic javax.naming.ContextcreateSubcontext(javax.naming.Context ctx, java.lang.String name)Create a subcontext including any intermediate contexts.static javax.naming.ContextcreateSubcontext(javax.naming.Context ctx, javax.naming.Name name)Create a subcontext including any intermediate contexts.static java.lang.Objectlookup(java.lang.String name, java.lang.Class<?> clazz)Lookup an object in the default initial contextstatic java.lang.Objectlookup(javax.naming.Context context, java.lang.String name, java.lang.Class clazz)Lookup an object in the given contextstatic java.lang.Objectlookup(javax.naming.Context context, javax.naming.Name name, java.lang.Class clazz)Lookup an object in the given contextstatic java.lang.Objectlookup(javax.naming.Name name, java.lang.Class<?> clazz)Lookup an object in the default initial contextstatic voidrebind(javax.naming.Context ctx, java.lang.String name, java.lang.Object value)Rebind val to name in ctx, and make sure that all intermediate contexts existstatic voidrebind(javax.naming.Context ctx, javax.naming.Name name, java.lang.Object value)Rebind val to name in ctx, and make sure that all intermediate contexts existstatic voidremoveLinkRef(java.lang.String name)Remove the link refstatic voidremoveLinkRef(javax.naming.Context ctx, java.lang.String name)Remove the link refstatic voidunbind(javax.naming.Context ctx, java.lang.String name)Unbinds a name from ctx, and removes parents if they are emptystatic voidunbind(javax.naming.Context ctx, javax.naming.Name name)Unbinds a name from ctx, and removes parents if they are empty
-
-
-
Method Detail
-
createSubcontext
public static javax.naming.Context createSubcontext(javax.naming.Context ctx, java.lang.String name) throws javax.naming.NamingExceptionCreate a subcontext including any intermediate contexts.- Parameters:
ctx- the parent JNDI Context under which value will be boundname- the name relative to ctx of the subcontext.- Returns:
- The new or existing JNDI subcontext
- Throws:
javax.naming.NamingException- on any JNDI failure
-
createSubcontext
public static javax.naming.Context createSubcontext(javax.naming.Context ctx, javax.naming.Name name) throws javax.naming.NamingExceptionCreate a subcontext including any intermediate contexts.- Parameters:
ctx- the parent JNDI Context under which value will be boundname- the name relative to ctx of the subcontext.- Returns:
- The new or existing JNDI subcontext
- Throws:
javax.naming.NamingException- on any JNDI failure
-
bind
public static void bind(javax.naming.Context ctx, java.lang.String name, java.lang.Object value) throws javax.naming.NamingExceptionBind val to name in ctx, and make sure that all intermediate contexts exist- Parameters:
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.- Throws:
javax.naming.NamingException- for any error
-
bind
public static void bind(javax.naming.Context ctx, javax.naming.Name name, java.lang.Object value) throws javax.naming.NamingExceptionBind val to name in ctx, and make sure that all intermediate contexts exist- Parameters:
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.- Throws:
javax.naming.NamingException- for any error
-
rebind
public static void rebind(javax.naming.Context ctx, java.lang.String name, java.lang.Object value) throws javax.naming.NamingExceptionRebind val to name in ctx, and make sure that all intermediate contexts exist- Parameters:
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.- Throws:
javax.naming.NamingException- for any error
-
rebind
public static void rebind(javax.naming.Context ctx, javax.naming.Name name, java.lang.Object value) throws javax.naming.NamingExceptionRebind val to name in ctx, and make sure that all intermediate contexts exist- Parameters:
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.- Throws:
javax.naming.NamingException- for any error
-
unbind
public static void unbind(javax.naming.Context ctx, java.lang.String name) throws javax.naming.NamingExceptionUnbinds a name from ctx, and removes parents if they are empty- Parameters:
ctx- the parent JNDI Context under which the name will be unboundname- The name to unbind- Throws:
javax.naming.NamingException- for any error
-
unbind
public static void unbind(javax.naming.Context ctx, javax.naming.Name name) throws javax.naming.NamingExceptionUnbinds a name from ctx, and removes parents if they are empty- Parameters:
ctx- the parent JNDI Context under which the name will be unboundname- The name to unbind- Throws:
javax.naming.NamingException- for any error
-
lookup
public static java.lang.Object lookup(java.lang.String name, java.lang.Class<?> clazz) throws java.lang.ExceptionLookup an object in the default initial context- Parameters:
name- the name to lookupclazz- the expected type- Returns:
- the object
- Throws:
java.lang.Exception- for any error
-
lookup
public static java.lang.Object lookup(javax.naming.Name name, java.lang.Class<?> clazz) throws java.lang.ExceptionLookup an object in the default initial context- Parameters:
name- the name to lookupclazz- the expected type- Returns:
- the object
- Throws:
java.lang.Exception- for any error
-
lookup
public static java.lang.Object lookup(javax.naming.Context context, java.lang.String name, java.lang.Class clazz) throws java.lang.ExceptionLookup an object in the given context- Parameters:
context- the contextname- the name to lookupclazz- the expected type- Returns:
- the object
- Throws:
java.lang.Exception- for any error
-
lookup
public static java.lang.Object lookup(javax.naming.Context context, javax.naming.Name name, java.lang.Class clazz) throws java.lang.ExceptionLookup an object in the given context- Parameters:
context- the contextname- the name to lookupclazz- the expected type- Returns:
- the object
- Throws:
java.lang.Exception- for any error
-
createLinkRef
public static void createLinkRef(java.lang.String fromName, java.lang.String toName) throws javax.naming.NamingExceptionCreate a link- Parameters:
fromName- the from nametoName- the to name- Throws:
javax.naming.NamingException- for any error
-
createLinkRef
public static void createLinkRef(javax.naming.Context ctx, java.lang.String fromName, java.lang.String toName) throws javax.naming.NamingExceptionCreate a link- Parameters:
ctx- the contextfromName- the from nametoName- the to name- Throws:
javax.naming.NamingException- for any error
-
removeLinkRef
public static void removeLinkRef(java.lang.String name) throws javax.naming.NamingExceptionRemove the link ref- Parameters:
name- the name of the link binding- Throws:
javax.naming.NamingException- for any error
-
removeLinkRef
public static void removeLinkRef(javax.naming.Context ctx, java.lang.String name) throws javax.naming.NamingExceptionRemove the link ref- Parameters:
ctx- the contextname- the name of the link binding- Throws:
javax.naming.NamingException- for any error
-
checkObject
protected static void checkObject(javax.naming.Context context, java.lang.String name, java.lang.Object object, java.lang.Class clazz) throws java.lang.ExceptionChecks an object implements the given class- Parameters:
context- the contextname- the name to lookupobject- the objectclazz- the expected type- Throws:
java.lang.Exception- for any error
-
appendClassInfo
protected static void appendClassInfo(java.lang.StringBuffer buffer, java.lang.Class clazz)Append Class Info- Parameters:
buffer- the buffer to append toclazz- the class to describe
-
-