ReplicationCliArgumentParser.java revision d90a03781f4833f726597d735b79b49073940d75
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2007-2010 Sun Microsystems, Inc.
* Portions Copyright 2012-2015 ForgeRock AS.
*/
/**
* 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.
*/
public class ReplicationCliArgumentParser extends SecureConnectionCliParser
{
/** Arguments used when enabling replication for a server. */
static class ServerArgs
{
/** The 'hostName' argument for the first server. */
/** The 'port' argument for the first server. */
/** The 'bindDN' argument for the first server. */
/** The 'bindPasswordFile' argument for the first server. */
/** The 'bindPassword' argument for the first server. */
/** The 'replicationPort' argument for the first server. */
/** The 'noReplicationServer' argument for the first server. */
/** The 'onlyReplicationServer' argument for the first server. */
/** The 'secureReplication' argument for the first server. */
/**
* Get the password which has to be used for the command to connect to this server without
* prompting the user in the enable replication subcommand. If no password was specified return
* null.
*
* @return the password which has to be used for the command to connect to this server without
* prompting the user in the enable replication subcommand. If no password was specified
* return null.
*/
{
}
boolean configureReplicationDomain()
{
return !onlyReplicationServerArg.isPresent();
}
boolean configureReplicationServer()
{
return !noReplicationServerArg.isPresent();
}
}
private SubCommand enableReplicationSubCmd;
private SubCommand disableReplicationSubCmd;
private SubCommand initializeReplicationSubCmd;
private SubCommand initializeAllReplicationSubCmd;
private SubCommand resetChangelogNumber;
private SubCommand statusReplicationSubCmd;
private SubCommand purgeHistoricalSubCmd;
private int defaultAdminPort =
/** No-prompt argument. */
private String defaultLocalHostValue;
/** Arguments for the first server. */
/** Arguments for the second server. */
/** The 'skipPortCheckArg' argument to not check replication ports. */
private BooleanArgument skipPortCheckArg;
/** The 'noSchemaReplication' argument to not replicate schema. */
/** The 'useSecondServerAsSchemaSource' argument to not replicate schema. */
/** The 'disableAll' argument to disable all the replication configuration of server. */
/** The 'disableReplicationServer' argument to disable the replication server. */
/** The 'hostName' argument for the source server. */
private StringArgument hostNameSourceArg;
/** The 'port' argument for the source server. */
private IntegerArgument portSourceArg;
/** The 'hostName' argument for the destination server. */
private StringArgument hostNameDestinationArg;
/** The 'port' argument for the destination server. */
private IntegerArgument portDestinationArg;
/** The 'suffixes' global argument. */
/**The 'quiet' argument. */
private BooleanArgument quietArg;
/**The 'scriptFriendly' argument. */
/**Properties file argument. */
/**No-properties file argument. */
/**
* The argument that the user must set to display the equivalent
* non-interactive mode argument.
*/
/**
* The argument that allows the user to dump the equivalent non-interactive
* command to a file.
*/
/** The argument that the user must set to have advanced options in interactive mode. */
/**
* The argument set by the user to specify the configuration class
* (useful when dsreplication purge-historical runs locally).
*/
private StringArgument configClassArg;
/**
* The argument set by the user to specify the configuration file
* (useful when dsreplication purge-historical runs locally).
*/
private StringArgument configFileArg;
/** The 'maximumDuration' argument for the purge of historical. */
/** the 'change-number' argument for task reset-changenumber. */
/** The text of the enable replication subcommand. */
/** The text of the disable replication subcommand. */
/** The text of the initialize replication subcommand. */
/** The text of the initialize all replication subcommand. */
/** The text of the pre external initialization subcommand. */
/** The text of the initialize all replication subcommand. */
/** The text of the reset changenumber subcommand. */
/** The text of the status replication subcommand. */
/** The text of the purge historical subcommand. */
/** This CLI is always using the administration connector with SSL. */
private static final boolean alwaysSSL = true;
/**
* Creates a new instance of this argument parser with no arguments.
*
* @param mainClassName
* The fully-qualified name of the Java class that should
* be invoked to launch the program with which this
* argument parser is associated.
*/
{
super(mainClassName,
INFO_REPLICATION_TOOL_DESCRIPTION.get(ENABLE_REPLICATION_SUBCMD_NAME, INITIALIZE_REPLICATION_SUBCMD_NAME),
false);
}
/**
* Initialize the parser with the Global options and subcommands.
*
* @param outStream
* The output stream to use for standard output, or {@code null}
* if standard output is not needed.
* @throws ArgumentException
* If there is a problem with any of the parameters used to create this argument.
*/
throws ArgumentException
{
taskArgs = new TaskScheduleArgs();
try
{
}
catch (Throwable t)
{
// Ignore
}
}
/**
* Checks all the options parameters and updates the provided LocalizableMessageBuilder
* with the errors that where encountered.
*
* This method assumes that the method parseArguments for the parser has
* already been called.
* @param buf the LocalizableMessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
}
/** {@inheritDoc} */
{
int returnValue;
super.validateGlobalOptions(buf);
}
// Check that we can write on the provided path where we write the
// equivalent non-interactive commands.
{
{
}
else
{
if (f.isDirectory())
{
}
}
}
{
}
if (!isInteractive())
{
// Check that we have the required data
if (!baseDNsArg.isPresent() &&
!isResetChangeNumber() &&
!disableAllArg.isPresent() &&
{
}
if (getBindPasswordAdmin() == null &&
{
}
}
if (baseDNsArg.isPresent())
{
{
{
}
{
}
}
}
{
{
}
}
{
}
else
{
}
return returnValue;
}
/**
* Initialize Global option.
*
* @param outStream
* The output stream used for the usage.
* @throws ArgumentException
* If there is a problem with any of the parameters used
* to create this argument.
*/
throws ArgumentException
{
Argument[] argsToRemove = {
};
{
}
// Remove it from the default location and redefine it.
int index = 0;
null,
OPTION_LONG_ADMIN_UID, false, false, true,
getAdminUidArg().setHidden(false);
OPTION_SHORT_BINDPWD, OPTION_LONG_ADMIN_PWD, false, false, true,
OPTION_SHORT_BINDPWD_FILE, OPTION_LONG_ADMIN_PWD_FILE, false, false,
for (int i=0; i<index; i++)
{
}
}
/**
* Initialize the global options with the provided set of arguments.
* @param args the arguments to use to initialize the global options.
* @param argGroup the group to which args will be added.
* @throws ArgumentException if there is a conflict with the provided
* arguments.
*/
protected void initializeGlobalArguments(
throws ArgumentException
{
{
if (arg == advancedArg)
{
}
else
{
}
}
// Set the propertiesFile argument
}
/**
* Creates the enable replication subcommand and all the specific options
* for the subcommand.
*/
private void createEnableReplicationSubCommand() throws ArgumentException
{
skipPortCheckArg = new BooleanArgument(
"skipportcheck", 'S', "skipPortCheck",
enableReplicationSubCmd = new SubCommand(this,
};
{
}
}
private void createServerArgs1() throws ArgumentException
{
false, false, true, INFO_PORT_PLACEHOLDER.get(),
true, 1,
true, 65336,
"cn=Directory Manager", null,
null, "bindPassword1", false, false, true,
null, "bindPasswordFile1", false, false,
8989, null,
true, 1,
true, 65336,
"secureReplication1",
}
private void createServerArgs2() throws ArgumentException
{
true, 1,
true, 65336,
"cn=Directory Manager", null,
null, "bindPassword2", false, false, true,
'F', "bindPasswordFile2", false, false,
8989, null,
true, 1,
true, 65336,
"secureReplication2",
}
/**
* Creates the disable replication subcommand and all the specific options
* for the subcommand. Note: this method assumes that
* initializeGlobalArguments has already been called and that hostNameArg and
* portArg have been created.
*/
private void createDisableReplicationSubCommand()
throws ArgumentException
{
disableReplicationSubCmd = new SubCommand(this,
"cn=Directory Manager", OPTION_LONG_BINDDN,
disableAllArg = new BooleanArgument(
"disableall", 'a', "disableAll",
{
}
}
/**
* Creates the initialize replication subcommand and all the specific options
* for the subcommand.
*/
private void createInitializeReplicationSubCommand() throws ArgumentException
{
};
}
private void createRelatedServersOptions() throws ArgumentException
{
true, 1,
true, 65336,
null,
true, 1,
true, 65336,
}
/**
* Creates the initialize all replication subcommand and all the specific
* options for the subcommand. Note: this method assumes that
* initializeGlobalArguments has already been called and that hostNameArg and
* portArg have been created.
*/
private void createInitializeAllReplicationSubCommand()
throws ArgumentException
{
initializeAllReplicationSubCmd = new SubCommand(this,
{
}
}
/**
* Creates the subcommand that the user must launch before doing an external
* initialization of the topology ( and all the specific
* options for the subcommand. Note: this method assumes that
* initializeGlobalArguments has already been called and that hostNameArg and
* portArg have been created.
*/
private void createPreExternalInitializationSubCommand()
throws ArgumentException
{
preExternalInitializationSubCmd = new SubCommand(this,
"local-only",
'l',
"local-only",
{
}
}
/**
* Creates the subcommand that the user must launch after doing an external
* initialization of the topology ( and all the specific
* options for the subcommand. Note: this method assumes that
* initializeGlobalArguments has already been called and that hostNameArg and
* portArg have been created.
*/
private void createPostExternalInitializationSubCommand()
throws ArgumentException
{
postExternalInitializationSubCmd = new SubCommand(this,
{
}
}
private void createResetChangeNumberSubCommand() throws ArgumentException
{
};
}
private void setSubCommandArguments(SubCommand subCommand, Argument[] argsToAdd) throws ArgumentException
{
{
}
}
{
}
/**
* Creates the status replication subcommand and all the specific options
* for the subcommand. Note: this method assumes that
* initializeGlobalArguments has already been called and that hostNameArg and
* portArg have been created.
*/
private void createStatusReplicationSubCommand() throws ArgumentException
{
statusReplicationSubCmd = new SubCommand(this,
scriptFriendlyArg = new BooleanArgument(
"script-friendly",
's',
"script-friendly",
{
}
}
/**
* Creates the purge historical subcommand and all the specific options
* for the subcommand. Note: this method assumes that
* initializeGlobalArguments has already been called and that hostNameArg and
* portArg have been created.
*/
private void createPurgeHistoricalSubCommand()
throws ArgumentException
{
"maximumDuration",
null, // shortId
"maximumDuration",
true, // isRequired
false, // isMultivalued
true, // needsValue
null,
true, 0,
purgeHistoricalSubCmd = new SubCommand(
this,
{
}
{
}
}
/**
* Tells whether the user specified to have an interactive operation or not.
* This method must be called after calling parseArguments.
* @return {@code true} if the user specified to have an interactive
* operation and {@code false} otherwise.
*/
public boolean isInteractive()
{
return !noPromptArg.isPresent();
}
/**
* Tells whether the user specified to have a quite operation or not.
* This method must be called after calling parseArguments.
* @return {@code true} if the user specified to have a quite operation
* and {@code false} otherwise.
*/
public boolean isQuiet()
{
}
/**
* Tells whether the user specified to have a script-friendly output or not.
* This method must be called after calling parseArguments.
* @return {@code true} if the user specified to have a script-friendly
* output and {@code false} otherwise.
*/
public boolean isScriptFriendly()
{
return scriptFriendlyArg.isPresent();
}
/**
* 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.
*
* @return 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.
*/
public String getBindPasswordAdmin()
{
}
/**
* Returns the Administrator UID explicitly provided in the command-line.
* @return the Administrator UID explicitly provided in the command-line.
*/
public String getAdministratorUID()
{
return getValue(getAdminUidArg());
}
/**
* Returns the default Administrator UID value.
* @return the default Administrator UID value.
*/
public String getAdministratorUIDOrDefault()
{
return getValueOrDefault(getAdminUidArg());
}
/**
* Returns the Administrator UID argument.
* @return the Administrator UID argument.
*/
{
return secureArgsList.adminUidArg;
}
/**
* Returns the first server replication port explicitly provided in the enable
* replication subcommand.
* @return the first server replication port explicitly provided in the enable
* replication subcommand. Returns -1 if no port was explicitly provided.
*/
public int getReplicationPort1()
{
}
/**
* Returns the second server replication port explicitly provided in the
* enable replication subcommand.
* @return the second server replication port explicitly provided in the
* enable replication subcommand. Returns -1 if no port was explicitly
* provided.
*/
public int getReplicationPort2()
{
}
/**
* Returns whether the user asked to skip the replication port checks (if the
* ports are free) or not.
* @return {@code true} the user asked to skip the replication port
* checks (if the ports are free) and {@code false} otherwise.
*/
boolean skipReplicationPortCheck()
{
return skipPortCheckArg.isPresent();
}
/**
* Returns whether the user asked to not replicate the schema between servers.
* @return {@code true} if the user asked to not replicate schema and
* {@code false} otherwise.
*/
boolean noSchemaReplication()
{
return noSchemaReplicationArg.isPresent();
}
/**
* Returns whether the user asked to use the second server to initialize the
* schema of the first server.
* @return {@code true} if the user asked to use the second server to
* initialize the schema of the first server and {@code false} otherwise.
*/
boolean useSecondServerAsSchemaSource()
{
return useSecondServerAsSchemaSourceArg.isPresent();
}
/**
* Returns the host name explicitly provided in the disable replication
* subcommand.
* @return the host name explicitly provided in the disable replication
* subcommand.
*/
public String getHostNameToDisable()
{
}
/**
* Returns the host name default value in the disable replication
* subcommand.
* @return the host name default value in the disable replication
* subcommand.
*/
public String getHostNameToDisableOrDefault()
{
}
/**
* Returns the server bind dn explicitly provided in the disable replication
* subcommand.
* @return the server bind dn explicitly provided in the disable replication
* subcommand.
*/
public String getBindDNToDisable()
{
}
/**
* Returns the server bind dn default value in the disable replication
* subcommand.
* @return the server bind dn default value in the enable replication
* subcommand.
*/
public String getDefaultBindDnToDisable()
{
}
/**
* Returns the host name explicitly provided in the status replication
* subcommand.
* @return the host name explicitly provided in the status replication
* subcommand.
*/
public String getHostNameToStatus()
{
}
/**
* Returns the host name default value in the status replication subcommand.
* @return the host name default value in the status replication subcommand.
*/
public String getHostNameToStatusOrDefault()
{
}
/**
* Returns the host name explicitly provided in the initialize all replication
* subcommand.
* @return the host name explicitly provided in the initialize all replication
* subcommand.
*/
public String getHostNameToInitializeAll()
{
}
/**
* Returns the host name default value in the initialize all replication
* subcommand.
* @return the host name default value in the initialize all replication
* subcommand.
*/
{
}
/**
* Returns the host name explicitly provided in the pre external
* initialization subcommand.
* @return the host name explicitly provided in the pre external
* initialization subcommand.
*/
{
}
/**
* Returns the host name default value in the pre external initialization
* subcommand.
* @return the host name default value in the pre external initialization
* subcommand.
*/
{
}
/**
* Returns the host name explicitly provided in the post external
* initialization subcommand.
* @return the host name explicitly provided in the post external
* initialization subcommand.
*/
{
}
/**
* Returns the host name default value in the post external initialization
* subcommand.
* @return the host name default value in the post external initialization
* subcommand.
*/
{
}
/**
* Returns the source host name explicitly provided in the initialize
* replication subcommand.
* @return the source host name explicitly provided in the initialize
* replication subcommand.
*/
public String getHostNameSource()
{
return getValue(hostNameSourceArg);
}
/**
* Returns the first host name default value in the initialize replication
* subcommand.
* @return the first host name default value in the initialize replication
* subcommand.
*/
public String getHostNameSourceOrDefault()
{
return getValueOrDefault(hostNameSourceArg);
}
/**
* Returns the destination host name explicitly provided in the initialize
* replication subcommand.
* @return the destination host name explicitly provided in the initialize
* replication subcommand.
*/
public String getHostNameDestination()
{
return getValue(hostNameDestinationArg);
}
/**
* Returns the destination host name default value in the initialize
* replication subcommand.
* @return the destination host name default value in the initialize
* replication subcommand.
*/
public String getHostNameDestinationOrDefault()
{
return getValueOrDefault(hostNameDestinationArg);
}
/**
* Returns the source server port explicitly provided in the initialize
* replication subcommand.
* @return the source server port explicitly provided in the initialize
* replication subcommand. Returns -1 if no port was explicitly provided.
*/
public int getPortSource()
{
return getValue(portSourceArg);
}
/**
* Returns the source server port default value in the initialize replication
* subcommand.
* @return the source server port default value in the initialize replication
* subcommand.
*/
public int getPortSourceOrDefault()
{
return getValueOrDefault(portSourceArg);
}
/**
* Returns the destination server port explicitly provided in the initialize
* replication subcommand.
* @return the destination server port explicitly provided in the initialize
* replication subcommand. Returns -1 if no port was explicitly provided.
*/
public int getPortDestination()
{
return getValue(portDestinationArg);
}
/**
* Returns the destination server port default value in the initialize
* replication subcommand.
* @return the destination server port default value in the initialize
* replication subcommand.
*/
public int getPortDestinationOrDefault()
{
return getValueOrDefault(portDestinationArg);
}
/**
* Returns the server port explicitly provided in the disable replication
* subcommand.
* @return the server port explicitly provided in the disable replication
* subcommand. Returns -1 if no port was explicitly provided.
*/
public int getPortToDisable()
{
}
/**
* Returns the server port default value in the disable replication
* subcommand.
* @return the server port default value in the disable replication
* subcommand.
*/
public int getPortToDisableOrDefault()
{
}
/**
* Returns the server port explicitly provided in the initialize all
* replication subcommand.
* @return the server port explicitly provided in the initialize all
* replication subcommand. Returns -1 if no port was explicitly provided.
*/
public int getPortToInitializeAll()
{
}
/**
* Returns the server port default value in the initialize all replication
* subcommand.
* @return the server port default value in the initialize all replication
* subcommand.
*/
public int getPortToInitializeAllOrDefault()
{
}
/**
* Returns the server port explicitly provided in the pre external
* initialization subcommand.
* @return the server port explicitly provided in the pre external
* initialization subcommand. Returns -1 if no port was explicitly provided.
*/
public int getPortToPreExternalInitialization()
{
}
/**
* Returns the server port default value in the pre external initialization
* subcommand.
* @return the server port default value in the pre external initialization
* subcommand.
*/
public int getDefaultPortToPreExternalInitialization()
{
}
/**
* Returns the server port explicitly provided in the post external
* initialization subcommand.
* @return the server port explicitly provided in the post external
* initialization subcommand. Returns -1 if no port was explicitly provided.
*/
public int getPortToPostExternalInitialization()
{
}
/**
* Returns the server port default value in the post external initialization
* subcommand.
* @return the server port default value in the post external initialization
* subcommand.
*/
public int getDefaultPortToPostExternalInitialization()
{
}
/**
* Returns the server port explicitly provided in the status replication
* subcommand.
* @return the server port explicitly provided in the status replication
* subcommand. Returns -1 if no port was explicitly provided.
*/
public int getPortToStatus()
{
}
/**
* Returns the server port default value in the status replication subcommand.
* @return the server port default value in the status replication subcommand.
*/
public int getPortToStatusOrDefault()
{
}
/**
* Returns the list of base DNs provided by the user.
* @return the list of base DNs provided by the user.
*/
{
return baseDNsArg.getValues();
}
/**
* Returns the config class value provided in the hidden argument of the
* command-line.
* @return the config class value provided in the hidden argument of the
* command-line.
*/
public String getConfigClass()
{
return getValue(configClassArg);
}
/**
* Returns the config file value provided in the hidden argument of the
* command-line.
* @return the config file value provided in the hidden argument of the
* command-line.
*/
public String getConfigFile()
{
return getValue(configFileArg);
}
/**
* Returns the argument's value if present or else return the argument's default value.
*
* @param arg the argument
* @return the argument's value if present, the argument's default value if not present
*/
{
return v != null ? v : defaultValue;
}
/**
* Returns the argument's value if present or else return the argument's default value.
*
* @param arg the argument
* @return the argument's value if present, the argument's default value if not present
*/
{
return v != -1 ? v : defaultValue;
}
/**
* Returns the value of the provided argument only if the user provided it
* explicitly.
* @param arg the StringArgument to be handled.
* @return the value of the provided argument only if the user provided it
* explicitly.
*/
{
}
/**
* Returns the default value of the provided argument.
* @param arg the StringArgument to be handled.
* @return the default value of the provided argument.
*/
{
return arg.getDefaultValue();
}
/**
* Returns the value of the provided argument only if the user provided it
* explicitly.
* @param arg the StringArgument to be handled.
* @return the value of the provided argument only if the user provided it
* explicitly.
*/
{
{
try
{
return arg.getIntValue();
}
catch (ArgumentException ae)
{
// This is a bug
throw new IllegalStateException(
"There was an argument exception calling "+
"ReplicationCliParser.getValue(). This appears to be a bug "+
"because this method should be called after calling "+
"parseArguments which should result in an error.", ae);
}
}
return -1;
}
/**
* Returns the default value of the provided argument.
* @param arg the StringArgument to be handled.
* @return the default value of the provided argument.
*/
{
}
/**
* Checks the subcommand options and updates the provided LocalizableMessageBuilder
* with the errors that were encountered with the subcommand options.
*
* This method assumes that the method parseArguments for the parser has
* already been called.
* @param buf the LocalizableMessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
{
}
else if (isDisableReplicationSubcommand())
{
}
else if (isStatusReplicationSubcommand())
{
}
else if (isInitializeReplicationSubcommand())
{
}
else if (isPurgeHistoricalSubcommand())
{
}
else if (isResetChangeNumber())
{
}
}
/**
* Checks the purge historical subcommand options and updates the
* provided LocalizableMessageBuilder with the errors that were encountered with the
* subcommand options.
*
* This method assumes that the method parseArguments for the parser has
* already been called.
* @param buf the LocalizableMessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
try
{
if (!isInteractive() && !connectionArgumentsPresent())
{
}
else
{
}
}
catch (ClientException | ArgumentException e)
{
}
}
/**
* Returns whether the user provided subcommand is the enable replication
* or not.
* @return {@code true} if the user provided subcommand is the
* enable replication and {@code false} otherwise.
*/
public boolean isEnableReplicationSubcommand()
{
}
/**
* Returns whether the user provided subcommand is the disable replication
* or not.
* @return {@code true} if the user provided subcommand is the
* disable replication and {@code false} otherwise.
*/
public boolean isDisableReplicationSubcommand()
{
}
/**
* Returns whether the user specified the reset changelog numbering subcommand.
* @return {@code true} if the user wanted to reset change number
*/
public boolean isResetChangeNumber()
{
}
/**
* Returns whether the user provided subcommand is the status replication
* or not.
* @return {@code true} if the user provided subcommand is the
* status replication and {@code false} otherwise.
*/
public boolean isStatusReplicationSubcommand()
{
}
/**
* Returns whether the user provided subcommand is the purge historical
* or not.
* @return {@code true} if the user provided subcommand is the
* purge historical and {@code false} otherwise.
*/
public boolean isPurgeHistoricalSubcommand()
{
return isSubcommand(PURGE_HISTORICAL_SUBCMD_NAME);
}
/**
* Returns whether the user provided subcommand is the initialize all
* replication or not.
* @return {@code true} if the user provided subcommand is the
* initialize all replication and {@code false} otherwise.
*/
public boolean isInitializeAllReplicationSubcommand()
{
}
/**
* Returns whether the user provided subcommand is the pre external
* initialization or not.
* @return {@code true} if the user provided subcommand is the
* pre external initialization and {@code false} otherwise.
*/
public boolean isPreExternalInitializationSubcommand()
{
}
/**
* Returns whether the user provided subcommand is the post external
* initialization or not.
* @return {@code true} if the user provided subcommand is the
* post external initialization and {@code false} otherwise.
*/
public boolean isPostExternalInitializationSubcommand()
{
}
/**
* Returns whether the user provided subcommand is the initialize replication
* or not.
* @return {@code true} if the user provided subcommand is the
* initialize replication and {@code false} otherwise.
*/
public boolean isInitializeReplicationSubcommand()
{
}
/**
* Returns whether the command-line subcommand has the name provided
* or not.
* @param name the name of the subcommand.
* @return {@code true} if command-line subcommand has the name provided
* and {@code false} otherwise.
*/
{
}
/**
* Checks the enable replication subcommand options and updates the provided
* LocalizableMessageBuilder with the errors that were encountered with the subcommand
* options.
*
* This method assumes that the method parseArguments for the parser has
* already been called.
* @param buf the LocalizableMessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
Argument[][] conflictingPairs =
{
};
{
{
}
}
&& !isInteractive()
{
}
}
/**
* Checks the disable replication subcommand options and updates the provided
* LocalizableMessageBuilder with the errors that were encountered with the subcommand
* options.
*
* This method assumes that the method parseArguments for the parser has
* already been called.
* @param buf the LocalizableMessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
Argument[][] conflictingPairs =
{
};
{
{
}
}
}
/**
* Checks the status replication subcommand options and updates the provided
* LocalizableMessageBuilder with the errors that were encountered with the subcommand
* options.
*
* This method assumes that the method parseArguments for the parser has
* already been called.
* @param buf the LocalizableMessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
{
}
}
/**
* Checks the initialize replication subcommand options and updates the
* provided LocalizableMessageBuilder with the errors that were encountered with the
* subcommand options.
*
* This method assumes that the method parseArguments for the parser has
* already been called.
* @param buf the LocalizableMessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
&& !isInteractive()
{
}
}
/**
* Adds a message to the provided LocalizableMessageBuilder.
* @param buf the LocalizableMessageBuilder.
* @param message the message to be added.
*/
{
{
}
}
/**
* Returns the default value to be used for the host.
* @return the default value to be used for the host.
*/
private String getDefaultHostValue()
{
if (defaultLocalHostValue == null)
{
try
{
}
catch (Throwable t)
{
}
if (defaultLocalHostValue == null)
{
defaultLocalHostValue = "localhost";
}
}
return defaultLocalHostValue;
}
/**
* Returns the SecureConnectionCliArgs object containing the arguments
* of this parser.
* @return the SecureConnectionCliArgs object containing the arguments
* of this parser.
*/
public SecureConnectionCliArgs getSecureArgsList()
{
return secureArgsList;
}
/**
* Returns the TaskScheduleArgs object containing the arguments
* of this parser.
* @return the TaskScheduleArgs object containing the arguments
* of this parser.
*/
public TaskScheduleArgs getTaskArgsList()
{
return taskArgs;
}
/**
* Returns whether the user specified connection arguments or not.
* @return {@code true} if the user specified connection arguments and
* {@code false} otherwise.
*/
boolean connectionArgumentsPresent()
{
if (isPurgeHistoricalSubcommand()) {
// This have to be explicitly specified because their original definition
// has been replaced.
return secureArgsPresent || adminArgsPresent;
}
return true;
}
/**
* Returns the maximum duration explicitly provided in the purge historical
* replication subcommand.
* @return the maximum duration explicitly provided in the purge historical
* replication subcommand. Returns -1 if no port was explicitly provided.
*/
public int getMaximumDuration()
{
return getValue(maximumDurationArg);
}
/**
* Returns the maximum duration default value in the purge historical
* replication subcommand.
* @return the maximum duration default value in the purge historical
* replication subcommand.
*/
public int getMaximumDurationOrDefault()
{
return getValueOrDefault(maximumDurationArg);
}
/**
* Returns the changenumber specified as argument.
* @return the changenumber specified as argument
*/
public int getResetChangeNumber()
{
return getValue(resetChangeNumber);
}
/**
* Sets the start change number value.
* @param changeNumber the new value of the option
*/
{
resetChangeNumber.setPresent(true);
}
}