/*
* 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 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.
*/
{
int defaultAdminPort =
/**
* No-prompt argument.
*/
/**
* 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.
*/
/**
* The 'hostName' argument for the second server.
*/
/**
* The 'port' argument for the second server.
*/
/**
* The 'binDN' argument for the second server.
*/
/**
* The 'bindPasswordFile' argument for the second server.
*/
/**
* The 'bindPassword' argument for the second server.
*/
/**
* The 'replicationPort' argument for the second server.
*/
/**
* The 'noReplicationServer' argument for the second server.
*/
/**
* The 'onlyReplicationServer' argument for the second server.
*/
/**
* The 'secureReplication' argument for the second server.
*/
/**
* The 'skipPortCheckArg' argument to not check replication ports.
*/
/**
* 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.
*/
/**
* The 'port' argument for the source server.
*/
/**
* The 'hostName' argument for the destination server.
*/
/**
* The 'port' argument for the destination server.
*/
/**
* The 'suffixes' global argument.
*/
/**
* The 'quiet' argument.
*/
/**
* 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)
// The argument set by the user to specify the configuration file
// (useful when dsreplication purge-historical runs locally)
/**
* The 'maximumDuration' argument for the purge of historical.
*/
/**
* 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.
*/
"initialize-all";
/**
* The text of the pre external initialization subcommand.
*/
"pre-external-initialization";
/**
* The text of the initialize all replication subcommand.
*/
"post-external-initialization";
/**
* 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,
false);
}
/**
* Initialize the parser with the Global options and subcommands.
*
* @param outStream
* The output stream to use for standard output, or <CODE>null</CODE>
* 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 MessageBuilder
* with the errors that where encountered.
*
* This method assumes that the method parseArguments for the parser has
* already been called.
* @param buf the MessageBuilder 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.
{
{
file));
}
else
{
if (f.isDirectory())
{
}
}
}
{
}
if (!isInteractive())
{
// Check that we have the required data
if (!baseDNsArg.isPresent() &&
!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,
OPTION_SHORT_BINDPWD, OPTION_LONG_ADMIN_PWD, false, false, true,
OPTION_SHORT_BINDPWD_FILE, OPTION_LONG_ADMIN_PWD_FILE, false, false,
quietArg = new BooleanArgument(
noPromptArg = new BooleanArgument(
OPTION_LONG_EQUIVALENT_COMMAND_FILE_PATH, false, false, true,
OPTION_LONG_CONFIG_CLASS, true, false,
true, INFO_CONFIGCLASS_PLACEHOLDER.get(),
configClassArg.setHidden(true);
null,
configFileArg.setHidden(true);
for (int i=0; i<index; i++)
{
}
this.propertiesFileArgument = new StringArgument(
this.noPropertiesFileArgument = new BooleanArgument(
}
/**
* 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
{
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",
true, 1,
true, 65336,
"cn=Directory Manager", null,
null, "bindPassword2", false, false, true,
'F', "bindPasswordFile2", false, false,
8989, null,
true, 1,
true, 65336,
"secureReplication2",
skipPortCheckArg = new BooleanArgument(
"skipportcheck", 'S', "skipPortCheck",
enableReplicationSubCmd = new SubCommand(this,
};
{
}
}
/**
* 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
{
true, 1,
true, 65336,
null,
true, 1,
true, 65336,
initializeReplicationSubCmd = new SubCommand(this,
};
{
}
}
/**
* 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,
{
}
}
/**
* 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.
*/
{
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</CODE> if the user specified to have an interactive
* operation and <CODE>false</CODE> 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</CODE> if the user specified to have a quite operation
* and <CODE>false</CODE> 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</CODE> if the user specified to have a script-friendly
* output and <CODE>false</CODE> otherwise.
*/
public boolean isScriptFriendly()
{
return scriptFriendlyArg.isPresent();
}
/**
* Get the password which has to be used for the command to connect to the
* first 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 the
* first server without prompting the user in the enable replication
* subcommand. If no password was specified return null.
*/
{
}
/**
* Get the password which has to be used for the command to connect to the
* second 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 the
* second server without prompting the user in the enable replication
* subcommand. If no password was specified return null.
*/
{
}
/**
* 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.
*/
{
}
/**
* Get the password of the first server which has to be used in the
* enable replication subcommand.
*
* @param dn
* The user DN for which to password could be asked.
* @param out
* The input stream to used if we have to prompt to the
* user.
* @param err
* The error stream to used if we have to prompt to the
* user.
* @return the password of the first server which has to be used n the
* enable replication subcommand.
*/
{
}
/**
* Get the password of the second server which has to be used in the
* enable replication subcommand.
*
* @param dn
* The user DN for which to password could be asked.
* @param out
* The input stream to used if we have to prompt to the
* user.
* @param err
* The error stream to used if we have to prompt to the
* user.
* @return the password of the second server which has to be used in the
* enable replication subcommand.
*/
{
}
/**
* Get the password of the global administrator which has to be used for the
* command.
*
* @param dn
* The user DN for which to password could be asked.
* @param out
* The input stream to used if we have to prompt to the
* user.
* @param err
* The error stream to used if we have to prompt to the
* user.
* @return the password of the global administrator which has to be used for
* the command.
*/
{
}
/**
* Returns the Administrator UID explicitly provided in the command-line.
* @return the Administrator UID explicitly provided in the command-line.
*/
{
}
/**
* Returns the default Administrator UID value.
* @return the default Administrator UID value.
*/
{
}
/**
* Returns the first host name explicitly provided in the enable replication
* subcommand.
* @return the first host name explicitly provided in the enable replication
* subcommand.
*/
{
return getValue(hostName1Arg);
}
/**
* Returns the first host name default value in the enable replication
* subcommand.
* @return the first host name default value in the enable replication
* subcommand.
*/
{
return getDefaultValue(hostName1Arg);
}
/**
* Returns the first server port explicitly provided in the enable replication
* subcommand.
* @return the first server port explicitly provided in the enable replication
* subcommand. Returns -1 if no port was explicitly provided.
*/
public int getPort1()
{
}
/**
* Returns the first server port default value in the enable replication
* subcommand.
* @return the first server port default value in the enable replication
* subcommand.
*/
public int getDefaultPort1()
{
return getDefaultValue(port1Arg);
}
/**
* Returns the first server bind dn explicitly provided in the enable
* replication subcommand.
* @return the first server bind dn explicitly provided in the enable
* replication subcommand.
*/
{
return getValue(bindDn1Arg);
}
/**
* Returns the first server bind dn default value in the enable replication
* subcommand.
* @return the first server bind dn default value in the enable replication
* subcommand.
*/
{
return getDefaultValue(bindDn1Arg);
}
/**
* 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()
{
return getValue(replicationPort1Arg);
}
/**
* Returns the first server replication port default value in the enable
* replication subcommand.
* @return the first server replication port default value in the enable
* replication subcommand.
*/
public int getDefaultReplicationPort1()
{
return getDefaultValue(replicationPort1Arg);
}
/**
* Returns whether the user asked to have replication communication with the
* first server or not.
* @return <CODE>true</CODE> the user asked to have replication communication
* with the first server and <CODE>false</CODE> otherwise.
*/
public boolean isSecureReplication1()
{
return secureReplication1Arg.isPresent();
}
/**
* Returns the second host name explicitly provided in the enable replication
* subcommand.
* @return the second host name explicitly provided in the enable replication
* subcommand.
*/
{
return getValue(hostName2Arg);
}
/**
* Returns the second host name default value in the enable replication
* subcommand.
* @return the second host name default value in the enable replication
* subcommand.
*/
{
return getDefaultValue(hostName2Arg);
}
/**
* Returns the second server port explicitly provided in the enable
* replication subcommand.
* @return the second server port explicitly provided in the enable
* replication subcommand. Returns -1 if no port was explicitly provided.
*/
public int getPort2()
{
}
/**
* Returns the second server port default value in the enable replication
* subcommand.
* @return the second server port default value in the enable replication
* subcommand.
*/
public int getDefaultPort2()
{
return getDefaultValue(port2Arg);
}
/**
* Returns the second server bind dn explicitly provided in the enable
* replication subcommand.
* @return the second server bind dn explicitly provided in the enable
* replication subcommand.
*/
{
return getValue(bindDn2Arg);
}
/**
* Returns the second server bind dn default value in the enable replication
* subcommand.
* @return the second server bind dn default value in the enable replication
* subcommand.
*/
{
return getDefaultValue(bindDn2Arg);
}
/**
* 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()
{
return getValue(replicationPort2Arg);
}
/**
* Returns the second server replication port default value in the enable
* replication subcommand.
* @return the second server replication port default value in the enable
* replication subcommand.
*/
public int getDefaultReplicationPort2()
{
return getDefaultValue(replicationPort2Arg);
}
/**
* Returns whether the user asked to have replication communication with the
* second server or not.
* @return <CODE>true</CODE> the user asked to have replication communication
* with the second server and <CODE>false</CODE> otherwise.
*/
public boolean isSecureReplication2()
{
return secureReplication2Arg.isPresent();
}
/**
* Returns whether the user asked to skip the replication port checks (if the
* ports are free) or not.
* @return <CODE>true</CODE> the user asked to skip the replication port
* checks (if the ports are free) and <CODE>false</CODE> otherwise.
*/
public boolean skipReplicationPortCheck()
{
return skipPortCheckArg.isPresent();
}
/**
* Returns whether the user asked to not replicate the schema between servers.
* @return <CODE>true</CODE> if the user asked to not replicate schema and
* <CODE>false</CODE> otherwise.
*/
public 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</CODE> if the user asked to use the second server to
* initialize the schema of the first server and <CODE>false</CODE> otherwise.
*/
public 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.
*/
{
}
/**
* Returns the host name default value in the disable replication
* subcommand.
* @return the host name default value in the disable replication
* subcommand.
*/
{
}
/**
* Returns the server bind dn explicitly provided in the disable replication
* subcommand.
* @return the server bind dn explicitly provided in the disable replication
* subcommand.
*/
{
}
/**
* Returns the server bind dn default value in the disable replication
* subcommand.
* @return the server bind dn default value in the enable replication
* subcommand.
*/
{
}
/**
* Returns the host name explicitly provided in the status replication
* subcommand.
* @return the host name explicitly provided in the status replication
* subcommand.
*/
{
}
/**
* Returns the host name default value in the status replication subcommand.
* @return the host name default value in the status replication subcommand.
*/
{
}
/**
* Returns the host name explicitly provided in the initialize all replication
* subcommand.
* @return the host name explicitly provided in the initialize all replication
* subcommand.
*/
{
}
/**
* 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.
*/
{
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.
*/
{
return getDefaultValue(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.
*/
{
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.
*/
{
return getDefaultValue(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 getDefaultPortSource()
{
return getDefaultValue(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 getDefaultPortDestination()
{
return getDefaultValue(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 getDefaultPortToDisable()
{
}
/**
* 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 getDefaultPortToInitializeAll()
{
}
/**
* 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 getDefaultPortToStatus()
{
}
/**
* 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.
*/
{
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.
*/
{
return getValue(configFileArg);
}
/**
* 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.
*/
{
{
}
return v;
}
/**
* 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.
*/
{
int v = -1;
{
try
{
v = 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 v;
}
/**
* Returns the default value of the provided argument.
* @param arg the StringArgument to be handled.
* @return the default value of the provided argument.
*/
{
int returnValue = -1;
if (defaultValue != null)
{
}
return returnValue;
}
/**
* Checks the subcommand options and updates the provided MessageBuilder
* 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 MessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
{
}
else if (isDisableReplicationSubcommand())
{
}
else if (isStatusReplicationSubcommand())
{
}
else if (isInitializeReplicationSubcommand())
{
}
else if (isInitializeAllReplicationSubcommand())
{
}
else if (isPreExternalInitializationSubcommand())
{
}
else if (isPostExternalInitializationSubcommand())
{
}
else if (isPurgeHistoricalSubcommand())
{
}
else
{
// This can occur if the user did not provide any subcommand. We assume
// that the error informing of this will be generated in
// validateGlobalOptions.
}
}
/**
* Checks the purge historical subcommand options and updates the
* provided MessageBuilder 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 MessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
try
{
if (!isInteractive() && !connectionArgumentsPresent())
{
}
else
{
}
}
catch (OpenDsException ode)
{
}
}
/**
* Returns whether the user provided subcommand is the enable replication
* or not.
* @return <CODE>true</CODE> if the user provided subcommand is the
* enable replication and <CODE>false</CODE> otherwise.
*/
public boolean isEnableReplicationSubcommand()
{
}
/**
* Returns whether the user provided subcommand is the disable replication
* or not.
* @return <CODE>true</CODE> if the user provided subcommand is the
* disable replication and <CODE>false</CODE> otherwise.
*/
public boolean isDisableReplicationSubcommand()
{
}
/**
* Returns whether the user provided subcommand is the status replication
* or not.
* @return <CODE>true</CODE> if the user provided subcommand is the
* status replication and <CODE>false</CODE> otherwise.
*/
public boolean isStatusReplicationSubcommand()
{
}
/**
* Returns whether the user provided subcommand is the purge historical
* or not.
* @return <CODE>true</CODE> if the user provided subcommand is the
* purge historical and <CODE>false</CODE> 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</CODE> if the user provided subcommand is the
* initialize all replication and <CODE>false</CODE> otherwise.
*/
public boolean isInitializeAllReplicationSubcommand()
{
}
/**
* Returns whether the user provided subcommand is the pre external
* initialization or not.
* @return <CODE>true</CODE> if the user provided subcommand is the
* pre external initialization and <CODE>false</CODE> otherwise.
*/
public boolean isPreExternalInitializationSubcommand()
{
}
/**
* Returns whether the user provided subcommand is the post external
* initialization or not.
* @return <CODE>true</CODE> if the user provided subcommand is the
* post external initialization and <CODE>false</CODE> otherwise.
*/
public boolean isPostExternalInitializationSubcommand()
{
}
/**
* Returns whether the user provided subcommand is the initialize replication
* or not.
* @return <CODE>true</CODE> if the user provided subcommand is the
* initialize replication and <CODE>false</CODE> 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</CODE> if command-line subcommand has the name provided
* and <CODE>false</CODE> otherwise.
*/
{
boolean isSubcommand = false;
if (subCommand != null)
{
}
return isSubcommand;
}
/**
* Checks the enable replication subcommand options and updates the provided
* MessageBuilder 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 MessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
Argument[][] conflictingPairs =
{
};
{
{
}
}
!isInteractive())
{
{
}
}
}
/**
* Checks the disable replication subcommand options and updates the provided
* MessageBuilder 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 MessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
Argument[][] conflictingPairs =
{
};
{
{
}
}
}
/**
* Checks the initialize all replication subcommand options and updates the
* provided MessageBuilder 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 MessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
}
/**
* Checks the pre external initialization subcommand options and updates the
* provided MessageBuilder 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 MessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
}
/**
* Checks the post external initialization subcommand options and updates the
* provided MessageBuilder 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 MessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
}
/**
* Checks the status replication subcommand options and updates the provided
* MessageBuilder 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 MessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
{
}
}
/**
* Checks the initialize replication subcommand options and updates the
* provided MessageBuilder 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 MessageBuilder object where we add the error messages
* describing the errors encountered.
*/
{
{
{
}
}
}
/**
* Adds a message to the provided MessageBuilder.
* @param buf the MessageBuilder.
* @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.
*/
{
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.
*/
{
return secureArgsList;
}
/**
* Returns the TaskScheduleArgs object containing the arguments
* of this parser.
* @return the TaskScheduleArgs object containing the arguments
* of this parser.
*/
{
return taskArgs;
}
/**
* Returns whether the user specified connection arguments or not.
* @return {@code true} if the user specified connection arguments and
* {@code false} otherwise.
*/
public boolean connectionArgumentsPresent()
{
if (isPurgeHistoricalSubcommand()) {
// This have to be explicitly specified because their original definition
// has been replaced.
return secureArgsPresent || adminArgsPresent;
}
else
{
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 getDefaultMaximumDuration()
{
return getDefaultValue(maximumDurationArg);
}
}