org.universAAL.context.sesame.sail.crypt
Class CryptDataStore

Package class diagram package CryptDataStore
java.lang.Object
  extended by org.openrdf.sail.nativerdf.datastore.DataStore
      extended by org.universAAL.context.sesame.sail.crypt.CryptDataStore

public class CryptDataStore
extends org.openrdf.sail.nativerdf.datastore.DataStore

Class that provides indexed storage and retrieval of arbitrary length data.

Author:
Arjohn Kampman

Constructor Summary
CryptDataStore(File dataDir, String filePrefix)
           
CryptDataStore(File dataDir, String filePrefix, boolean forceSync)
           
 
Method Summary
 void clear()
          Removes all values from the DataStore.
 void close()
          Closes the DataStore, releasing any file references, etc.
 byte[] getData(int id)
          Gets the value for the specified ID.
 int getID(byte[] queryData)
          Gets the ID for the specified value.
 int getMaxID()
          Returns the maximum value-ID that is in use.
 int storeData(byte[] data)
          Stores the supplied value and returns the ID that has been assigned to it.
 void sync()
          Synchronizes any recent changes to the data to disk.
 
Methods inherited from class org.openrdf.sail.nativerdf.datastore.DataStore
main
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CryptDataStore

public CryptDataStore(File dataDir,
                      String filePrefix)
               throws IOException
Throws:
IOException

CryptDataStore

public CryptDataStore(File dataDir,
                      String filePrefix,
                      boolean forceSync)
               throws IOException
Throws:
IOException
Method Detail

getData

public byte[] getData(int id)
               throws IOException
Gets the value for the specified ID.

Overrides:
getData in class org.openrdf.sail.nativerdf.datastore.DataStore
Parameters:
id - A value ID, should be larger than 0.
Returns:
The value for the ID, or null if no such value could be found.
Throws:
Exception
IOException

getID

public int getID(byte[] queryData)
          throws IOException
Gets the ID for the specified value.

Overrides:
getID in class org.openrdf.sail.nativerdf.datastore.DataStore
Parameters:
queryData - The value to get the ID for, must not be null.
Returns:
The ID for the specified value, or -1 if no such ID could be found.
Throws:
Exception
IOException

getMaxID

public int getMaxID()
             throws IOException
Returns the maximum value-ID that is in use.

Overrides:
getMaxID in class org.openrdf.sail.nativerdf.datastore.DataStore
Returns:
The largest ID, or 0 if the store does not contain any values.
Throws:
IOException - If an I/O error occurs.

storeData

public int storeData(byte[] data)
              throws IOException
Stores the supplied value and returns the ID that has been assigned to it. In case the data to store is already present, the ID of this existing data is returned.

Overrides:
storeData in class org.openrdf.sail.nativerdf.datastore.DataStore
Parameters:
data - The data to store, must not be null.
Returns:
The ID that has been assigned to the value.
Throws:
Exception
IOException

sync

public void sync()
          throws IOException
Synchronizes any recent changes to the data to disk.

Overrides:
sync in class org.openrdf.sail.nativerdf.datastore.DataStore
Throws:
IOException - If an I/O error occurred.

clear

public void clear()
           throws IOException
Removes all values from the DataStore.

Overrides:
clear in class org.openrdf.sail.nativerdf.datastore.DataStore
Throws:
IOException - If an I/O error occurred.

close

public void close()
           throws IOException
Closes the DataStore, releasing any file references, etc. In case a transaction is currently open, it will be rolled back. Once closed, the DataStore can no longer be used.

Overrides:
close in class org.openrdf.sail.nativerdf.datastore.DataStore
Throws:
IOException - If an I/O error occurred.


Copyright © 2014 universAAL Consortium. All Rights Reserved.