annotate src/main/java/jungle/app/bbs/NetworkJungleBulletinBoard.java @ 105:f9e29a52efd3

Move some files
author one
date Tue, 26 Nov 2013 06:43:10 +0900
parents src/jungle/app/bbs/NetworkJungleBulletinBoard.java@75cf01a430a6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
66
29127ac788a6 move some files
one
parents: 65
diff changeset
1 package jungle.app.bbs;
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
2
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
3 import java.nio.ByteBuffer;
56
ccfe9b5e8f11 bug LogUpdateCodeSegment
one
parents: 52
diff changeset
4 import java.util.Date;
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
5 import java.util.concurrent.atomic.AtomicInteger;
39
10359a815068 add alice.jungle.codesegment.remote
one
parents: 38
diff changeset
6
10359a815068 add alice.jungle.codesegment.remote
one
parents: 38
diff changeset
7 import alice.jungle.core.NetworkDefaultJungle;
105
f9e29a52efd3 Move some files
one
parents: 93
diff changeset
8 import alice.jungle.persistent.AliceJournal;
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.Jungle;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTreeEditor;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Children;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
13 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Node;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
14 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
15 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultTreeEditor;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
16 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.EditableNode;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
17 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.NodeEditor;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
18 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.DefaultTraverser;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
19 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
20 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
21 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
22 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.IterableConverter;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
23
39
10359a815068 add alice.jungle.codesegment.remote
one
parents: 38
diff changeset
24 public class NetworkJungleBulletinBoard implements BulletinBoard
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
25 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
26 private final Jungle jungle;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
27
91
2c7b3f2b2ee1 Removed serverName field
one
parents: 90
diff changeset
28 public NetworkJungleBulletinBoard(String _uuid)
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
29 {
91
2c7b3f2b2ee1 Removed serverName field
one
parents: 90
diff changeset
30 jungle = new NetworkDefaultJungle(new AliceJournal(), _uuid,new DefaultTreeEditor(new DefaultTraverser()));
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
31 jungle.createNewTree("boards");
51
9e782b4eb06e add HashSetConvertDataSegment
one
parents: 50
diff changeset
32 JungleManager.setJungle(jungle);
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
33 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
34
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
35 public Iterable<String> getBoards()
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
36 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
37 JungleTree tree = jungle.getTreeByName("boards");
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
38 Node node = tree.getRootNode();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
39 Children<Node> chs = node.getChildren();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
40
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
41 IterableConverter.Converter<String,Node> converter = new IterableConverter.Converter<String,Node>(){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
42 public String conv(Node _b) {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
43 ByteBuffer e = _b.getAttributes().get("name");
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
44 return new String(e.array());
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
45 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
46 };
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
47
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
48 return new IterableConverter<String,Node>(chs,converter);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
49 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
50
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
51 public void createBoards(final String _name,final String _author,final String _initMessage,final String _editKey)
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
52 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
53 if(null == jungle.createNewTree(_name)){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
54 throw new IllegalStateException();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
55 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
56
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
57 JungleTree tree = jungle.getTreeByName("boards");
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
58 JungleTreeEditor editor = tree.getTreeEditor();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
59 DefaultNodePath root = new DefaultNodePath();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
60 Either<Error,JungleTreeEditor> either = editor.addNewChildAt(root,0);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
61 if(either.isA()){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
62 throw new IllegalStateException();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
63 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
64 editor = either.b();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
65
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
66 either = editor.putAttribute(root.add(0),"name",ByteBuffer.wrap(_name.getBytes()));
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
67 if(either.isA()){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
68 throw new IllegalStateException();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
69 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
70 editor = either.b();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
71 Either<Error,JungleTreeEditor> result = editor.success();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
72 if(result.isA()){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
73 throw new IllegalStateException();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
74 }
56
ccfe9b5e8f11 bug LogUpdateCodeSegment
one
parents: 52
diff changeset
75 final long timestamp = new Date().getTime();
93
75cf01a430a6 Added LocalTreeEditor
one
parents: 92
diff changeset
76
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
77
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
78 tree = jungle.getTreeByName(_name);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
79 editor = tree.getTreeEditor();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
80 either = editor.addNewChildAt(root,0);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
81 if(either.isA()){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
82 throw new IllegalStateException();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
83 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
84 editor = either.b();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
85
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
86 NodeEditor e = new NodeEditor(){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
87 public <T extends EditableNode<T>> Either<Error, T> edit(T _e){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
88 _e = _e.getAttributes().put("author",ByteBuffer.wrap(_author.getBytes())).b();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
89 _e = _e.getAttributes().put("mes",ByteBuffer.wrap(_initMessage.getBytes())).b();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
90 _e = _e.getAttributes().put("key",ByteBuffer.wrap(_editKey.getBytes())).b();
56
ccfe9b5e8f11 bug LogUpdateCodeSegment
one
parents: 52
diff changeset
91 ByteBuffer tBuffer = ByteBuffer.allocate(16);
ccfe9b5e8f11 bug LogUpdateCodeSegment
one
parents: 52
diff changeset
92 _e = _e.getAttributes().put("timestamp",tBuffer.putLong(timestamp)).b();
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
93 return DefaultEither.newB(_e);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
94 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
95 };
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
96
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
97 either = editor.edit(root.add(0),e);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
98 if(either.isA()){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
99 throw new IllegalStateException();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
100 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
101 editor = either.b();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
102 editor.success();
46
fd3643699f83 modified pom.xml. fix conflict log4j libraries
one
parents: 45
diff changeset
103
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
104 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
105
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
106 public void createBoardMessage(final String _board,final String _author,final String _message,final String _editKey)
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
107 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
108 JungleTree tree = jungle.getTreeByName(_board);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
109 if(tree == null){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
110 throw new IllegalStateException();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
111 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
112
46
fd3643699f83 modified pom.xml. fix conflict log4j libraries
one
parents: 45
diff changeset
113 Either<Error, JungleTreeEditor> either;
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
114 do{
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
115 Node node = tree.getRootNode();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
116 int size = node.getChildren().size();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
117 DefaultNodePath path = new DefaultNodePath();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
118
65
ebf42371454b remove warning
one
parents: 64
diff changeset
119 JungleTreeEditor editor = tree.getTreeEditor();
46
fd3643699f83 modified pom.xml. fix conflict log4j libraries
one
parents: 45
diff changeset
120 either = editor.addNewChildAt(path,size);
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
121 if(either.isA()){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
122 throw new IllegalStateException();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
123 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
124 editor = either.b();
56
ccfe9b5e8f11 bug LogUpdateCodeSegment
one
parents: 52
diff changeset
125 final long timestamp = new Date().getTime();
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
126 NodeEditor e = new NodeEditor(){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
127 public <T extends EditableNode<T>> Either<Error, T> edit(T _e){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
128 _e = _e.getAttributes().put("author",ByteBuffer.wrap(_author.getBytes())).b();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
129 _e = _e.getAttributes().put("mes",ByteBuffer.wrap(_message.getBytes())).b();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
130 _e = _e.getAttributes().put("key",ByteBuffer.wrap(_editKey.getBytes())).b();
56
ccfe9b5e8f11 bug LogUpdateCodeSegment
one
parents: 52
diff changeset
131 ByteBuffer tBuffer = ByteBuffer.allocate(16);
ccfe9b5e8f11 bug LogUpdateCodeSegment
one
parents: 52
diff changeset
132 _e = _e.getAttributes().put("timestamp",tBuffer.putLong(timestamp)).b();
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
133 return DefaultEither.newB(_e);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
134 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
135 };
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
136 path = path.add(size);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
137 either = editor.edit(path,e);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
138 if(either.isA()){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
139 throw new IllegalStateException();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
140 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
141 editor = either.b();
46
fd3643699f83 modified pom.xml. fix conflict log4j libraries
one
parents: 45
diff changeset
142 either = editor.success();
93
75cf01a430a6 Added LocalTreeEditor
one
parents: 92
diff changeset
143
46
fd3643699f83 modified pom.xml. fix conflict log4j libraries
one
parents: 45
diff changeset
144 }while(either.isA());
51
9e782b4eb06e add HashSetConvertDataSegment
one
parents: 50
diff changeset
145 /* Put DataSegment */
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
146 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
147
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
148 public void editMessage(String _board,String _uuid,final String _author,final String _message,final String _editKey)
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
149 {
65
ebf42371454b remove warning
one
parents: 64
diff changeset
150 for(;;) {
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
151 DefaultNodePath path = new DefaultNodePath();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
152 path = path.add(Integer.parseInt(_uuid));
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
153
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
154 JungleTree tree = jungle.getTreeByName(_board);
65
ebf42371454b remove warning
one
parents: 64
diff changeset
155 JungleTreeEditor editor = tree.getTreeEditor();
56
ccfe9b5e8f11 bug LogUpdateCodeSegment
one
parents: 52
diff changeset
156 final long timestamp = new Date().getTime();
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
157 NodeEditor e = new NodeEditor(){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
158 public <T extends EditableNode<T>> Either<Error, T> edit(T _e){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
159 _e = _e.getAttributes().put("author",ByteBuffer.wrap(_author.getBytes())).b();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
160 _e = _e.getAttributes().put("mes",ByteBuffer.wrap(_message.getBytes())).b();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
161 _e = _e.getAttributes().put("key",ByteBuffer.wrap(_editKey.getBytes())).b();
56
ccfe9b5e8f11 bug LogUpdateCodeSegment
one
parents: 52
diff changeset
162 ByteBuffer tBuffer = ByteBuffer.allocate(16);
ccfe9b5e8f11 bug LogUpdateCodeSegment
one
parents: 52
diff changeset
163 _e = _e.getAttributes().put("timestamp",tBuffer.putLong(timestamp)).b();
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
164 return DefaultEither.newB(_e);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
165 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
166 };
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
167
65
ebf42371454b remove warning
one
parents: 64
diff changeset
168 Either<Error, JungleTreeEditor> either = editor.edit(path,e);
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
169 if(either.isA()){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
170 throw new IllegalStateException();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
171 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
172 editor = either.b();
46
fd3643699f83 modified pom.xml. fix conflict log4j libraries
one
parents: 45
diff changeset
173 either = editor.success();
65
ebf42371454b remove warning
one
parents: 64
diff changeset
174 if(!either.isA()) {
ebf42371454b remove warning
one
parents: 64
diff changeset
175 return;
ebf42371454b remove warning
one
parents: 64
diff changeset
176 }
ebf42371454b remove warning
one
parents: 64
diff changeset
177 }
ebf42371454b remove warning
one
parents: 64
diff changeset
178
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
179 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
180
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
181 public Iterable<BoardMessage> getMessages(String _boardName)
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
182 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
183 JungleTree tree = jungle.getTreeByName(_boardName);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
184 Node node = tree.getRootNode();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
185 Children<Node> chs = node.getChildren();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
186
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
187 final AtomicInteger counter = new AtomicInteger(0);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
188 IterableConverter.Converter<BoardMessage,Node> converter = new IterableConverter.Converter<BoardMessage,Node>(){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
189 public BoardMessage conv(Node _b) {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
190 String uuid = Integer.toString(counter.get());
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
191 String author = new String(_b.getAttributes().get("author").array());
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
192 String message = new String(_b.getAttributes().get("mes").array());
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
193 counter.incrementAndGet();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
194 return new BoardMessageImpl(author,message,uuid);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
195 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
196 };
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
197
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
198 return new IterableConverter<BoardMessage,Node>(chs,converter);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
199 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
200
46
fd3643699f83 modified pom.xml. fix conflict log4j libraries
one
parents: 45
diff changeset
201
fd3643699f83 modified pom.xml. fix conflict log4j libraries
one
parents: 45
diff changeset
202
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
203 private static class BoardMessageImpl implements BoardMessage
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
204 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
205 private final String author;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
206 private final String message;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
207 private final String uuid;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
208
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
209 public BoardMessageImpl(String _author,String _message,String _uuid)
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
210 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
211 author = _author;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
212 message = _message;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
213 uuid = _uuid;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
214 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
215
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
216 public String getAuthor()
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
217 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
218 return author;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
219 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
220
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
221 public String getMessage()
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
222 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
223 return message;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
224 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
225
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
226 public String getUUID()
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
227 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
228 return uuid;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
229 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
230 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
231 }