|
JNDI 1.2: Modifications to JNDI 1.1 Packages |
The following changes were made to the JNDI 1.1 packages:
javax.naming:
javax.naming.directory:
javax.naming.spi:
Problem: In JNDI 1.1, the search results are returned in a NamingEnumeration. Client applications need a way of cancelling large search requests. Leaving outstanding requests that the client is no longer interested in consumes resources both on the client and on the server.
Solution: Add a new method NamingEnumeration.close() that terminates the enumeration. When this method is invoked, the service provider is free to release resources associated with the enumeration and can notify the server to cancel the request as well, if that is appropriate. After this method has been invoked on an enumeration, the enumeration becomes invalid and subsequent invocation of any of its method will yield undefined results.
Solution: Add a new method ReferralException.getReferralContext(Hashtable env). This is like the ReferralException.getReferralContext() method that takes no arguments. The only difference is that the existing method uses the environment properties associated with the context (that threw the exception), while the new method uses the supplied environment properties.
Add a new method ReferralException.retryReferral() to allow a referral to be retried.
Solution: Claify the documentation to say that if the structured name argument (Name) 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.
Solution: Add a new method Context.getNameInNamespace(). This method returns a string representation of the name of an object within its own namespace. This name is not a JNDI composite name, and should therefore not be passed directly to JNDI context methods.
Solution: Add a method boolean Attribute.isOrdered() that allows the client application to determine whether the attribute he is dealing with is ordered. If the attribute is ordered, then the values returned from the getAll() method returns the values in order. The following methods are also added to support ordered values: get(int), remove(int), add(int, Object), set(int, Object). Similar changes are made to the BasicAttribute class to support this new feature.
Solution: Modify the description so that the method returns a context containing all of the directory object's object class definitions. That way, you can get the object class you're interested in, or you can enumerate the context to see all of the object classes.
Solution: Add equals() and hashCode() methods such that two BasicAttributes objects are equal (and return the same hashCode) if they contain the same BasicAttribute objects.
Solution: The NamingManager.getObjectInstance() and DirectoryManager.getObjectInstance() methods no longer treat URL strings specially. Equivalent functionality is instead provided in the following way. When these methods are passed a Reference with no factory class name, and with StringRefAddr addresses with "URL" as the address type, the contents of each address is treated as a URL. A URL context factory based on the URL's scheme id is located, if possible, and used to resolve the URL.
Solution: Have ResolveResult implement the Serializable interface. Note that a ResolveResult is only serializable if the resolved object is serializable.
Solution: Add new constructors InitialContext(boolean lazy) and InitialDirContext(boolean lazy). When lazy is true, the connection is deferred.
Solution: Define the class factory location as a space-separated list of URLs representing the codebase used to load the factory. When the factory class (or any class upon which it depends) needs to be loaded, it is loaded from the codebase formed by the URLs.
Solution: The method NamingManager.getContinuationContext(CannotProceedException cpe) updates the environment associated with cpe by setting the value of the property NamingManager.CPE ("java.naming.spi.CannotProceedException") to cpe. This property is inherited by the continuation context, and may be used by that context's service provider to inspect the fields of the exception.
When a caller invokes DirContext.bind() and supplies attributes with the object to be bound, the service provider has no way of passing those attributes to the state factory, and the factory has no way of returning both an object and attributes to be bound.
Solution: The new method, DirectoryManager.getObjectInstance(), allows a service provider to pass attributes it has already read to object factories that implement the interface DirObjectFactory.
The new method, DirectoryManager.getStateToBind(), allows a service provider to pass attributes supplied by the caller to state factories that implement the new interface DirStateFactory. The provider can also obtain from the state factories the object and the attributes to be bound.
|
Copyright © 1995-99 Sun Microsystems, Inc. All Rights Reserved. Please send comments to: jndi@java.sun.com |
Java Software |