001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *  
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *  
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License. 
018 *  
019 */
020
021package org.apache.directory.shared.ldap.model.message;
022
023
024import org.apache.directory.shared.ldap.model.entry.Entry;
025import org.apache.directory.shared.ldap.model.exception.MessageException;
026import org.apache.directory.shared.ldap.model.name.Dn;
027
028
029/**
030 * Add protocol operation request used to add a new entry to the DIT.
031 * 
032 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
033 */
034public interface AddRequest extends SingleReplyRequest<AddResponse>, AbandonableRequest
035{
036    /** LDAPv3 add request type enum code */
037    MessageTypeEnum TYPE = MessageTypeEnum.ADD_REQUEST;
038
039    /** LDAPv3 add response type enum code */
040    MessageTypeEnum RESP_TYPE = AddResponse.TYPE;
041
042
043    /**
044     * Gets the distinguished name of the entry to add.
045     * 
046     * @return the Dn of the added entry.
047     */
048    Dn getEntryDn();
049
050
051    /**
052     * Sets the distinguished name of the entry to add.
053     * 
054     * @param entry the Dn of the added entry.
055     * @return The AddRequest instance
056     */
057    AddRequest setEntryDn( Dn entry );
058
059
060    /**
061     * Gets the entry to add.
062     * 
063     * @return the added Entry
064     */
065    Entry getEntry();
066
067
068    /**
069     * Sets the Entry to add.
070     * 
071     * @param entry the added Entry
072     * @return The AddRequest instance
073     */
074    AddRequest setEntry( Entry entry );
075
076
077    /**
078     * {@inheritDoc}
079     */
080    AddRequest setMessageId( int messageId );
081    
082    
083    /**
084     * {@inheritDoc}
085     */
086    AddRequest addControl( Control control ) throws MessageException;
087    
088    
089    /**
090     * {@inheritDoc}
091     */
092    AddRequest addAllControls( Control[] controls ) throws MessageException;
093    
094    
095    /**
096     * {@inheritDoc}
097     */
098    AddRequest removeControl( Control control ) throws MessageException;
099}