Mercurial > hg > Members > nobuyasu > jungle-network
comparison src/main/java/alice/jungle/persistent/AliceJournal.java @ 105:f9e29a52efd3
Move some files
author | one |
---|---|
date | Tue, 26 Nov 2013 06:43:10 +0900 |
parents | src/alice/jungle/persistence/AliceJournal.java@87ec5dd0dc27 |
children | 895ab2907db3 |
comparison
equal
deleted
inserted
replaced
104:03bf62bb699e | 105:f9e29a52efd3 |
---|---|
1 package alice.jungle.persistent; | |
2 | |
3 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeList; | |
4 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeListReader; | |
5 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeListWriter; | |
6 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.Journal; | |
7 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.Result; | |
8 | |
9 public class AliceJournal implements Journal { | |
10 | |
11 private static final AliceChangeListWriter ALICE_WRITER = new AliceChangeListWriter(); | |
12 private static final AliceChangeListReader ALICE_READER = new AliceChangeListReader(); | |
13 @Override | |
14 public ChangeListReader getReader() { | |
15 return ALICE_READER; | |
16 } | |
17 @Override | |
18 public ChangeListWriter getWriter() { | |
19 return ALICE_WRITER; | |
20 } | |
21 | |
22 private static class AliceChangeListWriter implements ChangeListWriter | |
23 { | |
24 @Override | |
25 public Result write(ChangeList _operations) | |
26 { | |
27 /* | |
28 for(TreeOperation op : _operations){ | |
29 NodePath p = op.getNodePath(); | |
30 NodeOperation nodeOp = op.getNodeOperation(); | |
31 Command c = nodeOp.getCommand(); | |
32 String args = ""; | |
33 switch(c){ | |
34 case PUT_ATTRIBUTE: | |
35 String key = nodeOp.getKey(); | |
36 ByteBuffer value = nodeOp.getValue(); | |
37 if(value.limit() < 100){ | |
38 args = String.format("key:%s,value:%s",key,new String(value.array())); | |
39 }else{ | |
40 args = String.format("key:%s,value:%d",key,value.limit()); | |
41 } | |
42 break; | |
43 case DELETE_ATTRIBUTE: | |
44 args = String.format("key:%s",nodeOp.getKey()); | |
45 break; | |
46 case APPEND_CHILD: | |
47 args = String.format("pos:%d",nodeOp.getPosition()); | |
48 break; | |
49 case DELETE_CHILD: | |
50 args = String.format("pos:%d",nodeOp.getPosition()); | |
51 break; | |
52 } | |
53 System.out.println(String.format("[%s:%s:%s]",c,p,args)); | |
54 } | |
55 */ | |
56 return Result.SUCCESS; | |
57 } | |
58 } | |
59 | |
60 private static class AliceChangeListReader implements ChangeListReader | |
61 { | |
62 @Override | |
63 public ChangeListReader newReader() | |
64 { | |
65 return this; | |
66 } | |
67 | |
68 @Override | |
69 public ChangeList read() | |
70 { | |
71 return null; | |
72 } | |
73 } | |
74 | |
75 | |
76 } |