use of org.onosproject.app.ApplicationAdminService in project onos by opennetworkinglab.
the class ApplicationsWebResource method health.
/**
* Get application health.
*
* @param name application name
* @return 200 OK with app health in the body; 404 if app is not found
*/
@GET
@Path("{name}/health")
public Response health(@PathParam("name") String name) {
ApplicationAdminService service = get(ApplicationAdminService.class);
ApplicationId appId = service.getId(name);
nullIsNotFound(appId, APP_ID_NOT_FOUND + ": " + name);
Application app = service.getApplication(appId);
nullIsNotFound(app, APP_NOT_FOUND + ": " + appId);
ComponentsMonitorService componentsMonitorService = get(ComponentsMonitorService.class);
boolean ready = componentsMonitorService.isFullyStarted(app.features());
return Response.ok(mapper().createObjectNode().put("message", ready ? APP_READY : APP_PENDING)).build();
}
use of org.onosproject.app.ApplicationAdminService in project onos by opennetworkinglab.
the class ApplicationsWebResource method activateApp.
/**
* Activate application.
* Activates the specified application.
*
* @param name application name
* @return 200 OK; 404; 401
*/
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("{name}/active")
public Response activateApp(@PathParam("name") String name) {
ApplicationAdminService service = get(ApplicationAdminService.class);
ApplicationId appId = nullIsNotFound(service.getId(name), APP_NOT_FOUND + ": " + name);
service.activate(appId);
return response(service, appId);
}
use of org.onosproject.app.ApplicationAdminService in project onos by opennetworkinglab.
the class ApplicationsWebResource method uninstallApp.
/**
* Uninstall application.
* Uninstalls the specified application deactivating it first if necessary.
*
* @param name application name
* @return 204 NO CONTENT
*/
@DELETE
@Path("{name}")
public Response uninstallApp(@PathParam("name") String name) {
ApplicationAdminService service = get(ApplicationAdminService.class);
ApplicationId appId = service.getId(name);
if (appId != null) {
service.uninstall(appId);
}
return Response.noContent().build();
}
use of org.onosproject.app.ApplicationAdminService in project onos by opennetworkinglab.
the class ApplicationsWebResource method getAppBits.
/**
* Get application OAR/JAR file.
* Returns the OAR/JAR file used to install the specified application.
*
* @param name application name
* @return 200 OK; 404; 401
*/
@GET
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Path("{name}/bits")
public Response getAppBits(@PathParam("name") String name) {
ApplicationAdminService service = get(ApplicationAdminService.class);
ApplicationId appId = nullIsNotFound(service.getId(name), APP_ID_NOT_FOUND + ": " + name);
InputStream bits = service.getApplicationArchive(appId);
return ok(bits).build();
}
Aggregations