01: // ========================================================================
02: // $Id: javaNameParser.java 231 2006-02-19 15:09:58Z janb $
03: // Copyright 2006 Mort Bay Consulting Pty. Ltd.
04: // ------------------------------------------------------------------------
05: // Licensed under the Apache License, Version 2.0 (the "License");
06: // you may not use this file except in compliance with the License.
07: // You may obtain a copy of the License at
08: // http://www.apache.org/licenses/LICENSE-2.0
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14: // ========================================================================
15:
16: package org.mortbay.naming.java;
17:
18: import java.util.Properties;
19:
20: import javax.naming.CompoundName;
21: import javax.naming.Name;
22: import javax.naming.NameParser;
23: import javax.naming.NamingException;
24:
25: /**
26: * javaNameParser
27: *
28: */
29: public class javaNameParser implements NameParser {
30:
31: static Properties syntax = new Properties();
32:
33: static {
34: syntax.put("jndi.syntax.direction", "left_to_right");
35: syntax.put("jndi.syntax.separator", "/");
36: syntax.put("jndi.syntax.ignorecase", "false");
37: }
38:
39: /**
40: * Parse a name into its components.
41: * @param name The non-null string name to parse.
42: * @return A non-null parsed form of the name using the naming convention
43: * of this parser.
44: * @exception NamingException If a naming exception was encountered.
45: */
46: public Name parse(String name) throws NamingException {
47: return new CompoundName(name, syntax);
48: }
49:
50: }
|