org.keridwen.core.data.storage.manager
Interface DataStorage

All Known Subinterfaces:
DataStorageService
All Known Implementing Classes:
DefaultDataStorage, DefaultDataStorageService

public interface DataStorage

DataModelManager is the data type manager which can store Data and DataModel. It is just a container which has no idea of it's content. It manages a collection of DataAccessors which can extract data from it.


Method Summary
 boolean addDataPacketListener(DataPacketId packetId, DataPacketListener listener)
          Adds a listener on a data packet with given Id.
 boolean addDataStorageListener(DataStorageListener listener)
          Adds a listener on this data storage.
 Set<DataPacketId> getDataListSafe(Class<?> objectClass)
          Gets the list of ids for the objects of the given type.
 Set<DataPacketId> getDataListUnsafe(Class<?> objectClass)
          Gets the list of ids for the objects of the given type.
<ObjectType extends Serializable>
ObjectType
getDataSafe(DataPacketId packetId)
          Gets the data object corresponding to the given unique id.
<ObjectType extends Serializable>
ObjectType
getDataSafe(String objectName)
          Gets the data object corresponding to the given name.
<ObjectType>
ObjectType
getDataUnsafe(DataPacketId packetId)
          Gets the data object corresponding to the given unique id.
<ObjectType>
ObjectType
getDataUnsafe(String objectName)
          Gets the data object corresponding to the given name.
 int getNbData()
          Get the total number of stored data (safe+unsafe).
 String getPacketInformation(DataPacketId packetId)
          Gets the information of the packet with the given id.
 Boolean isReadLocked(DataPacketId packetId)
          Checks if the data packet with the given id is read locked.
 Boolean isWriteLocked(DataPacketId packetId)
          Checks if the data packet with the given id is write locked.
 boolean removeDataPacketListener(DataPacketId packetId, DataPacketListener listener)
          Removes a listener from a data packet with given Id.
 boolean removeDataStorageListener(DataStorageListener listener)
          Removes a listener from this data storage.
 boolean setDataSafe(Serializable serializableObject, DataPacketId packetId)
          Sets the object with the given unique id in the data storage.
 DataPacketId setDataSafe(String name, Serializable serializableObject)
          Sets the object with the given name in the data storage.
<ObjectType>
DataPacketId
setDataUnsafe(String name, ObjectType object)
          Sets the object with the given name in the data storage.
 

Method Detail

getNbData

int getNbData()
Get the total number of stored data (safe+unsafe).

Returns:
the total number of stored data

setDataUnsafe

<ObjectType> DataPacketId setDataUnsafe(String name,
                                        ObjectType object)
                           throws DataIOException
Sets the object with the given name in the data storage. This method is not safe.

Type Parameters:
ObjectType - the type of the object to set
Parameters:
name - the object name
object - the object to set
Returns:
an unique DataPacketId
Throws:
DataIOException - if the data writting failed

setDataSafe

DataPacketId setDataSafe(String name,
                         Serializable serializableObject)
                         throws DataIOException,
                                DataConcurrencyException
Sets the object with the given name in the data storage. This method is safe.

Parameters:
name - the object name
serializableObject - the object to set
Returns:
an unique DataPacketId
Throws:
DataIOException - if the data writting failed
DataConcurrencyException - in case of concurrent access to the data

setDataSafe

boolean setDataSafe(Serializable serializableObject,
                    DataPacketId packetId)
                    throws DataIOException,
                           DataConcurrencyException
Sets the object with the given unique id in the data storage.

Parameters:
serializableObject - the object to set
packetId - the unique id of the object to set
Returns:
true in case of success
Throws:
DataIOException - if the data writting failed
DataConcurrencyException - in case of concurrent access to the data

getDataUnsafe

<ObjectType> ObjectType getDataUnsafe(DataPacketId packetId)
                         throws DataIOException
Gets the data object corresponding to the given unique id. This method is not safe.

Parameters:
packetId - the unique id of the object to retrieve
Returns:
the retrieved object
Throws:
DataIOException - in case data reading failed

getDataSafe

<ObjectType extends Serializable> ObjectType getDataSafe(String objectName)
                                            throws DataIOException,
                                                   DataConcurrencyException
Gets the data object corresponding to the given name. This method is safe.

Parameters:
objectName - the name of the object to retrieve
Returns:
the retrieved object
Throws:
DataIOException - in case data reading failed
DataConcurrencyException - in case of concurrent access to the data

getDataUnsafe

<ObjectType> ObjectType getDataUnsafe(String objectName)
                         throws DataIOException
Gets the data object corresponding to the given name. This method is not safe.

Parameters:
objectName - the name of the object to retrieve
Returns:
the retrieved object
Throws:
DataIOException - in case data reading failed

getDataSafe

<ObjectType extends Serializable> ObjectType getDataSafe(DataPacketId packetId)
                                            throws DataIOException,
                                                   DataConcurrencyException
Gets the data object corresponding to the given unique id. This method is safe.

Parameters:
packetId - the unique id of the object to retrieve
Returns:
the retrieved object
Throws:
DataIOException - in case data reading failed
DataConcurrencyException - in case of concurrent access to the data

getDataListSafe

Set<DataPacketId> getDataListSafe(Class<?> objectClass)
Gets the list of ids for the objects of the given type. This method is safe.

Parameters:
objectClass - the type of object to fetch
Returns:
the list of unique ids of the objects
Throws:
DataIOException - in case data reading failed

getDataListUnsafe

Set<DataPacketId> getDataListUnsafe(Class<?> objectClass)
Gets the list of ids for the objects of the given type. This method is safe.

Parameters:
objectClass - the type of object to fetch
Returns:
the list of unique ids of the objects
Throws:
DataIOException - in case data reading failed

addDataStorageListener

boolean addDataStorageListener(DataStorageListener listener)
Adds a listener on this data storage.

Parameters:
listener - the listener to add

removeDataStorageListener

boolean removeDataStorageListener(DataStorageListener listener)
Removes a listener from this data storage.

Parameters:
listener - the listener to remove

addDataPacketListener

boolean addDataPacketListener(DataPacketId packetId,
                              DataPacketListener listener)
Adds a listener on a data packet with given Id.

Parameters:
packetId - the id of the packet to listen
the - listener to add

removeDataPacketListener

boolean removeDataPacketListener(DataPacketId packetId,
                                 DataPacketListener listener)
Removes a listener from a data packet with given Id.

Parameters:
packetId - the id of the packet to stop listenning
the - listener to remove

getPacketInformation

String getPacketInformation(DataPacketId packetId)
Gets the information of the packet with the given id.

Parameters:
packetId - the id of the packet
Returns:
the string information regarding the data packet

isWriteLocked

Boolean isWriteLocked(DataPacketId packetId)
Checks if the data packet with the given id is write locked.

Parameters:
packetId - the id of the packet to check
Returns:
true if the packet is locked for writing. Returns null if no packet is found.

isReadLocked

Boolean isReadLocked(DataPacketId packetId)
Checks if the data packet with the given id is read locked.

Parameters:
packetId - the id of the packet to check
Returns:
true if the packet is locked for reading. Returns null if no packet is found.


Copyright © 2010-2013 Artenum. All Rights Reserved.