1. /*
  2. * @(#)ObjectFactoryBuilder.java 1.5 00/02/02
  3. *
  4. * Copyright 1999, 2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.naming.spi;
  11. import java.util.Hashtable;
  12. import javax.naming.NamingException;
  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.5 00/02/02
  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 createObjectFactory(Object obj, Hashtable environment)
  56. throws NamingException;
  57. }