StartupPluginResult.java revision 99faa045b6241c1d2843cce1b7a9d9c97055beae
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift/*
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * CDDL HEADER START
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * The contents of this file are subject to the terms of the
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Common Development and Distribution License, Version 1.0 only
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * (the "License"). You may not use this file except in compliance
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * with the License.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * You can obtain a copy of the license at
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * trunk/opends/resource/legal-notices/OpenDS.LICENSE
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * See the License for the specific language governing permissions
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * and limitations under the License.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * When distributing Covered Code, include this CDDL HEADER in each
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * file and include the License file at
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * add the following below this CDDL HEADER, with the fields enclosed
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * by brackets "[]" replaced with your own identifying information:
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Portions Copyright [yyyy] [name of copyright owner]
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * CDDL HEADER END
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Portions Copyright 2006-2007 Sun Microsystems, Inc.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift */
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swiftpackage org.opends.server.api.plugin;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift/**
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * This class defines a data structure that holds information about
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * the result of processing by a plugin invoked during the Directory
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Server startup process.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift */
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swiftpublic class StartupPluginResult
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift{
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift /**
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * A startup plugin result instance that indicates all processing
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * was successful.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift */
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift public static final StartupPluginResult SUCCESS =
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift new StartupPluginResult();
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift // Indicates whether the startup plugin completed successfully.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift private final boolean completedSuccessfully;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift // Indicates whether the server should continue with the startup
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift // process.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift private final boolean continueStartup;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift // The unique identifier for any error message generated by the
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift // startup plugin.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift private final int errorID;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift // A human-readable message that explains any error that might have
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift // occurred.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift private final String errorMessage;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift /**
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Creates a new startup plugin result with the default settings.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * In this case, it will indicate that the plugin completed
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * successfully, that the startup process should continue, and that
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * there is no error message.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift */
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift private StartupPluginResult()
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift {
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift this(true, true, 0, null);
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift }
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift /**
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Creates a new startup plugin result with the provided
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * information.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * @param completedSuccessfully Indicates whether the startup
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * plugin completed its processing
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * successfully.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * @param continueStartup Indicates whether the Directory
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Server should continue with its
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * startup process.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * @param errorID The unique ID assigned to any
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * error message that might have been
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * generated by the startup plugin.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * @param errorMessage A human-readable error message
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * that explains any error that might
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * have occurred.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift */
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift public StartupPluginResult(boolean completedSuccessfully,
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift boolean continueStartup, int errorID,
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift String errorMessage)
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift {
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift this.completedSuccessfully = completedSuccessfully;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift this.continueStartup = continueStartup;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift this.errorID = errorID;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift this.errorMessage = errorMessage;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift }
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift /**
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Indicates whether the startup plugin completed its processing
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * successfully.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * @return <CODE>true</CODE> if the startup plugin completed its
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * processing successfully, or <CODE>false</CODE> if not.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift */
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift public boolean completedSuccessfully()
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift {
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift return completedSuccessfully;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift }
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift /**
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Indicates whether the Directory Server should continue with its
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * startup process.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * @return <CODE>true</CODE> if the Directory Server should
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * continue with its startup process, or <CODE>false</CODE>
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * if not.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift */
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift public boolean continueStartup()
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift {
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift return continueStartup;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift }
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift /**
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Retrieves the unique ID for the error message generated by the
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * startup plugin.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * @return The unique ID for the error message generated by the
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * startup plugin, or 0 if there is no error message.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift */
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift public int getErrorID()
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift {
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift return errorID;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift }
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift /**
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Retrieves the human-readable error message generated by the
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * startup plugin.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * @return The human-readable error message generated by the
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * startup plugin, or <CODE>null</CODE> if there is no
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * error message.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift */
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift public String getErrorMessage()
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift {
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift return errorMessage;
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift }
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift /**
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Retrieves a string representation of this startup plugin result.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * @return A string representation of this startup plugin result.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift */
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift public String toString()
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift {
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift StringBuilder buffer = new StringBuilder();
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift toString(buffer);
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift return buffer.toString();
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift }
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift /**
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * Appends a string representation of this startup plugin result to
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * the provided buffer.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift *
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * @param buffer The buffer to which the information should be
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift * appended.
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift */
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift public void toString(StringBuilder buffer)
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift {
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift buffer.append("StartupPluginResult(completedSuccessfully=");
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift buffer.append(completedSuccessfully);
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift buffer.append(", continueStartup=");
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift buffer.append(continueStartup);
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift buffer.append(", errorID=");
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift buffer.append(errorID);
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift buffer.append(", errorMessage=\"");
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift buffer.append(errorMessage);
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift buffer.append("\")");
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift }
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift}
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift
bb8874d71cdd8e5288297b9727703437c6dfcfedmatthew_swift