// Path: src/com/thetransactioncompany/jsonrpc2/client/JSONRPC2SessionException.java
// public class JSONRPC2SessionException extends Exception {
// 
// 	
// 	/**
// 	 * The exception cause is network or I/O related.
// 	 */
// 	public static final int NETWORK_EXCEPTION = 1;
// 	
// 	
// 	/**
// 	 * Unexpected "Content-Type" header value of the HTTP response.
// 	 */
// 	public static final int UNEXPECTED_CONTENT_TYPE = 2;
// 	
// 	
// 	/**
// 	 * Invalid JSON-RPC 2.0 response.
// 	 */
// 	public static final int BAD_RESPONSE = 3;
// 	
// 	
// 	/**
// 	 * Indicates the type of cause for this exception, see
// 	 * constants.
// 	 */
// 	private int causeType;
// 	
// 	
// 	/**
// 	 * Creates a new JSON-RPC 2.0 session exception with the specified 
// 	 * message and cause type.
// 	 *
// 	 * @param message   The message.
// 	 * @param causeType The cause type, see the constants.
// 	 */
// 	public JSONRPC2SessionException(final String message, final int causeType) {
// 	
// 		super(message);
// 		this.causeType = causeType;
// 	}
// 	
// 	
// 	/**
// 	 * Creates a new JSON-RPC 2.0 session exception with the specified 
// 	 * message, cause type and cause.
// 	 *
// 	 * @param message   The message.
// 	 * @param causeType The cause type, see the constants.
// 	 * @param cause     The original exception.
// 	 */
// 	public JSONRPC2SessionException(final String message, final int causeType, final Throwable cause) {
// 	
// 		super(message, cause);
// 		this.causeType = causeType;
// 	}
// 	
// 	
// 	/**
// 	 * Returns the exception cause type.
// 	 *
// 	 * @return The cause type constant.
// 	 */
// 	public int getCauseType() {
// 	
// 		return causeType;
// 	}
// }
// 
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidParametersException.java
// public class InvalidParametersException extends Exception {
// 
// 	/**
// 	 * Signifies that the paramers we sent were invalid for the used JSONRPC2
// 	 * method.
// 	 */
// 	private static final long serialVersionUID = 4044188679464846005L;
// 
// }
// 
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidPasswordException.java
// public class InvalidPasswordException extends Exception {
// 
// 	/**
// 	 * The remote I2PControl server is rejecting the provided password.
// 	 */
// 	private static final long serialVersionUID = 8461972369522962046L;
// 
// }
// 
// Path: src/net/i2p/itoopie/i2pcontrol/methods/GetRateStat.java
// public class GetRateStat{
// 	
// 	@SuppressWarnings("unchecked")
// 	public static Double execute(String stat, long period)
// 			throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException {
// 
// 		JSONRPC2Request req = new JSONRPC2Request("GetRate", JSONRPC2Interface.incrNonce());
// 		@SuppressWarnings("rawtypes")
// 		Map params = new HashMap();
// 		params.put("Stat", stat);
// 		params.put("Period", period);
// 		req.setParams(params);
// 
// 		JSONRPC2Response resp = null;
// 		try {
// 			resp = JSONRPC2Interface.sendReq(req);
// 			HashMap inParams = (HashMap) resp.getResult();
// 			
// 			if (inParams == null)
// 				return 0D;
// 			
// 			try {
// 				Double dbl = (Double) inParams.get("Result"); 
// 				return dbl;
// 			} catch (ClassCastException e){
// 				Log _log = LogFactory.getLog(GetRateStat.class);
// 				_log.debug("Error: Tried to cast a BigDecimal as Double");
// 			}
// 			try {
// 				BigDecimal bigNum = (BigDecimal) inParams.get("Result"); 					
// 				Double dbl = bigNum.doubleValue();
// 				return dbl;
// 			} catch (ClassCastException e){
// 				Log _log = LogFactory.getLog(GetRateStat.class);
// 				_log.debug("Error: Tried to cast a double as a BigDecimal");
// 			} 
// 		}catch (UnrecoverableFailedRequestException e) {
// 			Log _log = LogFactory.getLog(GetRateStat.class);
// 			_log.error("getRateStat failed.", e);
// 		}
// 		return new Double(0);
// 	}
// }


import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
import net.i2p.itoopie.i2pcontrol.methods.GetRateStat;
package net.i2p.itoopie.gui.component.chart;



/**
 *  Unused
 */
public class RateStatTracker extends Thread implements Tracker {
	
	/** Last read bw */
	private double m_value = 0;
	private final int updateInterval;
	
	/** Which RateStat to measure from the router */
	private String rateStat;
	
	/** Which period of a stat to measure */
	private long period;

	/**
	 * Start daemon that checks to current inbound bandwidth of the router.
	 */
	public RateStatTracker(String rateStat, long period, int interval) {
		super("IToopie-RST");
		this.rateStat = rateStat;
		this.period = period;
		updateInterval = interval;
		this.setDaemon(true);
		this.start();
	}

	/**
	 * @see java.lang.Runnable#run()
	 */
	@Override
	public void run() {

		while (true) {
			try {
				m_value = GetRateStat.execute(rateStat, period);
			} catch (InvalidPasswordException e1) {
			} catch (JSONRPC2SessionException e1) {
			} catch (InvalidParametersException e1) {
			}

			try {
// Path: src/com/thetransactioncompany/jsonrpc2/client/JSONRPC2SessionException.java
// public class JSONRPC2SessionException extends Exception {
// 
// 	
// 	/**
// 	 * The exception cause is network or I/O related.
// 	 */
// 	public static final int NETWORK_EXCEPTION = 1;
// 	
// 	
// 	/**
// 	 * Unexpected "Content-Type" header value of the HTTP response.
// 	 */
// 	public static final int UNEXPECTED_CONTENT_TYPE = 2;
// 	
// 	
// 	/**
// 	 * Invalid JSON-RPC 2.0 response.
// 	 */
// 	public static final int BAD_RESPONSE = 3;
// 	
// 	
// 	/**
// 	 * Indicates the type of cause for this exception, see
// 	 * constants.
// 	 */
// 	private int causeType;
// 	
// 	
// 	/**
// 	 * Creates a new JSON-RPC 2.0 session exception with the specified 
// 	 * message and cause type.
// 	 *
// 	 * @param message   The message.
// 	 * @param causeType The cause type, see the constants.
// 	 */
// 	public JSONRPC2SessionException(final String message, final int causeType) {
// 	
// 		super(message);
// 		this.causeType = causeType;
// 	}
// 	
// 	
// 	/**
// 	 * Creates a new JSON-RPC 2.0 session exception with the specified 
// 	 * message, cause type and cause.
// 	 *
// 	 * @param message   The message.
// 	 * @param causeType The cause type, see the constants.
// 	 * @param cause     The original exception.
// 	 */
// 	public JSONRPC2SessionException(final String message, final int causeType, final Throwable cause) {
// 	
// 		super(message, cause);
// 		this.causeType = causeType;
// 	}
// 	
// 	
// 	/**
// 	 * Returns the exception cause type.
// 	 *
// 	 * @return The cause type constant.
// 	 */
// 	public int getCauseType() {
// 	
// 		return causeType;
// 	}
// }
// 
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidParametersException.java
// public class InvalidParametersException extends Exception {
// 
// 	/**
// 	 * Signifies that the paramers we sent were invalid for the used JSONRPC2
// 	 * method.
// 	 */
// 	private static final long serialVersionUID = 4044188679464846005L;
// 
// }
// 
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidPasswordException.java
// public class InvalidPasswordException extends Exception {
// 
// 	/**
// 	 * The remote I2PControl server is rejecting the provided password.
// 	 */
// 	private static final long serialVersionUID = 8461972369522962046L;
// 
// }
// 
// Path: src/net/i2p/itoopie/i2pcontrol/methods/GetRateStat.java
// public class GetRateStat{
// 	
// 	@SuppressWarnings("unchecked")
// 	public static Double execute(String stat, long period)
// 			throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException {
// 
// 		JSONRPC2Request req = new JSONRPC2Request("GetRate", JSONRPC2Interface.incrNonce());
// 		@SuppressWarnings("rawtypes")
// 		Map params = new HashMap();
// 		params.put("Stat", stat);
// 		params.put("Period", period);
// 		req.setParams(params);
// 
// 		JSONRPC2Response resp = null;
// 		try {
// 			resp = JSONRPC2Interface.sendReq(req);
// 			HashMap inParams = (HashMap) resp.getResult();
// 			
// 			if (inParams == null)
// 				return 0D;
// 			
// 			try {
// 				Double dbl = (Double) inParams.get("Result"); 
// 				return dbl;
// 			} catch (ClassCastException e){
// 				Log _log = LogFactory.getLog(GetRateStat.class);
// 				_log.debug("Error: Tried to cast a BigDecimal as Double");
// 			}
// 			try {
// 				BigDecimal bigNum = (BigDecimal) inParams.get("Result"); 					
// 				Double dbl = bigNum.doubleValue();
// 				return dbl;
// 			} catch (ClassCastException e){
// 				Log _log = LogFactory.getLog(GetRateStat.class);
// 				_log.debug("Error: Tried to cast a double as a BigDecimal");
// 			} 
// 		}catch (UnrecoverableFailedRequestException e) {
// 			Log _log = LogFactory.getLog(GetRateStat.class);
// 			_log.error("getRateStat failed.", e);
// 		}
// 		return new Double(0);
// 	}
// }


// Path: src/net/i2p/itoopie/gui/component/chart/RateStatTracker.java
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
import net.i2p.itoopie.i2pcontrol.methods.GetRateStat;

package net.i2p.itoopie.gui.component.chart;



/**
 *  Unused
 */
public class RateStatTracker extends Thread implements Tracker {
	
	/** Last read bw */
	private double m_value = 0;
	private final int updateInterval;
	
	/** Which RateStat to measure from the router */
	private String rateStat;
	
	/** Which period of a stat to measure */
	private long period;

	/**
	 * Start daemon that checks to current inbound bandwidth of the router.
	 */
	public RateStatTracker(String rateStat, long period, int interval) {
		super("IToopie-RST");
		this.rateStat = rateStat;
		this.period = period;
		updateInterval = interval;
		this.setDaemon(true);
		this.start();
	}

	/**
	 * @see java.lang.Runnable#run()
	 */
	@Override
	public void run() {

		while (true) {
			try {
				m_value = GetRateStat.execute(rateStat, period);
			} catch (InvalidPasswordException e1) {
			} catch (JSONRPC2SessionException e1) {
			} catch (InvalidParametersException e1) {
			}

			try {
				Thread.sleep(updateInterval);