1 package car; 2 3 5 import org.ozoneDB.*; 6 import org.ozoneDB.core.ObjectID; 7 import org.ozoneDB.core.ObjectContainer; 8 import org.xml.sax.ContentHandler ; 9 import org.xml.sax.SAXException ; 10 11 12 public class AutoImpl implements Auto, OzoneCompatible { 13 14 18 final static long serialVersionUID = 1L; 19 20 String name = "Ford"; 21 22 int age = 0; 23 24 Auto link; 25 26 OzoneObject ozoneObject; 27 28 29 public AutoImpl(String foo, int i) { 30 ozoneObject = new OzoneObject(); 31 System.out.println(getClass().getName() + " Autoimpl(" + foo + ", " + i + ")"); 32 } 33 34 35 public boolean equals(Object obj) { 36 Auto auto = (Auto) obj; 37 return name.equals(auto.name()); 38 } 39 40 41 public Auto doSomething(Auto auto) throws Exception { 42 System.out.println("got: " + auto.toString() + " (" + auto.getClass().getName() + ")"); 43 return this; 44 } 45 46 47 public Auto setLink(Auto auto) throws Exception { 48 link = auto; 50 return this; 51 } 52 53 54 public void print() { 55 System.out.println(toString()); 56 } 57 58 59 public void setName(String newName) { 60 name = newName; 61 } 62 63 64 public String name() { 65 return name; 66 } 67 68 69 public void setAge(Integer newAge) { 70 age = newAge.intValue(); 71 } 73 74 75 public int setAge(int newAge) { 76 int result = age; 77 age = newAge; 78 return result; 79 } 80 81 82 public Integer age() { 83 return new Integer (age); 84 } 85 86 87 public String toString() { 88 return "car.Auto:" + name + ", " + String.valueOf(age); 90 } 91 92 93 public void done() throws Exception { 94 } 96 97 public ObjectID getObjectID() { 98 return ozoneObject.getObjectID(); 99 } 100 101 public void setContainer(ObjectContainer objectContainer) { 102 ozoneObject.setContainer(objectContainer); 103 } 104 105 public ObjectContainer container() { 106 return ozoneObject.container(); 107 } 108 109 public OzoneProxy self() { 110 return ozoneObject.self(); 111 } 112 113 public OzoneInterface database() { 114 return ozoneObject.database(); 115 } 116 117 public void onCreate() { 118 System.out.println("created"); 119 } 120 121 public void onActivate() { 122 System.out.println("activated"); 123 } 124 125 public void onPassivate() { 126 System.out.println("passivated"); 127 } 128 129 public void onDelete() { 130 System.out.println("deleted"); 131 } 132 133 public boolean toXML(ContentHandler contentHandler) throws SAXException { 134 return ozoneObject.toXML(contentHandler); 135 } 136 137 } 138 | Popular Tags |