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 2015 ForgeRock AS. 016 */ 017 018package org.opends.server.admin; 019 020 021 022import java.util.Collection; 023import java.util.Collections; 024 025 026 027/** 028 * An interface which can be used to initialize the contents of a managed 029 * object. 030 */ 031public interface PropertyProvider { 032 033 /** 034 * A property provider which always returns empty property values, indicating 035 * default behavior. 036 */ 037 PropertyProvider DEFAULT_PROVIDER = 038 new PropertyProvider() { 039 040 /** {@inheritDoc} */ 041 public <T> Collection<T> getPropertyValues(PropertyDefinition<T> d) 042 throws IllegalArgumentException { 043 return Collections.<T> emptySet(); 044 } 045 046 }; 047 048 049 050 /** 051 * Get the property values associated with the specified property definition. 052 * <p> 053 * Implementations are not required to validate the values that they provide. 054 * Specifically: 055 * <ul> 056 * <li>they do not need to guarantee that the provided values are valid 057 * according to the property's syntax 058 * <li>they do not need to provide values for mandatory properties 059 * <li>they do not need to ensure that single-valued properties do contain at 060 * most one value. 061 * </ul> 062 * The returned set of values is allowed to contain duplicates. 063 * 064 * @param <T> 065 * The underlying type of the property. 066 * @param d 067 * The Property definition. 068 * @return Returns a newly allocated set containing a copy of the property's 069 * values. An empty set indicates that the property has no values 070 * defined and any default behavior is applicable. 071 * @throws IllegalArgumentException 072 * If this property provider does not recognise the requested 073 * property definition. 074 */ 075 <T> Collection<T> getPropertyValues(PropertyDefinition<T> d) 076 throws IllegalArgumentException; 077}