KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > kaha > impl > index > RedoStoreIndexItem


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.kaha.impl.index;
19
20 import java.io.DataInput JavaDoc;
21 import java.io.DataOutput JavaDoc;
22 import java.io.Externalizable JavaDoc;
23 import java.io.IOException JavaDoc;
24 import java.io.ObjectInput JavaDoc;
25 import java.io.ObjectOutput JavaDoc;
26
27 import org.apache.activemq.kaha.Marshaller;
28
29 public class RedoStoreIndexItem implements Externalizable JavaDoc {
30
31     public static final Marshaller MARSHALLER = new Marshaller() {
32         public Object JavaDoc readPayload(DataInput JavaDoc in) throws IOException JavaDoc {
33             RedoStoreIndexItem item = new RedoStoreIndexItem();
34             item.readExternal(in);
35             return item;
36         }
37
38         public void writePayload(Object JavaDoc object, DataOutput JavaDoc out) throws IOException JavaDoc {
39             RedoStoreIndexItem item = (RedoStoreIndexItem) object;
40             item.writeExternal(out);
41         }
42     };
43     
44     private static final long serialVersionUID = -4865508871719676655L;
45     private String JavaDoc indexName;
46     private IndexItem indexItem;
47     private long offset;
48
49     public RedoStoreIndexItem() {
50     }
51     public RedoStoreIndexItem(String JavaDoc indexName, long offset, IndexItem item) {
52         this.indexName = indexName;
53         this.offset=offset;
54         this.indexItem = item;
55     }
56
57     public void readExternal(ObjectInput JavaDoc in) throws IOException JavaDoc, ClassNotFoundException JavaDoc {
58         readExternal((DataInput JavaDoc)in);
59     }
60     public void readExternal(DataInput JavaDoc in) throws IOException JavaDoc {
61         // indexName = in.readUTF();
62
offset = in.readLong();
63         indexItem = new IndexItem();
64         indexItem.read(in);
65     }
66     
67     public void writeExternal(ObjectOutput JavaDoc out) throws IOException JavaDoc {
68         writeExternal((DataOutput JavaDoc)out);
69     }
70     public void writeExternal(DataOutput JavaDoc out) throws IOException JavaDoc {
71         // out.writeUTF(indexName);
72
out.writeLong(offset);
73         indexItem.write(out);
74     }
75     
76     public String JavaDoc getIndexName() {
77         return indexName;
78     }
79     public void setIndexName(String JavaDoc 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