KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > naming > spi > ObjectFactoryBuilder


1 /*
2  * @(#)ObjectFactoryBuilder.java 1.10 04/07/16
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.naming.spi;
9
10 import java.util.Hashtable JavaDoc;
11 import javax.naming.NamingException JavaDoc;
12
13  /**
14   * This interface represents a builder that creates object factories.
15   *<p>
16   * The JNDI framework allows for object implementations to
17   * be loaded in dynamically via <em>object factories</em>.
18   * For example, when looking up a printer bound in the name space,
19   * if the print service binds printer names to References, the printer
20   * Reference could be used to create a printer object, so that
21   * the caller of lookup can directly operate on the printer object
22   * after the lookup. An ObjectFactory is responsible for creating
23   * objects of a specific type. JNDI uses a default policy for using
24   * and loading object factories. You can override this default policy
25   * by calling <tt>NamingManager.setObjectFactoryBuilder()</tt> with an ObjectFactoryBuilder,
26   * which contains the program-defined way of creating/loading
27   * object factories.
28   * Any <tt>ObjectFactoryBuilder</tt> implementation must implement this
29   * interface that for creating object factories.
30   *
31   * @author Rosanna Lee
32   * @author Scott Seligman
33   * @version 1.10 04/07/16
34   *
35   * @see ObjectFactory
36   * @see NamingManager#getObjectInstance
37   * @see NamingManager#setObjectFactoryBuilder
38   * @since 1.3
39   */

40 public interface ObjectFactoryBuilder {
41     /**
42       * Creates a new object factory using the environment supplied.
43       *<p>
44       * The environment parameter is owned by the caller.
45       * The implementation will not modify the object or keep a reference
46       * to it, although it may keep a reference to a clone or copy.
47       *
48       * @param obj The possibly null object for which to create a factory.
49       * @param environment Environment to use when creating the factory.
50       * Can be null.
51       * @return A non-null new instance of an ObjectFactory.
52       * @exception NamingException If an object factory cannot be created.
53       *
54       */

55     public ObjectFactory JavaDoc createObjectFactory(Object JavaDoc obj,
56                          Hashtable JavaDoc<?,?> environment)
57     throws NamingException JavaDoc;
58 }
59
Popular Tags