org.cruxframework.crux.core.client.db
Interface FileStore

All Known Implementing Classes:
IDXFileStore

public interface FileStore

A Store for files on Crux Database. Use this to work with files on database.

See the following example:

 Transaction transaction = database.getTransaction(new String[]{FileStore.OBJECT_STORE_NAME}, Transaction.Mode.readWrite);
 FileStore store = transaction.getFileStore();
 store.openCursor(new FileStoreCursorCallback(){

Author:
Thiago da Rosa de Bustamante
See Also:
ObjectStore

Field Summary
static String OBJECT_STORE_NAME
          The name of the object store used to store the files on Crux Database.
 
Method Summary
 void add(Blob file, String fileName)
          Insert a new file into the database.
 void add(Blob file, String fileName, DatabaseWriteCallback<String> callback)
          Insert a new file into the database.
 void clear()
          Removes all files from the database FileStore
 void count(DatabaseCountCallback callback)
          Check the number of files on the fileStore
 void count(KeyRange<String> keyRange, DatabaseCountCallback callback)
          Check the number of files on the fileStore
 void delete(KeyRange<String> keyRange)
          Remove a range of files from the database
 void delete(KeyRange<String> keyRange, DatabaseDeleteCallback callback)
          Remove a range of files from the database
 void delete(String key, DatabaseDeleteCallback callback)
          Remove the file from the database
 void get(String key, DatabaseRetrieveCallback<Blob> callback)
          Retrieve a file from the database.
 KeyRangeFactory<String> getKeyRangeFactory()
          Creates a factory for KeyRange objects used by this store.
 void openCursor(FileStoreCursorCallback callback)
          Open a FileCursor object, to allow iteration over the files on this store.
 void openCursor(KeyRange<String> keyRange, Cursor.CursorDirection direction, FileStoreCursorCallback callback)
          Open a FileCursor object, to allow iteration over the files on this store.
 void openCursor(KeyRange<String> keyRange, FileStoreCursorCallback callback)
          Open a FileCursor object, to allow iteration over the files on this store.
 void put(Blob file, String fileName)
          If database already contains a file stored with the given fileName, update the file stored.
 void put(Blob file, String fileName, DatabaseWriteCallback<String> callback)
          If database already contains a file stored with the given fileName, update the file stored.
 

Field Detail

OBJECT_STORE_NAME

static final String OBJECT_STORE_NAME
The name of the object store used to store the files on Crux Database. Use this constant when opening a transaction to access the file store object.

See Also:
Constant Field Values
Method Detail

add

void add(Blob file,
         String fileName)
Insert a new file into the database.

Parameters:
file - file to store
fileName - file name

put

void put(Blob file,
         String fileName)
If database already contains a file stored with the given fileName, update the file stored. Otherwise, Insert a new file into the database.

Parameters:
file - file to store
fileName - file name

add

void add(Blob file,
         String fileName,
         DatabaseWriteCallback<String> callback)
Insert a new file into the database.

Parameters:
file - file to store
fileName - file name
callback - called when the operation complete

put

void put(Blob file,
         String fileName,
         DatabaseWriteCallback<String> callback)
If database already contains a file stored with the given fileName, update the file stored.

Parameters:
file - file to store
fileName - file name
callback - called when the operation complete

get

void get(String key,
         DatabaseRetrieveCallback<Blob> callback)
Retrieve a file from the database.

Parameters:
key - the fileName used to insert the object
callback - called when the operation complete

delete

void delete(String key,
            DatabaseDeleteCallback callback)
Remove the file from the database

Parameters:
key - the fileName used to insert the object
callback - called when the operation complete

delete

void delete(KeyRange<String> keyRange)
Remove a range of files from the database

Parameters:
keyRange - an object specifying the fileNames range to exclude

delete

void delete(KeyRange<String> keyRange,
            DatabaseDeleteCallback callback)
Remove a range of files from the database

Parameters:
keyRange - an object specifying the fileNames range to exclude
callback - called when the operation complete

clear

void clear()
Removes all files from the database FileStore


openCursor

void openCursor(FileStoreCursorCallback callback)
Open a FileCursor object, to allow iteration over the files on this store.

Parameters:
callback - called when the operation complete

openCursor

void openCursor(KeyRange<String> keyRange,
                FileStoreCursorCallback callback)
Open a FileCursor object, to allow iteration over the files on this store.

Parameters:
keyRange - an object specifying the fileNames range to appear on iteration
callback - called when the operation complete

openCursor

void openCursor(KeyRange<String> keyRange,
                Cursor.CursorDirection direction,
                FileStoreCursorCallback callback)
Open a FileCursor object, to allow iteration over the files on this store.

Parameters:
keyRange - an object specifying the fileNames range to appear on iteration
direction - specifies the cursor iteration direction
callback - called when the operation complete

count

void count(DatabaseCountCallback callback)
Check the number of files on the fileStore

Parameters:
callback - called when the operation complete

count

void count(KeyRange<String> keyRange,
           DatabaseCountCallback callback)
Check the number of files on the fileStore

Parameters:
keyRange - an object specifying the fileNames range to count
callback - called when the operation complete

getKeyRangeFactory

KeyRangeFactory<String> getKeyRangeFactory()
Creates a factory for KeyRange objects used by this store.

Returns:
the factory


Copyright © 2014. All rights reserved.