use of com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo in project ats-framework by Axway.
the class MonitoringServiceImpl method scheduleSystemMonitoring.
@POST
@Path("scheduleSystemMonitoring")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response scheduleSystemMonitoring(@Context HttpServletRequest request, ScheduleSystemMonitoringPojo monitoringPojo) {
final String caller = getCaller(request, monitoringPojo, false);
ThreadsPerCaller.registerThread(caller);
try {
SessionData sd = getSessionData(request, monitoringPojo);
RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();
String agent = request.getLocalAddr() + ":" + request.getLocalPort();
Set<ReadingBean> readings = restSystemMonitor.scheduleSystemMonitoring(agent, monitoringPojo.getReadings());
restSystemMonitor.setScheduledReadingTypes(readings);
return Response.ok("{\"status\":\"scheduled system monitoring for readings '" + Arrays.toString(monitoringPojo.getReadings()) + "'\"}").build();
} catch (Exception e) {
return Response.serverError().entity(new ErrorPojo(e)).build();
} finally {
ThreadsPerCaller.unregisterThread();
}
}
use of com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo in project ats-framework by Axway.
the class MonitoringServiceImpl method scheduleMonitoring.
@POST
@Path("scheduleMonitoring")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response scheduleMonitoring(@Context HttpServletRequest request, ScheduleMonitoringPojo monitoringPojo) {
final String caller = getCaller(request, monitoringPojo, false);
ThreadsPerCaller.registerThread(caller);
try {
SessionData sd = getSessionData(request, monitoringPojo);
RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();
String agent = request.getLocalAddr() + ":" + request.getLocalPort();
Set<ReadingBean> readings = restSystemMonitor.scheduleMonitoring(agent, monitoringPojo.getReading(), monitoringPojo.getReadingParametersAsMap());
restSystemMonitor.setScheduledReadingTypes(readings);
String readingParametersAsString = entrySetAsString(monitoringPojo.getReadingParametersAsMap());
return Response.ok("{\"status\":\"scheduled monitoring for reading '" + monitoringPojo.getReading() + "' and readingParameters '" + readingParametersAsString + "'\"}").build();
} catch (Exception e) {
return Response.serverError().entity(new ErrorPojo(e)).build();
} finally {
ThreadsPerCaller.unregisterThread();
}
}
Aggregations