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-2016 UnboundID Corp.
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 PreManageExtensionPluginResult
047       implements Serializable
048{
049  /**
050   * A predefined result instance that indicates all processing completed
051   * successfully.
052   */
053  public static final PreManageExtensionPluginResult SUCCESS =
054       new PreManageExtensionPluginResult(true, null);
055
056
057  /**
058   * The serial version UID for this serializable class.
059   */
060  private static final long serialVersionUID = -5058225898311204645L;
061
062  // Indicates whether the manage-extension tool should continue with the
063  // installation.
064  private final boolean continueInstallation;
065
066  private final List<String> messages;
067
068
069
070  /**
071   * Creates a new pre manage extension plugin result with the provided
072   * information.
073   *
074   * @param  continueInstallation  Indicates whether the manage-extension tool
075   *                               should continue with the installation.
076   * @param  messages              Messages to print to the console or
077   *                               <code>null</code>.
078   */
079  public PreManageExtensionPluginResult(final boolean continueInstallation,
080                                        final List<String> messages)
081  {
082    this.continueInstallation = continueInstallation;
083    this.messages = messages;
084  }
085
086
087  /**
088   * Indicates whether the manage-extension tool should continue with the
089   * installation.
090   *
091   * @return  {@code true} the manage-extension tool should continue with the
092   * installation, or {@code false} if not.
093   */
094  public boolean continueInstallation()
095  {
096    return continueInstallation;
097  }
098
099
100
101  /**
102   * Retrieves the list of messages to print to the console.
103   *
104   * @return  The list of messages to print to the console or <code>null</code>
105   *          if no messages are to be printed.
106   */
107  public List<String> getMessages()
108  {
109    return messages;
110  }
111
112
113  /**
114   * Retrieves a string representation of this pre manage extension plugin
115   * result.
116   *
117   * @return  A string representation of this pre manage extension plugin
118   * result.
119   */
120  @Override()
121  public String toString()
122  {
123    final StringBuilder buffer = new StringBuilder();
124
125    buffer.append("PreManageExtensionPluginResult(continueInstallation=");
126    buffer.append(continueInstallation);
127    buffer.append(", messages=");
128    buffer.append(messages);
129    buffer.append(')');
130
131    return buffer.toString();
132  }
133}