changeset 39:ea7f0a4eacaf

added cassandra
author suika6039
date Tue, 11 Jan 2011 17:20:33 +0900
parents e647bb37b7ad
children a2e384c93533
files CHANGELOG src/treecms/proto/cassandra/CassBrowser.java src/treecms/proto/cassandra/CassEditor.java src/treecms/proto/cassandra/CassLink.java src/treecms/proto/cassandra/CassNode.java src/treecms/proto/simple/SimpleEditor.java src/treecms/proto/test/EditorTest.java
diffstat 7 files changed, 427 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Thu Dec 30 00:50:47 2010 +0900
+++ b/CHANGELOG	Tue Jan 11 17:20:33 2011 +0900
@@ -1,4 +1,19 @@
 CHANGELOG
+2010/12/29
+added treecms.proto.cassandra
+	for cassandra support
+
+2010/12/28
+added treecms.proto.merge
+	separate the merge algorithm from editor
+
+2010/12/27
+added common test (treecms.proto.test)
+	in case of implementing APIs , create test-class and extend correct common test-class.
+
+2010/12/26
+renew all
+
 2010/11/29
 added treecms.proto.cassandra
 added cassandra libraries
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/treecms/proto/cassandra/CassBrowser.java	Tue Jan 11 17:20:33 2011 +0900
@@ -0,0 +1,62 @@
+package treecms.proto.cassandra;
+
+import treecms.proto.api.Browser;
+import treecms.proto.api.Node;
+import java.util.List;
+import java.io.UnsupportedEncodingException;
+import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TFramedTransport;
+import org.apache.thrift.transport.TSocket;
+import org.apache.thrift.transport.TTransportException;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.TException;
+import org.apache.cassandra.service.*;
+import org.apache.cassandra.thrift.Cassandra;
+
+public class CassBrowser implements Browser
+{
+	public static void main(String _args[])
+	{
+		
+	}
+	
+	private Cassandra.Client m_cassandra;
+	private String m_keySpace,m_colFamily;
+	
+	private CassBrowser(String _host,String _port) throws TTransportException
+	{
+		TTransport tr = new TFramedTransport(new TSocket(_host,Integer.parseInt(_port)));
+		TProtocol proto = new TBinaryProtocol(tr);
+		m_cassandra = new Cassandra.Client(proto);
+		tr.open();
+	}
+	
+	public CassBrowser createInstance(String _host,String _port)
+	{
+		CassBrowser browser = null;
+		try{
+			browser = new CassBrowser(_host,_port);
+		}catch(Exception _err){
+			_err.printStackTrace();
+		}
+		return browser;
+	}
+	
+	public void setKeyspace(String _keySpace)
+	{
+		m_keySpace = _keySpace;
+	}
+	
+	public void setColumnFamily(String _colFamily)
+	{
+		m_colFamily = _colFamily;
+	}
+
+	@Override
+	public Node useContents()
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/treecms/proto/cassandra/CassEditor.java	Tue Jan 11 17:20:33 2011 +0900
@@ -0,0 +1,59 @@
+package treecms.proto.cassandra;
+
+import treecms.proto.api.Editor;
+import treecms.proto.api.Node;
+
+public class CassEditor implements Editor
+{
+	@Override
+	public boolean check()
+	{
+		return false;
+	}
+
+	@Override
+	public boolean commit(boolean _force)
+	{
+		return false;
+	}
+
+	@Override
+	public Node edit(Node _target)
+	{
+		return null;
+	}
+
+	@Override
+	public Node getUncommited()
+	{
+		return null;
+	}
+
+	@Override
+	public void login(String _user, String _pass)
+	{
+	}
+
+	@Override
+	public void logout()
+	{
+	}
+
+	@Override
+	public void merge()
+	{
+	}
+
+	@Override
+	public boolean update()
+	{
+		return false;
+	}
+
+	@Override
+	public Node useContents()
+	{
+		return null;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/treecms/proto/cassandra/CassLink.java	Tue Jan 11 17:20:33 2011 +0900
@@ -0,0 +1,147 @@
+package treecms.proto.cassandra;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import treecms.proto.api.Link;
+import treecms.proto.api.Node;
+import treecms.proto.api.NodeID;
+
+public class CassLink implements Link
+{
+
+	@Override
+	public Node getNode()
+	{
+		return null;
+	}
+
+	@Override
+	public void setNode(Node link)
+	{
+	}
+
+	@Override
+	public Node addChild(Node child)
+	{
+		return null;
+	}
+
+	@Override
+	public void addChildren(List<Node> child)
+	{
+	}
+
+	@Override
+	public void clearChildren()
+	{
+	}
+
+	@Override
+	public Node cloneNode()
+	{
+		return null;
+	}
+
+	@Override
+	public Link createLink()
+	{
+		return null;
+	}
+
+	@Override
+	public Node createNode()
+	{
+		return null;
+	}
+
+	@Override
+	public void down(Node _child)
+	{
+	}
+
+	@Override
+	public String getAttribute(String _attr)
+	{
+		return null;
+	}
+
+	@Override
+	public Set<String> getAttributeKeys()
+	{
+		return null;
+	}
+
+	@Override
+	public List<Node> getChildren()
+	{
+		return null;
+	}
+
+	@Override
+	public String getClassName()
+	{
+		return null;
+	}
+
+	@Override
+	public NodeID getID()
+	{
+		return null;
+	}
+
+	@Override
+	public String getTitle()
+	{
+		return null;
+	}
+
+	@Override
+	public boolean isChild(Node _child)
+	{
+		return false;
+	}
+
+	@Override
+	public Iterator<Node> iterator()
+	{
+		return null;
+	}
+
+	@Override
+	public boolean removeChild(Node _child)
+	{
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public void replace(Node target, Node newChild)
+	{
+	}
+
+	@Override
+	public void setAttribute(String attr, String value)
+	{
+	}
+
+	@Override
+	public void setClassName(String class1) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void setTitle(String title) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void up(Node child) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/treecms/proto/cassandra/CassNode.java	Tue Jan 11 17:20:33 2011 +0900
@@ -0,0 +1,144 @@
+package treecms.proto.cassandra;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import treecms.proto.api.Link;
+import treecms.proto.api.Node;
+import treecms.proto.api.NodeID;
+
+public class CassNode implements Node
+{
+	public CassNode()
+	{
+		
+	}
+
+	@Override
+	public Node addChild(Node _child)
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void addChildren(List<Node> _child)
+	{
+	}
+
+	@Override
+	public void clearChildren() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public Node cloneNode() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Link createLink() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Node createNode() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void down(Node child) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public String getAttribute(String attr) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Set<String> getAttributeKeys() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public List<Node> getChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getClassName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public NodeID getID() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getTitle() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean isChild(Node child) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public Iterator<Node> iterator() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean removeChild(Node child) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public void replace(Node target, Node newChild) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void setAttribute(String attr, String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void setClassName(String class1) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void setTitle(String title) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void up(Node child) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}
--- a/src/treecms/proto/simple/SimpleEditor.java	Thu Dec 30 00:50:47 2010 +0900
+++ b/src/treecms/proto/simple/SimpleEditor.java	Tue Jan 11 17:20:33 2011 +0900
@@ -1,7 +1,6 @@
 package treecms.proto.simple;
 
 import java.util.List;
-
 import java.util.LinkedList;
 import treecms.proto.api.Editor;
 import treecms.proto.api.Node;
--- a/src/treecms/proto/test/EditorTest.java	Thu Dec 30 00:50:47 2010 +0900
+++ b/src/treecms/proto/test/EditorTest.java	Tue Jan 11 17:20:33 2011 +0900
@@ -3,11 +3,8 @@
 import java.util.LinkedList;
 
 import junit.framework.Assert;
-
 import org.junit.Test;
-
 import treecms.proto.api.*;
-import treecms.proto.util.PreOrderTreeWalker;
 
 public class EditorTest
 {