Renamed JSONInterface to the more correct JSONRPC2Interface.
This commit is contained in:
@ -16,7 +16,7 @@ import javax.net.ssl.*;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import net.i2p.itoopie.i2pcontrol.JSONInterface;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONRPC2Interface;
|
||||
import net.i2p.itoopie.security.CertificateHelper;
|
||||
import net.i2p.itoopie.security.CertificateManager;
|
||||
|
||||
|
@ -24,7 +24,7 @@ import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
|
||||
import net.i2p.itoopie.configuration.ConfigurationManager;
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONInterface;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONRPC2Interface;
|
||||
import net.i2p.itoopie.i2pcontrol.methods.GetEcho;
|
||||
import net.i2p.itoopie.i2pcontrol.methods.GetNetworkSetting;
|
||||
import net.i2p.itoopie.i2pcontrol.methods.GetRateStat;
|
||||
|
@ -32,7 +32,7 @@ import net.i2p.itoopie.configuration.ConfigurationManager;
|
||||
import net.i2p.itoopie.gui.component.ProgressiveDisclosurePanel;
|
||||
import net.i2p.itoopie.i18n.Transl;
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONInterface;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONRPC2Interface;
|
||||
import javax.swing.BoxLayout;
|
||||
import java.awt.Component;
|
||||
|
||||
@ -220,7 +220,7 @@ public class Settings extends RegisteredFrame{
|
||||
try {
|
||||
System.out.println("Password changed: \""+oldPW+"\"->\"" + pwText + "\"");
|
||||
_conf.setConf("server.password", pwText);
|
||||
JSONInterface.testSettings();
|
||||
JSONRPC2Interface.testSettings();
|
||||
newSettings = true;
|
||||
} catch (InvalidPasswordException e) {
|
||||
_conf.setConf("server.password", oldPW);
|
||||
|
@ -20,7 +20,7 @@ import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2Session;
|
||||
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
|
||||
|
||||
public class JSONInterface {
|
||||
public class JSONRPC2Interface {
|
||||
private static Log _log;
|
||||
private static ConfigurationManager _conf;
|
||||
private static String DEFAULT_PASSWORD = "itoopie";
|
||||
@ -30,7 +30,7 @@ public class JSONInterface {
|
||||
private static String token;
|
||||
|
||||
static {
|
||||
_log = LogFactory.getLog(JSONInterface.class);
|
||||
_log = LogFactory.getLog(JSONRPC2Interface.class);
|
||||
_conf = ConfigurationManager.getInstance();
|
||||
Random rnd = new Random();
|
||||
nonce = rnd.nextInt();
|
@ -9,7 +9,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import net.i2p.itoopie.configuration.ConfigurationManager;
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONInterface;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONRPC2Interface;
|
||||
import net.i2p.itoopie.i2pcontrol.UnrecoverableFailedRequestException;
|
||||
|
||||
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
|
||||
@ -23,7 +23,7 @@ public class Authenticate {
|
||||
|
||||
public static String execute()
|
||||
throws InvalidPasswordException, JSONRPC2SessionException {
|
||||
JSONRPC2Request req = new JSONRPC2Request("Authenticate", JSONInterface.incrNonce());
|
||||
JSONRPC2Request req = new JSONRPC2Request("Authenticate", JSONRPC2Interface.incrNonce());
|
||||
|
||||
Map outParams = new HashMap();
|
||||
outParams.put("Password",
|
||||
@ -32,7 +32,7 @@ public class Authenticate {
|
||||
|
||||
JSONRPC2Response resp = null;
|
||||
try {
|
||||
resp = JSONInterface.sendReq(req);
|
||||
resp = JSONRPC2Interface.sendReq(req);
|
||||
Map inParams = (HashMap) resp.getResult();
|
||||
return (String) inParams.get("Token");
|
||||
}catch (UnrecoverableFailedRequestException e) {
|
||||
|
@ -8,7 +8,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONInterface;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONRPC2Interface;
|
||||
import net.i2p.itoopie.i2pcontrol.UnrecoverableFailedRequestException;
|
||||
|
||||
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
|
||||
@ -22,7 +22,7 @@ public class GetEcho {
|
||||
public static String execute(String str)
|
||||
throws InvalidPasswordException, JSONRPC2SessionException {
|
||||
|
||||
JSONRPC2Request req = new JSONRPC2Request("Echo", JSONInterface.incrNonce());
|
||||
JSONRPC2Request req = new JSONRPC2Request("Echo", JSONRPC2Interface.incrNonce());
|
||||
@SuppressWarnings("rawtypes")
|
||||
Map params = new HashMap();
|
||||
params.put("Echo", str);
|
||||
@ -30,7 +30,7 @@ public class GetEcho {
|
||||
|
||||
JSONRPC2Response resp = null;
|
||||
try {
|
||||
resp = JSONInterface.sendReq(req);
|
||||
resp = JSONRPC2Interface.sendReq(req);
|
||||
Map inParams = (HashMap) resp.getResult();
|
||||
return (String) inParams.get("Result");
|
||||
} catch (UnrecoverableFailedRequestException e) {
|
||||
|
@ -12,7 +12,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONInterface;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONRPC2Interface;
|
||||
import net.i2p.itoopie.i2pcontrol.UnrecoverableFailedRequestException;
|
||||
import net.i2p.itoopie.i2pcontrol.methods.NetworkInfo.NETWORK_INFO;
|
||||
|
||||
@ -26,7 +26,7 @@ public class GetNetworkSetting {
|
||||
public static HashMap execute(NETWORK_INFO ... options)
|
||||
throws InvalidPasswordException, JSONRPC2SessionException{
|
||||
|
||||
JSONRPC2Request req = new JSONRPC2Request("NetworkSetting", JSONInterface.incrNonce());
|
||||
JSONRPC2Request req = new JSONRPC2Request("NetworkSetting", JSONRPC2Interface.incrNonce());
|
||||
@SuppressWarnings("rawtypes")
|
||||
Map outParams = new HashMap();
|
||||
List<NETWORK_INFO> list = Arrays.asList(options);
|
||||
@ -39,7 +39,7 @@ public class GetNetworkSetting {
|
||||
|
||||
JSONRPC2Response resp = null;
|
||||
try {
|
||||
resp = JSONInterface.sendReq(req);
|
||||
resp = JSONRPC2Interface.sendReq(req);
|
||||
HashMap map = (HashMap) resp.getResult();
|
||||
if (map != null){
|
||||
Set<Entry> set = map.entrySet();
|
||||
|
@ -8,7 +8,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONInterface;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONRPC2Interface;
|
||||
import net.i2p.itoopie.i2pcontrol.UnrecoverableFailedRequestException;
|
||||
|
||||
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
|
||||
@ -22,7 +22,7 @@ public class GetRateStat{
|
||||
public static Double execute(String stat, long period)
|
||||
throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException {
|
||||
|
||||
JSONRPC2Request req = new JSONRPC2Request("GetRate", JSONInterface.incrNonce());
|
||||
JSONRPC2Request req = new JSONRPC2Request("GetRate", JSONRPC2Interface.incrNonce());
|
||||
@SuppressWarnings("rawtypes")
|
||||
Map params = new HashMap();
|
||||
params.put("Stat", stat);
|
||||
@ -31,7 +31,7 @@ public class GetRateStat{
|
||||
|
||||
JSONRPC2Response resp = null;
|
||||
try {
|
||||
resp = JSONInterface.sendReq(req);
|
||||
resp = JSONRPC2Interface.sendReq(req);
|
||||
HashMap inParams = (HashMap) resp.getResult();
|
||||
Double dbl = (Double) inParams.get("Result");
|
||||
return dbl;
|
||||
|
@ -10,7 +10,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
|
||||
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONInterface;
|
||||
import net.i2p.itoopie.i2pcontrol.JSONRPC2Interface;
|
||||
import net.i2p.itoopie.i2pcontrol.UnrecoverableFailedRequestException;
|
||||
import net.i2p.itoopie.i2pcontrol.methods.NetworkInfo.NETWORK_INFO;
|
||||
|
||||
@ -25,7 +25,7 @@ public class SetNetworkSetting {
|
||||
public static HashMap<NETWORK_INFO, Boolean> execute(Map<NETWORK_INFO,String> settings)
|
||||
throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException{
|
||||
|
||||
JSONRPC2Request req = new JSONRPC2Request("NetworkSetting", JSONInterface.incrNonce());
|
||||
JSONRPC2Request req = new JSONRPC2Request("NetworkSetting", JSONRPC2Interface.incrNonce());
|
||||
|
||||
Map outParams = new HashMap();
|
||||
|
||||
@ -39,7 +39,7 @@ public class SetNetworkSetting {
|
||||
|
||||
JSONRPC2Response resp = null;
|
||||
try {
|
||||
resp = JSONInterface.sendReq(req);
|
||||
resp = JSONRPC2Interface.sendReq(req);
|
||||
HashMap map = (HashMap) resp.getResult();
|
||||
return map;
|
||||
} catch (UnrecoverableFailedRequestException e) {
|
||||
|
Reference in New Issue
Block a user