001/*
002 * Copyright 2019-2024 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2019-2024 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) 2019-2024 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.sdk;
037
038
039
040import java.io.Closeable;
041
042import com.unboundid.asn1.ASN1OctetString;
043import com.unboundid.util.NotExtensible;
044import com.unboundid.util.NotNull;
045import com.unboundid.util.Nullable;
046import com.unboundid.util.ThreadSafety;
047import com.unboundid.util.ThreadSafetyLevel;
048
049
050
051/**
052 * This interface defines a set of methods that are available for objects that
053 * may be used to communicate with an LDAP directory server (or something that
054 * simulates an LDAP directory server).  This can be used to facilitate
055 * development of methods which can be used for either a single LDAP connection
056 * or an LDAP  pool.  This interface extends the basic
057 * {@link LDAPInterface} interface to also include support for bind and extended
058 * operations, although those operations should be used with care because they
059 * may alter the state of the associated connection (or connection-like object),
060 * and in some cases (like a connection pool with multiple connections, where it
061 * may not be possible to guarantee that successive operations are processed on
062 * the same underlying connection), this may result in unexpected behavior.
063 * <BR><BR>
064 * This interface also extends the {@code Closeable} interface so that the
065 * underlying connection (or connection-like object) may be closed.  After it
066 * has been closed, no attempt should be made to re-use the object to perform
067 * LDAP (or LDAP-like) communication.
068 */
069@NotExtensible()
070@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
071public interface FullLDAPInterface
072       extends LDAPInterface, Closeable
073{
074  /**
075   * Closes the associated interface and frees any resources associated with it.
076   * This method may be safely called multiple times, but the associated
077   * interface should not be used after it has been closed.
078   */
079  @Override()
080  void close();
081
082
083
084  /**
085   * Processes a simple bind request with the provided DN and password.
086   *
087   * @param  bindDN    The bind DN for the bind operation.
088   * @param  password  The password for the simple bind operation.
089   *
090   * @return  The result of processing the bind operation.
091   *
092   * @throws  LDAPException  If the server rejects the bind request, or if a
093   *                         problem occurs while sending the request or reading
094   *                         the response.
095   */
096  @NotNull()
097  BindResult bind(@Nullable String bindDN, @Nullable String password)
098       throws LDAPException;
099
100
101
102  /**
103   * Processes the provided bind request.
104   *
105   * @param  bindRequest  The bind request to be processed.  It must not be
106   *                      {@code null}.
107   *
108   * @return  The result of processing the bind operation.
109   *
110   * @throws  LDAPException  If the server rejects the bind request, or if a
111   *                         problem occurs while sending the request or reading
112   *                         the response.
113   */
114  @NotNull()
115  BindResult bind(@NotNull BindRequest bindRequest)
116       throws LDAPException;
117
118
119
120  /**
121   * Processes an extended operation with the provided request OID and no value.
122   *
123   * @param  requestOID  The OID for the extended request to process.  It must
124   *                     not be {@code null}.
125   *
126   * @return  The extended result object that provides information about the
127   *          result of the request processing.
128   *
129   * @throws  LDAPException  If a problem occurs while sending the request or
130   *                         reading the response.
131   */
132  @NotNull()
133  ExtendedResult processExtendedOperation(@NotNull String requestOID)
134       throws LDAPException;
135
136
137
138  /**
139   * Processes an extended operation with the provided request OID and value.
140   *
141   * @param  requestOID    The OID for the extended request to process.  It must
142   *                       not be {@code null}.
143   * @param  requestValue  The encoded value for the extended request to
144   *                       process.  It may be {@code null} if there does not
145   *                       need to be a value for the requested operation.
146   *
147   * @return  The extended result object that provides information about the
148   *          result of the request processing.
149   *
150   * @throws  LDAPException  If a problem occurs while sending the request or
151   *                         reading the response.
152   */
153  @NotNull()
154  ExtendedResult processExtendedOperation(@NotNull String requestOID,
155                      @Nullable ASN1OctetString requestValue)
156       throws LDAPException;
157
158
159
160  /**
161   * Processes the provided extended request.
162   *
163   * @param  extendedRequest  The extended request to be processed.  It must not
164   *                          be {@code null}.
165   *
166   * @return  The extended result object that provides information about the
167   *          result of the request processing.
168   *
169   * @throws  LDAPException  If a problem occurs while sending the request or
170   *                         reading the response.
171   */
172  @NotNull()
173  ExtendedResult processExtendedOperation(
174                      @NotNull ExtendedRequest extendedRequest)
175       throws LDAPException;
176}