Mercurial > hg > Members > shoshi > jungle > bulletinboard
changeset 25:ca85609658bd
bug fix
author | one |
---|---|
date | Tue, 20 Jan 2015 09:31:16 +0900 |
parents | ae86706cab66 |
children | 05923eb9ce80 |
files | .classpath build.gradle src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/BulletinBoard.java src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/CassandraBulletinBoard.java src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/GetAttributeImp.java src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/JungleBulletinBoard.java src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/ShowBoardMessageServlet.java |
diffstat | 7 files changed, 99 insertions(+), 175 deletions(-) [+] |
line wrap: on
line diff
--- a/.classpath Thu Jan 15 10:00:24 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/> - <classpathentry including="**/*.java" kind="src" path="src/main/java"/> - <classpathentry kind="var" path="M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar" sourcepath="M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5-sources.jar"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java8u5"/> - <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/> - <classpathentry kind="var" path="M2_REPO/org/functionaljava/functionaljava/3.1/functionaljava-3.1.jar" sourcepath="M2_REPO/org/functionaljava/functionaljava/3.1/functionaljava-3.1-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/functionaljava/functionaljava/3.1/functionaljava-3.1-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-server/9.1.1.v20140108/jetty-server-9.1.1.v20140108.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-server/9.1.1.v20140108/jetty-server-9.1.1.v20140108-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/eclipse/jetty/jetty-server/9.1.1.v20140108/jetty-server-9.1.1.v20140108-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-http/9.1.1.v20140108/jetty-http-9.1.1.v20140108.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-http/9.1.1.v20140108/jetty-http-9.1.1.v20140108-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/eclipse/jetty/jetty-http/9.1.1.v20140108/jetty-http-9.1.1.v20140108-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-util/9.1.1.v20140108/jetty-util-9.1.1.v20140108.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-util/9.1.1.v20140108/jetty-util-9.1.1.v20140108-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/eclipse/jetty/jetty-util/9.1.1.v20140108/jetty-util-9.1.1.v20140108-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-io/9.1.1.v20140108/jetty-io-9.1.1.v20140108.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-io/9.1.1.v20140108/jetty-io-9.1.1.v20140108-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/eclipse/jetty/jetty-io/9.1.1.v20140108/jetty-io-9.1.1.v20140108-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/hectorclient/hector-core/1.1-2/hector-core-1.1-2.jar" sourcepath="M2_REPO/org/hectorclient/hector-core/1.1-2/hector-core-1.1-2-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/hectorclient/hector-core/1.1-2/hector-core-1.1-2-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar" sourcepath="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/commons-pool/commons-pool/1.5.3/commons-pool-1.5.3.jar" sourcepath="M2_REPO/commons-pool/commons-pool/1.5.3/commons-pool-1.5.3-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/commons-pool/commons-pool/1.5.3/commons-pool-1.5.3-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/apache/cassandra/cassandra-thrift/1.1.0/cassandra-thrift-1.1.0.jar" sourcepath="M2_REPO/org/apache/cassandra/cassandra-thrift/1.1.0/cassandra-thrift-1.1.0-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/apache/cassandra/cassandra-thrift/1.1.0/cassandra-thrift-1.1.0-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/apache/thrift/libthrift/0.7.0/libthrift-0.7.0.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/apache/thrift/libthrift/0.7.0/libthrift-0.7.0-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1-sources.jar"/> - <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1-sources.jar"/> - <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.2/commons-codec-1.2.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/commons-codec/commons-codec/1.2/commons-codec-1.2-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/com/google/guava/guava/r09/guava-r09.jar" sourcepath="M2_REPO/com/google/guava/guava/r09/guava-r09-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/com/google/guava/guava/r09/guava-r09-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/com/github/stephenc/eaio-uuid/uuid/3.2.0/uuid-3.2.0.jar"/> - <classpathentry kind="var" path="M2_REPO/com/ecyrd/speed4j/speed4j/0.9/speed4j-0.9.jar" sourcepath="M2_REPO/com/ecyrd/speed4j/speed4j/0.9/speed4j-0.9-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/com/ecyrd/speed4j/speed4j/0.9/speed4j-0.9-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/apache/cassandra/cassandra-all/1.2.1/cassandra-all-1.2.1.jar" sourcepath="M2_REPO/org/apache/cassandra/cassandra-all/1.2.1/cassandra-all-1.2.1-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/apache/cassandra/cassandra-all/1.2.1/cassandra-all-1.2.1-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/xerial/snappy/snappy-java/1.0.4.1/snappy-java-1.0.4.1.jar" sourcepath="M2_REPO/org/xerial/snappy/snappy-java/1.0.4.1/snappy-java-1.0.4.1-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/xerial/snappy/snappy-java/1.0.4.1/snappy-java-1.0.4.1-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/com/ning/compress-lzf/0.8.4/compress-lzf-0.8.4.jar" sourcepath="M2_REPO/com/ning/compress-lzf/0.8.4/compress-lzf-0.8.4-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/com/ning/compress-lzf/0.8.4/compress-lzf-0.8.4-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/commons-cli/commons-cli/1.1/commons-cli-1.1.jar" sourcepath="M2_REPO/commons-cli/commons-cli/1.1/commons-cli-1.1-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/commons-cli/commons-cli/1.1/commons-cli-1.1-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/com/googlecode/concurrentlinkedhashmap/concurrentlinkedhashmap-lru/1.3/concurrentlinkedhashmap-lru-1.3.jar" sourcepath="M2_REPO/com/googlecode/concurrentlinkedhashmap/concurrentlinkedhashmap-lru/1.3/concurrentlinkedhashmap-lru-1.3-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/com/googlecode/concurrentlinkedhashmap/concurrentlinkedhashmap-lru/1.3/concurrentlinkedhashmap-lru-1.3-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/antlr/antlr/3.2/antlr-3.2.jar" sourcepath="M2_REPO/org/antlr/antlr/3.2/antlr-3.2-sources.jar"/> - <classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.2/antlr-runtime-3.2.jar" sourcepath="M2_REPO/org/antlr/antlr-runtime/3.2/antlr-runtime-3.2-sources.jar"/> - <classpathentry kind="var" path="M2_REPO/org/antlr/stringtemplate/3.2/stringtemplate-3.2.jar"/> - <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/> - <classpathentry kind="var" path="M2_REPO/org/apache/cassandra/deps/avro/1.4.0-cassandra-1/avro-1.4.0-cassandra-1.jar" sourcepath="M2_REPO/org/apache/cassandra/deps/avro/1.4.0-cassandra-1/avro-1.4.0-cassandra-1-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/apache/cassandra/deps/avro/1.4.0-cassandra-1/avro-1.4.0-cassandra-1-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.9.2/jackson-mapper-asl-1.9.2.jar" sourcepath="M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.9.2/jackson-mapper-asl-1.9.2-sources.jar"/> - <classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-core-asl/1.9.2/jackson-core-asl-1.9.2.jar" sourcepath="M2_REPO/org/codehaus/jackson/jackson-core-asl/1.9.2/jackson-core-asl-1.9.2-sources.jar"/> - <classpathentry kind="var" path="M2_REPO/org/mortbay/jetty/jetty/6.1.22/jetty-6.1.22.jar"/> - <classpathentry kind="var" path="M2_REPO/org/mortbay/jetty/jetty-util/6.1.22/jetty-util-6.1.22.jar"/> - <classpathentry kind="var" path="M2_REPO/org/mortbay/jetty/servlet-api/2.5-20081211/servlet-api-2.5-20081211.jar" sourcepath="M2_REPO/org/mortbay/jetty/servlet-api/2.5-20081211/servlet-api-2.5-20081211-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/mortbay/jetty/servlet-api/2.5-20081211/servlet-api-2.5-20081211-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/jline/jline/1.0/jline-1.0.jar" sourcepath="M2_REPO/jline/jline/1.0/jline-1.0-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/jline/jline/1.0/jline-1.0-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/com/googlecode/json-simple/json-simple/1.1/json-simple-1.1.jar" sourcepath="M2_REPO/com/googlecode/json-simple/json-simple/1.1/json-simple-1.1-sources.jar"/> - <classpathentry kind="var" path="M2_REPO/com/github/stephenc/high-scale-lib/high-scale-lib/1.1.2/high-scale-lib-1.1.2.jar" sourcepath="M2_REPO/com/github/stephenc/high-scale-lib/high-scale-lib/1.1.2/high-scale-lib-1.1.2-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/com/github/stephenc/high-scale-lib/high-scale-lib/1.1.2/high-scale-lib-1.1.2-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/org/yaml/snakeyaml/1.6/snakeyaml-1.6.jar" sourcepath="M2_REPO/org/yaml/snakeyaml/1.6/snakeyaml-1.6-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/org/yaml/snakeyaml/1.6/snakeyaml-1.6-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/edu/stanford/ppl/snaptree/0.1/snaptree-0.1.jar" sourcepath="M2_REPO/edu/stanford/ppl/snaptree/0.1/snaptree-0.1-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/edu/stanford/ppl/snaptree/0.1/snaptree-0.1-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/com/yammer/metrics/metrics-core/2.0.3/metrics-core-2.0.3.jar" sourcepath="M2_REPO/com/yammer/metrics/metrics-core/2.0.3/metrics-core-2.0.3-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/com/yammer/metrics/metrics-core/2.0.3/metrics-core-2.0.3-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar" sourcepath="M2_REPO/com/github/stephenc/jamm/0.2.5/jamm-0.2.5-sources.jar"> - <attributes> - <attribute name="javadoc_location" value="jar:file:/Users/one/.m2/repository/com/github/stephenc/jamm/0.2.5/jamm-0.2.5-javadoc.jar!/"/> - </attributes> - </classpathentry> - <classpathentry kind="var" path="M2_REPO/com/eaio/uuid/uuid/3.3/uuid-3.3.jar"/> - <classpathentry combineaccessrules="false" kind="src" path="/jungle-core"/> - <classpathentry kind="output" path="target/classes"/> -</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build.gradle Tue Jan 20 09:31:16 2015 +0900 @@ -0,0 +1,29 @@ +apply plugin: 'java' +apply plugin: 'maven' + +group = 'jp.ac.u_ryukyu.ie.cr.shoshi.jungle' +version = '0.0.1-SNAPSHOT' + +description = """bulletinboard""" + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + + + +repositories { + maven { url "http://eaio.com/maven2" } + maven { url "http://repo.maven.apache.org/maven2" } +} + +dependencies { + compile fileTree(dir: 'lib', include: '*.jar') + compile group: 'org.eclipse.jetty', name: 'jetty-server', version:'9.1.1.v20140108' + compile group: 'org.hectorclient', name: 'hector-core', version:'1.1-2' + compile(group: 'org.apache.cassandra', name: 'cassandra-all', version:'1.2.1') { +exclude(module: 'slf4j-log4j12') +exclude(module: 'log4j') + } + compile group: 'com.eaio.uuid', name: 'uuid', version:'3.3' + compile "junit:junit:4.7" +}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/BulletinBoard.java Thu Jan 15 10:00:24 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/BulletinBoard.java Tue Jan 20 09:31:16 2015 +0900 @@ -1,5 +1,7 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; + public interface BulletinBoard { public Iterable<String> getBoards(); @@ -7,5 +9,5 @@ public void createBoardMessage(String _board,String _author,String _message,String _editKey); public void editMessage(String _board,String _uuid,String _author,String _message,String _editKey); public String sanitize(String str); - public Iterable<BoardMessage> getMessages(String _boardName); + GetAttributeImp getAttribute(String _bname, String _nodeNum, String revisionStr); }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/CassandraBulletinBoard.java Thu Jan 15 10:00:24 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/CassandraBulletinBoard.java Tue Jan 20 09:31:16 2015 +0900 @@ -217,4 +217,8 @@ return str; } + public GetAttributeImp getAttribute(String _bname, String _nodeNum, String revisionStr) { + return null; // 未実装 使うときに実装する + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/GetAttributeImp.java Tue Jan 20 09:31:16 2015 +0900 @@ -0,0 +1,22 @@ +package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs; + + +import fj.data.List; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; + +public class GetAttributeImp { + private final TreeNode node; + + public GetAttributeImp(TreeNode _node) { + node = _node; + } + + public String getMessage(String key) { + return node.getAttributes().getString(key); + } + + public List<String> getKeys() { + return node.getAttributes().getKeys(); + } + +}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/JungleBulletinBoard.java Thu Jan 15 10:00:24 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/JungleBulletinBoard.java Tue Jan 20 09:31:16 2015 +0900 @@ -11,10 +11,13 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultTreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.DefaultEvaluator; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.DefaultTraverser; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.Traversal; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.IterableConverter; +import junit.framework.Assert; public class JungleBulletinBoard implements BulletinBoard { @@ -246,4 +249,33 @@ str = str.replaceAll("'", "'"); return str; } + + public GetAttributeImp getAttribute(String _bname, String _nodeNum, String revisionStr) { + + DefaultNodePath path = new DefaultNodePath(); + try { + for (int count = 0; _nodeNum.substring(count, count + 1) != null; count++) { + if (!_nodeNum.substring(count, count + 1).equals("/")) + path = path.add(Integer.parseInt(_nodeNum.substring(count, count + 1))); + } + } catch (Exception _e) { + } + JungleTree tree = jungle.getTreeByName(_bname); + System.out.println(tree.revision()); + Long revision = Long.parseLong(revisionStr); + JungleTree oldTree = tree.getOldTree(revision).b(); + System.out.println(oldTree.revision()); + TreeNode node = oldTree.getRootNode(); + + DefaultTraverser traverser = new DefaultTraverser(); + DefaultEvaluator evaluator = new DefaultEvaluator(path); + Either<Error, Traversal> ret = traverser.traverse(node, evaluator); + if (ret.isA()) { + Assert.fail(); + } + + Traversal traversal = ret.b(); + TreeNode target = traversal.destination(); + return new GetAttributeImp(target); + } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/ShowBoardMessageServlet.java Thu Jan 15 10:00:24 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/bbs/ShowBoardMessageServlet.java Tue Jan 20 09:31:16 2015 +0900 @@ -6,6 +6,9 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import fj.data.List; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; + public class ShowBoardMessageServlet extends HttpServlet { /** @@ -46,12 +49,12 @@ _pw.write("<p>Author : <input type='text' name='author'/> <input type='hidden' name='bname' value='"+_bname+"'/> EditKey : <input type='text' name='key'/></p>\n"); _pw.write("<p>Message<br/> <input type='textarea' name='msg'/> </p>\n"); _pw.write("<p><input type='submit' value='submit'/></p>\n"); - - for(BoardMessage msg : bbs.getMessages(_bname)){ - _pw.write("<hr/>"); - _pw.write("<p><b>"+msg.getAuthor()+"</b></p>"); - _pw.write("<p>"+msg.getMessage()+"</p>"); - _pw.write("<small><a href='"+editMessagePath+"?bname="+_bname+"&uuid="+msg.getUUID()+"'>edit</a></small>"); + GetAttributeImp attribute = bbs.getAttribute(_bname, "[-1]","0"); + List<String> keys = attribute.getKeys(); + + for(String key : keys){ + String mesage = attribute.getMessage(key); + _pw.write("<p>" + key + " = " + mesage + "</p>\n"); } _pw.write("</body></html>");