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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations