From 702aa45a188660b1458a0c4e852fa7f329eef846 Mon Sep 17 00:00:00 2001 From: Gideon le Grange Date: Tue, 5 May 2015 13:20:35 +0200 Subject: [PATCH 1/2] Preparing for 2.2 release --- README.md | 10 ++++++---- pom.xml | 2 +- src/main/java/examples/Example9.java | 16 +++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 93de839..a1c0dff 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,17 @@ 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. diff --git a/pom.xml b/pom.xml index fef94c5..c93d0e3 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ me.legrange mikrotik - 2.1 + 2.2 jar Mikrotik API Java Client Library diff --git a/src/main/java/examples/Example9.java b/src/main/java/examples/Example9.java index 5870a9c..b9917ee 100644 --- a/src/main/java/examples/Example9.java +++ b/src/main/java/examples/Example9.java @@ -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> res = con.execute("/user/add name=çãáõ"); - for (Map 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"); + } } } From 138d93bcb3b0cd94dfc30e9283244f5691996fc6 Mon Sep 17 00:00:00 2001 From: Gideon le Grange Date: Tue, 5 May 2015 13:23:35 +0200 Subject: [PATCH 2/2] Preparing for 2.2 --- README.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a1c0dff..19bb8e3 100644 --- a/README.md +++ b/README.md @@ -18,20 +18,14 @@ Version 2.2 implements AutoCloseable on ApiConnection to support Java 7's try-wi * 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.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