Package com.unboundid.ldap.sdk
Class ExtendedRequest
- java.lang.Object
-
- com.unboundid.ldap.sdk.LDAPRequest
-
- com.unboundid.ldap.sdk.ExtendedRequest
-
- All Implemented Interfaces:
ProtocolOp
,ReadOnlyLDAPRequest
,java.io.Serializable
- Direct Known Subclasses:
CancelExtendedRequest
,ClearMissedNotificationChangesAlarmExtendedRequest
,CollectSupportDataExtendedRequest
,ConsumeSingleUseTokenExtendedRequest
,DeleteNotificationDestinationExtendedRequest
,DeleteNotificationSubscriptionExtendedRequest
,DeliverOneTimePasswordExtendedRequest
,DeliverPasswordResetTokenExtendedRequest
,DeliverSingleUseTokenExtendedRequest
,DeregisterYubiKeyOTPDeviceExtendedRequest
,EndAdministrativeSessionExtendedRequest
,EndBatchedTransactionExtendedRequest
,EndInteractiveTransactionExtendedRequest
,EndTransactionExtendedRequest
,GeneratePasswordExtendedRequest
,GenerateTOTPSharedSecretExtendedRequest
,GetBackupCompatibilityDescriptorExtendedRequest
,GetChangelogBatchExtendedRequest
,GetConfigurationExtendedRequest
,GetConnectionIDExtendedRequest
,GetPasswordQualityRequirementsExtendedRequest
,GetSubtreeAccessibilityExtendedRequest
,GetSupportedOTPDeliveryMechanismsExtendedRequest
,IdentifyBackupCompatibilityProblemsExtendedRequest
,ListConfigurationsExtendedRequest
,ListNotificationSubscriptionsExtendedRequest
,MultiUpdateExtendedRequest
,PasswordModifyExtendedRequest
,PasswordPolicyStateExtendedRequest
,RegisterYubiKeyOTPDeviceExtendedRequest
,RevokeTOTPSharedSecretExtendedRequest
,SetNotificationDestinationExtendedRequest
,SetNotificationSubscriptionExtendedRequest
,SetSubtreeAccessibilityExtendedRequest
,StartAdministrativeSessionExtendedRequest
,StartBatchedTransactionExtendedRequest
,StartInteractiveTransactionExtendedRequest
,StartTLSExtendedRequest
,StartTransactionExtendedRequest
,StreamDirectoryValuesExtendedRequest
,StreamProxyValuesExtendedRequest
,ValidateTOTPPasswordExtendedRequest
,WhoAmIExtendedRequest
@Extensible @NotMutable @ThreadSafety(level=NOT_THREADSAFE) public class ExtendedRequest extends LDAPRequest implements ProtocolOp
This class implements the processing necessary to perform an LDAPv3 extended operation, which provides a way to request actions not included in the core LDAP protocol. Subclasses can provide logic to help implement more specific types of extended operations, but it is important to note that if such subclasses include an extended request value, then the request value must be kept up-to-date if any changes are made to custom elements in that class that would impact the request value encoding.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static byte
TYPE_EXTENDED_REQUEST_OID
The BER type for the extended request OID element.protected static byte
TYPE_EXTENDED_REQUEST_VALUE
The BER type for the extended request value element.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ExtendedRequest(ExtendedRequest extendedRequest)
Creates a new extended request with the information from the provided extended request.ExtendedRequest(java.lang.String oid)
Creates a new extended request with the provided OID and no value.ExtendedRequest(java.lang.String oid, ASN1OctetString value)
Creates a new extended request with the provided OID and value.ExtendedRequest(java.lang.String oid, ASN1OctetString value, Control[] controls)
Creates a new extended request with the provided OID and value.ExtendedRequest(java.lang.String oid, Control[] controls)
Creates a new extended request with the provided OID and no value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExtendedRequest
duplicate()
Creates a new instance of this LDAP request that may be modified without impacting this request.ExtendedRequest
duplicate(Control[] controls)
Creates a new instance of this LDAP request that may be modified without impacting this request.ASN1Element
encodeProtocolOp()
Encodes the extended request protocol op to an ASN.1 element.java.lang.String
getExtendedRequestName()
Retrieves the user-friendly name for the extended request, if available.int
getLastMessageID()
Retrieves the message ID for the last LDAP message sent using this request.java.lang.String
getOID()
Retrieves the OID for this extended request.OperationType
getOperationType()
Retrieves the type of operation that is represented by this request.byte
getProtocolOpType()
Retrieves the BER type for this protocol op.ASN1OctetString
getValue()
Retrieves the encoded value for this extended request, if available.boolean
hasValue()
Indicates whether this extended request has a value.protected ExtendedResult
process(LDAPConnection connection, int depth)
Sends this extended request to the directory server over the provided connection and returns the associated response.void
responseReceived(LDAPResponse response)
void
toCode(java.util.List<java.lang.String> lineList, java.lang.String requestID, int indentSpaces, boolean includeProcessing)
Appends a number of lines comprising the Java source code that can be used to recreate this request to the given list.void
toString(java.lang.StringBuilder buffer)
Appends a string representation of this request to the provided buffer.void
writeTo(ASN1Buffer writer)
Writes an ASN.1-encoded representation of this LDAP protocol op to the provided ASN.1 buffer.-
Methods inherited from class com.unboundid.ldap.sdk.LDAPRequest
followReferrals, getControl, getControlList, getControls, getIntermediateResponseListener, getReferralConnector, getResponseTimeoutMillis, hasControl, hasControl, setFollowReferrals, setIntermediateResponseListener, setReferralConnector, setResponseTimeoutMillis, toString
-
-
-
-
Field Detail
-
TYPE_EXTENDED_REQUEST_OID
protected static final byte TYPE_EXTENDED_REQUEST_OID
The BER type for the extended request OID element.- See Also:
- Constant Field Values
-
TYPE_EXTENDED_REQUEST_VALUE
protected static final byte TYPE_EXTENDED_REQUEST_VALUE
The BER type for the extended request value element.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExtendedRequest
public ExtendedRequest(java.lang.String oid)
Creates a new extended request with the provided OID and no value.- Parameters:
oid
- The OID for this extended request. It must not benull
.
-
ExtendedRequest
public ExtendedRequest(java.lang.String oid, Control[] controls)
Creates a new extended request with the provided OID and no value.- Parameters:
oid
- The OID for this extended request. It must not benull
.controls
- The set of controls for this extended request.
-
ExtendedRequest
public ExtendedRequest(java.lang.String oid, ASN1OctetString value)
Creates a new extended request with the provided OID and value.- Parameters:
oid
- The OID for this extended request. It must not benull
.value
- The encoded value for this extended request. It may benull
if this request should not have a value.
-
ExtendedRequest
public ExtendedRequest(java.lang.String oid, ASN1OctetString value, Control[] controls)
Creates a new extended request with the provided OID and value.- Parameters:
oid
- The OID for this extended request. It must not benull
.value
- The encoded value for this extended request. It may benull
if this request should not have a value.controls
- The set of controls for this extended request.
-
ExtendedRequest
protected ExtendedRequest(ExtendedRequest extendedRequest)
Creates a new extended request with the information from the provided extended request.- Parameters:
extendedRequest
- The extended request that should be used to create this new extended request.
-
-
Method Detail
-
getOID
public final java.lang.String getOID()
Retrieves the OID for this extended request.- Returns:
- The OID for this extended request.
-
hasValue
public final boolean hasValue()
Indicates whether this extended request has a value.- Returns:
true
if this extended request has a value, orfalse
if not.
-
getValue
public final ASN1OctetString getValue()
Retrieves the encoded value for this extended request, if available.- Returns:
- The encoded value for this extended request, or
null
if this request does not have a value.
-
getProtocolOpType
public final byte getProtocolOpType()
Retrieves the BER type for this protocol op.- Specified by:
getProtocolOpType
in interfaceProtocolOp
- Returns:
- The BER type for this protocol op.
-
writeTo
public final void writeTo(ASN1Buffer writer)
Writes an ASN.1-encoded representation of this LDAP protocol op to the provided ASN.1 buffer. This method is intended for internal use only and should not be used by third-party code.- Specified by:
writeTo
in interfaceProtocolOp
- Parameters:
writer
- The ASN.1 buffer to which the encoded representation should be written.
-
encodeProtocolOp
public ASN1Element encodeProtocolOp()
Encodes the extended request protocol op to an ASN.1 element.- Specified by:
encodeProtocolOp
in interfaceProtocolOp
- Returns:
- The ASN.1 element with the encoded extended request protocol op.
-
process
protected ExtendedResult process(LDAPConnection connection, int depth) throws LDAPException
Sends this extended request to the directory server over the provided connection and returns the associated response.- Specified by:
process
in classLDAPRequest
- Parameters:
connection
- The connection to use to communicate with the directory server.depth
- The current referral depth for this request. It should always be one for the initial request, and should only be incremented when following referrals.- Returns:
- An LDAP result object that provides information about the result of the extended operation processing.
- Throws:
LDAPException
- If a problem occurs while sending the request or reading the response.
-
responseReceived
@InternalUseOnly public final void responseReceived(LDAPResponse response) throws LDAPException
- Throws:
LDAPException
-
getLastMessageID
public final int getLastMessageID()
Retrieves the message ID for the last LDAP message sent using this request.- Specified by:
getLastMessageID
in classLDAPRequest
- Returns:
- The message ID for the last LDAP message sent using this request, or -1 if it no LDAP messages have yet been sent using this request.
-
getOperationType
public final OperationType getOperationType()
Retrieves the type of operation that is represented by this request.- Specified by:
getOperationType
in classLDAPRequest
- Returns:
- The type of operation that is represented by this request.
-
duplicate
public ExtendedRequest duplicate()
Creates a new instance of this LDAP request that may be modified without impacting this request.. Subclasses should override this method to return a duplicate of the appropriate type.- Specified by:
duplicate
in interfaceReadOnlyLDAPRequest
- Returns:
- A new instance of this LDAP request that may be modified without impacting this request.
-
duplicate
public ExtendedRequest duplicate(Control[] controls)
Creates a new instance of this LDAP request that may be modified without impacting this request. The provided controls will be used for the new request instead of duplicating the controls from this request.. Subclasses should override this method to return a duplicate of the appropriate type.- Specified by:
duplicate
in interfaceReadOnlyLDAPRequest
- Parameters:
controls
- The set of controls to include in the duplicate request.- Returns:
- A new instance of this LDAP request that may be modified without impacting this request.
-
getExtendedRequestName
public java.lang.String getExtendedRequestName()
Retrieves the user-friendly name for the extended request, if available. If no user-friendly name has been defined, then the OID will be returned.- Returns:
- The user-friendly name for this extended request, or the OID if no user-friendly name is available.
-
toString
public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this request to the provided buffer.- Specified by:
toString
in interfaceProtocolOp
- Specified by:
toString
in interfaceReadOnlyLDAPRequest
- Specified by:
toString
in classLDAPRequest
- Parameters:
buffer
- The buffer to which to append a string representation of this request.
-
toCode
public void toCode(java.util.List<java.lang.String> lineList, java.lang.String requestID, int indentSpaces, boolean includeProcessing)
Appends a number of lines comprising the Java source code that can be used to recreate this request to the given list.- Specified by:
toCode
in interfaceReadOnlyLDAPRequest
- Parameters:
lineList
- The list to which the source code lines should be added.requestID
- The name that should be used as an identifier for the request. If this isnull
or empty, then a generic ID will be used.indentSpaces
- The number of spaces that should be used to indent the generated code. It must not be negative.includeProcessing
- Indicates whether the generated code should include code required to actually process the request and handle the result (iftrue
), or just to generate the request (iffalse
).
-
-