1. /*
  2. * @(#)InitialContextFactory.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. package javax.naming.spi;
  8. import java.util.Hashtable;
  9. import javax.naming.*;
  10. /**
  11. * This interface represents a factory that creates an initial context.
  12. *<p>
  13. * The JNDI framework allows for different initial context implementations
  14. * to be specified at runtime. The initial context is created using
  15. * an <em>initial context factory</em>.
  16. * An initial context factory must implement the InitialContextFactory
  17. * interface, which provides a method for creating instances of initial
  18. * context that implement the Context interface.
  19. * In addition, the factory class must be public and must have a public
  20. * constructor that accepts no arguments.
  21. *
  22. * @author Rosanna Lee
  23. * @author Scott Seligman
  24. * @version 1.10 04/07/16
  25. *
  26. * @see InitialContextFactoryBuilder
  27. * @see NamingManager#getInitialContext
  28. * @see javax.naming.InitialContext
  29. * @see javax.naming.directory.InitialDirContext
  30. * @since 1.3
  31. */
  32. public interface InitialContextFactory {
  33. /**
  34. * Creates an Initial Context for beginning name resolution.
  35. * Special requirements of this context are supplied
  36. * using <code>environment</code>.
  37. *<p>
  38. * The environment parameter is owned by the caller.
  39. * The implementation will not modify the object or keep a reference
  40. * to it, although it may keep a reference to a clone or copy.
  41. *
  42. * @param environment The possibly null environment
  43. * specifying information to be used in the creation
  44. * of the initial context.
  45. * @return A non-null initial context object that implements the Context
  46. * interface.
  47. * @exception NamingException If cannot create an initial context.
  48. */
  49. public Context getInitialContext(Hashtable<?,?> environment)
  50. throws NamingException;
  51. }