Mercurial > hg > RemoteEditor > REPSessionManager
comparison 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 |
comparison
equal
deleted
inserted
replaced
315:20fb70068089 | 316:77f443f6dc9f |
---|---|
1 package rep.handler; | |
2 | |
3 import java.io.IOException; | |
4 | |
5 import rep.REPCommand; | |
6 import rep.SessionManager; | |
7 import rep.channel.REPSelectionKey; | |
8 import rep.channel.REPSocketChannel; | |
9 | |
10 public class REPEditorHandler implements REPHandler { | |
11 | |
12 private SessionManager manager; | |
13 | |
14 | |
15 public REPEditorHandler(SessionManager manager) { | |
16 this.manager = manager; | |
17 } | |
18 | |
19 public void handle(REPSelectionKey<REPCommand> key) throws IOException { | |
20 REPSocketChannel<REPCommand> channel = key.channel1(); | |
21 REPCommand command = channel.read(); | |
22 System.out.println("REPHandlerImpl.handle() read : command = " + command +" from "+channel); | |
23 | |
24 manager.manage(channel, command); | |
25 } | |
26 | |
27 public void cancel(REPSocketChannel<REPCommand> socketChannel) { | |
28 manager.remove(socketChannel); | |
29 } | |
30 | |
31 | |
32 } |