01: /* JFox, the OpenSource J2EE Application Server
02: *
03: * Copyright (C) 2002 huihoo.com
04: * Distributable under GNU LGPL license
05: * See the GNU Lesser General Public License for more details.
06: */
07:
08: package org.huihoo.jfox.jndi;
09:
10: import javax.naming.*;
11: import java.util.Properties;
12:
13: /**
14: *
15: * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
16: */
17:
18: class NameParserImpl implements NameParser, java.io.Serializable {
19: // private static Properties syntax = PropertiesHolder.getNSProperties();
20: private static Properties syntax = new Properties();
21: static {
22: syntax.setProperty("jndi.syntax.direction", "left_to_right");
23: syntax.setProperty("jndi.syntax.ignorecase", "false");
24: syntax.setProperty("jndi.syntax.separator", "/");
25: syntax.setProperty("jndi.syntax.trimblanks", "true");
26: }
27:
28: private static NameParserImpl me = new NameParserImpl();
29:
30: private NameParserImpl() {
31:
32: }
33:
34: /**
35: * parse a name to javax.naming.Name
36: */
37:
38: public Name parse(String name) throws NamingException {
39: return new CompoundName(name, syntax);
40: }
41:
42: public static synchronized NameParserImpl getInstance() {
43: return me;
44: }
45:
46: public static void main(String[] args) throws Exception {
47: System.out.println(me.parse("/").toString());
48: }
49: }
|