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-2018 Ping Identity Corporation
026 */
027package com.unboundid.directory.sdk.proxy.types;
028
029
030
031import java.util.List;
032
033import com.unboundid.directory.sdk.common.types.ServerContext;
034import com.unboundid.util.NotExtensible;
035import com.unboundid.util.ThreadSafety;
036import com.unboundid.util.ThreadSafetyLevel;
037
038
039
040/**
041 * This interface may be used to obtain information about the Directory Proxy
042 * Server in which an extension is running.
043 */
044@NotExtensible()
045@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
046public interface ProxyServerContext
047       extends ServerContext
048{
049   /**
050   * Creates a health check result with the provided information.
051   *
052   * @param  state     The health check state for the result.  It must not be
053   *                   {@code null}.
054   * @param  score     The score for the result.  It must be an integer value
055   *                   between 1 and 10 for a state of AVAILABLE or DEGRADED, or
056   *                   zero for a state of UNAVAILABLE.
057   * @param  messages  A set of messages with additional information about the
058   *                   reason for the provided state and score.  It may be
059   *                   {@code null} or empty if no messages are needed.
060   *
061   * @return  The created health check result.
062   */
063  HealthCheckResult createHealthCheckResult(final HealthCheckState state,
064                                            final int score,
065                                            final String... messages);
066
067
068
069  /**
070   * Creates a health check result with the provided information.
071   *
072   * @param  state     The health check state for the result.  It must not be
073   *                   {@code null}.
074   * @param  score     The score for the result.  It must be an integer value
075   *                   between 1 and 10 for a state of AVAILABLE or DEGRADED, or
076   *                   zero for a state of UNAVAILABLE.
077   * @param  messages  A set of messages with additional information about the
078   *                   reason for the provided state and score.  It may be
079   *                   {@code null} or empty if no messages are needed.
080   *
081   * @return  The created health check result.
082   */
083  HealthCheckResult createHealthCheckResult(final HealthCheckState state,
084                                            final int score,
085                                            final List<String> messages);
086
087
088
089  /**
090   * Aggregates the information contained in the provided list of health check
091   * results into a single result.  The aggregate result will be the worst
092   * result of all of the provided results, and will contain all the messages
093   * from all of the given results.
094   *
095   * @param  results  The list of health check results to be aggregated.  It
096   *                  must not be {@code null} or empty.
097   *
098   * @return  The health check result which is an aggregation of the provided
099   *          list of results.
100   */
101  HealthCheckResult aggregate(final List<HealthCheckResult> results);
102}