This commit is contained in:
mattiagr91 2017-06-26 14:39:13 +00:00 committed by GitHub
commit 1b503a16e2
2 changed files with 15 additions and 0 deletions

View File

@ -85,6 +85,16 @@ public abstract class ApiConnection implements AutoCloseable {
*/ */
public abstract List<Map<String, String>> execute(String cmd) throws MikrotikApiException; public abstract List<Map<String, String>> execute(String cmd) throws MikrotikApiException;
/**
* execute a command and return a list of results.
*
* @param cmd Command to execute
* @param timeout The connection timeout to use when executing the command.
* @return The list of results
* @throws me.legrange.mikrotik.MikrotikApiException Thrown if the API encounters an error executing a command.
*/
public abstract List<Map<String, String>> execute(String cmd, int timeout) throws MikrotikApiException;
/** /**
* execute a command and attach a result listener to receive it's results. * execute a command and attach a result listener to receive it's results.
* *

View File

@ -67,6 +67,11 @@ public final class ApiConnectionImpl extends ApiConnection {
return execute(Parser.parse(cmd), timeout); return execute(Parser.parse(cmd), timeout);
} }
@Override
public List<Map<String, String>> execute(String cmd, int timeout) throws MikrotikApiException {
return execute(Parser.parse(cmd), timeout);
}
@Override @Override
public String execute(String cmd, ResultListener lis) throws MikrotikApiException { public String execute(String cmd, ResultListener lis) throws MikrotikApiException {
return execute(Parser.parse(cmd), lis); return execute(Parser.parse(cmd), lis);