Added service to fetch the build version from the manifest.
lbs-gitea/maptology/master This commit looks good

This commit is contained in:
2017-12-05 15:18:09 +01:00
parent b0df31ab42
commit 0ef59cd4b8
12 changed files with 583 additions and 0 deletions
@@ -0,0 +1,130 @@
package com.maptology.api.version;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Information about the build of the application.
*
* @author Marcus
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.ANY,
getterVisibility = JsonAutoDetect.Visibility.NONE,
setterVisibility = JsonAutoDetect.Visibility.NONE,
isGetterVisibility = JsonAutoDetect.Visibility.NONE)
@ApiModel(description="Represents version information about the running build.")
public class BuildVersion {
/**
* The build time.
*/
@XmlAttribute(required=true)
@ApiModelProperty(value="The build time in Epoch milliseconds.", required=true)
private long time;
/**
* The build number.
*/
@XmlAttribute(required=true)
@ApiModelProperty(value="The build number.", required=true)
private String build;
/**
* The user creating the build.
*/
@XmlAttribute(required=true)
@ApiModelProperty(value="The creator of the build.", required=true)
private String creator;
/**
* The maven package version.
*/
@XmlAttribute(required=true)
@ApiModelProperty(value="The version of the build.", required=true)
private String version;
/**
* Returns the time.
*
* @return The time.
*/
public long getTime() {
return time;
}
/**
* Sets the time.
*
* @param time The time to set.
*/
public void setTime(long time) {
this.time = time;
}
/**
* Returns the build.
*
* @return The build.
*/
public String getBuild() {
return build;
}
/**
* Sets the build.
*
* @param build The build to set.
*/
public void setBuild(String build) {
this.build = build;
}
/**
* Returns the creator.
*
* @return The creator.
*/
public String getCreator() {
return creator;
}
/**
* Sets the creator.
*
* @param creator The creator to set.
*/
public void setCreator(String creator) {
this.creator = creator;
}
/**
* Returns the version.
*
* @return The version.
*/
public String getVersion() {
return version;
}
/**
* Sets the version.
*
* @param version The version to set.
*/
public void setVersion(String version) {
this.version = version;
}
}
@@ -0,0 +1,40 @@
package com.maptology.api.version;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
/**
* An api to retrieve the build version.
*
* @author Marcus
*
*/
@Api
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Path("/")
public interface IVersionService {
/**
* Returns the build version of the service.
*
* @return The build version of the service.
*/
@GET
@Path("version/build")
@ApiOperation(value = "Returns the build version.")
@ApiResponses({
@ApiResponse(code=HttpServletResponse.SC_OK, message="Build version retrieved successfully.", response=BuildVersion.class)
})
Response getBuildVersion();
}
@@ -0,0 +1,6 @@
/**
* A service to fetch build related information.
*
* @author Marcus
*/
package com.maptology.api.version;