use of com.emc.storageos.api.service.impl.resource.utils.XMLEventMarshaller 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);
}
Aggregations