com.ibm.websphere.naming
Class JndiHelper
- java.lang.Object
com.ibm.websphere.naming.JndiHelper
- public class JndiHelper
- extends java.lang.Object
- methods for creating subcontexts, binding and rebinding objects to the name space such that intermediate contexts are automatically created if necessary. In general, the caller does not need to be concerned with NameNotFoundException or NameAlreadyBoundExceptions for intermediate contexts when using methods in this class.
- methods for normalizing hostnames for consistent use in the WebSphere NameSpace.
Nested Class Summary
Modifier and Type | Class and Description |
---|---|
|
JndiHelper.Operation
|
Constructor Summary
Modifier | Constructor and Description |
---|---|
|
JndiHelper()
Protected empty constructor which prevents anyone from
creating an instance of this class.
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
batchCreateSubcontextsDriver(WsnBatchModeContext startingContext,javax.naming.Name name)
|
|
createSubcontextsDriver(javax.naming.Context startingContext,javax.naming.Name name)
|
|
getSubcontextFromBatchResults(javax.naming.Context startingContext,java.util.Enumeration vEnum,int numCtx)
|
|
normalizeHostname(java.util.Hashtable env)
Returns a normalized form of the local hostname for consistent use in the NameSpace.
|
|
normalizeHostname(java.util.Hashtable env,java.net.InetAddress ipAddress)
Returns a normalized form of the hostname represented by the ipAddress parameter
for consistent use in the NameSpace.
|
|
normalizeHostname(java.util.Hashtable env,java.lang.String hostname)
Returns a normalized form of the hostname parameter for consistent use in the NameSpace.
|
|
recursiveBind(javax.naming.Context startingContext,javax.naming.Name name,java.lang.Object obj)
Binds the object with the specified name to the name space such that
all intermediate subcontexts in the name are created if they do not already
exist.
|
|
recursiveBind(javax.naming.Context startingContext,java.lang.String name,java.lang.Object obj)
String form of the
recursiveBind(Context, Name, Object) method.
|
|
recursiveCreateSubcontext(javax.naming.Context startingContext,javax.naming.Name name)
Creates a subcontext with the specified name such that all intermediate
subcontexts in the name are created if they do not already exist.
|
|
recursiveCreateSubcontext(javax.naming.Context startingContext,java.lang.String name)
String form of the
recursiveCreateSubcontext(Context, Name) method.
|
|
recursiveRebind(javax.naming.Context startingContext,javax.naming.Name name,java.lang.Object obj)
Rebinds the object with the specified name to the name space such that
all intermediate subcontexts in the name are created if they do not already
exist.
|
|
recursiveRebind(javax.naming.Context startingContext,java.lang.String name,java.lang.Object obj)
String form of the
recursiveRebind(Context, Name, Object) method.
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail
JndiHelper
- protected JndiHelper()
Method Detail
recursiveCreateSubcontext
- public static javax.naming.Context recursiveCreateSubcontext( javax.naming.Context startingContext,
- java.lang.String name)
- throws javax.naming.NamingException
recursiveCreateSubcontext(Context, Name)
method.
startingContext
- The context to which the specified name is relative. name
- String form of the name of the context to create. javax.naming.NotContextException
- Some object other than a context is bound to the
name space with a name that conflicts with the specified name. javax.naming.NamingException
- A naming exception was encountered. recursiveCreateSubcontext
- public static javax.naming.Context recursiveCreateSubcontext( javax.naming.Context startingContext,
- javax.naming.Name name)
- throws javax.naming.NamingException
startingContext
- The context to which the specified name is relative. name
- The name of the context to create. javax.naming.NotContextException
- Some object other than a context is bound to the
name space with a name that conflicts with the specified name. javax.naming.NamingException
- A naming exception was encountered. batchCreateSubcontextsDriver
- protected static void batchCreateSubcontextsDriver( WsnBatchModeContext startingContext,
- javax.naming.Name name)
- throws javax.naming.NamingException
javax.naming.NamingException
createSubcontextsDriver
- protected static javax.naming.Context createSubcontextsDriver( javax.naming.Context startingContext,
- javax.naming.Name name)
- throws javax.naming.NamingException
javax.naming.NamingException
recursiveRebind
- public static void recursiveRebind( javax.naming.Context startingContext,
- java.lang.String name,
- java.lang.Object obj)
- throws javax.naming.NamingException
recursiveRebind(Context, Name, Object)
method.
startingContext
- The context to which the specified name is relative. name
- String form of the name of the object to rebind. obj
- The object to rebind. javax.naming.NotContextException
- Some object other than a context is bound to the
name space with a name that conflicts with the specified name. javax.naming.NamingException
- A naming exception was encountered. recursiveRebind
- public static void recursiveRebind( javax.naming.Context startingContext,
- javax.naming.Name name,
- java.lang.Object obj)
- throws javax.naming.NamingException
startingContext
- The context to which the specified name is relative. name
- Name of the object to rebind. obj
- The object to rebind. javax.naming.NotContextException
- Some object other than a context is bound to the
name space with a name that conflicts with the specified name. javax.naming.NamingException
- A naming exception was encountered. recursiveBind
- public static void recursiveBind( javax.naming.Context startingContext,
- java.lang.String name,
- java.lang.Object obj)
- throws javax.naming.NamingException
recursiveBind(Context, Name, Object)
method.
startingContext
- The context to which the specified name is relative. name
- String form of the name of the object to bind. obj
- The object to bind. javax.naming.NotContextException
- Some object other than a context is bound to the
name space with a name that conflicts with the specified name. javax.naming.NameAlreadyBoundException
- thrown if and only if the leaf name
corresponds to an already bound object. Not thrown if an intermediate
context is already bound. javax.naming.NamingException
- A naming exception was encountered. recursiveBind
- public static void recursiveBind( javax.naming.Context startingContext,
- javax.naming.Name name,
- java.lang.Object obj)
- throws javax.naming.NamingException
startingContext
- The context to which the specified name is relative. name
- Name
of the object to bind. obj
- The object to bind. javax.naming.NotContextException
- Some object other than a context is bound to the
name space with a name that conflicts with the specified name. javax.naming.NameAlreadyBoundException
- thrown if and only if the leaf name
corresponds to an already bound object. Not thrown if an intermediate
context is already bound. javax.naming.NamingException
- A naming exception was encountered. getSubcontextFromBatchResults
- protected static javax.naming.Context getSubcontextFromBatchResults( javax.naming.Context startingContext,
- java.util.Enumeration vEnum,
- int numCtx)
- throws javax.naming.NamingException
startingContext
- vEnum
- numCtx
- javax.naming.NamingException
normalizeHostname
- public static java.lang.String normalizeHostname( java.util.Hashtable env)
- throws javax.naming.NamingException
- com.ibm.websphere.naming.hostname.normalizer - contains the name of
the class to call for normalization. The class must implement the
HostnameNormalizer
interface. - com.ibm.websphere.naming.syntax - if set to "ins", the escapeDots
parameter of the HostnameNormalizer is set to
HostnameNormalizer.ESCAPE_DOTS_TRUE
.
Websphere supplies a DefaultHostnameNormalizer which operates as follows:
- attempts to get the fully qualified hostname
- converts hostname to lowercase
- if
HostnameNormalizer.ESCAPE_DOTS_TRUE
is passed, prepends all dots (".") with the escape character ("\"). This is necessary for INS syntax names. - if
HostnameNormalizer.ESCAPE_DOTS_FALSE
is passed, no special processing is done for dots
If your environment requires a different normalization algorithm, you can supply your
own implementation of the HostnameNormalizer interface. You will need to set
com.ibm.websphere.naming.hostname.normalizer to the name of your implementing
class. It is recommended that you do this in a jndi.properties file which is
in your classpath. For example set
com.ibm.websphere.naming.hostname.normalizer=com.mycompany.mySpecialHostnameNormalizer
Note that JndiHelper will cache the name of the hostname normalizer class during the first call to a normalizeHostname method, and will not examine the environment for this property on subsequent calls.
env
- Hashtable containing environment properties. If null, this method will
attempt to get an initial context and use its environment. javax.naming.NamingException
- Any exceptions from the HostnameNormalizer are
returned to the caller. normalizeHostname
- public static java.lang.String normalizeHostname( java.util.Hashtable env,
- java.lang.String hostname)
- throws javax.naming.NamingException
Please see normalizeHostname(Hashtable)
for additional details.
env
- Hashtable containing environment properties. If null, this method
will attempt to get an initial context and use its environment. hostname
- String containing the hostname to normalize. If null, a
NamingException is thrown. If the hostname is not a known host, a
NamingException is thrown with root cause of java.net.UnknownHostException. javax.naming.NamingException
- Any exceptions from the HostnameNormalizer are returned
to the caller. normalizeHostname
- public static java.lang.String normalizeHostname( java.util.Hashtable env,
- java.net.InetAddress ipAddress)
- throws javax.naming.NamingException
Please see normalizeHostname(Hashtable)
for additional details.
env
- Hashtable containing environment properties. If null, this method
will attempt to get an initial context and use its environment. ipAddress
- java.net.InetAddress representing the hostname to normalize.
If null, a NamingException is thrown. javax.naming.NamingException
- Any exceptions from the HostnameNormalizer are returned
to the caller.