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, serverContext -
Constructor Summary
ConstructorsConstructorDescriptionSearchOperation(RequestContext context, LocalBackend<?> backend, SearchRequest request, Consumer<ResponseStream> out) Creates a new search operation. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddResponseControl(Control control) Adds the provided control to the set of controls to include in the response to the client.Retrieves the set of requested attributes for this search operation.final DnRetrieves the base DN for this search operation.final DereferenceAliasesPolicyRetrieves the alias dereferencing policy for this search operation.final intRetrieves the number of entries sent to the client for this search operation.final FilterRetrieves the filter for this search operation.final MatcherRetrieves the matcher derived from the search filter for this search operation.final intRetrieves the number of search references sent to the client for this search operation.Returns the request associated to this operation.final ResourceLimitsRetrieves the limits for this search operation.Retrieves the set of controls to include in the response to the client.final SearchScopegetScope()Retrieves the scope for this search operation.Return the Server Side Sort Control of the search request ornullif absent.Return the Simple Paged Results Control of the search request ornullif absent.final booleanRetrieves the typesOnly flag for this search operation.Return the Virtual List View Request Control of the search request ornullif absent.protected voidHandles any controls contained in the request.protected voidInvokes any applicable post-response plugins.protected booleanInvokes any applicable pre-parse plugins.booleanReturnstrueif this search operation contains the ManageDsaIT control.booleanmayReturnEntry(Entry entry) Returns if the entry may be returned according to access control and other checks.final voidremoveResponseControl(Control control) Removes the provided control from the set of controls to include in the response to the client.booleanreturnEntry(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.booleanreturnReference(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 booleanrunImpl()Performs the work of actually processing this operation.final voidsetAttributes(Set<String> attributes) Specifies the set of requested attributes for this search operation.final voidSpecifies the base DN as included in the request from the client.final voidsetDerefPolicy(DereferenceAliasesPolicy derefPolicy) Specifies the alias dereferencing policy for this search operation.final voidSpecifies the search filter as included in the request from the client.final voidsetScope(SearchScope scope) Specifies the scope for this search operation.final voidsetTypesOnly(boolean typesOnly) Specifies the typesOnly flag for this search operation.booleanReturns whether the search operation has reached its time limit.voidtoString(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, appendErrorMessage, appendMaskedErrorMessage, checkAttributeConformsToSyntax, checkIfBackendIsWritable, checkIfCanceled, createLdapException, equals, evaluateProxyAuthControls, getAdditionalLogItems, getAttachment, getAttachments, getAuthorizationDN, getAuthorizationEntry, getClientConnection, getConnectionID, getErrorMessage, getLargestEntrySize, getMatchedDN, getMessageID, getOperationID, getProxiedAuthorizationDN, getReferralURLs, getRequestContext, getRequestControl, getRequestControls, getResultCode, hashCode, hasPrivilege, hasRequestControl, isInternalOperation, isProxyAuthzControl, isSynchronizationOperation, mustCheckSchema, operationToResult, processOperationResult, removeAllDisallowedControls, run, sendResponses, sendResult, setAttachment, setErrorMessage, setMatchedDN, setReferralURLs, setResult, setResult, setResultCode, setResultCodeAndMessageNoInfoDisclosure, toString, trySetLargestEntrySizeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opends.server.types.operation.InProgressOperation
addAdditionalLogItem, appendErrorMessage, getAdditionalLogItems, getAuthorizationDN, getErrorMessage, getMatchedDN, getReferralURLs, getResultCode, setErrorMessage, setMatchedDN, setReferralURLs, setResult, setResultCodeMethods inherited from interface org.opends.server.types.operation.PluginOperation
checkIfCanceled, getAttachment, getAttachments, getClientConnection, getConnectionID, getMessageID, getOperationID, getRequestControl, getRequestControl, getRequestControls, hasPrivilege, isInternalOperation, isSynchronizationOperation, setAttachment, toStringMethods inherited from interface org.opends.server.types.operation.PostOperationOperation
addAdditionalLogItem, appendErrorMessage, getAdditionalLogItems, getAuthorizationDN, getErrorMessage, getMatchedDN, getReferralURLs, getResultCode, setErrorMessage, setMatchedDN, setReferralURLs, setResult, setResultCodeMethods inherited from interface org.opends.server.types.operation.PostResponseOperation
getAdditionalLogItems, getAuthorizationDN, getErrorMessage, getMatchedDN, getReferralURLs, getResultCodeMethods inherited from interface org.opends.server.types.operation.PreOperationOperation
addAdditionalLogItem, appendErrorMessage, getAdditionalLogItems, getAuthorizationDN, getErrorMessage, sendResponses, setErrorMessageMethods inherited from interface org.opends.server.types.operation.PreParseOperation
addAdditionalLogItem, addRequestControl, appendErrorMessage, getAdditionalLogItems, getErrorMessage, sendResponses, setErrorMessage
-
Constructor Details
-
SearchOperation
public SearchOperation(RequestContext context, LocalBackend<?> backend, SearchRequest request, Consumer<ResponseStream> out) 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.
-
-
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:
setBaseDNin interfacePreParseSearchOperation- Parameters:
baseDN- The non-null base DN as included in the request from the client.
-
getBaseDN
Description copied from interface:PreOperationSearchOperationRetrieves the base DN for this search operation.- Specified by:
getBaseDNin interfaceInProgressSearchOperation- Specified by:
getBaseDNin interfacePostOperationSearchOperation- Specified by:
getBaseDNin interfacePostResponseSearchOperation- Specified by:
getBaseDNin interfacePreOperationSearchOperation- Specified by:
getBaseDNin interfacePreParseSearchOperation- Returns:
- The base DN for this search operation.
-
getScope
Retrieves the scope for this search operation.- Specified by:
getScopein interfaceInProgressSearchOperation- Specified by:
getScopein interfacePostOperationSearchOperation- Specified by:
getScopein interfacePostResponseSearchOperation- Specified by:
getScopein interfacePreOperationSearchOperation- Specified by:
getScopein 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:
setScopein interfacePreParseSearchOperation- Parameters:
scope- The scope for this search operation.
-
getDerefPolicy
Retrieves the alias dereferencing policy for this search operation.- Specified by:
getDerefPolicyin interfaceInProgressSearchOperation- Specified by:
getDerefPolicyin interfacePostOperationSearchOperation- Specified by:
getDerefPolicyin interfacePostResponseSearchOperation- Specified by:
getDerefPolicyin interfacePreOperationSearchOperation- Specified by:
getDerefPolicyin 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:
setDerefPolicyin interfacePreParseSearchOperation- Parameters:
derefPolicy- The alias dereferencing policy for this search operation.
-
getResourceLimits
Retrieves the limits for this search operation.- Specified by:
getResourceLimitsin interfaceInProgressSearchOperation- Specified by:
getResourceLimitsin interfacePostOperationSearchOperation- Specified by:
getResourceLimitsin interfacePostResponseSearchOperation- Specified by:
getResourceLimitsin interfacePreOperationSearchOperation- Specified by:
getResourceLimitsin interfacePreParseSearchOperation- Returns:
- The resource limits
-
getTypesOnly
public final boolean getTypesOnly()Retrieves the typesOnly flag for this search operation.- Specified by:
getTypesOnlyin interfaceInProgressSearchOperation- Specified by:
getTypesOnlyin interfacePostOperationSearchOperation- Specified by:
getTypesOnlyin interfacePostResponseSearchOperation- Specified by:
getTypesOnlyin interfacePreOperationSearchOperation- Specified by:
getTypesOnlyin 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:
setTypesOnlyin 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:
setFilterin 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:
getFilterin interfaceInProgressSearchOperation- Specified by:
getFilterin interfacePostOperationSearchOperation- Specified by:
getFilterin interfacePostResponseSearchOperation- Specified by:
getFilterin interfacePreOperationSearchOperation- Specified by:
getFilterin 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:
getAttributesin interfaceInProgressSearchOperation- Specified by:
getAttributesin interfacePostOperationSearchOperation- Specified by:
getAttributesin interfacePostResponseSearchOperation- Specified by:
getAttributesin interfacePreOperationSearchOperation- Specified by:
getAttributesin 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:
setAttributesin 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:
getEntriesSentin interfacePostOperationSearchOperation- Specified by:
getEntriesSentin 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:
getReferencesSentin interfacePostOperationSearchOperation- Specified by:
getReferencesSentin 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:
returnEntryin interfacePreOperationSearchOperation- Specified by:
returnEntryin interfacePreParseSearchOperation- Parameters:
entry- The entry that matches the search criteria and should be sent to the client.controls- The set of controls to include with the entry (may benullif none are needed).- Returns:
trueif the caller should continue processing the search request and sending additional entries and references, orfalseif not for some reason (e.g., the size limit has been reached or the search has been abandoned).
-
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
-
timeLimitExpired
public boolean timeLimitExpired()Returns whether the search operation has reached its time limit.- Returns:
- whether the search operation has reached its time limit
-
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:
returnReferencein interfacePreOperationSearchOperation- Specified by:
returnReferencein interfacePreParseSearchOperation- Parameters:
reference- The search reference to send to the client.dn- The DN related to the specified search reference.- Returns:
trueif the caller should continue processing the search request and sending additional entries and references , orfalseif not for some reason (e.g., the size limit has been reached or the search has been abandoned).
-
getRequest
Description copied from class:OperationReturns the request associated to this operation.- Specified by:
getRequestin interfacePluginOperation- Overrides:
getRequestin classOperation- Returns:
- The request associated to this operation.
-
getResponseControls
Description copied from interface:PluginOperationRetrieves the set of controls to include in the response to the client. The contents of this list must not be altered.- Specified by:
getResponseControlsin interfacePluginOperation- Returns:
- The set of controls to include in the response to the client.
-
addResponseControl
Description copied from class:OperationAdds the provided control to the set of controls to include in the response to the client.This method may not be called by post-response plugins.
- Specified by:
addResponseControlin interfaceInProgressOperation- Specified by:
addResponseControlin interfacePostOperationOperation- Specified by:
addResponseControlin interfacePreOperationOperation- Specified by:
addResponseControlin interfacePreParseOperation- Specified by:
addResponseControlin classOperation- Parameters:
control- The control to add to the set of controls to include in the response to the client.
-
removeResponseControl
Description copied from class:OperationRemoves the provided control from the set of controls to include in the response to the client.This method may not be called by post-response plugins.
- Specified by:
removeResponseControlin interfaceInProgressOperation- Specified by:
removeResponseControlin interfacePostOperationOperation- Specified by:
removeResponseControlin interfacePreOperationOperation- Specified by:
removeResponseControlin interfacePreParseOperation- Specified by:
removeResponseControlin classOperation- Parameters:
control- The control to remove from the set of controls to include in the response to the client.
-
toString
Description copied from interface:PluginOperationAppends a string representation of this operation to the provided buffer.- Specified by:
toStringin interfacePluginOperation- Specified by:
toStringin 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 ornullif absent.- Returns:
- the Simple Paged Results Control of the search request or
nullif absent
-
getServerSideSortControlOrNull
Return the Server Side Sort Control of the search request ornullif absent.- Returns:
- the Server Side Sort Control of the search request or
nullif absent
-
getVirtualListViewRequestControlOrNull
Return the Virtual List View Request Control of the search request ornullif absent.- Returns:
- the Virtual List View Request Control of the search request or
nullif absent
-
isManageDsaIt
public boolean isManageDsaIt()Returnstrueif this search operation contains the ManageDsaIT control.- Returns:
trueif this search operation contains the ManageDsaIT control.
-
runImpl
Description copied from class:OperationPerforms the work of actually processing this operation.- Specified by:
runImplin classOperation- Returns:
trueif the result should be sent immediately, orfalseif it will be sent later, e.g. as part of a persistent search.- Throws:
LdapException- If an error occurred when processing the operation.
-
invokePreParsePlugins
Description copied from class:OperationInvokes any applicable pre-parse plugins.- Specified by:
invokePreParsePluginsin classOperation- Returns:
trueif processing should continue.- Throws:
LdapException- If an error occurred when invoking the pre-parse plugins.
-
invokePostResponsePlugins
protected void invokePostResponsePlugins()Description copied from class:OperationInvokes any applicable post-response plugins.- Specified by:
invokePostResponsePluginsin classOperation
-
handleRequestControls
Handles any controls contained in the request.- Throws:
LdapException- If there is a problem with any of the request controls.
-