* org.onap.music
* ===================================================================
* Copyright (c) 2017 AT&T Intellectual Property
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ===================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.rest;
import java.util.Map;
@Api(value="Version Api")
public class RestMusicVersionAPI {
- private EELFLoggerDelegate logger =EELFLoggerDelegate.getLogger(RestMusicVersionAPI.class);
-
- /**
- * Get the version of MUSIC
- * @return
- */
- @GET
- @ApiOperation(value = "Get Version", response = Map.class)
- @Produces(MediaType.APPLICATION_JSON)
- public Map<String,Object> version(@Context HttpServletResponse response) {
- logger.info("Replying to request for MUSIC version with MUSIC:" + MusicUtil.getVersion());
- response.addHeader("X-latestVersion",MusicUtil.getVersion());
- return new JsonResponse(ResultType.SUCCESS).setMusicVersion("MUSIC:" + MusicUtil.getVersion()).toMap();
- }
+ private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RestMusicVersionAPI.class);
+ private static final String MUSIC_KEY = "MUSIC:";
+ /**
+ * Get the version of MUSIC.
+ * @return
+ */
+ @GET
+ @ApiOperation(value = "Get Version", response = Map.class)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map<String,Object> version(@Context HttpServletResponse response) {
+ logger.info("Replying to request for MUSIC version with MUSIC:" + MusicUtil.getVersion());
+ response.addHeader("X-latestVersion",MusicUtil.getVersion());
+ return new JsonResponse(ResultType.SUCCESS).
+ setMusicVersion(MUSIC_KEY + MusicUtil.getVersion()).toMap();
+ }
+
+ /**
+ * Get the version of MUSIC.
+ * @return
+ */
+ @GET
+ @Path("/build")
+ @ApiOperation(value = "Get Version", response = Map.class)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map<String,Object> build(@Context HttpServletResponse response) {
+ logger.info("Replying to request for MUSIC build with MUSIC:" + MusicUtil.getBuild());
+ response.addHeader("X-latestVersion",MusicUtil.getVersion());
+ return new JsonResponse(ResultType.SUCCESS)
+ .setMusicBuild(MUSIC_KEY + MusicUtil.getBuild())
+ .setMusicVersion(MUSIC_KEY + MusicUtil.getVersion()).toMap();
+ }
+
+
}
\ No newline at end of file