Search in sources :

Example 11 with ErrorPojo

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();
    }
}
Also used : ReadingBean(com.axway.ats.common.performance.monitor.beans.ReadingBean) ErrorPojo(com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo) SessionData(com.axway.ats.agent.webapp.restservice.model.SessionData) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 12 with ErrorPojo

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();
    }
}
Also used : ReadingBean(com.axway.ats.common.performance.monitor.beans.ReadingBean) ErrorPojo(com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo) SessionData(com.axway.ats.agent.webapp.restservice.model.SessionData) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Aggregations

ErrorPojo (com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo)12 POST (javax.ws.rs.POST)12 Path (javax.ws.rs.Path)12 Produces (javax.ws.rs.Produces)12 SessionData (com.axway.ats.agent.webapp.restservice.model.SessionData)11 Consumes (javax.ws.rs.Consumes)11 ReadingBean (com.axway.ats.common.performance.monitor.beans.ReadingBean)6 PassiveDbAppender (com.axway.ats.log.appenders.PassiveDbAppender)1 DbAppenderConfiguration (com.axway.ats.log.autodb.DbAppenderConfiguration)1 TestCaseState (com.axway.ats.log.autodb.TestCaseState)1