Jian Li

[ONOS-3634] Add REST API for extended application properties

Change-Id: I61f91075ac3bd527d0e10436e14ed496f55ef593
......@@ -16,6 +16,7 @@
package org.onosproject.codec.impl;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.commons.lang3.StringEscapeUtils;
import org.onosproject.app.ApplicationService;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
......@@ -36,8 +37,11 @@ public final class ApplicationCodec extends JsonCodec<Application> {
.put("name", app.id().name())
.put("id", app.id().id())
.put("version", app.version().toString())
.put("description", app.description())
.put("category", app.category())
.put("description", StringEscapeUtils.escapeJson(app.description()))
.put("readme", StringEscapeUtils.escapeJson(app.readme()))
.put("origin", app.origin())
.put("url", app.url())
.put("permissions", app.permissions().toString()) // FIXME: change to an array
.put("featuresRepo", app.featuresRepo().isPresent() ?
app.featuresRepo().get().toString() : "")
......@@ -45,5 +49,4 @@ public final class ApplicationCodec extends JsonCodec<Application> {
.put("requiredApps", app.requiredApps().toString()) // FIXME: change to an array
.put("state", service.getState(app.id()).toString());
}
}
......
......@@ -15,7 +15,7 @@
-->
<app name="org.foo.app" origin="Circus" version="1.2.a" category="other"
url="http://www.onosproject.org" featuresRepo="mvn:org.foo-features/1.2a/xml/features"
readme="Awesome application from Circus, Inc." features="foo,bar">
features="foo,bar">
<description>Awesome application from Circus, Inc.</description>
<security>
<role>ADMIN</role>
......
......@@ -5,8 +5,11 @@
"name",
"id",
"version",
"category",
"description",
"readme",
"origin",
"url",
"permissions",
"featuresRepo",
"features",
......@@ -27,14 +30,26 @@
"type": "string",
"example": "1.2.3"
},
"category": {
"type": "string",
"example": "default"
},
"description": {
"type": "string",
"example": "ONOS app to test distributed primitives"
},
"readme": {
"type": "string",
"example": "ONOS app to test distributed primitives."
},
"origin": {
"type": "string",
"example": "ON.Lab"
},
"url": {
"type": "string",
"example": "http://onosproject.org"
},
"permissions": {
"type": "array",
"xml": {
......
......@@ -5,8 +5,11 @@
"name",
"id",
"version",
"category",
"description",
"readme",
"origin",
"url",
"permissions",
"featuresRepo",
"features",
......@@ -27,14 +30,26 @@
"type": "string",
"example": "1.2.3"
},
"category": {
"type": "string",
"example": "default"
},
"description": {
"type": "string",
"example": "ONOS app to test distributed primitives"
},
"readme": {
"type": "string",
"example": "ONOS app to test distributed primitives."
},
"origin": {
"type": "string",
"example": "ON.Lab"
},
"url": {
"type": "string",
"example": "http://onosproject.org"
},
"permissions": {
"type": "array",
"xml": {
......
......@@ -18,8 +18,11 @@
"name",
"id",
"version",
"category",
"description",
"readme",
"origin",
"url",
"permissions",
"featuresRepo",
"features",
......@@ -40,14 +43,26 @@
"type": "string",
"example": "1.2.3"
},
"category": {
"type": "string",
"example": "default"
},
"description": {
"type": "string",
"example": "ONOS app to test distributed primitives"
},
"readme": {
"type": "string",
"example": "ONOS app to test distributed primitives."
},
"origin": {
"type": "string",
"example": "ON.Lab"
},
"url": {
"type": "string",
"example": "http://onosproject.org"
},
"permissions": {
"type": "array",
"xml": {
......