Package com.isode.dsapi.syntax.mhs
Class Redirect
Class representation of a Redirect value. Users may create
values from Strings, BER, or AttributeValue objects.
This class works by holding an
MHSR.Redirect
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 Redirect, which says it looks like this:
Redirect ::= SEQUENCE OF SEQUENCE { or-name ORName, reason RedirectionReason, -- from X.411 filter CHOICE { min-size [1] INTEGER, max-size [1] INTEGER, content [3] ContentType, eit [4] ExternalEncodedInformationType } OPTIONAL }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.6
- Author:
- tc
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumerated values representing RedirectionReason.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
ConstructorsConstructorDescriptionRedirect()
Create an empty object.Redirect
(byte[] ber) Construct a new object based on a byte array containing the BER representation of an RedirectRedirect
(int numelems) Redirect
(MHSR.Redirect val) Create a new Redirect object from an existing ASN representation.Create a new Redirect object from a suitable AttributeValue.Create a new Redirect object from a string representation. -
Method Summary
Modifier and TypeMethodDescriptionAdd
(ORName orname, Redirect.RedirectionReason reason, Integer min_size, Integer max_size, Oid content_type, Oid eit) Add
(ORName orname, Redirect.RedirectionReason reason, Integer min_size, Integer max_size, Oid content_type, Oid eit, int index) Add new Redirect_value object based on a set of fieldsgetContentType
(int index) getEIT
(int index) getFilter
(int index) getMaxSize
(int index) Return a reference to the underlying asn representation of this objectgetMinSize
(int index) getORName
(int index) Determine the value of the ORName component of this Redirect.getRedirectionReason
(int index) Determine the RedirectionReason component of the Redirect element.protected IsodeSyntax.SyntaxInfo
Subclasses must implement a method which returns a SyntaxInfo object that can be used by the IsodeSyntax class.protected void
parse
(byte[] berRepresentation) Parse the specified byte array into asn representationvoid
reset()
Clear all fields in the object.void
setContentType
(int index, Oid contentType) Set the ContentType field of a Redirect element.void
Set the Eit field of a Redirect element.void
setMaxSize
(int index, Integer size) Set the maxSize file of a Redirect element.void
setMinSize
(int index, Integer size) Set the minSize file of a Redirect element.void
Set the ORName component of a Redirect element.void
setRedirectionReason
(int index, Redirect.RedirectionReason reason) Set the RedirectionReason of a Redirect element.Methods inherited from class com.isode.dsapi.syntax.IsodeSyntax
equals, getAsnVal, getAttributeValue, getAttributeValue, getStringRepresentation, hashCode, isNumeric, isValid, isValidStringValue, set, toString
-
Constructor Details
-
Redirect
Create a new Redirect object from an existing ASN representation.- Parameters:
val
- an ASN value, which must not be null. The contents of this object will be copied.
-
Redirect
Create a new Redirect object from a string representation.- Parameters:
str
- String representation. Must not be null.- Throws:
BadValueException
- if str is not a valid RedirectBadSyntaxException
- it is not possible to parse Redirect values
-
Redirect
Create a new Redirect object from a suitable AttributeValue.- Parameters:
av
- AttributeValue. Must not be null.- Throws:
BadValueException
- if av is not a valid RedirectBadSyntaxException
- it is not possible to parse Redirect valuesNativeLibraryException
- if an unrecoverable error was detected by the native library
-
Redirect
public Redirect()Create an empty object. This may not be a valid Redirect, but can become one as fields are set appropriately.- See Also:
-
Redirect
public Redirect(int numelems) -
Redirect
Construct a new object based on a byte array containing the BER representation of an Redirect- Parameters:
ber
- BER representation of a Redirect value- Throws:
BadValueException
- if ber doesn't hold a valid Redirect value
-
-
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<MHSR.Redirect>
- 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:
parse
in classIsodeSyntax<MHSR.Redirect>
- Parameters:
berRepresentation
- putative value in BER- Throws:
BadValueException
-
Add
public MHSR.Redirect_value Add(ORName orname, Redirect.RedirectionReason reason, Integer min_size, Integer max_size, Oid content_type, Oid eit, int index) throws BadValueException Add new Redirect_value object based on a set of fields- Throws:
BadValueException
- if the supplied values cannot be converted into a Redirect_value
-
Add
public MHSR.Redirect_value Add(ORName orname, Redirect.RedirectionReason reason, Integer min_size, Integer max_size, Oid content_type, Oid eit) throws BadValueException - Throws:
BadValueException
-
getMhsrRedirect
Return a reference to the underlying asn representation of this object- Returns:
- the MHSR.Redirect object.
-
getORName
Determine the value of the ORName component of this Redirect.- Returns:
- an ORName.
- Throws:
BadException
- if it the RedirectFilter does not contain a valid ORNameNativeLibraryException
- if an unrecoverable error was detected by the native libraryBadValueException
IndexOutOfBoundsException
-
getRedirectionReason
Determine the RedirectionReason component of the Redirect element.- Returns:
- a RedirectionReason.
- Throws:
IndexOutOfBoundsException
-
getFilter
- Throws:
IndexOutOfBoundsException
-
setORName
public void setORName(int index, ORName newORName) throws IndexOutOfBoundsException, NullPointerException Set the ORName component of a Redirect element. Other fields remain unchanged.- Parameters:
newORName
- the new ORName to be used (must not be null).- Throws:
NullPointerException
- if newORName is null.IndexOutOfBoundsException
-
setRedirectionReason
public void setRedirectionReason(int index, Redirect.RedirectionReason reason) throws IndexOutOfBoundsException, NullPointerException Set the RedirectionReason of a Redirect element. Other fields remain unchanged.- Parameters:
reason
- the new RedirectionReason to be used (must not be null).- Throws:
NullPointerException
- if newNode is null.IndexOutOfBoundsException
-
setMinSize
public void setMinSize(int index, Integer size) throws IndexOutOfBoundsException, NullPointerException Set the minSize file of a Redirect element. Other fields remain unchanged.- Parameters:
size
- the new size to be used (must not be null).- Throws:
NullPointerException
- if newNode is null.IndexOutOfBoundsException
-
getMinSize
-
setMaxSize
public void setMaxSize(int index, Integer size) throws IndexOutOfBoundsException, NullPointerException Set the maxSize file of a Redirect element. Other fields remain unchanged.- Parameters:
size
- the new size to be used (must not be null).- Throws:
NullPointerException
- if newNode is null.IndexOutOfBoundsException
-
getMaxSize
-
setContentType
public void setContentType(int index, Oid contentType) throws IndexOutOfBoundsException, NullPointerException Set the ContentType field of a Redirect element. Other fields remain unchanged.- Parameters:
contentType
- the new value to be used (must not be null).- Throws:
NullPointerException
- if newNode is null.IndexOutOfBoundsException
-
getContentType
-
setEIT
Set the Eit field of a Redirect element. Other fields remain unchanged.- Parameters:
eit
- the new value to be used (must not be null).- Throws:
NullPointerException
- if eit is null.IndexOutOfBoundsException
-
getEIT
-
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 classIsodeSyntax<MHSR.Redirect>
- Since:
- 14.6
-