view rep/handler/REPEditorHandler.java @ 337:5ba5b7a9761b

use REPLogger
author kono
date Sun, 12 Oct 2008 18:42:18 +0900
parents 77f443f6dc9f
children 86935b872385
line wrap: on
line source

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();
		SessionManager.logger.writeLog("REPHandlerImpl.handle() read : command = " + command +" from "+channel);

		manager.manage(channel, command);
	}

	public void cancel(REPSocketChannel<REPCommand> socketChannel) {
		manager.remove(socketChannel);
	}


}