use of com.emc.storageos.api.service.impl.resource.utils.EventMarshaller in project coprhd-controller by CoprHD.
the class DummyEventRetriever method getBulkEvents.
@Override
public void getBulkEvents(DateTime time, TimeSeriesMetadata.TimeBucket bucket, MediaType type, Writer writer) throws MarshallingExcetion {
EventMarshaller marshaller = null;
if (type == MediaType.APPLICATION_XML_TYPE) {
marshaller = new XMLEventMarshaller();
} else if (type == MediaType.APPLICATION_JSON_TYPE) {
marshaller = new JSONEventMarshaller();
}
marshaller.header(writer);
List<Event> events = null;
try {
events = getDummyEvents();
} catch (URISyntaxException e) {
_logger.error("Error getting events", e);
}
for (Event event : events) {
if (type == MediaType.APPLICATION_XML_TYPE) {
marshaller.marshal(event, writer);
} else if (type == MediaType.APPLICATION_JSON_TYPE) {
marshaller.marshal(event, writer);
}
}
marshaller.tailer(writer);
}
Aggregations