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.server.ldap;
021
022
023import java.util.Set;
024
025import org.apache.directory.api.ldap.model.message.ExtendedRequest;
026import org.apache.directory.api.ldap.model.message.ExtendedResponse;
027
028
029/**
030 * An extension (hook) point that enables an implementor to provide his or her
031 * own LDAP 'Extended' operation.  
032 **
033 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
034 *
035 */
036public interface ExtendedOperationHandler<R extends ExtendedRequest, P extends ExtendedResponse>
037{
038    /**
039     * @return the EXTENSION_OID of the extended request this handler can handle.
040     */
041    String getOid();
042
043
044    /**
045     * The OIDs of the extensions supported by this handler.  This includes the 
046     * request as well as any responses associated with the request.  These OIDs 
047     * will be registered with the server to publish them as supportedExtensions.
048     * 
049     * @return the OIDs supported by this handler.
050     */
051    Set<String> getExtensionOids();
052
053
054    /**
055     * Handles the specified extended operation.
056     * 
057     * @param session the session object related with current connection
058     * @param req the LDAP Extended operation request
059     * 
060     * @throws Exception if failed to handle the operation
061     */
062    void handleExtendedOperation( LdapSession session, R req ) throws Exception;
063
064
065    /**
066     * Sets the LDAP server for this extendedOperation handler.
067     * 
068     * @param ldapServer the ldap protocol server
069     */
070    void setLdapServer( LdapServer ldapServer );
071}