001    /*
002     * Copyright 2011-2015 UnboundID Corp.
003     * All Rights Reserved.
004     */
005    /*
006     * Copyright (C) 2011-2015 UnboundID Corp.
007     *
008     * This program is free software; you can redistribute it and/or modify
009     * it under the terms of the GNU General Public License (GPLv2 only)
010     * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011     * as published by the Free Software Foundation.
012     *
013     * This program is distributed in the hope that it will be useful,
014     * but WITHOUT ANY WARRANTY; without even the implied warranty of
015     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016     * GNU General Public License for more details.
017     *
018     * You should have received a copy of the GNU General Public License
019     * along with this program; if not, see <http://www.gnu.org/licenses>.
020     */
021    package com.unboundid.ldap.listener;
022    
023    
024    
025    import java.util.List;
026    
027    import com.unboundid.ldap.sdk.ExtendedRequest;
028    import com.unboundid.ldap.sdk.ExtendedResult;
029    import com.unboundid.util.Extensible;
030    import com.unboundid.util.ThreadSafety;
031    import com.unboundid.util.ThreadSafetyLevel;
032    
033    
034    
035    /**
036     * This class defines an API that may be used to provide support for one or
037     * more types of extended operations in the in-memory directory server.
038     */
039    @Extensible()
040    @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
041    public abstract class InMemoryExtendedOperationHandler
042    {
043      /**
044       * Retrieves the name that should be used for this extended operation handler.
045       *
046       * @return  The name that should be used for this extended operation handler.
047       */
048      public abstract String getExtendedOperationHandlerName();
049    
050    
051    
052      /**
053       * Retrieves a list of the extended request OIDs supported by this extended
054       * operation handler.
055       *
056       * @return  A list of the extended request OIDs supported by this extended
057       *          operation handler.
058       */
059      public abstract List<String> getSupportedExtendedRequestOIDs();
060    
061    
062    
063      /**
064       * Performs the appropriate processing for the provided extended request.
065       * This method is completely responsible for any controls associated with the
066       * provided request.
067       *
068       * @param  handler    The in-memory request handler that accepted the extended
069       *                    request.
070       * @param  messageID  The message ID for the LDAP message that the client used
071       *                    to send the request.
072       * @param  request    The extended request to process, which will have a
073       *                    request OID which matches one of the OIDs in the list
074       *                    returned byt the
075       *                    {@link #getSupportedExtendedRequestOIDs()} method.
076       *
077       * @return  The result that should be returned to the client in response to
078       *          the provided request.
079       */
080      public abstract ExtendedResult processExtendedOperation(
081                                          final InMemoryRequestHandler handler,
082                                          final int messageID,
083                                          final ExtendedRequest request);
084    
085    
086    
087      /**
088       * Retrieves a string representation of this extended operation handler.
089       *
090       * @return  A string representation of this extended operation handler.
091       */
092      @Override()
093      public String toString()
094      {
095        return getExtendedOperationHandlerName();
096      }
097    }