1 package mir.storage.store;
4 * Title: Class StoreIdentifier
6 * Copyright: Copyright (c) 2002
12 import mir.misc.Logfile;
14 public class StoreIdentifier {
16 /** @todo move main stuff to storecontainertype */
18 private static Logfile storeLog;
20 private StoreContainerType stocType=null;
21 private StorableObject reference=null;
22 private String uniqueIdentifier=null; // id for Entity & sql for EntityList
23 private long timesUsed;
25 /** @todo initialize logfile */
27 private StoreIdentifier() {}
29 public StoreIdentifier(StorableObject reference, int storeType, String uniqueIdentifier) {
30 this.reference=reference;
31 this.uniqueIdentifier=uniqueIdentifier;
32 this.stocType = StoreContainerType.valueOf(reference.getClass(), storeType);
35 public void invalidate() {
36 Set set = reference.notifyOnReleaseSet();
37 /** @todo here we should propagate the invalidation all members of Set
38 * @see StoreContainer */
41 this.uniqueIdentifier=null;
51 * Method equals for comparison between two identifier
53 * @return true if yes otherwise false
56 public boolean equals(StoreIdentifier sid) {
57 // compare al relevant fields, most likely difference first
58 /** @todo doubecheck with book */
63 public StoreContainerType getStoreContainerType() { return stocType; }
64 public boolean hasReference() { return (reference==null) ? false:true; }
66 public String toString() {
67 return reference.getClass()+"@storetype"+stocType.toString()+"."
68 +uniqueIdentifier+" ("+timesUsed+") times used )";