01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.compass.needle.coherence;
18:
19: import java.io.DataInput;
20: import java.io.DataOutput;
21: import java.io.IOException;
22:
23: import com.tangosol.io.ExternalizableLite;
24:
25: /**
26: * A file entry holds the meta data of a file, without its content.
27: *
28: * @author kimchy
29: */
30: public class FileHeaderValue implements ExternalizableLite {
31:
32: private long lastModified;
33:
34: private long size;
35:
36: // just here for serialization
37: public FileHeaderValue() {
38: }
39:
40: public FileHeaderValue(long lastModified, long size) {
41: this .lastModified = lastModified;
42: this .size = size;
43: }
44:
45: public long getLastModified() {
46: return this .lastModified;
47: }
48:
49: public long getSize() {
50: return this .size;
51: }
52:
53: public void touch() {
54: // we are using currentTime here, which should be sync between nodes (though some
55: // minor difference won't matter that much with Lucene).
56: this .lastModified = System.currentTimeMillis();
57: }
58:
59: public void readExternal(DataInput in) throws IOException {
60: size = in.readLong();
61: lastModified = in.readLong();
62: }
63:
64: public void writeExternal(DataOutput out) throws IOException {
65: out.writeLong(size);
66: out.writeLong(lastModified);
67: }
68: }
|