Reference Guide
Table Of Contents
- 1 Introduction
- 2 Establishing Your Test and Development Environments
- 3 Developing Applications
- Introduction
- Authentication
- REST API
- Audit Logging
- Alert Logging
- Configuration
- High Availability
- OpenFlow
- Metrics Framework
- GUI
- SKI Framework - Overview
- SKI Framework - Navigation Tree
- SKI Framework - Hash Navigation
- SKI Framework - View Life-Cycle
- SKI Framework - Live Reference Application
- UI Extension
- Introduction
- Controller Teaming
- Distributed Coordination Service
- Persistence
- Backup and Restore
- Device Driver Framework
- 4 Application Security
- 5 Including Debian Packages with Applications
- 6 Sample Application
- Application Description
- Creating Application Development Workspace
- Application Generator (Automatic Workspace Creation)
- Creating Eclipse Projects
- Updating Project Dependencies
- Building the Application
- Installing the Application
- Application Code
- 7 Testing Applications
- 8 Built-In Applications
- Appendix A
- Appendix B
- Bibliography
App Event Listener
If an application registers an AppEventListener with the application service then it can receive
notification of pending uninstall or disable actions. These notifications are made prior to shutting
down the application in the OSGi runtime environment. The AppEventListener registered by the
application will hear of any application event for all installed applications. To use this method to
determine when an application should remove an installed debian package, it must filter the call-
back event for just the application id, and then look at the type of event.
private final AppEventListener listener = new AppListener();
. . .
@Activate
protected void activate() throws Exception {
. . .
appService.addAppEventListener(listener);
}
private final class AppListener implements AppEventListener {
@Override
public void handleAppEvent(ApplicationEventType event, Application app) {
if (app.id().equals(APP_ID)) {
if (event.equals(ApplicationEventType.UNINSTALLING) ||
event.equals(ApplicationEventType.DISABLING)) {
removeDebian();
}
}
}
}
Uploading and Installing the Debian Package
The path to remove the debian file is “/” and requires an action string with the action word
“uninstall” and the name of the debian package. The REST API will return a status of 200, and the
string associated with the response is JSON structure with the current status of the controller and
admin services (sdnc and sdna).
. . .
URI uri = adminRest.uri(IpAddress.LOOPBACK_IPv4, "/");
// then we need to uninstall it
ResponseData response = adminRest.post(adminRest.login(),
uri, uninstallRequestBytes());
. . .
135