Reference Guide

Table Of Contents
After disconnecting the devices from the HP VAN SDN Controller (Stopping Mininet [45] in case
of a virtualized network) the device’s active state should be updated to OFF.
Application Manager Events/State
In addition to the OSGI application service events, developers have access to SDN application
events and SDN application state. For example, applications can query their own state during
deactivation to perform pre-uninstall and/or pre-upgrade work.
The following is an example of how to listen to application events:
private ApplicationService as;
private AppEventListener listener = new MyAppEventListener();
private class MyAppEventListener implements AppEventListener {
@Override
public void handleAppEvent(ApplicationEventType e, Application app) {
if (app.id().equals(“my-app-id”)) {
if (e == ApplicationEventType.UNINSTALLING) {
// handle event
} else if (e == ApplicationEventType.UPGRADING) {
// handle event
}
}
}
}
protected void bindAppService(ApplicationService as) {
this.as = as;
as.addApplicationListener(listener);
}
protected void unbindAppService(ApplicationService as) {
this.as = null;
}
@Deactivate
protected void deactivate() {
if (as != null)
as.removeAppEventListener(listener);
}
227