Package com.isode.dsapi.config
Class MESHManager
java.lang.Object
com.isode.dsapi.config.MESHManager
Manages MESH (multimaster) related configuration.
- Since:
- 16.3
- Author:
- dsm
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a DSA to the MESH group.createMESHEntry
(String desc, List<IdentifiedDN> servers, List<IdentifiedDN> agreements) Construct MESH entry (always named "cn=mesh,cn=config").void
Delete the MESH configuration entry.getAgreementDN
(Integer agmtID) Return the DN of an identified server.Get state associated with an agreement.int
getServerDN
(Integer dsaID) Return the DN of an identified server.Get (connection) state associated with a server.void
Load failover entry & associated data.boolean
loaded()
Check the MESH configuration entry has been loaded successfully.void
removeServer
(int id) Remove a server from the group.
-
Constructor Details
-
MESHManager
MESHManager constructor.- Parameters:
ds
- Isode directory session
-
-
Method Details
-
load
Load failover entry & associated data.- Parameters:
entry
- Entry.- Throws:
ConfigOpFailedException
- if mandatory attributes are not loadedReadFailedException
- if there is an error while reading data from the directory server
-
createMESHEntry
public MESHEntry createMESHEntry(String desc, List<IdentifiedDN> servers, List<IdentifiedDN> agreements) throws ConfigOpFailedException, ReadFailedException Construct MESH entry (always named "cn=mesh,cn=config"). Used when creating the MESH configuration.- Parameters:
desc
- String describing the MESH group, does not have to be unique but helps user friendliness.servers
- Map of integer server IDs to server DNs. If null then only _this_ server is added, and with a server ID of 1 (0 is not permitted).agreements
- Map of integer server IDs to GDAM DNs, which constitutes the set of failover agreements. Must not be null.- Returns:
- Created MESH entry, will never be null.
- Throws:
ReadFailedException
- If there is a problem on reading the committed entry back.ConfigOpFailedException
- If there is a problem on applying the changes to the directory.
-
deleteMESHEntry
Delete the MESH configuration entry.- Throws:
ConfigOpFailedException
- if there is an error during the delete.
-
addServer
Add a DSA to the MESH group. This method does directory operations so a user may want to call it in the background.- Parameters:
dsaID
- Integer identifier to be associated with the new DN.dsaDN
- DN of failover DSA to add, must not be null- Throws:
ReadFailedException
- if there is a problem on reading the committed entry backConfigOpFailedException
- if MESH entry is null (possibly because there are not enough access rights to read it) or there is any other problem on applying the changes.
-
removeServer
Remove a server from the group.- Parameters:
id
- Integer of the ID DSA being removed. Must not be null.- Throws:
ReadFailedException
- if there is a problem on reading the committed entry backConfigOpFailedException
- if MESH entry is null (possibly because there are not enough access rights to read it) or there is any other problem on applying the changes.
-
loaded
public boolean loaded()Check the MESH configuration entry has been loaded successfully.- Returns:
- 'true' if loaded OK, 'false' otherwise.
-
getServerMap
- Returns:
- List of IdentifiedDNs forming the MESH group. Will never be null.
-
getServerDN
Return the DN of an identified server.- Parameters:
dsaID
- Server identifier.- Returns:
- DN of server, null on unrecognized ID.
-
getAgreementMap
- Returns:
- map of agreement IDs to GDAM DN. Will never be null.
-
getAgreementDN
Return the DN of an identified server.- Parameters:
agmtID
- Agreement ID.- Returns:
- DN of agreement (GDAM), null on unrecognized ID.
-
getGroupID
- Returns:
- The MESH group configuration ID.
-
getDescription
- Returns:
- The description of the MESH configuration.
-
getOwningServerDN
- Returns:
- DN of server from which this configuration was loaded.
-
getOwningServerID
public int getOwningServerID()- Returns:
- ID of server from which this configuration was loaded.
-
getAgreementState
Get state associated with an agreement.- Returns:
- State object associated with the given agreement ID, null if not found.
-
getServerState
Get (connection) state associated with a server.- Returns:
- State object associated with the given server ID, null if not found.
-