KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > lib > naming > cos > NamingParser


1 /*
2  * CoadunationLib: The coaduntion implementation library.
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
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 JavaDoc;
30 import java.io.Serializable JavaDoc;
31 import javax.naming.CompoundName JavaDoc;
32 import javax.naming.Name JavaDoc;
33 import javax.naming.NameParser JavaDoc;
34 import javax.naming.NamingException JavaDoc;
35
36
37 /**
38  * This object is responsible for parsing the string value passed in. Valid
39  * names must be formated as "this/is/valid".
40  *
41  * @author Brett Chaldecott
42  */

43 public class NamingParser implements NameParser JavaDoc,Serializable JavaDoc {
44     
45     // the synax value
46
private static Properties JavaDoc syntax = new Properties JavaDoc();
47     
48     
49     static {
50         syntax.setProperty("jndi.syntax.direction","left_to_right");
51         syntax.setProperty("jndi.syntax.separator","/");
52         syntax.setProperty("jndi.syntax.ignorecase","false");
53         syntax.setProperty("jndi.syntax.escape","\\");
54     }
55     
56     /**
57      * Creates a new instance of NamingParser
58      */

59     public NamingParser() {
60     }
61     
62     
63     /**
64      * The method responsible for parsing the string value into a name value.
65      *
66      * @return The parse name object.
67      * @param name The name to parse.
68      * @exception NamingException
69      */

70     public Name JavaDoc parse(String JavaDoc name) throws NamingException JavaDoc {
71         return new CompoundName JavaDoc(name,syntax);
72     }
73 }
74
Popular Tags