Reference Guide

Table Of Contents
Installing a debian package
The path to install the debian file is “/” and requires an action string with the action word “install”
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 contorller and Admin
services (sdnc and sdna).
. . .
uri = adminRest.uri(IpAddress.LOOPBACK_IPv4, "/");
// then we need to install it
ResponseData response = adminRest.post(adminRest.login(),
uri, installRequestBytes());
if (response.status() != Response.Status.OK.getStatusCode())
throw new IllegalStateException(E_INSTALL + response.status());
. . .
private byte[] installRequestBytes() throws UnsupportedEncodingException {
String install = "{ \”action\”: " +
\”install\”, \”name\”: “ +
\”” + APP_DEBIAN_FILE + “\”}";
return install.getBytes(UTF8);
}
Removing the Debian Package
The application must assume the responsibility for removing the debian package when the
application is uninstalled. An application can determine that it is being uninstalled via an
AppEventListener or by checking the current state of the application in a components deactivate
method.
An application should consider the differences between “DISABLED” and “UNINSTALLED”. When
a user disables an application, the application manager removes that application from the OSGi
runtime environment, but the physical files that constitute that application are not removed from
disk. If a user decides to “ENABLE” an application that has been disabled, then it is re-introduced
into the OSGi runtime environment. When in a “DISABLED” state there is no java code from that
application executing (at least the intent is that there is no java code executing). An application
should determine if it is proper to remove (or shutdown) the installed debian package when it is
being disabled. When an application is uninstalled, it is the responsibility of the application to
remove the installed debian.
134