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-2023 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/" target="_blank"> https://simulation.tudelft.nl</a>. The DSOL
13 * project is distributed under a three-clause BSD-style license, which can be found at
14 * <a href="https://https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank">
15 * https://https://simulation.tudelft.nl/dsol/docs/latest/license.html</a>.
16 * </p>
17 * @author <a href="https://www.tudelft.nl/averbraeck" target="_blank">Alexander Verbraeck</a>
18 */
19 public interface ContextFactory
20 {
21 /**
22 * Creates an Initial Context for beginning name resolution. Special requirements of this context are supplied using
23 * <code>environment</code>. Different implementations exist, such as the JVMContext, the FileContext and the RemoteContext.
24 * A remote context registers itself in the RMI registry using a provided key from the environment. The remote event
25 * producer for the remote context uses that same key, extended with the string "_producer".
26 * @param environment The possibly null environment specifying information to be used in the creation of the initial context
27 * @param atomicName String; the name under which the root context will be registered
28 * @return A non-null initial context object that implements the ContextInterface
29 * @throws NamingException when the initial context could not be created
30 */
31 ContextInterface getInitialContext(Hashtable<?, ?> environment, final String atomicName) throws NamingException;
32 }