/*
* 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 2006-2008 Sun Microsystems, Inc.
* Portions copyright 2012-2013 ForgeRock AS.
*/
/**
* This program provides a utility to verify the contents of the indexes
* of a Directory Server backend. This will be a process that is
* intended to run separate from Directory Server and not internally within the
* server process (e.g., via the tasks interface).
*/
public class VerifyIndex
{
/**
* Processes the command-line arguments and invokes the verify process.
*
* @param args The command-line arguments provided to this program.
*/
{
if(retCode != 0)
{
}
}
/**
* Processes the command-line arguments and invokes the verify process.
*
* @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} if standard output is not needed.
* @param errStream The output stream to use for standard error, or
* {@code null} if standard error is not needed.
*
* @return The error code.
*/
{
{
}
else
{
}
{
}
else
{
}
// Define the command-line arguments that may be used with this program.
// Create the command-line argument parser for use with this program.
new ArgumentParser("org.opends.server.tools.VerifyIndex",
toolDescription, false);
// Initialize all the command-line argument types and register them with the
// parser.
try
{
OPTION_LONG_CONFIG_CLASS, true, false,
true, INFO_CONFIGCLASS_PLACEHOLDER.get(),
configClass.setHidden(true);
null,
configFile.setHidden(true);
OPTION_LONG_BASEDN, true, false, true,
false, true, true,
}
catch (ArgumentException ae)
{
return 1;
}
// Parse the command-line arguments provided to this program.
try
{
}
catch (ArgumentException ae)
{
return 1;
}
// If we should just display usage or version information,
// then print it and exit.
if (argParser.usageOrVersionDisplayed())
{
return 0;
}
// If no arguments were provided, then display usage information and exit.
if (numArgs == 0)
{
return 1;
}
{
return 1;
}
// Checks the version - if upgrade required, the tool is unusable
try
{
}
catch (InitializationException e)
{
return 1;
}
// Perform the initial bootstrap of the Directory Server and process the
// configuration.
if (initializeServer)
{
try
{
}
catch (Exception e)
{
return 1;
}
try
{
configFile.getValue());
}
catch (InitializationException ie)
{
return 1;
}
catch (Exception e)
{
return 1;
}
// Initialize the Directory Server schema elements.
try
{
}
catch (ConfigException ce)
{
return 1;
}
catch (InitializationException ie)
{
return 1;
}
catch (Exception e)
{
return 1;
}
// Initialize the Directory Server core configuration.
try
{
}
catch (ConfigException ce)
{
return 1;
}
catch (InitializationException ie)
{
return 1;
}
catch (Exception e)
{
return 1;
}
// Initialize the Directory Server crypto manager.
try
{
}
catch (ConfigException ce)
{
return 1;
}
catch (InitializationException ie)
{
return 1;
}
catch (Exception e)
{
getExceptionMessage(e));
return 1;
}
try
{
}
catch(Exception e)
{
}
}
// Decode the base DN provided by the user.
try
{
}
catch (DirectoryException de)
{
return 1;
}
catch (Exception e)
{
return 1;
}
// Get information about the backends defined in the server. Iterate
// through them, finding the one backend to be verified.
for (int i=0; i < numBackends; i++)
{
{
{
{
backend = b;
}
else
{
return 1;
}
break;
}
}
}
{
return 1;
}
if (!(backend instanceof BackendImpl))
{
return 1;
}
// Initialize the verify configuration.
{
{
}
}
else
{
{
}
}
// Acquire a shared lock for the backend.
try
{
{
return 1;
}
}
catch (Exception e)
{
return 1;
}
// Launch the verify process.
int returnCode = 0 ;
try
{
if (countErrors.isPresent())
{
{
}
else
{
returnCode = (int) errorCount;
}
}
}
catch (Exception e)
{
returnCode = 1;
}
// Release the shared lock on the backend.
try
{
{
}
}
catch (Exception e)
{
}
return returnCode;
}
}