Search in sources :

Example 31 with Application

use of org.onosproject.core.Application in project onos by opennetworkinglab.

the class ApplicationManager method install.

@Override
public Application install(InputStream appDescStream) {
    checkNotNull(appDescStream, "Application archive stream cannot be null");
    Application app = store.create(appDescStream);
    SecurityUtil.register(app.id());
    return app;
}
Also used : Application(org.onosproject.core.Application)

Example 32 with Application

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

Aggregations

Application (org.onosproject.core.Application)32 DefaultApplication (org.onosproject.core.DefaultApplication)12 Test (org.junit.Test)8 List (java.util.List)6 ApplicationAdminService (org.onosproject.app.ApplicationAdminService)6 ApplicationEvent (org.onosproject.app.ApplicationEvent)6 ApplicationId (org.onosproject.core.ApplicationId)6 IOException (java.io.IOException)4 Lists (com.google.common.collect.Lists)3 InputStream (java.io.InputStream)3 Collectors (java.util.stream.Collectors)3 Service (org.apache.karaf.shell.api.action.lifecycle.Service)3 ApplicationService (org.onosproject.app.ApplicationService)3 ApplicationState (org.onosproject.app.ApplicationState)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 Charsets (com.google.common.base.Charsets)2 MoreObjects (com.google.common.base.MoreObjects)2 Preconditions (com.google.common.base.Preconditions)2 Throwables (com.google.common.base.Throwables)2