1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.eclipse.jetty.jndi;
15
16
17 import java.util.Hashtable;
18 import java.util.Properties;
19
20 import javax.naming.CompoundName;
21 import javax.naming.Context;
22 import javax.naming.Name;
23 import javax.naming.NameParser;
24 import javax.naming.NamingException;
25
26 import org.eclipse.jetty.jndi.local.localContextRoot;
27 import org.eclipse.jetty.util.log.Logger;
28
29
30
31
32
33
34
35
36
37
38
39
40 public class InitialContextFactory implements javax.naming.spi.InitialContextFactory
41 {
42 private static Logger __log = NamingUtil.__log;
43
44 public static class DefaultParser implements NameParser
45 {
46 static Properties syntax = new Properties();
47 static
48 {
49 syntax.put("jndi.syntax.direction", "left_to_right");
50 syntax.put("jndi.syntax.separator", "/");
51 syntax.put("jndi.syntax.ignorecase", "false");
52 }
53 public Name parse (String name)
54 throws NamingException
55 {
56 return new CompoundName (name, syntax);
57 }
58 };
59
60
61
62
63
64
65
66
67
68
69
70
71
72 public Context getInitialContext(Hashtable env)
73 {
74 __log.debug("InitialContextFactory.getInitialContext()");
75
76 Context ctx = new localContextRoot(env);
77 if(__log.isDebugEnabled())__log.debug("Created initial context delegate for local namespace:"+ctx);
78
79 return ctx;
80 }
81 }