01: /*
02: * CoadunationLib: The coaduntion implementation library.
03: * Copyright (C) 2006 Rift IT Contracting
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18: *
19: * NamingParser.java
20: *
21: * This object is responsible for parsing the string value passed in. Valid
22: * names must be formated as "this/is/valid".
23: */
24:
25: // package path
26: package com.rift.coad.lib.naming.cos;
27:
28: // java imports
29: import java.util.Properties;
30: import java.io.Serializable;
31: import javax.naming.CompoundName;
32: import javax.naming.Name;
33: import javax.naming.NameParser;
34: import javax.naming.NamingException;
35:
36: /**
37: * This object is responsible for parsing the string value passed in. Valid
38: * names must be formated as "this/is/valid".
39: *
40: * @author Brett Chaldecott
41: */
42: public class NamingParser implements NameParser, Serializable {
43:
44: // the synax value
45: private static Properties syntax = new Properties();
46:
47: static {
48: syntax.setProperty("jndi.syntax.direction", "left_to_right");
49: syntax.setProperty("jndi.syntax.separator", "/");
50: syntax.setProperty("jndi.syntax.ignorecase", "false");
51: syntax.setProperty("jndi.syntax.escape", "\\");
52: }
53:
54: /**
55: * Creates a new instance of NamingParser
56: */
57: public NamingParser() {
58: }
59:
60: /**
61: * The method responsible for parsing the string value into a name value.
62: *
63: * @return The parse name object.
64: * @param name The name to parse.
65: * @exception NamingException
66: */
67: public Name parse(String name) throws NamingException {
68: return new CompoundName(name, syntax);
69: }
70: }
|