de.nava.informa.utils.manager
Interface PersistenceManagerIF

All Known Implementing Classes:
NonCachingPersistenceManager, PersistenceManager, PersistenceManager, SpringPersistenceManager

public interface PersistenceManagerIF

General interface for all persistence managers. This interface defines methods, which can be safely used by client application to perform changes over persistent data.

Main assumption is that client application operates with objects (instances) created ONLY by manager instance. Some persistence implementations might be very sensitive to duplicate objects representing the same data in persistent storage.

Please take care about thread-safety of your implementation. Single instance will be shared by PersistenceManagerConfig through whole application.

Author:
Aleksey Gureev (spyromus@noizeramp.com)

Method Summary
 void addChannelToGroup(ChannelIF channel, ChannelGroupIF group)
          Adds channel to the group.
 ChannelIF createChannel(String title, URL location)
          Creates new channel object and persists it into storage.
 ChannelGroupIF createGroup(String title)
          Creates new group of channels in persistent storage.
 ItemIF createItem(ChannelIF channel, ItemIF ethalon)
          Creates new item using specified object as ethalon.
 ItemIF createItem(ChannelIF channel, String title)
          Creates new item in the channel.
 void deleteChannel(ChannelIF channel)
          Deletes channel from persistent storage.
 void deleteGroup(ChannelGroupIF group)
          Deletes group from persistent storage.
 void deleteItem(ItemIF item)
          Deletes the item from the persistent storage.
 ChannelGroupIF[] getGroups()
          Returns the list of groups available in database.
 void mergeGroups(ChannelGroupIF first, ChannelGroupIF second)
          Takes channels from the second group and put them all in first group.
 void removeChannelFromGroup(ChannelIF channel, ChannelGroupIF group)
          Deletes channel from the group.
 void updateChannel(ChannelIF channel)
          Updates data in database with data from channel object.
 void updateGroup(ChannelGroupIF group)
          Updates data in storage with data from the group object.
 void updateItem(ItemIF item)
          Updates data in database with data from item object.
 

Method Detail

createGroup

ChannelGroupIF createGroup(String title)
                           throws PersistenceManagerException
Creates new group of channels in persistent storage.

Parameters:
title - title of the group.
Returns:
initialized and persisted group object.
Throws:
PersistenceManagerException - in case of any problems.

updateGroup

void updateGroup(ChannelGroupIF group)
                 throws PersistenceManagerException
Updates data in storage with data from the group object.

Parameters:
group - group object
Throws:
PersistenceManagerException - in case of any problems.

deleteGroup

void deleteGroup(ChannelGroupIF group)
                 throws PersistenceManagerException
Deletes group from persistent storage.

Parameters:
group - group to delete.
Throws:
PersistenceManagerException - in case of any problems.

mergeGroups

void mergeGroups(ChannelGroupIF first,
                 ChannelGroupIF second)
                 throws PersistenceManagerException
Takes channels from the second group and put them all in first group. Then second group is deleted.

Parameters:
first - first group of channels.
second - second group of channels.
Throws:
PersistenceManagerException - in case of any problems.

getGroups

ChannelGroupIF[] getGroups()
                           throws PersistenceManagerException
Returns the list of groups available in database.

Returns:
list of groups.
Throws:
PersistenceManagerException - in case of any problems.

createChannel

ChannelIF createChannel(String title,
                        URL location)
                        throws PersistenceManagerException
Creates new channel object and persists it into storage.

Parameters:
title - title of the channel.
location - location of channel data resource.
Returns:
newly created object.
Throws:
PersistenceManagerException - in case of any problems.

updateChannel

void updateChannel(ChannelIF channel)
                   throws PersistenceManagerException
Updates data in database with data from channel object.

Parameters:
channel - channel object.
Throws:
PersistenceManagerException - in case of any problems.

addChannelToGroup

void addChannelToGroup(ChannelIF channel,
                       ChannelGroupIF group)
                       throws PersistenceManagerException
Adds channel to the group.

Parameters:
channel - channel to add.
group - group to use.
Throws:
PersistenceManagerException - in case of any problems.

removeChannelFromGroup

void removeChannelFromGroup(ChannelIF channel,
                            ChannelGroupIF group)
                            throws PersistenceManagerException
Deletes channel from the group. This method doesn't delete channel from persistent storage. It only breaks the association between channel and group.

Parameters:
channel - channel to delete.
group - group to use.
Throws:
PersistenceManagerException - in case of any problems.

deleteChannel

void deleteChannel(ChannelIF channel)
                   throws PersistenceManagerException
Deletes channel from persistent storage.

Parameters:
channel - channel to delete.
Throws:
PersistenceManagerException - in case of any problems.

createItem

ItemIF createItem(ChannelIF channel,
                  String title)
                  throws PersistenceManagerException
Creates new item in the channel.

Parameters:
channel - channel to put new item into.
title - title of new item.
Returns:
new item object.
Throws:
PersistenceManagerException - in case of any problems.

createItem

ItemIF createItem(ChannelIF channel,
                  ItemIF ethalon)
                  throws PersistenceManagerException
Creates new item using specified object as ethalon. Note that application could already add object to the channel and only persistent modifications required.

Parameters:
channel - channel to put new item into.
ethalon - object to copy properties values from.
Returns:
new item object.
Throws:
PersistenceManagerException - in case of any problems.

updateItem

void updateItem(ItemIF item)
                throws PersistenceManagerException
Updates data in database with data from item object.

Parameters:
item - item object.
Throws:
PersistenceManagerException - in case of any errors.

deleteItem

void deleteItem(ItemIF item)
                throws PersistenceManagerException
Deletes the item from the persistent storage.

Parameters:
item - item to delete.
Throws:
PersistenceManagerException - in case of any problems.


Copyright © 2002-2007 Niko Schmuck. All Rights Reserved.