package com.eactive.eai.adapter.socket2.protocol.cisco;

import com.eactive.eai.adapter.socket2.config.SocketAdapterContext;
import com.eactive.eai.adapter.socket2.protocol.TcpAdapterClient;
import com.eactive.eai.adapter.socket2.protocol.cisco.codec.CiscoCodecFactory;
import org.apache.mina.filter.codec.ProtocolCodecFilter;

public class CiscoClient extends TcpAdapterClient {

	public CiscoClient(SocketAdapterContext context) throws Exception {
		super(context);
		this.handler = new CiscoHandler(this);
		config.getFilterChain().addFirst("codec", new ProtocolCodecFilter(new CiscoCodecFactory(this)));

		/**
		 * TODO : snmp 와 연동하여 아래 작업 할 것 flow control filter
		 */
		//config.getFilterChain().addLast("flowControl", new FlowControlFilter());
		
		/*
		ReadThrottleFilterBuilder filter = new ReadThrottleFilterBuilder(); 
		filter.attach(config.getFilterChain());
		*/


		/**
		 * flow control filter (apache mina version 1.9.x)
		 */
		/*
		 * config.getFilterChain().addLast("executor", new ExecutorFilter(executor)); 
		 * ReadThrottleFilterBuilder flowControlFilter = new ReadThrottleFilterBuilder();
		 * flowControlFilter.setMaximumConnectionBufferSize(1024*1024); // 1MB
		 * flowControlFilter.attach(config.getFilterChain());
		 */

		/**
		 * flow control filter (apache mina version 2.x)
		 */
		/*
		 * config.getFilterChain().addLast("flowControl", new ReadThrottleFilter()); 
		 * config.getFilterChain().addLast("flowControl", new WriteThrottleFilter());
		 */		
	}
}
