package com.eactive.eai.rms.onl.server.handler;//package com.eactive.eai.rms.onl.server.handler;
//
//import org.apache.mina.common.IoSession;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import com.eactive.eai.rms.onl.server.UdpServerSessionHandler;
//import com.eactive.eai.rms.onl.vo.LogConfigurationCommand;
//
//@Service
//public class LogConfigurationCommandHandler implements IMessageHandler {
//
//    @Autowired
//    UdpServerSessionHandler udpServerSessionHandler;
//
//    public Class<LogConfigurationCommand> targetClass() {
//        return LogConfigurationCommand.class;
//    }
//
//    public void messageReceived( Object message)
//            throws Exception {
//        LogConfigurationCommand command = (LogConfigurationCommand) message;
//
//        //session.setAttribute(command.getMessageKey(), command);
//    }
//
//    public LogConfigurationCommand executeCommand(
//            LogConfigurationCommand command) throws Exception {
//
//        LogConfigurationCommand receved = null;
//
//        IoSession session = udpServerSessionHandler.getSession(
//            command.getHostName(), command.getInstanceName());
//
//        command.setMessageKey(LogConfigurationCommand.class.getName()
//                + System.currentTimeMillis());
//
//        session.write(command);
//
//        for (int i = 0; i < 50; i++) {
//            receved = (LogConfigurationCommand) session.removeAttribute(command.getMessageKey());
//            if (receved != null) {
//                break;
//            }
//            Thread.sleep(100);
//        }
//
//        return receved;
//
//    }
//
//}
