Deprecate java command line api to keyring commands

This commit is contained in:
Jeremy Lakeman 2015-09-28 12:03:27 +09:30
parent 75df3bd4ec
commit 41d416977f
2 changed files with 23 additions and 9 deletions

View File

@ -170,6 +170,7 @@ public class ServalDCommand
return result;
}
@Deprecated
public static class IdentityResult extends JniResult {
public String did;
public String name;
@ -212,6 +213,7 @@ public class ServalDCommand
}
}
@Deprecated
public static IdentityResult keyringAdd()
throws ServalDFailureException {
IdentityResult result = new IdentityResult();
@ -219,6 +221,7 @@ public class ServalDCommand
return result;
}
@Deprecated
public static IdentityResult keyringSetDidName(SubscriberId sid, String did, String name) throws ServalDFailureException
{
IdentityResult result = new IdentityResult();
@ -226,6 +229,7 @@ public class ServalDCommand
return result;
}
@Deprecated
public static int keyringList(final AsyncResult<IdentityResult> results) throws ServalDFailureException
{
// FIXME, this is a little hacky as the number of tags is unknown so we don't have a fixed number of columns
@ -263,6 +267,7 @@ public class ServalDCommand
}, "keyring", "list", "--full");
}
@Deprecated
public static int keyringList(IJniResults results) throws ServalDFailureException{
return command(results, "keyring", "list");
}
@ -273,6 +278,7 @@ public class ServalDCommand
return result;
}
@Deprecated
public static IdentityResult reverseLookup(final SubscriberId sid) throws ServalDFailureException {
IdentityResult result = new IdentityResult();
command(result, "reverse", "lookup", sid.toHex());
@ -306,6 +312,7 @@ public class ServalDCommand
}
}
@Deprecated
public static int dnaLookup(AsyncResult<LookupResult> results, String did, int timeout) throws ServalDFailureException {
return dnaLookup(new JniResultList<LookupResult>(results) {
@Override
@ -315,9 +322,11 @@ public class ServalDCommand
}, did, timeout);
}
@Deprecated
public static int dnaLookup(IJniResults results, String did, int timeout) throws ServalDFailureException {
return command(results, "dna", "lookup", did, Integer.toString(timeout));
}
public static class ManifestResult extends JniResult{
public BundleId manifestId;
public long version;
@ -583,6 +592,7 @@ public class ServalDCommand
}
// Note that the result values will only have a subscriber id
@Deprecated
public static int idPeers(AsyncResult<IdentityResult> results) throws ServalDFailureException {
return idPeers(new JniResultList<IdentityResult>(results) {
@Override
@ -592,6 +602,7 @@ public class ServalDCommand
});
}
@Deprecated
public static int idPeers(IJniResults results) throws ServalDFailureException {
return command(results, "id", "peers");
}

View File

@ -85,27 +85,30 @@ public class ServerControl {
start();
}
public boolean isRunning() throws ServalDFailureException {
public boolean isRunning() {
try {
ServalDCommand.Status s = ServalDCommand.serverStatus();
if (s.status.equals("running")) {
setStatus(s);
}else{
clearStatus();
return pid!=0;
}
} catch (ServalDFailureException e) {
// ignore
}
clearStatus();
return pid!=0;
}
public MdpServiceLookup getMdpServiceLookup(ChannelSelector selector, AsyncResult<MdpServiceLookup.ServiceResult> results) throws ServalDInterfaceException, IOException {
if (!isRunning())
throw new ServalDInterfaceException("server is not running");
return new MdpServiceLookup(selector, this.loopbackMdpPort, results);
return new MdpServiceLookup(selector, getLoopbackMdpPort(), results);
}
public MdpDnaLookup getMdpDnaLookup(ChannelSelector selector, AsyncResult<ServalDCommand.LookupResult> results) throws ServalDInterfaceException, IOException {
if (!isRunning())
throw new ServalDInterfaceException("server is not running");
return new MdpDnaLookup(selector, this.loopbackMdpPort, results);
return new MdpDnaLookup(selector, getLoopbackMdpPort(), results);
}
public ServalDClient getRestfulClient() throws ServalDInterfaceException {