Class BindProfileAddress
- All Implemented Interfaces:
Comparable<BindProfileAddress>
LDAP and LDAPS are used to support the bind profile ldap & ldaps url's. DAP is provided for those who are used to seeing single ITOT network addresses as "DAP" in their bind profile editors. "Advanced" allows support for any type of valid presentation address. "XMPP" is used for storing M-Link server administration details. "Other" is supported because it seems some users may want to put anything else as a bind profile address.
This is an immutable class.
Examples:
LDAP: ldap://localhost:29389
LDAPS: ldaps://localhost
DAP: URI+0000+URL+itot://localhost:29999
Advanced: "0aZ-."/ '0aff'H/'00'H/TELEX+00728722+IP-APP+11+127.0.0.1|URI+0000+URL+itot://[FFEF::1 ]
XMPP: xmpp://isode.com
Other: Anything else
- Since:
- 15.0
- Author:
- mv
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
An enumeration defining the different address types that can be used to create a bind profile. -
Constructor Summary
ConstructorsConstructorDescriptionBindProfileAddress
(BindProfileAddress bpaToCopy, String hostName, int portNo) Creates a copy of a given BindProfileAddress.Constructor to create an object with the given data.BindProfileAddress
(URIData uriData) Constructor to create a bind profile address of the type AddressType.LDAP AddressType.LDAPS or AddressType.XMPP.BindProfileAddress
(String str) Constructor to create an object with the given data. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
Returns the type of the bind profile address.static ArrayList<BindProfileAddress>
Creates a list of unique bindable addresses from the network addresses in the given presentation address.The URI data and presentation address are converted to their canonical forms.Return a String containing a short "user-friendly" version of the BindProfileAddress.getHost()
Returns the host name of the bind profile address if the bind profile address is not of the ADVANCED or OTHER type.Returns a String containing the names of any hosts that are contained in this object.static BindProfileAddress
Returns the most bindable address in the given presentation address.getOther()
Returns the bind profile address in the form of Other string.int
getPort()
Returns the port of the bind profile address if the bind profile address is not of the ADVANCED or OTHER type.Returns the bind profile address in the form of a presentation address.Returns a String representation of this object, which can be used inBindProfileAddress(String)
to construct another object that has the equivalent value.Returns the bind profile address in the form of URI data.int
hashCode()
toString()
Returns a String representation of this BindProfileAddress.
-
Constructor Details
-
BindProfileAddress
Constructor to create an object with the given data.- Parameters:
str
- String representation of the bind profile address.- Throws:
BadValueException
- if the input is invalid.BadSyntaxException
- if it is not possible to parse the presentation address.
-
BindProfileAddress
Constructor to create an object with the given data.- Parameters:
pa
- Bind profile address in the form of a presentation address.- Throws:
BadValueException
- if the input is invalid.
-
BindProfileAddress
Constructor to create a bind profile address of the type AddressType.LDAP AddressType.LDAPS or AddressType.XMPP.- Parameters:
uriData
- URI data to create address with- Throws:
BadValueException
- if the input is invalid.
-
BindProfileAddress
public BindProfileAddress(BindProfileAddress bpaToCopy, String hostName, int portNo) throws BadValueException, BadSyntaxException Creates a copy of a given BindProfileAddress. But with the hostName and portNo replaced by the given values.- Parameters:
bpaToCopy
- The BindProfileAddress to copy. This can not benull
.hostName
- The new value for host name. This can not benull
.portNo
- The new value for port no.- Throws:
BadValueException
- If any of the input is invalidBadSyntaxException
- If it was not possible to parse the PresentationAddress.- Since:
- 16.0
-
-
Method Details
-
getAddressType
Returns the type of the bind profile address.- Returns:
- Type of the bind profile address.
-
getStringRepresentation
Returns a String representation of this object, which can be used inBindProfileAddress(String)
to construct another object that has the equivalent value.- Returns:
- a String representation of the object, suitable for re-creating an equivalent BindProfileAddress object.
-
toString
Returns a String representation of this BindProfileAddress. The current implementation simply wrapsgetStringRepresentation()
-
getPresentationAddress
Returns the bind profile address in the form of a presentation address.- Returns:
- Bind profile address in the form of a presentation address; NULL if the bind profile address is not in the form AddressType.DAP or AddressType.ADVANCED.
-
getURIData
Returns the bind profile address in the form of URI data.- Returns:
- Bind profile address in the form of URI data; NULL if the bind profile address is not in the form AddressType.LDAP, AddressType.LDAPS or AddressType.XMPP.
-
getOther
Returns the bind profile address in the form of Other string.- Returns:
- Bind profile address in the form of other string; NULL if the bind profile address is not in the form AddressType.OTHER.
-
getHost
Returns the host name of the bind profile address if the bind profile address is not of the ADVANCED or OTHER type.- Returns:
- Host name of the bind profile address; NULL if the bind profile address is of the ADVANCED or OTHER type.
-
getPort
public int getPort()Returns the port of the bind profile address if the bind profile address is not of the ADVANCED or OTHER type.- Returns:
- Port of the bind profile address; -1 if the bind profile address is of the ADVANCED or OTHER type, or if the bind profile address contains no explicit port number (e.g. "ldap://william.isode.net")
-
getHostnames
Returns a String containing the names of any hosts that are contained in this object. If no host names are available, the method returns an empty String ("")- Returns:
- a String containing all the distinct hostnames that are contained in this object.
- See Also:
-
getFriendlyString
Return a String containing a short "user-friendly" version of the BindProfileAddress. The intention is that this String be used in situations where we want to enough information that's likely to allow the user to identify the address without having to overload the user with a full-blown String representation.The current implementation simply calls
getHostnames()
. A future implementation may do something more elaborate.- Returns:
- a String representation of the PresentationAddress which contains enough information to be useful in most cases. If it's not possible to make a short name, then this method returns the empty String "".
-
getCanonicalForm
The URI data and presentation address are converted to their canonical forms. The other string is converted to lower case.- Returns:
- canonical form of object.
- Throws:
BadSyntaxException
- if it is not possible to parse the presentation address.
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<BindProfileAddress>
-
getBindableAddresses
public static ArrayList<BindProfileAddress> getBindableAddresses(PresentationAddress pa) throws BadSyntaxException Creates a list of unique bindable addresses from the network addresses in the given presentation address. It uses the following order to create the list:If there are LDAP
NetworkAddress.Type
addresses in the presentation address (which do not have extra info in the URI if they are URI), it forms an LDAPBindProfileAddress.AddressType
bind profile address out of each such LDAP network address. These bind profile addresses are ordered in the order the LDAP addresses are found in the presentation address.Then, if there are LDAPS
NetworkAddress.Type
addresses in the presentation address (which do not have extra info in the URI if they are URI), it forms an LDAPSBindProfileAddress.AddressType
bind profile address out of each such LDAPS network address. These bind profile addresses are ordered in the order the LDAPS addresses are found in the presentation address.Then, if there are ITOT
NetworkAddress.Type
addresses in the presentation address, it forms a DAPBindProfileAddress.AddressType
bind profile address out of each such ITOT network address. These bind profile addresses are ordered in the order the ITOT addresses are found in the presentation address.Then, it forms a bind profile address out of each remaining network addresses. These bind profile addresses are ordered in the order the remaining network addresses are found in the presentation address.
Selectors in the given presentation address are ignored.
An empty list is returned if presentation address is null.
- Parameters:
pa
- Presentation address to create bindable address list from, can be null.- Returns:
- List of bindable bind profile addresses.
- Throws:
BadSyntaxException
- if it is not possible to parse the presentation address.
-
getMostBindableAddress
public static BindProfileAddress getMostBindableAddress(PresentationAddress pa) throws BadSyntaxException Returns the most bindable address in the given presentation address. It usesgetBindableAddresses(PresentationAddress)
to get the list of bindable addresses and returns the first bind profile address in the list.If there are any selectors in the presentation address, the bind profile address is created out of the entire presentation address.
- Parameters:
pa
- Presentation address to create bindable address from, can be null.- Returns:
- Most bindable bind profile address, will be null if given presentation address was null.
- Throws:
BadSyntaxException
- if it is not possible to parse the presentation address.
-