*
* @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
*
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; }
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 );
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
}
}
+ /**
+ * 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_");
// 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) {
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();
return yesno;
}
+ /**
+ * Method: version()
+ * Description: returns ObjectStore version as String
+ *
+ * @return String
+ */
private String version() { return "prototype_daytwo";}
}
\ No newline at end of file
*/
import java.util.*;
+import mir.misc.Logfile;
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: ");