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 2011-2021 Ping Identity Corporation
026 */
027package com.unboundid.directory.sdk.common.types;
028
029
030
031import java.io.Serializable;
032import java.util.List;
033
034import com.unboundid.util.NotMutable;
035import com.unboundid.util.ThreadSafety;
036import com.unboundid.util.ThreadSafetyLevel;
037
038
039
040/**
041 * This class defines a structure which may be used to provide information about
042 * the result of the processing performed by a manage extension plugin.
043 */
044@NotMutable()
045@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
046public final class PostManageExtensionPluginResult
047       implements Serializable
048{
049  /**
050   * A predefined result instance that indicates all processing completed
051   * successfully.
052   */
053  public static final PostManageExtensionPluginResult SUCCESS =
054       new PostManageExtensionPluginResult(true, null);
055
056
057  /**
058   * The serial version UID for this serializable class.
059   */
060  private static final long serialVersionUID = 5891391890895925978L;
061
062  // Indicates whether the manage-extension tool should restart the server
063  // after the installation if it was previous started.
064  private final boolean restartServer;
065
066  private final List<String> messages;
067
068
069
070  /**
071   * Creates a new post manage extension plugin result with the provided
072   * information.
073   *
074   * @param  restartServer         Indicates whether the manage-extension tool
075   *                               should restart the server after the
076   *                               installation if it was previous started.
077   * @param  messages              Messages to print to the console or
078   *                               <code>null</code>.
079   */
080  public PostManageExtensionPluginResult(final boolean restartServer,
081                                         final List<String> messages)
082  {
083    this.restartServer = restartServer;
084    this.messages = messages;
085  }
086
087
088  /**
089   * Indicates whether the manage-extension tool should restart the server
090   * after the installation if it was previous started.
091   *
092   * @return  {@code true} the manage-extension tool should restart
093   * the server, or {@code false} if not.
094   */
095  public boolean restartServer()
096  {
097    return restartServer;
098  }
099
100
101
102  /**
103   * Retrieves the list of messages to print to the console.
104   *
105   * @return  The list of messages to print to the console or <code>null</code>
106   *          if no messages are to be printed.
107   */
108  public List<String> getMessages()
109  {
110    return messages;
111  }
112
113
114  /**
115   * Retrieves a string representation of this post manage extension plugin
116   * result.
117   *
118   * @return  A string representation of this post manage extension plugin
119   * result.
120   */
121  @Override()
122  public String toString()
123  {
124    final StringBuilder buffer = new StringBuilder();
125
126    buffer.append("PostManageExtensionPluginResult(restartServer=");
127    buffer.append(restartServer);
128    buffer.append(", messages=");
129    buffer.append(messages);
130    buffer.append(')');
131
132    return buffer.toString();
133  }
134}