Skip to content

Commit

Permalink
Merge pull request #31 from rwth-acis/rc_0.4.1
Browse files Browse the repository at this point in the history
Release v0.4.1
  • Loading branch information
hexTileX authored Oct 25, 2017
2 parents 5532966 + 65b2653 commit 3e86122
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion etc/ant_configuration/service.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
service.version=0.4
service.version=0.4.1
service.name=de.rwth.dbis.acis.activitytracker.service
service.path=de/rwth/dbis/acis/activitytracker/service
service.class=ActivityTrackerService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import de.rwth.dbis.acis.activitytracker.service.network.HttpRequestCallable;
import i5.las2peer.api.Context;
import i5.las2peer.logging.L2pLogger;
import i5.las2peer.logging.NodeObserver;
import i5.las2peer.p2p.AgentNotKnownException;
import i5.las2peer.restMapper.RESTService;
import i5.las2peer.restMapper.annotations.ServicePath;
import io.swagger.annotations.*;
Expand Down Expand Up @@ -261,7 +263,7 @@ public void closeDBConnection(DALFacade dalFacade) {
@SwaggerDefinition(
info = @Info(
title = "las2peer Activity Service",
version = "0.4",
version = "0.4.1",
description = "An activity tracker for las2peer and other web services.",
termsOfService = "http://requirements-bazaar.org",
contact = @Contact(
Expand Down Expand Up @@ -487,6 +489,31 @@ public Response createActivity(@ApiParam(value = "Activity" +
}
}

/**
* This method allows to retrieve the service name version.
*
* @return Response with service name version as a JSON object.
*/
@GET
@Path("/version")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "This method allows to retrieve the service name version.")
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns service name version"),
@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal server problems")
})
public Response getServiceNameVersion() throws ActivityTrackerException {
try {
String serviceNameVersion = Context.getCurrent().getService().getAgent().getServiceNameVersion().toString();
return Response.ok("{\"version\": \"" + serviceNameVersion + "\"}").build();
} catch (AgentNotKnownException ex) {
ActivityTrackerException atException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.ACTIVITYTRACKERSERVICE, ErrorCode.UNKNOWN, ex.getMessage());
L2pLogger.logEvent(NodeObserver.Event.SERVICE_ERROR, Context.getCurrent().getMainAgent(), "Get service name version failed");
service.logger.warning(atException.getMessage());
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build();
}
}

}

}

0 comments on commit 3e86122

Please sign in to comment.