org.cruxframework.crux.core.client.db
Class IDXFileStore

java.lang.Object
  extended by org.cruxframework.crux.core.client.db.DBObject
      extended by org.cruxframework.crux.core.client.db.IDXFileStore
All Implemented Interfaces:
FileStore

public class IDXFileStore
extends DBObject
implements FileStore

CRUX INTERNAL CLASS. DO NOT USE IT DIRECTLY. Indexed DB implementation for FileStore Interface. Use the interface FileStore instead.

Author:
Thiago da Rosa de Bustamante

Field Summary
protected  IDXAbstractDatabase db
           
protected  IDBObjectStore idbObjectStore
           
 
Fields inherited from class org.cruxframework.crux.core.client.db.DBObject
logger
 
Fields inherited from interface org.cruxframework.crux.core.client.db.FileStore
OBJECT_STORE_NAME
 
Constructor Summary
protected IDXFileStore(IDXAbstractDatabase db, IDBObjectStore idbObjectStore)
           
 
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> range, 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.
 
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

idbObjectStore

protected final IDBObjectStore idbObjectStore

db

protected final IDXAbstractDatabase db
Constructor Detail

IDXFileStore

protected IDXFileStore(IDXAbstractDatabase db,
                       IDBObjectStore idbObjectStore)
Method Detail

add

public void add(Blob file,
                String fileName)
Description copied from interface: FileStore
Insert a new file into the database.

Specified by:
add in interface FileStore
Parameters:
file - file to store
fileName - file name

put

public void put(Blob file,
                String fileName)
Description copied from interface: FileStore
If database already contains a file stored with the given fileName, update the file stored. Otherwise, Insert a new file into the database.

Specified by:
put in interface FileStore
Parameters:
file - file to store
fileName - file name

delete

public void delete(KeyRange<String> keyRange)
Description copied from interface: FileStore
Remove a range of files from the database

Specified by:
delete in interface FileStore
Parameters:
keyRange - an object specifying the fileNames range to exclude

add

public void add(Blob file,
                String fileName,
                DatabaseWriteCallback<String> callback)
Description copied from interface: FileStore
Insert a new file into the database.

Specified by:
add in interface FileStore
Parameters:
file - file to store
fileName - file name
callback - called when the operation complete

put

public void put(Blob file,
                String fileName,
                DatabaseWriteCallback<String> callback)
Description copied from interface: FileStore
If database already contains a file stored with the given fileName, update the file stored.

Specified by:
put in interface FileStore
Parameters:
file - file to store
fileName - file name
callback - called when the operation complete

get

public void get(String key,
                DatabaseRetrieveCallback<Blob> callback)
Description copied from interface: FileStore
Retrieve a file from the database.

Specified by:
get in interface FileStore
Parameters:
key - the fileName used to insert the object
callback - called when the operation complete

delete

public void delete(String key,
                   DatabaseDeleteCallback callback)
Description copied from interface: FileStore
Remove the file from the database

Specified by:
delete in interface FileStore
Parameters:
key - the fileName used to insert the object
callback - called when the operation complete

delete

public void delete(KeyRange<String> keyRange,
                   DatabaseDeleteCallback callback)
Description copied from interface: FileStore
Remove a range of files from the database

Specified by:
delete in interface FileStore
Parameters:
keyRange - an object specifying the fileNames range to exclude
callback - called when the operation complete

clear

public void clear()
Description copied from interface: FileStore
Removes all files from the database FileStore

Specified by:
clear in interface FileStore

openCursor

public void openCursor(FileStoreCursorCallback callback)
Description copied from interface: FileStore
Open a FileCursor object, to allow iteration over the files on this store.

Specified by:
openCursor in interface FileStore
Parameters:
callback - called when the operation complete

openCursor

public void openCursor(KeyRange<String> keyRange,
                       FileStoreCursorCallback callback)
Description copied from interface: FileStore
Open a FileCursor object, to allow iteration over the files on this store.

Specified by:
openCursor in interface FileStore
Parameters:
keyRange - an object specifying the fileNames range to appear on iteration
callback - called when the operation complete

openCursor

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

Specified by:
openCursor in interface FileStore
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

public void count(DatabaseCountCallback callback)
Description copied from interface: FileStore
Check the number of files on the fileStore

Specified by:
count in interface FileStore
Parameters:
callback - called when the operation complete

count

public void count(KeyRange<String> range,
                  DatabaseCountCallback callback)
Description copied from interface: FileStore
Check the number of files on the fileStore

Specified by:
count in interface FileStore
Parameters:
range - an object specifying the fileNames range to count
callback - called when the operation complete

getKeyRangeFactory

public KeyRangeFactory<String> getKeyRangeFactory()
Description copied from interface: FileStore
Creates a factory for KeyRange objects used by this store.

Specified by:
getKeyRangeFactory in interface FileStore
Returns:
the factory


Copyright © 2014. All rights reserved.