001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2008 Sun Microsystems, Inc. 015 * Portions Copyright 2014 ForgeRock AS. 016 */ 017package org.opends.server.admin.condition; 018 019 020 021import org.opends.server.admin.AbstractManagedObjectDefinition; 022import org.opends.server.admin.client.AuthorizationException; 023import org.opends.server.admin.client.CommunicationException; 024import org.opends.server.admin.client.ManagedObject; 025import org.opends.server.admin.client.ManagementContext; 026import org.opends.server.admin.server.ServerManagedObject; 027import org.forgerock.opendj.config.server.ConfigException; 028 029 030 031/** 032 * An interface for evaluating conditions. 033 */ 034public interface Condition { 035 036 /** 037 * Initializes this condition. 038 * 039 * @param d 040 * The abstract managed object definition associated with 041 * this condition. 042 * @throws Exception 043 * If this condition could not be initialized. 044 */ 045 void initialize(AbstractManagedObjectDefinition<?, ?> d) throws Exception; 046 047 048 049 /** 050 * Evaluates this condition against the provided client managed 051 * object. 052 * 053 * @param context 054 * The client management context. 055 * @param managedObject 056 * The client managed object. 057 * @return Returns <code>true</code> if this condition is 058 * satisfied. 059 * @throws AuthorizationException 060 * If the condition could not be evaluated due to an 061 * authorization problem. 062 * @throws CommunicationException 063 * If the condition could not be evaluated due to an 064 * communication problem. 065 */ 066 boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) 067 throws AuthorizationException, CommunicationException; 068 069 070 071 /** 072 * Evaluates this condition against the provided server managed 073 * object. 074 * 075 * @param managedObject 076 * The server managed object. 077 * @return Returns <code>true</code> if this condition is 078 * satisfied. 079 * @throws ConfigException 080 * If the condition could not be evaluated due to an 081 * unexpected configuration exception. 082 */ 083 boolean evaluate(ServerManagedObject<?> managedObject) throws ConfigException; 084}