01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.components.store;
18:
19: import org.apache.avalon.framework.component.Component;
20:
21: import java.io.IOException;
22: import java.util.Enumeration;
23:
24: /**
25: *
26: * @deprecated Use the Avalon Excalibur Store instead.
27: *
28: * @author <a href="mailto:scoobie@betaversion.org">Federico Barbieri</a>
29: * (Betaversion Productions)
30: * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
31: * (Apache Software Foundation)
32: * @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
33: * (Apache Software Foundation)
34: * @version CVS $Id: Store.java 433543 2006-08-22 06:22:54Z crossley $
35: */
36: public interface Store extends Component {
37:
38: String ROLE = "org.apache.cocoon.components.store.Store/Repository";
39:
40: String TRANSIENT_CACHE = "org.apache.cocoon.components.store.Store/TransientCache";
41: String PERSISTENT_CACHE = "org.apache.cocoon.components.store.Store/PersistentCache";
42:
43: /**
44: * Get the object associated to the given unique key.
45: */
46: Object get(Object key);
47:
48: /**
49: * Store the given object in a persistent state. It is up to the
50: * caller to ensure that the key has a persistent state across
51: * different JVM executions.
52: */
53: void store(Object key, Object value) throws IOException;
54:
55: /**
56: * Holds the given object in a volatile state. This means
57: * the object store will discard held objects if the
58: * virtual machine is restarted or some error happens.
59: */
60: void hold(Object key, Object value) throws IOException;
61:
62: void free();
63:
64: /**
65: * Remove the object associated to the given key.
66: */
67: void remove(Object key);
68:
69: /**
70: * Indicates if the given key is associated to a contained object.
71: */
72: boolean containsKey(Object key);
73:
74: /**
75: * Returns the list of used keys as an Enumeration of Objects.
76: */
77: Enumeration keys();
78:
79: /**
80: * Returns count of the objects in the store, or -1 if could not be
81: * obtained.
82: */
83: int size();
84: }
|