001/*
002 * Copyright 2011-2022 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2011-2022 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-2022 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.NotNull;
046import com.unboundid.util.ThreadSafety;
047import com.unboundid.util.ThreadSafetyLevel;
048
049
050
051/**
052 * This class defines an API that may be used to provide support for one or
053 * more types of extended operations in the in-memory directory server.
054 */
055@Extensible()
056@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
057public abstract class InMemoryExtendedOperationHandler
058{
059  /**
060   * Retrieves the name that should be used for this extended operation handler.
061   *
062   * @return  The name that should be used for this extended operation handler.
063   */
064  @NotNull()
065  public abstract String getExtendedOperationHandlerName();
066
067
068
069  /**
070   * Retrieves a list of the extended request OIDs supported by this extended
071   * operation handler.
072   *
073   * @return  A list of the extended request OIDs supported by this extended
074   *          operation handler.
075   */
076  @NotNull()
077  public abstract List<String> getSupportedExtendedRequestOIDs();
078
079
080
081  /**
082   * Performs the appropriate processing for the provided extended request.
083   * This method is completely responsible for any controls associated with the
084   * provided request.
085   *
086   * @param  handler    The in-memory request handler that accepted the extended
087   *                    request.
088   * @param  messageID  The message ID for the LDAP message that the client used
089   *                    to send the request.
090   * @param  request    The extended request to process, which will have a
091   *                    request OID which matches one of the OIDs in the list
092   *                    returned byt the
093   *                    {@link #getSupportedExtendedRequestOIDs()} method.
094   *
095   * @return  The result that should be returned to the client in response to
096   *          the provided request.
097   */
098  @NotNull()
099  public abstract ExtendedResult processExtendedOperation(
100                                      @NotNull InMemoryRequestHandler handler,
101                                      int messageID,
102                                      @NotNull ExtendedRequest request);
103
104
105
106  /**
107   * Retrieves a string representation of this extended operation handler.
108   *
109   * @return  A string representation of this extended operation handler.
110   */
111  @Override()
112  @NotNull()
113  public String toString()
114  {
115    return getExtendedOperationHandlerName();
116  }
117}