Mercurial > hg > Members > tatsuki > JungleXMLReader
changeset 2:92e3416c3f76
delete nou use file
author | tatsuki |
---|---|
date | Fri, 24 Oct 2014 16:24:26 +0900 |
parents | b036c87f1e5c |
children | 3dc5905739ef |
files | src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/CreateNode.java src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/EditAttributeServlet.java src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/EditNodeName.java src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/MatrixApp.java src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/ShowMatrix.java src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/ShowMessageWithTimeStampServletMatrix.java src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/createAttributeMatrix.java src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/deleteAttributeServlet.java src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/deleteNodeServlet.java |
diffstat | 9 files changed, 3 insertions(+), 432 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/CreateNode.java Fri Oct 24 09:45:52 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -package jp.ac.u_ryukyu.cr.ie.tatsuki.bbs; - -import java.io.PrintWriter; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class CreateNode extends HttpServlet { - private final XmlBulletinBoard bbs; - private static final String PARAM_BOARD_NAME = "bname"; - private static final String PARAM_BOARD_AUTHOR = "author"; - private static final String PARAM_NODE_NAME = "name"; - private static final String PARAM_BOARD_EDITKEY = "key"; - private static final String PARAM_BOARD_PATH = "path"; - private static final long serialVersionUID = 1L; - - public CreateNode(XmlBulletinBoard _bbs) { - bbs = _bbs; - } - - public void doPost(HttpServletRequest _req, HttpServletResponse _res) { - String boardName = (_req.getParameter(PARAM_BOARD_NAME)); - String author = (_req.getParameter(PARAM_BOARD_AUTHOR));//not use - String nodeName = (_req.getParameter(PARAM_NODE_NAME)); - String key = (_req.getParameter(PARAM_BOARD_EDITKEY));//not use - String nodeNum = (_req.getParameter(PARAM_BOARD_PATH)); - - try { - bbs.createFolder(boardName, author, nodeName, key, nodeNum); - PrintWriter pw = _res.getWriter(); - pw.write("successfully written"); - } catch (Exception _e) { - _res.setStatus(500); - } - } -}
--- a/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/EditAttributeServlet.java Fri Oct 24 09:45:52 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -package jp.ac.u_ryukyu.cr.ie.tatsuki.bbs; - -import java.io.PrintWriter; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - - -public class EditAttributeServlet extends HttpServlet -{ - private final XmlBulletinBoard bbs; - private static final String PARAM_BOARD_NAME = "bname"; - private static final String PARAM_NODE_PATH = "path"; - private static final String PARAM_BOARD_MESSAGE= "msg"; - //private static final String PARAM_BOARD_EDITKEY = "key"; - private static final String PARAM_NODE_ID = "id"; - private static final long serialVersionUID = 1L; - - public EditAttributeServlet(XmlBulletinBoard _bbs) - { - bbs = _bbs; - } - - public void doGet(HttpServletRequest _req,HttpServletResponse _res) - { - String bname = (_req.getParameter(PARAM_BOARD_NAME)); - String path = (_req.getParameter(PARAM_NODE_PATH)); - String id = (_req.getParameter(PARAM_NODE_ID)); - - - try{ - _res.setCharacterEncoding("UTF-8"); - PrintWriter pw = _res.getWriter(); - pw.write("<html><body><h1>edit message</h1>"); - pw.write("<form method='POST'\n"); - pw.write("<p><input type='hidden' name='path' value='"+path+"'/>" + - "<input type='hidden' name='id' value='"+id+"'/>" + - "<input type='hidden' name='bname' value='"+bname+"'</p>\n"); - pw.write("<p>Message<br/> <input type='textarea' name='msg'/> </p>\n"); - pw.write("<p><input type='submit' value='submit'/></p>\n"); - pw.write("</body></html>"); - pw.flush(); - }catch(Exception _e){ - _res.setStatus(500); - } - } - - public void doPost(HttpServletRequest _req,HttpServletResponse _res) - { - String boardName = (_req.getParameter(PARAM_BOARD_NAME)); - String msg = (_req.getParameter(PARAM_BOARD_MESSAGE)); - String path = (_req.getParameter(PARAM_NODE_PATH)); - String id = (_req.getParameter(PARAM_NODE_ID)); - - try{ - bbs.editAttribute(boardName, path,id, msg); - PrintWriter pw = _res.getWriter(); - pw.write("successfully written"); - pw.flush(); - }catch(Exception _e){ - _res.setStatus(500); - } - } -}
--- a/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/EditNodeName.java Fri Oct 24 09:45:52 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -package jp.ac.u_ryukyu.cr.ie.tatsuki.bbs; - -import java.io.PrintWriter; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.BulletinBoard; - -public class EditNodeName extends HttpServlet -{ - private final XmlBulletinBoard bbs; - private static final String PARAM_BOARD_NAME = "bname"; - private static final String PARAM_NODE_PATH = "path"; - private static final String PARAM_BOARD_AUTHOR = "author"; - private static final String PARAM_BOARD_MESSAGE= "msg"; - private static final String PARAM_BOARD_EDITKEY = "key"; - - private static final long serialVersionUID = 1L; - - public EditNodeName(XmlBulletinBoard _bbs) - { - bbs = _bbs; - } - - public void doGet(HttpServletRequest _req,HttpServletResponse _res) - { - String bname = (_req.getParameter(PARAM_BOARD_NAME)); - String path = (_req.getParameter(PARAM_NODE_PATH)); - - - try{ - _res.setCharacterEncoding("UTF-8"); - PrintWriter pw = _res.getWriter(); - pw.write("<html><body><h1>edit message</h1>"); - pw.write("<form method='POST'\n"); - pw.write("<p><input type='hidden' name='author'/>" + - "<input type='hidden' name='key' value='"+path+"'/>" + - "<input type='hidden' name='bname' value='"+bname+"'</p>\n"); - pw.write("<p>Message<br/> <input type='textarea' name='msg'/> </p>\n"); - pw.write("<p><input type='submit' value='submit'/></p>\n"); - pw.write("</body></html>"); - pw.flush(); - }catch(Exception _e){ - _res.setStatus(500); - } - } - - public void doPost(HttpServletRequest _req,HttpServletResponse _res) - { - String boardName = (_req.getParameter(PARAM_BOARD_NAME)); - String author = (_req.getParameter(PARAM_BOARD_AUTHOR)); - String msg = (_req.getParameter(PARAM_BOARD_MESSAGE)); - String key = (_req.getParameter(PARAM_BOARD_EDITKEY)); - String path = (_req.getParameter(PARAM_NODE_PATH)); - - try{ - bbs.editMessage(boardName, path, author, msg, key); - PrintWriter pw = _res.getWriter(); - pw.write("successfully written"); - pw.flush(); - }catch(Exception _e){ - _res.setStatus(500); - } - } -}
--- a/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/MatrixApp.java Fri Oct 24 09:45:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/MatrixApp.java Fri Oct 24 16:24:26 2014 +0900 @@ -28,7 +28,6 @@ String createFolderPath = "/createFolder"; String createBoardPath = "/createBoard"; String editMessagePath = "/editMessage"; - String showBoardMessagePath = "/showBoardMessage"; String showMatrixPath = "/showMatrix"; String createAttributePath = "/createAttribute"; String editAttributePath = "/editAttribute"; @@ -38,31 +37,17 @@ Server serv = new Server(8080); ThreadPool thp = serv.getThreadPool(); Servlet createBoardMessage = new CreateBoardMessageServlet(BBS); - Servlet createFolder = new CreateNode(BBS); Servlet createBoard = new ReadXml(BBS); - Servlet editNode = new EditNodeName(BBS); - Servlet createAttribute = new createAttributeMatrix(BBS); - Servlet editAttribute = new EditAttributeServlet(BBS); - Servlet deleteAttribute = new deleteAttributeServlet(BBS); - Servlet deleteNode = new deleteNodeServlet(BBS); Servlet editBoardMessage = new EditMessageServlet(BBS); Servlet index = new ShowBoardsServletMatrix(BBS,createBoardPath,showMatrixPath); // Servlet board = new ShowBoardMessageServlet(BBS,createBoardMessagePath,editMessagePath); - Servlet board = new ShowMessageWithTimeStampServletMatrix(BBS,createBoardMessagePath,editMessagePath,showMatrixPath); Servlet matrix = new ShowMatrix(BBS,createFolderPath,editNodePath, showMatrixPath, createAttributePath, editAttributePath,deleteAttributePath,deleteNodePath,thp); ServletHandler context = new ServletHandler(); context.addServletWithMapping(new ServletHolder(editBoardMessage),editMessagePath); context.addServletWithMapping(new ServletHolder(createBoardMessage),createBoardMessagePath); - context.addServletWithMapping(new ServletHolder(createFolder),createFolderPath); context.addServletWithMapping(new ServletHolder(createBoard),createBoardPath); - context.addServletWithMapping(new ServletHolder(editNode),editNodePath); - context.addServletWithMapping(new ServletHolder(createAttribute),createAttributePath); context.addServletWithMapping(new ServletHolder(index),"/"); - context.addServletWithMapping(new ServletHolder(deleteAttribute),deleteAttributePath); - context.addServletWithMapping(new ServletHolder(deleteNode),deleteNodePath); - context.addServletWithMapping(new ServletHolder(editAttribute),editAttributePath); - context.addServletWithMapping(new ServletHolder(board),showBoardMessagePath); context.addServletWithMapping(new ServletHolder(matrix),showMatrixPath); /* * For write benchmark
--- a/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/ShowMatrix.java Fri Oct 24 09:45:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/ShowMatrix.java Fri Oct 24 16:24:26 2014 +0900 @@ -88,26 +88,14 @@ _pw.write("<small><a href=" + showMatrixPath + "?bname=" + bbs.sanitize(_bname) + "&uuid=" + path + "/" + msg.getUUID() + "&nodeName=" + bbs.sanitize(msg.getMessage()) + ">" + bbs.sanitize(msg.getMessage()) - + "</a></small>"); - _pw.write(" "); - _pw.write("<small><a href='" + editNodePath + "?bname=" + bbs.sanitize(_bname) - + "&path=" + path + "/" + msg.getUUID() - + "'>edit</a></small>"); - _pw.write(" "); - _pw.write("<small><a href='" + deleteNodePath + "?bname=" + bbs.sanitize(_bname) - + "&path=" + path + "&id=" + msg.getUUID() - + "'>delete</a><br><br></small>"); + + "</a><br><br></small>"); } _pw.write("<br><hr/><p>Value</p>"); getAttributeImp attribute = (bbs.getAttribute(_bname, path)); - _pw.write("<a href='" + editAttributePath + "?bname=" + bbs.sanitize(_bname) - + "&path=" + path + "&id=" + "'>" - + bbs.sanitize(attribute.getMessage()) + "</a>"); - _pw.write("<a href='" + deleteAttributePath + "?bname=" + bbs.sanitize(_bname) - + "&path=" + path + "&id=" + "'>" + " delete" - + "</a></p>"); + _pw.write(bbs.sanitize(attribute.getMessage())); + _pw.write("</body></html>"); _pw.flush();
--- a/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/ShowMessageWithTimeStampServletMatrix.java Fri Oct 24 09:45:52 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -package jp.ac.u_ryukyu.cr.ie.tatsuki.bbs; - -import java.io.PrintWriter; - - - - - - - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.BoardMessage; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.BulletinBoard; - -public class ShowMessageWithTimeStampServletMatrix extends HttpServlet { - /** - * - */ - private static final long serialVersionUID = 1L; - private final XmlBulletinBoard bbs; - private final String createBoardMessagePath; - private final String editMessagePath; - private final String showMatrixPath; - - private static final String PARAM_BOARD_NAME = "bname"; - - public ShowMessageWithTimeStampServletMatrix(XmlBulletinBoard _bbs, - String _createBoardMessagePath, String _editMessagePath, String _showMatrixPath) { - bbs = _bbs; - showMatrixPath = _showMatrixPath; - createBoardMessagePath = _createBoardMessagePath; - editMessagePath = _editMessagePath; - } - - public void doGet(HttpServletRequest _req, HttpServletResponse _res) { - final String bname = (_req.getParameter(PARAM_BOARD_NAME)); - try { - _res.setCharacterEncoding("UTF-8"); - printBoard(bname, _res.getWriter()); - } catch (Exception _e) { - _res.setStatus(500); - } - } - - private void printBoard(String _bname, PrintWriter _pw) throws Exception { - _pw.write("<html><body>\n"); - _pw.write("<h1>" + bbs.sanitize(_bname) + "</h1>\n"); - - _pw.write("<form action='" + createBoardMessagePath + "' method='POST'\n"); - _pw.write("<p>Author : <input type='text' name='author'/> <input type='hidden' name='bname' value='" +bbs.sanitize( _bname) + "'/> EditKey : <input type='textarea' 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"); - _pw.write("<small><a href=" + showMatrixPath + "?bname=" + bbs.sanitize(_bname) + "&uuid= >MatrixMode"+"</a></small><br>"); - - for (BoardMessage msg : bbs.getMessages(_bname)) {//フォルダの表示 - _pw.write("<hr/>"); - _pw.write("<p> Author <b>" + bbs.sanitize(msg.getAuthor()) + "</b></p>"); - _pw.write("<small><a href=" + editMessagePath + "?bname=" + bbs.sanitize(_bname) - + "&uuid=" + msg.getUUID() + ">"+ bbs.sanitize(msg.getMessage()) +"</a></small><br>"); - } - - _pw.write("</body></html>"); - _pw.flush(); - } -}
--- a/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/createAttributeMatrix.java Fri Oct 24 09:45:52 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -package jp.ac.u_ryukyu.cr.ie.tatsuki.bbs; - -import java.io.PrintWriter; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.BulletinBoard; - -public class createAttributeMatrix extends HttpServlet -{ - private final XmlBulletinBoard bbs; - private static final String PARAM_BOARD_NAME = "bname"; - private static final String PARAM_NODE_PATH = "path"; - private static final String PARAM_BOARD_AUTHOR = "author"; - private static final String PARAM_BOARD_MESSAGE= "msg"; - private static final String PARAM_BOARD_EDITKEY = "key"; - - private static final long serialVersionUID = 1L; - - public createAttributeMatrix(XmlBulletinBoard _bbs) - { - bbs = _bbs; - } - - - - public void doPost(HttpServletRequest _req,HttpServletResponse _res) - { - String boardName = (_req.getParameter(PARAM_BOARD_NAME)); - String author = (_req.getParameter(PARAM_BOARD_AUTHOR));//not use - String msg = (_req.getParameter(PARAM_BOARD_MESSAGE)); - String key = (_req.getParameter(PARAM_BOARD_EDITKEY)); // not use - String uuid = (_req.getParameter(PARAM_NODE_PATH)); - try{ - bbs.createAttribute(boardName, uuid, author, msg, key); - PrintWriter pw = _res.getWriter(); - pw.write("successfully written"); - pw.flush(); - }catch(Exception _e){ - _res.setStatus(500); - } - } -}
--- a/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/deleteAttributeServlet.java Fri Oct 24 09:45:52 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -package jp.ac.u_ryukyu.cr.ie.tatsuki.bbs; - -import java.io.PrintWriter; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - - -public class deleteAttributeServlet extends HttpServlet -{ - private final XmlBulletinBoard bbs; - private static final String PARAM_BOARD_NAME = "bname"; - private static final String PARAM_NODE_PATH = "path"; - //private static final String PARAM_BOARD_MESSAGE= "msg"; - //private static final String PARAM_BOARD_EDITKEY = "key"; - private static final String PARAM_NODE_ID = "id"; - private static final long serialVersionUID = 1L; - - public deleteAttributeServlet(XmlBulletinBoard _bbs) - { - bbs = _bbs; - } - - public void doGet(HttpServletRequest _req,HttpServletResponse _res) - { - String bname = (_req.getParameter(PARAM_BOARD_NAME)); - String path = (_req.getParameter(PARAM_NODE_PATH)); - String id = (_req.getParameter(PARAM_NODE_ID)); - - - try{ - _res.setCharacterEncoding("UTF-8"); - PrintWriter pw = _res.getWriter(); - pw.write("<html><body><h1>delete Attribute ?</h1>"); - pw.write("<form method='POST'\n"); - pw.write("<p><input type='hidden' name='path' value='"+path+"'/>" + - "<input type='hidden' name='id' value='"+id+"'/>" + - "<input type='hidden' name='bname' value='"+bname+"'</p>\n"); - pw.write("<p><input type='submit' value='submit'/></p>\n"); - pw.write("</body></html>"); - pw.flush(); - }catch(Exception _e){ - _res.setStatus(500); - } - } - - public void doPost(HttpServletRequest _req,HttpServletResponse _res) - { - String boardName = (_req.getParameter(PARAM_BOARD_NAME)); - String path = (_req.getParameter(PARAM_NODE_PATH)); - String id = (_req.getParameter(PARAM_NODE_ID)); - - try{ - bbs.deleteAttribute(boardName, path,id); - PrintWriter pw = _res.getWriter(); - pw.write("successfully written"); - pw.flush(); - }catch(Exception _e){ - _res.setStatus(500); - } - } -}
--- a/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/deleteNodeServlet.java Fri Oct 24 09:45:52 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -package jp.ac.u_ryukyu.cr.ie.tatsuki.bbs; -import java.io.PrintWriter; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class deleteNodeServlet extends HttpServlet -{ - private final XmlBulletinBoard bbs; - private static final String PARAM_BOARD_NAME = "bname"; - private static final String PARAM_BOARD_PATH = "path"; - private static final String PARAM_NODE_ID = "id"; - - private static final long serialVersionUID = 1L; - - public deleteNodeServlet(XmlBulletinBoard _bbs) - { - bbs = _bbs; - } - - public void doGet(HttpServletRequest _req,HttpServletResponse _res) - { - String bname = (_req.getParameter(PARAM_BOARD_NAME)); - String path = (_req.getParameter(PARAM_BOARD_PATH )); - String id = (_req.getParameter(PARAM_NODE_ID)); - - try{ - _res.setCharacterEncoding("UTF-8"); - PrintWriter pw = _res.getWriter(); - pw.write("<html><body><h1>delete message ?</h1>"); - pw.write("<form method='POST'\n"); - pw.write("<p><input type='hidden' name='path' value='" + path + "'/>" + - "<input type='hidden' name='id' value='" + id +"'/>" + - "<input type='hidden' name='bname' value='" + bname + "'</p>\n"); - pw.write("<p><input type='submit' value='submit'/></p>\n"); - pw.write("</body></html>"); - pw.flush(); - }catch(Exception _e){ - _res.setStatus(500); - } - } - - public void doPost(HttpServletRequest _req,HttpServletResponse _res) - { - String boardName = (_req.getParameter(PARAM_BOARD_NAME)); - String path = (_req.getParameter(PARAM_BOARD_PATH)); - String id = (_req.getParameter(PARAM_NODE_ID)); - try{ - bbs.deleteNode(boardName, path, id); - PrintWriter pw = _res.getWriter(); - pw.write("successfully written"); - pw.flush(); - }catch(Exception _e){ - _res.setStatus(500); - } - } -}