diff options
author | Tibor Sirovatka <tsirovat@cisco.com> | 2016-05-13 10:17:51 +0200 |
---|---|---|
committer | Tibor Sirovatka <tsirovat@cisco.com> | 2016-05-23 06:25:05 +0000 |
commit | 071d610dc446f2914c0ca4c709be38719baa041c (patch) | |
tree | e97337183e4078ab00557665a02b9e3f0ee57071 /vpp-api/java/jvpp/gen | |
parent | 6931f59e54c9643196c0edda20840e49e9eb1da1 (diff) |
Changed JVPP interface for construction and connectivity
Simplified construction, autoconnected; possible connect/close
See updated sample test cases with changed interface usage
Change-Id: Ib53e855880bc414868aa2b9bb8f5df086917e375
Signed-off-by: Tibor Sirovatka <tsirovat@cisco.com>
Diffstat (limited to 'vpp-api/java/jvpp/gen')
-rw-r--r-- | vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py | 15 | ||||
-rw-r--r-- | vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py | 15 | ||||
-rw-r--r-- | vpp-api/java/jvpp/gen/jvpp_impl_gen.py | 15 |
3 files changed, 39 insertions, 6 deletions
diff --git a/vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py b/vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py index de239b6d1a3..e8de3fc10c1 100644 --- a/vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py +++ b/vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py @@ -51,10 +51,19 @@ public final class CallbackJVppFacade implements $base_package.$callback_facade_ private final $base_package.JVpp jvpp; private final java.util.Map<Integer, $base_package.$callback_package.JVppCallback> callbacks; - public CallbackJVppFacade(final $base_package.JVpp jvpp, - java.util.Map<Integer, $base_package.$callback_package.JVppCallback> callbacks) { + /** + * <p>Create CallbackJVppFacade object for provided JVpp instance. + * Constructor internally creates CallbackJVppFacadeCallback class for processing callbacks + * and then connects to provided JVpp instance + * + * @param jvpp provided $base_package.JVpp instance + * + * @throws java.io.IOException in case instance cannot connect to JVPP + */ + public CallbackJVppFacade(final $base_package.JVpp jvpp) throws java.io.IOException { this.jvpp = java.util.Objects.requireNonNull(jvpp,"jvpp is null"); - this.callbacks = callbacks; + this.callbacks = new java.util.HashMap<>(); + this.jvpp.connect(new CallbackJVppFacadeCallback(this.callbacks)); } @Override diff --git a/vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py b/vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py index 4f63f9bcf4b..5574f120712 100644 --- a/vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py +++ b/vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py @@ -250,9 +250,18 @@ package $base_package.$future_package; */ public class FutureJVppFacade extends FutureJVppInvokerFacade implements FutureJVpp { - public FutureJVppFacade(final $base_package.JVpp jvpp, - final java.util.Map<Integer, java.util.concurrent.CompletableFuture<? extends $base_package.$dto_package.JVppReply<?>>> requestMap) { - super(jvpp, requestMap); + /** + * <p>Create FutureJVppFacade object for provided JVpp instance. + * Constructor internally creates FutureJVppFacadeCallback class for processing callbacks + * and then connects to provided JVpp instance + * + * @param jvpp provided $base_package.JVpp instance + * + * @throws java.io.IOException in case instance cannot connect to JVPP + */ + public FutureJVppFacade(final $base_package.JVpp jvpp) throws java.io.IOException { + super(jvpp, new java.util.HashMap<>()); + jvpp.connect(new FutureJVppFacadeCallback(getRequests())); } $methods } diff --git a/vpp-api/java/jvpp/gen/jvpp_impl_gen.py b/vpp-api/java/jvpp/gen/jvpp_impl_gen.py index 4e2625714a9..4e408c364b1 100644 --- a/vpp-api/java/jvpp/gen/jvpp_impl_gen.py +++ b/vpp-api/java/jvpp/gen/jvpp_impl_gen.py @@ -28,6 +28,16 @@ package $base_package; public interface JVpp extends java.lang.AutoCloseable { /** + * Generic connect with $base_package.callback.JVppCallback callback handler + * providing connecting to VPP + * + * @param callback JVppCallback instance providing callback handling + * + * @throws java.io.IOException if connection cannot be initiated + */ + void connect($base_package.callback.JVppCallback callback) throws java.io.IOException; + + /** * Generic dispatch method for sending requests to VPP */ int send($base_package.$dto_package.JVppRequest request); @@ -56,6 +66,11 @@ public final class JVppImpl implements $base_package.JVpp { } @Override + public void connect($base_package.callback.JVppCallback callback) throws java.io.IOException { + connection.connect(callback); + } + + @Override public void close() { connection.close(); } |