Package com.isode.dsapi.syntax.mhs
Class ORName
java.lang.Object
com.isode.dsapi.syntax.mhs.ORName
Class representation of an ORName value. The class makes use
of the
MTA.ORName to encode/decode
an ORName. The ASN definition has:
ORName ::= [APPLICATION 0] SEQUENCE {
standard-attributes StandardAttributes,
domain-defined DomainDefinedAttributes OPTIONAL,
extension-attributes ExtensionAttributes OPTIONAL,
directory-name [0] EXPLICIT IF.Name OPTIONAL }
I.e. it is like an ORAddress with an optional directory name stuck on the end.
It is possible for an ORName object to exist which contains no value ("empty"): this is to allow callers to construct an object before they know what all the contents will be, so that they can subsequently use setter methods to populate it.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget(int comp) Get an O/R name component, i.e.getASN()Return a reference to the ASN object corresponding to the ORNameDerive an AttributeValue from the object.getDN()Return the DN component of this ORName, if presentGet the DN as a String.Derive an ORAddress from this ORName.Get the O/R address as a String.Return the O/R Name string value.booleanisValid()Does this object represent a valid ORName?voidreset()Clear all the fields in the object.voidSet an O/R name component, i.e.voidSet the O/R name value from string.voidSet the DN component of the ORNamevoidSet the DN component of the ORNamevoidsetORAddress(ORAddress ora) Set the "ORAddress" component of this ORName, leaving any DN unchangedtoString()Return the O/R Name string value.
-
Field Details
-
avType
The name of the attribute type expected to be in the schema for this syntax.- See Also:
-
avName
The name of the attribute expected to be present in the schema for this syntax.- See Also:
-
ORADDRESS
public static final int ORADDRESSO/R name component IDs.- See Also:
-
DN
public static final int DN- See Also:
-
-
Constructor Details
-
ORName
public ORName()Create an empty object. This will not be a valid ORName, but can become one as fields are set appropriately. -
ORName
Create a new ORName object from an existing ASN value.- Parameters:
val- an ASN value, which must not be null. The contents of this object will be copied.- Since:
- 14.4
-
ORName
Create a new ORName object from a string representation.- Parameters:
str- String representation. A null value, or blank String ("") creates an empty object.- Throws:
BadValueException- if str is not a valid ORName.BadSyntaxException- if the schema does not know about ORName.
-
ORName
Create a new ORName object from a BER encoding- Parameters:
ber- BER encoding or ORName- Throws:
BadValueException- if ber is not a valid encoding.
-
-
Method Details
-
set
Set the O/R name value from string.- Parameters:
str-- Throws:
BadValueException- if or_name_str contains an illegal valueBadSyntaxException- if the schema does not know about ORName.
-
getDN
Return the DN component of this ORName, if present- Returns:
- a DN, or null if no DN is present
-
setDN
Set the DN component of the ORName- Parameters:
newval- new DN, which may be null to clear the DN component.
-
setDN
Set the DN component of the ORName- Parameters:
newval- String representation of new DN, which may be null to clear the DN component.- Throws:
BadDNException
-
setORAddress
Set the "ORAddress" component of this ORName, leaving any DN unchanged- Parameters:
ora- ORAddress, which may be null or empty to remove all ORAddress fields.
-
getORAddress
Derive an ORAddress from this ORName.- Returns:
- ORAddress. The returned value is a copy of the value in this object, not a reference to it.
-
set
Set an O/R name component, i.e. the DN or O/R address.- Parameters:
comp- Component ID; one of ORName.DN or ORName.ORADDRESSstr_val- Component string value.- Throws:
BadValueExceptionBadSyntaxException- if the schema does not know about ORName.
-
get
Get an O/R name component, i.e. the DN or O/R address.- Parameters:
comp- Component ID.- Returns:
- Component string value, null if no component value.
-
getDNString
Get the DN as a String.- Returns:
- Return the DN string, null if not set.
-
getORAddressString
Get the O/R address as a String.- Returns:
- Return the O/R address string, null if not set.
-
reset
public void reset()Clear all the fields in the object. The object will not be a valid ORName, but may become one if fields inside it are set appropriately. -
getAttributeValue
public AttributeValue getAttributeValue(AttributeType at) throws BadAttributeTypeException, BadValueException, BadSyntaxException Derive an AttributeValue from the object. To do this, callers must provide a suitable AttributeType object (which is required in order to construct a new AttributeValue).- Parameters:
at- an AttributeType which should be used to create the new AttributeValue- Returns:
- an AttributeValue, whose type will be determined by at and whose value is derived from this object
- Throws:
BadAttributeTypeException- if at is not an AttributeType which has ORName syntax.BadValueException- if it is not possible to create an AttributeValue representation of this object.BadSyntaxException- if the schema does not know about ORName.- Since:
- 14.4
-
getString
Return the O/R Name string value.- Returns:
- String representation of O/R name
- Throws:
BadSyntaxExceptionBadValueException- Since:
- 14.5
- See Also:
-
toString
Return the O/R Name string value. -
getASN
Return a reference to the ASN object corresponding to the ORName- Returns:
- an ASN object containing the ORName
-
isValid
public boolean isValid()Does this object represent a valid ORName?- Returns:
- true if this is a valid ORName, false otherwise.
-