Commit cc91b9f4 authored by tzwickl's avatar tzwickl
Browse files

Updated REST interface.

parent 29d0f52a
......@@ -32,7 +32,7 @@ public class ParserConstants {
public static final String STORAGE_UNIT = "storageUnit";
// HEAP
public static final String CAPACITY_ATTR = "capacity";
public static final String CAPACITY_ATTR = "maxHeapSize";
// LAN
public static final String COMMUNICATION_LINK_SPECIFICATION_TAG = "communicationLinkResourceSpecifications_LinkingResource";
......
......@@ -53,7 +53,7 @@ public class Costs implements Serializable {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/resourceContainers/costDetails")
@Path("/getCostDetails/resourceContainers")
public Response getCostDetailsResourceContainers() {
ResponseBuilder builder;
......@@ -146,7 +146,7 @@ public class Costs implements Serializable {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/linkingResources/costDetails")
@Path("/getCostDetails/linkingResources")
public Response getCostDetailsLinkingResources() {
ResponseBuilder builder;
......
......@@ -35,7 +35,7 @@ public class Network implements Serializable {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/linkingResources")
@Path("/getLinkingResources")
public Response getLinkingResources() {
ResponseBuilder builder;
......
......@@ -29,150 +29,150 @@ import com.google.gson.Gson;
@SessionScoped
public class ResponseTimes implements Serializable {
Logger logger = LoggerFactory.getLogger(getClass());
/**
*
*/
private static final long serialVersionUID = -1931727127755595910L;
@Inject
private Selector selector;
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/runInfos")
public Response getRunInfos() {
ResponseBuilder builder;
try {
IDatabase connection = this.selector.getDatabaseConnection();
List<RunInfo> runInfos = connection.getRunInfos();
builder = Response.ok().entity(DateGsonConverter.getGsonBuilder().create().toJson(runInfos));
} catch (Exception e) {
e.printStackTrace();
builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).header(e.getClass().getName(),
e.getMessage());
}
return builder.build();
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/businessTransactions")
public Response getBusinessTransactions() {
ResponseBuilder builder;
try {
String runId = this.selector.getSessionSelection().getRunId();
IDatabase connection = this.selector.getDatabaseConnection();
builder = Response.ok()
.entity(new Gson().toJson(connection.getResponseTimesMeasurementBusinessTransactions(runId)));
} catch (Exception e) {
e.printStackTrace();
builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).header(e.getClass().getName(),
e.getMessage());
}
return builder.build();
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/stats/{businessTransaction}")
public Response getStatistics(@PathParam("businessTransaction") final String businessTransaction) {
ResponseBuilder builder;
try {
String runId = this.selector.getSessionSelection().getRunId();
IDatabase connection = this.selector.getDatabaseConnection();
Statistic statistic = new Statistic();
Map<Long, Double> percentile = connection.getResponseTimeMeasurementPercentile(runId, businessTransaction);
statistic.setMax(percentile.get(Constants.MAX));
statistic.setMin(percentile.get(Constants.MIN));
statistic.setMean(percentile.get(Constants.MEDIAN));
statistic.setQuartile1(percentile.get(Constants.QUARTILE1));
statistic.setQuartile2(percentile.get(Constants.QUARTILE2));
builder = Response.ok().entity(new Gson().toJson(statistic));
} catch (Exception e) {
e.printStackTrace();
builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).header(e.getClass().getName(),
e.getMessage());
}
return builder.build();
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/stats")
public Response getStatistics() {
ResponseBuilder builder;
try {
String runId = this.selector.getSessionSelection().getRunId();
IDatabase connection = this.selector.getDatabaseConnection();
List<String> businessTransactions = connection.getResponseTimesMeasurementBusinessTransactions(runId);
Map<String, Statistic> responseTimes = new HashMap<>();
for (String businessTransaction : businessTransactions) {
Statistic statistic = new Statistic();
Map<Long, Double> percentile = connection.getResponseTimeMeasurementPercentile(runId,
businessTransaction);
statistic.setMax(percentile.get(Constants.MAX));
statistic.setMin(percentile.get(Constants.MIN));
statistic.setMean(percentile.get(Constants.MEDIAN));
statistic.setQuartile1(percentile.get(Constants.QUARTILE1));
statistic.setQuartile2(percentile.get(Constants.QUARTILE2));
responseTimes.put(businessTransaction, statistic);
}
builder = Response.ok().entity(new Gson().toJson(responseTimes));
} catch (Exception e) {
e.printStackTrace();
builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).header(e.getClass().getName(),
e.getMessage());
}
return builder.build();
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/numberOfCalls")
public Response getNumberOfCalls() {
ResponseBuilder builder;
try {
String runId = this.selector.getSessionSelection().getRunId();
IDatabase connection = this.selector.getDatabaseConnection();
List<String> businessTransactions = connection.getResponseTimesMeasurementBusinessTransactions(runId);
Map<String, Long> numberOfCalls = new HashMap<>();
for (String businessTransaction : businessTransactions) {
numberOfCalls.put(businessTransaction,
connection.getNumberOfResponseTimeMeasurementInvocations(runId, businessTransaction));
}
builder = Response.ok().entity(new Gson().toJson(numberOfCalls));
} catch (Exception e) {
e.printStackTrace();
builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).header(e.getClass().getName(),
e.getMessage());
}
Logger logger = LoggerFactory.getLogger(getClass());
/**
*
*/
private static final long serialVersionUID = -1931727127755595910L;
@Inject
private Selector selector;
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/getRunInfos")
public Response getRunInfos() {
ResponseBuilder builder;
try {
IDatabase connection = this.selector.getDatabaseConnection();
List<RunInfo> runInfos = connection.getRunInfos();
builder = Response.ok().entity(DateGsonConverter.getGsonBuilder().create().toJson(runInfos));
} catch (Exception e) {
e.printStackTrace();
builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).header(e.getClass().getName(),
e.getMessage());
}
return builder.build();
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/getBusinessTransactions")
public Response getBusinessTransactions() {
ResponseBuilder builder;
try {
String runId = this.selector.getSessionSelection().getRunId();
IDatabase connection = this.selector.getDatabaseConnection();
builder = Response.ok()
.entity(new Gson().toJson(connection.getResponseTimesMeasurementBusinessTransactions(runId)));
} catch (Exception e) {
e.printStackTrace();
builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).header(e.getClass().getName(),
e.getMessage());
}
return builder.build();
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/getStats/{businessTransaction}")
public Response getStatistics(@PathParam("businessTransaction") final String businessTransaction) {
ResponseBuilder builder;
try {
String runId = this.selector.getSessionSelection().getRunId();
IDatabase connection = this.selector.getDatabaseConnection();
Statistic statistic = new Statistic();
Map<Long, Double> percentile = connection.getResponseTimeMeasurementPercentile(runId, businessTransaction);
statistic.setMax(percentile.get(Constants.MAX));
statistic.setMin(percentile.get(Constants.MIN));
statistic.setMean(percentile.get(Constants.MEDIAN));
statistic.setQuartile1(percentile.get(Constants.QUARTILE1));
statistic.setQuartile2(percentile.get(Constants.QUARTILE2));
builder = Response.ok().entity(new Gson().toJson(statistic));
} catch (Exception e) {
e.printStackTrace();
builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).header(e.getClass().getName(),
e.getMessage());
}
return builder.build();
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/getStats")
public Response getStatistics() {
ResponseBuilder builder;
try {
String runId = this.selector.getSessionSelection().getRunId();
IDatabase connection = this.selector.getDatabaseConnection();
List<String> businessTransactions = connection.getResponseTimesMeasurementBusinessTransactions(runId);
Map<String, Statistic> responseTimes = new HashMap<>();
for (String businessTransaction : businessTransactions) {
Statistic statistic = new Statistic();
Map<Long, Double> percentile = connection.getResponseTimeMeasurementPercentile(runId,
businessTransaction);
statistic.setMax(percentile.get(Constants.MAX));
statistic.setMin(percentile.get(Constants.MIN));
statistic.setMean(percentile.get(Constants.MEDIAN));
statistic.setQuartile1(percentile.get(Constants.QUARTILE1));
statistic.setQuartile2(percentile.get(Constants.QUARTILE2));
responseTimes.put(businessTransaction, statistic);
}
builder = Response.ok().entity(new Gson().toJson(responseTimes));
} catch (Exception e) {
e.printStackTrace();
builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).header(e.getClass().getName(),
e.getMessage());
}
return builder.build();
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/getNumberOfCalls")
public Response getNumberOfCalls() {
ResponseBuilder builder;
try {
String runId = this.selector.getSessionSelection().getRunId();
IDatabase connection = this.selector.getDatabaseConnection();
List<String> businessTransactions = connection.getResponseTimesMeasurementBusinessTransactions(runId);
Map<String, Long> numberOfCalls = new HashMap<>();
for (String businessTransaction : businessTransactions) {
numberOfCalls.put(businessTransaction,
connection.getNumberOfResponseTimeMeasurementInvocations(runId, businessTransaction));
}
builder = Response.ok().entity(new Gson().toJson(numberOfCalls));
} catch (Exception e) {
e.printStackTrace();
builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).header(e.getClass().getName(),
e.getMessage());
}
return builder.build();
}
return builder.build();
}
}
......@@ -154,9 +154,9 @@
$.jStorage.set(repositoryNameHistory, repositoryNameList);
updateRepositoryAddressList();
updateRepositoryNameList();
get("/simulation/simulations", addSimulations);
get("/responseTimes/runInfos", addRunId);
get("/measurement/experiments", addExperiments);
get(getSimulations, addSimulations);
get(getRunInfos, addRunId);
get(getMeasurements, addExperiments);
}
function connectionFailed(jqXHR, textStatus, errorThrown) {
......
......@@ -33,20 +33,23 @@ var simulatorResultUploaderSimName = "simulatorResultUploaderSimName";
var JSON_File = "JSON_File";
// REST interface
var measurementUtilStats = "/measurement/util/stats";
var measurementUtilVals = "/measurement/util/vals";
var measurementMemoryVals = "/measurement/memory/vals";
var measurementResourceContainers = "/measurement/resourceContainers";
var simulationUtilStats = "/simulation/util/stats";
var simulationUtilVals = "/simulation/util/vals";
var simulationResponseTimeBT = "/simulation/responseTimes/businessTransactions";
var simulationResponseTimeBTnOC = "/simulation/responseTimes/businessTransactions/numberOfCalls";
var simulationResourceContainers = "/simulation/resourceContainers";
var getRunInfos = "/responseTimes/getRunInfos";
var getMeasurements = "/measurement/getExperiments";
var measurementUtilStats = "/measurement/getUtilStats";
var measurementUtilVals = "/measurement/getUtilVals";
var measurementMemoryVals = "/measurement/getMemoryVals";
var measurementResourceContainers = "/measurement/getResourceContainers";
var getSimulations = "/simulation/getSimulations";
var simulationUtilStats = "/simulation/getUtilStats";
var simulationUtilVals = "/simulation/getUtilVals";
var simulationResponseTimeBT = "/simulation/getResponseTimes/businessTransactions";
var simulationResponseTimeBTnOC = "/simulation/getResponseTimes/businessTransactions/numberOfCalls";
var simulationResourceContainers = "/simulation/getResourceContainers";
var simulationNetworkUtilization = "/network/getBytes";
var simulationCostDetailResourceContainer = "/costs/resourceContainers/costDetails";
var simulationCostDetailLinkingResources = "/costs/linkingResources/costDetails";
var responseTimeStats = "/responseTimes/stats";
var responseTimeNumberOfCalls = "/responseTimes/numberOfCalls";
var simulationCostDetailResourceContainer = "/costs/getCostDetails/resourceContainers";
var simulationCostDetailLinkingResources = "/costs/getCostDetails/linkingResources";
var responseTimeStats = "/responseTimes/getStats";
var responseTimeNumberOfCalls = "/responseTimes/getNumberOfCalls";
var setSelection = "/selector/setSelection";
var getSelection = "/selector/getSelection";
var checkConnection = "/selector/checkConnection";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment