|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.keridwen.core.data.storage.manager.DefaultDataStorage
public class DefaultDataStorage
This is the default implementation of the DataStorage
.
Constructor Summary | |
---|---|
DefaultDataStorage()
Default constructor. |
|
DefaultDataStorage(boolean isStoredInMemory)
Constructor with data storage localization. |
Method Summary | ||
---|---|---|
boolean |
addDataPacketListener(DataPacketId packetId,
DataPacketListener listener)
Add a listener on a data packet with given Id |
|
boolean |
addDataStorageListener(DataStorageListener listener)
Adds a listener on this data storage. |
|
protected void |
fireDataManagerEvent(DataStorageEvent event)
fire an event to the Data manager listeners |
|
DataPacketId |
generateUniqueId(Object... parameters)
ids generation Method. |
|
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. |
|
|
getDataSafe(DataPacketId packetId)
Gets the data object corresponding to the given unique id. |
|
|
getDataSafe(String objectName)
Gets the data object corresponding to the given name. |
|
|
getDataUnsafe(DataPacketId packetId)
Gets the unsafe data associated with the given unique id. |
|
|
getDataUnsafe(String objectName)
Gets the data object corresponding to the given name. |
|
boolean |
getLogPacketInformation()
|
|
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)
remove 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 given object as safe data. |
|
|
setDataUnsafe(String name,
ObjectType object)
Sets the given object as unsafe data. |
|
void |
setFileDataStorage()
Set the data storage in files. |
|
void |
setLogPacketInformation(boolean logPacketInformations)
|
|
void |
setLogPacketInformation(DataPacketId id,
String log)
|
|
void |
setMemoryDataStorage()
Sets the data storage in memory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultDataStorage()
public DefaultDataStorage(boolean isStoredInMemory)
isStoredInMemory
- true if the storage is performed in memoryMethod Detail |
---|
public final int getNbData()
DataStorage
getNbData
in interface DataStorage
public final DataPacketId generateUniqueId(Object... parameters)
UniqueIdGenerator
generateUniqueId
in interface UniqueIdGenerator<DataPacketId>
parameters
- list of parameters
public final void setMemoryDataStorage()
public final void setFileDataStorage()
public final <ObjectType> DataPacketId setDataUnsafe(String name, ObjectType object) throws DataIOException
setDataUnsafe
in interface DataStorage
ObjectType
- the type of the object to setname
- the name of the data to setobject
- the object to set
DataIOException
- in case of error while writing the datapublic final DataPacketId setDataSafe(String name, Serializable serializableObject) throws DataIOException, DataConcurrencyException
setDataSafe
in interface DataStorage
ObjectType
- the type of the object to setname
- the name of the data to setobject
- the object to set
DataIOException
- in case of error while writing the data
DataConcurrencyException
- in case of concurrent access to the datapublic final <ObjectType> ObjectType getDataUnsafe(DataPacketId packetId) throws DataIOException
getDataUnsafe
in interface DataStorage
packetId
- the id of the packet to fetch
DataIOException
- in case of error while reading the datapublic final <ObjectType extends Serializable> ObjectType getDataSafe(DataPacketId packetId) throws DataIOException, DataConcurrencyException
DataStorage
getDataSafe
in interface DataStorage
packetId
-
DataIOException
DataConcurrencyException
- in case of concurrent access to the datapublic final boolean setDataSafe(Serializable serializableObject, DataPacketId packetId) throws DataIOException, DataConcurrencyException
DataStorage
setDataSafe
in interface DataStorage
serializableObject
- the object to setpacketId
- the unique id of the object to set
DataIOException
- if the data writting failed
DataConcurrencyException
- in case of concurrent access to the dataorg.keridwen.core.data.storage.manager.DataStorage#setDataSafe(org.keridwen.core.model.manager.DataAccessReader[],
org.keridwen.core.data.storage.packet.DataPacketId)
public final boolean addDataPacketListener(DataPacketId packetId, DataPacketListener listener)
addDataPacketListener
in interface DataStorage
packetId
- public final boolean removeDataPacketListener(DataPacketId packetId, DataPacketListener listener)
removeDataPacketListener
in interface DataStorage
packetId
- public final void setLogPacketInformation(DataPacketId id, String log)
public final boolean getLogPacketInformation()
public final void setLogPacketInformation(boolean logPacketInformations)
logPacketInformations
- the logPacketInformations to setpublic final String getPacketInformation(DataPacketId packetId)
DataStorage
getPacketInformation
in interface DataStorage
packetId
- the id of the packet
DataStorage.getPacketInformation(org.keridwen.core.data.storage.packet.DataPacketId)
public final Boolean isWriteLocked(DataPacketId packetId)
DataStorage
isWriteLocked
in interface DataStorage
packetId
- the id of the packet to check
DataStorage.isWriteLocked(org.keridwen.core.data.storage.packet.DataPacketId)
public final Boolean isReadLocked(DataPacketId packetId)
DataStorage
isReadLocked
in interface DataStorage
packetId
- the id of the packet to check
DataStorage.isReadLocked(org.keridwen.core.data.storage.packet.DataPacketId)
public final <ObjectType extends Serializable> ObjectType getDataSafe(String objectName) throws DataIOException, DataConcurrencyException
DataStorage
getDataSafe
in interface DataStorage
objectName
- the name of the object to retrieve
DataIOException
- in case data reading failed
DataConcurrencyException
- in case of concurrent access to the dataDataStorage.getDataSafe(java.lang.String)
public final <ObjectType> ObjectType getDataUnsafe(String objectName) throws DataIOException
DataStorage
getDataUnsafe
in interface DataStorage
objectName
- the name of the object to retrieve
DataIOException
- in case data reading failedDataStorage.getDataUnsafe(java.lang.String)
public final Set<DataPacketId> getDataListSafe(Class<?> objectClass)
DataStorage
getDataListSafe
in interface DataStorage
objectClass
- the type of object to fetch
org.keridwen.core.data.storage.manager.DataStorage#getDataList(java.lang.Class)
public final Set<DataPacketId> getDataListUnsafe(Class<?> objectClass)
DataStorage
getDataListUnsafe
in interface DataStorage
objectClass
- the type of object to fetch
org.keridwen.core.data.storage.manager.DataStorage#getDataList(java.lang.Class)
public final boolean addDataStorageListener(DataStorageListener listener)
DataStorage
addDataStorageListener
in interface DataStorage
listener
- the listener to addpublic final boolean removeDataStorageListener(DataStorageListener listener)
DataStorage
removeDataStorageListener
in interface DataStorage
listener
- the listener to removeprotected final void fireDataManagerEvent(DataStorageEvent event)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |