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 2006-2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.types.operation;
028    
029    
030    
031    import java.util.List;
032    import java.util.Map;
033    
034    import org.opends.server.types.Attribute;
035    import org.opends.server.types.AttributeType;
036    import org.opends.server.types.ByteString;
037    import org.opends.server.types.DN;
038    import org.opends.server.types.Entry;
039    import org.opends.server.types.ObjectClass;
040    import org.opends.server.types.RawAttribute;
041    
042    
043    
044    /**
045     * This class defines a set of methods that are available for use by
046     * pre-operation plugins for add operations.  Note that this interface
047     * is intended only to define an API for use by plugins and is not
048     * intended to be implemented by any custom classes.
049     */
050    @org.opends.server.types.PublicAPI(
051         stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
052         mayInstantiate=false,
053         mayExtend=false,
054         mayInvoke=true)
055    public interface PreOperationAddOperation
056           extends PreOperationOperation
057    {
058      /**
059       * Retrieves the DN of the entry to add in a raw, unparsed form as
060       * it was included in the request.  This may or may not actually
061       * contain a valid DN, since no validation will have been performed
062       * on it.
063       *
064       * @return  The DN of the entry in a raw, unparsed form.
065       */
066      public ByteString getRawEntryDN();
067    
068    
069    
070      /**
071       * Retrieves the set of attributes in their raw, unparsed form as
072       * read from the client request.  Some of these attributes may be
073       * invalid as no validation will have been performed on them.  The
074       * returned list must not be altered by the caller.
075       *
076       * @return  The set of attributes in their raw, unparsed form as
077       *          read from the client request.
078       */
079      public List<RawAttribute> getRawAttributes();
080    
081    
082    
083      /**
084       * Retrieves the DN of the entry to add.
085       *
086       * @return  The DN of the entry to add.
087       */
088      public DN getEntryDN();
089    
090    
091    
092      /**
093       * Retrieves the set of processed objectclasses for the entry to
094       * add.  The contents of the returned map must not be altered by the
095       * caller.
096       *
097       * @return  The set of processed objectclasses for the entry to add.
098       */
099      public Map<ObjectClass,String> getObjectClasses();
100    
101    
102    
103      /**
104       * Adds the provided objectclass to the entry to add.  Note that
105       * pre-operation plugin processing is invoked after access control
106       * and schema validation, so plugins should be careful to only make
107       * changes that will not violate either schema or access control
108       * rules.
109       *
110       * @param  objectClass  The objectclass to add to the entry.
111       * @param  name         The name to use for the objectclass.
112       */
113      public void addObjectClass(ObjectClass objectClass, String name);
114    
115    
116    
117      /**
118       * Removes the provided objectclass from the entry to add.  Note
119       * that pre-operation plugin processing is invoked after access
120       * control and schema validation, so plugins should be careful to
121       * only make changes that will not violate either schema or access
122       * control rules.
123       *
124       * @param  objectClass  The objectclass to remove from the entry.
125       */
126      public void removeObjectClass(ObjectClass objectClass);
127    
128    
129    
130      /**
131       * Retrieves the set of processed user attributes for the entry to
132       * add.  The contents of the returned map must not be altered by the
133       * caller.
134       *
135       * @return  The set of processed user attributes for the entry to
136       *          add.
137       */
138      public Map<AttributeType,List<Attribute>> getUserAttributes();
139    
140    
141    
142      /**
143       * Retrieves the set of processed operational attributes for the
144       * entry to add.  The contents of the returned map must not be
145       * altered by the caller.
146       *
147       * @return  The set of processed operational attributes for the
148       *          entry to add.
149       */
150      public Map<AttributeType,List<Attribute>>
151                  getOperationalAttributes();
152    
153    
154    
155      /**
156       * Sets the specified attribute in the entry to add, overwriting any
157       * existing attribute of the specified type if necessary.  Note that
158       * pre-operation plugin processing is invoked after access control
159       * and schema validation, so plugins should be careful to only make
160       * changes that will not violate either schema or access control
161       * rules.
162       *
163       * @param  attributeType  The attribute type for the attribute.
164       * @param  attributeList  The attribute list for the provided
165       *                        attribute type.
166       */
167      public void setAttribute(AttributeType attributeType,
168                               List<Attribute> attributeList);
169    
170    
171    
172      /**
173       * Removes the specified attribute from the entry to add.  Note that
174       * pre-operation processing is invoked after access control and
175       * schema validation, so plugins should be careful to only make
176       * changes that will not violate either schema or access control
177       * rules.
178       *
179       * @param  attributeType  The attribute tyep for the attribute to
180       *                        remove.
181       */
182      public void removeAttribute(AttributeType attributeType);
183    
184    
185    
186      /**
187       * Retrieves the entry to be added to the server.  The contents of
188       * the returned entry must not be altered by the caller.
189       *
190       * @return  The entry to be added to the server.
191       */
192      public Entry getEntryToAdd();
193    }
194