Search in sources :

Example 1 with MonitoringEventQueryResult

use of com.emc.storageos.api.service.impl.resource.utils.MonitoringEventQueryResult in project coprhd-controller by CoprHD.

the class DbEventRetriever method getBulkEvents.

@Override
public void getBulkEvents(DateTime time, TimeSeriesMetadata.TimeBucket bucket, MediaType type, Writer writer) throws MarshallingExcetion {
    if (dbClient == null) {
        throw APIException.internalServerErrors.noDBClient();
    }
    EventMarshaller marshaller = null;
    if (type.equals(MediaType.APPLICATION_XML_TYPE)) {
        marshaller = new XMLEventMarshaller();
        log.debug("Parser type: {}", type.toString());
    } else if (type.equals(MediaType.APPLICATION_JSON_TYPE)) {
        marshaller = new JSONEventMarshaller();
        log.debug("Parser type: {}", type.toString());
    } else {
        log.warn("unsupported type: {}, use XML", type.toString());
        marshaller = new XMLEventMarshaller();
    }
    MonitoringEventQueryResult result = new MonitoringEventQueryResult(marshaller, writer);
    marshaller.header(writer);
    log.info("Query time bucket {}", time.toString());
    dbClient.queryTimeSeries(EventTimeSeries.class, time, bucket, result, getThreadPool());
    marshaller.tailer(writer);
}
Also used : MonitoringEventQueryResult(com.emc.storageos.api.service.impl.resource.utils.MonitoringEventQueryResult) XMLEventMarshaller(com.emc.storageos.api.service.impl.resource.utils.XMLEventMarshaller) JSONEventMarshaller(com.emc.storageos.api.service.impl.resource.utils.JSONEventMarshaller) JSONEventMarshaller(com.emc.storageos.api.service.impl.resource.utils.JSONEventMarshaller) XMLEventMarshaller(com.emc.storageos.api.service.impl.resource.utils.XMLEventMarshaller)

Aggregations

JSONEventMarshaller (com.emc.storageos.api.service.impl.resource.utils.JSONEventMarshaller)1 MonitoringEventQueryResult (com.emc.storageos.api.service.impl.resource.utils.MonitoringEventQueryResult)1 XMLEventMarshaller (com.emc.storageos.api.service.impl.resource.utils.XMLEventMarshaller)1