| Creates an object of the type specified by parameter o ,
including any reference or location details, customized by the specified
envmt parameter.
Object factories are specified via environment properties from several
sources including provider properties files (see the specification of the
Context interface) and may comprise a list of factories.
Each object factory in the list is used by
NamingManager.getObjectInstance() which invokes this
method on each of them until a non-null result is achieved or until the
list is exhausted. If an ObjectFactory throws an
exception, it should be passed back to the code that invoked
NamingManager.getObjectInstance() and no further object
factories in the list are examined. An exception should only be thrown by
an object factory if it is intended that no other object factories be
examined. Usually, if an ObjectFactory is unable to create
an object, then null should be returned.
A special case of ObjectFactory is a URL context factory
which is used either to create an object whose location is specified by a
URL passed as the object o or creates contexts for
resolving URLs. The getObjectInstance() method of a URL
context factory must obey these rules:
1. When Object o is null, return a new Context object
suitable for resolving any URL of the scheme supported by this factory.
2. When Object o is a URL string, return a new object
(usually a context) identified by the URL, so that names relatively lower
than that context may be resolved.
3. When Object o is an Array object with
more than one URL string (order is not important), return a new object
(usually a context) identified by the URL as in rule 2, above. The URLs
in the array are considered to be equivalent in relation to the
associated context, but the object (context) factory can choose whether
or not to verify that they are truly equivalent.
4. Otherwise, the behaviour of this method depends on the context factory
implementation.
Parameters: o - may be null or may contain location or reference details Parameters: n - the name relative to the context c of theobject being created and may be null; the implementation mayclone or copy this object, but will not modify the original. Parameters: c - may be null when the name is relative to the default initialcontext, or specifies the context to which the name isrelative (if a factory uses this context object,synchronization should be used as Context objects are notthread-safe). Parameters: envmt - may be null; the implementation may clone or copy this object,but will not modify the original. either an object of the specified type or null if no object couldbe created. throws: Exception - causes no further object factory will be tried |