< prev index next >
src/java.naming/share/classes/javax/naming/InitialContext.java
Print this page
*** 47,63 ****
* <ol>
* <li>
* The first occurrence of the property from the constructor's
* environment parameter and system properties.
* <li>
! * The application resource files (<tt>jndi.properties</tt>).
* </ol>
* For each property found in both of these two sources, or in
* more than one application resource file, the property's value
* is determined as follows. If the property is
* one of the standard JNDI properties that specify a list of JNDI
! * factories (see <a href=Context.html#LISTPROPS><tt>Context</tt></a>),
* all of the values are
* concatenated into a single colon-separated list. For other
* properties, only the first value found is used.
*
*<p>
--- 47,63 ----
* <ol>
* <li>
* The first occurrence of the property from the constructor's
* environment parameter and system properties.
* <li>
! * The application resource files ({@code jndi.properties}).
* </ol>
* For each property found in both of these two sources, or in
* more than one application resource file, the property's value
* is determined as follows. If the property is
* one of the standard JNDI properties that specify a list of JNDI
! * factories (see <a href=Context.html#LISTPROPS>{@code Context}</a>),
* all of the values are
* concatenated into a single colon-separated list. For other
* properties, only the first value found is used.
*
*<p>
*** 66,92 ****
* "{@link Context#INITIAL_CONTEXT_FACTORY java.naming.factory.initial}",
* which contains the class name of the initial context factory.
* An exception to this policy is made when resolving URL strings, as described
* below.
*<p>
! * When a URL string (a <tt>String</tt> of the form
* <em>scheme_id:rest_of_name</em>) is passed as a name parameter to
* any method, a URL context factory for handling that scheme is
* located and used to resolve the URL. If no such factory is found,
* the initial context specified by
! * <tt>"java.naming.factory.initial"</tt> is used. Similarly, when a
! * <tt>CompositeName</tt> object whose first component is a URL string is
* passed as a name parameter to any method, a URL context factory is
* located and used to resolve the first name component.
* See {@link NamingManager#getURLContext
! * <tt>NamingManager.getURLContext()</tt>} for a description of how URL
* context factories are located.
*<p>
* This default policy of locating the initial context and URL context
* factories may be overridden
* by calling
! * <tt>NamingManager.setInitialContextFactoryBuilder()</tt>.
*<p>
* NoInitialContextException is thrown when an initial context cannot
* be instantiated. This exception can be thrown during any interaction
* with the InitialContext, not only when the InitialContext is constructed.
* For example, the implementation of the initial context might lazily
--- 66,92 ----
* "{@link Context#INITIAL_CONTEXT_FACTORY java.naming.factory.initial}",
* which contains the class name of the initial context factory.
* An exception to this policy is made when resolving URL strings, as described
* below.
*<p>
! * When a URL string (a {@code String} of the form
* <em>scheme_id:rest_of_name</em>) is passed as a name parameter to
* any method, a URL context factory for handling that scheme is
* located and used to resolve the URL. If no such factory is found,
* the initial context specified by
! * {@code "java.naming.factory.initial"} is used. Similarly, when a
! * {@code CompositeName} object whose first component is a URL string is
* passed as a name parameter to any method, a URL context factory is
* located and used to resolve the first name component.
* See {@link NamingManager#getURLContext
! * NamingManager.getURLContext()} for a description of how URL
* context factories are located.
*<p>
* This default policy of locating the initial context and URL context
* factories may be overridden
* by calling
! * {@code NamingManager.setInitialContextFactoryBuilder()}.
*<p>
* NoInitialContextException is thrown when an initial context cannot
* be instantiated. This exception can be thrown during any interaction
* with the InitialContext, not only when the InitialContext is constructed.
* For example, the implementation of the initial context might lazily
*** 123,133 ****
public class InitialContext implements Context {
/**
* The environment associated with this InitialContext.
* It is initialized to null and is updated by the constructor
! * that accepts an environment or by the <tt>init()</tt> method.
* @see #addToEnvironment
* @see #removeFromEnvironment
* @see #getEnvironment
*/
protected Hashtable<Object,Object> myProps = null;
--- 123,133 ----
public class InitialContext implements Context {
/**
* The environment associated with this InitialContext.
* It is initialized to null and is updated by the constructor
! * that accepts an environment or by the {@code init()} method.
* @see #addToEnvironment
* @see #removeFromEnvironment
* @see #getEnvironment
*/
protected Hashtable<Object,Object> myProps = null;
*** 150,167 ****
/**
* Constructs an initial context with the option of not
* initializing it. This may be used by a constructor in
* a subclass when the value of the environment parameter
! * is not yet known at the time the <tt>InitialContext</tt>
* constructor is called. The subclass's constructor will
* call this constructor, compute the value of the environment,
! * and then call <tt>init()</tt> before returning.
*
* @param lazy
* true means do not initialize the initial context; false
! * is equivalent to calling <tt>new InitialContext()</tt>
* @throws NamingException if a naming exception is encountered
*
* @see #init(Hashtable)
* @since 1.3
*/
--- 150,167 ----
/**
* Constructs an initial context with the option of not
* initializing it. This may be used by a constructor in
* a subclass when the value of the environment parameter
! * is not yet known at the time the {@code InitialContext}
* constructor is called. The subclass's constructor will
* call this constructor, compute the value of the environment,
! * and then call {@code init()} before returning.
*
* @param lazy
* true means do not initialize the initial context; false
! * is equivalent to calling {@code new InitialContext()}
* @throws NamingException if a naming exception is encountered
*
* @see #init(Hashtable)
* @since 1.3
*/
*** 172,182 ****
}
/**
* Constructs an initial context.
* No environment properties are supplied.
! * Equivalent to <tt>new InitialContext(null)</tt>.
*
* @throws NamingException if a naming exception is encountered
*
* @see #InitialContext(Hashtable)
*/
--- 172,182 ----
}
/**
* Constructs an initial context.
* No environment properties are supplied.
! * Equivalent to {@code new InitialContext(null)}.
*
* @throws NamingException if a naming exception is encountered
*
* @see #InitialContext(Hashtable)
*/
*** 186,199 ****
/**
* Constructs an initial context using the supplied environment.
* Environment properties are discussed in the class description.
*
! * <p> This constructor will not modify <tt>environment</tt>
* or save a reference to it, but may save a clone.
* Caller should not modify mutable keys and values in
! * <tt>environment</tt> after it has been passed to the constructor.
*
* @param environment
* environment used to create the initial context.
* Null indicates an empty environment.
*
--- 186,199 ----
/**
* Constructs an initial context using the supplied environment.
* Environment properties are discussed in the class description.
*
! * <p> This constructor will not modify {@code environment}
* or save a reference to it, but may save a clone.
* Caller should not modify mutable keys and values in
! * {@code environment} after it has been passed to the constructor.
*
* @param environment
* environment used to create the initial context.
* Null indicates an empty environment.
*
*** 210,220 ****
/**
* Initializes the initial context using the supplied environment.
* Environment properties are discussed in the class description.
*
! * <p> This method will modify <tt>environment</tt> and save
* a reference to it. The caller may no longer modify it.
*
* @param environment
* environment used to create the initial context.
* Null indicates an empty environment.
--- 210,220 ----
/**
* Initializes the initial context using the supplied environment.
* Environment properties are discussed in the class description.
*
! * <p> This method will modify {@code environment} and save
* a reference to it. The caller may no longer modify it.
*
* @param environment
* environment used to create the initial context.
* Null indicates an empty environment.
*** 243,261 ****
* <p>
* <code>
* InitialContext ic = new InitialContext();
* Object obj = ic.lookup();
* </code>
! * <p> If <tt>name</tt> is empty, returns a new instance of this context
* (which represents the same naming context as this context, but its
* environment may be modified independently and it may be accessed
* concurrently).
*
* @param <T> the type of the returned object
* @param name
* the name of the object to look up
! * @return the object bound to <tt>name</tt>
* @throws NamingException if a naming exception is encountered
*
* @see #doLookup(String)
* @see #lookup(Name)
* @since 1.6
--- 243,261 ----
* <p>
* <code>
* InitialContext ic = new InitialContext();
* Object obj = ic.lookup();
* </code>
! * <p> If {@code name} is empty, returns a new instance of this context
* (which represents the same naming context as this context, but its
* environment may be modified independently and it may be accessed
* concurrently).
*
* @param <T> the type of the returned object
* @param name
* the name of the object to look up
! * @return the object bound to {@code name}
* @throws NamingException if a naming exception is encountered
*
* @see #doLookup(String)
* @see #lookup(Name)
* @since 1.6
*** 270,280 ****
* A static method to retrieve the named object.
* See {@link #doLookup(Name)} for details.
* @param <T> the type of the returned object
* @param name
* the name of the object to look up
! * @return the object bound to <tt>name</tt>
* @throws NamingException if a naming exception is encountered
* @since 1.6
*/
@SuppressWarnings("unchecked")
public static <T> T doLookup(String name)
--- 270,280 ----
* A static method to retrieve the named object.
* See {@link #doLookup(Name)} for details.
* @param <T> the type of the returned object
* @param name
* the name of the object to look up
! * @return the object bound to {@code name}
* @throws NamingException if a naming exception is encountered
* @since 1.6
*/
@SuppressWarnings("unchecked")
public static <T> T doLookup(String name)
*** 504,514 ****
/**
* Composes the name of this context with a name relative to
* this context.
* Since an initial context may never be named relative
* to any context other than itself, the value of the
! * <tt>prefix</tt> parameter must be an empty name (<tt>""</tt>).
*/
public String composeName(String name, String prefix)
throws NamingException {
return name;
}
--- 504,514 ----
/**
* Composes the name of this context with a name relative to
* this context.
* Since an initial context may never be named relative
* to any context other than itself, the value of the
! * {@code prefix} parameter must be an empty name ({@code ""}).
*/
public String composeName(String name, String prefix)
throws NamingException {
return name;
}
*** 516,526 ****
/**
* Composes the name of this context with a name relative to
* this context.
* Since an initial context may never be named relative
* to any context other than itself, the value of the
! * <tt>prefix</tt> parameter must be an empty name.
*/
public Name composeName(Name name, Name prefix)
throws NamingException
{
return (Name)name.clone();
--- 516,526 ----
/**
* Composes the name of this context with a name relative to
* this context.
* Since an initial context may never be named relative
* to any context other than itself, the value of the
! * {@code prefix} parameter must be an empty name.
*/
public Name composeName(Name name, Name prefix)
throws NamingException
{
return (Name)name.clone();
< prev index next >