Skip to content

Commit 571038c

Browse files
vishnu-alapatiVishnu
andauthored
Introduced /message_protocols endpoint (#196)
Co-authored-by: Vishnu <vishnu.alapati@ericsson.com>
1 parent f0362f2 commit 571038c

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 2.1.5
2+
- Introduced new (/message_protocols) Endpoint which returns the available message protocols list and their respective edition names.
3+
14
## 2.1.4
25
- Fixed issue related to ER lookup strategy in REMReM-generate.
36

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111

1212
<properties>
13-
<eiffel-remrem-generate.version>2.1.4</eiffel-remrem-generate.version>
13+
<eiffel-remrem-generate.version>2.1.5</eiffel-remrem-generate.version>
1414
<eiffel-remrem-shared.version>2.0.5</eiffel-remrem-shared.version>
1515
<eiffel-remrem-semantics.version>2.2.1</eiffel-remrem-semantics.version>
1616
</properties>

service/src/main/java/com/ericsson/eiffel/remrem/generate/controller/RemremGenerateController.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,24 @@ public JsonElement getVersions() {
251251
return parser.parse(versions.toString());
252252
}
253253

254+
/**
255+
* Used to display the available message protocol list and their edition names.
256+
*
257+
* @return json with service names and respective edition details.
258+
*/
259+
@ApiOperation(value = "To get the available message protocol list and edition names", response = String.class)
260+
@RequestMapping(value = "/message_protocols", method = RequestMethod.GET)
261+
public JsonElement getMessageProtocols() {
262+
JsonArray array = new JsonArray();
263+
for (MsgService service : msgServices) {
264+
JsonObject protocolObject = new JsonObject();
265+
protocolObject.addProperty("name", service.getServiceName());
266+
protocolObject.addProperty("edition", service.getProtocolEdition());
267+
array.add(protocolObject);
268+
}
269+
return array;
270+
}
271+
254272
/**
255273
* Returns available Eiffel event types as listed in EiffelEventType enum.
256274
*

wiki/markdown/usage/service.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Available REST resources for REMReM Generate Service are described below:
3333
| /event_types/{mp} | GET | mp - message protocol, required | | This endpoint is used to obtain Eiffel event types implemented in [Eiffel REMReM Semantics](https://github.com/eiffel-community/eiffel-remrem-semantics). |
3434
| /template/{type}/{mp} | GET | type - Eiffel event type mp - message protocol, required | | This endpoint is used to obtain Eiffel event templates implemented in [Eiffel REMReM Semantics](https://github.com/eiffel-community/eiffel-remrem-semantics). |
3535
| /versions | GET | | | This endpoint is used to get versions of generate service and all loaded protocols versions in JSON format. |
36-
36+
| /message_protocols | GET | |This endpoint is used to obtain the message protocols list and edition names in JSON format. |
3737

3838
## Examples
3939

@@ -109,6 +109,18 @@ Result:
109109
{"serviceVersion":{"version":"x.x.x"},"endpointVersions":{"semanticsVersion":"x.x.x"}}
110110
```
111111

112+
### Examples for `/message_protocols` endpoint
113+
114+
```
115+
curl -H "Content-Type: application/json" -X GET http://localhost:8080/generate/message_protocols
116+
```
117+
118+
Result:
119+
120+
```
121+
{{"name":"eiffelsemantics", "edition":"xxxx"}, {"name":"eiffel3", "edition":"xxxx"}}
122+
```
123+
112124
## Status Codes
113125

114126
The response generated will have internal status codes for each and every event based on the input JSON provided.

0 commit comments

Comments
 (0)