Package org.glassfish.jndi.cosnaming
Class CNNameParser
java.lang.Object
org.glassfish.jndi.cosnaming.CNNameParser
- All Implemented Interfaces:
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 ClassesModifier and TypeClassDescription(package private) static final class
An implementation of CompoundName that bypasses the parsing and stringifying code of the default CompoundName. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final char
private static final char
private static final char
private static final Properties
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new name parser for parsing names in INS syntax. -
Method Summary
Modifier and TypeMethodDescription(package private) static String
cosNameToInsString
(NameComponent[] cname) Returns the INS stringified form of a NameComponent[].(package private) static Name
cosNameToName
(NameComponent[] cname) Creates a CompositeName from a NameComponent[].private static String
Returns a string with '.', '\', '/' escaped.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
(Name name) Creates a NameComponent[] from a Name structure.Returns a CompoundName given a string in INS syntax.private static NameComponent
parseComponent
(String compStr) Return a NameComponent given its stringified form.private static String
-
Field Details
-
mySyntax
-
kindSeparator
private static final char kindSeparator- See Also:
-
compSeparator
private static final char compSeparator- See Also:
-
escapeChar
private static final char escapeChar- See Also:
-
-
Constructor Details
-
CNNameParser
public CNNameParser()Constructs a new name parser for parsing names in INS syntax.
-
-
Method Details
-
parse
Returns a CompoundName given a string in INS syntax.- Specified by:
parse
in interfaceNameParser
- Parameters:
name
- The non-null string representation of the name.- Returns:
- a non-null CompoundName
- Throws:
NamingException
-
nameToCosName
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:
InvalidNameException
-
cosNameToInsString
Returns the INS stringified form of a NameComponent[]. Used by CNCtx.getNameInNamespace(), CNCompoundName.toString(). -
cosNameToName
Creates a CompositeName from a NameComponent[]. Used by ExceptionMapper and CNBindingEnumeration to convert a NameComponent[] into a composite name. -
insStringToStringifiedComps
Converts an INS-syntax string name into a Vector in which each element of the vector contains a stringified form of a NameComponent.- Throws:
InvalidNameException
-
parseComponent
Return a NameComponent given its stringified form.- Throws:
InvalidNameException
-
stringifyComponent
-
escape
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 '\'.
-