Package org.opends.server.core
Class SearchOperation
java.lang.Object
org.opends.server.types.Operation
org.opends.server.core.SearchOperation
- All Implemented Interfaces:
InProgressOperation
,InProgressSearchOperation
,PluginOperation
,PostCommitOperation
,PostOperationOperation
,PostOperationSearchOperation
,PostResponseOperation
,PostResponseSearchOperation
,PreOperationOperation
,PreOperationSearchOperation
,PreParseOperation
,PreParseSearchOperation
public class SearchOperation
extends Operation
implements PreOperationSearchOperation, PreParseSearchOperation, PostOperationSearchOperation, PostResponseSearchOperation, InProgressSearchOperation
This class defines an operation used to search for entries in the Directory Server.
-
Field Summary
Fields inherited from class org.opends.server.types.Operation
backend, context, out, pluginConfigManager, request, result, serverContext
-
Constructor Summary
ConstructorsConstructorDescriptionSearchOperation
(RequestContext context, LocalBackend<?> backend, SearchRequest request, Consumer<Response> out, ServerContext serverContext) Creates a new search operation. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the set of requested attributes for this search operation.final Dn
Retrieves the base DN for this search operation.final DereferenceAliasesPolicy
Retrieves the alias dereferencing policy for this search operation.final int
Retrieves the number of entries sent to the client for this search operation.final Filter
Retrieves the filter for this search operation.final Matcher
Retrieves the matcher derived from the search filter for this search operation.final int
Retrieves the number of search references sent to the client for this search operation.Returns the request associated to this operation.final ResourceLimits
Retrieves the limits for this search operation.final SearchScope
getScope()
Retrieves the scope for this search operation.Return the Server Side Sort Control of the search request ornull
if absent.Return the Simple Paged Results Control of the search request ornull
if absent.final boolean
Retrieves the typesOnly flag for this search operation.Return the Virtual List View Request Control of the search request ornull
if absent.protected void
Handles any controls contained in the request.protected void
Invokes any applicable post-response plugins.protected void
Invokes any applicable pre-parse plugins.boolean
Returnstrue
if this search operation contains the ManageDsaIT control.boolean
mayReturnEntry
(Entry entry) Returns if the entry may be returned according to access control and other checks.void
Returns whether the search operation has reached its time limit.void
returnEntry
(Entry entry, List<Control> controls) Used as a callback for backends to indicate that the provided entry matches the search criteria and that additional processing should be performed to potentially send it back to the client.void
returnReference
(Dn dn, SearchResultReference reference) Used as a callback for backends to indicate that the provided search reference was encountered during processing and that additional processing should be performed to potentially send it back to the client.protected Result
runImpl()
Performs the work of actually processing this operation.final void
setAttributes
(Set<String> attributes) Specifies the set of requested attributes for this search operation.final void
Specifies the base DN as included in the request from the client.final void
setDerefPolicy
(DereferenceAliasesPolicy derefPolicy) Specifies the alias dereferencing policy for this search operation.final void
Specifies the search filter as included in the request from the client.final void
setScope
(SearchScope scope) Specifies the scope for this search operation.final void
setTypesOnly
(boolean typesOnly) Specifies the typesOnly flag for this search operation.void
toString
(StringBuilder buffer) Appends a string representation of this operation to the provided buffer.Methods inherited from class org.opends.server.types.Operation
addAdditionalLogItem, addPasswordPolicyWarningToLog, addPostReadResponse, addPreReadResponse, addRequestControl, addResponseControl, checkAttributeConformsToSyntax, checkIfBackendIsWritable, checkIfCanceled, createLdapException, equals, evaluateProxyAuthControls, filterNonDisclosableMatchedDn, getAccessControlHandler, getAdditionalLogItems, getAttachment, getAttachments, getAuthorizationDN, getAuthorizationEntry, getClientConnection, getConnectionID, getMessageID, getOperationID, getProxiedAuthorizationDN, getRequestContext, getRequestControl, getRequestControls, getResponseControls, getResult, getResultCode, hashCode, hasPrivilege, hasRequestControl, isInternalOperation, isProxyAuthzControl, isSynchronizationOperation, mustCheckSchema, operationToResult, removeAllDisallowedControls, removeResponseControl, run, sendIntermediateResponse, sendResult, setAttachment, setResult, setResult, toString, trySetLargestEntrySize
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opends.server.types.operation.InProgressOperation
addAdditionalLogItem, addResponseControl, getAdditionalLogItems, getAuthorizationDN, getResultCode, removeResponseControl, setResult
Methods inherited from interface org.opends.server.types.operation.PluginOperation
checkIfCanceled, getAttachment, getAttachments, getClientConnection, getConnectionID, getMessageID, getOperationID, getRequestControl, getRequestControl, getRequestControls, getResponseControls, hasPrivilege, isInternalOperation, isSynchronizationOperation, setAttachment, toString
Methods inherited from interface org.opends.server.types.operation.PostOperationOperation
addAdditionalLogItem, addResponseControl, getAdditionalLogItems, getAuthorizationDN, getResultCode, removeResponseControl, setResult, setResult
Methods inherited from interface org.opends.server.types.operation.PostResponseOperation
getAdditionalLogItems, getAuthorizationDN, getResultCode
Methods inherited from interface org.opends.server.types.operation.PreOperationOperation
addAdditionalLogItem, addResponseControl, getAdditionalLogItems, getAuthorizationDN, removeResponseControl, sendIntermediateResponse
Methods inherited from interface org.opends.server.types.operation.PreParseOperation
addAdditionalLogItem, addRequestControl, addResponseControl, getAdditionalLogItems, removeResponseControl, sendIntermediateResponse
-
Constructor Details
-
SearchOperation
public SearchOperation(RequestContext context, LocalBackend<?> backend, SearchRequest request, Consumer<Response> out, ServerContext serverContext) Creates a new search operation.- Parameters:
context
- The context.backend
- The local backend in which this request is to be processed.request
- The request.out
- A consumer responsible for sending responses to the client.serverContext
- the server context
-
-
Method Details
-
setBaseDN
Specifies the base DN as included in the request from the client.This method should only be called by pre-parse plugins or for internal use.
- Specified by:
setBaseDN
in interfacePreParseSearchOperation
- Parameters:
baseDN
- The non-null base DN as included in the request from the client.
-
getBaseDN
Description copied from interface:PreOperationSearchOperation
Retrieves the base DN for this search operation.- Specified by:
getBaseDN
in interfaceInProgressSearchOperation
- Specified by:
getBaseDN
in interfacePostOperationSearchOperation
- Specified by:
getBaseDN
in interfacePostResponseSearchOperation
- Specified by:
getBaseDN
in interfacePreOperationSearchOperation
- Specified by:
getBaseDN
in interfacePreParseSearchOperation
- Returns:
- The base DN for this search operation.
-
getScope
Retrieves the scope for this search operation.- Specified by:
getScope
in interfaceInProgressSearchOperation
- Specified by:
getScope
in interfacePostOperationSearchOperation
- Specified by:
getScope
in interfacePostResponseSearchOperation
- Specified by:
getScope
in interfacePreOperationSearchOperation
- Specified by:
getScope
in interfacePreParseSearchOperation
- Returns:
- The scope for this search operation.
-
setScope
Specifies the scope for this search operation. This should only be called by pre-parse plugins.- Specified by:
setScope
in interfacePreParseSearchOperation
- Parameters:
scope
- The scope for this search operation.
-
getDerefPolicy
Retrieves the alias dereferencing policy for this search operation.- Specified by:
getDerefPolicy
in interfaceInProgressSearchOperation
- Specified by:
getDerefPolicy
in interfacePostOperationSearchOperation
- Specified by:
getDerefPolicy
in interfacePostResponseSearchOperation
- Specified by:
getDerefPolicy
in interfacePreOperationSearchOperation
- Specified by:
getDerefPolicy
in interfacePreParseSearchOperation
- Returns:
- The alias dereferencing policy for this search operation.
-
setDerefPolicy
Specifies the alias dereferencing policy for this search operation. This should only be called by pre-parse plugins.- Specified by:
setDerefPolicy
in interfacePreParseSearchOperation
- Parameters:
derefPolicy
- The alias dereferencing policy for this search operation.
-
getResourceLimits
Retrieves the limits for this search operation.- Specified by:
getResourceLimits
in interfaceInProgressSearchOperation
- Specified by:
getResourceLimits
in interfacePostOperationSearchOperation
- Specified by:
getResourceLimits
in interfacePostResponseSearchOperation
- Specified by:
getResourceLimits
in interfacePreOperationSearchOperation
- Specified by:
getResourceLimits
in interfacePreParseSearchOperation
- Returns:
- The resource limits
-
getTypesOnly
public final boolean getTypesOnly()Retrieves the typesOnly flag for this search operation.- Specified by:
getTypesOnly
in interfaceInProgressSearchOperation
- Specified by:
getTypesOnly
in interfacePostOperationSearchOperation
- Specified by:
getTypesOnly
in interfacePostResponseSearchOperation
- Specified by:
getTypesOnly
in interfacePreOperationSearchOperation
- Specified by:
getTypesOnly
in interfacePreParseSearchOperation
- Returns:
- The typesOnly flag for this search operation.
-
setTypesOnly
public final void setTypesOnly(boolean typesOnly) Specifies the typesOnly flag for this search operation. This should only be called by pre-parse plugins.- Specified by:
setTypesOnly
in interfacePreParseSearchOperation
- Parameters:
typesOnly
- The typesOnly flag for this search operation.
-
setFilter
Specifies the search filter as included in the request from the client.This method should only be called by pre-parse plugins.
- Specified by:
setFilter
in interfacePreParseSearchOperation
- Parameters:
filter
- The non-null search filter as included in the request from the client.
-
getFilter
Retrieves the filter for this search operation.Only use this method for logging. Prefer to use
getMatcher()
for matching entries.- Specified by:
getFilter
in interfaceInProgressSearchOperation
- Specified by:
getFilter
in interfacePostOperationSearchOperation
- Specified by:
getFilter
in interfacePostResponseSearchOperation
- Specified by:
getFilter
in interfacePreOperationSearchOperation
- Specified by:
getFilter
in interfacePreParseSearchOperation
- Returns:
- The filter for this search operation.
-
getMatcher
Retrieves the matcher derived from the search filter for this search operation.- Returns:
- the matcher for this search operation.
-
getAttributes
Retrieves the set of requested attributes for this search operation. Its contents should not be altered.- Specified by:
getAttributes
in interfaceInProgressSearchOperation
- Specified by:
getAttributes
in interfacePostOperationSearchOperation
- Specified by:
getAttributes
in interfacePostResponseSearchOperation
- Specified by:
getAttributes
in interfacePreOperationSearchOperation
- Specified by:
getAttributes
in interfacePreParseSearchOperation
- Returns:
- The set of requested attributes for this search operation.
-
setAttributes
Specifies the set of requested attributes for this search operation. It should only be called by pre-parse plugins.- Specified by:
setAttributes
in interfacePreParseSearchOperation
- Parameters:
attributes
- The set of requested attributes for this search operation.
-
getEntriesSent
public final int getEntriesSent()Retrieves the number of entries sent to the client for this search operation.- Specified by:
getEntriesSent
in interfacePostOperationSearchOperation
- Specified by:
getEntriesSent
in interfacePostResponseSearchOperation
- Returns:
- The number of entries sent to the client for this search operation.
-
getReferencesSent
public final int getReferencesSent()Retrieves the number of search references sent to the client for this search operation.- Specified by:
getReferencesSent
in interfacePostOperationSearchOperation
- Specified by:
getReferencesSent
in interfacePostResponseSearchOperation
- Returns:
- The number of search references sent to the client for this search operation.
-
returnEntry
Used as a callback for backends to indicate that the provided entry matches the search criteria and that additional processing should be performed to potentially send it back to the client.- Specified by:
returnEntry
in interfacePreOperationSearchOperation
- Specified by:
returnEntry
in interfacePreParseSearchOperation
- Parameters:
entry
- The entry that should be returned.controls
- The set of controls to include with the entry (may benull
if no controls should be included with the entry).- Throws:
LdapException
- If an unexpected problem occurs while returning the entry.
-
mayReturnEntry
Returns if the entry may be returned according to access control and other checks.- Parameters:
entry
- the candidate entry to return- Returns:
- if the entry may be returned according to access control and other checks
-
rejectIfTimeLimitExpired
Returns whether the search operation has reached its time limit.- Throws:
LdapException
-
returnReference
Used as a callback for backends to indicate that the provided search reference was encountered during processing and that additional processing should be performed to potentially send it back to the client.- Specified by:
returnReference
in interfacePreOperationSearchOperation
- Specified by:
returnReference
in interfacePreParseSearchOperation
- Parameters:
reference
- The search reference to send to the client.dn
- The DN related to the specified search reference.- Throws:
LdapException
- If an unexpected problem occurs while returning the reference.
-
getRequest
Description copied from class:Operation
Returns the request associated to this operation.- Specified by:
getRequest
in interfacePluginOperation
- Overrides:
getRequest
in classOperation
- Returns:
- The request associated to this operation.
-
toString
Description copied from interface:PluginOperation
Appends a string representation of this operation to the provided buffer.- Specified by:
toString
in interfacePluginOperation
- Specified by:
toString
in classOperation
- Parameters:
buffer
- The buffer into which a string representation of this operation should be appended.
-
getSimplePagedResultsControlOrNull
Return the Simple Paged Results Control of the search request ornull
if absent.- Returns:
- the Simple Paged Results Control of the search request or
null
if absent
-
getServerSideSortControlOrNull
Return the Server Side Sort Control of the search request ornull
if absent.- Returns:
- the Server Side Sort Control of the search request or
null
if absent
-
getVirtualListViewRequestControlOrNull
Return the Virtual List View Request Control of the search request ornull
if absent.- Returns:
- the Virtual List View Request Control of the search request or
null
if absent
-
isManageDsaIt
public boolean isManageDsaIt()Returnstrue
if this search operation contains the ManageDsaIT control.- Returns:
true
if this search operation contains the ManageDsaIT control.
-
runImpl
Description copied from class:Operation
Performs the work of actually processing this operation.- Specified by:
runImpl
in classOperation
- Returns:
null
if the result is delayed (e.g. persistent search),Result
otherwise.- Throws:
LdapException
- If an error occurred when processing the operation.
-
invokePreParsePlugins
Description copied from class:Operation
Invokes any applicable pre-parse plugins.- Specified by:
invokePreParsePlugins
in classOperation
- Throws:
LdapException
- If an error occurred when invoking the pre-parse plugins.
-
invokePostResponsePlugins
protected void invokePostResponsePlugins()Description copied from class:Operation
Invokes any applicable post-response plugins.- Specified by:
invokePostResponsePlugins
in classOperation
-
handleRequestControls
Handles any controls contained in the request.- Throws:
LdapException
- If there is a problem with any of the request controls.
-