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 */
020package org.apache.directory.shared.ldap.model.message;
021
022import org.apache.directory.shared.ldap.model.exception.MessageException;
023
024
025/**
026 * Extended protocol request message used to add to more operations to the
027 * protocol. Here's what <a href="http://www.faqs.org/rfcs/rfc2251.html"> RFC
028 * 2251</a> says about it:
029 * 
030 * <pre>
031 *  4.12. Extended Operation
032 * 
033 *   An extension mechanism has been added in this version of LDAP, in
034 *   order to allow additional operations to be defined for services not
035 *   available elsewhere in this protocol, for instance digitally signed
036 *   operations and results.
037 * 
038 *   The extended operation allows clients to make requests and receive
039 *   responses with predefined syntaxes and semantics.  These may be
040 *   defined in RFCs or be private to particular implementations.  Each
041 *   request MUST have a unique OBJECT IDENTIFIER assigned to it.
042 * 
043 *        ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
044 *                requestName      [0] LDAPOID,
045 *                requestValue     [1] OCTET STRING OPTIONAL }
046 * 
047 *   The requestName is a dotted-decimal representation of the OBJECT
048 *   IDENTIFIER corresponding to the request. The requestValue is
049 *   information in a form defined by that request, encapsulated inside an
050 *   OCTET STRING.
051 * </pre>
052 * <br>
053 *  
054 *  @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
055 * 
056 */
057public interface ExtendedRequest<R extends ExtendedResponse> extends SingleReplyRequest<R>
058{
059    /** Extended request message type enumeration value */
060    MessageTypeEnum TYPE = MessageTypeEnum.EXTENDED_REQUEST;
061
062    /** Extended response message type enumeration value */
063    MessageTypeEnum RESP_TYPE = ExtendedResponse.TYPE;
064
065
066    /**
067     * Gets the Object Identifier corresponding to the extended request type.
068     * This is the <b>requestName</b> portion of the ExtendedRequst PDU.
069     * 
070     * @return the dotted-decimal representation as a String of the OID
071     */
072    String getRequestName();
073
074
075    /**
076     * Sets the Object Identifier corresponding to the extended request type.
077     * 
078     * @param oid the dotted-decimal representation as a String of the OID
079     * @return The ExtendedRequest instance
080     */
081    ExtendedRequest<R> setRequestName( String oid );
082
083
084    /**
085     * {@inheritDoc}
086     */
087    ExtendedRequest<R> setMessageId( int messageId );
088    
089    
090    /**
091     * {@inheritDoc}
092     */
093    ExtendedRequest<R> addControl( Control control ) throws MessageException;
094    
095    
096    /**
097     * {@inheritDoc}
098     */
099    ExtendedRequest<R> addAllControls( Control[] controls ) throws MessageException;
100    
101    
102    /**
103     * {@inheritDoc}
104     */
105    ExtendedRequest<R> removeControl( Control control ) throws MessageException;
106}