This property is used to select the COS naming service provider; it's
not actually used by the provider itself. It specifies the class name
of the initial context factory for the provider.
This property must be set if you are using the
COS naming service as the initial context. The only exception is
if you supply only URLs to the initial context, in which case,
you don't need to specify this property. See
Names and URLs for details.
If the URL scheme is either "iiop" or "iiopname", then the host and
port fields of the URL are used to initialize the ORB. An
"iiopname" URL must conform to the now obsolete
INS
specification (98-10-11).
It has the form:
iiopname://[<addr_list>][/<cosnaming_name>]
The "iiop" URL scheme is supported for backward compatibility
with an older version
of the INS specification. It has the form:
iiop://[<host>[:<port>]][/<cosnaming_name>]
For both "iiop" and "iiopname" URLs, if <host> is not specified,
then it defaults to "localhost" for an application and the applet's host for
an applet. If <port> is not specified, then it defaults to 9999
for "iiopname",
and 900 for "iiop". The root naming context is obtained by invoking the
following method on the ORB:
orb.resolve_initial_references("NameService");
If <cosnaming_name> is nonempty, then
the root naming context is the
naming context named by cosnaming_name.
If the URL scheme is not one of "iiop", "iiopname", "IOR", "corbaname",
or "corbaloc", then the URL must name a location that contains the stringified
IOR of the root naming context.
For example, if the property contains "file:/nsdir/ior", then the file
/nsdir/ior must contain a stringified IOR. The URL scheme can be any
for which there is a corresponding URL protocol handler (
java.net.URLStreamHandler
). See the
java.net.URL class for details.
The stringified IOR is read from the data stream corresponding to the
URL by using a character encoding of ISO Latin-1. The stringified IOR
is the first line in the stream that contains the prefix "IOR:". For
example, if the URL scheme is "http", then the headers in the stream are
skipped and the first line that contains the prefix "IOR:" is returned as
the IOR.
This property specifies the ORB that the program is using.
When the JNDI COS naming service provider needs to use an ORB, for
example, to look up the "NameService" initial reference or to
turn a stringified IOR into an object reference, it will use
this ORB.
In an application you can set this property as follows:
This property specifies the applet that the program
is using. It is used to initialize the ORB to be used by the
COS naming service provider. Its parameters are used for setting
JNDI-related properties; see the
JNDI documentation
for details.
public class MyApplet extends Applet {
public someInitMethod() {
Hashtable env = new Hashtable(5, 0.75f);
env.put("java.naming.applet", this);
...
}
...
}
java.naming.factory.state
A colon-separated list of the fully qualified class names
of state factory classes used to get an object's state for storing
given the object itself. You can use this mechanism to transform
an object into forms that can be stored into a COS name server.
The COS name server supports storing CORBA objects.
A state factory that transforms a java.rmi.Remote into
a CORBA object is supplied by default. This factory
is useful for applications that use
RMI-IIOP.
You can supply other factories to affect the transformation of other objects
into CORBA objects for storing.
See
javax.naming.spi.NamingManager.getStateToBind() for details.
java.naming.factory.object
A colon-separated list of the fully qualified class names
of object factory classes for transforming a CORBA object.
You can use this mechanism to transform an object into forms expected
by the application. For example, a specialized object factory could
do the appropriate narrowing to return an object of the expected type. See
javax.naming.spi.NamingManager.getObjectInstance() for details.
java.naming.batchsize
Specifies the batch size to use in
CosNaming::BindingIterator.next_n
when getting the results of a list()/listBindings().
The default is "100."
For example, the following sets the batch size to be 24.
You can specify CORBA related properties such as those with the
"org.omg.CORBA." prefix as properties. Properties
of type String are used to initialize the ORB.
The root naming context is initialized either using the
java.naming.provider.url property or by a
resolve_initial_references()
call on the ORB. If the java.naming.provider.url property is set
but contains neither an "iiop" or "iiopname" URL, then it is assumed to contain
a stringified IOR, a "corbaname" or "corbaloc" URL of an IOR,
or a URL containing the location of a stringified
IOR. The IOR is used to obtain the root naming context and must
be that of a CORBA object of type
CosNaming::NamingContext.
If the java.naming.provider.url has not been set,
then the root naming context is
obtained by invoking the following method on the ORB:
A CosNaming::Name
contains a sequence of CosNaming::NameComponent. The stringified
form of a component is the concatenation of the component's id, the kind
separator character ('.'), and the component's kind. The occurrence of
any meta characters ('.', '/', or '\') in either the id or kind is escaped
using the escape character ('\').
The stringified form of a CosNaming::Name is defined in Section
3.5 of the INS
specification (99-12-03).
The
JNDI composite name syntax
is very similar to, but not identical
to, the INS syntax. There are minor differences with respect to the
treatment of escape and quote characters. If you want to use names
with the precise INS syntax, then you should use the overloads that accept a
Name argument instead of a String argument. The
Name argument should be a value returned by
nameParser.parse(), where nameParser is a value obtained
from the COS naming service provider. See the Name
Parsing section.
URL String Names
The URL form of a CosNaming::Name is defined in the INS
specification.
and <obj_addr_list> is a list of addresses as defined in a
"corbaloc" URL and <key_string> is a key string as defined
in a "corbaloc" URL.
<cosnaming_name>
is the stringified form of an INS name (see
Name Parsing).
For backward compatibility with older versions of the INS, the following
URL schemes are also supported.
iiopname://[<addr_list>][/<cosnaming_name>]
where <addr_list> specifies a list of host/port pairs.
If <port> is not specified,
then it defaults to 9999. <cosnaming_name>
is the stringified form of an INS name.
iiop://<host>[:<port>][/<cosnaming_name>]
If <port>
is not supplied, then it defaults to 900. <cosnaming_name>
is the stringified form of an INS name.
When you supply an "iiop" or "iiopname" URL to the initial context in this way,
the ORB supplied to the initial context is used
if its string_to_object() method supports the
99-12-03 INS specification.
Otherwise, the ORB is ignored and the server and port designations in
the URL are used to create an ORB.
The value of the java.naming.factory.initial
property is ignored for the purposes of resolving the URL.
Note that this rule is not used
when you supply a "corbaname" URL to the initial context.
For a "corbaname" URL, the ORB supplied to the initial context is used
because the ORB is needed to resolve the "corbaname" URL.
Name Objects
The Name argument to a Context method is treated as a
sequence of strings, each representing a stringified
CosNaming::NameComponent.
The COS naming service provider supports names in the syntax specified
in the INS specification. In short, the syntax is that components are
left-to-right slash ('/') separated and case-sensitive. The id and
kind of each component are separated by the period character ('.').
Here is a code fragment that uses the name parser from the COS naming
service provider to eventually do a lookup using an INS name.
String insName = ...;
InitialContext ctx = new InitialContext(env); // env contains init properties
NameParser parser = ctx.getNameParser(""); // parser for INS names
Name name = parser.parse(insName); // get parsed INS name
Object obj = ctx.lookup(name); // do lookup