fr.cnes.sitools.persistence
Class XmlPersistenceDaoImpl<E extends Persistent>

java.lang.Object
  extended by fr.cnes.sitools.persistence.XmlPersistenceDaoImpl<E>
Type Parameters:
E - Element must extend Persistent
All Implemented Interfaces:
PersistenceDao<E>
Direct Known Subclasses:
ApplicationPluginStoreXmlImpl, DataStorageStoreXmlImpl, PortalStoreXmlImpl

public abstract class XmlPersistenceDaoImpl<E extends Persistent>
extends java.lang.Object
implements PersistenceDao<E>

Generic implementation of PersistenceDao.

Author:
jp.boignard (AKKA Technologies)

Constructor Summary
XmlPersistenceDaoImpl(java.io.File storageRoot, org.restlet.Context context)
          Constructor for file based persistence
 
Method Summary
 void delete(E o)
          Delete an element
 E get(java.lang.String id)
          Get an element by ID
 java.util.Collection<E> getList()
          Get the list of elements
 java.util.Collection<E> getList(ResourceCollectionFilter filter)
          Get the list of elements
 java.util.Collection<E> getPage(ResourceCollectionFilter filter, java.util.Collection<E> result)
          Get the list of elements
 com.thoughtworks.xstream.XStream getXstream()
          Gets the xstream value
 void save(E o)
          Save an element
 void saveAll(java.util.Collection<E> os)
          Save a collection of elements
 void setXstream(com.thoughtworks.xstream.XStream xstream)
          Sets the value of xstream
 void update(E o)
          Update an element
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlPersistenceDaoImpl

public XmlPersistenceDaoImpl(java.io.File storageRoot,
                             org.restlet.Context context)
Constructor for file based persistence

Parameters:
storageRoot - - the base dir where all the xml files will be saved
context - TODO
Method Detail

getXstream

public final com.thoughtworks.xstream.XStream getXstream()
Gets the xstream value

Returns:
the xstream

setXstream

public final void setXstream(com.thoughtworks.xstream.XStream xstream)
Sets the value of xstream

Parameters:
xstream - the xstream to set

get

public final E get(java.lang.String id)
Description copied from interface: PersistenceDao
Get an element by ID

Specified by:
get in interface PersistenceDao<E extends Persistent>
Parameters:
id - the ID
Returns:
an element

save

public final void save(E o)
Description copied from interface: PersistenceDao
Save an element

Specified by:
save in interface PersistenceDao<E extends Persistent>
Parameters:
o - the element to save

update

public final void update(E o)
Description copied from interface: PersistenceDao
Update an element

Specified by:
update in interface PersistenceDao<E extends Persistent>
Parameters:
o - the element to save

saveAll

public final void saveAll(java.util.Collection<E> os)
Description copied from interface: PersistenceDao
Save a collection of elements

Specified by:
saveAll in interface PersistenceDao<E extends Persistent>
Parameters:
os - the collection to save

getList

public final java.util.Collection<E> getList()
Description copied from interface: PersistenceDao
Get the list of elements

Specified by:
getList in interface PersistenceDao<E extends Persistent>
Returns:
the list

getList

public java.util.Collection<E> getList(ResourceCollectionFilter filter)
Description copied from interface: PersistenceDao
Get the list of elements

Specified by:
getList in interface PersistenceDao<E extends Persistent>
Parameters:
filter - query filter
Returns:
the list

getPage

public final java.util.Collection<E> getPage(ResourceCollectionFilter filter,
                                             java.util.Collection<E> result)
Description copied from interface: PersistenceDao
Get the list of elements

Specified by:
getPage in interface PersistenceDao<E extends Persistent>
Parameters:
filter - query filter
result - the full result list
Returns:
the list

delete

public final void delete(E o)
Description copied from interface: PersistenceDao
Delete an element

Specified by:
delete in interface PersistenceDao<E extends Persistent>
Parameters:
o - the element to delete


Copyright © 2010-2013 CNES. All Rights Reserved.