1 /*
2 * Copyright (c) 2003-2008 by Cosylab d. d.
3 *
4 * This file is part of Java-Common.
5 *
6 * Java-Common is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Java-Common is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Java-Common. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 package com.cosylab.application.state;
21
22 import java.io.IOException;
23 import java.io.InputStream;
24 import java.io.OutputStream;
25
26 import java.util.Iterator;
27 import java.util.List;
28
29
30 /**
31 * This interface should be implemented by the objects which will be used for
32 * storing and restoring an array of the <code>State</code> objects.
33 *
34 * @author dvitas
35 */
36 public interface StateStorage
37 {
38 /**
39 * Adds new state to storage.
40 *
41 * @param state the state to be added
42 */
43 public void add(State state);
44
45 /**
46 * DOCUMENT ME!
47 *
48 * @param states DOCUMENT ME!
49 */
50 public void addAll(List states);
51
52 /**
53 * DOCUMENT ME!
54 *
55 * @return DOCUMENT ME!
56 */
57 public List getStates();
58
59 /**
60 * DOCUMENT ME! TODO: Add load(InputStream, String) to support loading
61 * from non-file sources!
62 *
63 * @param filePath DOCUMENT ME!
64 * @param applicationName DOCUMENT ME!
65 *
66 * @throws IOException DOCUMENT ME!
67 */
68 public void load(String filePath, String applicationName)
69 throws IOException;
70
71 /**
72 * DOCUMENT ME!
73 *
74 * @param stream DOCUMENT ME!
75 *
76 * @throws IOException DOCUMENT ME!
77 */
78 public void load(InputStream stream) throws IOException;
79
80 /**
81 * DOCUMENT ME!
82 *
83 * @param filePath DOCUMENT ME!
84 * @param applicationName DOCUMENT ME!
85 *
86 * @throws IOException DOCUMENT ME!
87 */
88 public void store(String filePath, String applicationName)
89 throws IOException;
90
91 /**
92 * DOCUMENT ME!
93 *
94 * @param stream
95 *
96 * @throws IOException DOCUMENT ME!
97 */
98 public void store(OutputStream stream) throws IOException;
99
100 /**
101 * DOCUMENT ME!
102 *
103 * @param st DOCUMENT ME!
104 */
105 public void remove(State st);
106
107 /**
108 * DOCUMENT ME!
109 *
110 * @param st DOCUMENT ME!
111 *
112 * @return DOCUMENT ME!
113 */
114 public boolean contains(State st);
115
116 /**
117 * Rerurns iterator over states.
118 *
119 * @return iterator over states
120 */
121 public Iterator iterator();
122 }
123
124 /* __oOo__ */