/*
 * Created on 29 déc. 2005
 *
 */
package archean.util.mina;

import java.util.Date;

import javax.management.openmbean.TabularData;

/**
 * MBean interface for the session manager, it's used for instrumenting IoSession 
 * @author Julien Vermillard - Archean
 */
public interface SessionManagerMBean {
	/**
	 * is the session is connected
	 * @return connection status
	 */
	public boolean isConnected();

	/**
	 * bytes read from the beginning
	 * @return total of bytes read
	 */
	public long getReadBytes();

	/**
	 * bytes written from the beginning
	 * @return total of bytes written
	 */
	public long getWrittenBytes();

	/**
	 * close the session
	 */
	public void close();

	/**
	 * when the session was created
	 * @return the date of session creation
	 */
	public Date getCreationTime();
	
	/**
	 * last time the session processed an IO
	 * @return date of last IO
	 */
	public Date getLastIoTime();
	
	/**
	 * last time the session processed a write
	 * @return date of last write
	 */
	public Date getLastWriteTime();
	
	/**
	 * last time the session processed an read
	 * @return date of last read
	 */
	public Date getLastReadTime();
	
	/**
	 * total reading byte/sec ratio (not instantaneous!) 
	 * @return total read bytes per sec
	 */
	public float getReadByteSec();

	/**
	 * total writting byte/sec ratio (not instantaneous!) 
	 * @return total written bytes per sec
	 */
	public float getWrittenByteSec();
	
	/**
	 * get the list of filters installed in the filter chain
	 * @return array of filter names
	 */
	public String[] getInstalledFilters();
	
	/**
	 * filters in a tabular way
	 * @return tabular list of filters
	 */
	public TabularData getFilters();

	/**
	 * add a logging filter at end of the chain
	 */
	public void addLastLoggingFilter();

	/**
	 * remove the logging filter at end of the chain
	 */
	public void removeLastLoggingFilter();
	
	/**
	 * add a logging filter at begining of the chain
	 */
	public void addFirstLoggingFilter();
	
	/**
	 * remove the logging filter at begining of the chain
	 */
	public void removeFirstLoggingFilter();

	/**
	 * read and write IDLE time
	 * @return idle time in milli-seconds
	 */
	public long getBothIdleTime();
	
	/**
	 * read IDLE time
	 * @return read idle time in milli-seconds
	 */	
	public long getReadIdleTime();
	
	/**
	 * write IDLE time
	 * @return write idle time in milli-seconds
	 */	
	public long getWriteIdleTime();
}