Catalina JNDI Context implementation.
| 46 | * Catalina JNDI Context implementation. |
| 47 | */ |
| 48 | public class NamingContext implements Context { |
| 49 | |
| 50 | |
| 51 | // -------------------------------------------------------------- Constants |
| 52 | |
| 53 | |
| 54 | /** |
| 55 | * Name parser for this context. |
| 56 | */ |
| 57 | protected static final NameParser nameParser = new NameParserImpl(); |
| 58 | |
| 59 | |
| 60 | private static final Log log = LogFactory.getLog(NamingContext.class); |
| 61 | |
| 62 | |
| 63 | // ----------------------------------------------------------- Constructors |
| 64 | |
| 65 | |
| 66 | /** |
| 67 | * Builds a naming context. |
| 68 | * |
| 69 | * @param env The environment to use to construct the naming context |
| 70 | * @param name The name of the associated Catalina Context |
| 71 | */ |
| 72 | public NamingContext(Hashtable<String,Object> env, String name) { |
| 73 | this(env, name, new HashMap<>()); |
| 74 | } |
| 75 | |
| 76 | |
| 77 | /** |
| 78 | * Builds a naming context. |
| 79 | * |
| 80 | * @param env The environment to use to construct the naming context |
| 81 | * @param name The name of the associated Catalina Context |
| 82 | * @param bindings The initial bindings for the naming context |
| 83 | */ |
| 84 | public NamingContext(Hashtable<String,Object> env, String name, HashMap<String,NamingEntry> bindings) { |
| 85 | |
| 86 | this.env = new Hashtable<>(); |
| 87 | this.name = name; |
| 88 | // Populating the environment hashtable |
| 89 | if (env != null) { |
| 90 | Enumeration<String> envEntries = env.keys(); |
| 91 | while (envEntries.hasMoreElements()) { |
| 92 | String entryName = envEntries.nextElement(); |
| 93 | addToEnvironment(entryName, env.get(entryName)); |
| 94 | } |
| 95 | } |
| 96 | this.bindings = bindings; |
| 97 | } |
| 98 | |
| 99 | |
| 100 | // ----------------------------------------------------- Instance Variables |
| 101 | |
| 102 | |
| 103 | /** |
| 104 | * Environment. |
| 105 | */ |
nothing calls this directly
no test coverage detected