Mercurial > hg > RemoteEditor > REPSessionManager
changeset 131:617a47cb0150
*** empty log message ***
author | pin |
---|---|
date | Wed, 27 Aug 2008 18:17:16 +0900 |
parents | fc15d8fd1326 |
children | 70fc1e70652c |
files | rep/Editor.java rep/EditorList.java rep/REPPacketReceive.java rep/REPPacketSend.java rep/Session.java rep/xml/SessionXMLDecoder.java |
diffstat | 6 files changed, 28 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/rep/Editor.java Wed Aug 27 18:17:12 2008 +0900 +++ b/rep/Editor.java Wed Aug 27 18:17:16 2008 +0900 @@ -4,10 +4,12 @@ import java.util.LinkedList; import java.util.StringTokenizer; +import rep.channel.REPSocketChannel; + public class Editor { private int eid; - private SocketChannel myChannel; - private SocketChannel nextChannel; + private REPSocketChannel myChannel; + private REPSocketChannel nextChannel; private String host; private String port; //public int getEID; @@ -15,12 +17,12 @@ private LinkedList<REPCommand> undoCommandList = new LinkedList<REPCommand>(); private LinkedList<Integer> temp = new LinkedList<Integer>(); - public Editor(int editorNo, SocketChannel channel){ + public Editor(int editorNo, REPSocketChannel channel){ this.eid = editorNo; this.myChannel = channel; } - public Editor(SocketChannel channel) { + public Editor(REPSocketChannel channel) { this.myChannel = channel; setHostAndPort(myChannel); } @@ -28,8 +30,8 @@ public Editor() { } - private void setHostAndPort(SocketChannel channel) { - String socketString = channel.socket().getRemoteSocketAddress().toString(); + private void setHostAndPort(REPSocketChannel myChannel2) { + String socketString = myChannel2.socket().getRemoteSocketAddress().toString(); String[] split = socketString.split("/"); int length = split.length; String hostAndPort = split[length-1]; @@ -38,7 +40,7 @@ port = split[1]; } - public SocketChannel getChannel() { + public REPSocketChannel getChannel() { return myChannel; } @@ -81,7 +83,7 @@ send.send(repCmd); } - public void setChannel(SocketChannel channel) { + public void setChannel(REPSocketChannel channel) { myChannel = channel; }
--- a/rep/EditorList.java Wed Aug 27 18:17:12 2008 +0900 +++ b/rep/EditorList.java Wed Aug 27 18:17:16 2008 +0900 @@ -3,6 +3,8 @@ import java.nio.channels.SocketChannel; import java.util.LinkedList; +import rep.channel.REPSocketChannel; + public class EditorList { private int numberOfEditor; @@ -31,13 +33,13 @@ send.send(command); } - public int addEditor(SocketChannel channel, REPCommand repCmd) { + public int addEditor(REPSocketChannel channel, REPCommand repCmd) { numberOfEditor++; editorList.add(new Editor(numberOfEditor, channel)); return numberOfEditor; } - public void addEditor(SocketChannel channel) { + public void addEditor(REPSocketChannel channel) { editorList.add(new Editor(0, channel)); }
--- a/rep/REPPacketReceive.java Wed Aug 27 18:17:12 2008 +0900 +++ b/rep/REPPacketReceive.java Wed Aug 27 18:17:16 2008 +0900 @@ -13,14 +13,15 @@ import java.util.StringTokenizer; import rep.channel.ChannelSimulator; +import rep.channel.REPSocketChannel; public class REPPacketReceive { - SocketChannel socketchannel; + REPSocketChannel socketchannel; private final int HEADER_SIZE = 24; SelectionKey key; - public REPPacketReceive(SocketChannel sc){ + public REPPacketReceive(REPSocketChannel sc){ socketchannel = sc; }
--- a/rep/REPPacketSend.java Wed Aug 27 18:17:12 2008 +0900 +++ b/rep/REPPacketSend.java Wed Aug 27 18:17:16 2008 +0900 @@ -7,14 +7,16 @@ import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; +import rep.channel.REPSocketChannel; + public class REPPacketSend { - SocketChannel socketchannel; + REPSocketChannel socketchannel; // JIS/S-JIS = 2, UTF-8 = 3, UTF-?? = 5 final int CHAR_ORDER = 5; - public REPPacketSend(SocketChannel sc){ - socketchannel = sc; + public REPPacketSend(REPSocketChannel channel){ + socketchannel = channel; } private ByteBuffer pack(REPCommand command){
--- a/rep/Session.java Wed Aug 27 18:17:12 2008 +0900 +++ b/rep/Session.java Wed Aug 27 18:17:16 2008 +0900 @@ -4,6 +4,8 @@ import java.util.LinkedList; import java.util.List; +import rep.channel.REPSocketChannel; + public class Session { private Editor masterEditor; private int sessionID; @@ -15,7 +17,7 @@ private int incrementEID; private boolean isOwner = false; - public Session(int sessionID, String string, SocketChannel channel) { + public Session(int sessionID, String string, REPSocketChannel channel) { masterEditor = new Editor(sessionID, channel); this.sessionID = sessionID; this.sessionName = string; @@ -28,7 +30,7 @@ this.sessionName = editor.getName(); } - public void addEditor(int editorID, SocketChannel channel) { + public void addEditor(int editorID, REPSocketChannel channel) { editorList.add(new Editor(editorID, channel)); } public LinkedList<Editor> getEditorList() {
--- a/rep/xml/SessionXMLDecoder.java Wed Aug 27 18:17:12 2008 +0900 +++ b/rep/xml/SessionXMLDecoder.java Wed Aug 27 18:17:16 2008 +0900 @@ -25,10 +25,11 @@ import rep.Editor; import rep.Session; import rep.SessionList; +import rep.channel.REPSocketChannel; public class SessionXMLDecoder { - private SocketChannel channel; + private REPSocketChannel channel; public SessionXMLDecoder(String string) { decode(string);