Creates an object using the location or reference information, and attributes specified.
Special requirements of this object are supplied using environment
. An example of such an environment property is user identity information.
DirectoryManager.getObjectInstance()
successively loads in object factories. If it encounters a DirObjectFactory
, it will invoke DirObjectFactory.getObjectInstance()
; otherwise, it invokes ObjectFactory.getObjectInstance()
. It does this until a factory produces a non-null answer.
When an exception is thrown by an object factory, the exception is passed on to the caller of DirectoryManager.getObjectInstance()
. The search for other factories that may produce a non-null answer is halted. An object factory should only throw an exception if it is sure that it is the only intended factory and that no other object factories should be tried. If this factory cannot create an object using the arguments supplied, it should return null.
Since DirObjectFactory
extends ObjectFactory
, it effectively has two getObjectInstance()
methods, where one differs from the other by the attributes argument. Given a factory that implements DirObjectFactory
, DirectoryManager.getObjectInstance()
will only use the method that accepts the attributes argument, while NamingManager.getObjectInstance()
will only use the one that does not accept the attributes argument.
See ObjectFactory
for a description URL context factories and other properties of object factories that apply equally to DirObjectFactory
.
The name
, attrs
, and environment
parameters are owned by the caller. The implementation will not modify these objects or keep references to them, although it may keep references to clones or copies.