Search in sources :

Example 1 with StatMarshaller

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

the class DummyStatRetriever method getBulkStats.

@Override
public void getBulkStats(DateTime timeBucket, TimeBucket granularity, MediaType mediaType, PrintWriter out) throws MarshallingExcetion {
    StatMarshaller marshaller = StatMarshallerFactory.getMarshaller(mediaType);
    marshaller.header(out);
    List<Stat> stats = null;
    try {
        stats = getDummyStats();
    } catch (URISyntaxException e) {
        _logger.error("Error getting stats", e);
    }
    for (Stat stat : stats) {
        if (mediaType == MediaType.APPLICATION_XML_TYPE) {
            try {
                marshaller.marshall(stat, out);
            } catch (Exception e) {
                _logger.error(e.getMessage(), e);
            }
        } else if (mediaType == MediaType.APPLICATION_JSON_TYPE) {
            try {
                marshaller.marshall(stat, out);
            } catch (Exception e) {
                _logger.error(e.getMessage(), e);
            }
        }
    }
    marshaller.tailer(out);
}
Also used : Stat(com.emc.storageos.db.client.model.Stat) URISyntaxException(java.net.URISyntaxException) StatMarshaller(com.emc.storageos.api.service.impl.resource.utils.StatMarshaller) URISyntaxException(java.net.URISyntaxException)

Aggregations

StatMarshaller (com.emc.storageos.api.service.impl.resource.utils.StatMarshaller)1 Stat (com.emc.storageos.db.client.model.Stat)1 URISyntaxException (java.net.URISyntaxException)1