Class FailoverManager

java.lang.Object
com.isode.dsapi.config.FailoverManager

public class FailoverManager extends Object
Failover manager manages the failover related data stored in the directory session.
  • Constructor Details

    • FailoverManager

      public FailoverManager(IsodeDirectorySession ds)
      Constructor for failover manager.
      Parameters:
      ds - Isode directory session
  • Method Details

    • load

      public void load(ConfigEntry config, Entry entry) throws ConfigOpFailedException, ReadFailedException
      Load failover entry & associated data.
      Parameters:
      entry - Entry.
      Throws:
      ConfigOpFailedException - if mandatory attributes are not loaded
      ReadFailedException - if there is an error while reading data from the directory server
    • createFailoverEntry

      public FailoverEntry createFailoverEntry(DN dsaDN, DN groupDN) throws ConfigOpFailedException, ReadFailedException
      Construct Failover entry (which will be something like "cn=failover,cn=config"). This is used when you're turning a non-failover DSA into the master of a new failover group. If failover is already enabled, this method simply returns the existing FailoverEntry entry and does not do anything else.

      The returned result will contain the following attributes

      • objectClass = top, isodeFailoverConfiguration
      • isodeFailoverIdentity = groupDN</code
      • isodeFailoverGroup = dsaDN (multi-valued attribute with only one member)
      Parameters:
      dsaDN - the DN of the DSA which is going to be the initial member of the group. Must not be null.
      groupDN - the DN of the failover group (which can be the same as newMasterDSADN but doesn't have to be). Must not be null.
      Returns:
      created failover 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.
    • deleteFailoverEntry

      public void deleteFailoverEntry() throws ConfigOpFailedException
      Delete the FailoverEntry entry. If failover is already disabled,this method simply returns and does not do anything else.
      Throws:
      ConfigOpFailedException - if there is an error during the delete.
    • addMirror

      public void addMirror(DN dsaDN) throws ConfigOpFailedException, ReadFailedException
      Add a DSA to the failover group. This method does directory operations so a user may want to call it in the background.
      Parameters:
      dsaDN - DN of failover DSA to add, must not be null
      Throws:
      ReadFailedException - if there is a problem on reading the committed entry back
      ConfigOpFailedException - if failover entry is null (possibly because there are not enough access rights to read it) or there is any other problem on applying the changes
    • removeMember

      public void removeMember(DN dsaDN) throws ConfigOpFailedException, ReadFailedException
      Remove a member from the group. This method performs directory operations and so should not be called from the display thread. D3 requires that you remove a member by telling the master to do so, so this method should only be invoked for a master DSA (although it does not check that you're doing this).
      Parameters:
      dsaDN - DN of the DSA being removed. Must not be null.
      Throws:
      ReadFailedException - if there is a problem on reading the committed entry back
      ConfigOpFailedException - if failover entry is null (possibly because there are not enough access rights to read it) or there is any other problem on applying the changes
    • getFailoverEntry

      public FailoverEntry getFailoverEntry()
      Once failover entry is loaded successfully, i.e. it is non=null, it is re-assigned only after everything is ok. This is done so during re-loading, if there are exceptions and even then the object is used, there is no crash by using a null or invalid failover entry.

      However, the first time it is loaded, the user has to ensure that it is not null before using it. It could be null if the user has no permission to read it and in this case most failover related tasks should not be done.

      Returns:
      failover entry - non-null if the user has permissions to read the object. Could remain the same as before if an error occurs when loading data.
    • getFailoverDsaList

      public ArrayList<DN> getFailoverDsaList()
      Returns:
      list of failover DSAs - will never be null. Would be empty if the user does not have permissions to read the failover entry group list or agreement list. Could be empty or incomplete if an error occurs when loading data.
    • getAgreementList

      public ArrayList<FailoverAgreement> getAgreementList()
      Returns:
      list of failover agreements - will never be null. Would be empty if the user does not have permissions to read the failover entry group list or agreement list. Could be empty or incomplete if an error occurs when loading data.
    • isFailoverMember

      public boolean isFailoverMember()
      Determine whether this DSA is part of a failover group. The method looks to see if there is a failover entry, and returns true if there is. This doesn't necessarily mean that the group is active (e.g. it could be that isodeFailoverEnabled is not set to true in the config entry).
      Returns:
      true if this DSA is part of a failover group; false if it isn't, or if the FailoverManager hasn't been read properly (e.g. the user didn't have access rights to read the entry).
    • getIdentityDN

      public DN getIdentityDN()
      Get the failover identity, i.e. the DSA DN used in regular supplier agreements.
      Returns:
      the failover identity DN, or null if not set or the failover configuration entry has not been loaded.
      Since:
      16.3