@ManagedOperation(description="Return Document Location Info")
@ManagedOperationParameters({
@ManagedOperationParameter(name = "uri", description = "Document identifier")})
public CompositeData getDocumentLocation(String uri) {
try {
Properties props = new Properties();
props.setProperty("bdb.document.headers", String.valueOf(DocumentAccessor.HDR_URI));
DocumentAccessor doc = docManager.getDocument(uri, props);
CompositeData result = null;
if (doc != null) {
int hash = schemaManager.getRepository().getDistributionStrategy().getDistributionHash(uri);
Partition part = hzClient.getPartitionService().getPartition(hash);
Map<String, Object> location = new HashMap<>(2);
location.put("partition", part.getPartitionId());
location.put("owner", part.getOwner().toString());
result = JMXUtils.mapToComposite("document", "Document Location", location);
}
logger.debug("getDocumentLocation; returning: {}", result);
return result;
} catch (BagriException ex) {
logger.error("getDocumentLocation.error: {}", ex.getMessage(), ex);
throw new RuntimeException(ex.getMessage());
}
}