Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 9 package org.ozoneDB; 10 11 import org.ozoneDB.core.ObjectContainer; 12 import org.ozoneDB.core.ObjectID; 13 import org.xml.sax.ContentHandler ; 14 import org.xml.sax.SAXException ; 15 16 17 24 public class OzoneObject implements OzoneCompatible { 25 26 final static long serialVersionUID = 3171995582505722338L; 27 28 transient ObjectContainer container = null; 29 30 31 public int hashCode() { 32 return container.id().hashCode(); 33 } 34 35 36 public synchronized void setContainer(ObjectContainer _container) { 37 container = _container; 38 } 39 40 41 public OzoneProxy self() { 42 if (container == null) { 43 throw new RuntimeException ("The object of class " + this.getClass().getName() + " is not (yet) associated to a database container."); 44 } 45 return container.ozoneProxy(); 46 } 47 48 49 public ObjectContainer container() { 50 if (container == null) { 51 throw new RuntimeException ("The object of class " + this.getClass().getName() + " is not (yet) associated to a database container."); 52 } 53 return container; 54 } 55 56 72 public String getHandle() { 73 if (container == null) { 74 throw new RuntimeException ("The object of class " + this.getClass().getName() + " is not (yet) associated to a database container."); 75 } 76 return container.id().toString(); 77 } 78 79 82 public String handle() { 83 return getHandle(); 84 } 85 86 public OzoneInterface database() { 87 if (container == null) { 88 return CurrentDatabase.get(); 89 } 90 return container.database(); 91 } 92 93 94 public String toString() { 95 return "OzoneObject, ID: " + (container != null ? container.id().toString() : "null"); 96 } 97 98 99 102 public void onCreate() { 103 } 104 105 110 public void onActivate() { 111 } 113 114 134 protected void requireWriteLocking() { 135 container.requireWriteLocking(); 136 } 137 138 142 public void onPassivate() { 143 } 145 146 149 public void onDelete() { 150 } 151 152 153 162 163 164 168 public boolean toXML(ContentHandler ch) throws SAXException { 169 return false; 170 } 171 172 173 public void deleteRecursive() { 174 throw new RuntimeException ("deleteRecursive() is not implemented yet."); 175 } 176 177 188 public ObjectID getObjectID() { 189 return container.id(); 190 } 191 192 201 public boolean equals(Object o) { 202 if (o == this) { 206 return true; 207 } else if (o instanceof OzoneObject && getObjectID().equals(((OzoneObject) o).getObjectID())) { 208 return true; 209 } else { 210 return o instanceof OzoneProxy && getObjectID().equals(((OzoneProxy) o).getObjectID()); 211 } 212 } 213 214 } 215 216
| Popular Tags
|