1 22 package org.jboss.test.security.ejb.project.support; 23 24 import java.util.Enumeration ; 25 import java.util.Properties ; 26 import javax.naming.CompoundName ; 27 import javax.naming.InvalidNameException ; 28 import javax.naming.Name ; 29 import javax.naming.NameParser ; 30 import javax.naming.NamingException ; 31 32 39 public class DefaultName extends CompoundName 40 { 41 42 static Name emptyName; 43 static Properties nameSyntax = new Properties (); 44 static 45 { 46 nameSyntax.put("jndi.syntax.direction", "left_to_right"); 47 nameSyntax.put("jndi.syntax.separator", "/"); 48 try 49 { 50 emptyName = new DefaultName(""); 51 } 52 catch(InvalidNameException e) 53 { 54 } 55 } 56 57 private static class DefaultNameParser implements NameParser 58 { 59 public Name parse(String path) throws NamingException 60 { 61 DefaultName name = new DefaultName(path); 62 return name; 63 } 64 } 65 66 public static NameParser getNameParser() 67 { 68 return new DefaultNameParser(); 69 } 70 71 72 public DefaultName(Enumeration comps) 73 { 74 super(comps, nameSyntax); 75 } 76 public DefaultName(String name) throws InvalidNameException 77 { 78 super(name, nameSyntax); 79 } 80 public DefaultName(Name name) 81 { 82 super(name.getAll(), nameSyntax); 83 } 84 public DefaultName() 85 { 86 this(emptyName); 87 } 88 89 } 90 | Popular Tags |