1 21 package com.db4o.inside.marshall; 22 23 import com.db4o.*; 24 import com.db4o.inside.*; 25 26 27 30 public class UntypedMarshaller0 extends UntypedMarshaller { 31 32 public void deleteEmbedded(YapWriter parentBytes) { 33 int objectID = parentBytes.readInt(); 34 if (objectID > 0) { 35 YapWriter reader = 36 parentBytes.getStream().readWriterByID(parentBytes.getTransaction(), objectID); 37 if (reader != null) { 38 reader.setCascadeDeletes(parentBytes.cascadeDeletes()); 39 ObjectHeader oh = new ObjectHeader(reader); 40 if(oh.yapClass() != null){ 41 oh.yapClass().deleteEmbedded1(_family, reader, objectID); 42 } 43 } 44 } 45 } 46 47 public boolean useNormalClassRead(){ 48 return true; 49 } 50 51 52 public Object read(YapWriter reader) { 53 throw Exceptions4.shouldNeverBeCalled(); 54 } 55 56 public Object readQuery(Transaction trans, YapReader reader, boolean toArray) throws CorruptionException{ 57 throw Exceptions4.shouldNeverBeCalled(); 58 } 59 60 61 public TypeHandler4 readArrayHandler(Transaction a_trans, YapReader[] a_bytes) { 62 int id = 0; 63 64 int offset = a_bytes[0]._offset; 65 try { 66 id = a_bytes[0].readInt(); 67 } catch (Exception e) { 68 } 69 a_bytes[0]._offset = offset; 70 71 if (id != 0) { 72 YapWriter reader = 73 a_trans.stream().readWriterByID(a_trans, id); 74 if (reader != null) { 75 ObjectHeader oh = new ObjectHeader(reader); 76 try { 77 if (oh.yapClass() != null) { 78 a_bytes[0] = reader; 79 return oh.yapClass().readArrayHandler1(a_bytes); 80 } 81 } catch (Exception e) { 82 83 if(Debug.atHome){ 84 e.printStackTrace(); 85 } 86 87 } 90 } 91 } 92 return null; 93 } 94 95 public QCandidate readSubCandidate(YapReader reader, QCandidates candidates, boolean withIndirection) { 96 return null; 97 } 98 99 public Object writeNew(Object a_object, boolean restoreLinkOffset, YapWriter a_bytes) { 100 if (a_object == null) { 101 a_bytes.writeInt(0); 102 return new Integer (0); 103 } 104 105 int id = a_bytes.getStream().setInternal( 106 a_bytes.getTransaction(), 107 a_object, 108 a_bytes.getUpdateDepth(), true); 109 110 a_bytes.writeInt(id); 111 return new Integer (id); 112 } 113 114 public void defrag(ReaderPair readers) { 115 } 117 } 118 | Popular Tags |