package com.eactive.eai.rms.client.common;

import com.eactive.eai.rms.client.SocketClient;
import com.eactive.eai.rms.client.context.RmsProperties;
import com.eactive.eai.rms.onl.vo.MonitorDataVo;

import org.apache.mina.common.IoConnector;
import org.apache.mina.common.IoConnectorConfig;
import org.apache.mina.common.IoHandler;
import org.apache.mina.common.IoSession;
import org.apache.mina.common.ThreadModel;
import org.apache.mina.filter.codec.ProtocolCodecFactory;

/**
 * The Class AbstractSocketClient.
 * <ul>
 * <li>1. Function :</li>
 * <li>2. Summary :</li>
 * <li>3. Notification :</li>
 * </ul>
 * 
 * @author  : $Author: 
 * @version : $Revision: 1.2 $
 */
public abstract class AbstractSocketClient implements SocketClient {

    /** The Constant connector. */
    protected IoConnector connector;

    /** The datagram connector config. */
    protected IoConnectorConfig connectorConfig;

    /** The protocol codec factory. */
    protected ProtocolCodecFactory protocolCodecFactory;

    /** The handler. */
    protected IoHandler handler;

    /** The session. */
    protected IoSession session;

    /** The monitoring context. */
    protected RmsProperties rmsProperties;

    /** The thread model. */
    protected ThreadModel threadModel;

    /* (non-Javadoc)
     * @see com.eactive.eai.rms.client.SocketClient#send(com.eactive.eai.rms.vo.MonitorDataVo)
     */
    public abstract void send(MonitorDataVo serializable);

    /* (non-Javadoc)
     * @see com.eactive.eai.rms.client.SocketClient#destroy()
     */
    public abstract void destroy();

    /**
     * Sets the protocol codec factory.
     * 
     * @param protocolCodecFactory the new protocol codec factory
     */
    public void setProtocolCodecFactory(
            ProtocolCodecFactory protocolCodecFactory) {
        this.protocolCodecFactory = protocolCodecFactory;
    }

    /**
     * Sets the handler.
     * 
     * @param handler the new handler
     */
    public void setHandler(IoHandler handler) {
        this.handler = handler;
    }

    /**
     * Sets the rms properties.
     * 
     * @param rmsProperties the new rms properties
     */
    public void setRmsProperties(RmsProperties rmsProperties) {
        this.rmsProperties = rmsProperties;
    }

    /**
     * Sets the thread model.
     * 
     * @param threadModel the new thread model
     */
    public void setThreadModel(ThreadModel threadModel) {
        this.threadModel = threadModel;
    }

}
