Sun Java Solaris Communities My SDN Account Join SDN
 
Documentation

JNDI 1.2 Compatibility with JNDI 1.1

 

Contents

Binary Compatibility

API Users

The JNDI 1.2 API is upwards binary-compatible with JNDI 1.1 except for the incompatibilities listed below. This means that, except for the noted incompatibilities, class files of programs written to use the JNDI APIs in 1.1, and which were compiled against JNDI 1.1 will run correctly in 1.2.

The JNDI 1.2 API is downward binary-compatible with JNDI 1.1 as long as the program does not use any APIs introduced in JNDI 1.2. This means that, except for the noted incompatibilities, class files of programs written to use the 1.1 subset, and compiled against JNDI 1.2 will run correctly in JNDI 1.1.

Service Providers

The JNDI 1.2 SPI is not upwards binary-compatible with JNDI 1.1. This means that you cannot use a JNDI 1.1 service provider with the JNDI 1.2 packages.

The JNDI 1.2 SPI is downward binary-compatible with JNDI 1.1 as long as the service provider does not use any 1.2-specific methods/classes. This means that you can use a JNDI 1.2 service provider with JNDI 1.1 as long as the service provider does not use the 1.2-specific features.

See the incompatibilities listed below.

Source Compatibility

API Users

The JNDI 1.2 API is upwards source-compatible with JNDI 1.1, except for the incompatibilities listed below. This means that, except for the noted incompatibilities, source files of programs written to use the JNDI APIs in 1.1 can be compiled and run in version 1.2.

Downward source compatibility is not supported. If programs use new 1.2 APIs, they will neither compile nor run with JNDI 1.1.

Service Providers

The JNDI 1.2 SPI is not upwards source-compatible with JNDI 1.1. This means that source files of service providers written to use the JNDI 1.1 cannot be compiled with version 1.2 without changes.

Downward source compatibility is not supported.

Incompatibilities

The following is intended to be a complete list of all cases in which a program that works under in JNDI 1.1 would fail to work under 1.2. If you know of other incompatibilities, please notify us (at jndi@java.sun.com).

API Incompatibilities

  1. Use of Name argument to Context and DirContext methods
    In JNDI 1.1, the methods in Context and DirContext have overloaded forms that accept either a String name or a structured name (Name). There is documentation to the effect that both forms treat the name argument as composite names. In JNDI 1.2, if the Name argument is an instance of CompositeName, then it will be treated as a composite name. Otherwise, it will be treated as a compound name that is implemented by the CompoundName class or some other compound name implementation. If you were to pass a non-CompositeName instance to these methods in JNDI 1.1, it would be treated either as a composite name, or an InvalidNameException is thrown. In JNDI 1.2, any non-CompositeName argument is treated as a compound name.
  2. Schema Class Definition
    In JNDI 1.1, DirContext.getSchemaClassDefinition() returns the directory object's class definition in the schema. In JNDI 1.2, this method returns a context containing all of the directory object's object class definitions.
  3. BasicAttributes
    The hashCode and equals() methods of BasicAttributes have been implemented in JNDI 1.2 to take into account the attributes it contains. In JNDI 1.1, these methods inherit their implementations from java.lang.Object.

Service Provider Incompatibilities

Service providers are affected by the API incompatibilities noted above, and the following additional items:

  1. NamingEnumeration has a new method, close(). 1.2 service providers must implement this method for their NamingEnumeration implementations.
  2. Context has a new method, getNameInNamespace(). 1.2 service providers must implement this method for their Context implementations.
  3. Attribute has new methods for supporting ordered attributes:
    • boolean isOrdered()
    • Object get(int)
    • Object remove(int)
    • void add(int, Object)
    • Object set(int, Object)
    1.2 service providers that define implementations of Attribute must implement these new methods.
  4. The NamingManager.getObjectInstance() and DirectoryManager.getObjectInstance() methods no longer treat URL strings specially. URLs may be passed when wrapped in a Reference with no factory class name.