Package com.isode.dsapi.syntax.mhs
Class 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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.isode.dsapi.syntax.IsodeSyntax
IsodeSyntax.SyntaxInfo -
Field Summary
Fields inherited from class com.isode.dsapi.syntax.IsodeSyntax
asnVal, logger -
Constructor Summary
ConstructorsConstructorDescriptionRoutingFilter(byte[] ber) Construct a new object based on a byte array containing the BER representation of an RoutingFilter.Create a new RoutingFilter object from an existing ASN representation.RoutingFilter(AttributeType attributeType, int routeWeight, String ddaKey, String regexMatch, DN node) Construct a new object based on a set of fieldsCreate a new RoutingFilter object from a suitable AttributeValue.RoutingFilter(String str) Create a new RoutingFilter object from a string representation. -
Method Summary
Modifier and TypeMethodDescriptionDetermine the value of the attributetype component of this RoutingFilter.Determine the dda-key from this object.Return a reference to the underlying asn representation of this objectgetNode()Determine the node component of the RoutingFilter.Determine the regex-match from this object.intDetermine the routing weight of the RoutingFilter.protected IsodeSyntax.SyntaxInfoSubclasses must implement a method which returns a SyntaxInfo object that can be used by the IsodeSyntax class.protected voidparse(byte[] berRepresentation) Parse the specified byte array into asn representationvoidreset()Clear all fields in the object.voidsetAttributeType(AttributeType newAttributeType) Set the attributeType component of a RoutingFilter.voidsetDDAKeyPrintable(String newDDAKey) Set the dda-key component of a RoutingFilter.voidSet the node component of an RoutingFilter.voidsetRegexMatch(String newRegexMatch) Set the regex-match component of a RoutingFilter.voidsetRoutingWeight(int newRouteWeight) Set the weight component of a RoutingFilter.Methods inherited from class com.isode.dsapi.syntax.IsodeSyntax
equals, getAsnVal, getAttributeValue, getAttributeValue, getStringRepresentation, hashCode, isNumeric, isValid, isValidStringValue, set, toString
-
Constructor Details
-
RoutingFilter
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
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 RoutingFilterBadSyntaxException- it is not possible to parse RoutingFilter values
-
RoutingFilter
Create a new RoutingFilter object from a suitable AttributeValue.- Parameters:
av- AttributeValue. Must not be null.- Throws:
BadValueException- if av is not a valid RoutingFilterBadSyntaxException- it is not possible to parse RoutingFilter valuesNativeLibraryException- 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 weightddaKey- 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
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
Description copied from class:IsodeSyntaxSubclasses must implement a method which returns a SyntaxInfo object that can be used by the IsodeSyntax class.- Specified by:
getSyntaxInfoin classIsodeSyntax<MHSR.RoutingFilter>- Returns:
- a SyntaxInfo describing the syntax represented by the subclass.
- Throws:
BadSyntaxException- if no SyntaxInfo is available for this syntax.
-
parse
Parse the specified byte array into asn representation- Specified by:
parsein classIsodeSyntax<MHSR.RoutingFilter>- Parameters:
berRepresentation- putative value in BER- Throws:
BadValueException
-
getMhsrRoutingFilter
Return a reference to the underlying asn representation of this object- Returns:
- the MHSR.RoutingFilter object.
- Since:
- 14.4
-
getAttributeType
Determine the value of the attributetype component of this RoutingFilter.- Returns:
- an AttributeType.
- Throws:
BadAttributeTypeException- if it the RoutingFilter does not contain a valid AttributeTypeNativeLibraryException- if an unrecoverable error was detected by the native library
-
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
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
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
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
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 valueNullPointerException- 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
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
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:
resetin classIsodeSyntax<MHSR.RoutingFilter>- Since:
- 14.6
-