KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ca > jndiproviders > dsml > DsmlParser


1 package com.ca.jndiproviders.dsml;
2
3 import com.ca.commons.naming.DN;
4
5 import javax.naming.*;
6 import java.util.logging.Logger JavaDoc;
7 import java.util.logging.Level JavaDoc;
8
9 /**
10  * This code lovingly written by Chris.
11  */

12 public class DsmlParser implements NameParser
13 {
14     
15     private static Logger JavaDoc log = Logger.getLogger(DsmlParser.class.getName());
16 // private static Logger log = Logger.getLogger("com.ca.jndiproviders.dsml");
17

18     /**
19      * Default DSML parser for general use
20      */

21     public static final DsmlParser parser = new DsmlParser();
22
23     // Debug
24
{
25         log.setLevel(Level.FINE);
26     }
27
28     /**
29      * Parses a name into its components. DSML names are
30      * simply LDAP names, and this parser returns a com.ca.commons.naming.DN object.
31      * It does not support
32      *
33      * @param name The non-null string name to parse.
34      * @return A non-null parsed form of the name using the naming convention
35      * of this parser.
36      * @throws javax.naming.InvalidNameException
37      * If name does not conform to
38      * syntax defined for the namespace.
39      * @throws javax.naming.NamingException If a naming exception was encountered.
40      */

41
42     public Name parse(String JavaDoc name) throws NamingException
43     {
44         DN newDN = new DN(name);
45         if (newDN.error())
46             throw newDN.getNamingException();
47         return newDN;
48     }
49
50     /**
51      * Empty constructor. Use if you don't want to use the static 'parser' object (e.g.
52      * for thread safety reasons).
53      */

54     public DsmlParser()
55     {
56         log.log(Level.FINE, "creating DsmlParser");
57     }
58
59 }
60
Popular Tags