aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api
diff options
context:
space:
mode:
authorMatej Perina <mperina@cisco.com>2017-09-11 10:11:51 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2017-10-10 16:44:03 +0000
commitac1a7286500c18ac51beb66e4a2b99ea26c8c966 (patch)
tree62a4a0430bd0d5623c5e9945ca5bf671745351f9 /src/vpp-api
parentd91c1dbdb31f80db7d967f2f57c43d0a81d65297 (diff)
jvpp: adding callbacks for all messages (VPP-914)
1) In the previous version callbacks were generated based on request-replay naming conventions. It turned out they were too strict in case of events (e.g. BFD sends Details messages as notifications). So now we generate callback for all messages, allowing to receive any message as notification.(callback_gen.py) 2) "notification" suffix is no longer added because all messages are treated same (dto_gen.py, jvpp_c_gen_.py) 3) name of property that holds notification/events changed in callback facade and future apis 4) JVppNotification.java is no longer used since all events are treated equally Change-Id: I13f6438affc3473040d63cd4acb3984d03e97482 Signed-off-by: Matej <matej.perina@pantheon.tech>
Diffstat (limited to 'src/vpp-api')
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackApiExample.java8
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeExample.java10
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java22
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java14
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java16
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java4
-rw-r--r--src/vpp-api/java/jvpp-ioampot/io/fd/vpp/jvpp/ioampot/examples/IoamPotApiExample.java4
-rw-r--r--src/vpp-api/java/jvpp-ioamtrace/io/fd/vpp/jvpp/ioamtrace/examples/IoamTraceApiExample.java4
-rw-r--r--src/vpp-api/java/jvpp-nat/io/fd/vpp/jvpp/nat/examples/CallbackApiExample.java4
-rw-r--r--src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/dto/JVppNotification.java23
-rw-r--r--src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/FutureJVppInvoker.java4
-rw-r--r--src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/notification/EventRegistry.java (renamed from src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/notification/NotificationRegistry.java)2
-rw-r--r--src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/notification/EventRegistryProvider.java (renamed from src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/notification/NotificationRegistryProvider.java)4
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py15
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py49
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py28
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py35
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py16
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py2
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py48
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/util.py6
21 files changed, 171 insertions, 147 deletions
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackApiExample.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackApiExample.java
index 554a21bd411..b99979cf301 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackApiExample.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackApiExample.java
@@ -21,9 +21,9 @@ import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.JVppRegistryImpl;
import io.fd.vpp.jvpp.VppCallbackException;
import io.fd.vpp.jvpp.core.JVppCoreImpl;
-import io.fd.vpp.jvpp.core.callback.GetNodeIndexCallback;
-import io.fd.vpp.jvpp.core.callback.ShowVersionCallback;
-import io.fd.vpp.jvpp.core.callback.SwInterfaceCallback;
+import io.fd.vpp.jvpp.core.callback.GetNodeIndexReplyCallback;
+import io.fd.vpp.jvpp.core.callback.ShowVersionReplyCallback;
+import io.fd.vpp.jvpp.core.callback.SwInterfaceDetailsCallback;
import io.fd.vpp.jvpp.core.dto.GetNodeIndex;
import io.fd.vpp.jvpp.core.dto.GetNodeIndexReply;
import io.fd.vpp.jvpp.core.dto.ShowVersion;
@@ -65,7 +65,7 @@ public class CallbackApiExample {
Thread.sleep(1000);
}
- static class TestCallback implements GetNodeIndexCallback, ShowVersionCallback, SwInterfaceCallback {
+ static class TestCallback implements GetNodeIndexReplyCallback, ShowVersionReplyCallback, SwInterfaceDetailsCallback {
@Override
public void onGetNodeIndexReply(final GetNodeIndexReply msg) {
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeExample.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeExample.java
index 2f77f0f136f..dc2bdcba569 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeExample.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeExample.java
@@ -20,8 +20,8 @@ import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.JVppRegistryImpl;
import io.fd.vpp.jvpp.VppCallbackException;
import io.fd.vpp.jvpp.core.JVppCoreImpl;
-import io.fd.vpp.jvpp.core.callback.GetNodeIndexCallback;
-import io.fd.vpp.jvpp.core.callback.ShowVersionCallback;
+import io.fd.vpp.jvpp.core.callback.GetNodeIndexReplyCallback;
+import io.fd.vpp.jvpp.core.callback.ShowVersionReplyCallback;
import io.fd.vpp.jvpp.core.callfacade.CallbackJVppCoreFacade;
import io.fd.vpp.jvpp.core.dto.GetNodeIndex;
import io.fd.vpp.jvpp.core.dto.GetNodeIndexReply;
@@ -34,7 +34,7 @@ import java.nio.charset.StandardCharsets;
*/
public class CallbackJVppFacadeExample {
- private static ShowVersionCallback showVersionCallback1 = new ShowVersionCallback() {
+ private static ShowVersionReplyCallback showVersionCallback1 = new ShowVersionReplyCallback() {
@Override
public void onShowVersionReply(final ShowVersionReply msg) {
System.out.printf("ShowVersionCallback1 received ShowVersionReply: context=%d, program=%s,"
@@ -52,7 +52,7 @@ public class CallbackJVppFacadeExample {
}
};
- private static ShowVersionCallback showVersionCallback2 = new ShowVersionCallback() {
+ private static ShowVersionReplyCallback showVersionCallback2 = new ShowVersionReplyCallback() {
@Override
public void onShowVersionReply(final ShowVersionReply msg) {
System.out.printf("ShowVersionCallback2 received ShowVersionReply: context=%d, program=%s,"
@@ -71,7 +71,7 @@ public class CallbackJVppFacadeExample {
};
- private static GetNodeIndexCallback getNodeIndexCallback = new GetNodeIndexCallback() {
+ private static GetNodeIndexReplyCallback getNodeIndexCallback = new GetNodeIndexReplyCallback() {
@Override
public void onGetNodeIndexReply(final GetNodeIndexReply msg) {
System.out.printf("Received GetNodeIndexReply: %s%n", msg);
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java
index 308dad9faa6..832464a22cb 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java
@@ -21,9 +21,11 @@ import io.fd.vpp.jvpp.JVppRegistryImpl;
import io.fd.vpp.jvpp.VppCallbackException;
import io.fd.vpp.jvpp.core.JVppCore;
import io.fd.vpp.jvpp.core.JVppCoreImpl;
-import io.fd.vpp.jvpp.core.callback.WantInterfaceEventsCallback;
+import io.fd.vpp.jvpp.core.callback.WantInterfaceEventsReplyCallback;
+import io.fd.vpp.jvpp.core.callback.SwInterfaceEventCallback;
import io.fd.vpp.jvpp.core.callfacade.CallbackJVppCoreFacade;
import io.fd.vpp.jvpp.core.dto.WantInterfaceEventsReply;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceEvent;
public class CallbackJVppFacadeNotificationExample {
@@ -36,12 +38,20 @@ public class CallbackJVppFacadeNotificationExample {
System.out.println("Successfully connected to VPP");
final AutoCloseable notificationListenerReg =
- jvppCallbackFacade.getNotificationRegistry().registerSwInterfaceEventNotificationCallback(
- NotificationUtils::printNotification
- );
+ jvppCallbackFacade.getEventRegistry().registerSwInterfaceEventCallback(
+ new SwInterfaceEventCallback() {
+ public void onSwInterfaceEvent(SwInterfaceEvent reply) {
+ System.out.printf("Received interface notification: ifc: %s%n", reply);
+ }
+
+ public void onError (VppCallbackException ex) {
+ System.out.printf("Received onError exception: call=%s, context=%d, retval=%d%n",
+ ex.getMethodName(), ex.getCtxId(), ex.getErrorCode());
+ }
+ });
jvppCallbackFacade.wantInterfaceEvents(NotificationUtils.getEnableInterfaceNotificationsReq(),
- new WantInterfaceEventsCallback() {
+ new WantInterfaceEventsReplyCallback() {
@Override
public void onWantInterfaceEventsReply(final WantInterfaceEventsReply reply) {
System.out.println("Interface events started");
@@ -60,7 +70,7 @@ public class CallbackJVppFacadeNotificationExample {
Thread.sleep(1000);
jvppCallbackFacade.wantInterfaceEvents(NotificationUtils.getDisableInterfaceNotificationsReq(),
- new WantInterfaceEventsCallback() {
+ new WantInterfaceEventsReplyCallback() {
@Override
public void onWantInterfaceEventsReply(final WantInterfaceEventsReply reply) {
System.out.println("Interface events stopped");
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java
index 7d56b7ea292..9ed418eaa22 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java
@@ -26,9 +26,9 @@ import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.JVppRegistryImpl;
import io.fd.vpp.jvpp.VppCallbackException;
import io.fd.vpp.jvpp.core.JVppCoreImpl;
-import io.fd.vpp.jvpp.core.callback.SwInterfaceEventNotificationCallback;
-import io.fd.vpp.jvpp.core.callback.WantInterfaceEventsCallback;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceEventNotification;
+import io.fd.vpp.jvpp.core.callback.SwInterfaceEventCallback;
+import io.fd.vpp.jvpp.core.callback.WantInterfaceEventsReplyCallback;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceEvent;
import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply;
import io.fd.vpp.jvpp.core.dto.WantInterfaceEventsReply;
@@ -64,12 +64,12 @@ public class CallbackNotificationApiExample {
testCallbackApi();
}
- private static class TestCallback implements SwInterfaceEventNotificationCallback,
- WantInterfaceEventsCallback {
+ private static class TestCallback implements SwInterfaceEventCallback,
+ WantInterfaceEventsReplyCallback {
@Override
- public void onSwInterfaceEventNotification(
- final SwInterfaceEventNotification msg) {
+ public void onSwInterfaceEvent(
+ final SwInterfaceEvent msg) {
printNotification(msg);
}
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java
index 7460401e36e..3c84fd7276e 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java
@@ -24,6 +24,9 @@ import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.JVppRegistryImpl;
import io.fd.vpp.jvpp.core.JVppCoreImpl;
import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
+import io.fd.vpp.jvpp.core.callback.SwInterfaceEventCallback;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceEvent;
+import io.fd.vpp.jvpp.VppCallbackException;
public class FutureApiNotificationExample {
@@ -32,8 +35,17 @@ public class FutureApiNotificationExample {
try (final JVppRegistry registry = new JVppRegistryImpl("FutureApiNotificationExample");
final FutureJVppCoreFacade jvppFacade = new FutureJVppCoreFacade(registry, new JVppCoreImpl());
final AutoCloseable notificationListenerReg =
- jvppFacade.getNotificationRegistry()
- .registerSwInterfaceEventNotificationCallback(NotificationUtils::printNotification)) {
+ jvppFacade.getEventRegistry()
+ .registerSwInterfaceEventCallback(new SwInterfaceEventCallback() {
+ public void onSwInterfaceEvent(SwInterfaceEvent reply) {
+ System.out.printf("Received interface notification: ifc: %s%n", reply);
+ }
+
+ public void onError (VppCallbackException ex) {
+ System.out.printf("Received onError exception: call=%s, context=%d, retval=%d%n",
+ ex.getMethodName(), ex.getCtxId(), ex.getErrorCode());
+ }
+ })) {
System.out.println("Successfully connected to VPP");
jvppFacade.wantInterfaceEvents(getEnableInterfaceNotificationsReq()).toCompletableFuture().get();
System.out.println("Interface events started");
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java
index d3f9dd2c732..e963d631d61 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java
@@ -18,14 +18,14 @@ package io.fd.vpp.jvpp.core.examples;
import java.io.PrintStream;
import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceEventNotification;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceEvent;
import io.fd.vpp.jvpp.core.dto.WantInterfaceEvents;
final class NotificationUtils {
private NotificationUtils() {}
- static PrintStream printNotification(final SwInterfaceEventNotification msg) {
+ static PrintStream printNotification(final SwInterfaceEvent msg) {
return System.out.printf("Received interface notification: ifc: %s%n", msg);
}
diff --git a/src/vpp-api/java/jvpp-ioampot/io/fd/vpp/jvpp/ioampot/examples/IoamPotApiExample.java b/src/vpp-api/java/jvpp-ioampot/io/fd/vpp/jvpp/ioampot/examples/IoamPotApiExample.java
index e97d24fb22e..b9ed7d03afd 100644
--- a/src/vpp-api/java/jvpp-ioampot/io/fd/vpp/jvpp/ioampot/examples/IoamPotApiExample.java
+++ b/src/vpp-api/java/jvpp-ioampot/io/fd/vpp/jvpp/ioampot/examples/IoamPotApiExample.java
@@ -21,14 +21,14 @@ import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.JVppRegistryImpl;
import io.fd.vpp.jvpp.VppCallbackException;
import io.fd.vpp.jvpp.ioampot.JVppIoampotImpl;
-import io.fd.vpp.jvpp.ioampot.callback.PotProfileAddCallback;
+import io.fd.vpp.jvpp.ioampot.callback.PotProfileAddReplyCallback;
import io.fd.vpp.jvpp.ioampot.dto.PotProfileAdd;
import io.fd.vpp.jvpp.ioampot.dto.PotProfileAddReply;
import java.nio.charset.StandardCharsets;
public class IoamPotApiExample {
- static class IoamPotTestCallback implements PotProfileAddCallback {
+ static class IoamPotTestCallback implements PotProfileAddReplyCallback {
@Override
public void onPotProfileAddReply(final PotProfileAddReply reply) {
diff --git a/src/vpp-api/java/jvpp-ioamtrace/io/fd/vpp/jvpp/ioamtrace/examples/IoamTraceApiExample.java b/src/vpp-api/java/jvpp-ioamtrace/io/fd/vpp/jvpp/ioamtrace/examples/IoamTraceApiExample.java
index 827466bd2ec..d63d1372698 100644
--- a/src/vpp-api/java/jvpp-ioamtrace/io/fd/vpp/jvpp/ioamtrace/examples/IoamTraceApiExample.java
+++ b/src/vpp-api/java/jvpp-ioamtrace/io/fd/vpp/jvpp/ioamtrace/examples/IoamTraceApiExample.java
@@ -22,7 +22,7 @@ import io.fd.vpp.jvpp.JVppRegistryImpl;
import io.fd.vpp.jvpp.VppCallbackException;
import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtraceFacade;
import io.fd.vpp.jvpp.ioamtrace.JVppIoamtraceImpl;
-import io.fd.vpp.jvpp.ioamtrace.callback.TraceProfileAddCallback;
+import io.fd.vpp.jvpp.ioamtrace.callback.TraceProfileAddReplyCallback;
import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileAdd;
import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileAddReply;
import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileShowConfig;
@@ -30,7 +30,7 @@ import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileShowConfigReply;
public class IoamTraceApiExample {
- static class IoamTraceTestCallback implements TraceProfileAddCallback {
+ static class IoamTraceTestCallback implements TraceProfileAddReplyCallback {
@Override
public void onTraceProfileAddReply(final TraceProfileAddReply reply) {
diff --git a/src/vpp-api/java/jvpp-nat/io/fd/vpp/jvpp/nat/examples/CallbackApiExample.java b/src/vpp-api/java/jvpp-nat/io/fd/vpp/jvpp/nat/examples/CallbackApiExample.java
index e4d5cb3370c..e0d93ff466d 100644
--- a/src/vpp-api/java/jvpp-nat/io/fd/vpp/jvpp/nat/examples/CallbackApiExample.java
+++ b/src/vpp-api/java/jvpp-nat/io/fd/vpp/jvpp/nat/examples/CallbackApiExample.java
@@ -21,13 +21,13 @@ import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.JVppRegistryImpl;
import io.fd.vpp.jvpp.VppCallbackException;
import io.fd.vpp.jvpp.nat.JVppNatImpl;
-import io.fd.vpp.jvpp.nat.callback.Nat44InterfaceAddDelFeatureCallback;
+import io.fd.vpp.jvpp.nat.callback.Nat44InterfaceAddDelFeatureReplyCallback;
import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceAddDelFeature;
import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceAddDelFeatureReply;
public class CallbackApiExample {
- static class TestCallback implements Nat44InterfaceAddDelFeatureCallback {
+ static class TestCallback implements Nat44InterfaceAddDelFeatureReplyCallback {
@Override
public void onNat44InterfaceAddDelFeatureReply(final Nat44InterfaceAddDelFeatureReply msg) {
diff --git a/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/dto/JVppNotification.java b/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/dto/JVppNotification.java
deleted file mode 100644
index 5554f50165a..00000000000
--- a/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/dto/JVppNotification.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.vpp.jvpp.dto;
-
-/**
-* Base interface for all notification DTOs
-*/
-public interface JVppNotification {
-}
diff --git a/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/FutureJVppInvoker.java b/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/FutureJVppInvoker.java
index 7a48e4181fa..65250ed5a8f 100644
--- a/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/FutureJVppInvoker.java
+++ b/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/future/FutureJVppInvoker.java
@@ -22,12 +22,12 @@ import io.fd.vpp.jvpp.dto.JVppReplyDump;
import io.fd.vpp.jvpp.dto.JVppRequest;
import java.util.concurrent.CompletionStage;
-import io.fd.vpp.jvpp.notification.NotificationRegistryProvider;
+import io.fd.vpp.jvpp.notification.EventRegistryProvider;
/**
* Future facade on top of JVpp
*/
-public interface FutureJVppInvoker extends NotificationRegistryProvider, AutoCloseable {
+public interface FutureJVppInvoker extends EventRegistryProvider, AutoCloseable {
/**
* Invoke asynchronous operation on VPP
diff --git a/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/notification/NotificationRegistry.java b/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/notification/EventRegistry.java
index 3c72ff793a4..12515a519e7 100644
--- a/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/notification/NotificationRegistry.java
+++ b/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/notification/EventRegistry.java
@@ -19,7 +19,7 @@ package io.fd.vpp.jvpp.notification;
/**
* Base registry for notification callbacks.
*/
-public interface NotificationRegistry extends AutoCloseable {
+public interface EventRegistry extends AutoCloseable {
void close();
}
diff --git a/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/notification/NotificationRegistryProvider.java b/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/notification/EventRegistryProvider.java
index 4a6e06b705c..1ac5d55335b 100644
--- a/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/notification/NotificationRegistryProvider.java
+++ b/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/notification/EventRegistryProvider.java
@@ -19,10 +19,10 @@ package io.fd.vpp.jvpp.notification;
/**
* Provides notification registry
*/
-public interface NotificationRegistryProvider {
+public interface EventRegistryProvider {
/**
* Get current notification registry instance
*/
- NotificationRegistry getNotificationRegistry();
+ EventRegistry getEventRegistry();
}
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py
index b3024b9c2ba..f0aee47b0f5 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py
@@ -68,16 +68,9 @@ def generate_callbacks(func_list, base_package, plugin_package, plugin_name, cal
if not util.is_reply(camel_case_name_with_suffix) and not util.is_notification(func['name']):
continue
- if util.is_reply(camel_case_name_with_suffix):
- camel_case_name = util.remove_reply_suffix(camel_case_name_with_suffix)
- callback_type = "JVppCallback"
- else:
- camel_case_name_with_suffix = util.add_notification_suffix(camel_case_name_with_suffix)
- camel_case_name = camel_case_name_with_suffix
- callback_type = "JVppNotificationCallback"
-
- callbacks.append("{0}.{1}.{2}".format(plugin_package, callback_package, camel_case_name + callback_suffix))
- callback_path = os.path.join(callback_package, camel_case_name + callback_suffix + ".java")
+ callback_type = "JVppCallback"
+ callbacks.append("{0}.{1}.{2}".format(plugin_package, callback_package, camel_case_name_with_suffix + callback_suffix))
+ callback_path = os.path.join(callback_package, camel_case_name_with_suffix + callback_suffix + ".java")
callback_file = open(callback_path, 'w')
reply_type = "%s.%s.%s" % (plugin_package, dto_package, camel_case_name_with_suffix)
@@ -85,7 +78,7 @@ def generate_callbacks(func_list, base_package, plugin_package, plugin_name, cal
callback_file.write(
callback_template.substitute(inputfile=inputfile,
docs=util.api_message_to_javadoc(func),
- cls_name=camel_case_name + callback_suffix,
+ cls_name=camel_case_name_with_suffix + callback_suffix,
callback_method=method,
base_package=base_package,
plugin_package=plugin_package,
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py
index e831557c15a..e94bbc5cb28 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py
@@ -35,6 +35,23 @@ $methods
}
""")
+dto_template_typeless = Template("""
+package $plugin_package.$dto_package;
+
+/**
+ * <p>This class represents $description.
+ * <br>It was generated by dto_gen.py based on $inputfile preparsed data:
+ * <pre>
+$docs
+ * </pre>
+ */
+public final class $cls_name {
+
+$fields
+$methods
+}
+""")
+
field_template = Template(""" public $type $name;\n""")
send_template = Template(""" @Override
@@ -93,9 +110,7 @@ def generate_dtos(func_list, base_package, plugin_package, plugin_name, dto_pack
# for structures that are also used as notifications, generate dedicated notification DTO
if util.is_notification(func["name"]):
- base_type = "JVppNotification"
description = "notification DTO"
- camel_case_dto_name = util.add_notification_suffix(camel_case_dto_name)
dto_path = os.path.join(dto_package, camel_case_dto_name + ".java")
methods = generate_dto_base_methods(camel_case_dto_name, func)
write_dto_file(base_package, plugin_package, base_type, camel_case_dto_name, description, dto_package,
@@ -229,16 +244,26 @@ def generate_dto_hash(func):
def write_dto_file(base_package, plugin_package, base_type, camel_case_dto_name, description, dto_package, dto_path,
fields, func, inputfile, methods):
dto_file = open(dto_path, 'w')
- dto_file.write(dto_template.substitute(inputfile=inputfile,
- description=description,
- docs=util.api_message_to_javadoc(func),
- cls_name=camel_case_dto_name,
- fields=fields,
- methods=methods,
- base_package=base_package,
- plugin_package=plugin_package,
- base_type=base_type,
- dto_package=dto_package))
+ if base_type != "":
+ dto_file.write(dto_template.substitute(inputfile=inputfile,
+ description=description,
+ docs=util.api_message_to_javadoc(func),
+ cls_name=camel_case_dto_name,
+ fields=fields,
+ methods=methods,
+ base_package=base_package,
+ plugin_package=plugin_package,
+ base_type=base_type,
+ dto_package=dto_package))
+ else:
+ dto_file.write(dto_template_typeless.substitute(inputfile=inputfile,
+ description=description,
+ docs=util.api_message_to_javadoc(func),
+ cls_name=camel_case_dto_name,
+ fields=fields,
+ methods=methods,
+ plugin_package=plugin_package,
+ dto_package=dto_package))
dto_file.flush()
dto_file.close()
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
index 4fe7ab53fb9..e2f6aa4d505 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
@@ -70,23 +70,13 @@ def generate_class_cache(func_list, plugin_name):
if util.is_ignored(c_name) or util.is_control_ping(class_name):
continue
- if util.is_reply(class_name):
- class_references.append(class_reference_template.substitute(
- ref_name=ref_name))
- find_class_invocations.append(find_class_invocation_template.substitute(
- plugin_name=plugin_name,
- ref_name=ref_name,
- class_name=class_name))
- delete_class_invocations.append(delete_class_invocation_template.substitute(ref_name=ref_name))
- elif util.is_notification(c_name):
- class_references.append(class_reference_template.substitute(
- ref_name=util.add_notification_suffix(ref_name)))
- find_class_invocations.append(find_class_invocation_template.substitute(
- plugin_name=plugin_name,
- ref_name=util.add_notification_suffix(ref_name),
- class_name=util.add_notification_suffix(class_name)))
- delete_class_invocations.append(delete_class_invocation_template.substitute(
- ref_name=util.add_notification_suffix(ref_name)))
+ class_references.append(class_reference_template.substitute(
+ ref_name=ref_name))
+ find_class_invocations.append(find_class_invocation_template.substitute(
+ plugin_name=plugin_name,
+ ref_name=ref_name,
+ class_name=class_name))
+ delete_class_invocations.append(delete_class_invocation_template.substitute(ref_name=ref_name))
# add exception class to class cache
ref_name = 'callbackException'
@@ -270,10 +260,6 @@ def generate_msg_handlers(func_list, plugin_name, inputfile):
if not util.is_reply(dto_name) and not util.is_notification(handler_name):
continue
- if util.is_notification(handler_name):
- dto_name = util.add_notification_suffix(dto_name)
- ref_name = util.add_notification_suffix(ref_name)
-
dto_setters = ''
err_handler = ''
# dto setters
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py
index 3cfc633a55c..53e9f49e029 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py
@@ -27,7 +27,7 @@ package $plugin_package.$callback_facade_package;
* <br>It was generated by jvpp_callback_facade_gen.py based on $inputfile
* <br>(python representation of api file generated by vppapigen).
*/
-public interface CallbackJVpp${plugin_name} extends $base_package.$notification_package.NotificationRegistryProvider, java.lang.AutoCloseable {
+public interface CallbackJVpp${plugin_name} extends $base_package.$notification_package.EventRegistryProvider, java.lang.AutoCloseable {
// TODO add send
@@ -47,7 +47,7 @@ public final class CallbackJVpp${plugin_name}Facade implements CallbackJVpp${plu
private final $plugin_package.JVpp${plugin_name} jvpp;
private final java.util.Map<Integer, $base_package.$callback_package.JVppCallback> callbacks;
- private final $plugin_package.$notification_package.${plugin_name}NotificationRegistryImpl notificationRegistry = new $plugin_package.$notification_package.${plugin_name}NotificationRegistryImpl();
+ private final $plugin_package.$notification_package.${plugin_name}EventRegistryImpl eventRegistry = new $plugin_package.$notification_package.${plugin_name}EventRegistryImpl();
/**
* <p>Create CallbackJVpp${plugin_name}Facade object for provided JVpp instance.
* Constructor internally creates CallbackJVppFacadeCallback class for processing callbacks
@@ -61,12 +61,12 @@ public final class CallbackJVpp${plugin_name}Facade implements CallbackJVpp${plu
this.jvpp = java.util.Objects.requireNonNull(jvpp,"jvpp is null");
this.callbacks = new java.util.HashMap<>();
java.util.Objects.requireNonNull(registry, "JVppRegistry should not be null");
- registry.register(jvpp, new CallbackJVpp${plugin_name}FacadeCallback(this.callbacks, notificationRegistry));
+ registry.register(jvpp, new CallbackJVpp${plugin_name}FacadeCallback(this.callbacks, eventRegistry));
}
@Override
- public $plugin_package.$notification_package.${plugin_name}NotificationRegistry getNotificationRegistry() {
- return notificationRegistry;
+ public $plugin_package.$notification_package.${plugin_name}EventRegistry getEventRegistry() {
+ return eventRegistry;
}
@Override
@@ -121,7 +121,12 @@ def generate_jvpp(func_list, base_package, plugin_package, plugin_name, dto_pack
continue
# Strip suffix for dump calls
- callback_type = get_request_name(camel_case_name_upper, func['name']) + callback_gen.callback_suffix
+ callback_type = get_request_name(camel_case_name_upper, func['name'])
+ if (util.is_dump(camel_case_name_upper)):
+ callback_type += "Details"
+ elif (not util.is_notification(camel_case_name_upper)):
+ callback_type += "Reply"
+ callback_type += callback_gen.callback_suffix
if len(func['args']) == 0:
methods.append(no_arg_method_template.substitute(name=camel_case_name,
@@ -193,13 +198,13 @@ package $plugin_package.$callback_facade_package;
public final class CallbackJVpp${plugin_name}FacadeCallback implements $plugin_package.$callback_package.JVpp${plugin_name}GlobalCallback {
private final java.util.Map<Integer, $base_package.$callback_package.JVppCallback> requests;
- private final $plugin_package.$notification_package.Global${plugin_name}NotificationCallback notificationCallback;
+ private final $plugin_package.$notification_package.Global${plugin_name}EventCallback eventCallback;
private static final java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(CallbackJVpp${plugin_name}FacadeCallback.class.getName());
public CallbackJVpp${plugin_name}FacadeCallback(final java.util.Map<Integer, $base_package.$callback_package.JVppCallback> requestMap,
- final $plugin_package.$notification_package.Global${plugin_name}NotificationCallback notificationCallback) {
+ final $plugin_package.$notification_package.Global${plugin_name}EventCallback eventCallback) {
this.requests = requestMap;
- this.notificationCallback = notificationCallback;
+ this.eventCallback = eventCallback;
}
@Override
@@ -266,7 +271,7 @@ jvpp_facade_callback_notification_method_template = Template("""
if (LOG.isLoggable(java.util.logging.Level.FINE)) {
LOG.fine(String.format("Received $callback_dto event message: %s", notification));
}
- notificationCallback.on$callback_dto(notification);
+ eventCallback.on$callback_dto(notification);
}
""")
@@ -281,19 +286,19 @@ def generate_callback(func_list, base_package, plugin_package, plugin_name, dto_
continue
if util.is_reply(camel_case_name_with_suffix):
+ request_method = camel_case_name_with_suffix
callbacks.append(jvpp_facade_callback_method_template.substitute(plugin_package=plugin_package,
dto_package=dto_package,
callback_package=callback_package,
- callback=util.remove_reply_suffix(camel_case_name_with_suffix) + callback_gen.callback_suffix,
- callback_dto=camel_case_name_with_suffix))
+ callback=camel_case_name_with_suffix + callback_gen.callback_suffix,
+ callback_dto=request_method))
if util.is_notification(func["name"]):
- with_notification_suffix = util.add_notification_suffix(camel_case_name_with_suffix)
callbacks.append(jvpp_facade_callback_notification_method_template.substitute(plugin_package=plugin_package,
dto_package=dto_package,
callback_package=callback_package,
- callback=with_notification_suffix + callback_gen.callback_suffix,
- callback_dto=with_notification_suffix))
+ callback=camel_case_name_with_suffix + callback_gen.callback_suffix,
+ callback_dto=camel_case_name_with_suffix))
jvpp_file = open(os.path.join(callback_facade_package, "CallbackJVpp%sFacadeCallback.java" % plugin_name), 'w')
jvpp_file.write(jvpp_facade_callback_template.substitute(inputfile=inputfile,
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py
index b2f8d376aca..a31287b3333 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py
@@ -30,12 +30,12 @@ package $plugin_package.$future_package;
public final class FutureJVpp${plugin_name}FacadeCallback implements $plugin_package.$callback_package.JVpp${plugin_name}GlobalCallback {
private final java.util.Map<java.lang.Integer, java.util.concurrent.CompletableFuture<? extends $base_package.$dto_package.JVppReply<?>>> requests;
- private final $plugin_package.$notification_package.Global${plugin_name}NotificationCallback notificationCallback;
+ private final $plugin_package.$notification_package.Global${plugin_name}EventCallback notificationCallback;
private static final java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(FutureJVpp${plugin_name}FacadeCallback.class.getName());
public FutureJVpp${plugin_name}FacadeCallback(
final java.util.Map<java.lang.Integer, java.util.concurrent.CompletableFuture<? extends $base_package.$dto_package.JVppReply<?>>> requestMap,
- final $plugin_package.$notification_package.Global${plugin_name}NotificationCallback notificationCallback) {
+ final $plugin_package.$notification_package.Global${plugin_name}EventCallback notificationCallback) {
this.requests = requestMap;
this.notificationCallback = notificationCallback;
}
@@ -213,7 +213,7 @@ def generate_jvpp(func_list, base_package, plugin_package, plugin_name, dto_pack
if util.is_notification(func["name"]):
callbacks.append(jvpp_facade_callback_notification_method_template.substitute(plugin_package=plugin_package,
dto_package=dto_package,
- callback_dto=util.add_notification_suffix(camel_case_name_with_suffix)))
+ callback_dto=camel_case_name_with_suffix))
jvpp_file = open(os.path.join(future_facade_package, "FutureJVpp%sFacadeCallback.java" % plugin_name), 'w')
jvpp_file.write(jvpp_facade_callback_template.substitute(inputfile=inputfile,
@@ -264,7 +264,7 @@ public interface FutureJVpp${plugin_name} extends $base_package.$future_package.
$methods
@Override
- public $plugin_package.$notification_package.${plugin_name}NotificationRegistry getNotificationRegistry();
+ public $plugin_package.$notification_package.${plugin_name}EventRegistry getEventRegistry();
}
''')
@@ -284,7 +284,7 @@ package $plugin_package.$future_package;
*/
public class FutureJVpp${plugin_name}Facade extends $base_package.$future_package.AbstractFutureJVppInvoker implements FutureJVpp${plugin_name} {
- private final $plugin_package.$notification_package.${plugin_name}NotificationRegistryImpl notificationRegistry = new $plugin_package.$notification_package.${plugin_name}NotificationRegistryImpl();
+ private final $plugin_package.$notification_package.${plugin_name}EventRegistryImpl eventRegistry = new $plugin_package.$notification_package.${plugin_name}EventRegistryImpl();
/**
* <p>Create FutureJVpp${plugin_name}Facade object for provided JVpp instance.
@@ -298,12 +298,12 @@ public class FutureJVpp${plugin_name}Facade extends $base_package.$future_packag
public FutureJVpp${plugin_name}Facade(final $base_package.JVppRegistry registry, final $base_package.JVpp jvpp) throws java.io.IOException {
super(jvpp, registry, new java.util.HashMap<>());
java.util.Objects.requireNonNull(registry, "JVppRegistry should not be null");
- registry.register(jvpp, new FutureJVpp${plugin_name}FacadeCallback(getRequests(), notificationRegistry));
+ registry.register(jvpp, new FutureJVpp${plugin_name}FacadeCallback(getRequests(), eventRegistry));
}
@Override
- public $plugin_package.$notification_package.${plugin_name}NotificationRegistry getNotificationRegistry() {
- return notificationRegistry;
+ public $plugin_package.$notification_package.${plugin_name}EventRegistry getEventRegistry() {
+ return eventRegistry;
}
$methods
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py
index 7af70be0df9..f802ee27014 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py
@@ -175,7 +175,7 @@ def generate_jvpp(func_list, base_package, plugin_package, plugin_name_underscor
for func in func_list:
# Skip structures that are used only as notifications
- if util.is_just_notification(func['name']) or util.is_ignored(func['name']):
+ if util.is_ignored(func['name']):
continue
camel_case_name = util.underscore_to_camelcase(func['name'])
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py
index 66de7a56ed1..96111193f07 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py
@@ -27,7 +27,7 @@ package $plugin_package.$notification_package;
* <br>It was generated by notification_gen.py based on $inputfile
* <br>(python representation of api file generated by vppapigen).
*/
-public interface ${plugin_name}NotificationRegistry extends $base_package.$notification_package.NotificationRegistry {
+public interface ${plugin_name}EventRegistry extends $base_package.$notification_package.EventRegistry {
$register_callback_methods
@@ -44,7 +44,7 @@ package $plugin_package.$notification_package;
* <br>It was generated by notification_gen.py based on $inputfile
* <br>(python representation of api file generated by vppapigen).
*/
-public interface Global${plugin_name}NotificationCallback$callbacks {
+public interface Global${plugin_name}EventCallback$callbacks {
}
""")
@@ -57,12 +57,12 @@ package $plugin_package.$notification_package;
* <br>It was generated by notification_gen.py based on $inputfile
* <br>(python representation of api file generated by vppapigen).
*/
-public final class ${plugin_name}NotificationRegistryImpl implements ${plugin_name}NotificationRegistry, Global${plugin_name}NotificationCallback {
+public final class ${plugin_name}EventRegistryImpl implements ${plugin_name}EventRegistry, Global${plugin_name}EventCallback {
// TODO add a special NotificationCallback interface and only allow those to be registered
- private final java.util.concurrent.ConcurrentMap<Class<? extends $base_package.$dto_package.JVppNotification>, $base_package.$callback_package.JVppNotificationCallback> registeredCallbacks =
+ private final java.util.concurrent.ConcurrentMap<Class<?>, $base_package.$callback_package.JVppCallback> registeredCallbacks =
new java.util.concurrent.ConcurrentHashMap<>();
- private static java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(${plugin_name}NotificationRegistryImpl.class.getName());
+ private static java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(${plugin_name}EventRegistryImpl.class.getName());
$register_callback_methods
$handler_methods
@@ -71,6 +71,13 @@ public final class ${plugin_name}NotificationRegistryImpl implements ${plugin_na
public void close() {
registeredCallbacks.clear();
}
+
+ @Override
+ public void onError(io.fd.vpp.jvpp.VppCallbackException ex) {
+ java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(${plugin_name}EventRegistryImpl.class.getName());
+ LOG.log(java.util.logging.Level.WARNING, String.format("Received onError exception: call=%s, context=%d, retval=%d%n", ex.getMethodName(),
+ ex.getCtxId(), ex.getErrorCode()), ex);
+ }
}
""")
@@ -87,12 +94,12 @@ register_callback_impl_template = Template("""
handler_impl_template = Template("""
@Override
public void on$notification(
- final $plugin_package.$dto_package.$notification notification) {
+ final $plugin_package.$dto_package.$notification_reply notification) {
if (LOG.isLoggable(java.util.logging.Level.FINE)) {
LOG.fine(String.format("Received $notification event message: %s", notification));
}
- final $base_package.$callback_package.JVppNotificationCallback jVppNotificationCallback = registeredCallbacks.get($plugin_package.$dto_package.$notification.class);
- if (null != jVppNotificationCallback) {
+ final $base_package.$callback_package.JVppCallback jVppCallback = registeredCallbacks.get($plugin_package.$dto_package.$notification.class);
+ if (null != jVppCallback) {
(($plugin_package.$callback_package.$callback) registeredCallbacks
.get($plugin_package.$dto_package.$notification.class))
.on$notification(notification);
@@ -104,14 +111,14 @@ notification_provider_template = Template("""
package $plugin_package.$notification_package;
/**
- * Provides ${plugin_name}NotificationRegistry.
+ * Provides ${plugin_name}EventRegistry.
* <br>The file was generated by notification_gen.py based on $inputfile
* <br>(python representation of api file generated by vppapigen).
*/
-public interface ${plugin_name}NotificationRegistryProvider extends $base_package.$notification_package.NotificationRegistryProvider {
+public interface ${plugin_name}EventRegistryProvider extends $base_package.$notification_package.EventRegistryProvider {
@Override
- public ${plugin_name}NotificationRegistry getNotificationRegistry();
+ public ${plugin_name}EventRegistry getEventRegistry();
}
""")
@@ -129,12 +136,14 @@ def generate_notification_registry(func_list, base_package, plugin_package, plug
handler_methods = []
for func in func_list:
- if not util.is_notification(func['name']):
+ if not util.is_reply(func['name']) and not util.is_notification(func['name']):
continue
camel_case_name_with_suffix = util.underscore_to_camelcase_upper(func['name'])
- notification_dto = util.add_notification_suffix(camel_case_name_with_suffix)
- callback_ifc = notification_dto + callback_gen.callback_suffix
+ if util.is_control_ping(camel_case_name_with_suffix):
+ continue
+ notification_dto = camel_case_name_with_suffix
+ callback_ifc = camel_case_name_with_suffix + callback_gen.callback_suffix
fully_qualified_callback_ifc = "{0}.{1}.{2}".format(plugin_package, callback_package, callback_ifc)
callbacks.append(fully_qualified_callback_ifc)
@@ -145,17 +154,18 @@ def generate_notification_registry(func_list, base_package, plugin_package, plug
register_callback_methods_impl.append(register_callback_impl_template.substitute(plugin_package=plugin_package,
callback_package=callback_package,
dto_package=dto_package,
- notification=notification_dto,
+ notification=camel_case_name_with_suffix,
callback=callback_ifc))
handler_methods.append(handler_impl_template.substitute(base_package=base_package,
plugin_package=plugin_package,
callback_package=callback_package,
dto_package=dto_package,
notification=notification_dto,
+ notification_reply=camel_case_name_with_suffix,
callback=callback_ifc))
- callback_file = open(os.path.join(notification_package, "%sNotificationRegistry.java" % plugin_name), 'w')
+ callback_file = open(os.path.join(notification_package, "%sEventRegistry.java" % plugin_name), 'w')
callback_file.write(notification_registry_template.substitute(inputfile=inputfile,
register_callback_methods="\n ".join(register_callback_methods),
base_package=base_package,
@@ -165,7 +175,7 @@ def generate_notification_registry(func_list, base_package, plugin_package, plug
callback_file.flush()
callback_file.close()
- callback_file = open(os.path.join(notification_package, "Global%sNotificationCallback.java" % plugin_name), 'w')
+ callback_file = open(os.path.join(notification_package, "Global%sEventCallback.java" % plugin_name), 'w')
global_notification_callback_callbacks = ""
if (callbacks):
@@ -179,7 +189,7 @@ def generate_notification_registry(func_list, base_package, plugin_package, plug
callback_file.flush()
callback_file.close()
- callback_file = open(os.path.join(notification_package, "%sNotificationRegistryImpl.java" % plugin_name), 'w')
+ callback_file = open(os.path.join(notification_package, "%sEventRegistryImpl.java" % plugin_name), 'w')
callback_file.write(notification_registry_impl_template.substitute(inputfile=inputfile,
callback_package=callback_package,
dto_package=dto_package,
@@ -192,7 +202,7 @@ def generate_notification_registry(func_list, base_package, plugin_package, plug
callback_file.flush()
callback_file.close()
- callback_file = open(os.path.join(notification_package, "%sNotificationRegistryProvider.java" % plugin_name), 'w')
+ callback_file = open(os.path.join(notification_package, "%sEventRegistryProvider.java" % plugin_name), 'w')
callback_file.write(notification_provider_template.substitute(inputfile=inputfile,
base_package=base_package,
plugin_package=plugin_package,
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/util.py b/src/vpp-api/java/jvpp/gen/jvppgen/util.py
index 42394419737..48645246596 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/util.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/util.py
@@ -41,6 +41,7 @@ reply_suffixes = ("reply", "details", "l2fibtableentry")
def is_reply(name):
return name.lower().endswith(reply_suffixes)
+details_suffix = "details"
def is_details(name):
return name.lower().endswith(reply_suffixes[1]) or name.lower().endswith(reply_suffixes[2])
@@ -186,6 +187,8 @@ def remove_reply_suffix(camel_case_name_with_suffix):
def remove_suffix(camel_case_name_with_suffix, suffix):
+ if not suffix:
+ return camel_case_name_with_suffix
suffix_length = len(suffix)
return camel_case_name_with_suffix[:-suffix_length] if suffix_length != 0 else camel_case_name_with_suffix
@@ -210,3 +213,6 @@ def add_notification_suffix(camel_case_dto_name):
def is_array(java_type_as_string):
return java_type_as_string.endswith("[]")
+
+def is_want(name):
+ return name.startswith("want_") \ No newline at end of file