Class QueryResponseImpl

java.lang.Object
ddf.catalog.operation.impl.OperationImpl
ddf.catalog.operation.impl.ResponseImpl<ddf.catalog.operation.QueryRequest>
ddf.catalog.operation.impl.QueryResponseImpl
All Implemented Interfaces:
ddf.catalog.operation.Operation, ddf.catalog.operation.QueryResponse, ddf.catalog.operation.Response<ddf.catalog.operation.QueryRequest>, ddf.catalog.operation.SourceResponse, Serializable

public class QueryResponseImpl extends ResponseImpl<ddf.catalog.operation.QueryRequest> implements ddf.catalog.operation.QueryResponse
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected AtomicLong
     
    protected AtomicBoolean
     
    protected static final ddf.catalog.data.Result
     

    Fields inherited from class ddf.catalog.operation.impl.ResponseImpl

    request

    Fields inherited from interface ddf.catalog.operation.QueryResponse

    ELAPSED_TIME, SITE_LIST, TOTAL_HITS, TOTAL_RESULTS_RETURNED
  • Constructor Summary

    Constructors
    Constructor
    Description
    QueryResponseImpl(ddf.catalog.operation.QueryRequest request)
    Instantiates a new QueryResponseImpl with a $(@link QueryRequest)
    QueryResponseImpl(ddf.catalog.operation.QueryRequest request, List<ddf.catalog.data.Result> results, boolean closeResultQueue, long hits)
    Instantiates a new QueryResponseImpl with a $(@link QueryRequest), a $List of results, a closeResultQueue indicator, and a number of hits to return
    QueryResponseImpl(ddf.catalog.operation.QueryRequest request, List<ddf.catalog.data.Result> results, boolean closeResultQueue, long hits, Map<String,Serializable> properties)
    Instantiates a new QueryResponseImpl with a $(@link QueryRequest), a $List of results, a closeResultQueue indicator, a number of hits to return, and a $Map of properties
    QueryResponseImpl(ddf.catalog.operation.QueryRequest request, List<ddf.catalog.data.Result> results, boolean shouldCloseResultQueue, long hits, Map<String,Serializable> properties, Set<ddf.catalog.operation.ProcessingDetails> processingDetails)
    Instantiates a new QueryResponseImpl with: a QueryRequest, a List of Results, the indicator of whether to close the queue, the number of Results, properties, and a Set of ProcessingDetails
    QueryResponseImpl(ddf.catalog.operation.QueryRequest request, List<ddf.catalog.data.Result> results, long totalHits)
    Instantiates a new QueryResponseImpl with a $(@link QueryRequest) and and a $List of results
    QueryResponseImpl(ddf.catalog.operation.QueryRequest request, Map<String,Serializable> properties)
    Instantiates a new QueryResponseImpl with a $(@link QueryRequest) and and a $Map of properties
    QueryResponseImpl(ddf.catalog.operation.SourceResponse response, String sourceId)
    Construct from an underlying SourceResponse
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addResult(ddf.catalog.data.Result result, boolean closeQueue)
    Adds a $Result to this QueryResponse, and specifies whether or not to close the queue
    void
    addResults(List<ddf.catalog.data.Result> results, boolean closeQueue)
    Adds a $List of $Results to this QueryResponse, and specifies whether or not to close the queue
    void
     
    long
     
    Set<ddf.catalog.operation.ProcessingDetails>
     
    List<ddf.catalog.data.Result>
     
    boolean
     
    ddf.catalog.data.Result
     
    ddf.catalog.data.Result
    poll(long timeout)
     
    void
    setHits(long hits)
     
    void
    setProcessingDetails(Set<ddf.catalog.operation.ProcessingDetails> details)
     
    ddf.catalog.data.Result
     
    List<ddf.catalog.data.Result>
    take(long size)
     

    Methods inherited from class ddf.catalog.operation.impl.ResponseImpl

    getRequest

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface ddf.catalog.operation.Operation

    containsPropertyName, getProperties, getPropertyNames, getPropertyValue, hasProperties

    Methods inherited from interface ddf.catalog.operation.Response

    getProcessingErrors, getRequest
  • Field Details

    • POISON_PILL_RESULT

      protected static final ddf.catalog.data.Result POISON_PILL_RESULT
    • hits

      protected AtomicLong hits
    • isQueueClosed

      protected AtomicBoolean isQueueClosed
  • Constructor Details

    • QueryResponseImpl

      public QueryResponseImpl(ddf.catalog.operation.QueryRequest request)
      Instantiates a new QueryResponseImpl with a $(@link QueryRequest)
      Parameters:
      request - the request
    • QueryResponseImpl

      public QueryResponseImpl(ddf.catalog.operation.QueryRequest request, Map<String,Serializable> properties)
      Instantiates a new QueryResponseImpl with a $(@link QueryRequest) and and a $Map of properties
      Parameters:
      request - the request
      properties -
    • QueryResponseImpl

      public QueryResponseImpl(ddf.catalog.operation.QueryRequest request, List<ddf.catalog.data.Result> results, long totalHits)
      Instantiates a new QueryResponseImpl with a $(@link QueryRequest) and and a $List of results
      Parameters:
      request - the request
      results - the results
    • QueryResponseImpl

      public QueryResponseImpl(ddf.catalog.operation.QueryRequest request, List<ddf.catalog.data.Result> results, boolean closeResultQueue, long hits)
      Instantiates a new QueryResponseImpl with a $(@link QueryRequest), a $List of results, a closeResultQueue indicator, and a number of hits to return
      Parameters:
      request - the request
      results - the results
      hits - the hits
    • QueryResponseImpl

      public QueryResponseImpl(ddf.catalog.operation.QueryRequest request, List<ddf.catalog.data.Result> results, boolean closeResultQueue, long hits, Map<String,Serializable> properties)
      Instantiates a new QueryResponseImpl with a $(@link QueryRequest), a $List of results, a closeResultQueue indicator, a number of hits to return, and a $Map of properties
      Parameters:
      request - the request
      results - the results
      hits - the hits
      properties - the properties
    • QueryResponseImpl

      public QueryResponseImpl(ddf.catalog.operation.QueryRequest request, List<ddf.catalog.data.Result> results, boolean shouldCloseResultQueue, long hits, Map<String,Serializable> properties, Set<ddf.catalog.operation.ProcessingDetails> processingDetails)
      Instantiates a new QueryResponseImpl with: a QueryRequest, a List of Results, the indicator of whether to close the queue, the number of Results, properties, and a Set of ProcessingDetails
      Parameters:
      request - the QueryRequest used to elicit this QueryResponseImpl
      results - the List of Results which the execution of the request has returned
      shouldCloseResultQueue - the indicator of whether to close this QueryResponseImpl's queue of Results or to leave the queue open so that it may continue to add Results as they become available
      hits - the number of distinct Results in the list of results
      properties - the Map from each key of this QueryResponseImpl's properties to its value
      processingDetails - the Set of ProcessingDetails which the execution of the request generated
    • QueryResponseImpl

      public QueryResponseImpl(ddf.catalog.operation.SourceResponse response, String sourceId)
      Construct from an underlying SourceResponse
      Parameters:
      response -
      sourceId -
  • Method Details

    • getHits

      public long getHits()
      Specified by:
      getHits in interface ddf.catalog.operation.SourceResponse
    • setHits

      public void setHits(long hits)
    • getProcessingDetails

      public Set<ddf.catalog.operation.ProcessingDetails> getProcessingDetails()
      Specified by:
      getProcessingDetails in interface ddf.catalog.operation.QueryResponse
      Specified by:
      getProcessingDetails in interface ddf.catalog.operation.SourceResponse
    • setProcessingDetails

      public void setProcessingDetails(Set<ddf.catalog.operation.ProcessingDetails> details)
    • getResults

      public List<ddf.catalog.data.Result> getResults()
      Specified by:
      getResults in interface ddf.catalog.operation.SourceResponse
    • addResult

      public void addResult(ddf.catalog.data.Result result, boolean closeQueue)
      Adds a $Result to this QueryResponse, and specifies whether or not to close the queue
      Parameters:
      result - the result
      closeQueue - the indicator for closing of the queue
    • addResults

      public void addResults(List<ddf.catalog.data.Result> results, boolean closeQueue)
      Adds a $List of $Results to this QueryResponse, and specifies whether or not to close the queue
      Parameters:
      results - the results
      closeQueue - the indicator for closing of the queue
    • hasMoreResults

      public boolean hasMoreResults()
      Specified by:
      hasMoreResults in interface ddf.catalog.operation.QueryResponse
    • closeResultQueue

      public void closeResultQueue()
    • poll

      public ddf.catalog.data.Result poll()
      Specified by:
      poll in interface ddf.catalog.operation.QueryResponse
    • poll

      public ddf.catalog.data.Result poll(long timeout)
      Specified by:
      poll in interface ddf.catalog.operation.QueryResponse
    • take

      public ddf.catalog.data.Result take()
      Specified by:
      take in interface ddf.catalog.operation.QueryResponse
    • take

      public List<ddf.catalog.data.Result> take(long size)
      Specified by:
      take in interface ddf.catalog.operation.QueryResponse