1 package mir.storage.store;
4 * Title: ObjectStore for StorableObjects
5 * Description: ObjectStore holds a Map of @see StoreContainer for all possible
6 * @see StoreIdentifier.
8 * @see StorageIdentifier - identitfies one object in the ObjectStore
9 * i.e. in its apropriate bucket. It holds a unique identifier
10 * of an Object and a reference on the Object.
12 * @see StoreContainer - "Buckets" to store different types of Objects
13 * in one Container. These buckets are cofigurable via
16 * @see StorableObjects - Interface Object have to implement to
17 * be handled by the ObjectStore
19 * @see ServletStoreInfo - Maintenance Servlet for ObjectStore.
20 * Displays information about current content of the
24 * Copyright: Copyright (c) 2002
32 public class ObjectStore {
34 private static ObjectStore INSTANCE=new ObjectStore();
35 private static HashMap containerMap=new HashMap(); // StoreIdentifier/StoreContainer
37 private ObjectStore() { }
39 public ObjectStore getInstance() { return INSTANCE; }
42 public boolean has(StoreIdentifier sid) {
43 StoreContainer stoc = getStoreContainerForSid( sid );
44 return ( stoc != null && stoc.has(sid) ) ? true:false;
47 public Object use(StoreIdentifier sid) {
49 StoreContainer stoc = getStoreContainerForSid( sid );
55 public void add(StoreIdentifier sid) {
56 // find right container
57 // if no container create container
61 // internal methods for StoreContainer managment
64 private StoreContainer getStoreContainerForSid(StoreIdentifier sid){
65 // find apropraiate container for a specific sid