Search in sources :

Example 6 with DataObject

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();
}
Also used : DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) DataObject(org.irods.jargon.core.pub.domain.DataObject) JargonException(org.irods.jargon.core.exception.JargonException) DataObjectAO(org.irods.jargon.core.pub.DataObjectAO)

Example 7 with DataObject

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);
}
Also used : DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) DataObject(org.irods.jargon.core.pub.domain.DataObject) HashMap(java.util.HashMap) JargonException(org.irods.jargon.core.exception.JargonException) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) DataGridResource(com.emc.metalnx.core.domain.entity.DataGridResource) DataObjectAO(org.irods.jargon.core.pub.DataObjectAO)

Example 8 with DataObject

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());
}
Also used : DataObject(org.irods.jargon.core.pub.domain.DataObject) Test(org.junit.Test)

Aggregations

DataObject (org.irods.jargon.core.pub.domain.DataObject)8 DataGridCollectionAndDataObject (com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)7 JargonException (org.irods.jargon.core.exception.JargonException)7 DataObjectAO (org.irods.jargon.core.pub.DataObjectAO)7 CollectionAO (org.irods.jargon.core.pub.CollectionAO)4 CollectionAndDataObjectListAndSearchAO (org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO)4 AvuData (org.irods.jargon.core.pub.domain.AvuData)3 DataGridMetadata (com.emc.metalnx.core.domain.entity.DataGridMetadata)1 DataGridResource (com.emc.metalnx.core.domain.entity.DataGridResource)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 JargonQueryException (org.irods.jargon.core.query.JargonQueryException)1 MetaDataAndDomainData (org.irods.jargon.core.query.MetaDataAndDomainData)1 Test (org.junit.Test)1