use of org.onosproject.app.ApplicationAdminService in project onos by opennetworkinglab.
the class ApplicationsWebResource method getApp.
/**
* Get application details.
* Returns details of the specified application.
*
* @param name application name
* @return 200 OK; 404; 401
* @onos.rsModel Application
*/
@GET
@Path("{name}")
public Response getApp(@PathParam("name") String name) {
ApplicationAdminService service = get(ApplicationAdminService.class);
ApplicationId appId = nullIsNotFound(service.getId(name), APP_NOT_FOUND + ":" + name);
return response(service, appId);
}
use of org.onosproject.app.ApplicationAdminService in project onos by opennetworkinglab.
the class ApplicationsWebResource method getApps.
/**
* Get all installed applications.
* Returns array of all installed applications.
*
* @return 200 OK
* @onos.rsModel Applications
*/
@GET
public Response getApps() {
ApplicationAdminService service = get(ApplicationAdminService.class);
Set<Application> apps = service.getApplications();
return ok(encodeArray(Application.class, "applications", apps)).build();
}
use of org.onosproject.app.ApplicationAdminService in project onos by opennetworkinglab.
the class ApplicationResource method download.
/**
* 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}/download")
public Response download(@PathParam("name") String name) {
ApplicationAdminService service = get(ApplicationAdminService.class);
ApplicationId appId = service.getId(name);
InputStream bits = service.getApplicationArchive(appId);
String fileName = appId.name() + ".oar";
return Response.ok(bits).header("Content-Disposition", "attachment; filename=\"" + fileName + "\"").build();
}
use of org.onosproject.app.ApplicationAdminService in project onos by opennetworkinglab.
the class ApplicationResource method getIcon.
@Path("{name}/icon")
@GET
@Produces("image/png")
public Response getIcon(@PathParam("name") String name) throws IOException {
ApplicationAdminService service = get(ApplicationAdminService.class);
ApplicationId appId = service.getId(name);
Application app = service.getApplication(appId);
return Response.ok(app.icon()).build();
}
use of org.onosproject.app.ApplicationAdminService in project onos by opennetworkinglab.
the class ReviewCommand method doExecute.
@Override
protected void doExecute() {
ApplicationAdminService applicationAdminService = get(ApplicationAdminService.class);
ApplicationId appId = applicationAdminService.getId(name);
if (appId == null) {
print("No such application: %s", name);
return;
}
Application app = applicationAdminService.getApplication(appId);
SecurityAdminService smService = SecurityUtil.getSecurityService();
if (smService == null) {
print("Security Mode is disabled");
return;
}
if (accept == null) {
smService.review(appId);
printPolicy(smService, app);
} else if ("accept".equals(accept.trim())) {
smService.acceptPolicy(appId);
printPolicy(smService, app);
} else {
print("Unknown command");
}
}
Aggregations