001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at 010 * docs/licenses/cddl.txt 011 * or http://www.opensource.org/licenses/cddl1.php. 012 * See the License for the specific language governing permissions 013 * and limitations under the License. 014 * 015 * When distributing Covered Code, include this CDDL HEADER in each 016 * file and include the License file at 017 * docs/licenses/cddl.txt. If applicable, 018 * add the following below this CDDL HEADER, with the fields enclosed 019 * by brackets "[]" replaced with your own identifying information: 020 * Portions Copyright [yyyy] [name of copyright owner] 021 * 022 * CDDL HEADER END 023 * 024 * 025 * Copyright 2010-2021 Ping Identity Corporation 026 */ 027package com.unboundid.directory.sdk.ds.types; 028 029 030 031import java.io.Serializable; 032 033import com.unboundid.util.NotMutable; 034import com.unboundid.util.ThreadSafety; 035import com.unboundid.util.ThreadSafetyLevel; 036 037 038 039/** 040 * This class defines a structure which may be used to provide information about 041 * the result of the processing performed by a startup plugin. 042 */ 043@NotMutable() 044@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 045public final class StartupPluginResult 046 implements Serializable 047{ 048 /** 049 * A predefined result instance that indicates all processing completed 050 * successfully. 051 */ 052 public static final StartupPluginResult SUCCESS = 053 new StartupPluginResult(true, true, null); 054 055 056 057 /** 058 * The serial version UID for this serializable class. 059 */ 060 private static final long serialVersionUID = -7383162206183763287L; 061 062 063 064 // Indicates whether processing completed successfully. 065 private final boolean completedSuccessfully; 066 067 // Indicates whether server startup processing should continue. 068 private final boolean continueStartup; 069 070 // A message with information about any problem that occurred. 071 private final String message; 072 073 074 075 /** 076 * Creates a new startup plugin result with the provided information. 077 * 078 * @param completedSuccessfully Indicates whether the plugin successfully 079 * completed its processing. 080 * @param continueStartup Indicates whether server startup processing 081 * should continue. 082 * @param message An optional message providing additional 083 * information about the result of the plugin 084 * processing. 085 */ 086 public StartupPluginResult(final boolean completedSuccessfully, 087 final boolean continueStartup, 088 final CharSequence message) 089 { 090 this.completedSuccessfully = completedSuccessfully; 091 this.continueStartup = continueStartup; 092 093 if (message == null) 094 { 095 this.message = null; 096 } 097 else 098 { 099 this.message = message.toString(); 100 } 101 } 102 103 104 105 /** 106 * Indicates whether the plugin successfully completed its processing. 107 * 108 * @return {@code true} if the plugin successfully completed its processing, 109 * or {@code false} if not. 110 */ 111 public boolean completedSuccessfully() 112 { 113 return completedSuccessfully; 114 } 115 116 117 118 /** 119 * Indicates whether the server startup process should continue. 120 * 121 * @return {@code true} if the server startup process should continue, or 122 * {@code false} if not. 123 */ 124 public boolean continueStartup() 125 { 126 return continueStartup; 127 } 128 129 130 131 /** 132 * Retrieves a message with additional information about the processing 133 * performed by this plugin, if available. 134 * 135 * @return A message with additional information about the processing 136 * performed by this plugin, or {@code null} if none is available. 137 */ 138 public String getMessage() 139 { 140 return message; 141 } 142 143 144 145 /** 146 * Retrieves a string representation of this startup plugin result. 147 * 148 * @return A string representation of this startup plugin result. 149 */ 150 @Override() 151 public String toString() 152 { 153 final StringBuilder buffer = new StringBuilder(); 154 155 buffer.append("StartupPluginResult(completedSuccessfully="); 156 buffer.append(completedSuccessfully); 157 buffer.append(", continueStartup="); 158 buffer.append(continueStartup); 159 160 if (message != null) 161 { 162 buffer.append(", message='"); 163 buffer.append(message); 164 buffer.append('\''); 165 } 166 167 buffer.append(')'); 168 169 return buffer.toString(); 170 } 171}