1 6 7 package org.jfox.jndi; 8 9 import java.util.Properties ; 10 import javax.naming.CompoundName ; 11 import javax.naming.Name ; 12 import javax.naming.NameParser ; 13 import javax.naming.NamingException ; 14 15 18 19 20 public class NameParserImpl implements NameParser , java.io.Serializable { 21 private static Properties syntax = new Properties (); 23 24 static { 25 syntax.setProperty("jndi.syntax.direction", "left_to_right"); 26 syntax.setProperty("jndi.syntax.ignorecase", "false"); 27 syntax.setProperty("jndi.syntax.separator", "/"); 28 syntax.setProperty("jndi.syntax.trimblanks", "true"); 29 } 30 31 private static NameParserImpl me = new NameParserImpl(); 32 33 private NameParserImpl() { 34 35 } 36 37 40 41 public Name parse(String name) throws NamingException { 42 return new CompoundName (name, syntax); 43 } 44 45 public static synchronized NameParserImpl getInstance() { 46 return me; 47 } 48 49 public static void main(String [] args) throws Exception { 50 System.out.println(me.parse("/").toString()); 51 } 52 } 53 | Popular Tags |