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