Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.novell.nds.dirxml.util
Class XdsDN

    java.lang.Object
      com.novell.nds.dirxml.util.XdsDN

    public class XdsDN

extends Object

`XdsDN` is an abstract representation of a distinguished name

Nested Class Summary
`static class` | `XdsDN.DNComponent`

Field Summary
`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 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 String` | `illegalChars`
`static String` | `LDAP_DELIMS` Delimiter set for `"ldap"` DN format.
`static int` | `LDAP_FORM` Integer constant representing DN `"ldap"` format.
`static String` | `QDOT_DELIMS` Delimiter set for `"qualified-dot"` DN format.
`static int` | `QDOT_FORM` Integer constant representing DN `"qualified-dot"` format.
`static 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 String` | `SLASH_DELIMS` Delimiter set for "`slash"` DN format.
`static int` | `SLASH_FORM` Integer constant representing DN `"slash"` format.

Constructor Summary
`XdsDN(String srcDN, char[] delims)` constructor
`XdsDN(XdsDN original)` copy constructor

Method Summary
`static void` | `appendComponent(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 String` | `decodeURL(String s)` Decode x-www-form-urlEncoded string.
`static String` | `encodeURL(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 String` | `getDelims(int dnForm)` Return a `String` containing the delimiter set for the passed DN format.
`static String` | `getDelims(String dnForm)` Return a `String` containing the delimiter set for the passed DN format.
`String` | `getDN(char[] delims)` `getDN` get the whole DN
`String` | `getDNFragment(char[] delims, int loIndex, int count, boolean includeRoot)` `getDNFragment` return a fragment of the dn
`static String` | `getFormString(char[] delims)` Return a human-readable string representing the name of the passed DN delimiter.
`static String` | `getFormString(int dnForm)` Return a human-readable string representing the name of the passed DN format.
`String` | `getName(char[] delims)` `getName` return the unqualified "name" of the object (without path, but escaped)
`String` | `getNDSStreamURL()` `getNDSStreamURL` get the vnd.nds.stream URL representation of the URL
`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.
`String` | `getRDN(char[] delims, int count)` `getRDN` return an rdn containing the last count components
`String` | `getRelativeDN(XdsDN baseDN, char[] delims)` `getRelativeDN` get DN relative to another DN
`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(String[] args)`
`boolean` | `matchComponent(XdsDN.DNComponent c1, XdsDN.DNComponent c2)` check to see if two components match
`protected int` | `parseDN(String dn, char[] delims)` parses DN according to the delimiters
`static XdsDN` | `parseNDSURLForm(String urlFile)` `parseNDSURLForm` Create an XdsDN from filespec from a vnd.nds.* URL
`static String` | `quote(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(String name)` `setTreeName` sets the treename for the dn
`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

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SLASH_FORM

    public static final int SLASH_FORM

  Integer constant representing DN `"slash"` format.

  See Also:
    Constant Field Values

### QSLASH_FORM

    public static final int QSLASH_FORM

  Integer constant representing DN `"qualified-slash"` format.

  See Also:
    Constant Field Values

### DOT_FORM

    public static final int DOT_FORM

  Integer constant representing DN `"dot"` format.

  See Also:
    Constant Field Values

### QDOT_FORM

    public static final int QDOT_FORM

  Integer constant representing DN `"qualified-dot"` format.

  See Also:
    Constant Field Values

### LDAP_FORM

    public static final int LDAP_FORM

  Integer constant representing DN `"ldap"` format.

  See Also:
    Constant Field Values

### CUSTOM_FORM

    public static final int CUSTOM_FORM

  Integer constant representing DN `"custom"` format.

  See Also:
    Constant Field Values

### SLASH_DELIMS

    public static final String SLASH_DELIMS

  Delimiter set for "`slash"` DN format.

  See Also:
    Constant Field Values

### QSLASH_DELIMS

    public static final String QSLASH_DELIMS

  Delimiter set for `"qualified-slash"` DN format.

  See Also:
    Constant Field Values

### DOT_DELIMS

    public static final String DOT_DELIMS

  Delimiter set for `"dot"` DN format.

  See Also:
    Constant Field Values

### QDOT_DELIMS

    public static final String QDOT_DELIMS

  Delimiter set for `"qualified-dot"` DN format.

  See Also:
    Constant Field Values

### LDAP_DELIMS

    public static final String LDAP_DELIMS

  Delimiter set for `"ldap"` DN format.

  See Also:
    Constant Field Values

### DI_CFG_TYPED

    public static final int DI_CFG_TYPED

See Also:
  Constant Field Values

### DI_CFG_ESC_STRINGS

    public static final int DI_CFG_ESC_STRINGS

See Also:
  Constant Field Values

### DI_REL

    public static final int DI_REL

See Also:
  Constant Field Values

### DI_RDN

    public static final int DI_RDN

See Also:
  Constant Field Values

### DI_DV

    public static final int DI_DV

See Also:
  Constant Field Values

### DI_VALUE

    public static final int DI_VALUE

See Also:
  Constant Field Values

### DI_WILD

    public static final int DI_WILD

See Also:
  Constant Field Values

### DI_ESC

    public static final int DI_ESC

See Also:
  Constant Field Values

### DI_SIZE

    public static final int DI_SIZE

See Also:
  Constant Field Values

### DI_EXTRA_QUOTED

    public static final int DI_EXTRA_QUOTED

See Also:
  Constant Field Values

### DELIM_CFG_TRUE

    public static final char DELIM_CFG_TRUE

See Also:
  Constant Field Values

### DELIM_CFG_FALSE

    public static final char DELIM_CFG_FALSE

See Also:
  Constant Field Values

### illegalChars

    public static final String illegalChars

See Also:
  Constant Field Values

### SCOPE_SUBTREE

    public static final int SCOPE_SUBTREE

See Also:
  Constant Field Values

### SCOPE_SUBORDINATES

    public static final int SCOPE_SUBORDINATES

See Also:
  Constant Field Values

### SCOPE_ENTRY

    public static final int SCOPE_ENTRY

See Also:
  Constant Field Values

### ERR_NONE

    public static final int ERR_NONE

See Also:
  Constant Field Values

### ERR_INVALID_CHAR

    public static final int ERR_INVALID_CHAR

See Also:
  Constant Field Values

Constructor Detail

### XdsDN

    public XdsDN(String srcDN,
                 char[] delims)

  constructor

  Parameters:
    `srcDN` - dn to parse
    `delims` - delimiter to use for parse

### XdsDN

    public XdsDN(XdsDN original)

  copy constructor

  Parameters:
    `original` - dn to copy

Method Detail

### getDelims

    public static String getDelims(int dnForm)

  Return a `String` containing the delimiter set for the passed DN format.

  Parameters:
    `dnForm` - SLASH_FORM, QSLASH_FORM, DOT_FORM, QDOT_FORM, LDAP_FORM.
  Returns:
    `String` containing delimiter set or `null`, if argument is invalid.

### getDelims

    public static String getDelims(String dnForm)

  Return a `String` containing the delimiter set for the passed DN format.

  Parameters:
    `dnForm` - `"slash"`, `"qualified-slash"`, `"dot"`, `"qualified-dot"`, `"ldap"`.
  Returns:
    `String` containing delimiter set or `null`, if argument is invalid.

### getFormString

    public static String getFormString(int dnForm)

  Return a human-readable string representing the name of the passed DN format.

  Parameters:
    `dnForm` - SLASH_FORM, QSLASH_FORM, DOT_FORM, QDOT_FORM, LDAP_FORM, CUSTOM_FORM.
  Returns:
    `String` containing the name, or `"unknown"` if argument is invalid.

### getFormString

    public static String getFormString(char[] delims)

  Return a human-readable string representing the name of the passed DN delimiter.

  Parameters:
    `delims` - delimiters.
  Returns:
    `String` containing the name

### getParseErr

    public int getParseErr()

  Return any error that occurred while parsing a string as a DN.

  Returns:
    ERR_NONE, or error code.

### getComponentCount

    public int getComponentCount()

  `getComponentCount` return the number of components

  Returns:
    the number of components

### hasTreeName

    public boolean hasTreeName()

  `hasTreeName` returns whether or not the dn includes the tree name

  Returns:
    true if dn includes a tree name

### setHasTreeName

    public 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

  Parameters:
    `hasTreeName` - true if dn includes a tree name

### removeTreeName

    public void removeTreeName()

  `removeTreeName` remove the tree name component if it is there

### copyTreeName

    public void copyTreeName(XdsDN src)

  `copyTreeName` copies the tree name from another DN to this one

  Parameters:
    `src` - the other DN

### setTreeName

    public void setTreeName(String name)

  `setTreeName` sets the treename for the dn

  Parameters:
    `name` - the tree name

### getTreeName

    public String getTreeName()

  `getTreeName` gets the treename for the dn

  Returns:
    the tree name if one exists, `null` otherwise

### getName

    public String getName(char[] delims)

  `getName` return the unqualified "name" of the object (without path, but escaped)

  Parameters:
    `delims` - the delimiter set to use for escaping
  Returns:
    the "name" part of the DN

### getRDN

    public String getRDN(char[] delims,
                         int count)

  `getRDN` return an rdn containing the last count components

  Parameters:
    `delims` - the delimiter set for returned the name
    `count` - number of components to include in the suffix
  Returns:
    the rdn

### split

    public String[] split(char[] delims)

  `split` return the parent and the rdn

  Parameters:
    `delims` - the delimiter set for returned the name
  Returns:
    an array[0] = the parent, array[1] is the rdn

### getDNFragment

    public String getDNFragment(char[] delims,
                                int loIndex,
                                int count,
                                boolean includeRoot)

  `getDNFragment` return a fragment of the dn

  Parameters:
    `delims` - the delimiter set for returned the name
    `loIndex` - 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 get
    `includeRoot` - include the root if doing all components and has tree name
  Returns:
    the DNFragment

### getDN

    public String getDN(char[] delims)

  `getDN` get the whole DN

  Parameters:
    `delims` - the delimiter set for returned the name
  Returns:
    the whole DN in requested format

### getRelativeDN

    public String getRelativeDN(XdsDN baseDN,
                                char[] delims)

  `getRelativeDN` get DN relative to another DN

  Parameters:
    `delims` - the delimiter set for returned the name
  Returns:
    the whole DN in requested format

### parseDN

    protected int parseDN(String dn,
                          char[] delims)

  parses DN according to the delimiters

  Parameters:
    `dn` - the format desired to return the name in (DOT, SLASH, or LDAP)
    `delims` - the delimiter chars
  Returns:
    true if successful, false otherwise

### hasAncestor

    public boolean hasAncestor(XdsDN root)

  check to see if root is an ancestor of this dn

  Parameters:
    `root` - the ancestor in question
  Returns:
    true if root is ancestor, false otherwise

### checkScope

    public boolean checkScope(XdsDN base,
                              int scope)

  check if dn is in a particular scope

  Parameters:
    `base` - the base of the scope check
    `scope` - the scope relative to the base
  Returns:
    true if in scope

### equals

    public boolean equals(XdsDN dn)

  check if dn is equivalent

  Parameters:
    `dn` - to compare
  Returns:
    true or false

### matchComponent

    public boolean matchComponent(XdsDN.DNComponent c1,
                                  XdsDN.DNComponent c2)

  check to see if two components match

  Parameters:
    `c1` - first component
    `c2` - second component
  Returns:
    true if a match, false otherwise

### getComponent

    public XdsDN.DNComponent getComponent(int n)

  get the nth component

  Parameters:
    `n` - the index of the dn component to get (`0` is rootmost, `getComponentCount() - 1` is leafmost)
  Returns:
    the specified component

### validateDelims

    public static boolean validateDelims(char[] d)

  check a delimiter string to see if it could be valid

  Parameters:
    `d` - the delimiter chars
  Returns:
    true if valid, false otherwise

### quote

    public static String quote(String string,
                               char[] d)

  quote the special characters in a string

  Parameters:
    `d` - the delimiter chars
  Returns:
    true if valid, false otherwise

### appendComponent

    public static void appendComponent(StringBuffer sb,
                                       XdsDN.DNComponent component,
                                       char[] delims,
                                       boolean typed)

  Append a DN component to a StringBuffer.

  Parameters:
    `sb` - buffer to which to append.
    `component` - component to append
    `delims` - the delimiter set used to be used
    `typed` - true if type information is desired

### getNDSStreamURL

    public String getNDSStreamURL()

  `getNDSStreamURL` get the vnd.nds.stream URL representation of the URL

  Returns:
    the DN as a vnd.nds.stream URL

### getNDSURLForm

    public String getNDSURLForm()

  `getNDSURLForm` get the form of the DN suitable for use in vnd.nds.* URL

  Returns:
    the DN as a vnd.nds.stream URL

### parseNDSURLForm

    public static XdsDN parseNDSURLForm(String urlFile)

  `parseNDSURLForm` Create an XdsDN from filespec from a vnd.nds.* URL

  Parameters:
    `urlFile` - the filespec from a vnd.nds.* URL
  Returns:
    the XdsDN

### decodeURL

    public static String decodeURL(String s)

  Decode x-www-form-urlEncoded string.

  Parameters:
    `s` - String to be decoded
  Returns:
    the decoded String.

### encodeURL

    public static String encodeURL(String s)

  Encode x-www-form-urlEncoded string.

  Parameters:
    `s` - String to be encoded
  Returns:
    the encoded String.

### main

    public static void main(String[] args)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD