Merge pull request #23 from GideonLeGrange/pre-2.2
Merge in documentation changes for 2.20
This commit is contained in:
commit
2218bacead
20
README.md
20
README.md
|
|
@ -6,30 +6,26 @@ This project provides a Java client to manipulate Mikrotik routers using the rem
|
|||
|
||||
## Versions
|
||||
|
||||
**The current stable version is 2.2**
|
||||
|
||||
This library uses [semantic versioning](http://semver.org/)
|
||||
|
||||
**The current stable version is 2.1**
|
||||
### Changes in version 2.2:
|
||||
|
||||
### Changes in version 2.1:
|
||||
Version 2.2 implements AutoCloseable on ApiConnection to support Java 7's try-with-resources statement.
|
||||
|
||||
Version 2.1 adds the ability to use connection and command timeouts as requested by users. To see how to use these, please refer to the examples below. For more information, look at issue [#16](https://github.com/GideonLeGrange/mikrotik-java/issues/16).
|
||||
#### Previous 2.x versions:
|
||||
|
||||
#### Previous 2.0 versions:
|
||||
* 2.1 added the ability to use connection and command timeouts as.
|
||||
|
||||
* 2.0.3 Fixed bug #18 - An empty username in ```login()``` caused the API to hang.
|
||||
* 2.0.2 Fixed bug #13 - processor thread wasn't being stopped on disconnect(), causing non-exit of application in some cases.
|
||||
* 2.0.1 fixed parsing of !=, < and > operators in a where clause.
|
||||
* 2.0.0 changed ResultListener to receive errors and completion notifications. This version is not backwards compatible with version 1.x.
|
||||
|
||||
The last version 1.x release was 1.1.6 which was the first version to be pushed to Maven Central. Version 1 is considered *deprecated* and will no longer be supported or patched.
|
||||
#### Version 1.x
|
||||
|
||||
#### Previous 1.1 versions:
|
||||
|
||||
* 1.1.5 fixed even more comamnd line parsing bugs.
|
||||
* 1.1.4 fixed command line parsing bugs #7 and #8.
|
||||
* 1.1.3 fixed severe command line parsing bugs, #3, #4 and #5.
|
||||
* 1.1.2 added support for handling multi-line results, like for example /file print.
|
||||
* 1.1 added TLS (SSL) support to encrypt API traffic.
|
||||
Version 1 is considered *deprecated* and will no longer be supported or patched.
|
||||
|
||||
## Getting the API
|
||||
|
||||
|
|
|
|||
2
pom.xml
2
pom.xml
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<groupId>me.legrange</groupId>
|
||||
<artifactId>mikrotik</artifactId>
|
||||
<version>2.1</version>
|
||||
<version>2.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Mikrotik API Java Client Library</name>
|
||||
|
|
|
|||
|
|
@ -2,27 +2,25 @@ package examples;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.legrange.mikrotik.ApiConnection;
|
||||
import me.legrange.mikrotik.MikrotikApiException;
|
||||
|
||||
/**
|
||||
* Example 9: Test special characters in usernames
|
||||
* Example 9: Try with resources
|
||||
*
|
||||
* @author gideon
|
||||
*/
|
||||
public class Example9 extends Example {
|
||||
public class Example9 {
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
Example9 ex = new Example9();
|
||||
ex.connect();
|
||||
ex.test();
|
||||
ex.disconnect();
|
||||
}
|
||||
|
||||
private void test() throws MikrotikApiException, InterruptedException {
|
||||
List<Map<String, String>> res = con.execute("/user/add name=çãáõ");
|
||||
for (Map<String, String> r : res) {
|
||||
System.out.println(r);
|
||||
}
|
||||
// con.execute("/ip/firewall/filter/add chain=forward hotspot=!auth protocol=tcp src-port=8000-8084");
|
||||
try (ApiConnection con = ApiConnection.connect(Config.HOST, ApiConnection.DEFAULT_PORT, 2000)) {
|
||||
con.login(Config.USERNAME, Config.PASSWORD);
|
||||
con.execute("/user/add name=eric");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue