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 post-connect plugin.
042 */
043@NotMutable()
044@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
045public final class PostConnectPluginResult
046       implements Serializable
047{
048  /**
049   * A predefined result instance that indicates all processing completed
050   * successfully.
051   */
052  public static final PostConnectPluginResult SUCCESS =
053       new PostConnectPluginResult(false, true);
054
055
056
057  /**
058   * The serial version UID for this serializable class.
059   */
060  private static final long serialVersionUID = 3975156371629164031L;
061
062
063
064  // Indicates whether the connection has been terminated.
065  private final boolean connectionTerminated;
066
067  // Indicates whether the server should continue processing other post-connect
068  // plugins.
069  private final boolean continuePluginProcessing;
070
071
072
073  /**
074   * Creates a new post-connect plugin result with the provided information.
075   *
076   * @param  connectionTerminated      Indicates whether the connection has been
077   *                                   terminated.
078   * @param  continuePluginProcessing  Indicates whether to continue processing
079   *                                   other post-connect plugins for the
080   *                                   connection.
081   */
082  public PostConnectPluginResult(final boolean connectionTerminated,
083                                 final boolean continuePluginProcessing)
084  {
085    this.connectionTerminated     = connectionTerminated;
086    this.continuePluginProcessing = continuePluginProcessing;
087  }
088
089
090
091  /**
092   * Indicates whether the connection has been terminated.
093   *
094   * @return  {@code true} if the connection has been terminated, or
095   *          {@code false} if not.
096   */
097  public boolean connectionTerminated()
098  {
099    return connectionTerminated;
100  }
101
102
103
104  /**
105   * Indicates whether to continue processing other post-connect plugins for the
106   * connection.
107   *
108   * @return  {@code true} if the server should continue processing other
109   *          post-connect plugins for the connection, or {@code false} if not.
110   */
111  public boolean continuePluginProcessing()
112  {
113    return continuePluginProcessing;
114  }
115
116
117
118  /**
119   * Retrieves a string representation of this post-connect plugin result.
120   *
121   * @return  A string representation of this post-connect plugin result.
122   */
123  @Override()
124  public String toString()
125  {
126    final StringBuilder buffer = new StringBuilder();
127
128    buffer.append("PostConnectPluginResult(connectionTerminated=");
129    buffer.append(connectionTerminated);
130    buffer.append(", continuePluginProcessing=");
131    buffer.append(continuePluginProcessing);
132    buffer.append(')');
133
134    return buffer.toString();
135  }
136}