Search in sources :

Example 6 with ApplicationAdminService

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);
}
Also used : ApplicationId(org.onosproject.core.ApplicationId) ApplicationAdminService(org.onosproject.app.ApplicationAdminService) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 7 with ApplicationAdminService

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();
}
Also used : Application(org.onosproject.core.Application) ApplicationAdminService(org.onosproject.app.ApplicationAdminService) GET(javax.ws.rs.GET)

Example 8 with ApplicationAdminService

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();
}
Also used : InputStream(java.io.InputStream) ApplicationId(org.onosproject.core.ApplicationId) ApplicationAdminService(org.onosproject.app.ApplicationAdminService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 9 with ApplicationAdminService

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();
}
Also used : ApplicationId(org.onosproject.core.ApplicationId) Application(org.onosproject.core.Application) ApplicationAdminService(org.onosproject.app.ApplicationAdminService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 10 with ApplicationAdminService

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");
    }
}
Also used : SecurityAdminService(org.onosproject.security.SecurityAdminService) ApplicationId(org.onosproject.core.ApplicationId) Application(org.onosproject.core.Application) ApplicationAdminService(org.onosproject.app.ApplicationAdminService)

Aggregations

ApplicationAdminService (org.onosproject.app.ApplicationAdminService)14 ApplicationId (org.onosproject.core.ApplicationId)11 Path (javax.ws.rs.Path)8 GET (javax.ws.rs.GET)6 Produces (javax.ws.rs.Produces)6 Application (org.onosproject.core.Application)6 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 URL (java.net.URL)3 POST (javax.ws.rs.POST)3 Consumes (javax.ws.rs.Consumes)2 DELETE (javax.ws.rs.DELETE)2 YangLiveCompilerService (org.onosproject.yang.YangLiveCompilerService)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 ByteStreams (com.google.common.io.ByteStreams)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Argument (org.apache.karaf.shell.api.action.Argument)1 Command (org.apache.karaf.shell.api.action.Command)1 Completion (org.apache.karaf.shell.api.action.Completion)1