org.apache.gora.query.ws.impl
Class QueryWSBase<K,T extends Persistent>

java.lang.Object
  extended by org.apache.gora.query.ws.impl.QueryWSBase<K,T>
All Implemented Interfaces:
Query<K,T>
Direct Known Subclasses:
DynamoDBQuery, PartitionWSQueryImpl

public abstract class QueryWSBase<K,T extends Persistent>
extends Object
implements Query<K,T>

Base class for Query implementations.


Field Summary
protected  DataStore<K,T> dataStore
          Data store used for this query
protected  K endKey
           
protected  long endTime
           
protected  String[] fields
          Fields to be retrieved
protected  String filter
          Query filter
protected  boolean isCompiled
          Flag to determine whether a query is compiled or not
protected  long limit
          Max number of results to be retrieved
protected  String queryString
          Query represented in a string
protected  K startKey
          Range key parameters
protected  long startTime
          Query time parameters
 
Constructor Summary
QueryWSBase(DataStore<K,T> dataStore)
          Constructor
 
Method Summary
 boolean equals(Object obj)
           
 Result<K,T> execute()
          Executes the Query on the DataStore and returns the results.
 Object getConf()
          Gets the configuration object
 DataStore<K,T> getDataStore()
          Returns the DataStore, that this Query is associated with.
 K getEndKey()
           
 long getEndTime()
           
 String[] getFields()
           
 K getKey()
           
 long getLimit()
          Returns the maximum number of results
 K getStartKey()
           
 long getStartTime()
           
 long getTimestamp()
           
 int hashCode()
           
 void setConf(Object auth)
          Sets the configuration object
 void setDataStore(DataStore<K,T> dataStore)
          Sets the dataStore of this query.
 void setEndKey(K endKey)
           
 void setEndTime(long endTime)
           
 void setFields(String... fields)
           
 void setKey(K key)
           
 void setKeyRange(K startKey, K endKey)
          Set the range of keys over which the query will execute.
 void setLimit(long limit)
          Sets the maximum number of results to return.
 void setStartKey(K startKey)
           
 void setStartTime(long startTime)
           
 void setTimeRange(long startTime, long endTime)
           
 void setTimestamp(long timestamp)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

dataStore

protected DataStore<K,T extends Persistent> dataStore
Data store used for this query


queryString

protected String queryString
Query represented in a string


fields

protected String[] fields
Fields to be retrieved


startKey

protected K startKey
Range key parameters


endKey

protected K endKey

startTime

protected long startTime
Query time parameters


endTime

protected long endTime

filter

protected String filter
Query filter


limit

protected long limit
Max number of results to be retrieved


isCompiled

protected boolean isCompiled
Flag to determine whether a query is compiled or not

Constructor Detail

QueryWSBase

public QueryWSBase(DataStore<K,T> dataStore)
Constructor

Parameters:
dataStore -
Method Detail

execute

public Result<K,T> execute()
Description copied from interface: Query
Executes the Query on the DataStore and returns the results.

Specified by:
execute in interface Query<K,T extends Persistent>
Returns:
the Result for the query.

setDataStore

public void setDataStore(DataStore<K,T> dataStore)
Description copied from interface: Query
Sets the dataStore of this query. Under normal operation, this call is not necessary and it is potentially dangerous. So use this method only if you know what you are doing.

Specified by:
setDataStore in interface Query<K,T extends Persistent>
Parameters:
dataStore - the dataStore of the query

getDataStore

public DataStore<K,T> getDataStore()
Description copied from interface: Query
Returns the DataStore, that this Query is associated with.

Specified by:
getDataStore in interface Query<K,T extends Persistent>
Returns:
the DataStore of the Query

setFields

public void setFields(String... fields)
Specified by:
setFields in interface Query<K,T extends Persistent>

getFields

public String[] getFields()
Specified by:
getFields in interface Query<K,T extends Persistent>

setKey

public void setKey(K key)
Specified by:
setKey in interface Query<K,T extends Persistent>

setStartKey

public void setStartKey(K startKey)
Specified by:
setStartKey in interface Query<K,T extends Persistent>
Parameters:
startKey - an inclusive start key

setEndKey

public void setEndKey(K endKey)
Specified by:
setEndKey in interface Query<K,T extends Persistent>
Parameters:
endKey - an inclusive end key

setKeyRange

public void setKeyRange(K startKey,
                        K endKey)
Description copied from interface: Query
Set the range of keys over which the query will execute.

Specified by:
setKeyRange in interface Query<K,T extends Persistent>
Parameters:
startKey - an inclusive start key
endKey - an inclusive end key

getKey

public K getKey()
Specified by:
getKey in interface Query<K,T extends Persistent>

getStartKey

public K getStartKey()
Specified by:
getStartKey in interface Query<K,T extends Persistent>

getEndKey

public K getEndKey()
Specified by:
getEndKey in interface Query<K,T extends Persistent>

setTimestamp

public void setTimestamp(long timestamp)
Specified by:
setTimestamp in interface Query<K,T extends Persistent>

setStartTime

public void setStartTime(long startTime)
Specified by:
setStartTime in interface Query<K,T extends Persistent>

setEndTime

public void setEndTime(long endTime)
Specified by:
setEndTime in interface Query<K,T extends Persistent>

setTimeRange

public void setTimeRange(long startTime,
                         long endTime)
Specified by:
setTimeRange in interface Query<K,T extends Persistent>

getTimestamp

public long getTimestamp()
Specified by:
getTimestamp in interface Query<K,T extends Persistent>

getStartTime

public long getStartTime()
Specified by:
getStartTime in interface Query<K,T extends Persistent>

getEndTime

public long getEndTime()
Specified by:
getEndTime in interface Query<K,T extends Persistent>

setLimit

public void setLimit(long limit)
Description copied from interface: Query
Sets the maximum number of results to return.

Specified by:
setLimit in interface Query<K,T extends Persistent>

getLimit

public long getLimit()
Description copied from interface: Query
Returns the maximum number of results

Specified by:
getLimit in interface Query<K,T extends Persistent>
Returns:
the limit if it is set, otherwise a negative number

getConf

public Object getConf()
Gets the configuration object

Returns:

setConf

public void setConf(Object auth)
Sets the configuration object

Parameters:
auth -

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.