Class RoutingFilter


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

This class works by holding an MHSR.RoutingFilter 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 RoutingFilter, which says it looks like this:

 RoutingFilter ::= SEQUENCE{
       attribute-type OBJECT-IDENTIFIER,
       weight RouteWeight,
       dda-key String OPTIONAL,
       regex-match IA5String OPTIONAL,
       node DistinguishedName }
 
This class supports access (via set and get methods) to all of the above fields. Note though that while "dda-key" is a CHOICE of either PrintableString or TeletexString, this class only supports access to the PrintableString option.
Author:
nh
  • Constructor Details

    • RoutingFilter

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

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

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

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

      public RoutingFilter(byte[] ber) throws BadValueException
      Construct a new object based on a byte array containing the BER representation of an RoutingFilter.
      Parameters:
      ber - BER representation of a RoutingFilter value
      Throws:
      BadValueException - if ber doesn't hold a valid RoutingFilter value
      Since:
      14.4
  • 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.RoutingFilter>
      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.RoutingFilter>
      Parameters:
      berRepresentation - putative value in BER
      Throws:
      BadValueException
    • getMhsrRoutingFilter

      public MHSR.RoutingFilter getMhsrRoutingFilter()
      Return a reference to the underlying asn representation of this object
      Returns:
      the MHSR.RoutingFilter object.
      Since:
      14.4
    • getAttributeType

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

      public DN getNode()
      Determine the node component of the RoutingFilter.
      Returns:
      a DN containing the RoutingFilter's node. This will be null in the case that the value in the object cannot be represented as a DN object.
    • getRouteWeight

      public int getRouteWeight()
      Determine the routing weight of the RoutingFilter.
      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.
    • setAttributeType

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

      public void setNode(DN newNode) throws BadValueException
      Set the node component of an RoutingFilter. Other fields remain unchanged.

      If an error is detected with the specified value, an exception will be thrown, and the object retains its original value.

      Parameters:
      newNode - the new DN to be used (must not be null).
      Throws:
      BadValueException - if dn is not a valid node value
      NullPointerException - if newNode is null.
    • setRoutingWeight

      public void setRoutingWeight(int newRouteWeight)
      Set the weight component of a RoutingFilter. 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 RoutingFilter. 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 RoutingFilter. 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 RoutingFilter, but may become one if fields inside it are set appropriately.
      Specified by:
      reset in class IsodeSyntax<MHSR.RoutingFilter>
      Since:
      14.6