use of io.jhdf.links.SoftLink in project drill by apache.
the class HDF5BatchReader method getFileMetadata.
/**
* Gets the file metadata from a given HDF5 file. It will extract the file
* name the path, and adds any information to the metadata List.
*
* @param group A list of paths from which the metadata will be extracted
* @param metadata The HDF5 metadata object from which the metadata will be extracted
* @return A list of metadata from the given file paths
*/
private List<HDF5DrillMetadata> getFileMetadata(Group group, List<HDF5DrillMetadata> metadata) {
Map<String, HDF5Attribute> attribs;
// that the group can be read.
try {
group.getChildren();
} catch (HdfException e) {
logger.warn(e.getMessage());
return metadata;
}
for (Node node : group) {
HDF5DrillMetadata metadataRow = new HDF5DrillMetadata();
if (node.isLink()) {
SoftLink link = (SoftLink) node;
metadataRow.setPath(link.getTargetPath());
metadataRow.setLink(true);
} else {
metadataRow.setPath(node.getPath());
metadataRow.setDataType(node.getType().name());
metadataRow.setLink(false);
switch(node.getType()) {
case DATASET:
attribs = getAttributes(node.getPath());
metadataRow.setAttributes(attribs);
metadata.add(metadataRow);
break;
case GROUP:
attribs = getAttributes(node.getPath());
metadataRow.setAttributes(attribs);
metadata.add(metadataRow);
getFileMetadata((Group) node, metadata);
break;
default:
logger.warn("Unknown data type: {}", node.getType());
}
}
}
return metadata;
}
Aggregations