Package org.opends.server.protocols.ldap
Class LDAPMessage
- java.lang.Object
-
- org.opends.server.protocols.ldap.LDAPMessage
-
- All Implemented Interfaces:
ProtocolElement
public class LDAPMessage extends Object implements ProtocolElement
This class defines the data structures and methods to use when interacting with an LDAP message, which is the basic envelope used to hold LDAP requests and responses.
-
-
Constructor Summary
Constructors Constructor Description LDAPMessage(int messageID, ProtocolOp protocolOp)Creates a new LDAP message with the provided message ID and protocol op but no controls.LDAPMessage(int messageID, ProtocolOp protocolOp, List<Control> controls)Creates a new LDAP message with the provided message ID, protocol op, and set of controls.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbandonRequestProtocolOpgetAbandonRequestProtocolOp()Retrieves the protocol op for this LDAP message as an abandon request protocol op.AddRequestProtocolOpgetAddRequestProtocolOp()Retrieves the protocol op for this LDAP message as an add request protocol op.AddResponseProtocolOpgetAddResponseProtocolOp()Retrieves the protocol op for this LDAP message as an add response protocol op.BindRequestProtocolOpgetBindRequestProtocolOp()Retrieves the protocol op for this LDAP message as a bind request protocol op.BindResponseProtocolOpgetBindResponseProtocolOp()Retrieves the protocol op for this LDAP message as a bind response protocol op.CompareRequestProtocolOpgetCompareRequestProtocolOp()Retrieves the protocol op for this LDAP message as a compare request protocol op.CompareResponseProtocolOpgetCompareResponseProtocolOp()Retrieves the protocol op for this LDAP message as a compare response protocol op.List<Control>getControls()Retrieves the set of controls for this LDAP message.DeleteRequestProtocolOpgetDeleteRequestProtocolOp()Retrieves the protocol op for this LDAP message as a delete request protocol op.DeleteResponseProtocolOpgetDeleteResponseProtocolOp()Retrieves the protocol op for this LDAP message as a delete response protocol op.ExtendedRequestProtocolOpgetExtendedRequestProtocolOp()Retrieves the protocol op for this LDAP message as an extended request protocol op.ExtendedResponseProtocolOpgetExtendedResponseProtocolOp()Retrieves the protocol op for this LDAP message as an extended response protocol op.intgetMessageID()Retrieves the message ID for this LDAP message.ModifyDNRequestProtocolOpgetModifyDNRequestProtocolOp()Retrieves the protocol op for this LDAP message as a modify DN request protocol op.ModifyDNResponseProtocolOpgetModifyDNResponseProtocolOp()Retrieves the protocol op for this LDAP message as a modify DN response protocol op.ModifyRequestProtocolOpgetModifyRequestProtocolOp()Retrieves the protocol op for this LDAP message as a modify request protocol op.ModifyResponseProtocolOpgetModifyResponseProtocolOp()Retrieves the protocol op for this LDAP message as a modify response protocol op.StringgetProtocolElementName()Retrieves the name of the protocol associated with this protocol element.ProtocolOpgetProtocolOp()Retrieves the protocol op for this LDAP message.StringgetProtocolOpName()Retrieves the protocol op name for this LDAP message.bytegetProtocolOpType()Retrieves the protocol op type for this LDAP message.SearchRequestProtocolOpgetSearchRequestProtocolOp()Retrieves the protocol op for this LDAP message as a search request protocol op.SearchResultDoneProtocolOpgetSearchResultDoneProtocolOp()Retrieves the protocol op for this LDAP message as a search result done protocol op.SearchResultEntryProtocolOpgetSearchResultEntryProtocolOp()Retrieves the protocol op for this LDAP message as a search result entry protocol op.SearchResultReferenceProtocolOpgetSearchResultReferenceProtocolOp()Retrieves the protocol op for this LDAP message as a search result reference protocol op.UnbindRequestProtocolOpgetUnbindRequestProtocolOp()Retrieves the protocol op for this LDAP message as an unbind request protocol op.StringtoString()Retrieves a string representation of this LDAP message.voidtoString(StringBuilder buffer)Appends a string representation of this protocol element to the provided buffer.voidtoString(StringBuilder buffer, int indent)Appends a string representation of this protocol element to the provided buffer.voidwrite(ASN1Writer stream)Writes this protocol op to an ASN.1 output stream.
-
-
-
Constructor Detail
-
LDAPMessage
public LDAPMessage(int messageID, ProtocolOp protocolOp)Creates a new LDAP message with the provided message ID and protocol op but no controls.- Parameters:
messageID- The message ID for this LDAP message.protocolOp- The protocol op for this LDAP message.
-
LDAPMessage
public LDAPMessage(int messageID, ProtocolOp protocolOp, List<Control> controls)Creates a new LDAP message with the provided message ID, protocol op, and set of controls.- Parameters:
messageID- The message ID for this LDAP message.protocolOp- The protocol op for this LDAP message.controls- The set of controls for this LDAP message.
-
-
Method Detail
-
getMessageID
public int getMessageID()
Retrieves the message ID for this LDAP message.- Returns:
- The message ID for this LDAP message.
-
getProtocolOp
public ProtocolOp getProtocolOp()
Retrieves the protocol op for this LDAP message.- Returns:
- The protocol op for this LDAP message.
-
getProtocolOpType
public byte getProtocolOpType()
Retrieves the protocol op type for this LDAP message.- Returns:
- The protocol op type for this LDAP message.
-
getProtocolOpName
public String getProtocolOpName()
Retrieves the protocol op name for this LDAP message.- Returns:
- The protocol op name for this LDAP message.
-
getAbandonRequestProtocolOp
public AbandonRequestProtocolOp getAbandonRequestProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as an abandon request protocol op.- Returns:
- The protocol op for this LDAP message as an abandon request protocol op.
- Throws:
ClassCastException- If the protocol op is not an abandon request protocol op.
-
getAddRequestProtocolOp
public AddRequestProtocolOp getAddRequestProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as an add request protocol op.- Returns:
- The protocol op for this LDAP message as an add request protocol op.
- Throws:
ClassCastException- If the protocol op is not an add request protocol op.
-
getAddResponseProtocolOp
public AddResponseProtocolOp getAddResponseProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as an add response protocol op.- Returns:
- The protocol op for this LDAP message as an add response protocol op.
- Throws:
ClassCastException- If the protocol op is not an add response protocol op.
-
getBindRequestProtocolOp
public BindRequestProtocolOp getBindRequestProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a bind request protocol op.- Returns:
- The protocol op for this LDAP message as a bind request protocol op.
- Throws:
ClassCastException- If the protocol op is not a bind request protocol op.
-
getBindResponseProtocolOp
public BindResponseProtocolOp getBindResponseProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a bind response protocol op.- Returns:
- The protocol op for this LDAP message as a bind response protocol op.
- Throws:
ClassCastException- If the protocol op is not a bind response protocol op.
-
getCompareRequestProtocolOp
public CompareRequestProtocolOp getCompareRequestProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a compare request protocol op.- Returns:
- The protocol op for this LDAP message as a compare request protocol op.
- Throws:
ClassCastException- If the protocol op is not a compare request protocol op.
-
getCompareResponseProtocolOp
public CompareResponseProtocolOp getCompareResponseProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a compare response protocol op.- Returns:
- The protocol op for this LDAP message as a compare response protocol op.
- Throws:
ClassCastException- If the protocol op is not a compare response protocol op.
-
getDeleteRequestProtocolOp
public DeleteRequestProtocolOp getDeleteRequestProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a delete request protocol op.- Returns:
- The protocol op for this LDAP message as a delete request protocol op.
- Throws:
ClassCastException- If the protocol op is not a delete request protocol op.
-
getDeleteResponseProtocolOp
public DeleteResponseProtocolOp getDeleteResponseProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a delete response protocol op.- Returns:
- The protocol op for this LDAP message as a delete response protocol op.
- Throws:
ClassCastException- If the protocol op is not a delete response protocol op.
-
getExtendedRequestProtocolOp
public ExtendedRequestProtocolOp getExtendedRequestProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as an extended request protocol op.- Returns:
- The protocol op for this LDAP message as an extended request protocol op.
- Throws:
ClassCastException- If the protocol op is not an extended request protocol op.
-
getExtendedResponseProtocolOp
public ExtendedResponseProtocolOp getExtendedResponseProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as an extended response protocol op.- Returns:
- The protocol op for this LDAP message as an extended response protocol op.
- Throws:
ClassCastException- If the protocol op is not an extended response protocol op.
-
getModifyRequestProtocolOp
public ModifyRequestProtocolOp getModifyRequestProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a modify request protocol op.- Returns:
- The protocol op for this LDAP message as a modify request protocol op.
- Throws:
ClassCastException- If the protocol op is not a modify request protocol op.
-
getModifyResponseProtocolOp
public ModifyResponseProtocolOp getModifyResponseProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a modify response protocol op.- Returns:
- The protocol op for this LDAP message as a modify response protocol op.
- Throws:
ClassCastException- If the protocol op is not a modify response protocol op.
-
getModifyDNRequestProtocolOp
public ModifyDNRequestProtocolOp getModifyDNRequestProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a modify DN request protocol op.- Returns:
- The protocol op for this LDAP message as a modify DN request protocol op.
- Throws:
ClassCastException- If the protocol op is not a modify DN request protocol op.
-
getModifyDNResponseProtocolOp
public ModifyDNResponseProtocolOp getModifyDNResponseProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a modify DN response protocol op.- Returns:
- The protocol op for this LDAP message as a modify DN response protocol op.
- Throws:
ClassCastException- If the protocol op is not a modify DN response protocol op.
-
getSearchRequestProtocolOp
public SearchRequestProtocolOp getSearchRequestProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a search request protocol op.- Returns:
- The protocol op for this LDAP message as a search request protocol op.
- Throws:
ClassCastException- If the protocol op is not a search request protocol op.
-
getSearchResultDoneProtocolOp
public SearchResultDoneProtocolOp getSearchResultDoneProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a search result done protocol op.- Returns:
- The protocol op for this LDAP message as a search result done protocol op.
- Throws:
ClassCastException- If the protocol op is not a search result done protocol op.
-
getSearchResultEntryProtocolOp
public SearchResultEntryProtocolOp getSearchResultEntryProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a search result entry protocol op.- Returns:
- The protocol op for this LDAP message as a search result entry protocol op.
- Throws:
ClassCastException- If the protocol op is not a search result entry protocol op.
-
getSearchResultReferenceProtocolOp
public SearchResultReferenceProtocolOp getSearchResultReferenceProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as a search result reference protocol op.- Returns:
- The protocol op for this LDAP message as a search result reference protocol op.
- Throws:
ClassCastException- If the protocol op is not a search result reference protocol op.
-
getUnbindRequestProtocolOp
public UnbindRequestProtocolOp getUnbindRequestProtocolOp() throws ClassCastException
Retrieves the protocol op for this LDAP message as an unbind request protocol op.- Returns:
- The protocol op for this LDAP message as an unbind request protocol op.
- Throws:
ClassCastException- If the protocol op is not an unbind request protocol op.
-
getControls
public List<Control> getControls()
Retrieves the set of controls for this LDAP message. It may be modified by the caller.- Returns:
- The set of controls for this LDAP message.
-
write
public void write(ASN1Writer stream) throws IOException
Writes this protocol op to an ASN.1 output stream.- Parameters:
stream- The ASN.1 output stream to write to.- Throws:
IOException- If a problem occurs while writing to the stream.
-
getProtocolElementName
public String getProtocolElementName()
Retrieves the name of the protocol associated with this protocol element.- Specified by:
getProtocolElementNamein interfaceProtocolElement- Returns:
- The name of the protocol associated with this protocol element.
-
toString
public String toString()
Retrieves a string representation of this LDAP message.
-
toString
public void toString(StringBuilder buffer)
Appends a string representation of this protocol element to the provided buffer.- Specified by:
toStringin interfaceProtocolElement- Parameters:
buffer- The buffer into which the string representation should be written.
-
toString
public void toString(StringBuilder buffer, int indent)
Appends a string representation of this protocol element to the provided buffer.- Specified by:
toStringin interfaceProtocolElement- Parameters:
buffer- The buffer into which the string representation should be written.indent- The number of spaces that should be used to indent the resulting string representation.
-
-