net.obsearch.storage
Interface OBStoreFactory

All Known Implementing Classes:
BDBFactoryJe, TCFactory

public interface OBStoreFactory

OBStoreFactory defines several methods to facilitate the creation of indexes by OBSearch's indexes. In general, each index should receive an object that implements OBStoreFactory and from then, the index will get databases from the factory as needed. Constructors for each factory are expected to define how and where the data will be accessed. If the factory cannot provide some of the requested indexes, an #net.obsearch.exception.UnsupportedStorageException is thrown.

Author:
Arnoldo Jose Muller Molina

Method Summary
 void close()
          Close the factory.
 OBStore<TupleBytes> createOBStore(String name, OBStorageConfig config)
          Creates a generic OBStore.
 OBStoreByte createOBStoreByte(String name, OBStorageConfig config)
          Creates an OBStoreByte whose key is based on bytes.
 OBStoreDouble createOBStoreDouble(String name, OBStorageConfig config)
          Creates an OBStoreDouble whose key is based on doubles.
 OBStoreFloat createOBStoreFloat(String name, OBStorageConfig config)
          Creates an OBStoreFloat whose key is based on floats.
 OBStoreInt createOBStoreInt(String name, OBStorageConfig config)
          Creates an OBStoreInt whose key is based on ints.
 OBStoreLong createOBStoreLong(String name, OBStorageConfig config)
          Creates an OBStoreLong whose key is based on longs.
 OBStoreShort createOBStoreShort(String name, OBStorageConfig config)
          Creates an OBStoreShort whose key is based on shorts.
 BigInteger deSerializeBigInteger(byte[] value)
          Creates a BigInteger of the given value.
 byte deSerializeByte(byte[] value)
          Creates a byte of the given value.
 double deSerializeDouble(byte[] value)
          Creates a double of the given value.
 float deSerializeFloat(byte[] value)
          Creates a float of the given value.
 int deSerializeInt(byte[] value)
          Creates a int of the given value.
 long deSerializeLong(byte[] value)
          Creates a long of the given value.
 short deSerializeShort(byte[] value)
          Creates a short of the given value.
 String getFactoryLocation()
          Return the url where this factory is located.
 void removeOBStore(OBStore storage)
          Removes all indexes and structures related to the given storage device.
 byte[] serializeBigInteger(BigInteger value)
          Creates a binary representation of the given value.
 byte[] serializeByte(byte value)
          Creates a binary representation of the given value.
 byte[] serializeDouble(double value)
          Creates a binary representation of the given value.
 byte[] serializeFloat(float value)
          Creates a binary representation of the given value.
 byte[] serializeInt(int value)
          Creates a binary representation of the given value.
 byte[] serializeLong(long value)
          Creates a binary representation of the given value.
 byte[] serializeShort(short value)
          Creates a binary representation of the given value.
 Object stats()
          Return a stats object that is to be printed
 

Method Detail

createOBStore

OBStore<TupleBytes> createOBStore(String name,
                                  OBStorageConfig config)
                                  throws OBStorageException,
                                         OBException
Creates a generic OBStore.

Parameters:
temp - If true, the database will be configured to be a temporal database.
name - The name of the database.
duplicates - If duplicates are to be allowed.
bulkMode - If we want the storage to be faster for lots of insertions.
Returns:
An OBStore ready to be used.
Throws:
OBStorageException - If the DB cannot be created.
OBException

removeOBStore

void removeOBStore(OBStore storage)
                   throws OBStorageException,
                          OBException
Removes all indexes and structures related to the given storage device.

Parameters:
storage - The storage device to remove.
Throws:
OBStorageException - If something goes wrong with the delete operation.
OBException

createOBStoreByte

OBStoreByte createOBStoreByte(String name,
                              OBStorageConfig config)
                              throws OBStorageException,
                                     OBException
Creates an OBStoreByte whose key is based on bytes.

Parameters:
name - The name of the database.
temp - If true, the database will be configured to be a temporal database.
duplicates - If duplicates are to be allowed.
bulkMode - If we want the storage to be faster for lots of insertions.
Returns:
An OBStoreByte ready to be used.
Throws:
OBStorageException - If the DB cannot be created.
OBException

serializeByte

byte[] serializeByte(byte value)
Creates a binary representation of the given value. The value must be returned in such a way that it can be sorted with bytes.


deSerializeByte

byte deSerializeByte(byte[] value)
Creates a byte of the given value. Only the required bytes are taken from the input.


createOBStoreShort

OBStoreShort createOBStoreShort(String name,
                                OBStorageConfig config)
                                throws OBStorageException,
                                       OBException
Creates an OBStoreShort whose key is based on shorts.

Parameters:
name - The name of the database.
temp - If true, the database will be configured to be a temporal database.
duplicates - If duplicates are to be allowed.
bulkMode - If we want the storage to be faster for lots of insertions.
Returns:
An OBStoreShort ready to be used.
Throws:
OBStorageException - If the DB cannot be created.
OBException

serializeShort

byte[] serializeShort(short value)
Creates a binary representation of the given value. The value must be returned in such a way that it can be sorted with bytes.


deSerializeShort

short deSerializeShort(byte[] value)
Creates a short of the given value. Only the required bytes are taken from the input.


createOBStoreInt

OBStoreInt createOBStoreInt(String name,
                            OBStorageConfig config)
                            throws OBStorageException,
                                   OBException
Creates an OBStoreInt whose key is based on ints.

Parameters:
name - The name of the database.
temp - If true, the database will be configured to be a temporal database.
duplicates - If duplicates are to be allowed.
bulkMode - If we want the storage to be faster for lots of insertions.
Returns:
An OBStoreInt ready to be used.
Throws:
OBStorageException - If the DB cannot be created.
OBException

serializeInt

byte[] serializeInt(int value)
Creates a binary representation of the given value. The value must be returned in such a way that it can be sorted with bytes.


deSerializeInt

int deSerializeInt(byte[] value)
Creates a int of the given value. Only the required bytes are taken from the input.


createOBStoreLong

OBStoreLong createOBStoreLong(String name,
                              OBStorageConfig config)
                              throws OBStorageException,
                                     OBException
Creates an OBStoreLong whose key is based on longs.

Parameters:
name - The name of the database.
temp - If true, the database will be configured to be a temporal database.
duplicates - If duplicates are to be allowed.
bulkMode - If we want the storage to be faster for lots of insertions.
Returns:
An OBStoreLong ready to be used.
Throws:
OBStorageException - If the DB cannot be created.
OBException

serializeLong

byte[] serializeLong(long value)
Creates a binary representation of the given value. The value must be returned in such a way that it can be sorted with bytes.


deSerializeLong

long deSerializeLong(byte[] value)
Creates a long of the given value. Only the required bytes are taken from the input.


createOBStoreFloat

OBStoreFloat createOBStoreFloat(String name,
                                OBStorageConfig config)
                                throws OBStorageException,
                                       OBException
Creates an OBStoreFloat whose key is based on floats.

Parameters:
name - The name of the database.
temp - If true, the database will be configured to be a temporal database.
duplicates - If duplicates are to be allowed.
bulkMode - If we want the storage to be faster for lots of insertions.
Returns:
An OBStoreFloat ready to be used.
Throws:
OBStorageException - If the DB cannot be created.
OBException

serializeFloat

byte[] serializeFloat(float value)
Creates a binary representation of the given value. The value must be returned in such a way that it can be sorted with bytes.


deSerializeFloat

float deSerializeFloat(byte[] value)
Creates a float of the given value. Only the required bytes are taken from the input.


createOBStoreDouble

OBStoreDouble createOBStoreDouble(String name,
                                  OBStorageConfig config)
                                  throws OBStorageException,
                                         OBException
Creates an OBStoreDouble whose key is based on doubles.

Parameters:
name - The name of the database.
temp - If true, the database will be configured to be a temporal database.
duplicates - If duplicates are to be allowed.
bulkMode - If we want the storage to be faster for lots of insertions.
Returns:
An OBStoreDouble ready to be used.
Throws:
OBStorageException - If the DB cannot be created.
OBException

serializeDouble

byte[] serializeDouble(double value)
Creates a binary representation of the given value. The value must be returned in such a way that it can be sorted with bytes.


deSerializeDouble

double deSerializeDouble(byte[] value)
Creates a double of the given value. Only the required bytes are taken from the input.


serializeBigInteger

byte[] serializeBigInteger(BigInteger value)
Creates a binary representation of the given value. The value must be returned in such a way that it can be sorted with bytes.


deSerializeBigInteger

BigInteger deSerializeBigInteger(byte[] value)
Creates a BigInteger of the given value. Only the required bytes are taken from the input.


close

void close()
           throws OBStorageException
Close the factory. All opened OBStores must be closed before this method is called.

Throws:
OBStorageException - if something goes wrong with the underlying storage system.

stats

Object stats()
             throws OBStorageException
Return a stats object that is to be printed

Throws:
OBStorageException - if something goes wrong with the underlying storage system.

getFactoryLocation

String getFactoryLocation()
Return the url where this factory is located.



Copyright © 2007-2011 Arnoldo Jose Muller Molina. All Rights Reserved.