Class ORName

java.lang.Object
com.isode.dsapi.syntax.mhs.ORName

public class ORName extends Object
Class representation of an ORName value. The class makes use of the MTA.ORName to encode/decode an ORName. The ASN definition has:
ORName ::= [APPLICATION 0] SEQUENCE {
    standard-attributes StandardAttributes,
    domain-defined DomainDefinedAttributes OPTIONAL,
    extension-attributes ExtensionAttributes OPTIONAL,
    directory-name [0] EXPLICIT IF.Name OPTIONAL }

I.e. it is like an ORAddress with an optional directory name stuck on the end.

It is possible for an ORName object to exist which contains no value ("empty"): this is to allow callers to construct an object before they know what all the contents will be, so that they can subsequently use setter methods to populate it.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name of the attribute expected to be present in the schema for this syntax.
    static final String
    The name of the attribute type expected to be in the schema for this syntax.
    static final int
     
    static final int
    O/R name component IDs.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an empty object.
    ORName(byte[] ber)
    Create a new ORName object from a BER encoding
    Create a new ORName object from an existing ASN value.
    Create a new ORName object from a string representation.
  • Method Summary

    Modifier and Type
    Method
    Description
    get(int comp)
    Get an O/R name component, i.e.
    Return a reference to the ASN object corresponding to the ORName
    Derive an AttributeValue from the object.
    Return the DN component of this ORName, if present
    Get the DN as a String.
    Derive an ORAddress from this ORName.
    Get the O/R address as a String.
    Return the O/R Name string value.
    boolean
    Does this object represent a valid ORName?
    void
    Clear all the fields in the object.
    void
    set(int comp, String str_val)
    Set an O/R name component, i.e.
    void
    set(String str)
    Set the O/R name value from string.
    void
    setDN(DN newval)
    Set the DN component of the ORName
    void
    setDN(String newval)
    Set the DN component of the ORName
    void
    Set the "ORAddress" component of this ORName, leaving any DN unchanged
    Return the O/R Name string value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • ORName

      public ORName()
      Create an empty object. This will not be a valid ORName, but can become one as fields are set appropriately.
    • ORName

      public ORName(MTA.ORName val)
      Create a new ORName object from an existing ASN value.
      Parameters:
      val - an ASN value, which must not be null. The contents of this object will be copied.
      Since:
      14.4
    • ORName

      public ORName(String str) throws BadValueException, BadSyntaxException
      Create a new ORName object from a string representation.
      Parameters:
      str - String representation. A null value, or blank String ("") creates an empty object.
      Throws:
      BadValueException - if str is not a valid ORName.
      BadSyntaxException - if the schema does not know about ORName.
    • ORName

      public ORName(byte[] ber) throws BadValueException
      Create a new ORName object from a BER encoding
      Parameters:
      ber - BER encoding or ORName
      Throws:
      BadValueException - if ber is not a valid encoding.
  • Method Details

    • set

      public void set(String str) throws BadValueException, BadSyntaxException
      Set the O/R name value from string.
      Parameters:
      str -
      Throws:
      BadValueException - if or_name_str contains an illegal value
      BadSyntaxException - if the schema does not know about ORName.
    • getDN

      public DN getDN()
      Return the DN component of this ORName, if present
      Returns:
      a DN, or null if no DN is present
    • setDN

      public void setDN(DN newval)
      Set the DN component of the ORName
      Parameters:
      newval - new DN, which may be null to clear the DN component.
    • setDN

      public void setDN(String newval) throws BadDNException
      Set the DN component of the ORName
      Parameters:
      newval - String representation of new DN, which may be null to clear the DN component.
      Throws:
      BadDNException
    • setORAddress

      public void setORAddress(ORAddress ora)
      Set the "ORAddress" component of this ORName, leaving any DN unchanged
      Parameters:
      ora - ORAddress, which may be null or empty to remove all ORAddress fields.
    • getORAddress

      public ORAddress getORAddress()
      Derive an ORAddress from this ORName.
      Returns:
      ORAddress. The returned value is a copy of the value in this object, not a reference to it.
    • set

      public void set(int comp, String str_val) throws BadValueException, BadSyntaxException
      Set an O/R name component, i.e. the DN or O/R address.
      Parameters:
      comp - Component ID; one of ORName.DN or ORName.ORADDRESS
      str_val - Component string value.
      Throws:
      BadValueException
      BadSyntaxException - if the schema does not know about ORName.
    • get

      public String get(int comp)
      Get an O/R name component, i.e. the DN or O/R address.
      Parameters:
      comp - Component ID.
      Returns:
      Component string value, null if no component value.
    • getDNString

      public String getDNString()
      Get the DN as a String.
      Returns:
      Return the DN string, null if not set.
    • getORAddressString

      public String getORAddressString()
      Get the O/R address as a String.
      Returns:
      Return the O/R address string, null if not set.
    • reset

      public void reset()
      Clear all the fields in the object. The object will not be a valid ORName, but may become one if fields inside it are set appropriately.
    • getAttributeValue

      Derive an AttributeValue from the object. To do this, callers must provide a suitable AttributeType object (which is required in order to construct a new AttributeValue).
      Parameters:
      at - an AttributeType which should be used to create the new AttributeValue
      Returns:
      an AttributeValue, whose type will be determined by at and whose value is derived from this object
      Throws:
      BadAttributeTypeException - if at is not an AttributeType which has ORName syntax.
      BadValueException - if it is not possible to create an AttributeValue representation of this object.
      BadSyntaxException - if the schema does not know about ORName.
      Since:
      14.4
    • getString

      public String getString() throws BadValueException, BadSyntaxException
      Return the O/R Name string value.
      Returns:
      String representation of O/R name
      Throws:
      BadSyntaxException
      BadValueException
      Since:
      14.5
      See Also:
    • toString

      public String toString()
      Return the O/R Name string value.
      Overrides:
      toString in class Object
      Returns:
      String representation of O/R name, or the empty string ("") if not set or invalid. (Use getString() if failures aren't to be silently ignored).
      See Also:
    • getASN

      public MTA.ORName getASN()
      Return a reference to the ASN object corresponding to the ORName
      Returns:
      an ASN object containing the ORName
    • isValid

      public boolean isValid()
      Does this object represent a valid ORName?
      Returns:
      true if this is a valid ORName, false otherwise.