Search in sources :

Example 1 with EventMarshaller

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);
}
Also used : XMLEventMarshaller(com.emc.storageos.api.service.impl.resource.utils.XMLEventMarshaller) JSONEventMarshaller(com.emc.storageos.api.service.impl.resource.utils.JSONEventMarshaller) Event(com.emc.storageos.db.client.model.Event) JSONEventMarshaller(com.emc.storageos.api.service.impl.resource.utils.JSONEventMarshaller) XMLEventMarshaller(com.emc.storageos.api.service.impl.resource.utils.XMLEventMarshaller) EventMarshaller(com.emc.storageos.api.service.impl.resource.utils.EventMarshaller) URISyntaxException(java.net.URISyntaxException)

Aggregations

EventMarshaller (com.emc.storageos.api.service.impl.resource.utils.EventMarshaller)1 JSONEventMarshaller (com.emc.storageos.api.service.impl.resource.utils.JSONEventMarshaller)1 XMLEventMarshaller (com.emc.storageos.api.service.impl.resource.utils.XMLEventMarshaller)1 Event (com.emc.storageos.db.client.model.Event)1 URISyntaxException (java.net.URISyntaxException)1