com.mymed.controller.core.manager.storage
Class StorageManager

java.lang.Object
  extended by com.mymed.controller.core.manager.storage.StorageManager
All Implemented Interfaces:
IStorageManager
Direct Known Subclasses:
MyJamStorageManager

public class StorageManager
extends java.lang.Object
implements IStorageManager

This class represent the DAO pattern: Access to data varies depending on the source of the data. Access to persistent storage, such as to a database, varies greatly depending on the type of storage Use a Data Access Object (DAO) to abstract and encapsulate all access to the data source. The DAO manages the connection with the data source to obtain and store data.

Author:
lvanni

Field Summary
 
Fields inherited from interface com.mymed.controller.core.manager.storage.IStorageManager
consistencyOnRead, consistencyOnWrite
 
Constructor Summary
StorageManager()
          Default Constructor: will create a ServiceManger on top of a Cassandra Wrapper
StorageManager(WrapperConfiguration conf)
          will create a ServiceManger on top of the WrapperType And use the specific configuration file for the transport layer
 
Method Summary
 int countColumns(java.lang.String tableName, java.lang.String key)
          Count columns in record
 CassandraWrapper getWrapper()
           
 void insertColumn(java.lang.String tableName, java.lang.String key, java.lang.String columnName, byte[] value)
          Update the value of a Simple Column
 void insertSlice(java.lang.String tableName, java.lang.String primaryKey, java.util.Map<java.lang.String,byte[]> args)
          Insert a new entry in the database
 void insertSuperColumn(java.lang.String tableName, java.lang.String key, java.lang.String superColumn, java.lang.String columnName, byte[] value)
          Update the value of a Super Column
 void insertSuperSlice(java.lang.String superTableName, java.lang.String key, java.lang.String superKey, java.util.Map<java.lang.String,byte[]> args)
          Insert a new entry in the database
 void removeAll(java.lang.String tableName, java.lang.String key)
          Remove an entry in the columnFamily
 void removeColumn(java.lang.String tableName, java.lang.String key, java.lang.String columnName)
          Remove a specific column defined by the columnName
 void removeSuperColumn(java.lang.String tableName, java.lang.String key, java.lang.String superColumnName)
           
 java.util.Map<byte[],byte[]> selectAll(java.lang.String tableName, java.lang.String key)
          Get the value of a column family
 byte[] selectColumn(java.lang.String tableName, java.lang.String key, java.lang.String columnName)
          Get the value of an entry column
 java.util.List<java.util.Map<byte[],byte[]>> selectList(java.lang.String tableName, java.lang.String key)
          Get the value of a column family
 java.util.Map<byte[],byte[]> selectRange(java.lang.String tableName, java.lang.String key, java.util.List<java.lang.String> columnNames)
          Get the values of a range of columns
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StorageManager

public StorageManager()
               throws InternalBackEndException
Default Constructor: will create a ServiceManger on top of a Cassandra Wrapper

Throws:
InternalBackEndException

StorageManager

public StorageManager(WrapperConfiguration conf)
               throws InternalBackEndException
will create a ServiceManger on top of the WrapperType And use the specific configuration file for the transport layer

Parameters:
conf - The configuration of the transport layer
Throws:
InternalBackEndException
Method Detail

selectColumn

public byte[] selectColumn(java.lang.String tableName,
                           java.lang.String key,
                           java.lang.String columnName)
                    throws InternalBackEndException,
                           IOBackEndException
Get the value of an entry column

Specified by:
selectColumn in interface IStorageManager
Parameters:
tableName - the name of the Table/ColumnFamily
key - the ID of the entry
columnName - the name of the column
Returns:
the value of the column
Throws:
IOBackEndException
InternalBackEndException

selectAll

public java.util.Map<byte[],byte[]> selectAll(java.lang.String tableName,
                                              java.lang.String key)
                                       throws InternalBackEndException,
                                              IOBackEndException
Get the value of a column family

Specified by:
selectAll in interface IStorageManager
Parameters:
tableName - the name of the Table/ColumnFamily
key - the ID of the entry
columnName - the name of the column
Returns:
the value of the column
Throws:
InternalBackEndException
IOBackEndException

selectList

public java.util.List<java.util.Map<byte[],byte[]>> selectList(java.lang.String tableName,
                                                               java.lang.String key)
                                                        throws InternalBackEndException,
                                                               IOBackEndException
Get the value of a column family

Specified by:
selectList in interface IStorageManager
Parameters:
tableName - the name of the Table/ColumnFamily
key - the ID of the entry
columnName - the name of the column
Returns:
the value of the column
Throws:
InternalBackEndException
IOBackEndException

selectRange

public java.util.Map<byte[],byte[]> selectRange(java.lang.String tableName,
                                                java.lang.String key,
                                                java.util.List<java.lang.String> columnNames)
                                         throws InternalBackEndException,
                                                IOBackEndException
Get the values of a range of columns

Specified by:
selectRange in interface IStorageManager
Parameters:
tableName - the name of the Table/ColumnFamily
key - the ID of the entry
columnNames - the name of the columns to return the values
Returns:
the value of the columns
Throws:
InternalBackEndException
IOBackEndException

countColumns

public int countColumns(java.lang.String tableName,
                        java.lang.String key)
                 throws InternalBackEndException
Count columns in record

Specified by:
countColumns in interface IStorageManager
Parameters:
key -
parent -
Returns:
Throws:
InternalBackEndException

insertColumn

public void insertColumn(java.lang.String tableName,
                         java.lang.String key,
                         java.lang.String columnName,
                         byte[] value)
                  throws InternalBackEndException
Update the value of a Simple Column

Specified by:
insertColumn in interface IStorageManager
Parameters:
tableName - the name of the Table/ColumnFamily
key - the ID of the entry
columnName - the name of the column
value - the value updated
Throws:
InternalBackEndException

insertSuperColumn

public void insertSuperColumn(java.lang.String tableName,
                              java.lang.String key,
                              java.lang.String superColumn,
                              java.lang.String columnName,
                              byte[] value)
                       throws InternalBackEndException
Update the value of a Super Column

Specified by:
insertSuperColumn in interface IStorageManager
Parameters:
tableName - the name of the Table/ColumnFamily
key - the ID of the entry
superColumn - the ID of the superColumn
columnName - the name of the column
value - the value updated
Throws:
InternalBackEndException

insertSlice

public void insertSlice(java.lang.String tableName,
                        java.lang.String primaryKey,
                        java.util.Map<java.lang.String,byte[]> args)
                 throws InternalBackEndException
Insert a new entry in the database

Specified by:
insertSlice in interface IStorageManager
Parameters:
tableName - the name of the Table/ColumnFamily
key - the ID of the entry
args - All columnName and the their value
Throws:
InternalBackEndException

insertSuperSlice

public void insertSuperSlice(java.lang.String superTableName,
                             java.lang.String key,
                             java.lang.String superKey,
                             java.util.Map<java.lang.String,byte[]> args)
                      throws IOBackEndException,
                             InternalBackEndException
Insert a new entry in the database

Specified by:
insertSuperSlice in interface IStorageManager
Parameters:
superTableName - the name of the Table/SuperColumnFamily
key - the ID of the entry
superKey - the ID of the entry in the SuperColumnFamily
args - All columnName and the their value
Throws:
ServiceManagerException
InternalBackEndException
IOBackEndException

removeColumn

public void removeColumn(java.lang.String tableName,
                         java.lang.String key,
                         java.lang.String columnName)
                  throws InternalBackEndException
Remove a specific column defined by the columnName

Specified by:
removeColumn in interface IStorageManager
Parameters:
keyspace -
columnFamily -
key -
columnName -
Throws:
InternalBackEndException

removeSuperColumn

public void removeSuperColumn(java.lang.String tableName,
                              java.lang.String key,
                              java.lang.String superColumnName)
                       throws InternalBackEndException
Specified by:
removeSuperColumn in interface IStorageManager
Parameters:
tableName -
key -
superColumnName -
Throws:
InternalBackEndException

removeAll

public void removeAll(java.lang.String tableName,
                      java.lang.String key)
               throws InternalBackEndException
Remove an entry in the columnFamily

Specified by:
removeAll in interface IStorageManager
Parameters:
keyspace -
columnFamily -
key -
Throws:
InternalBackEndException

getWrapper

public CassandraWrapper getWrapper()
Returns: