[ONOS-3634] Add REST API for extended application properties
Change-Id: I61f91075ac3bd527d0e10436e14ed496f55ef593
Showing
6 changed files
with
51 additions
and
3 deletions
... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
16 | package org.onosproject.codec.impl; | 16 | package org.onosproject.codec.impl; |
17 | 17 | ||
18 | import com.fasterxml.jackson.databind.node.ObjectNode; | 18 | import com.fasterxml.jackson.databind.node.ObjectNode; |
19 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
19 | import org.onosproject.app.ApplicationService; | 20 | import org.onosproject.app.ApplicationService; |
20 | import org.onosproject.codec.CodecContext; | 21 | import org.onosproject.codec.CodecContext; |
21 | import org.onosproject.codec.JsonCodec; | 22 | import org.onosproject.codec.JsonCodec; |
... | @@ -36,8 +37,11 @@ public final class ApplicationCodec extends JsonCodec<Application> { | ... | @@ -36,8 +37,11 @@ public final class ApplicationCodec extends JsonCodec<Application> { |
36 | .put("name", app.id().name()) | 37 | .put("name", app.id().name()) |
37 | .put("id", app.id().id()) | 38 | .put("id", app.id().id()) |
38 | .put("version", app.version().toString()) | 39 | .put("version", app.version().toString()) |
39 | - .put("description", app.description()) | 40 | + .put("category", app.category()) |
41 | + .put("description", StringEscapeUtils.escapeJson(app.description())) | ||
42 | + .put("readme", StringEscapeUtils.escapeJson(app.readme())) | ||
40 | .put("origin", app.origin()) | 43 | .put("origin", app.origin()) |
44 | + .put("url", app.url()) | ||
41 | .put("permissions", app.permissions().toString()) // FIXME: change to an array | 45 | .put("permissions", app.permissions().toString()) // FIXME: change to an array |
42 | .put("featuresRepo", app.featuresRepo().isPresent() ? | 46 | .put("featuresRepo", app.featuresRepo().isPresent() ? |
43 | app.featuresRepo().get().toString() : "") | 47 | app.featuresRepo().get().toString() : "") |
... | @@ -45,5 +49,4 @@ public final class ApplicationCodec extends JsonCodec<Application> { | ... | @@ -45,5 +49,4 @@ public final class ApplicationCodec extends JsonCodec<Application> { |
45 | .put("requiredApps", app.requiredApps().toString()) // FIXME: change to an array | 49 | .put("requiredApps", app.requiredApps().toString()) // FIXME: change to an array |
46 | .put("state", service.getState(app.id()).toString()); | 50 | .put("state", service.getState(app.id()).toString()); |
47 | } | 51 | } |
48 | - | ||
49 | } | 52 | } | ... | ... |
... | @@ -15,7 +15,7 @@ | ... | @@ -15,7 +15,7 @@ |
15 | --> | 15 | --> |
16 | <app name="org.foo.app" origin="Circus" version="1.2.a" category="other" | 16 | <app name="org.foo.app" origin="Circus" version="1.2.a" category="other" |
17 | url="http://www.onosproject.org" featuresRepo="mvn:org.foo-features/1.2a/xml/features" | 17 | url="http://www.onosproject.org" featuresRepo="mvn:org.foo-features/1.2a/xml/features" |
18 | - readme="Awesome application from Circus, Inc." features="foo,bar"> | 18 | + features="foo,bar"> |
19 | <description>Awesome application from Circus, Inc.</description> | 19 | <description>Awesome application from Circus, Inc.</description> |
20 | <security> | 20 | <security> |
21 | <role>ADMIN</role> | 21 | <role>ADMIN</role> | ... | ... |
No preview for this file type
... | @@ -5,8 +5,11 @@ | ... | @@ -5,8 +5,11 @@ |
5 | "name", | 5 | "name", |
6 | "id", | 6 | "id", |
7 | "version", | 7 | "version", |
8 | + "category", | ||
8 | "description", | 9 | "description", |
10 | + "readme", | ||
9 | "origin", | 11 | "origin", |
12 | + "url", | ||
10 | "permissions", | 13 | "permissions", |
11 | "featuresRepo", | 14 | "featuresRepo", |
12 | "features", | 15 | "features", |
... | @@ -27,14 +30,26 @@ | ... | @@ -27,14 +30,26 @@ |
27 | "type": "string", | 30 | "type": "string", |
28 | "example": "1.2.3" | 31 | "example": "1.2.3" |
29 | }, | 32 | }, |
33 | + "category": { | ||
34 | + "type": "string", | ||
35 | + "example": "default" | ||
36 | + }, | ||
30 | "description": { | 37 | "description": { |
31 | "type": "string", | 38 | "type": "string", |
32 | "example": "ONOS app to test distributed primitives" | 39 | "example": "ONOS app to test distributed primitives" |
33 | }, | 40 | }, |
41 | + "readme": { | ||
42 | + "type": "string", | ||
43 | + "example": "ONOS app to test distributed primitives." | ||
44 | + }, | ||
34 | "origin": { | 45 | "origin": { |
35 | "type": "string", | 46 | "type": "string", |
36 | "example": "ON.Lab" | 47 | "example": "ON.Lab" |
37 | }, | 48 | }, |
49 | + "url": { | ||
50 | + "type": "string", | ||
51 | + "example": "http://onosproject.org" | ||
52 | + }, | ||
38 | "permissions": { | 53 | "permissions": { |
39 | "type": "array", | 54 | "type": "array", |
40 | "xml": { | 55 | "xml": { | ... | ... |
... | @@ -5,8 +5,11 @@ | ... | @@ -5,8 +5,11 @@ |
5 | "name", | 5 | "name", |
6 | "id", | 6 | "id", |
7 | "version", | 7 | "version", |
8 | + "category", | ||
8 | "description", | 9 | "description", |
10 | + "readme", | ||
9 | "origin", | 11 | "origin", |
12 | + "url", | ||
10 | "permissions", | 13 | "permissions", |
11 | "featuresRepo", | 14 | "featuresRepo", |
12 | "features", | 15 | "features", |
... | @@ -27,14 +30,26 @@ | ... | @@ -27,14 +30,26 @@ |
27 | "type": "string", | 30 | "type": "string", |
28 | "example": "1.2.3" | 31 | "example": "1.2.3" |
29 | }, | 32 | }, |
33 | + "category": { | ||
34 | + "type": "string", | ||
35 | + "example": "default" | ||
36 | + }, | ||
30 | "description": { | 37 | "description": { |
31 | "type": "string", | 38 | "type": "string", |
32 | "example": "ONOS app to test distributed primitives" | 39 | "example": "ONOS app to test distributed primitives" |
33 | }, | 40 | }, |
41 | + "readme": { | ||
42 | + "type": "string", | ||
43 | + "example": "ONOS app to test distributed primitives." | ||
44 | + }, | ||
34 | "origin": { | 45 | "origin": { |
35 | "type": "string", | 46 | "type": "string", |
36 | "example": "ON.Lab" | 47 | "example": "ON.Lab" |
37 | }, | 48 | }, |
49 | + "url": { | ||
50 | + "type": "string", | ||
51 | + "example": "http://onosproject.org" | ||
52 | + }, | ||
38 | "permissions": { | 53 | "permissions": { |
39 | "type": "array", | 54 | "type": "array", |
40 | "xml": { | 55 | "xml": { | ... | ... |
... | @@ -18,8 +18,11 @@ | ... | @@ -18,8 +18,11 @@ |
18 | "name", | 18 | "name", |
19 | "id", | 19 | "id", |
20 | "version", | 20 | "version", |
21 | + "category", | ||
21 | "description", | 22 | "description", |
23 | + "readme", | ||
22 | "origin", | 24 | "origin", |
25 | + "url", | ||
23 | "permissions", | 26 | "permissions", |
24 | "featuresRepo", | 27 | "featuresRepo", |
25 | "features", | 28 | "features", |
... | @@ -40,14 +43,26 @@ | ... | @@ -40,14 +43,26 @@ |
40 | "type": "string", | 43 | "type": "string", |
41 | "example": "1.2.3" | 44 | "example": "1.2.3" |
42 | }, | 45 | }, |
46 | + "category": { | ||
47 | + "type": "string", | ||
48 | + "example": "default" | ||
49 | + }, | ||
43 | "description": { | 50 | "description": { |
44 | "type": "string", | 51 | "type": "string", |
45 | "example": "ONOS app to test distributed primitives" | 52 | "example": "ONOS app to test distributed primitives" |
46 | }, | 53 | }, |
54 | + "readme": { | ||
55 | + "type": "string", | ||
56 | + "example": "ONOS app to test distributed primitives." | ||
57 | + }, | ||
47 | "origin": { | 58 | "origin": { |
48 | "type": "string", | 59 | "type": "string", |
49 | "example": "ON.Lab" | 60 | "example": "ON.Lab" |
50 | }, | 61 | }, |
62 | + "url": { | ||
63 | + "type": "string", | ||
64 | + "example": "http://onosproject.org" | ||
65 | + }, | ||
51 | "permissions": { | 66 | "permissions": { |
52 | "type": "array", | 67 | "type": "array", |
53 | "xml": { | 68 | "xml": { | ... | ... |
-
Please register or login to post a comment