Search in sources :

Example 11 with JargonException

use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.

the class CollectionServiceImpl method countAll.

@Override
public int countAll() throws DataGridConnectionRefusedException {
    logger.info("countAll()");
    CollectionAO collectionAO = irodsServices.getCollectionAO();
    try {
        return collectionAO.countAllFilesUnderneathTheGivenCollection(IRODS_PATH_SEPARATOR);
    } catch (JargonException e) {
        logger.error("Could not count all files in the data grid: ", e);
    }
    return 0;
}
Also used : CollectionAO(org.irods.jargon.core.pub.CollectionAO) JargonException(org.irods.jargon.core.exception.JargonException)

Example 12 with JargonException

use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.

the class CollectionServiceImpl method compressTempFolderIntoDataGrid.

/*
	 * *************************************************************************
	 * *************************** PRIVATE METHODS *****************************
	 * *************************************************************************
	 */
/**
 * Creates a tar file into iRODS based on the path given
 *
 * @param filePathToBeBundled
 * @param bundleFilePathTobeCreated
 * @param resource
 * @return
 * @throws DataGridConnectionRefusedException
 * @throws JargonException
 */
private boolean compressTempFolderIntoDataGrid(String filePathToBeBundled, String bundleFilePathTobeCreated, String resource) throws DataGridConnectionRefusedException {
    logger.info("compressTempFolderIntoDataGrid()");
    boolean isZipFileCreatedSuccessfully = false;
    BulkFileOperationsAO bulkFileOperationsAO = null;
    try {
        bulkFileOperationsAO = irodsServices.getBulkFileOperationsAO();
        bulkFileOperationsAO.createABundleFromIrodsFilesAndStoreInIrodsWithForceOption(bundleFilePathTobeCreated, filePathToBeBundled, resource);
        isZipFileCreatedSuccessfully = true;
    } catch (JargonException e) {
        logger.error("Could not compress temporary folder: {}", e.getMessage());
    }
    return isZipFileCreatedSuccessfully;
}
Also used : BulkFileOperationsAO(org.irods.jargon.core.pub.BulkFileOperationsAO) JargonException(org.irods.jargon.core.exception.JargonException)

Example 13 with JargonException

use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.

the class CollectionServiceImpl method getInheritanceOptionForCollection.

@Override
public boolean getInheritanceOptionForCollection(String collPath) throws DataGridConnectionRefusedException, JargonException {
    logger.info("getInheritanceOptionForCollection()");
    if (collPath == null || collPath.isEmpty()) {
        throw new IllegalArgumentException("null or empty collPath");
    }
    logger.info("collPath:{}", collPath);
    CollectionAO collectionAO = irodsServices.getCollectionAO();
    try {
        return collectionAO.isCollectionSetForPermissionInheritance(collPath);
    } catch (FileNotFoundException e) {
        logger.warn("Collection {} does not exist: {}", collPath, e.getMessage());
    } catch (JargonException e) {
        logger.error("Could not retrieve inheritance option value for", collPath, e.getMessage());
        throw e;
    }
    return false;
}
Also used : CollectionAO(org.irods.jargon.core.pub.CollectionAO) JargonException(org.irods.jargon.core.exception.JargonException) FileNotFoundException(org.irods.jargon.core.exception.FileNotFoundException)

Example 14 with JargonException

use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.

the class CollectionServiceImpl method getTotalNumberOfReplsForDataObject.

@Override
public int getTotalNumberOfReplsForDataObject(String path) throws DataGridException {
    logger.info("getTotalNumberOfReplsForDataObject()");
    int totalNumberOfRepls = 0;
    if (path == null || path.isEmpty()) {
        return 0;
    }
    String parentPath = path.substring(0, path.lastIndexOf(IRODS_PATH_SEPARATOR));
    String dataObjectName = path.substring(path.lastIndexOf(IRODS_PATH_SEPARATOR), path.length());
    DataObjectAO dataObjectAO = irodsServices.getDataObjectAO();
    // getting total number of replicas
    try {
        totalNumberOfRepls = dataObjectAO.getTotalNumberOfReplsForDataObject(parentPath, dataObjectName);
    } catch (JargonException e) {
        logger.error("Could not get number of replicas of a data obj: {}", e.getMessage());
        throw new DataGridException(e.getMessage());
    }
    return totalNumberOfRepls;
}
Also used : DataGridException(com.emc.metalnx.core.domain.exceptions.DataGridException) JargonException(org.irods.jargon.core.exception.JargonException) DataObjectAO(org.irods.jargon.core.pub.DataObjectAO)

Example 15 with JargonException

use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.

the class CollectionServiceImpl method listWritePermissionsForPathAndGroupRecursive.

@Override
public Set<String> listWritePermissionsForPathAndGroupRecursive(String path, String groupName) throws DataGridConnectionRefusedException, JargonException {
    logger.info("listWritePermissionsForPathAndGroupRecursive()");
    CollectionAO collectionAO = irodsServices.getCollectionAO();
    List<DataGridCollectionAndDataObject> children = getSubCollectionsAndDataObjectsUnderPath(path);
    Set<String> list = new HashSet<String>();
    for (DataGridCollectionAndDataObject child : children) {
        try {
            if (collectionAO.getPermissionForUserName(child.getPath(), groupName) != null) {
                list.add(child.getPath());
            } else {
                if (listWritePermissionsForPathAndGroupRecursive(child.getPath(), groupName).isEmpty()) {
                    list.add(child.getPath());
                }
            }
        } catch (JargonException e) {
            logger.error("Could not list write permissions for path " + path + "and group: " + groupName, e);
        }
    }
    return list;
}
Also used : CollectionAO(org.irods.jargon.core.pub.CollectionAO) JargonException(org.irods.jargon.core.exception.JargonException) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) HashSet(java.util.HashSet)

Aggregations

JargonException (org.irods.jargon.core.exception.JargonException)86 DataGridCollectionAndDataObject (com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)20 CollectionAO (org.irods.jargon.core.pub.CollectionAO)20 DataGridException (com.emc.metalnx.core.domain.exceptions.DataGridException)18 DataObjectAO (org.irods.jargon.core.pub.DataObjectAO)18 IRODSFile (org.irods.jargon.core.pub.io.IRODSFile)17 IRODSFileFactory (org.irods.jargon.core.pub.io.IRODSFileFactory)15 ArrayList (java.util.ArrayList)12 SpecificQueryAO (org.irods.jargon.core.pub.SpecificQueryAO)12 DataGridConnectionRefusedException (com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException)11 CollectionAndDataObjectListAndSearchAO (org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO)10 SpecificQueryDefinition (org.irods.jargon.core.pub.domain.SpecificQueryDefinition)10 SpecificQueryResultSet (org.irods.jargon.core.query.SpecificQueryResultSet)9 UnsupportedDataGridFeatureException (com.emc.metalnx.core.domain.exceptions.UnsupportedDataGridFeatureException)8 SpecificQueryProvider (com.emc.metalnx.services.irods.utils.SpecificQueryProvider)8 ClientHints (org.irods.jargon.core.pub.domain.ClientHints)8 DataObject (org.irods.jargon.core.pub.domain.DataObject)8 CollectionAndDataObjectListingEntry (org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)8 SpecificQuery (org.irods.jargon.core.query.SpecificQuery)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8