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     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
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     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  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 2008 Sun Microsystems, Inc.
026     */
027    
028    package org.opends.server.admin.client.spi;
029    
030    
031    
032    import java.util.SortedSet;
033    
034    import org.opends.server.admin.PropertyDefinition;
035    
036    
037    
038    /**
039     * A managed object property comprising of the property's definition
040     * and its set of values.
041     * <p>
042     * The property stores the values in a sorted set in which values are
043     * compared using the comparator defined by the property definition.
044     * <p>
045     * The property keeps track of whether or not its pending set of
046     * values differs from its active values.
047     *
048     * @param <T>
049     *          The type of the property.
050     */
051    public interface Property<T> {
052    
053      /**
054       * Get an immutable set view of this property's active values.
055       *
056       * @return Returns an immutable set view of this property's active
057       *         values. An empty set indicates that there are no active
058       *         values, and any default values are applicable.
059       */
060      SortedSet<T> getActiveValues();
061    
062    
063    
064      /**
065       * Get an immutable set view of this property's default values.
066       *
067       * @return Returns an immutable set view of this property's default
068       *         values. An empty set indicates that there are no default
069       *         values.
070       */
071      SortedSet<T> getDefaultValues();
072    
073    
074    
075      /**
076       * Get an immutable set view of this property's effective values.
077       *
078       * @return Returns an immutable set view of this property's
079       *         effective values.
080       */
081      SortedSet<T> getEffectiveValues();
082    
083    
084    
085      /**
086       * Get an immutable set view of this property's pending values.
087       * <p>
088       * Immediately after construction, the pending values matches the
089       * active values.
090       *
091       * @return Returns an immutable set view of this property's pending
092       *         values. An empty set indicates that there are no pending
093       *         values, and any default values are applicable.
094       */
095      SortedSet<T> getPendingValues();
096    
097    
098    
099      /**
100       * Get the property definition associated with this property.
101       *
102       * @return Returns the property definition associated with this
103       *         property.
104       */
105      PropertyDefinition<T> getPropertyDefinition();
106    
107    
108    
109      /**
110       * Determines whether or not this property contains any pending
111       * values.
112       *
113       * @return Returns <code>true</code> if this property does not
114       *         contain any pending values.
115       */
116      boolean isEmpty();
117    
118    
119    
120      /**
121       * Determines whether or not this property has been modified since
122       * it was constructed. In other words, whether or not the set of
123       * pending values differs from the set of active values.
124       *
125       * @return Returns <code>true</code> if this property has been
126       *         modified since it was constructed.
127       */
128      boolean isModified();
129    
130    
131    
132      /**
133       * Determines whether or not this property contains any active
134       * values.
135       *
136       * @return Returns <code>true</code> if this property does not
137       *         contain any active values.
138       */
139      boolean wasEmpty();
140    }