144
|
1 package rep.handler;
|
|
2
|
148
|
3 import java.nio.channels.SelectionKey;
|
|
4
|
144
|
5 import rep.REPCommand;
|
|
6 import rep.SessionManager;
|
|
7 import rep.channel.ChannelSimulator;
|
|
8 import rep.channel.REPSocketChannel;
|
|
9 import rep.channel.SelectionKeySimulator;
|
|
10
|
|
11 public class REPHandlerImpl implements REPHandler {
|
|
12
|
|
13 private SessionManager manager;
|
|
14
|
|
15
|
|
16 public REPHandlerImpl(SessionManager manager) {
|
|
17 this.manager = manager;
|
|
18 }
|
|
19
|
|
20 public void handle(SelectionKeySimulator key) {
|
|
21 REPSocketChannel<REPCommand> channel = (REPSocketChannel<REPCommand>) key.channel();
|
|
22 REPCommand packet = channel.read();
|
|
23 REPCommand command = packet;
|
|
24 manager.manage(channel, command);
|
|
25 }
|
|
26
|
148
|
27 public void handle(SelectionKey key) {
|
|
28 // TODO Auto-generated method stub
|
|
29
|
|
30 }
|
|
31
|
144
|
32 }
|