KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > remoting > SerializableStore


1 package org.jboss.remoting;
2
3 import java.io.IOException JavaDoc;
4 import java.io.Serializable JavaDoc;
5 import java.util.Map JavaDoc;
6
7 /**
8  * @author <a HREF="mailto:telrod@e2technologies.net">Tom Elrod</a>
9  */

10 public interface SerializableStore
11 {
12    /**
13     * Getst the number of objects stored and available.
14     *
15     * @return
16     */

17    int size();
18
19    /**
20     * Will look through the files in the store directory for the oldest object serialized to disk, load it,
21     * delete the file, and return the deserialized object.
22     * Important to note that once this object is returned from this method, it is gone forever from this
23     * store and will not be able to retrieve it again without adding it back.
24     *
25     * @return
26     * @throws java.io.IOException
27     */

28    Object JavaDoc getNext() throws IOException JavaDoc;
29
30    /**
31     * Persists the serializable object passed to the directory specified. The file name will be the current time
32     * in milliseconds (vis System.currentTimeMillis()) with the specified suffix. This object can later be
33     * retrieved using the getNext() method, but objects will be returned in the order that they were added (FIFO).
34     *
35     * @param object
36     * @throws java.io.IOException
37     */

38    void add(Serializable JavaDoc object) throws IOException JavaDoc;
39
40    /**
41     * Will use the values in the map to set configuration.
42     *
43     * @param config
44     */

45    void setConfig(Map JavaDoc config);
46
47    /**
48     * Will get the file path value (if not already set will just use the
49     * default setting) and will create the directory specified by the file path
50     * if it does not already exist.
51     *
52     * @throws Exception
53     */

54    void start() throws Exception JavaDoc;
55
56    /**
57     * This will allow for change of file suffix and file path and then may start again
58     * using these new values. However, any object already written out using the old
59     * values will be lost as will not longer be accessible if these attributes are changed while stopped.
60     */

61    void stop();
62
63    /**
64     * This is a no op method, but needed in order to be used as a service within JBoss AS.
65     *
66     * @throws Exception
67     */

68    void create() throws Exception JavaDoc;
69
70    /**
71     * This is a no op method, but needed in order to be used as a service within JBoss AS.
72     */

73    void destroy();
74
75    /**
76     * Sets if store should clean up persisted files when shutdown (destroy()).
77     *
78     * @param purgeOnShutdown
79     */

80    void setPurgeOnShutdown(boolean purgeOnShutdown);
81
82    /**
83     * Returns if store will clean up persisted files when shutdown (destroy()).
84     *
85     * @return
86     */

87    boolean getPurgeOnShutdown();
88
89    void purgeFiles();
90 }
91
Popular Tags