object store - first draft work in progress
[mir.git] / source / mir / storage / store / ObjectStore.java
1 package mir.storage.store;
2
3 /**
4  * Title:         ObjectStore for StorableObjects
5  * Description:   ObjectStore holds a Map of @see StoreContainer for all possible
6  *                @see StoreIdentifier.
7  *
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.
11  *
12  *                @see StoreContainer - "Buckets" to store different types of Objects
13  *                      in one Container. These buckets are cofigurable via
14  *                      config.properties.
15  *
16  *                @see StorableObjects - Interface Object have to implement to
17  *                      be handled by the ObjectStore
18  *
19  *                @see ServletStoreInfo - Maintenance Servlet for ObjectStore.
20  *                      Displays information about current content of the
21  *                      ObjectStore.
22  *
23  *
24  * Copyright:     Copyright (c) 2002
25  * Company:       indy
26  * @author        rk
27  * @version 1.0
28  */
29
30 import java.util.*;
31
32 public class ObjectStore {
33
34   private static ObjectStore    INSTANCE=new ObjectStore();
35   private static HashMap        containerMap=new HashMap(); // StoreIdentifier/StoreContainer
36
37   private ObjectStore() { }
38
39   public ObjectStore getInstance() { return INSTANCE; }
40
41
42   public boolean has(StoreIdentifier sid) {
43     StoreContainer stoc = getStoreContainerForSid( sid );
44     return ( stoc != null && stoc.has(sid) ) ? true:false;
45   }
46
47   public Object use(StoreIdentifier sid) {
48     if ( has(sid) ) {
49       StoreContainer stoc = getStoreContainerForSid( sid );
50       return stoc.use(sid);
51     }
52     return null;
53   }
54
55   public void add(StoreIdentifier sid) {
56     // find right container
57     // if no container create container
58     // add there
59   }
60
61   // internal methods for StoreContainer managment
62
63
64   private StoreContainer getStoreContainerForSid(StoreIdentifier sid){
65     // find apropraiate container for a specific sid
66     return null;
67   }
68
69
70
71 }