Class RedirectFilter

java.lang.Object
com.isode.dsapi.syntax.IsodeSyntax<MHSR.RedirectFilter>
com.isode.dsapi.syntax.mhs.RedirectFilter

public class RedirectFilter extends IsodeSyntax<MHSR.RedirectFilter>
Class representation of an RedirectFilter value. Users may create values from Strings, BER, or AttributeValue objects.

This class works by holding an MHSR.RedirectFilter object, and providing a slightly more user-friendly set of methods which access and manipulate fields inside that object. See RFC 1801 for description of RedirectFilter, which says it looks like this:

RedirectFilter ::= SEQUENCE {
    attribute-type OBJECT IDENTIFIER,
    weight RouteWeight,
    dda-key DDAKeyString OPTIONAL,
    regex-match IA5String OPTIONAL,
    reason RedirectionReason,
    orname ORName 
}
This class supports access (via set and get methods) to all of the above fields. The enum RedirectionReason can be used to access reason fields in the object.
Since:
14.4
Author:
nh
  • Constructor Details

    • RedirectFilter

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

      public RedirectFilter(String str) throws BadValueException, BadSyntaxException
      Create a new RedirectFilter object from a string representation.
      Parameters:
      str - String representation. Must not be null.
      Throws:
      BadValueException - if str is not a valid RedirectFilter
      BadSyntaxException - it is not possible to parse RedirectFilter values
    • RedirectFilter

      public RedirectFilter(AttributeValue av) throws BadValueException, BadSyntaxException
      Create a new RedirectFilter object from a suitable AttributeValue.
      Parameters:
      av - AttributeValue. Must not be null.
      Throws:
      BadValueException - if av is not a valid RedirectFilter
      BadSyntaxException - it is not possible to parse RedirectFilter values
      NativeLibraryException - if an unrecoverable error was detected by the native library
    • RedirectFilter

      public RedirectFilter(AttributeType attributeType, int weight, String ddaKey, String regexMatch, RedirectFilter.RedirectionReason reason, ORName orname) throws BadValueException
      Construct a new object based on a set of fields
      Parameters:
      attributeType - attribute type (must not be null)
      weight - routing weight
      ddaKey - PrintableString dda-key value (may be null)
      regexMatch - regex-match (may be null)
      reason - redirection reason (must not be null)
      orname - ORName (must not be null)
      Throws:
      BadValueException - if the supplied values cannot be converted into a RedirectFilter
    • RedirectFilter

      public RedirectFilter(byte[] ber) throws BadValueException
      Construct a new object based on a byte array containing the BER representation of an RedirectFilter.
      Parameters:
      ber - BER representation of a RedirectFilter value
      Throws:
      BadValueException - if ber doesn't hold a valid RedirectFilter value
  • Method Details

    • getSyntaxInfo

      protected IsodeSyntax.SyntaxInfo getSyntaxInfo() throws BadSyntaxException
      Description copied from class: IsodeSyntax
      Subclasses must implement a method which returns a SyntaxInfo object that can be used by the IsodeSyntax class.
      Specified by:
      getSyntaxInfo in class IsodeSyntax<MHSR.RedirectFilter>
      Returns:
      a SyntaxInfo describing the syntax represented by the subclass.
      Throws:
      BadSyntaxException - if no SyntaxInfo is available for this syntax.
    • parse

      protected void parse(byte[] berRepresentation) throws BadValueException
      Parse the specified byte array into asn representation
      Specified by:
      parse in class IsodeSyntax<MHSR.RedirectFilter>
      Parameters:
      berRepresentation - putative value in BER
      Throws:
      BadValueException
    • getMhsrRedirectFilter

      public MHSR.RedirectFilter getMhsrRedirectFilter()
      Return a reference to the underlying asn representation of this object
      Returns:
      the MHSR.RedirectFilter object.
    • getAttributeType

      public AttributeType getAttributeType() throws BadAttributeTypeException
      Determine the value of the attributetype component of this RedirectFilter.
      Returns:
      an AttributeType.
      Throws:
      BadAttributeTypeException - if it the RedirectFilter does not contain a valid AttributeType
      NativeLibraryException - if an unrecoverable error was detected by the native library
    • getRedirectionReason

      public RedirectFilter.RedirectionReason getRedirectionReason()
      Determine the RedirectionReason component of the RedirectFilter.
      Returns:
      a RedirectionReason.
    • getRouteWeight

      public int getRouteWeight()
      Determine the routing weight of the RedirectFilter.
      Returns:
      an integer representing the routing weight. Lower values are "better".
    • getddaKeyPrintable

      public String getddaKeyPrintable()
      Determine the dda-key from this object. A dda-key may be held as either a PrintableString or TeletexString. This method returns the PrintableString (if present), or null if no PrintableString representation is available.
      Returns:
      the PrintableString representation of the dda-key, which may be null if none is present.
    • getRegexMatch

      public String getRegexMatch()
      Determine the regex-match from this object.
      Returns:
      the String representation of the regex-match, which may be null if no value is present.
    • getORName

      public ORName getORName()
      Determine the ORName component in this RedirectFilter
      Returns:
      an ORName
    • setAttributeType

      public void setAttributeType(AttributeType newAttributeType)
      Set the attributeType component of a RedirectFilter. Other fields remain unchanged.
      Parameters:
      newAttributeType - the new AttributeType to be used (must not be null).
      Throws:
      NullPointerException - if newAttributeType is null.
    • setRedirectionReason

      public void setRedirectionReason(RedirectFilter.RedirectionReason reason)
      Set the RedirectionReason of an RedirectFilter. Other fields remain unchanged.
      Parameters:
      reason - the new RedirectionReason to be used (must not be null).
      Throws:
      NullPointerException - if newNode is null.
    • setORName

      public void setORName(ORName orname)
    • setRoutingWeight

      public void setRoutingWeight(int newRouteWeight)
      Set the weight component of a RedirectFilter. Other fields remain unchanged.
      Parameters:
      newRouteWeight - the new weight to be used.
    • setRegexMatch

      public void setRegexMatch(String newRegexMatch)
      Set the regex-match component of a RedirectFilter. Other fields remain unchanged.
      Parameters:
      newRegexMatch - the new weight to be used (which may be null).
    • setDDAKeyPrintable

      public void setDDAKeyPrintable(String newDDAKey)
      Set the dda-key component of a RedirectFilter. Other fields remain unchanged. A dda-key may be held as either a PrintableString or TeletexString. This method sets the PrintableString value (which means any existing PrintableString or TeletexString value will be lost).
      Parameters:
      newDDAKey - the new PrintableString dda-key to be used (which may be null).
    • reset

      public void reset()
      Clear all fields in the object. The object may not be a valid RedirectFilter, but may become one if fields inside it are set appropriately.
      Specified by:
      reset in class IsodeSyntax<MHSR.RedirectFilter>
      Since:
      14.6