KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > dbi > Operation


1 /*
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: Operation.java,v 1.3 2006/12/04 18:47:41 cwl Exp $
7  */

8
9 package com.sleepycat.je.dbi;
10
11 import java.nio.ByteBuffer JavaDoc;
12
13 /**
14  * An enumeration of different api call sources for replication, currently for
15  * debugging. This is also intended to support the future possibility of
16  * providing application level visibility into the replication operation
17  * stream.
18  */

19 public class Operation {
20
21     public static final Operation PUT = new Operation((byte) 1);
22     public static final Operation NO_OVERWRITE = new Operation((byte) 2);
23     public static final Operation PLACEHOLDER = new Operation((byte) 3);
24
25     private byte op;
26
27     private Operation(byte op) {
28         this.op = op;
29     }
30
31     /**
32      * Serialize this object into the buffer.
33      * @param buffer is the destination buffer
34      */

35     public void writeToBuffer(ByteBuffer JavaDoc buffer) {
36         buffer.put(op);
37     }
38         
39     public void readFromBuffer(ByteBuffer JavaDoc buffer) {
40         op = buffer.get();
41     }
42 }
43
Popular Tags