Package com.isode.dsapi.syntax
Class MASAP
java.lang.Object
com.isode.dsapi.syntax.IsodeSyntax<MASAPSyntax.MasterAndShadowAccessPoints>
com.isode.dsapi.syntax.MASAP
- All Implemented Interfaces:
Comparable<MASAP>
public class MASAP
extends IsodeSyntax<MASAPSyntax.MasterAndShadowAccessPoints>
implements Comparable<MASAP>
Class representation of MASAP. A MASAP object may be constructed using an
appropriate AttributeValue.
This is an immutable class.
This class works by holding an MASAPSyntax.MasterAndShadowAccessPoints
object,
and providing a slightly more user-friendly set of methods which access and
manipulate fields inside that object.
The ASN for a MASAP is:
MasterOrShadowAccessPoint ::= SET { COMPONENTS OF AccessPoint, category [3] ENUMERATED { master (0), shadow (1) } DEFAULT 0 } MasterAndShadowAccessPoints ::= SET OF MasterOrShadowAccessPoint
- Since:
- 15.0
- Author:
- mv
-
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
-
Constructor Summary
ConstructorsConstructorDescriptionMASAP
(byte[] ber) Construct a new object based on a byte array containing the BER representation of a MASAP.MASAP
(AttributeValue av) Create a new MASAP object from a suitable AttributeValue.Create a new MASAP object from a String representationCreate an MASAP object using given data. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
Performs equality testing using the syntax handler for the relevant attribute type.The addresses are converted to their canonical forms.protected IsodeSyntax.SyntaxInfo
Subclasses must implement a method which returns a SyntaxInfo object that can be used by the IsodeSyntax class.int
hashCode()
Returns a hashcode suitable for use by the Collection classesprotected void
parse
(byte[] berRepresentation) Decode the specifed byte array into ASN representationvoid
reset()
Clear all fields in the object.Methods inherited from class com.isode.dsapi.syntax.IsodeSyntax
getAsnVal, getAttributeValue, getAttributeValue, getStringRepresentation, isNumeric, isValid, isValidStringValue, set, toString
-
Constructor Details
-
MASAP
Create a new MASAP object from a suitable AttributeValue.- Parameters:
av
- AttributeValue. Must not be null.- Throws:
BadValueException
- if av is not a valid MASAPBadSyntaxException
- it is not possible to parse MASAP values
-
MASAP
Construct a new object based on a byte array containing the BER representation of a MASAP.- Parameters:
ber
- BER representation of a MASAP value. This must never be null.- Throws:
BadValueException
- if ber doesn't hold a valid MASAP valueBadSyntaxException
- if it is not possible to parse the MASAP.
-
MASAP
Create a new MASAP object from a String representation- Parameters:
str
- String representation; must not be null- Throws:
BadValueException
- if str is not a valid MASAPBadSyntaxException
- if it is not possible to parse MASAP values
-
MASAP
Create an MASAP object using given data.- Parameters:
newMosapList
- list of addresses, must not be null- Throws:
BadValueException
- If there are encoding errorsBadSyntaxException
- if it is not possible to parse MASAP objects in this environment.
-
-
Method Details
-
getSyntaxInfo
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 classIsodeSyntax<MASAPSyntax.MasterAndShadowAccessPoints>
- Returns:
- a SyntaxInfo describing the syntax represented by the subclass.
- Throws:
BadSyntaxException
- if no SyntaxInfo is available for this syntax.
-
parse
Decode the specifed byte array into ASN representation- Specified by:
parse
in classIsodeSyntax<MASAPSyntax.MasterAndShadowAccessPoints>
- Parameters:
berRepresentation
- putative value in BER- Throws:
BadValueException
-
reset
public void reset()Description copied from class:IsodeSyntax
Clear all fields in the object. Following this operation, the object may not be a valid value, so may need to have fields set in it to become one.Subclasses should implement a method which clears all the asn fields, e.g.
asnVal = new MHSR.GlobalDomainIdentifier(); asnVal.setAdministration_domain_name(new AdministrationDomainName()); asnVal.setCountry_name(new CountryName());
Note that this method is called by theIsodeSyntax()
constructor.- Specified by:
reset
in classIsodeSyntax<MASAPSyntax.MasterAndShadowAccessPoints>
-
getAddressList
- Returns:
- List containing the addresses. This will never be null.
-
getCanonicalForm
The addresses are converted to their canonical forms. The address list is sorted and duplicates are removed.- Returns:
- canonical form of object.
- Throws:
BadSyntaxException
- if it is not possible to parse the MASAP values.
-
equals
Description copied from class:IsodeSyntax
Performs equality testing using the syntax handler for the relevant attribute type.Note that this method uses JNI to constructs AttributeValues and then call the syntax handler's comparison function, so it may not be ideal for use in resource-constrained situations (e.g. calling it loads of times in a loop)
- Overrides:
equals
in classIsodeSyntax<MASAPSyntax.MasterAndShadowAccessPoints>
- Parameters:
other
- another object of the same attribute type- Returns:
- true if other is the same object, or one which has a valid value that matches this object's value so far as the syntax handler is concerned. A value of false means that object contains a different value, or that it is not possible to compare the values because no suitable syntax handler is available.
-
hashCode
public int hashCode()Description copied from class:IsodeSyntax
Returns a hashcode suitable for use by the Collection classes- Overrides:
hashCode
in classIsodeSyntax<MASAPSyntax.MasterAndShadowAccessPoints>
- Returns:
- a hash code value for this object.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<MASAP>
-