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-2014 UnboundID Corp. 026 */ 027 package com.unboundid.directory.sdk.common.internal; 028 029 030 031 import java.util.List; 032 033 import com.unboundid.ldap.sdk.ResultCode; 034 import com.unboundid.util.NotExtensible; 035 import com.unboundid.util.ThreadSafety; 036 import com.unboundid.util.ThreadSafetyLevel; 037 import com.unboundid.util.args.ArgumentParser; 038 039 040 041 /** 042 * This interface is used to mark extensions which may be notified of changes 043 * to their configuration. They will be given the chance to validate those 044 * changes before they are accepted by the server, and to be notified when 045 * configuration changes are accepted so that they may be reflected in the 046 * behavior of the extension. 047 * 048 * @param <T> The type of configuration associated with this extension. 049 */ 050 @NotExtensible() 051 @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE) 052 public interface Reconfigurable<T> 053 extends Configurable 054 { 055 /** 056 * Indicates whether the configuration represented by the provided argument 057 * parser is acceptable for use by this extension. The parser will have been 058 * used to parse any configuration available for this extension, and any 059 * automatic validation will have been performed. This method may be used to 060 * perform any more complex validation which cannot be performed automatically 061 * by the argument parser. 062 * 063 * @param config The general configuration for this extension. 064 * @param parser The argument parser that has been used to 065 * parse the proposed configuration for this 066 * extension. 067 * @param unacceptableReasons A list to which messages may be added to 068 * provide additional information about why the 069 * provided configuration is not acceptable. 070 * 071 * @return {@code true} if the configuration in the provided argument parser 072 * appears to be acceptable, or {@code false} if not. 073 */ 074 boolean isConfigurationAcceptable(final T config, final ArgumentParser parser, 075 final List<String> unacceptableReasons); 076 077 078 079 /** 080 * Attempts to apply the configuration from the provided argument parser to 081 * this extension. 082 * 083 * @param config The general configuration for this extension. 084 * @param parser The argument parser that has been used to 085 * parse the new configuration for this 086 * extension. 087 * @param adminActionsRequired A list to which messages may be added to 088 * provide additional information about any 089 * additional administrative actions that may 090 * be required to apply some of the 091 * configuration changes. 092 * @param messages A list to which messages may be added to 093 * provide additional information about the 094 * processing performed by this method. 095 * 096 * @return A result code providing information about the result of applying 097 * the configuration change. A result of {@code SUCCESS} should be 098 * used to indicate that all processing completed successfully. Any 099 * other result will indicate that a problem occurred during 100 * processing. 101 */ 102 ResultCode applyConfiguration(final T config, final ArgumentParser parser, 103 final List<String> adminActionsRequired, 104 final List<String> messages); 105 }