© 2006-2007 ETH Zurich

org.ximtec.igesture.storage
Class DefaultFileStorageEngine

java.lang.Object
  extended by org.ximtec.igesture.storage.DefaultStorageEngine
      extended by org.ximtec.igesture.storage.DefaultFileStorageEngine
All Implemented Interfaces:
StorageEngine
Direct Known Subclasses:
XMLStorageEngine, ZipStorageEngine

public abstract class DefaultFileStorageEngine
extends DefaultStorageEngine


Constructor Summary
DefaultFileStorageEngine(File file)
          Constructor
 
Method Summary
 void commit()
          Commits the Transaction
protected abstract  HashMap<Class<? extends DataObject>,List<DataObject>> deserialize(File storageFile)
          Deserializes the objects
 void dispose()
          Disposes the engine.
 File getStorageFile()
           
protected  boolean isDoChanged()
          Returns true, if the data model has changed since the last storage/load operation.
<T extends DataObject>
List<T>
load(Class<T> clazz)
          Loads a collection of data objects of a given type.
<T extends DataObject>
T
load(Class<T> clazz, String id)
          Loads a data object of a specific type.
 void remove(DataObject dataObject)
          Removes a data object.
protected  void removeDataObject(DataObject dataObject)
          Removes a data object from the object container.
protected abstract  void serialize(HashMap<Class<? extends DataObject>,List<DataObject>> objects, File file)
          Serializes the data objects.
protected  void setDoChanged(boolean doChanged)
          Sets the flag indicating if the data model has changed since the last storage/load operation.
 void setStorageFile(File storageFile)
           
 void store(DataObject dataObject)
          Stores a data object.
 void update(DataObject dataObject)
          Updates a data object.
 
Methods inherited from class org.ximtec.igesture.storage.DefaultStorageEngine
load
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ximtec.igesture.storage.StorageEngine
copyTo
 

Constructor Detail

DefaultFileStorageEngine

public DefaultFileStorageEngine(File file)
Constructor

Parameters:
file -
Method Detail

commit

public void commit()
Description copied from interface: StorageEngine
Commits the Transaction


deserialize

protected abstract HashMap<Class<? extends DataObject>,List<DataObject>> deserialize(File storageFile)
Deserializes the objects

Parameters:
storageFile -
Returns:

dispose

public void dispose()
Description copied from interface: StorageEngine
Disposes the engine.


getStorageFile

public File getStorageFile()

load

public <T extends DataObject> List<T> load(Class<T> clazz)
Description copied from interface: StorageEngine
Loads a collection of data objects of a given type. In general this method returns all instances of the specific type.


load

public <T extends DataObject> T load(Class<T> clazz,
                                     String id)
Description copied from interface: StorageEngine
Loads a data object of a specific type.


remove

public void remove(DataObject dataObject)
Description copied from interface: StorageEngine
Removes a data object.


removeDataObject

protected void removeDataObject(DataObject dataObject)
Removes a data object from the object container.

Parameters:
dataObject - the data object to be removed.

serialize

protected abstract void serialize(HashMap<Class<? extends DataObject>,List<DataObject>> objects,
                                  File file)
Serializes the data objects.

Parameters:
objects -
file -

setStorageFile

public void setStorageFile(File storageFile)

store

public void store(DataObject dataObject)
Description copied from interface: StorageEngine
Stores a data object. The engine is responsible to set an unique id to the data object.


update

public void update(DataObject dataObject)
Description copied from interface: StorageEngine
Updates a data object.


setDoChanged

protected void setDoChanged(boolean doChanged)
Sets the flag indicating if the data model has changed since the last storage/load operation.

Parameters:
doChanged -

isDoChanged

protected boolean isDoChanged()
Returns true, if the data model has changed since the last storage/load operation.

Returns:
true if the data model has changed.

© 2006-2007 ETH Zurich

Copyright © 2007-2010 Global Information Systems Group, ETH Zurich. All Rights Reserved.