Mercurial > hg > RemoteEditor > REPSessionManager
diff rep/handler/REPEditorHandler.java @ 316:77f443f6dc9f
add session manager channel handler
author | kono |
---|---|
date | Tue, 07 Oct 2008 18:15:33 +0900 |
parents | |
children | 5ba5b7a9761b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rep/handler/REPEditorHandler.java Tue Oct 07 18:15:33 2008 +0900 @@ -0,0 +1,32 @@ +package rep.handler; + +import java.io.IOException; + +import rep.REPCommand; +import rep.SessionManager; +import rep.channel.REPSelectionKey; +import rep.channel.REPSocketChannel; + +public class REPEditorHandler implements REPHandler { + + private SessionManager manager; + + + public REPEditorHandler(SessionManager manager) { + this.manager = manager; + } + + public void handle(REPSelectionKey<REPCommand> key) throws IOException { + REPSocketChannel<REPCommand> channel = key.channel1(); + REPCommand command = channel.read(); + System.out.println("REPHandlerImpl.handle() read : command = " + command +" from "+channel); + + manager.manage(channel, command); + } + + public void cancel(REPSocketChannel<REPCommand> socketChannel) { + manager.remove(socketChannel); + } + + +}