All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----javax.naming.spi.NamingManager
The mention of URL in the documentation for this class refers to a URL string as defined by RFC 1738 and its related RFCs. It is any string that conforms to the syntax described therein, and may not always have corresponding support in the java.net.URL class or Web browsers.
NamingManager is safe for concurrent access by multiple threads.
public static synchronized void setObjectFactoryBuilder(ObjectFactoryBuilder builder) throws NamingException
setObjectFactoryBuilder() overrides this policy by installing its own ObjectFactoryBuilder. Subsequent object factories will be loaded and created using the installed builder.
The builder can only be installed if the executing thread is allowed by the security manager to do so. Once installed, the builder cannot be replaced.
public static synchronized Object getObjectInstance(Object refInfo, Name name, Context nameCtx, Hashtable environment) throws Exception
If an object factory builder has been installed, use it to create a factory for creating the object. Otherwise, the following rules are used to create the object:
refInfo
is a Reference
or Referenceable
, use information
in the reference to create a factory for creating the object
and return the object. If a factory cannot be created,
return refInfo
.
Note that in order for classes to be loaded from the URL
specified in the reference, a SecurityManager
must have
been installed. If there is no SecurityManager
installed,
the classes will not be loaded.
refInfo
is a URL string, or an array of URL strings,
use the URL context factory corresponding to the URL's scheme id to
create the object (see getURLContext()).
If that fails, continue to step 3.
refInfo
.
The name
and nameCtx
parameters may
optionally be used to specify the name of the object being created.
name
is the name of the object, relative to context
nameCtx
. This information could be useful to the object
factory or to the object implementation.
If there are several possible contexts from which the object
could be named -- as will often be the case -- it is up to
the caller to select one. A good rule of thumb is to select the
"deepest" context available.
If nameCtx
is null, name
is relative
to the default initial context. If no name is being specified, the
name
parameter should be null.
nameCtx
.
Specifying a name is optional; if it is
omitted, name
should be null.
name
parameter is specified. If null, name
is
relative to the default initial context.
refInfo
; or
refInfo
if an object cannot be created using
the algorithm described above.
public static Context getURLContext(String scheme, Hashtable environment) throws NamingException
The resulting context is for resolving URLs of the
scheme scheme
. The resulting context is not tied
to a specific URL. It is able to handle arbitrary URLs with
the specified scheme.
The class name of the factory that creates the resulting context has the naming convention scheme-idURLContextFactory (e.g. "ftpURLContextFactory" for the "ftp" scheme-id), in the package specified as follows. The java.naming.factory.url.pkgs environment or system property contains a colon-separated list of package prefixes. If both properties exist, the environment property takes precedence. Each package prefix in the property is tried in the order specified to load the factory class. The default package prefix is "com.sun.jndi.url" (if none of the specified packages work, this default is tried). The complete package name is constructed using the package prefix, concatenated with the scheme id.
For example, if the scheme id is "ldap", and the java.naming.factory.url.pkgs property contains "com.widget:com.wiz.jndi", the naming manager would attempt to load the following classes until one is successfully instantiated:
If a factory is instantiated, it is invoked with the following parameters to produce the resulting context.
factory.getObjectInstance(null, environment);
For example, invoking getObjectInstance() as shown above on a LDAP URL context factory would return a context that can resolve LDAP urls (e.g. "ldap://ldap.wiz.com/o=wiz,c=us", "ldap://ldap.umich.edu/o=umich,c=us", ...).
scheme
;
null
if the factory for creating the
context is not found.
public static synchronized Context getInitialContext(Hashtable environment) throws NamingException
If an InitialContextFactoryBuilder has been installed, it is used to create the factory for creating the initial context. Otherwise, the class specified in the java.naming.factory.initial system or environment property is used. If both properties exist, the environment property takes precedence.
public static synchronized void setInitialContextFactoryBuilder(InitialContextFactoryBuilder builder) throws NamingException
The builder can only be installed if the executing thread is allowed by the security manager to do so. Once installed, the builder cannot be replaced.
public static synchronized boolean hasInitialContextFactoryBuilder()
public static Context getContinuationContext(CannotProceedException cpe) throws NamingException
All Packages Class Hierarchy This Package Previous Next Index