CheckInstance.java revision 62ecec3a82a8b838ee76c1f6610902d8fd7015cb
/*
* 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-2009 Sun Microsystems, Inc.
*/
/**
* This class is called by the configure command line to move the default
* Directory Server instance.
*/
public class CheckInstance {
CheckInstance.class.getName());
/** Prefix for log files. */
private static String installRootFromSystem;
private static String instanceRootFromSystem;
/**
* The user that launches this application.
*/
/**
* The value for the short option 'currentUser'.
*/
/**
* Should version be verified.
*/
/**
* The value for the short option 'checkVersion'.
*/
private static StringArgument currentUserArg;
private static BooleanArgument checkVersionArg;
private static String currentUser;
private static String instanceOwner;
private static boolean isWin;
private static int SUCCESS = 0;
private static int ARGS_ERROR = 1;
private static int USER_ERROR = 2;
private static int VERSION_ERROR = 3;
/**
* Creates a copy of the specified file.
*
* @param from The source file to be copied.
* @param to The destination file to be created.
*
* @throws IOException If a problem occurs.
*/
throws IOException
{
byte[] buffer = new byte[4096];
try
{
while (bytesRead > 0)
{
}
}
finally
{
if (inputStream != null)
{
try
{
inputStream.close();
}
catch (Exception e)
{
}
}
if (outputStream != null)
{
}
}
}
/**
* The main method which is called by the configure command lines.
*
* @param args the arguments passed by the command line.
*/
try {
} catch (Throwable t) {
t.printStackTrace();
}
// Create the command-line argument parser for use with this program.
toolDescription, false);
if (installRootFromSystem == null) {
}
if (instanceRootFromSystem == null) {
}
// Initialize all the command-line argument types and register them with the
// parser.
try {
if (!isWin) {
true, true,
}
} catch (ArgumentException ae) {
}
// Parse the command-line arguments provided to this program.
try {
} catch (ArgumentException ae) {
}
if (!isWin) {
// Check user
int exit = 0;
int c;
try {
}
if (exit != 0) {
}
} catch (InterruptedException ex) {
} catch (IOException ex) {
}
if (tok.hasMoreTokens()) {
// access rights
if (tok.hasMoreTokens()) {
// inode
if (tok.hasMoreTokens()) {
} else {
}
} else {
}
} else {
}
}
}
// Initialize buildinfo in not already done (ZIP delivery)
"." + MINOR_VERSION +
"." + POINT_VERSION +
"." + REVISION_NUMBER);
try {
} catch (Exception e) {
} finally {
try {
} catch (Exception e) {
}
}
}
// Check version
if (checkVersionArg.isPresent()) {
try {
// Read the first line and close the file.
try {
} finally {
try {
} catch (Exception e) {
}
}
// For pkg(5) delivery: update the file to avoid overwrite
// during upgrade
try {
} finally {
try {
} catch (Exception e) {
}
}
}
} catch (Exception e) {
"current instance", e);
}
}
} else {
}
try {
"schema.ldif." + REVISION_NUMBER);
if (!concatenatedSchema.exists()) {
"schema.ldif." + REVISION_NUMBER);
} else {
"already exists");
}
"config.ldif." + REVISION_NUMBER);
if (!initialConfig.exists()) {
"config.ldif." + REVISION_NUMBER);
} else {
}
} catch (Exception e) {
}
}
}