Package org.glassfish.jndi.cosnaming
Class CNNameParser
- java.lang.Object
-
- org.glassfish.jndi.cosnaming.CNNameParser
-
- All Implemented Interfaces:
javax.naming.NameParser
public final class CNNameParser extends java.lang.Object implements javax.naming.NameParser
Parsing routines for NameParser as well as COS Naming stringified names. This is used by CNCtx to create a NameComponent[] object and vice versa. It follows Section 4.5 of Interoperable Naming Service (INS) 98-10-11. In summary, the stringified form is a left-to-right, forward-slash separated name. id and kinds are separated by '.'. backslash is the escape character.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
CNNameParser.CNCompoundName
An implementation of CompoundName that bypasses the parsing and stringifying code of the default CompoundName.
-
Field Summary
Fields Modifier and Type Field Description private static char
compSeparator
private static char
escapeChar
private static char
kindSeparator
private static java.util.Properties
mySyntax
-
Constructor Summary
Constructors Constructor Description CNNameParser()
Constructs a new name parser for parsing names in INS syntax.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static java.lang.String
cosNameToInsString(NameComponent[] cname)
Returns the INS stringified form of a NameComponent[].(package private) static javax.naming.Name
cosNameToName(NameComponent[] cname)
Creates a CompositeName from a NameComponent[].private static java.lang.String
escape(java.lang.String str)
Returns a string with '.', '\', '/' escaped.private static java.util.Vector<java.lang.String>
insStringToStringifiedComps(java.lang.String str)
Converts an INS-syntax string name into a Vector in which each element of the vector contains a stringified form of a NameComponent.private static boolean
isMeta(char ch)
In INS, there are three meta characters: '.', '/' and '\'.(package private) static NameComponent[]
nameToCosName(javax.naming.Name name)
Creates a NameComponent[] from a Name structure.javax.naming.Name
parse(java.lang.String name)
Returns a CompoundName given a string in INS syntax.private static NameComponent
parseComponent(java.lang.String compStr)
Return a NameComponent given its stringified form.private static java.lang.String
stringifyComponent(NameComponent comp)
-
-
-
Field Detail
-
mySyntax
private static final java.util.Properties mySyntax
-
kindSeparator
private static final char kindSeparator
- See Also:
- Constant Field Values
-
compSeparator
private static final char compSeparator
- See Also:
- Constant Field Values
-
escapeChar
private static final char escapeChar
- See Also:
- Constant Field Values
-
-
Method Detail
-
parse
public javax.naming.Name parse(java.lang.String name) throws javax.naming.NamingException
Returns a CompoundName given a string in INS syntax.- Specified by:
parse
in interfacejavax.naming.NameParser
- Parameters:
name
- The non-null string representation of the name.- Returns:
- a non-null CompoundName
- Throws:
javax.naming.NamingException
-
nameToCosName
static NameComponent[] nameToCosName(javax.naming.Name name) throws javax.naming.InvalidNameException
Creates a NameComponent[] from a Name structure. Used by CNCtx to convert the input Name arg into a NameComponent[].- Parameters:
a
- CompoundName or a CompositeName; each component must be the stringified form of a NameComponent.- Throws:
javax.naming.InvalidNameException
-
cosNameToInsString
static java.lang.String cosNameToInsString(NameComponent[] cname)
Returns the INS stringified form of a NameComponent[]. Used by CNCtx.getNameInNamespace(), CNCompoundName.toString().
-
cosNameToName
static javax.naming.Name cosNameToName(NameComponent[] cname)
Creates a CompositeName from a NameComponent[]. Used by ExceptionMapper and CNBindingEnumeration to convert a NameComponent[] into a composite name.
-
insStringToStringifiedComps
private static java.util.Vector<java.lang.String> insStringToStringifiedComps(java.lang.String str) throws javax.naming.InvalidNameException
Converts an INS-syntax string name into a Vector in which each element of the vector contains a stringified form of a NameComponent.- Throws:
javax.naming.InvalidNameException
-
parseComponent
private static NameComponent parseComponent(java.lang.String compStr) throws javax.naming.InvalidNameException
Return a NameComponent given its stringified form.- Throws:
javax.naming.InvalidNameException
-
stringifyComponent
private static java.lang.String stringifyComponent(NameComponent comp)
-
escape
private static java.lang.String escape(java.lang.String str)
Returns a string with '.', '\', '/' escaped. Used when stringifying the name into its INS stringified form.
-
isMeta
private static boolean isMeta(char ch)
In INS, there are three meta characters: '.', '/' and '\'.
-
-