1 18 package org.apache.activemq.kaha.impl.index; 19 20 import java.io.DataInput ; 21 import java.io.DataOutput ; 22 import java.io.Externalizable ; 23 import java.io.IOException ; 24 import java.io.ObjectInput ; 25 import java.io.ObjectOutput ; 26 27 import org.apache.activemq.kaha.Marshaller; 28 29 public class RedoStoreIndexItem implements Externalizable { 30 31 public static final Marshaller MARSHALLER = new Marshaller() { 32 public Object readPayload(DataInput in) throws IOException { 33 RedoStoreIndexItem item = new RedoStoreIndexItem(); 34 item.readExternal(in); 35 return item; 36 } 37 38 public void writePayload(Object object, DataOutput out) throws IOException { 39 RedoStoreIndexItem item = (RedoStoreIndexItem) object; 40 item.writeExternal(out); 41 } 42 }; 43 44 private static final long serialVersionUID = -4865508871719676655L; 45 private String indexName; 46 private IndexItem indexItem; 47 private long offset; 48 49 public RedoStoreIndexItem() { 50 } 51 public RedoStoreIndexItem(String indexName, long offset, IndexItem item) { 52 this.indexName = indexName; 53 this.offset=offset; 54 this.indexItem = item; 55 } 56 57 public void readExternal(ObjectInput in) throws IOException , ClassNotFoundException { 58 readExternal((DataInput )in); 59 } 60 public void readExternal(DataInput in) throws IOException { 61 offset = in.readLong(); 63 indexItem = new IndexItem(); 64 indexItem.read(in); 65 } 66 67 public void writeExternal(ObjectOutput out) throws IOException { 68 writeExternal((DataOutput )out); 69 } 70 public void writeExternal(DataOutput out) throws IOException { 71 out.writeLong(offset); 73 indexItem.write(out); 74 } 75 76 public String getIndexName() { 77 return indexName; 78 } 79 public void setIndexName(String indexName) { 80 this.indexName = indexName; 81 } 82 83 public IndexItem getIndexItem() { 84 return indexItem; 85 } 86 public void setIndexItem(IndexItem item) { 87 this.indexItem = item; 88 } 89 public long getOffset() { 90 return offset; 91 } 92 public void setOffset(long offset) { 93 this.offset = offset; 94 } 95 96 } 97 | Popular Tags |