javax.naming.spi
Class NamingManager
Contains methods for creating contexts and objects referred to by
location information. The location is specified in the scope of the
certain naming or directory service. This class only contais static
methods and cannot be instantiated.
static String | CPE - The environment property into which getContinuationContext() stores the
value of the CannotProceedException parameter.
|
static Context | getContinuationContext(CannotProceedException cpe) - Creates a context in which the context operation must be continued.
|
static Context | getInitialContext(Hashtable , ?> environment) - Creates the initial context.
|
static Object | getObjectInstance(Object refInfo, Name name, Context nameCtx, Hashtable , ?> environment) - Creates an object for the specified name context, environment and
referencing context object.
If the builder factory is set by
setObjectFactoryBuilder(ObjectFactoryBuilder) , the call is
delegated to that factory.
|
static Object | getStateToBind(Object obj, Name name, Context nameCtx, Hashtable , ?> environment) - Get the object state for binding.
|
static Context | getURLContext(String scheme, Hashtable , ?> environment) -
Creates the URL context for the given URL scheme id.
|
static boolean | hasInitialContextFactoryBuilder() - Checks if the initial context factory builder has been set.
|
static void | setInitialContextFactoryBuilder(InitialContextFactoryBuilder builder) - Sets the initial context factory builder.
|
static void | setObjectFactoryBuilder(ObjectFactoryBuilder builder) - Sets the initial object factory builder.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
CPE
public static final String CPE
The environment property into which getContinuationContext() stores the
value of the CannotProceedException parameter. The value of this field
is java.naming.spi.CannotProceedException.
- "java.naming.spi.CannotProceedException"
getContinuationContext
public static Context getContinuationContext(CannotProceedException cpe)
throws NamingException
Creates a context in which the context operation must be continued.
This method is used by operations on names that span multiple namespaces.
cpe
- the exception that triggered this continuation. This method
obtains the environment (CannotProceedException.getEnvironment()
and sets the environment property CPE
= cpe.
- a non null context for continuing the operation
getInitialContext
public static Context getInitialContext(Hashtable ,
?> environment)
throws NamingException
Creates the initial context. If the initial object factory builder has
been set with
setObjectFactoryBuilder(ObjectFactoryBuilder)
,
the work is delegated to this builder. Otherwise, the method searches
for the property Context.INITIAL_CONTEXT_FACTORY first in the passed
table and then in the system properties. The value of this property is
uses as a class name to install the context factory. The corresponding
class must exist, be public and have the public parameterless constructor.
environment
- the properties, used to create the context.
getObjectInstance
public static Object getObjectInstance(Object refInfo,
Name name,
Context nameCtx,
Hashtable ,
?> environment)
throws Exception
Creates an object for the specified name context, environment and
referencing context object.
If the builder factory is set by
setObjectFactoryBuilder(ObjectFactoryBuilder)
, the call is
delegated to that factory. Otherwise, the object is created using the
following rules:
- If the referencing object (refInfo) contains the factory class name,
the object is created by this factory. If the creation fails,
the parameter refInfo is returned as the method return value.
- If the referencing object has no factory class name, and the addresses
are StringRefAddrs having the address type "URL", the object is
created by the URL context factory. The used factory corresponds the
the naming schema of the each URL. If the attempt to create
the object this way is not successful, the subsequent rule is
tried.
- If the refInfo is not an instance of Reference or Referencable
(for example, null), the object is created by the factories,
specified in the Context.OBJECT_FACTORIES property of the
environment and the provider resource file, associated with the
nameCtx. The value of this property is the colon separated list
of the possible factories. If none of the factories can be
loaded, the refInfo is returned.
The object factory must be public and have the public parameterless
constructor.
refInfo
- the referencing object, for which the new object must be
created (can be null). If not null, it is usually an instance of
the Reference
or Referenceable
.name
- the name of the object. The name is relative to
the nameCtx naming context. The value of this parameter can be
null if the name is not specified.nameCtx
- the naming context, in which scope the name of the new
object is specified. If this parameter is null, the name is
specified in the scope of the initial context.environment
- contains additional information for creating the object.
This paramter can be null if there is no need to provide any
additional information.
- the created object. If the creation fails, in some cases
the parameter refInfo may be returned.
Exception
- if the object factory throws it. The object factory
only throws an exception if it does not want other factories
to be used to create the object.
getStateToBind
public static Object getStateToBind(Object obj,
Name name,
Context nameCtx,
Hashtable ,
?> environment)
throws NamingException
Get the object state for binding.
obj
- the object, for that the binding state must be retrieved. Cannot
be null.name
- the name of this object, related to the nameCtx. Can be null if
not specified.nameCtx
- the naming context, to that the object name is related. Can
be null if the name is related to the initial default context.environment
- the properties for creating the object state. Can be
null if no properties are provided.
- the object state for binding, may be null if no changes are
returned by the factory
getURLContext
public static Context getURLContext(String scheme,
Hashtable ,
?> environment)
throws NamingException
Creates the URL context for the given URL scheme id.
The class name of the factory that creates the context has the naming
pattern scheme-idURLContextFactory. For instance, the factory for the
"ftp" scheme should be named "ftpURLContextFactory".
The Context.URL_PKG_PREFIXES environment property contains the
colon-separated list of the possible package prefixes. The package name
is constructed by concatenating the package prefix with the scheme id.
If the factory class cannot be found in the specified packages, the
system will try to use the default internal factory for the given scheme.
After the factory is instantiated, its method
ObjectFactory.getObjectInstance(Object, Name, Context, Hashtable)
is called to create and return the object instance.
scheme
- the url scheme that must be supported by the given contextenvironment
- the properties for creating the factory and context
(may be null)
hasInitialContextFactoryBuilder
public static boolean hasInitialContextFactoryBuilder()
Checks if the initial context factory builder has been set.
- true if the builder has been set
NamingManager.java -- Creates contexts and objects
Copyright (C) 2000, 2001, 2002, 2003, 2004,
2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.