/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at * trunk/opends/resource/legal-notices/OpenDS.LICENSE * or https://OpenDS.dev.java.net/OpenDS.LICENSE. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, * add the following below this CDDL HEADER, with the fields enclosed * by brackets "[]" replaced with your own identifying information: * Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END * * * Portions Copyright 2007 Sun Microsystems, Inc. */ package org.opends.server.admin.client; import java.util.Collection; import java.util.SortedSet; import org.opends.server.admin.IllegalPropertyValueException; import org.opends.server.admin.InstantiableRelationDefinition; import org.opends.server.admin.ManagedObjectDefinition; import org.opends.server.admin.ConfigurationClient; import org.opends.server.admin.ManagedObjectPath; import org.opends.server.admin.OperationsException; import org.opends.server.admin.OptionalRelationDefinition; import org.opends.server.admin.PropertyDefinition; import org.opends.server.admin.PropertyIsMandatoryException; import org.opends.server.admin.PropertyIsReadOnlyException; import org.opends.server.admin.PropertyIsSingleValuedException; import org.opends.server.admin.PropertyProvider; import org.opends.server.admin.SingletonRelationDefinition; /** * A generic interface for accessing client-side managed objects. *

* A managed object comprises of zero or more properties. A property * has associated with it three sets of property value(s). These are: *

* In addition, a property has an effective state defined by * its effective values which are derived by evaluating the * following rules in the order presented: * * * @param * The type of client configuration represented by the client * managed object. */ public interface ManagedObject extends PropertyProvider { /** * Get the effective value of the specified property. *

* See the class description for more information about how the * effective property value is derived. * * @param * The type of the property to be retrieved. * @param d * The property to be retrieved. * @return Returns the property's effective value, or * null if there is no effective value * defined. * @throws IllegalArgumentException * If the property definition is not associated with this * managed object's definition. */ public T getPropertyValue(PropertyDefinition d) throws IllegalArgumentException; /** * Get the effective values of the specified property. *

* See the class description for more information about how the * effective property values are derived. * * @param * The type of the property to be retrieved. * @param d * The property to be retrieved. * @return Returns the property's effective values, or an empty set * if there are no effective values defined. * @throws IllegalArgumentException * If the property definition is not associated with this * managed object's definition. */ public SortedSet getPropertyValues(PropertyDefinition d) throws IllegalArgumentException; /** * Set a new pending value for the specified property. *

* See the class description for more information regarding pending * values. * * @param * The type of the property to be modified. * @param d * The property to be modified. * @param value * The new pending value for the property, or * null if the property should be reset to * its default behavior. * @throws IllegalPropertyValueException * If the new pending value is deemed to be invalid * according to the property definition. * @throws PropertyIsReadOnlyException * If an attempt was made to modify a read-only property. * @throws PropertyIsMandatoryException * If an attempt was made to remove a mandatory property. * @throws IllegalArgumentException * If the specified property definition is not associated * with this managed object, or if the property is * read-only. */ public void setPropertyValue(PropertyDefinition d, T value) throws IllegalPropertyValueException, PropertyIsReadOnlyException, PropertyIsMandatoryException, IllegalArgumentException; /** * Set a new pending values for the specified property. *

* See the class description for more information regarding pending * values. * * @param * The type of the property to be modified. * @param d * The property to be modified. * @param values * A non-null set of new pending values for * the property (an empty set indicates that the property * should be reset to its default behavior). The set will * not be referenced by this managed object. * @throws IllegalPropertyValueException * If a new pending value is deemed to be invalid * according to the property definition. * @throws PropertyIsSingleValuedException * If an attempt was made to add multiple pending values * to a single-valued property. * @throws PropertyIsReadOnlyException * If an attempt was made to modify a read-only property. * @throws PropertyIsMandatoryException * If an attempt was made to remove a mandatory property. * @throws IllegalArgumentException * If the specified property definition is not associated * with this managed object, or if the property is * read-only. */ public void setPropertyValues(PropertyDefinition d, Collection values) throws IllegalPropertyValueException, PropertyIsSingleValuedException, PropertyIsReadOnlyException, PropertyIsMandatoryException, IllegalArgumentException; /** * Commit any changes made to this managed object. Pending property * values will be committed to the managed object. If successful, * the pending values will become active values. *

* See the class description for more information regarding pending * and active values. * * @throws OperationsException * If the changes to this managed object could not be * committed due to some underlying communication problem. */ void commit() throws OperationsException; /** * Creates a new child managed object bound to the specified * instantiable relation. The new managed object instance will be * created with values taken from a property provider. The caller * must make sure that the property provider provides values for * mandatory properties. * * @param * The expected type of the child managed object * configuration client. * @param * The actual type of the added managed object * configuration client. * @param r * The instantiable relation definition. * @param d * The definition of the managed object to be created. * @param name * The name of the child managed object. * @param p * A property provider which should be used to initialize * property values of the new managed object. * @return Returns a new child managed object bound to the specified * instantiable relation. * @throws IllegalArgumentException * If the relation definition is not associated with this * managed object's definition. * @throws OperationsException * If the managed object could not be created due to some * underlying communication problem. */ ManagedObject createChild( InstantiableRelationDefinition r, ManagedObjectDefinition d, String name, PropertyProvider p) throws IllegalArgumentException, OperationsException; /** * Creates a new child managed object bound to the specified * optional relation. The new managed object instance will be * created with values taken from a property provider. The caller * must make sure that the property provider provides values for * mandatory properties. * * @param * The expected type of the child managed object * configuration client. * @param * The actual type of the added managed object * configuration client. * @param r * The optional relation definition. * @param d * The definition of the managed object to be created. * @param p * A property provider which should be used to initialize * property values of the new managed object. * @return Returns a new child managed object bound to the specified * optional relation. * @throws IllegalArgumentException * If the relation definition is not associated with this * managed object's definition. * @throws OperationsException * If the managed object could not be created due to some * underlying communication problem. */ ManagedObject createChild( OptionalRelationDefinition r, ManagedObjectDefinition d, PropertyProvider p) throws IllegalArgumentException, OperationsException; /** * Retrieve an instantiable child managed object. * * @param * The requested type of the child managed object * configuration client. * @param d * The instantiable relation definition. * @param name * The name of the child managed object. * @return Returns the instantiable child managed object. * @throws IllegalArgumentException * If the relation definition is not associated with this * managed object's definition. * @throws OperationsException * If the managed object could not be read due to some * underlying communication problem. */ ManagedObject getChild( InstantiableRelationDefinition d, String name) throws IllegalArgumentException, OperationsException; /** * Retrieve an optional child managed object. * * @param * The requested type of the child managed object * configuration client. * @param d * The optional relation definition. * @return Returns the optional child managed object. * @throws IllegalArgumentException * If the relation definition is not associated with this * managed object's definition. * @throws OperationsException * If the managed object could not be read due to some * underlying communication problem. */ ManagedObject getChild( OptionalRelationDefinition d) throws IllegalArgumentException, OperationsException; /** * Retrieve a singleton child managed object. * * @param * The requested type of the child managed object * configuration client. * @param d * The singleton relation definition. * @return Returns the singleton child managed object. * @throws IllegalArgumentException * If the relation definition is not associated with this * managed object's definition. * @throws OperationsException * If the managed object could not be read due to some * underlying communication problem. */ ManagedObject getChild( SingletonRelationDefinition d) throws IllegalArgumentException, OperationsException; /** * Creates a client configuration view of this managed object. * Modifications made to this managed object will be reflected in * the client configuration view and vice versa. * * @return Returns a client configuration view of this managed * object. */ C getConfiguration(); /** * Get the definition associated with this managed object. * * @return Returns the definition associated with this managed * object. */ ManagedObjectDefinition getManagedObjectDefinition(); /** * Get the path of this managed object. * * @return Returns the path of this managed object. */ ManagedObjectPath getManagedObjectPath(); /** * Determines whether or not the optional managed object associated * with the specified optional relations exists. * * @param d * The optional relation definition. * @return Returns true if the optional managed * object exists, false otherwise. * @throws IllegalArgumentException * If the relation definition is not associated with this * managed object's definition. * @throws OperationsException * If the existance of the optional managed object could * not be determined due to some underlying communication * problem. */ boolean hasChild(OptionalRelationDefinition d) throws IllegalArgumentException, OperationsException; /** * Lists the child managed objects associated with the specified * instantiable relation. * * @param d * The instantiable relation definition. * @return Returns the names of the child managed objects. * @throws IllegalArgumentException * If the relation definition is not associated with this * managed object's definition. * @throws OperationsException * If the managed objects could not be listed due to some * underlying communication problem. */ String[] listChildren(InstantiableRelationDefinition d) throws IllegalArgumentException, OperationsException; /** * Removes the named instantiable child managed object. * * @param * The type of the child managed object configuration * client. * @param d * The instantiable relation definition. * @param name * The name of the child managed object to be removed. * @throws IllegalArgumentException * If the relation definition is not associated with this * managed object's definition. * @throws OperationsException * If the managed object could not be removed due to some * underlying communication problem. */ void removeChild( InstantiableRelationDefinition d, String name) throws IllegalArgumentException, OperationsException; /** * Removes an optional child managed object. * * @param * The type of the child managed object configuration * client. * @param d * The optional relation definition. * @throws IllegalArgumentException * If the relation definition is not associated with this * managed object's definition. * @throws OperationsException * If the managed object could not be removed due to some * underlying communication problem. */ void removeChild( OptionalRelationDefinition d) throws IllegalArgumentException, OperationsException; }