Class ReplicationCliArgumentParser
- java.lang.Object
-
- com.forgerock.opendj.cli.ArgumentParser
-
- com.forgerock.opendj.cli.SubCommandArgumentParser
-
- org.opends.server.admin.client.cli.SecureConnectionCliParser
-
- org.opends.server.tools.dsreplication.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 Summary
Fields Modifier and Type Field Description static StringINITIALIZE_ALL_REPLICATION_SUBCMD_NAMEThe text of the initialize all replication subcommand.-
Fields inherited from class org.opends.server.admin.client.cli.SecureConnectionCliParser
noPropertiesFileArg, propertiesFileArg, secureArgsList, verboseArg
-
Fields inherited from class com.forgerock.opendj.cli.ArgumentParser
argumentGroups, DEFAULT_OPENDJ_CONFIG_DIR, DEFAULT_OPENDJ_PROPERTIES_FILE_EXTENSION, DEFAULT_OPENDJ_PROPERTIES_FILE_NAME, ioArgGroup, PROPERTY_SCRIPT_NAME, PROPERTY_SCRIPT_NAME_LEGACY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAdministratorUID()Returns the Administrator UID explicitly provided in the command-line.StringgetAdministratorUIDOrDefault()Returns the default Administrator UID value.List<String>getBaseDNs()Returns the list of base DNs provided by the user.StringgetBindDNToDisable()Returns the server bind dn explicitly provided in the disable replication subcommand.StringgetBindPasswordAdmin()Get the global administrator password which has to be used for the command to connect to the server(s) without prompting the user.StringgetConfigFile()Returns the config file value provided in the hidden argument of the command-line.StringgetHostNameDestination()Returns the destination host name explicitly provided in the initialize replication subcommand.StringgetHostNameDestinationOrDefault()Returns the destination host name default value in the initialize replication subcommand.StringgetHostNameSource()Returns the source host name explicitly provided in the initialize replication subcommand.StringgetHostNameSourceOrDefault()Returns the first host name default value in the initialize replication subcommand.StringgetHostNameToDisable()Returns the host name explicitly provided in the disable replication subcommand.StringgetHostNameToDisableOrDefault()Returns the host name default value in the disable replication subcommand.StringgetHostNameToInitializeAllOrDefault()Returns the host name default value in the initialize all replication subcommand.StringgetHostNameToStatusOrDefault()Returns the host name default value in the status replication subcommand.intgetMaximumDuration()Returns the maximum duration explicitly provided in the purge historical replication subcommand.intgetMaximumDurationOrDefault()Returns the maximum duration default value in the purge historical replication subcommand.intgetPortDestination()Returns the destination server port explicitly provided in the initialize replication subcommand.intgetPortDestinationOrDefault()Returns the destination server port default value in the initialize replication subcommand.intgetPortSource()Returns the source server port explicitly provided in the initialize replication subcommand.intgetPortSourceOrDefault()Returns the source server port default value in the initialize replication subcommand.intgetPortToDisable()Returns the server port explicitly provided in the disable replication subcommand.intgetPortToDisableOrDefault()Returns the server port default value in the disable replication subcommand.intgetPortToInitializeAllOrDefault()Returns the server port default value in the initialize all replication subcommand.intgetPortToStatusOrDefault()Returns the server port default value in the status replication subcommand.intgetReplicationPort1()Returns the first server replication port explicitly provided in the enable replication subcommand.intgetReplicationPort2()Returns the second server replication port explicitly provided in the enable replication subcommand.intgetResetChangeNumber()Returns the changenumber specified as argument.SecureConnectionCliArgsgetSecureArgsList()Returns the SecureConnectionCliArgs object containing the arguments of this parser.TaskScheduleArgsgetTaskArgsList()Returns the TaskScheduleArgs object containing the arguments of this parser.protected voidinitializeGlobalArguments(Collection<Argument> args, ArgumentGroup argGroup)Initialize the global options with the provided set of arguments.booleanisDisableReplicationSubcommand()Returns whether the user provided subcommand is the disable replication or not.booleanisEnableReplicationSubcommand()Returns whether the user provided subcommand is the enable replication or not.booleanisInitializeAllReplicationSubcommand()Returns whether the user provided subcommand is the initialize all replication or not.booleanisInitializeReplicationSubcommand()Returns whether the user provided subcommand is the initialize replication or not.booleanisInteractive()Tells whether the user specified to have an interactive operation or not.booleanisPostExternalInitializationSubcommand()Returns whether the user provided subcommand is the post external initialization or not.booleanisPreExternalInitializationSubcommand()Returns whether the user provided subcommand is the pre external initialization or not.booleanisPurgeHistoricalSubcommand()Returns whether the user provided subcommand is the purge historical or not.booleanisQuiet()Tells whether the user specified to have a quite operation or not.booleanisResetChangeNumber()Returns whether the user specified the reset changelog numbering subcommand.booleanisScriptFriendly()Tells whether the user specified to have a script-friendly output or not.booleanisStatusReplicationSubcommand()Returns whether the user provided subcommand is the status replication or not.voidsetResetChangeNumber(String changeNumber)Sets the start change number value.intvalidateGlobalOptions(org.forgerock.i18n.LocalizableMessageBuilder buf)Indication if provided global options are validate.-
Methods inherited from class org.opends.server.admin.client.cli.SecureConnectionCliParser
createGlobalArguments, getBindDN, getBindPassword, getConnectTimeout, getHostName, getPort, getTrustManager, initializeGlobalArguments, isVerbose, validateGlobalOptions
-
Methods inherited from class com.forgerock.opendj.cli.SubCommandArgumentParser
addGlobalArgument, addGlobalArgument, addLdapConnectionArgument, getGlobalArgumentForLongID, getGlobalArgumentForShortID, getSubCommand, getSubCommand, getSubCommandUsage, getUsage, hasGlobalArgument, hasSubCommand, parseArguments, replaceArgument, setUsageArgument, setUsageGroupArgument, setUsageHandler
-
Methods inherited from class com.forgerock.opendj.cli.ArgumentParser
addArgument, addArgument, addDefaultArgument, displayMessageAndUsageReference, getArgumentForLongID, getArgumentList, getBindPassword, getDocSubcommandsDescriptionSupplement, getDocToolDescriptionSupplement, getHelpUsageReference, getOptionsRefSect1, getShortToolDescription, getTrailingArguments, isUsageArgumentPresent, isVersionArgumentPresent, parseArguments, parseArguments, setDocSubcommandsDescriptionSupplement, setDocToolDescriptionSupplement, setFilePropertiesArgument, setNoPropertiesFileArgument, setShortToolDescription, setUsageArgument, setUsageOrVersionDisplayed, setVersionHandler, usageOrVersionDisplayed
-
-
-
-
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:SecureConnectionCliParserIndication if provided global options are validate.- Overrides:
validateGlobalOptionsin classSecureConnectionCliParser- Parameters:
buf- TheLocalizableMessageBuilderto write the error message.- Returns:
- return code.
-
initializeGlobalArguments
protected void initializeGlobalArguments(Collection<Argument> args, ArgumentGroup argGroup) throws ArgumentException
Initialize the global options with the provided set of arguments.- Overrides:
initializeGlobalArgumentsin classSecureConnectionCliParser- Parameters:
args- the arguments to use to initialize the global options.argGroup- the group to which args will be added.- Throws:
ArgumentException- if there is a conflict with the provided arguments.
-
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:
trueif the user specified to have an interactive operation andfalseotherwise.
-
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:
trueif the user specified to have a quite operation andfalseotherwise.
-
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:
trueif the user specified to have a script-friendly output andfalseotherwise.
-
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:
getAdministratorUIDin classSecureConnectionCliParser- 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:
trueif the user provided subcommand is the enable replication andfalseotherwise.
-
isDisableReplicationSubcommand
public boolean isDisableReplicationSubcommand()
Returns whether the user provided subcommand is the disable replication or not.- Returns:
trueif the user provided subcommand is the disable replication andfalseotherwise.
-
isResetChangeNumber
public boolean isResetChangeNumber()
Returns whether the user specified the reset changelog numbering subcommand.- Returns:
trueif the user wanted to reset change number
-
isStatusReplicationSubcommand
public boolean isStatusReplicationSubcommand()
Returns whether the user provided subcommand is the status replication or not.- Returns:
trueif the user provided subcommand is the status replication andfalseotherwise.
-
isPurgeHistoricalSubcommand
public boolean isPurgeHistoricalSubcommand()
Returns whether the user provided subcommand is the purge historical or not.- Returns:
trueif the user provided subcommand is the purge historical andfalseotherwise.
-
isInitializeAllReplicationSubcommand
public boolean isInitializeAllReplicationSubcommand()
Returns whether the user provided subcommand is the initialize all replication or not.- Returns:
trueif the user provided subcommand is the initialize all replication andfalseotherwise.
-
isPreExternalInitializationSubcommand
public boolean isPreExternalInitializationSubcommand()
Returns whether the user provided subcommand is the pre external initialization or not.- Returns:
trueif the user provided subcommand is the pre external initialization andfalseotherwise.
-
isPostExternalInitializationSubcommand
public boolean isPostExternalInitializationSubcommand()
Returns whether the user provided subcommand is the post external initialization or not.- Returns:
trueif the user provided subcommand is the post external initialization andfalseotherwise.
-
isInitializeReplicationSubcommand
public boolean isInitializeReplicationSubcommand()
Returns whether the user provided subcommand is the initialize replication or not.- Returns:
trueif the user provided subcommand is the initialize replication andfalseotherwise.
-
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
-
-