1 // ======================================================================== 2 // $Id: javaNameParser.java 231 2006-02-19 15:09:58Z janb $ 3 // Copyright 2006 Mort Bay Consulting Pty. Ltd. 4 // ------------------------------------------------------------------------ 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 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 /** 27 * javaNameParser 28 * 29 */ 30 public class javaNameParser implements NameParser 31 { 32 33 static Properties syntax = new Properties(); 34 35 static 36 { 37 syntax.put("jndi.syntax.direction", "left_to_right"); 38 syntax.put("jndi.syntax.separator", "/"); 39 syntax.put("jndi.syntax.ignorecase", "false"); 40 } 41 42 /** 43 * Parse a name into its components. 44 * @param name The non-null string name to parse. 45 * @return A non-null parsed form of the name using the naming convention 46 * of this parser. 47 * @exception NamingException If a naming exception was encountered. 48 */ 49 public Name parse(String name) throws NamingException 50 { 51 return new CompoundName(name, syntax); 52 } 53 54 }