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