KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > nava > informa > utils > manager > PersistenceManagerIF


1 //
2
// Informa -- RSS Library for Java
3
// Copyright (c) 2002 by Niko Schmuck
4
//
5
// Niko Schmuck
6
// http://sourceforge.net/projects/informa
7
// mailto:niko_schmuck@users.sourceforge.net
8
//
9
// This library is free software.
10
//
11
// You may redistribute it and/or modify it under the terms of the GNU
12
// Lesser General Public License as published by the Free Software Foundation.
13
//
14
// Version 2.1 of the license should be included with this distribution in
15
// the file LICENSE. If the license is not included with this distribution,
16
// you may find a copy at the FSF web site at 'www.gnu.org' or 'www.fsf.org',
17
// or you may write to the Free Software Foundation, 675 Mass Ave, Cambridge,
18
// MA 02139 USA.
19
//
20
// This library is distributed in the hope that it will be useful,
21
// but WITHOUT ANY WARRANTY; without even the implied waranty of
22
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
// Lesser General Public License for more details.
24
//
25
// $Id: PersistenceManagerIF.java,v 1.2 2004/09/02 09:11:12 spyromus Exp $
26
//
27

28 package de.nava.informa.utils.manager;
29
30 import de.nava.informa.core.ChannelGroupIF;
31 import de.nava.informa.core.ChannelIF;
32 import de.nava.informa.core.ItemIF;
33
34 import java.net.URL JavaDoc;
35
36 /**
37  * General interface for all persistence managers. This interface defines methods, which can be
38  * safely used by client application to perform changes over persistent data.
39  * <p/>
40  * Main assumption is that client application operates with objects (instances) created <b>ONLY</b>
41  * by manager instance. Some persistence implementations might be very sensitive to duplicate
42  * objects representing the same data in persistent storage.
43  * <p/>
44  * <b>Please take care about thread-safety of your implementation.</b> Single instance will
45  * be shared by <code>PersistenceManagerConfig</code> through whole application.
46  *
47  * @author Aleksey Gureev (spyromus@noizeramp.com)
48  */

49 public interface PersistenceManagerIF {
50   /**
51    * Creates new group of channels in persistent storage.
52    *
53    * @param title title of the group.
54    * @return initialized and persisted group object.
55    *
56    * @throws PersistenceManagerException in case of any problems.
57    */

58   ChannelGroupIF createGroup(String JavaDoc title)
59     throws PersistenceManagerException;
60
61   /**
62    * Updates data in storage with data from the group object.
63    *
64    * @param group group object
65    *
66    * @throws PersistenceManagerException in case of any problems.
67    */

68   void updateGroup(ChannelGroupIF group)
69     throws PersistenceManagerException;
70
71   /**
72    * Deletes group from persistent storage.
73    *
74    * @param group group to delete.
75    *
76    * @throws PersistenceManagerException in case of any problems.
77    */

78   void deleteGroup(ChannelGroupIF group)
79     throws PersistenceManagerException;
80
81   /**
82    * Takes channels from the <code>second</code> group and put them all in <code>first</code>
83    * group. Then <code>second</code> group is deleted.
84    *
85    * @param first first group of channels.
86    * @param second second group of channels.
87    *
88    * @throws PersistenceManagerException in case of any problems.
89    */

90   void mergeGroups(ChannelGroupIF first, ChannelGroupIF second)
91     throws PersistenceManagerException;
92
93   /**
94    * Returns the list of groups available in database.
95    *
96    * @return list of groups.
97    *
98    * @throws PersistenceManagerException in case of any problems.
99    */

100   ChannelGroupIF[] getGroups()
101     throws PersistenceManagerException;
102
103   /**
104    * Creates new channel object and persists it into storage.
105    *
106    * @param title title of the channel.
107    * @param location location of channel data resource.
108    * @return newly created object.
109    *
110    * @throws PersistenceManagerException in case of any problems.
111    */

112   ChannelIF createChannel(String JavaDoc title, URL JavaDoc location)
113     throws PersistenceManagerException;
114
115   /**
116    * Updates data in database with data from channel object.
117    *
118    * @param channel channel object.
119    *
120    * @throws PersistenceManagerException in case of any problems.
121    */

122   void updateChannel(ChannelIF channel)
123     throws PersistenceManagerException;
124
125   /**
126    * Adds <code>channel</code> to the <code>group</code>.
127    *
128    * @param channel channel to add.
129    * @param group group to use.
130    *
131    * @throws PersistenceManagerException in case of any problems.
132    */

133   void addChannelToGroup(ChannelIF channel, ChannelGroupIF group)
134     throws PersistenceManagerException;
135
136   /**
137    * Deletes <code>channel</code> from the <code>group</code>.
138    * This method doesn't delete channel from persistent storage. It only
139    * breaks the association between channel and group.
140    *
141    * @param channel channel to delete.
142    * @param group group to use.
143    *
144    * @throws PersistenceManagerException in case of any problems.
145    */

146   void removeChannelFromGroup(ChannelIF channel, ChannelGroupIF group)
147     throws PersistenceManagerException;
148
149   /**
150    * Deletes channel from persistent storage.
151    *
152    * @param channel channel to delete.
153    *
154    * @throws PersistenceManagerException in case of any problems.
155    */

156   void deleteChannel(ChannelIF channel)
157     throws PersistenceManagerException;
158
159   /**
160    * Creates new item in the channel.
161    *
162    * @param channel channel to put new item into.
163    * @param title title of new item.
164    * @return new item object.
165    *
166    * @throws PersistenceManagerException in case of any problems.
167    */

168   ItemIF createItem(ChannelIF channel, String JavaDoc title)
169     throws PersistenceManagerException;
170
171   /**
172    * Creates new item using specified object as ethalon.
173    * <b>Note that application <i>could</i> already add object to the channel and
174    * only persistent modifications required.</b>
175    *
176    * @param channel channel to put new item into.
177    * @param ethalon object to copy properties values from.
178    * @return new item object.
179    *
180    * @throws PersistenceManagerException in case of any problems.
181    */

182   ItemIF createItem(ChannelIF channel, ItemIF ethalon)
183     throws PersistenceManagerException;
184
185   /**
186    * Updates data in database with data from item object.
187    *
188    * @param item item object.
189    *
190    * @throws PersistenceManagerException in case of any errors.
191    */

192   void updateItem(ItemIF item)
193     throws PersistenceManagerException;
194
195   /**
196    * Deletes the item from the persistent storage.
197    *
198    * @param item item to delete.
199    *
200    * @throws PersistenceManagerException in case of any problems.
201    */

202   void deleteItem(ItemIF item)
203     throws PersistenceManagerException;
204 }
205
Popular Tags