Class Responses
java.lang.Object
org.forgerock.opendj.ldap.messages.Responses
This class contains various methods for creating and manipulating responses.
All copy constructors of the form copyOfXXXResult
perform deep copies
of their response parameter. More specifically, any controls, modifications,
and attributes contained within the response will be duplicated.
Similarly, all unmodifiable views of responses returned by methods of the
form unmodifiableXXXResult
return deep unmodifiable views of their
response parameter. More specifically, any controls, modifications, and
attributes contained within the returned response will be unmodifiable.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Result
copyOfResult
(Result result) Creates a new result that is an exact copy of the provided result.static SearchResultEntry
copyOfSearchResultEntry
(SearchResultEntry searchResultEntry) Creates a new search result entry that is an exact copy of the provided result.static BindResult
newBindResult
(Result result) Creates a new bind result using the provided result.static BindResult
newBindResult
(ResultCode resultCode) Creates a new bind result using the provided result code.static BindResult
newBindResult
(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, Throwable cause) Creates a new bind result using the provided result code.static BindResult
newBindResult
(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, List<String> referralUris, ByteString credentials, List<Control> controls, Throwable cause, SaslServer saslServer) Creates a new bind result using the provided result code.static BindResult
newBindResult
(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, ByteString credentials, Throwable cause, SaslServer saslServer) Creates a new bind result using the provided result code.static BindResult
newBindResult
(ResultCode resultCode, ByteString credentials, SaslServer saslServer) Creates a new bind result using the provided result code.static CompareResult
newCompareResult
(Result result) Creates a new compare result using the provided result.static CompareResult
newCompareResult
(ResultCode resultCode) Creates a new compare result using the provided result code.static CompareResult
newCompareResult
(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, List<String> referralUris, Throwable cause) Creates a new compare result using the provided result code.static GenericExtendedResult
Creates a new generic extended result using the provided extended result data.static GenericExtendedResult
newGenericExtendedResult
(ResultCode resultCode) Creates a new generic extended result using the provided result code.static GenericExtendedResult
newGenericExtendedResult
(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, String responseName, ByteString responseValue) Creates a new generic extended result using the provided result code.static GenericExtendedResult
newGenericExtendedResult
(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, List<String> referralUris, String responseName, ByteString responseValue, List<Control> controls) Creates a new generic extended result using the provided result code.static GenericExtendedResult
newGenericExtendedResult
(ResultCode resultCode, String responseName, ByteString responseValue) Creates a new generic extended result using the provided result code.static IntermediateResponse
newIntermediateResponse
(String oid, Object value) Creates a new intermediate response using the provided response name and value.static PasswordModifyExtendedResult
newPasswordModifyExtendedResult
(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, ByteString password) Creates a new password modify extended result using the provided result code, and no generated password.static PasswordModifyExtendedResult
newPasswordModifyExtendedResult
(ResultCode resultCode, ByteString password) Creates a new password modify extended result using the provided result code, and no generated password.static Result
newResult
(ResultCode resultCode) Creates a new result using the provided result code.static Result
newResult
(ResultCode resultCode, CharSequence diagnosticMessage) Creates a new result using the provided result code, the cause, the diagnostic message and the matched DN.static Result
newResult
(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, List<String> referralUris, Throwable cause) Creates a new result using the provided result code, the cause, the diagnostic message and the matched DN.static Result
newResult
(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, List<String> referralUris, List<Control> controls, Throwable cause) Creates a new result using the provided result code, the cause, the diagnostic message and the matched DN.static Result
newResult
(ResultCode resultCode, Dn matchedDn, CharSequence diagnosticMessage) Creates a new result using the provided result code, the cause, the diagnostic message and the matched DN.static Result
newResult
(ResultCode resultCode, Dn matchedDn, CharSequence diagnosticMessage, Throwable cause) Creates a new result using the provided result code, the cause, the diagnostic message and the matched DN.static SearchResultEntry
newSearchResultEntry
(String name) Creates a new search result entry using the provided distinguished name decoded using the default schema.static SearchResultEntry
newSearchResultEntry
(String... ldifLines) Creates a new search result entry using the provided lines of LDIF decoded using the default schema.static SearchResultEntry
newSearchResultEntry
(Dn name) Creates a new search result entry using the provided distinguished name.static SearchResultEntry
newSearchResultEntry
(Entry entry) Creates a new search result entry backed by the provided entry.static SearchResultReference
Creates a new search result reference using the provided continuation reference URI.static SearchResultReference
newSearchResultReference
(List<String> uris) Creates a new search result reference using the provided continuation reference URIs.static StartTlsExtendedResult
newStartTlsExtendedResult
(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, List<Control> controls, Throwable cause, SslOptions sslOptions) Creates a new start TLS extended result which will use the provided SSL context.static StartTlsExtendedResult
newStartTlsExtendedResult
(ResultCode resultCode, SslOptions sslOptions) Creates a new start TLS extended result which will use the provided SSL context.static WhoAmIExtendedResult
newWhoAmIExtendedResult
(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, String authorizationId) Creates a new who am I extended result with the provided result code, diagnosticMessage and matchedDn.
-
Method Details
-
copyOfResult
Creates a new result that is an exact copy of the provided result.- Parameters:
result
- The result to be copied.- Returns:
- The new result.
-
copyOfSearchResultEntry
Creates a new search result entry that is an exact copy of the provided result.- Parameters:
searchResultEntry
- The search result entry to be copied.- Returns:
- The new search result entry.
-
newBindResult
Creates a new bind result using the provided result code.- Parameters:
resultCode
- The result code.- Returns:
- The new bind result.
-
newBindResult
Creates a new bind result using the provided result.- Parameters:
result
- The result.- Returns:
- The new bind result.
-
newBindResult
public static BindResult newBindResult(ResultCode resultCode, ByteString credentials, SaslServer saslServer) Creates a new bind result using the provided result code.- Parameters:
resultCode
- The result code.credentials
- The server SASL credentials associated with this bind result, which may benull
indicating that none was provided.saslServer
- TheSaslServer
to use by the underlying connection, ornull
if SASL integrity and/or privacy protection must not be enabled.- Returns:
- The new bind result.
-
newBindResult
public static BindResult newBindResult(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, Throwable cause) Creates a new bind result using the provided result code.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
.cause
- The throwable cause, which may benull
indicating that none was provided.- Returns:
- The new bind result.
-
newBindResult
public static BindResult newBindResult(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, ByteString credentials, Throwable cause, SaslServer saslServer) Creates a new bind result using the provided result code.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
.credentials
- The server SASL credentials associated with this bind result, which may benull
indicating that none was provided.cause
- The throwable cause, which may benull
indicating that none was provided.saslServer
- TheSaslServer
to use by the underlying connection, ornull
if SASL integrity and/or privacy protection must not be enabled.- Returns:
- The new bind result.
-
newBindResult
public static BindResult newBindResult(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, List<String> referralUris, ByteString credentials, List<Control> controls, Throwable cause, SaslServer saslServer) Creates a new bind result using the provided result code.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
.referralUris
- The optional referrals are present in a BindResult if the result code is set toResultCode.REFERRAL
, and they are absent with all other result codes.credentials
- The server SASL credentials associated with this bind result, which may benull
indicating that none was provided.controls
- theList
containing the controls.cause
- The throwable cause, which may benull
indicating that none was provided.saslServer
- TheSaslServer
to use by the underlying connection, ornull
if SASL integrity and/or privacy protection must not be enabled.- Returns:
- The new bind result.
-
newCompareResult
Creates a new compare result using the provided result code.- Parameters:
resultCode
- The result code.- Returns:
- The new compare result.
-
newCompareResult
Creates a new compare result using the provided result.- Parameters:
result
- The result.- Returns:
- The new compare result.
-
newCompareResult
public static CompareResult newCompareResult(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, List<String> referralUris, Throwable cause) Creates a new compare result using the provided result code.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
.referralUris
- The optional referrals are present in a CompareResult if the result code is set toResultCode.REFERRAL
, and they are absent with all other result codes.cause
- The throwable cause, which may benull
indicating that none was provided.- Returns:
- The new compare result.
-
newGenericExtendedResult
Creates a new generic extended result using the provided result code.- Parameters:
resultCode
- The result code.- Returns:
- The new generic extended result.
-
newGenericExtendedResult
Creates a new generic extended result using the provided extended result data.- Parameters:
result
- The extended result to be used for copy.- Returns:
- The new generic extended result.
-
newGenericExtendedResult
public static GenericExtendedResult newGenericExtendedResult(ResultCode resultCode, String responseName, ByteString responseValue) Creates a new generic extended result using the provided result code.- Parameters:
resultCode
- The result code.responseName
- The numeric OID associated with this extended result, ornull
if there is no value.responseValue
- The value associated with this extended result, ornull
if there is no value.- Returns:
- The new generic extended result.
-
newGenericExtendedResult
public static GenericExtendedResult newGenericExtendedResult(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, String responseName, ByteString responseValue) Creates a new generic extended result using the provided result code.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
.responseName
- The numeric OID associated with this extended result, ornull
if there is no value.responseValue
- The value associated with this extended result, ornull
if there is no value.- Returns:
- The new generic extended result.
-
newGenericExtendedResult
public static GenericExtendedResult newGenericExtendedResult(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, List<String> referralUris, String responseName, ByteString responseValue, List<Control> controls) Creates a new generic extended result using the provided result code.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
.referralUris
- The optional referrals are present in a GenericExtendedResult if the result code is set toResultCode.REFERRAL
, and they are absent with all other result codes.responseName
- The numeric OID associated with this extended result, ornull
if there is no value.responseValue
- The value associated with this extended result, ornull
if there is no value.controls
- theList
containing the controls.- Returns:
- The new generic extended result.
-
newIntermediateResponse
Creates a new intermediate response using the provided response name and value.If the response value is not an instance of
ByteString
then it will be converted using theByteString.valueOfObject(Object)
method.- Parameters:
oid
- The dotted-decimal representation of the unique OID corresponding to this intermediate response, which may benull
indicating that none was provided.value
- The response value associated with this intermediate response, which may benull
indicating that none was provided.- Returns:
- The new intermediate response.
-
newPasswordModifyExtendedResult
public static PasswordModifyExtendedResult newPasswordModifyExtendedResult(ResultCode resultCode, ByteString password) Creates a new password modify extended result using the provided result code, and no generated password.- Parameters:
resultCode
- The result code.password
- The generated password, ornull
if there is no generated password associated with this result.- Returns:
- The new password modify extended result.
-
newPasswordModifyExtendedResult
public static PasswordModifyExtendedResult newPasswordModifyExtendedResult(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, ByteString password) Creates a new password modify extended result using the provided result code, and no generated password.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
.password
- The generated password, ornull
if there is no generated password associated with this result.- Returns:
- The new password modify extended result.
-
newResult
Creates a new result using the provided result code.- Parameters:
resultCode
- The result code.- Returns:
- The new result.
-
newResult
Creates a new result using the provided result code, the cause, the diagnostic message and the matched DN.- Parameters:
resultCode
- The result code.diagnosticMessage
- The diagnostic message, which may be empty ornull
indicating that none was provided.- Returns:
- The new result.
-
newResult
Creates a new result using the provided result code, the cause, the diagnostic message and the matched DN.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
indicating that none was provided.- Returns:
- The new result.
-
newResult
public static Result newResult(ResultCode resultCode, Dn matchedDn, CharSequence diagnosticMessage, Throwable cause) Creates a new result using the provided result code, the cause, the diagnostic message and the matched DN.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
indicating that none was provided.cause
- The throwable cause, which may benull
indicating that none was provided.- Returns:
- The new result.
-
newResult
public static Result newResult(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, List<String> referralUris, Throwable cause) Creates a new result using the provided result code, the cause, the diagnostic message and the matched DN.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
indicating that none was provided.referralUris
- The optional referrals are present in a ResultImpl if the result code is set toResultCode.REFERRAL
, and they are absent with all other result codes.cause
- The throwable cause, which may benull
indicating that none was provided.- Returns:
- The new result.
-
newResult
public static Result newResult(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, List<String> referralUris, List<Control> controls, Throwable cause) Creates a new result using the provided result code, the cause, the diagnostic message and the matched DN.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
indicating that none was provided.referralUris
- The optional referrals are present in a ResultImpl if the result code is set toResultCode.REFERRAL
, and they are absent with all other result codes.controls
- theList
containing the controls.cause
- The throwable cause, which may benull
indicating that none was provided.- Returns:
- The new result.
-
newSearchResultEntry
Creates a new search result entry using the provided distinguished name.- Parameters:
name
- The distinguished name of the entry.- Returns:
- The new search result entry.
-
newSearchResultEntry
Creates a new search result entry backed by the provided entry. Modifications made toentry
will be reflected in the returned search result entry. The returned search result entry supports updates to its list of controls, as well as updates to the name and attributes if the underlying entry allows.- Parameters:
entry
- The entry.- Returns:
- The new search result entry.
-
newSearchResultEntry
Creates a new search result entry using the provided distinguished name decoded using the default schema.- Parameters:
name
- The distinguished name of the entry.- Returns:
- The new search result entry.
-
newSearchResultEntry
Creates a new search result entry using the provided lines of LDIF decoded using the default schema.- Parameters:
ldifLines
- Lines of LDIF containing an LDIF add change record or an LDIF entry record.- Returns:
- The new search result entry.
-
newSearchResultReference
Creates a new search result reference using the provided continuation reference URI.- Parameters:
uri
- The first continuation reference URI to be added to this search result reference.- Returns:
- The new search result reference.
- Throws:
NullPointerException
- Ifuri
wasnull
.
-
newSearchResultReference
Creates a new search result reference using the provided continuation reference URIs.- Parameters:
uris
- The reference URIs to be added to this search result reference.- Returns:
- The new search result reference.
-
newStartTlsExtendedResult
public static StartTlsExtendedResult newStartTlsExtendedResult(ResultCode resultCode, SslOptions sslOptions) Creates a new start TLS extended result which will use the provided SSL context.- Parameters:
resultCode
- The result code.sslOptions
- TheSslOptions
which should be used to secure the connection on TLS layer.- Returns:
- The new start TLS extended request.
-
newStartTlsExtendedResult
public static StartTlsExtendedResult newStartTlsExtendedResult(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, List<Control> controls, Throwable cause, SslOptions sslOptions) Creates a new start TLS extended result which will use the provided SSL context.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
indicating that none was provided.controls
- TheList
containing the controls.cause
- The throwable cause, which may benull
indicating that none was provided.sslOptions
- TheSslOptions
which should be used to secure the connection on TLS layer.- Returns:
- The new start TLS extended request.
-
newWhoAmIExtendedResult
public static WhoAmIExtendedResult newWhoAmIExtendedResult(ResultCode resultCode, String matchedDn, CharSequence diagnosticMessage, String authorizationId) Creates a new who am I extended result with the provided result code, diagnosticMessage and matchedDn.- Parameters:
resultCode
- The result code.matchedDn
- The matched DN associated, which may be empty ornull
indicating that none was provided.diagnosticMessage
- The diagnostic message, which may be empty ornull
.authorizationId
- The authorization ID of the user, that usually has the form "dn:" immediately followed by the distinguished name of the user, or "u:" followed by a user ID string, but other forms are permitted. The authorization ID may benull
or empty if this result does not contain an authorization ID.- Returns:
- The new who am I extended result.
-