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.proxy.types; 028 029 030 031import java.util.List; 032import java.util.Map; 033 034import com.unboundid.directory.sdk.common.types.ServerContext; 035import com.unboundid.util.NotExtensible; 036import com.unboundid.util.ThreadSafety; 037import com.unboundid.util.ThreadSafetyLevel; 038 039 040 041/** 042 * This interface may be used to obtain information about the Directory Proxy 043 * Server in which an extension is running. 044 */ 045@NotExtensible() 046@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE) 047public interface ProxyServerContext 048 extends ServerContext 049{ 050 /** 051 * Creates a health check result with the provided information. 052 * 053 * @param state The health check state for the result. It must not be 054 * {@code null}. 055 * @param score The score for the result. It must be an integer value 056 * between 1 and 10 for a state of AVAILABLE or DEGRADED, or 057 * zero for a state of UNAVAILABLE. 058 * @param messages A set of messages with additional information about the 059 * reason for the provided state and score. It may be 060 * {@code null} or empty if no messages are needed. 061 * 062 * @return The created health check result. 063 */ 064 HealthCheckResult createHealthCheckResult(final HealthCheckState state, 065 final int score, 066 final String... messages); 067 068 069 070 /** 071 * Creates a health check result with the provided information. 072 * 073 * @param state The health check state for the result. It must not be 074 * {@code null}. 075 * @param score The score for the result. It must be an integer value 076 * between 1 and 10 for a state of AVAILABLE or DEGRADED, or 077 * zero for a state of UNAVAILABLE. 078 * @param messages A set of messages with additional information about the 079 * reason for the provided state and score. It may be 080 * {@code null} or empty if no messages are needed. 081 * 082 * @return The created health check result. 083 */ 084 HealthCheckResult createHealthCheckResult(final HealthCheckState state, 085 final int score, 086 final List<String> messages); 087 088 089 090 /** 091 * Aggregates the information contained in the provided list of health check 092 * results into a single result. The aggregate result will be the worst 093 * result of all of the provided results, and will contain all the messages 094 * from all of the given results. 095 * 096 * @param results The list of health check results to be aggregated. It 097 * must not be {@code null} or empty. 098 * 099 * @return The health check result which is an aggregation of the provided 100 * list of results. 101 */ 102 HealthCheckResult aggregate(final List<HealthCheckResult> results); 103 104 105 106 /** 107 * For each Subtree View, return the corresponding {@code RequestProcessor} 108 * in a map keyed by the configured name of the Subtree View. 109 * This is particularly useful for getting access to 110 * {@code EntryBalancingRequestProcessors} 111 * One use case of this method is to modify an incoming LDAP 112 * request in a {@code Plugin#doPreParse} implementation by accessing the 113 * Entry Balancing Request Processor's global indexes using the 114 * {@code EntryBalancingRequestProcessor#getGlobalIndexHint} methods. 115 * 116 * @return A map from the configured name of the Subtree View to its 117 * corresponding RequestProcessor. 118 */ 119 Map<String,RequestProcessor> getRequestProcessors(); 120}