docomentataion
authorrk <rk>
Tue, 19 Feb 2002 19:11:51 +0000 (19:11 +0000)
committerrk <rk>
Tue, 19 Feb 2002 19:11:51 +0000 (19:11 +0000)
source/mir/storage/store/ObjectStore.java
source/mir/storage/store/StoreContainer.java

index e719aad..52f52bf 100755 (executable)
@@ -7,12 +7,15 @@ package mir.storage.store;
  *
  *                @see StorageIdentifier - identitfies one object in the ObjectStore
  *                      i.e. in its apropriate bucket. It holds a unique identifier
- *                      of an Object and a reference on the Object.
+ *                      of a StorableObject and a reference on the StorableObject.
  *
  *                @see StoreContainer - "Buckets" to store different types of Objects
  *                      in one Container. These buckets are cofigurable via
  *                      config.properties.
  *
+ *                @see StoreContainerType - is a signature for all StoreContainer
+ *                      and StoreIdentifier.
+ *
  *                @see StorableObjects - Interface Object have to implement to
  *                      be handled by the ObjectStore
  *
@@ -36,10 +39,9 @@ public class ObjectStore {
   private static HashMap        containerMap=new HashMap(); // StoreContainerType/StoreContainer
   private static Logfile        storeLog;
   private static long           storeHit=0,storeMiss=0;
-  private static Class          storableObjectInterface;
+  private static Class          storableObjectInterface=StorableObject.class;
 
   private ObjectStore() {
-    storableObjectInterface=StorableObject.class;
   }
   public static ObjectStore getInstance() { return INSTANCE; }
 
@@ -49,6 +51,14 @@ public class ObjectStore {
     return ( stoc != null && stoc.has(sid) ) ? true:false;
   }
 
+  /**
+   *  Method:       use
+   *  Description:  The ObjectStore tries to find the @see StoreIdentifier sid
+   *                and returns the stored Object.
+   *
+   *  @return       StorableObject is null when no StorableObject for the
+   *                StoreIdentifier sid is found.
+   */
   public StorableObject use(StoreIdentifier sid) {
     StorableObject storeObject=null;
     StoreContainer stoc = getStoreContainerForSid( sid );
@@ -57,6 +67,11 @@ public class ObjectStore {
     return storeObject;
   }
 
+  /**
+   *  Method:       add
+   *  Description:  A StoreIdentifier is added to the ObjectStore, if it
+   *                contains a reference to a @see StorableObject.
+   */
   public void add(StoreIdentifier sid) {
     if ( sid!=null && sid.hasReference() ) {
       // find the right StoreContainer for sid
@@ -71,6 +86,13 @@ public class ObjectStore {
     }
   }
 
+  /**
+   *  Method:       toString()
+   *  Description:  Displays statistical information about the ObjectStore.
+   *                Further information is gathered from all @see StoreContainer
+   *
+   *  @return       String
+   */
   public String toString() {
 
     StringBuffer sb = new StringBuffer("Mir-ObjectStore v_");
@@ -92,6 +114,13 @@ public class ObjectStore {
 
   // internal methods for StoreContainer managment
 
+  /**
+   *  Method:       getStoreContainerForSid
+   *  Description:  private method to find the right @see StoreContainer for
+   *                the @see StoreIdentifier sid.
+   *
+   *  @return       StoreContainer is null when no Container is found.
+   */
   private StoreContainer getStoreContainerForSid(StoreIdentifier sid){
     // find apropriate container for a specific sid
     if (sid!=null) {
@@ -102,7 +131,14 @@ public class ObjectStore {
     return null;
   }
 
-  private boolean implementsStorableObject(Class aClass) {
+  /**
+   *  Method:       implementsStorableObject
+   *  Description:  internall helper method to find out if a class implements
+   *                interface StorableObject.
+   *
+   *  @return       true if yes, otherwise no.
+   */
+  private final static boolean implementsStorableObject(Class aClass) {
     boolean yesno=false;
     if (aClass!=null) {
       Class[] interfaces = aClass.getInterfaces();
@@ -116,5 +152,11 @@ public class ObjectStore {
     return yesno;
   }
 
+  /**
+   *  Method:       version()
+   *  Description:  returns ObjectStore version as String
+   *
+   *  @return       String
+   */
   private String version() { return "prototype_daytwo";}
 }
\ No newline at end of file
index d91b53a..2d700af 100755 (executable)
@@ -16,6 +16,7 @@ package mir.storage.store;
  */
 
 import java.util.*;
+import mir.misc.Logfile;
 
 public class StoreContainer {
 
@@ -56,11 +57,23 @@ public class StoreContainer {
     // size ok.
   }
 
+  /**
+   *  Method:       setSize
+   *  Description:  readjusts StoreContainer size to value.
+   *
+   */
   public void setSize(int size) {
     /** @todo  check size, if size too big, shrink  */
     this.maxSize=size;
   }
 
+  /**
+   *  Method:       toString()
+   *  Description:  gives out statistical Information, viewable via
+   *                @see ServletStoreInfo.
+   *
+   *  @return       String
+   */
   public String toString() {
     StringBuffer sb = new StringBuffer("StoreContainer for ");
     sb.append(stocType.toString()).append("\nCurrent size: ");