use of io.cdap.cdap.api.metadata.MetadataException in project cdap by caskdata.
the class RemoteMetadataReader method getMetadata.
@Override
public Map<MetadataScope, Metadata> getMetadata(MetadataEntity metadataEntity) throws MetadataException {
Map<MetadataScope, Metadata> scopeMetadata = new HashMap<>();
Set<MetadataRecord> metadata;
try {
metadata = metadataClient.getMetadata(metadataEntity);
} catch (ServiceUnavailableException e) {
throw e;
} catch (Exception e) {
throw new MetadataException(e);
}
metadata.forEach(record -> scopeMetadata.put(record.getScope(), new Metadata(record.getProperties(), record.getTags())));
LOG.trace("Returning metadata record {} for {}", scopeMetadata, metadataEntity);
return scopeMetadata;
}
Aggregations