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