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

@ -84,6 +84,16 @@ public abstract class ApiConnection implements AutoCloseable {
* @throws me.legrange.mikrotik.MikrotikApiException Thrown if the API encounters an error executing a command.
*/
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.

View File

@ -66,6 +66,11 @@ public final class ApiConnectionImpl extends ApiConnection {
public List<Map<String, String>> execute(String cmd) throws MikrotikApiException {
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
public String execute(String cmd, ResultListener lis) throws MikrotikApiException {