use of org.irods.jargon.core.pub.domain.DataObject in project metalnx-web by irods-contrib.
the class CollectionServiceImpl method getChecksum.
@Override
public String getChecksum(String path) throws DataGridConnectionRefusedException {
logger.info("getChecksum()");
logger.debug("Getting checksum of " + path);
DataObjectAO dataObjectAO = irodsServices.getDataObjectAO();
DataObject dataObject = null;
try {
dataObject = dataObjectAO.findByAbsolutePath(path);
} catch (JargonException e) {
logger.error("Could not find a data object matching " + path, e);
}
if (dataObject != null) {
return dataObject.getChecksum();
}
return new String();
}
use of org.irods.jargon.core.pub.domain.DataObject in project metalnx-web by irods-contrib.
the class CollectionServiceImpl method listReplicasByResource.
@Override
public Map<DataGridCollectionAndDataObject, DataGridResource> listReplicasByResource(String path) throws DataGridConnectionRefusedException {
logger.info("listReplicasByResource()");
logger.info("Listing all replicas of " + path);
Map<DataGridCollectionAndDataObject, DataGridResource> map = new HashMap<DataGridCollectionAndDataObject, DataGridResource>();
String collectionAbsPath = null;
String fileName = null;
DataObjectAO dataObjectAO = irodsServices.getDataObjectAO();
try {
collectionAbsPath = path.substring(0, path.lastIndexOf(IRODS_PATH_SEPARATOR));
fileName = path.substring(path.lastIndexOf(IRODS_PATH_SEPARATOR) + 1, path.length());
List<DataObject> replicas = dataObjectAO.listReplicationsForFile(collectionAbsPath, fileName);
for (DataObject replica : replicas) {
DataGridCollectionAndDataObject dataGridCollectionAndDataObject = DataGridUtils.getDataGridCollectionAndDataObject(replica);
DataGridResource dataGridResource = resourceService.find(replica.getResourceName());
map.put(dataGridCollectionAndDataObject, dataGridResource);
}
} catch (JargonException e) {
logger.error("Could not list replicas by resource for " + path);
}
return DataGridUtils.sortReplicaResourceMap(map);
}
use of org.irods.jargon.core.pub.domain.DataObject in project metalnx-web by irods-contrib.
the class TestTicketAuthenticatedAccess method testTransferFileWithTicketAsAuthenticatedUser.
@Test
public void testTransferFileWithTicketAsAuthenticatedUser() throws DataGridTicketUploadException, DataGridTicketInvalidUserException, DataGridConnectionRefusedException, JargonException {
ticketClientService.transferFileToIRODSUsingTicket(ticketString, localFile, targetPath);
DataObject obj = irodsServices.getDataObjectAO().findByCollectionNameAndDataName(targetPath, localFile.getName());
Assert.assertEquals(username, obj.getDataOwnerName());
}
Aggregations