org.cruxframework.crux.core.client.db
Class WSQLIndex<K,I,V>

java.lang.Object
  extended by org.cruxframework.crux.core.client.db.DBObject
      extended by org.cruxframework.crux.core.client.db.Index<K,I,V>
          extended by org.cruxframework.crux.core.client.db.WSQLIndex<K,I,V>
Type Parameters:
K - object key type
I - index key type. The type of the indexed column
V - object type

public abstract class WSQLIndex<K,I,V>
extends Index<K,I,V>

Represents an index into this database.

Author:
Thiago da Rosa de Bustamante

Field Summary
protected  WSQLAbstractDatabase db
           
protected  WSQLTransaction transaction
           
 
Fields inherited from class org.cruxframework.crux.core.client.db.DBObject
logger
 
Constructor Summary
protected WSQLIndex(WSQLAbstractDatabase db, WSQLTransaction transaction)
           
 
Method Summary
 void count(DatabaseCountCallback callback)
          Return the number of items referenced by the index.
 void count(KeyRange<I> range, DatabaseCountCallback callback)
          Return the number of items referenced by the index in the given range.
 void get(I key, DatabaseRetrieveCallback<V> callback)
          Retrieve the object associated with the given key from the index.
 void get(KeyRange<I> keyRange, DatabaseRetrieveCallback<V> callback)
          Retrieve the object in the given keyRange from the index.
 void getKey(I key, DatabaseRetrieveCallback<K> callback)
          Retrieve the object key associated with the given key from the index.
 void getKey(KeyRange<I> keyRange, DatabaseRetrieveCallback<K> callback)
          Retrieve the object key in the given keyRange from the index.
abstract  KeyRangeFactory<I> getKeyRangeFactory()
          Retrieve a factory to create KeyRange objects used by this index.
 void openCursor(DatabaseCursorCallback<I,V> callback)
          Open a cursor to iterate over the object store.
abstract  void openCursor(KeyRange<I> keyRange, Cursor.CursorDirection direction, DatabaseCursorCallback<I,V> callback)
          Open a cursor to iterate over the object store.
 void openCursor(KeyRange<I> keyRange, DatabaseCursorCallback<I,V> callback)
          Open a cursor to iterate over the object store.
 void openKeyCursor(DatabaseCursorCallback<I,K> callback)
          Open a cursor to iterate over the object store.
abstract  void openKeyCursor(KeyRange<I> keyRange, Cursor.CursorDirection direction, DatabaseCursorCallback<I,K> callback)
          Open a cursor to iterate over the object store.
 void openKeyCursor(KeyRange<I> keyRange, DatabaseCursorCallback<I,K> callback)
          Open a cursor to iterate over the object store.
 
Methods inherited from class org.cruxframework.crux.core.client.db.Index
getName, isMultiEntry, isUnique
 
Methods inherited from class org.cruxframework.crux.core.client.db.DBObject
reportError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

db

protected final WSQLAbstractDatabase db

transaction

protected final WSQLTransaction transaction
Constructor Detail

WSQLIndex

protected WSQLIndex(WSQLAbstractDatabase db,
                    WSQLTransaction transaction)
Method Detail

count

public void count(DatabaseCountCallback callback)
Return the number of items referenced by the index.

Specified by:
count in class Index<K,I,V>
Parameters:
callback -

count

public void count(KeyRange<I> range,
                  DatabaseCountCallback callback)
Return the number of items referenced by the index in the given range.

Specified by:
count in class Index<K,I,V>
Parameters:
range -
callback -

get

public void get(I key,
                DatabaseRetrieveCallback<V> callback)
Retrieve the object associated with the given key from the index. To read the object, use the method onSuccess from DatabaseRetrieveCallback.

Specified by:
get in class Index<K,I,V>
Parameters:
key -
callback -

get

public void get(KeyRange<I> keyRange,
                DatabaseRetrieveCallback<V> callback)
Retrieve the object in the given keyRange from the index. To read the object, use the method onSuccess from DatabaseRetrieveCallback.

Specified by:
get in class Index<K,I,V>
Parameters:
keyRange -
callback -

getKey

public void getKey(I key,
                   DatabaseRetrieveCallback<K> callback)
Retrieve the object key associated with the given key from the index. To read the object, use the method onSuccess from DatabaseRetrieveCallback.

Specified by:
getKey in class Index<K,I,V>
Parameters:
key -
callback -

getKey

public void getKey(KeyRange<I> keyRange,
                   DatabaseRetrieveCallback<K> callback)
Retrieve the object key in the given keyRange from the index. To read the object, use the method onSuccess from DatabaseRetrieveCallback.

Specified by:
getKey in class Index<K,I,V>
Parameters:
keyRange -
callback -

openCursor

public void openCursor(DatabaseCursorCallback<I,V> callback)
Open a cursor to iterate over the object store.

Specified by:
openCursor in class Index<K,I,V>
Parameters:
callback -

openCursor

public void openCursor(KeyRange<I> keyRange,
                       DatabaseCursorCallback<I,V> callback)
Open a cursor to iterate over the object store.

Specified by:
openCursor in class Index<K,I,V>
Parameters:
keyRange -
callback -

openKeyCursor

public void openKeyCursor(DatabaseCursorCallback<I,K> callback)
Open a cursor to iterate over the object store.

Specified by:
openKeyCursor in class Index<K,I,V>
Parameters:
callback -

openKeyCursor

public void openKeyCursor(KeyRange<I> keyRange,
                          DatabaseCursorCallback<I,K> callback)
Open a cursor to iterate over the object store.

Specified by:
openKeyCursor in class Index<K,I,V>
Parameters:
keyRange -
callback -

openCursor

public abstract void openCursor(KeyRange<I> keyRange,
                                Cursor.CursorDirection direction,
                                DatabaseCursorCallback<I,V> callback)
Open a cursor to iterate over the object store.

Specified by:
openCursor in class Index<K,I,V>
Parameters:
keyRange -
direction -
callback -

openKeyCursor

public abstract void openKeyCursor(KeyRange<I> keyRange,
                                   Cursor.CursorDirection direction,
                                   DatabaseCursorCallback<I,K> callback)
Open a cursor to iterate over the object store.

Specified by:
openKeyCursor in class Index<K,I,V>
Parameters:
keyRange -
direction -
callback -

getKeyRangeFactory

public abstract KeyRangeFactory<I> getKeyRangeFactory()
Retrieve a factory to create KeyRange objects used by this index.

Specified by:
getKeyRangeFactory in class Index<K,I,V>
Returns:


Copyright © 2014. All rights reserved.