Class ReplicationCliArgumentParser

  • All Implemented Interfaces:
    ToolRefDocContainer

    public class ReplicationCliArgumentParser
    extends SecureConnectionCliParser
    This class is used to parse the arguments passed to the replication CLI. It also checks the compatibility between the values and that all the required information has been provided. However it does not do any verification that require connection to any server.
    • Field Detail

      • INITIALIZE_ALL_REPLICATION_SUBCMD_NAME

        public static final String INITIALIZE_ALL_REPLICATION_SUBCMD_NAME
        The text of the initialize all replication subcommand.
        See Also:
        Constant Field Values
    • Method Detail

      • validateGlobalOptions

        public int validateGlobalOptions​(org.forgerock.i18n.LocalizableMessageBuilder buf)
        Description copied from class: SecureConnectionCliParser
        Indication if provided global options are validate.
        Overrides:
        validateGlobalOptions in class SecureConnectionCliParser
        Parameters:
        buf - The LocalizableMessageBuilder to write the error message.
        Returns:
        return code.
      • isInteractive

        public boolean isInteractive()
        Tells whether the user specified to have an interactive operation or not. This method must be called after calling parseArguments.
        Returns:
        true if the user specified to have an interactive operation and false otherwise.
      • isQuiet

        public boolean isQuiet()
        Tells whether the user specified to have a quite operation or not. This method must be called after calling parseArguments.
        Returns:
        true if the user specified to have a quite operation and false otherwise.
      • isScriptFriendly

        public boolean isScriptFriendly()
        Tells whether the user specified to have a script-friendly output or not. This method must be called after calling parseArguments.
        Returns:
        true if the user specified to have a script-friendly output and false otherwise.
      • getBindPasswordAdmin

        public String getBindPasswordAdmin()
        Get the global administrator password which has to be used for the command to connect to the server(s) without prompting the user. If no password was specified, return null.
        Returns:
        the global administrator password which has to be used for the command to connect to the server(s) without prompting the user. If no password was specified, return null.
      • getAdministratorUID

        public String getAdministratorUID()
        Returns the Administrator UID explicitly provided in the command-line.
        Overrides:
        getAdministratorUID in class SecureConnectionCliParser
        Returns:
        the Administrator UID explicitly provided in the command-line.
      • getAdministratorUIDOrDefault

        public String getAdministratorUIDOrDefault()
        Returns the default Administrator UID value.
        Returns:
        the default Administrator UID value.
      • getReplicationPort1

        public int getReplicationPort1()
        Returns the first server replication port explicitly provided in the enable replication subcommand.
        Returns:
        the first server replication port explicitly provided in the enable replication subcommand. Returns -1 if no port was explicitly provided.
      • getReplicationPort2

        public int getReplicationPort2()
        Returns the second server replication port explicitly provided in the enable replication subcommand.
        Returns:
        the second server replication port explicitly provided in the enable replication subcommand. Returns -1 if no port was explicitly provided.
      • getHostNameToDisable

        public String getHostNameToDisable()
        Returns the host name explicitly provided in the disable replication subcommand.
        Returns:
        the host name explicitly provided in the disable replication subcommand.
      • getHostNameToDisableOrDefault

        public String getHostNameToDisableOrDefault()
        Returns the host name default value in the disable replication subcommand.
        Returns:
        the host name default value in the disable replication subcommand.
      • getBindDNToDisable

        public String getBindDNToDisable()
        Returns the server bind dn explicitly provided in the disable replication subcommand.
        Returns:
        the server bind dn explicitly provided in the disable replication subcommand.
      • getHostNameToStatusOrDefault

        public String getHostNameToStatusOrDefault()
        Returns the host name default value in the status replication subcommand.
        Returns:
        the host name default value in the status replication subcommand.
      • getHostNameToInitializeAllOrDefault

        public String getHostNameToInitializeAllOrDefault()
        Returns the host name default value in the initialize all replication subcommand.
        Returns:
        the host name default value in the initialize all replication subcommand.
      • getHostNameSource

        public String getHostNameSource()
        Returns the source host name explicitly provided in the initialize replication subcommand.
        Returns:
        the source host name explicitly provided in the initialize replication subcommand.
      • getHostNameSourceOrDefault

        public String getHostNameSourceOrDefault()
        Returns the first host name default value in the initialize replication subcommand.
        Returns:
        the first host name default value in the initialize replication subcommand.
      • getHostNameDestination

        public String getHostNameDestination()
        Returns the destination host name explicitly provided in the initialize replication subcommand.
        Returns:
        the destination host name explicitly provided in the initialize replication subcommand.
      • getHostNameDestinationOrDefault

        public String getHostNameDestinationOrDefault()
        Returns the destination host name default value in the initialize replication subcommand.
        Returns:
        the destination host name default value in the initialize replication subcommand.
      • getPortSource

        public int getPortSource()
        Returns the source server port explicitly provided in the initialize replication subcommand.
        Returns:
        the source server port explicitly provided in the initialize replication subcommand. Returns -1 if no port was explicitly provided.
      • getPortSourceOrDefault

        public int getPortSourceOrDefault()
        Returns the source server port default value in the initialize replication subcommand.
        Returns:
        the source server port default value in the initialize replication subcommand.
      • getPortDestination

        public int getPortDestination()
        Returns the destination server port explicitly provided in the initialize replication subcommand.
        Returns:
        the destination server port explicitly provided in the initialize replication subcommand. Returns -1 if no port was explicitly provided.
      • getPortDestinationOrDefault

        public int getPortDestinationOrDefault()
        Returns the destination server port default value in the initialize replication subcommand.
        Returns:
        the destination server port default value in the initialize replication subcommand.
      • getPortToDisable

        public int getPortToDisable()
        Returns the server port explicitly provided in the disable replication subcommand.
        Returns:
        the server port explicitly provided in the disable replication subcommand. Returns -1 if no port was explicitly provided.
      • getPortToDisableOrDefault

        public int getPortToDisableOrDefault()
        Returns the server port default value in the disable replication subcommand.
        Returns:
        the server port default value in the disable replication subcommand.
      • getPortToInitializeAllOrDefault

        public int getPortToInitializeAllOrDefault()
        Returns the server port default value in the initialize all replication subcommand.
        Returns:
        the server port default value in the initialize all replication subcommand.
      • getPortToStatusOrDefault

        public int getPortToStatusOrDefault()
        Returns the server port default value in the status replication subcommand.
        Returns:
        the server port default value in the status replication subcommand.
      • getBaseDNs

        public List<String> getBaseDNs()
        Returns the list of base DNs provided by the user.
        Returns:
        the list of base DNs provided by the user.
      • getConfigFile

        public String getConfigFile()
        Returns the config file value provided in the hidden argument of the command-line.
        Returns:
        the config file value provided in the hidden argument of the command-line.
      • isEnableReplicationSubcommand

        public boolean isEnableReplicationSubcommand()
        Returns whether the user provided subcommand is the enable replication or not.
        Returns:
        true if the user provided subcommand is the enable replication and false otherwise.
      • isDisableReplicationSubcommand

        public boolean isDisableReplicationSubcommand()
        Returns whether the user provided subcommand is the disable replication or not.
        Returns:
        true if the user provided subcommand is the disable replication and false otherwise.
      • isResetChangeNumber

        public boolean isResetChangeNumber()
        Returns whether the user specified the reset changelog numbering subcommand.
        Returns:
        true if the user wanted to reset change number
      • isStatusReplicationSubcommand

        public boolean isStatusReplicationSubcommand()
        Returns whether the user provided subcommand is the status replication or not.
        Returns:
        true if the user provided subcommand is the status replication and false otherwise.
      • isPurgeHistoricalSubcommand

        public boolean isPurgeHistoricalSubcommand()
        Returns whether the user provided subcommand is the purge historical or not.
        Returns:
        true if the user provided subcommand is the purge historical and false otherwise.
      • isInitializeAllReplicationSubcommand

        public boolean isInitializeAllReplicationSubcommand()
        Returns whether the user provided subcommand is the initialize all replication or not.
        Returns:
        true if the user provided subcommand is the initialize all replication and false otherwise.
      • isPreExternalInitializationSubcommand

        public boolean isPreExternalInitializationSubcommand()
        Returns whether the user provided subcommand is the pre external initialization or not.
        Returns:
        true if the user provided subcommand is the pre external initialization and false otherwise.
      • isPostExternalInitializationSubcommand

        public boolean isPostExternalInitializationSubcommand()
        Returns whether the user provided subcommand is the post external initialization or not.
        Returns:
        true if the user provided subcommand is the post external initialization and false otherwise.
      • isInitializeReplicationSubcommand

        public boolean isInitializeReplicationSubcommand()
        Returns whether the user provided subcommand is the initialize replication or not.
        Returns:
        true if the user provided subcommand is the initialize replication and false otherwise.
      • getSecureArgsList

        public SecureConnectionCliArgs getSecureArgsList()
        Returns the SecureConnectionCliArgs object containing the arguments of this parser.
        Returns:
        the SecureConnectionCliArgs object containing the arguments of this parser.
      • getTaskArgsList

        public TaskScheduleArgs getTaskArgsList()
        Returns the TaskScheduleArgs object containing the arguments of this parser.
        Returns:
        the TaskScheduleArgs object containing the arguments of this parser.
      • getMaximumDuration

        public int getMaximumDuration()
        Returns the maximum duration explicitly provided in the purge historical replication subcommand.
        Returns:
        the maximum duration explicitly provided in the purge historical replication subcommand. Returns -1 if no port was explicitly provided.
      • getMaximumDurationOrDefault

        public int getMaximumDurationOrDefault()
        Returns the maximum duration default value in the purge historical replication subcommand.
        Returns:
        the maximum duration default value in the purge historical replication subcommand.
      • getResetChangeNumber

        public int getResetChangeNumber()
        Returns the changenumber specified as argument.
        Returns:
        the changenumber specified as argument
      • setResetChangeNumber

        public void setResetChangeNumber​(String changeNumber)
        Sets the start change number value.
        Parameters:
        changeNumber - the new value of the option