The JNDI framework allows for object implementations to
be loaded in dynamically via object factories. See
ObjectFactory for details.
A DirObjectFactory extends ObjectFactory by allowing
an Attributes instance
to be supplied to the getObjectInstance() method.
DirObjectFactory implementations are intended to be used by DirContext
service providers. The service provider, in addition reading an
object from the directory, might already have attributes that
are useful for the object factory to check to see whether the
factory is supposed to process the object. For instance, an LDAP-style
service provider might have read the "objectclass" of the object.
A CORBA object factory might be interested only in LDAP entries
with "objectclass=corbaObject". By using the attributes supplied by
the LDAP service provider, the CORBA object factory can quickly
eliminate objects that it need not worry about, and non-CORBA object
factories can quickly eliminate CORBA-related LDAP entries.
NamingManager#getObjectInstance, DirectoryManager#getObjectInstance, ObjectFactory
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: The object created; null if an object cannot be created.The possibly null object containing location or reference
information that can be used in creating an object. obj, Name The name of this object relative to name, Context nameCtx,
or null if no name is specified.The context relative to which the nameCtx, Hashtable<?, ?> name
parameter is specified, or null if name is
relative to the default initial context.The possibly null environment that is used in
creating the object. environment, Attributes The possibly null attributes containing some of attrs)obj's
attributes. attrs might not necessarily have all of obj's
attributes. If the object factory requires more attributes, it needs
to get it, either using obj, or name and nameCtx.
The factory must not modify attrs.Creates an object using the location or reference information, and attributes specified. |
| getObjectInstance | back to summary |
|---|---|
| public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment, Attributes attrs) throws Exception Creates an object using the location or reference information, and attributes specified.
Special requirements of this object are supplied
using
When an exception
is thrown by an object factory, the exception is passed on to the caller
of Since
See
The
| |