This project has retired. For details please refer to its Attic page.
QueryBase (Apache Gora 0.2 API)

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

java.lang.Object
  extended by org.apache.gora.query.impl.QueryBase<K,T>
All Implemented Interfaces:
Query<K,T>, org.apache.hadoop.conf.Configurable, org.apache.hadoop.io.Writable
Direct Known Subclasses:
AccumuloQuery, AvroQuery, CassandraQuery, HBaseQuery, MemStore.MemQuery, PartitionQueryImpl, SqlQuery

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

Base class for Query implementations.


Field Summary
protected  DataStore<K,T> dataStore
           
protected  K endKey
           
protected  long endTime
           
protected  String[] fields
           
protected  String filter
           
protected  boolean isCompiled
           
protected  long limit
           
protected  String queryString
           
protected  K startKey
           
protected  long startTime
           
 
Constructor Summary
QueryBase(DataStore<K,T> dataStore)
           
 
Method Summary
 boolean equals(Object obj)
           
 Result<K,T> execute()
          Executes the Query on the DataStore and returns the results.
 org.apache.hadoop.conf.Configuration getConf()
           
 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 readFields(DataInput in)
           
 void setConf(org.apache.hadoop.conf.Configuration conf)
           
 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()
           
 void write(DataOutput out)
           
 
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

queryString

protected String queryString

fields

protected String[] fields

startKey

protected K startKey

endKey

protected K endKey

startTime

protected long startTime

endTime

protected long endTime

filter

protected String filter

limit

protected long limit

isCompiled

protected boolean isCompiled
Constructor Detail

QueryBase

public QueryBase(DataStore<K,T> dataStore)
Method Detail

execute

public Result<K,T> execute()
                                       throws IOException
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.
Throws:
IOException

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 org.apache.hadoop.conf.Configuration getConf()
Specified by:
getConf in interface org.apache.hadoop.conf.Configurable

setConf

public void setConf(org.apache.hadoop.conf.Configuration conf)
Specified by:
setConf in interface org.apache.hadoop.conf.Configurable

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

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.