Class ConfigManager

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

public class ConfigManager extends Object
Stores the various configuration data.
  • Field Details

    • PAGE_SIZE

      public static final int PAGE_SIZE
      Page size to be used during paged search operations for configuration data. Admin size limit was typically set to 200 historically, hence keeping the page size smaller than that. If page size is bigger than admin size limit, then each page may hit the limit.
      See Also:
  • Constructor Details

    • ConfigManager

      public ConfigManager(IsodeDirectorySession isodeDS) throws IncorrectVersionException
      Create a config manager using the given Isode directory session.

      This sets up an internal CommonArgs variable based on the value in the given IsodeDirectorySession. This variable is then used for directory operations by the Config Manager. If further changes are done in the value in the IsodeDirectorySession, this internal variable here would not be updated.

      No directory operations are performed in this constructor.

      Parameters:
      isodeDS - Isode directory session
      Throws:
      IncorrectVersionException - if the version of DSA is _known_ to be incompatible.
  • Method Details

    • isSameMajorVersion

      public boolean isSameMajorVersion()
      Check whether the connected server has the same major version as this client.
      Returns:
      true if the connected M-Vault has the same major version as me, false otherwise.
    • isSameMinorVersion

      public boolean isSameMinorVersion()
      Check whether the connected server has the same minor version as this client.
      Returns:
      true if the connected M-Vault has the same major version as me, false otherwise.
    • getRootDSE

      public DSE getRootDSE()
      Returns:
      DSAIT cache - non-null if any config in ConfigManager.ConfigObjectClass is loaded. Would be empty if the user does not have permissions to read the DSE data. Could be empty or incomplete if an error occurs when loading data.
    • getConfigEntry

      public ConfigEntry getConfigEntry()
      Once config 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 config 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 managerial tasks should not be done.

      Returns:
      'cn=config' configuration entry - non-null if ConfigManager.ConfigObjectClass.DSA_CONFIG is loaded and the user has permissions to read the 'cn=config' object. Could remain the same as before if an error occurs when loading data.
    • getLogConfigObject

      public LogConfigObject getLogConfigObject()
      Returns:
      logging configuration entry - non-null if ConfigManager.ConfigObjectClass.DSA_CONFIG is loaded and the user has permissions to read the logging configuration. Could remain the same as before if an error occurs when loading data.
    • getGdamManager

      public GDAMManager getGdamManager()
      Returns:
      GDAM manager - non-null if ConfigManager.ConfigObjectClass.GDAM is loaded. Would be empty if the user does not have permissions to read the GDAM data. Could be empty or incomplete if an error occurs when loading data.
    • getPeerManager

      public PeerManager getPeerManager()
      Returns:
      peer manager - non-null if ConfigManager.ConfigObjectClass.PEER_DSA is loaded. Would be empty if the user does not have permissions to read the peer data. Could be empty or incomplete if an error occurs when loading data.
    • getOCSPServiceManager

      public OCSPServiceManager getOCSPServiceManager()
      Returns:
      OCSP manager - non-null if ConfigManager.ConfigObjectClass.GDAM is loaded. Would be empty if the user does not have permissions to read the OCSP data. Could be empty or incomplete if an error occurs when loading data.
    • getShadowManager

      public ShadowManager getShadowManager()
      Returns:
      shadow agreement manager - non-null if ConfigManager.ConfigObjectClass.SHADOW_AGREEMENT is loaded. Would be empty if the user does not have permissions to read the shadow agreements. Could be empty or incomplete if an error occurs when loading data.
    • getFailoverManager

      public FailoverManager getFailoverManager()
      Returns:
      Failover manager - non-null if ConfigManager.ConfigObjectClass.FAILOVER_CONFIG is loaded. Would contain data according to the user permissions to read failover data. Could be incomplete if an error occurs when loading data.
    • getMESHManager

      public MESHManager getMESHManager()
      Returns:
      MESH manager - non-null if ConfigManager.ConfigObjectClass.MESH_CONFIG is loaded. Would contain data according to the user permissions to read MESH data. Could be incomplete if an error occurs when loading data.
    • getLDAPChangelogEntry

      public LDAPChangelogEntry getLDAPChangelogEntry()
      Returns:
      LDAPChangelogEntry - non-null if ConfigManager.ConfigObjectClass.LDAP_CHANGELOG is loaded, entry is present and the user has permissions to read the 'cn=changelog,cn=config' object. Could remain the same as before if an error occurs when loading data.
    • getOAuthEntry

      public OAuthEntry getOAuthEntry()
      Returns:
      OAuthEntry - non-null if ConfigManager.ConfigObjectClass.OAUTH_CONFIG is loaded, entry is present and the user has permissions to read the 'cn=oauth,cn=config' object. Could remain the same as before if an error occurs when loading data.
    • loadConfigObject

      public void loadConfigObject(ConfigManager.ConfigObjectClass objectClass) throws ReadFailedException, ConfigOpFailedException
      Load the given type of configuration data.

      Perform a "best-efforts" attempt to read the requested information about the configuration. This is typically done when a new IsodeDirectorySession is bound, but may be requested at any subsequent time (e.g. to reload up-to-date data). In case of any exceptions, the stored objects for the requested type may remain the same as before or may contain incomplete data, depending on how much data has been read.

      Parameters:
      objectClass - Enum identifying the config data of interest.
      Throws:
      ConfigOpFailedException - if mandatory attributes are not loaded
      ReadFailedException - if there is an error while reading data from the directory server
    • createLDAPChangelogEntry

      public LDAPChangelogEntry createLDAPChangelogEntry(int maxEntryAge, int prunePeriod) throws ConfigOpFailedException, ReadFailedException
      Construct LDAPChangelogEntry entry (which will be something like "cn=changelog,cn=config"). This is used when you're enabling LDAP change logging. If logging is already enabled, this method simply returns the existing LDAPChangelogEntry entry and does not do anything else.

      Since there is no manager dedicated to the LDAPChangelogEntry entry, ConfigManager needs to ensure that the LDAPChangelogEntry entry value that it holds is correct and so needs to provide methods to create and delete it.

      The returned result will contain the following attributes

      • objectClass = top, icChangeLogGdam
      • diskDatabaseDirectory = "changelog" (hard-coded)
      • changeLogMaxEntryAge = [seconds]</code
      • changeLogPrunePeriod = [seconds]
      i.e., the "diskDatabaseDirectory" is currently always hard-coded to be "changelog".
      Parameters:
      maxEntryAge - the value for changeLogMaxEntryAge.
      prunePeriod - the value for changeLogPrunePeriod.
      Returns:
      created LDAPChangelogEntry 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.
    • deleteLDAPChangelogEntry

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

      public OAuthEntry createOAuthEntry(String serverAddress, Integer serverPort, Integer tokenPort, Integer tokenDuration, Integer refreshTokenDuration, Boolean allowNonTLSMode, Boolean useClientStrongAuth) throws ConfigOpFailedException, ReadFailedException
      Construct OAuthEntry entry (which will be something like "cn=oauth,cn=config"). This is used when you're enabling OAuth services. If already enabled, this method simply returns the existing OAuthEntry entry and does not do anything else.

      Since there is no manager dedicated to the LDAPChangelogEntry entry, ConfigManager needs to ensure that the LDAPChangelogEntry entry value that it holds is correct and so needs to provide methods to create and delete it.

      The returned result will contain the following attributes

      • objectClass = top, icChangeLogGdam
      • diskDatabaseDirectory = "changelog" (hard-coded)
      • changeLogMaxEntryAge = [seconds]</code
      • changeLogPrunePeriod = [seconds]
      i.e., the "diskDatabaseDirectory" is currently always hard-coded to be "changelog".
      Parameters:
      maxEntryAge - the value for changeLogMaxEntryAge.
      prunePeriod - the value for changeLogPrunePeriod.
      Returns:
      created LDAPChangelogEntry 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.
    • deleteOAuthEntry

      public void deleteOAuthEntry() throws ConfigOpFailedException
      Delete the OAuth configuration entry. No action if already deleted.
      Throws:
      ConfigOpFailedException - if the delete failed for any reason.
    • isStandAlone

      public boolean isStandAlone()
      Determine if DSA is stand alone.
      Returns:
      Return true if DSA is stand alone (not part of a failover or multimaster group), false otherwise.
      Since:
      16.3
    • isStandAloneOrMaster

      public boolean isStandAloneOrMaster()
      Determine if DSA is stand alone or a failover master.
      Returns:
      Return true if DSA is stand alone or a master of a failover group, false otherwise.
      Since:
      16.3
    • isFailoverMirror

      public boolean isFailoverMirror()
      Returns:
      true if DSA is a failover mirror (and not the master).
      Since:
      16.3
    • isFailoverMaster

      public boolean isFailoverMaster()
      Returns:
      true if DSA is a failover mirror and the master.
      Since:
      16.3
    • isMultimaster

      public boolean isMultimaster()
      Returns:
      true if DSA has a multimaster configuration.
      Since:
      19.0v25