KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > carol > jndi > enc > java > JavaNameParser


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2005 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: JavaNameParser.java,v 1.1 2005/03/10 16:50:22 benoitf Exp $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.carol.jndi.enc.java;
26
27 import java.util.Properties JavaDoc;
28
29 import javax.naming.CompoundName JavaDoc;
30 import javax.naming.Name JavaDoc;
31 import javax.naming.NameParser JavaDoc;
32 import javax.naming.NamingException JavaDoc;
33
34 /**
35  * Basic name parser used for java:comp naming space
36  */

37 public class JavaNameParser implements NameParser JavaDoc {
38
39     /**
40      * New syntax
41      */

42     private static Properties JavaDoc syntax = new Properties JavaDoc();
43
44     static {
45         syntax.put("jndi.syntax.direction", "left_to_right");
46         syntax.put("jndi.syntax.separator", "/");
47         syntax.put("jndi.syntax.ignorecase", "false");
48     }
49
50     /**
51      * Parse a name into its components.
52      * @param name The non-null string name to parse.
53      * @return A non-null parsed form of the name using the naming convention of
54      * this parser.
55      * @exception NamingException If a naming exception was encountered.
56      */

57     public Name JavaDoc parse(String JavaDoc name) throws NamingException JavaDoc {
58         return new CompoundName JavaDoc(name, syntax);
59     }
60
61 }
Popular Tags