ReplicationCliArgumentParser.java revision fbbcdae277f66a56a2e5450858b249f82470dc56
/*
* 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
* 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
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2008 Sun Microsystems, Inc.
*/
/**
* 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
{
private SubCommand enableReplicationSubCmd;
private SubCommand disableReplicationSubCmd;
private SubCommand initializeReplicationSubCmd;
private SubCommand initializeAllReplicationSubCmd;
private SubCommand statusReplicationSubCmd;
private BooleanArgument noPromptArg;
private String defaultLocalHostValue;
/**
* The 'hostName' argument for the first server.
*/
/**
* The 'port' argument for the first server.
*/
/**
* The 'binDN' argument for the first server.
*/
/**
* The 'bindPasswordFile' argument for the first server.
*/
/**
* The 'bindPassword' argument for the first server.
*/
/**
* The 'useSSLArg' argument for the first server.
*/
/**
* The 'useStartTLS1Arg' argument for the first server.
*/
/**
* The 'replicationPort' 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 'useSSLArg' argument for the second server.
*/
/**
* The 'useStartTLS2Arg' argument for the second server.
*/
/**
* The 'replicationPort' argument for the second server.
*/
/**
* The 'secureReplication' argument for the second server.
*/
/**
* The 'skipPortCheckArg' argument to not check replication ports.
*/
private BooleanArgument skipPortCheckArg;
/**
* The 'noSchemaReplication' argument to not replicate schema.
*/
private BooleanArgument noSchemaReplicationArg;
/**
* The 'useSecondServerAsSchemaSource' argument to not replicate schema.
*/
/**
* The 'hostName' argument for the source server.
*/
/**
* The 'port' argument for the source server.
*/
/**
* The 'useSSLArg' for the source server.
*/
/**
* The 'useStartTLSSourceArg' for the source server.
*/
/**
* The 'hostName' argument for the destination server.
*/
/**
* The 'port' argument for the destination server.
*/
/**
* The 'useSSLArg' argument for the destination server.
*/
/**
* The 'useStartTLSDestinationArg' argument for the destination server.
*/
/**
* The 'suffixes' global argument.
*/
/**
* The argument that specifies if the external initialization will be
* performed only on this server.
*/
/**
* The 'quiet' argument.
*/
private BooleanArgument quietArg;
/**
* The 'scriptFriendly' argument.
*/
private BooleanArgument scriptFriendlyArg;
/**
* 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.
*/
public static final String INITIALIZE_ALL_REPLICATION_SUBCMD_NAME =
"initialize-all";
/**
* The text of the pre external initialization subcommand.
*/
public static final String PRE_EXTERNAL_INITIALIZATION_SUBCMD_NAME =
"pre-external-initialization";
/**
* The text of the initialize all replication subcommand.
*/
public static final String POST_EXTERNAL_INITIALIZATION_SUBCMD_NAME =
"post-external-initialization";
/**
* The text of the status replication subcommand.
*/
/**
* 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
{
}
/**
* 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);
}
if (!isInteractive())
{
// Check that we have the required data
{
}
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_SHORT_BINDPWD, "adminPassword", false, false, true,
"adminPasswordFile",
OPTION_SHORT_BINDPWD_FILE, "adminPasswordFile", false, false,
noPromptArg = new BooleanArgument(
for (int i=0; i<index; i++)
{
}
quietArg = new BooleanArgument(
}
/**
* Creates the enable replication subcommand and all the specific options
* for the subcommand.
*/
private void createEnableReplicationSubCommand()
throws ArgumentException
{
"cn=Directory Manager", null,
null, "bindPassword1", false, false, true,
null, "bindPasswordFile1", false, false,
"startTLS1",
8989, null,
"secureReplication1",
"cn=Directory Manager", null,
null, "bindPassword2", false, false, true,
'F', "bindPasswordFile2", false, false,
"startTLS2",
8989, null,
"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,
* portArg, startTLSArg and useSSLArg have been created.
*/
private void createDisableReplicationSubCommand()
throws ArgumentException
{
disableReplicationSubCmd = new SubCommand(this,
"cn=Directory Manager", OPTION_LONG_BINDDN,
{
}
}
/**
* Creates the initialize replication subcommand and all the specific options
* for the subcommand.
*/
private void createInitializeReplicationSubCommand()
throws ArgumentException
{
null,
"useSSLSource",
OPTION_SHORT_START_TLS, "startTLSSource",
null,
"useSSLDestination",
"startTLSDestination",
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,
* portArg, startTLSArg and useSSLArg 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,
* portArg, startTLSArg and useSSLArg 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,
* portArg, startTLSArg and useSSLArg 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,
* portArg, startTLSArg and useSSLArg have been created.
*/
private void createStatusReplicationSubCommand() throws ArgumentException
{
statusReplicationSubCmd = new SubCommand(this,
scriptFriendlyArg = new BooleanArgument(
"script-friendly",
's',
"script-friendly",
{
}
}
/**
* 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.
*/
public String getBindPassword1()
{
}
/**
* 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.
*/
public String getBindPassword2()
{
}
/**
* 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()
{
}
/**
* 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.
*/
public String getBindPassword1(
{
}
/**
* 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.
*/
public String getBindPassword2(
{
}
/**
* 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.
*/
public String getBindPasswordAdmin(
{
}
/**
* Indicate if the SSL mode is required for the first server in the enable
* replication subcommand.
*
* @return <CODE>true</CODE> if SSL mode is required for the first server in
* the enable replication subcommand and <CODE>false</CODE> otherwise.
*/
public boolean useSSL1()
{
return useSSL1Arg.isPresent();
}
/**
* Indicate if the startTLS mode is required for the first server in the
* enable replication subcommand.
*
* @return <CODE>true</CODE> if startTLS mode is required for the first server
* in the enable replication subcommand and <CODE>false</CODE> otherwise.
*/
public boolean useStartTLS1()
{
return useStartTLS1Arg.isPresent();
}
/**
* Indicate if the SSL mode is required for the second server in the enable
* replication subcommand.
*
* @return <CODE>true</CODE> if SSL mode is required for the second server in
* the enable replication subcommand and <CODE>false</CODE> otherwise.
*/
public boolean useSSL2()
{
return useSSL2Arg.isPresent();
}
/**
* Indicate if the startTLS mode is required for the second server in the
* enable replication subcommand.
*
* @return <CODE>true</CODE> if startTLS mode is required for the second
* server in the enable replication subcommand and <CODE>false</CODE>
* otherwise.
*/
public boolean useStartTLS2()
{
return useStartTLS2Arg.isPresent();
}
/**
* Indicate if the SSL mode is required for the source server in the
* initialize replication subcommand.
*
* @return <CODE>true</CODE> if SSL mode is required for the source server
* in the initialize replication subcommand and <CODE>false</CODE> otherwise.
*/
public boolean useSSLSource()
{
return useSSLSourceArg.isPresent();
}
/**
* Indicate if the StartTLS mode is required for the source server in the
* initialize replication subcommand.
*
* @return <CODE>true</CODE> if StartTLS mode is required for the source
* server in the initialize replication subcommand and <CODE>false</CODE>
* otherwise.
*/
public boolean useStartTLSSource()
{
return useStartTLSSourceArg.isPresent();
}
/**
* Indicate if the SSL mode is required for the destinaton server in the
* initialize replication subcommand.
*
* @return <CODE>true</CODE> if SSL mode is required for the destination
* server in the initialize replication subcommand and <CODE>false</CODE>
* otherwise.
*/
public boolean useSSLDestination()
{
return useSSLDestinationArg.isPresent();
}
/**
* Indicate if the SSL mode is required for the destination server in the
* initialize replication subcommand.
*
* @return <CODE>true</CODE> if StartTLS mode is required for the destination
* server in the initialize replication subcommand and <CODE>false</CODE>
* otherwise.
*/
public boolean useStartTLSDestination()
{
return useStartTLSDestinationArg.isPresent();
}
/**
* Indicate if the SSL mode is required for the server in the disable
* replication subcommand.
*
* @return <CODE>true</CODE> if SSL mode is required for the server in the
* disable replication subcommand and <CODE>false</CODE> otherwise.
*/
public boolean useSSLToDisable()
{
}
/**
* Indicate if the SSL mode is required for the server in the disable
* replication subcommand.
*
* @return <CODE>true</CODE> if StartTLS mode is required for the server in
* the disable replication subcommand and <CODE>false</CODE> otherwise.
*/
public boolean useStartTLSToDisable()
{
}
/**
* Indicate if the SSL mode is required for the server in the initialize all
* replication subcommand.
*
* @return <CODE>true</CODE> if SSL mode is required for the server in the
* initialize all replication subcommand and <CODE>false</CODE> otherwise.
*/
public boolean useSSLToInitializeAll()
{
}
/**
* Indicate if the SSL mode is required for the server in the initialize all
* replication subcommand.
*
* @return <CODE>true</CODE> if StartTLS mode is required for the server in
* the initialize all replication subcommand and <CODE>false</CODE> otherwise.
*/
public boolean useStartTLSToInitializeAll()
{
}
/**
* Indicate if the SSL mode is required for the server in the pre external
* initialization subcommand.
*
* @return <CODE>true</CODE> if SSL mode is required for the server in the
* pre external initialization subcommand and <CODE>false</CODE> otherwise.
*/
public boolean useSSLToPreExternalInitialization()
{
}
/**
* Indicate if the SSL mode is required for the server in the pre external
* initialization subcommand.
*
* @return <CODE>true</CODE> if StartTLS mode is required for the server in
* the pre external initialization subcommand and <CODE>false</CODE>
* otherwise.
*/
public boolean useStartTLSToPreExternalInitialization()
{
}
/**
* Indicate if the SSL mode is required for the server in the post external
* initialization subcommand.
*
* @return <CODE>true</CODE> if SSL mode is required for the server in the
* post external initialization subcommand and <CODE>false</CODE> otherwise.
*/
public boolean useSSLToPostExternalInitialization()
{
}
/**
* Indicate if the SSL mode is required for the server in the post external
* initialization subcommand.
*
* @return <CODE>true</CODE> if StartTLS mode is required for the server in
* the post external initialization subcommand and <CODE>false</CODE>
* otherwise.
*/
public boolean useStartTLSToPostExternalInitialization()
{
}
/**
* Indicate if the SSL mode is required for the server in the status
* replication subcommand.
*
* @return <CODE>true</CODE> if SSL mode is required for the server in the
* status replication subcommand and <CODE>false</CODE> otherwise.
*/
public boolean useSSLToStatus()
{
}
/**
* Indicate if the SSL mode is required for the server in the status
* replication subcommand.
*
* @return <CODE>true</CODE> if StartTLS mode is required for the server in
* the status replication subcommand and <CODE>false</CODE> otherwise.
*/
public boolean useStartTLSToStatus()
{
}
/**
* Returns the Administrator UID explicitly provided in the command-line.
* @return the Administrator UID explicitly provided in the command-line.
*/
public String getAdministratorUID()
{
}
/**
* Returns the default Administrator UID value.
* @return the default Administrator UID value.
*/
public String getDefaultAdministratorUID()
{
}
/**
* Returns the first host name explicitly provided in the enable replication
* subcommand.
* @return the first host name explicitly provided in the enable replication
* subcommand.
*/
public String getHostName1()
{
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.
*/
public String getDefaultHostName1()
{
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.
*/
public String getBindDn1()
{
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.
*/
public String getDefaultBindDn1()
{
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.
*/
public String getHostName2()
{
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.
*/
public String getDefaultHostName2()
{
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.
*/
public String getBindDn2()
{
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.
*/
public String getDefaultBindDn2()
{
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.
*/
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 getDefaultHostNameToDisable()
{
}
/**
* 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 getDefaultHostNameToStatus()
{
}
/**
* 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.
*/
public String getDefaultHostNameToInitializeAll()
{
}
/**
* 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 getDefaultHostNameSource()
{
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.
*/
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 getDefaultHostNameDestination()
{
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 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
{
// This can occur if the user did not provide any subcommand. We assume
// that the error informing of this will be generated in
// validateGlobalOptions.
}
}
/**
* 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 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()
{
}
/**
* Tells whether the user specified to apply the pre (or post) external
* initialization operations only on the local server.
* @return <CODE>true</CODE> if the user specified to apply the pre (or post)
* external initialization operations only on the local server and
* <CODE>false</CODE> otherwise.
*/
public boolean isExternalInitializationLocalOnly()
{
return externalInitializationLocalOnlyArg.isPresent();
}
/**
* 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.
*/
{
Argument[][] conflictingPairs =
{
};
{
{
}
}
}
/**
* 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.
*/
{
Argument[][] conflictingPairs =
{
};
{
{
}
}
{
}
}
/**
* 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.
*/
{
// The startTLS and useSSL arguments are already validated in
// SecureConnectionCliParser.validateGlobalOptions.
{
{
}
}
}
/**
* 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.
*/
private String getDefaultHostValue()
{
if (defaultLocalHostValue == null)
{
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;
}
}