|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.unboundid.ldap.sdk.LDAPRequest
com.unboundid.ldap.sdk.UpdatableLDAPRequest
com.unboundid.ldap.sdk.DeleteRequest
@Mutable @ThreadSafety(level=NOT_THREADSAFE) public final class DeleteRequest
This class implements the processing necessary to perform an LDAPv3 delete
operation, which removes an entry from the directory. A delete request
contains the DN of the entry to remove. It may also include a set of
controls to send to the server.
DeleteRequest
objects are mutable and therefore can be altered and
re-used for multiple requests. Note, however, that DeleteRequest
objects are not threadsafe and therefore a single DeleteRequest
object instance should not be used to process multiple requests at the same
time.
DeleteRequest deleteRequest = new DeleteRequest("cn=entry to delete,dc=example,dc=com"); LDAPResult deleteResult; try { deleteResult = connection.delete(deleteRequest); // If we get here, the delete was successful. } catch (LDAPException le) { // The delete operation failed. deleteResult = le.toLDAPResult(); ResultCode resultCode = le.getResultCode(); String errorMessageFromServer = le.getDiagnosticMessage(); }
Constructor Summary | |
---|---|
DeleteRequest(DN dn)
Creates a new delete request with the provided DN. |
|
DeleteRequest(DN dn,
Control[] controls)
Creates a new delete request with the provided DN. |
|
DeleteRequest(java.lang.String dn)
Creates a new delete request with the provided DN. |
|
DeleteRequest(java.lang.String dn,
Control[] controls)
Creates a new delete request with the provided DN. |
Method Summary | |
---|---|
DeleteRequest |
duplicate()
Creates a new instance of this LDAP request that may be modified without impacting this request. |
DeleteRequest |
duplicate(Control[] controls)
Creates a new instance of this LDAP request that may be modified without impacting this request. |
ASN1Element |
encodeProtocolOp()
Encodes the delete request protocol op to an ASN.1 element. |
java.lang.String |
getDN()
Retrieves the DN of the entry to delete. |
int |
getLastMessageID()
Retrieves the message ID for the last LDAP message sent using this request. |
OperationType |
getOperationType()
Retrieves the type of operation that is represented by this request. |
byte |
getProtocolOpType()
Retrieves the BER type for this protocol op. |
protected LDAPResult |
process(LDAPConnection connection,
int depth)
Sends this delete request to the directory server over the provided connection and returns the associated response. |
void |
responseReceived(LDAPResponse response)
Indicates that the provided LDAP response has been received by from the server. |
void |
setDN(DN dn)
Specifies the DN of the entry to delete. |
void |
setDN(java.lang.String dn)
Specifies the DN of the entry to delete. |
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. |
java.lang.String[] |
toLDIF()
Retrieves a string array whose lines contain an LDIF representation of the corresponding delete change record. |
LDIFDeleteChangeRecord |
toLDIFChangeRecord()
Retrieves an LDIF delete change record with the contents of this delete request. |
java.lang.String |
toLDIFString()
Retrieves an LDIF string representation of this delete request. |
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this request to the provided buffer. |
void |
writeTo(ASN1Buffer buffer)
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.UpdatableLDAPRequest |
---|
addControl, addControls, clearControls, removeControl, removeControl, replaceControl, replaceControl, setControls, setControls |
Methods inherited from class com.unboundid.ldap.sdk.LDAPRequest |
---|
followReferrals, getControl, getControlList, getControls, getIntermediateResponseListener, getResponseTimeoutMillis, hasControl, hasControl, setFollowReferrals, setIntermediateResponseListener, setResponseTimeoutMillis, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.unboundid.ldap.sdk.ReadOnlyLDAPRequest |
---|
followReferrals, getControl, getControlList, getResponseTimeoutMillis, hasControl, hasControl, toString |
Constructor Detail |
---|
public DeleteRequest(java.lang.String dn)
dn
- The DN of the entry to delete. It must not be null
.public DeleteRequest(java.lang.String dn, Control[] controls)
dn
- The DN of the entry to delete. It must not be
null
.controls
- The set of controls to include in the request.public DeleteRequest(DN dn)
dn
- The DN of the entry to delete. It must not be null
.public DeleteRequest(DN dn, Control[] controls)
dn
- The DN of the entry to delete. It must not be
null
.controls
- The set of controls to include in the request.Method Detail |
---|
public java.lang.String getDN()
getDN
in interface ReadOnlyDeleteRequest
public void setDN(java.lang.String dn)
dn
- The DN of the entry to delete. It must not be null
.public void setDN(DN dn)
dn
- The DN of the entry to delete. It must not be null
.public byte getProtocolOpType()
getProtocolOpType
in interface ProtocolOp
public void writeTo(ASN1Buffer buffer)
writeTo
in interface ProtocolOp
buffer
- The ASN.1 buffer to which the encoded representation should
be written.public ASN1Element encodeProtocolOp()
encodeProtocolOp
in interface ProtocolOp
protected LDAPResult process(LDAPConnection connection, int depth) throws LDAPException
process
in class LDAPRequest
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.
LDAPException
- If a problem occurs while sending the request or
reading the response.@InternalUseOnly public void responseReceived(LDAPResponse response) throws LDAPException
response
- The LDAP response that has been received from the server.
It may be null
if the connection has been closed
without having received any response.
LDAPException
- If a problem occurs while handling the response.public int getLastMessageID()
getLastMessageID
in class LDAPRequest
public OperationType getOperationType()
getOperationType
in class LDAPRequest
public DeleteRequest duplicate()
duplicate
in interface ReadOnlyDeleteRequest
duplicate
in interface ReadOnlyLDAPRequest
public DeleteRequest duplicate(Control[] controls)
duplicate
in interface ReadOnlyDeleteRequest
duplicate
in interface ReadOnlyLDAPRequest
controls
- The set of controls to include in the duplicate request.
public LDIFDeleteChangeRecord toLDIFChangeRecord()
toLDIFChangeRecord
in interface ReadOnlyDeleteRequest
public java.lang.String[] toLDIF()
toLDIF
in interface ReadOnlyDeleteRequest
public java.lang.String toLDIFString()
toLDIFString
in interface ReadOnlyDeleteRequest
public void toString(java.lang.StringBuilder buffer)
toString
in interface ProtocolOp
toString
in interface ReadOnlyLDAPRequest
toString
in class LDAPRequest
buffer
- The buffer to which to append a string representation of
this request.public void toCode(java.util.List<java.lang.String> lineList, java.lang.String requestID, int indentSpaces, boolean includeProcessing)
toCode
in interface ReadOnlyLDAPRequest
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 is null
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 (if true
),
or just to generate the request (if
false
).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |