use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class ApplicationsWebResource method deactivateApp.
/**
* De-activate application.
* De-activates the specified application.
*
* @param name application name
* @return 204 NO CONTENT
*/
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("{name}/active")
public Response deactivateApp(@PathParam("name") String name) {
ApplicationAdminService service = get(ApplicationAdminService.class);
ApplicationId appId = service.getId(name);
if (appId != null) {
service.deactivate(appId);
}
return Response.noContent().build();
}
use of org.onosproject.core.ApplicationId 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.core.ApplicationId in project onos by opennetworkinglab.
the class ApplicationsWebResource method getAppIds.
/**
* Gets a collection of application ids.
* Returns array of all registered application ids.
*
* @return 200 OK; 404; 401
* @onos.rsModel ApplicationIds
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("ids")
public Response getAppIds() {
CoreService service = get(CoreService.class);
Set<ApplicationId> appIds = service.getAppIds();
return ok(encodeArray(ApplicationId.class, "applicationIds", appIds)).build();
}
use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class TopologyViewMessageHandler method findIntentByPayload.
private Intent findIntentByPayload(ObjectNode payload) {
Intent intent;
Key key;
int appId = Integer.parseInt(string(payload, APP_ID));
String appName = string(payload, APP_NAME);
ApplicationId applicId = new DefaultApplicationId(appId, appName);
String stringKey = string(payload, KEY);
try {
// FIXME: If apps use different string key, but they contains
// same numeric value (e.g. "020", "0x10", "16", "#10")
// and one intent using long key (e.g. 16L)
// this function might return wrong intent.
long longKey = Long.decode(stringKey);
key = Key.of(longKey, applicId);
intent = services.intent().getIntent(key);
if (intent == null) {
// Intent might using string key, not long key
key = Key.of(stringKey, applicId);
intent = services.intent().getIntent(key);
}
} catch (NumberFormatException ex) {
// string key
key = Key.of(stringKey, applicId);
intent = services.intent().getIntent(key);
}
log.debug("Attempting to select intent by key={}", key);
return intent;
}
use of org.onosproject.core.ApplicationId 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();
}
Aggregations