2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (c) 2017 AT&T Intellectual Property
6 * ===================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * ============LICENSE_END=============================================
20 * ====================================================================
23 package org.onap.music.rest;
27 import javax.servlet.http.HttpServletResponse;
28 import javax.ws.rs.GET;
29 import javax.ws.rs.Path;
30 import javax.ws.rs.Produces;
31 import javax.ws.rs.core.Context;
32 import javax.ws.rs.core.MediaType;
34 import org.onap.music.response.jsonobjects.JsonResponse;
35 import org.onap.music.eelf.logging.EELFLoggerDelegate;
36 import org.onap.music.main.MusicUtil;
37 import org.onap.music.main.ResultType;
39 import com.att.eelf.configuration.EELFLogger;
40 import com.att.eelf.configuration.EELFManager;
42 import io.swagger.annotations.Api;
43 import io.swagger.annotations.ApiOperation;
46 @Path("/v{version: [0-9]+}/version")
47 @Api(value="Version Api")
48 public class RestMusicVersionAPI {
50 private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RestMusicVersionAPI.class);
53 * Get the version of MUSIC.
57 @ApiOperation(value = "Get Version", response = Map.class)
58 @Produces(MediaType.APPLICATION_JSON)
59 public Map<String,Object> version(@Context HttpServletResponse response) {
60 logger.info("Replying to request for MUSIC version with MUSIC:" + MusicUtil.getVersion());
61 response.addHeader("X-latestVersion",MusicUtil.getVersion());
62 return new JsonResponse(ResultType.SUCCESS).
63 setMusicVersion("MUSIC:" + MusicUtil.getVersion()).toMap();
67 * Get the version of MUSIC.
72 @ApiOperation(value = "Get Version", response = Map.class)
73 @Produces(MediaType.APPLICATION_JSON)
74 public Map<String,Object> build(@Context HttpServletResponse response) {
75 logger.info("Replying to request for MUSIC build with MUSIC:" + MusicUtil.getBuild());
76 response.addHeader("X-latestVersion",MusicUtil.getVersion());
77 return new JsonResponse(ResultType.SUCCESS)
78 .setMusicBuild("MUSIC:" + MusicUtil.getBuild())
79 .setMusicVersion("MUSIC:" + MusicUtil.getVersion()).toMap();