View Javadoc
1   package nl.tudelft.simulation.naming.context;
2   
3   import java.util.Hashtable;
4   
5   import javax.naming.NamingException;
6   
7   /**
8    * This interface represents a factory that creates an initial context. It is based on the InitialContentFactory from
9    * javax.naming but creates a lightweight ContextInterface rather than the heavyweight JNDI context.
10   * <p>
11   * Copyright (c) 2020-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
12   * for project information <a href="https://simulation.tudelft.nl/dsol/manual/" target="_blank">DSOL Manual</a>. The DSOL
13   * project is distributed under a three-clause BSD-style license, which can be found at
14   * <a href="https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank">DSOL License</a>.
15   * </p>
16   * @author <a href="https://github.com/averbraeck" target="_blank">Alexander Verbraeck</a>
17   */
18  public interface ContextFactory
19  {
20      /**
21       * Creates an Initial Context for beginning name resolution. Special requirements of this context are supplied using
22       * <code>environment</code>. Different implementations exist, such as the JvmContext, the FileContext and the RemoteContext.
23       * A remote context registers itself in the RMI registry using a provided key from the environment. The remote event
24       * producer for the remote context uses that same key, extended with the string "_producer".
25       * @param environment The possibly null environment specifying information to be used in the creation of the initial context
26       * @param atomicName the name under which the root context will be registered
27       * @return A non-null initial context object that implements the ContextInterface
28       * @throws NamingException when the initial context could not be created
29       */
30      ContextInterface getInitialContext(Hashtable<?, ?> environment, final String atomicName) throws NamingException;
31  }