DsFrameworkCliMain.java revision f2ab35bbbfe7e1f27bf1e14294fa24b016f45dd7
/*
* 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
*
*
* Portions Copyright 2006-2007 Sun Microsystems, Inc.
*/
/**
* This class provides a tool that can be used to Directory Server framework
* services.
*/
public class DsFrameworkCliMain
{
/**
* The fully-qualified name of this class.
*/
private static final String CLASS_NAME =
"org.opends.server.admin.client.cli.DsFrameworkCliMain";
// The print stream to use for standard error.
private PrintStream err;
// The print stream to use for standard output.
private PrintStream out;
/**
* Constructor for the DsFrameworkCLI object.
*
* @param out The print stream to use for standard output.
* @param err The print stream to use for standard error.
*/
{
}
/**
* The main method for dsframework tool.
*
* @param args The command-line arguments provided to this program.
*/
{
if(retCode != 0)
{
}
}
/**
* Parses the provided command-line arguments and uses that information to
* run the dsframework tool.
*
* @param args The command-line arguments provided to this program.
*
* @return The error code.
*/
{
}
/**
* Parses the provided command-line arguments and uses that information to
* run the dsframework tool.
*
* @param args The command-line arguments provided to this
* program.
* @param initializeServer Indicates whether to initialize the server.
* @param outStream The output stream to use for standard output, or
* <CODE>null</CODE> if standard output is not
* needed.
* @param errStream The output stream to use for standard error, or
* <CODE>null</CODE> if standard error is not
* needed.
* @return The error code.
*/
{
{
}
else
{
}
{
}
else
{
}
}
/**
* Parses the provided command-line arguments and uses that information to
* run the dsframework tool.
*
* @param args The command-line arguments provided to this
* program.
* @param initializeServer Indicates whether to initialize the server.
*
* @return The error code.
*/
{
// Create the command-line argument parser for use with this
// program.
try
{
toolDescription, false);
}
catch (ArgumentException ae)
{
return CANNOT_INITIALIZE_ARGS.getReturnCode();
}
// Parse the command-line arguments provided to this program.
try
{
}
catch (ArgumentException ae)
{
int msgID = MSGID_ERROR_PARSING_ARGS;
return ERROR_PARSING_ARGS.getReturnCode();
}
// If we should just display usage information, then print it and exit.
if (argParser.usageOrVersionDisplayed())
{
return SUCCESSFUL.getReturnCode();
}
{
int msgID = MSGID_ERROR_PARSING_ARGS;
return ERROR_PARSING_ARGS.getReturnCode();
}
// Validate args
{
return ret;
}
// Check if we need a connection
// Should we initialize the server in client mode?
if (initializeServer)
{
// Bootstrap and initialize directory data structures.
// Bootstrap definition classes.
try
{
}
catch (InitializationException e)
{
return ERROR_UNEXPECTED.getReturnCode();
}
catch (IllegalStateException e)
{
return ERROR_UNEXPECTED.getReturnCode();
}
}
// perform the subCommand
try
{
}
catch (ADSContextException e)
{
adsException = e;
.getError());
if (returnCode == null)
{
}
}
catch (ArgumentException ae)
{
return CANNOT_INITIALIZE_ARGS.getReturnCode();
}
if ( (returnCode == SUCCESSFUL)
||
(returnCode == SUCCESSFUL_NOP))
{
{
}
}
else
if (msgID != MSGID_ADMIN_NO_MESSAGE)
{
{
}
}
return returnCode.getReturnCode();
}
}