public class XdsDN
extends java.lang.Object
XdsDN
is an abstract representation of a distinguished nameModifier and Type | Class and Description |
---|---|
static class |
XdsDN.DNComponent |
Modifier and Type | Field and Description |
---|---|
static int |
CUSTOM_FORM
Integer constant representing DN
"custom" format. |
static char |
DELIM_CFG_FALSE |
static char |
DELIM_CFG_TRUE |
static int |
DI_CFG_ESC_STRINGS |
static int |
DI_CFG_TYPED |
static int |
DI_DV |
static int |
DI_ESC |
static int |
DI_EXTRA_QUOTED |
static int |
DI_RDN |
static int |
DI_REL |
static int |
DI_SIZE |
static int |
DI_VALUE |
static int |
DI_WILD |
static java.lang.String |
DOT_DELIMS
Delimiter set for
"dot" DN format. |
static int |
DOT_FORM
Integer constant representing DN
"dot" format. |
static int |
ERR_INVALID_CHAR |
static int |
ERR_NONE |
static java.lang.String |
illegalChars |
static java.lang.String |
LDAP_DELIMS
Delimiter set for
"ldap" DN format. |
static int |
LDAP_FORM
Integer constant representing DN
"ldap" format. |
static java.lang.String |
QDOT_DELIMS
Delimiter set for
"qualified-dot" DN format. |
static int |
QDOT_FORM
Integer constant representing DN
"qualified-dot" format. |
static java.lang.String |
QSLASH_DELIMS
Delimiter set for
"qualified-slash" DN format. |
static int |
QSLASH_FORM
Integer constant representing DN
"qualified-slash" format. |
static int |
SCOPE_ENTRY |
static int |
SCOPE_SUBORDINATES |
static int |
SCOPE_SUBTREE |
static java.lang.String |
SLASH_DELIMS
Delimiter set for "
slash" DN format. |
static int |
SLASH_FORM
Integer constant representing DN
"slash" format. |
Constructor and Description |
---|
XdsDN(java.lang.String srcDN,
char[] delims)
constructor
|
XdsDN(XdsDN original)
copy constructor
|
Modifier and Type | Method and Description |
---|---|
static void |
appendComponent(java.lang.StringBuffer sb,
XdsDN.DNComponent component,
char[] delims,
boolean typed)
Append a DN component to a StringBuffer.
|
boolean |
checkScope(XdsDN base,
int scope)
check if dn is in a particular scope
|
void |
copyTreeName(XdsDN src)
copyTreeName copies the tree name from another DN to this one |
static java.lang.String |
decodeURL(java.lang.String s)
Decode x-www-form-urlEncoded string.
|
static java.lang.String |
encodeURL(java.lang.String s)
Encode x-www-form-urlEncoded string.
|
boolean |
equals(XdsDN dn)
check if dn is equivalent
|
XdsDN.DNComponent |
getComponent(int n)
get the nth component
|
int |
getComponentCount()
getComponentCount return the number of components |
static java.lang.String |
getDelims(int dnForm)
Return a
String containing the delimiter set for
the passed DN format. |
static java.lang.String |
getDelims(java.lang.String dnForm)
Return a
String containing the delimiter set for
the passed DN format. |
java.lang.String |
getDN(char[] delims)
getDN get the whole DN |
java.lang.String |
getDNFragment(char[] delims,
int loIndex,
int count,
boolean includeRoot)
getDNFragment return a fragment of the dn |
static java.lang.String |
getFormString(char[] delims)
Return a human-readable string representing the name of the passed
DN delimiter.
|
static java.lang.String |
getFormString(int dnForm)
Return a human-readable string representing the name of the passed
DN format.
|
java.lang.String |
getName(char[] delims)
getName return the unqualified "name" of the object (without path, but escaped) |
java.lang.String |
getNDSStreamURL()
getNDSStreamURL get the vnd.nds.stream URL representation of the URL |
java.lang.String |
getNDSURLForm()
getNDSURLForm get the form of the DN suitable for use in vnd.nds.* URL |
int |
getParseErr()
Return any error that occurred while parsing a string
as a DN.
|
java.lang.String |
getRDN(char[] delims,
int count)
getRDN return an rdn containing the last count components |
java.lang.String |
getRelativeDN(XdsDN baseDN,
char[] delims)
getRelativeDN get DN relative to another DN |
java.lang.String |
getTreeName()
getTreeName gets the treename for the dn |
boolean |
hasAncestor(XdsDN root)
check to see if root is an ancestor of this dn
|
boolean |
hasTreeName()
hasTreeName returns whether or not the dn includes the tree name |
static void |
main(java.lang.String[] args) |
boolean |
matchComponent(XdsDN.DNComponent c1,
XdsDN.DNComponent c2)
check to see if two components match
|
protected int |
parseDN(java.lang.String dn,
char[] delims)
parses DN according to the delimiters
|
static XdsDN |
parseNDSURLForm(java.lang.String urlFile)
parseNDSURLForm Create an XdsDN from filespec from a vnd.nds.* URL |
static java.lang.String |
quote(java.lang.String string,
char[] d)
quote the special characters in a string
|
void |
removeTreeName()
removeTreeName remove the tree name component if it is there |
void |
setHasTreeName(boolean hasTreeName)
setHasTreeName sets whether or not the dn includes the tree name
this is used to override the flag that was set by the parsing of the DN |
void |
setTreeName(java.lang.String name)
setTreeName sets the treename for the dn |
java.lang.String[] |
split(char[] delims)
split return the parent and the rdn |
static boolean |
validateDelims(char[] d)
check a delimiter string to see if it could be valid
|
public static final int SLASH_FORM
"slash"
format.public static final int QSLASH_FORM
"qualified-slash"
format.public static final int DOT_FORM
"dot"
format.public static final int QDOT_FORM
"qualified-dot"
format.public static final int LDAP_FORM
"ldap"
format.public static final int CUSTOM_FORM
"custom"
format.public static final java.lang.String SLASH_DELIMS
slash"
DN format.public static final java.lang.String QSLASH_DELIMS
"qualified-slash"
DN format.public static final java.lang.String DOT_DELIMS
"dot"
DN format.public static final java.lang.String QDOT_DELIMS
"qualified-dot"
DN format.public static final java.lang.String LDAP_DELIMS
"ldap"
DN format.public static final int DI_CFG_TYPED
public static final int DI_CFG_ESC_STRINGS
public static final int DI_REL
public static final int DI_RDN
public static final int DI_DV
public static final int DI_VALUE
public static final int DI_WILD
public static final int DI_ESC
public static final int DI_SIZE
public static final int DI_EXTRA_QUOTED
public static final char DELIM_CFG_TRUE
public static final char DELIM_CFG_FALSE
public static final java.lang.String illegalChars
public static final int SCOPE_SUBTREE
public static final int SCOPE_SUBORDINATES
public static final int SCOPE_ENTRY
public static final int ERR_NONE
public static final int ERR_INVALID_CHAR
public XdsDN(java.lang.String srcDN, char[] delims)
srcDN
- dn to parsedelims
- delimiter to use for parsepublic XdsDN(XdsDN original)
original
- dn to copypublic static java.lang.String getDelims(int dnForm)
String
containing the delimiter set for
the passed DN format.dnForm
- SLASH_FORM, QSLASH_FORM, DOT_FORM, QDOT_FORM, LDAP_FORM.String
containing delimiter set or null
, if argument is invalid.public static java.lang.String getDelims(java.lang.String dnForm)
String
containing the delimiter set for
the passed DN format.dnForm
- "slash"
, "qualified-slash"
,
"dot"
, "qualified-dot"
, "ldap"
.String
containing delimiter set or null
, if argument is invalid.public static java.lang.String getFormString(int dnForm)
dnForm
- SLASH_FORM, QSLASH_FORM, DOT_FORM, QDOT_FORM, LDAP_FORM, CUSTOM_FORM.String
containing the name, or "unknown"
if argument is invalid.public static java.lang.String getFormString(char[] delims)
delims
- delimiters.String
containing the namepublic int getParseErr()
public int getComponentCount()
getComponentCount
return the number of componentspublic boolean hasTreeName()
hasTreeName
returns whether or not the dn includes the tree namepublic void setHasTreeName(boolean hasTreeName)
setHasTreeName
sets whether or not the dn includes the tree name
this is used to override the flag that was set by the parsing of the DNhasTreeName
- true if dn includes a tree namepublic void removeTreeName()
removeTreeName
remove the tree name component if it is therepublic void copyTreeName(XdsDN src)
copyTreeName
copies the tree name from another DN to this onesrc
- the other DNpublic void setTreeName(java.lang.String name)
setTreeName
sets the treename for the dnname
- the tree namepublic java.lang.String getTreeName()
getTreeName
gets the treename for the dnnull
otherwisepublic java.lang.String getName(char[] delims)
getName
return the unqualified "name" of the object (without path, but escaped)delims
- the delimiter set to use for escapingpublic java.lang.String getRDN(char[] delims, int count)
getRDN
return an rdn containing the last count componentsdelims
- the delimiter set for returned the namecount
- number of components to include in the suffixpublic java.lang.String[] split(char[] delims)
split
return the parent and the rdndelims
- the delimiter set for returned the namepublic java.lang.String getDNFragment(char[] delims, int loIndex, int count, boolean includeRoot)
getDNFragment
return a fragment of the dndelims
- the delimiter set for returned the nameloIndex
- index of the rootmost component to get (0 is rootmost component,
negative numbersstart at leaf node and work towards the root)count
- number of components to getincludeRoot
- include the root if doing all components and has tree namepublic java.lang.String getDN(char[] delims)
getDN
get the whole DNdelims
- the delimiter set for returned the namepublic java.lang.String getRelativeDN(XdsDN baseDN, char[] delims)
getRelativeDN
get DN relative to another DNdelims
- the delimiter set for returned the nameprotected int parseDN(java.lang.String dn, char[] delims)
dn
- the format desired to return the name in (DOT, SLASH, or LDAP)delims
- the delimiter charspublic boolean hasAncestor(XdsDN root)
root
- the ancestor in questionpublic boolean checkScope(XdsDN base, int scope)
base
- the base of the scope checkscope
- the scope relative to the basepublic boolean equals(XdsDN dn)
dn
- to comparepublic boolean matchComponent(XdsDN.DNComponent c1, XdsDN.DNComponent c2)
c1
- first componentc2
- second componentpublic XdsDN.DNComponent getComponent(int n)
n
- the index of the dn component to get (0
is rootmost, getComponentCount() - 1
is leafmost)public static boolean validateDelims(char[] d)
d
- the delimiter charspublic static java.lang.String quote(java.lang.String string, char[] d)
d
- the delimiter charspublic static void appendComponent(java.lang.StringBuffer sb, XdsDN.DNComponent component, char[] delims, boolean typed)
sb
- buffer to which to append.component
- component to appenddelims
- the delimiter set used to be usedtyped
- true if type information is desiredpublic java.lang.String getNDSStreamURL()
getNDSStreamURL
get the vnd.nds.stream URL representation of the URLpublic java.lang.String getNDSURLForm()
getNDSURLForm
get the form of the DN suitable for use in vnd.nds.* URLpublic static XdsDN parseNDSURLForm(java.lang.String urlFile)
parseNDSURLForm
Create an XdsDN from filespec from a vnd.nds.* URLurlFile
- the filespec from a vnd.nds.* URLpublic static java.lang.String decodeURL(java.lang.String s)
s
- String to be decodedpublic static java.lang.String encodeURL(java.lang.String s)
s
- String to be encodedpublic static void main(java.lang.String[] args)