Environment Properties

 


Overview

The JNDI is a generic interface. To access any naming/directory service, specify the service provider to use. This is but one piece of configuration information. Depending on the naming/directory service and the service provider, you might need to specify other configuration information, for example telling the service provider which server to use. You specify configuration information in the JNDI by using environment properties. Although this section describes many environment properties, in general you need to specify only a few properties.

Following are the different types of environment properties, categorized by their scope and applicability:

 

 

Standard JNDI Environment Properties

The JNDI defines environment properties that are standard across all service providers. Not all standard environment properties are applicable to all service providers. But when a service provider does use one of these properties, it must interpret the property according to the definition specified by the JNDI.

These properties have the prefix "java.naming." The Context and LdapContext interfaces declare constants for these properties. Here is a list of the standard JNDI environment properties.

Property Name Description
java.naming.applet
An instance of java.applet.Applet. The applet parameters of this applet instance are used to obtain certain environment properties. See the next section for details.
Constant: Context.APPLET
Default: None.
java.naming.authoritative A string ("true" or "false") that specifies the authoritative source of the service requested. If you set this property to "true", then you are asking the service provider to use the most authoritative source for the service (such as a master server). Otherwise the source need not be (but can be) authoritative.
Constant: Context.AUTHORITATIVE
Default: "false"
java.naming.batchsize The string representation of an integer that specifies the preferred batch size to use when returning data via the service's protocol. See the Searches lesson for details and an example.
Constant:
Context.BATCHSIZE
Default: Provider's default.
Example: "10"
java.naming.dns.url A URL string that specifies the DNS host and domain names to use for the "jndi" URL context implementation.
Constant: Context.DNS_URL
Default: None.
Example: "dns://dnsserver/wiz.com"
java.naming.factory.control Colon-separated list of class names of control factories. Each class must implement the ControlFactory interface. This property is used by ControlFactory.getControlInstance() , which in turn is used by service providers. See the Controls and Extensions lesson for details.
Constant: LdapContext.CONTROL_FACTORIES
Default: The empty list.
Example: "com.wiz.jndi.ldap.ControlFactory:vendorX.ldap.VendorXControlFactory"
java.naming.factory.initial Class name of the initial context factory. Class must implement the InitialContextFactory interface. This class is instantiated by the InitialContext constructor. You must set this property, unless you pass only URL names to the InitialContext methods.
Constant: Context.INITIAL_CONTEXT_FACTORY
Default: None.
Example: "com.sun.jndi.ldap.LdapCtxFactory"
java.naming.factory.object Colon-separated list of class names of object factories. Each class must implement the ObjectFactory or DirObjectFactory interface. This property is used by NamingManager.getObjectInstance() and DirectoryManager.getObjectInstance() , which in turn are used by service providers. See the Java Objects and the Directory trail for details.
Constant: Context.OBJECT_FACTORIES
Default: The empty list.
Example: "com.wiz.jndi.ldap.AttrsToRemote:com.wiz.jndi.ldap.AttrsToCorba"
java.naming.factory.state Colon-separated list of class names of state factories. Each class must implement the StateFactory or DirStateFactory interface. This property is used by NamingManager.getStateToBind() and DirectoryManager.getStateToBind() , which in turn are used by service providers. See the Java Objects and the Directory trail for details.
Constant: Context.STATE_FACTORIES
Default: The empty list.
Example: "com.wiz.jndi.ldap.RemoteToAttrs:com.wiz.jndi.ldap.CorbaToAttrs"
java.naming.factory.url.pkgs Colon-separated list of package prefixes of URL context factories. The prefix consists of the URL scheme id and a suffix to construct the class name, as follows:
prefix.schemeId.schemeIdURLContextFactory
For example, suppose the prefix is "vendorZ.jndi" and the URL scheme id is "ldap", the complete class name is vendorZ.jndi.ldap.ldapURLContextFactory. Each class whose name is constructed in this manner must implement the ObjectFactory or DirObjectFactory interface and follow the rules for processing URL names. The package prefix "com.sun.jndi.url" is always appended to the end of the list specified by this property. This property is used when a URL name is passed to the InitialContext methods. See the URL lesson for more information.
Constant: Context.URL_PKG_PREFIXES
Default: The empty list.
Example: com.wiz.jndi.url:vendorZ.jndi
java.naming.language A string specifying the preferred language to use with this service. The values of this property are defined by RFC 1766.
Constant: Context.LANGUAGE
Default: Provider's default.
Example: "en-US"
java.naming.provider.url A URL string for configuring the service provider specified by the "java.naming.factory.initial" property.
Constant: Context.PROVIDER_URL
Default: Provider's default.
Example: "ldap://localhost:389/o=JNDIDocs"
java.naming.referral A string specifying how the service provider should handle referrals; one of "throw", "ignore", or "follow". See the Referrals lesson for details and examples.
Constant: Context.REFERRAL
Default: Provider's default.
Example: "throw"
java.naming.security.authentication A string specifying the type of authentication to use; one of "none", "simple", "strong", or a provider-specific string. See the Security lesson for details and examples.
Constant: Context.SECURITY_AUTHENTICATION
Default: Provider's default.
Example: "simple"
java.naming.security.credentials An object specifying the credentials of the entity performing the authentication. Its type is determined by the service provider. See the Security lesson for details and examples.
Constant: Context.SECURITY_CREDENTIALS
Default: Provider's default.
Example: A char[] containing "secret."
java.naming.security.principal A string that specifies the identity of the entity performing the authentication. See the Security lesson for details and examples.
Constant: Context.SECURITY_PRINCIPAL
Default: Provider's default.
Example: "cn=Directory Manager, o=JNDIDocs"
java.naming.security.protocol A string specifying the security protocol to use. See the Security lesson for details and an example.
Constant:
Context.SECURITY_PROTOCOL
Default: Provider's default.
Example: "ssl"

 

 

Service-Specific Environment Properties

Service-specific environment properties are common across all service providers that implement a particular service or protocol. For example, several different service providers might implement the LDAP. These providers would use LDAP-specific environment properties.

Service-specific properties have the prefix "java.naming.service." For example, the LDAP-specific properties have the prefix "java.naming.ldap." and the CORBA-specific properties have the prefix "java.naming.corba." Note that these are JNDI-related environment properties used by the JNDI service providers. A service or subsystem such as CORBA or the RMI might define other properties unrelated to the JNDI. See the Miscellaneous lesson for examples of LDAP-specific environment properties.

 

 

Feature-Specific Environment Properties

Feature-specific environment properties are common across all service providers that implement a particular feature. For example, the LDAP service provider and a VendorX service provider might both use the SASL for authentication. These providers would then use SASL-specific environment properties when configuring that feature.

Feature-specific properties have the prefix "java.naming.feature." For example, the SASL-specific properties have the prefix "java.naming.security.sasl." Note that these are JNDI-related environment properties used by the JNDI service providers. A feature or subsystem such as the SASL might define other properties unrelated to the JNDI. See the Security lesson for some examples of SASL-specific properties.

 

 

Provider-Specific Environment Properties

Provider-specific environment properties are properties used by only one service provider. For example, Sun's LDAP service provider has a property for turning on tracing. (See the example in the Frequently Asked Questions lesson.) A provider-specific property should have a prefix that reflects its uniqueness, commonly the package name of the service provider. For example, the Sun LDAP provider's trace property is named "com.sun.jndi.ldap.trace.ber".