Search in sources :

Example 6 with IRODSFileSystemAO

use of org.irods.jargon.core.pub.IRODSFileSystemAO in project metalnx-web by irods-contrib.

the class FileOperationServiceImpl method deleteCollection.

@Override
public boolean deleteCollection(String collectionPath, boolean forceFlag) throws DataGridException {
    IRODSFileSystemAO irodsFileSystemAO = irodsServices.getIRODSFileSystemAO();
    IRODSFileFactory irodsFileFactory = irodsServices.getIRODSFileFactory();
    try {
        IRODSFile collectionToBeRemoved = irodsFileFactory.instanceIRODSFile(collectionPath);
        if (forceFlag) {
            irodsFileSystemAO.directoryDeleteForce(collectionToBeRemoved);
        } else {
            irodsFileSystemAO.directoryDeleteNoForce(collectionToBeRemoved);
        }
        return true;
    } catch (JargonException e) {
        logger.error("Could not delete collection: ", e.getMessage());
    }
    return false;
}
Also used : IRODSFileFactory(org.irods.jargon.core.pub.io.IRODSFileFactory) JargonException(org.irods.jargon.core.exception.JargonException) IRODSFileSystemAO(org.irods.jargon.core.pub.IRODSFileSystemAO) IRODSFile(org.irods.jargon.core.pub.io.IRODSFile)

Example 7 with IRODSFileSystemAO

use of org.irods.jargon.core.pub.IRODSFileSystemAO in project metalnx-web by irods-contrib.

the class FileOperationServiceImpl method deleteDataObject.

@Override
public boolean deleteDataObject(String dataObjectPath, boolean forceFlag) throws DataGridException {
    boolean dataObjDeleted = false;
    try {
        IRODSFileSystemAO irodsFileSystemAO = irodsServices.getIRODSFileSystemAO();
        IRODSFileFactory irodsFileFactory = irodsServices.getIRODSFileFactory();
        IRODSFile fileToBeRemoved = irodsFileFactory.instanceIRODSFile(dataObjectPath);
        if (forceFlag) {
            irodsFileSystemAO.fileDeleteForce(fileToBeRemoved);
        } else {
            irodsFileSystemAO.fileDeleteNoForce(fileToBeRemoved);
        }
        dataObjDeleted = true;
    } catch (JargonException e) {
        logger.error("Could not delete data object: {}", e.getMessage());
    }
    return dataObjDeleted;
}
Also used : IRODSFileFactory(org.irods.jargon.core.pub.io.IRODSFileFactory) JargonException(org.irods.jargon.core.exception.JargonException) IRODSFileSystemAO(org.irods.jargon.core.pub.IRODSFileSystemAO) IRODSFile(org.irods.jargon.core.pub.io.IRODSFile)

Aggregations

JargonException (org.irods.jargon.core.exception.JargonException)7 IRODSFileSystemAO (org.irods.jargon.core.pub.IRODSFileSystemAO)7 IRODSFile (org.irods.jargon.core.pub.io.IRODSFile)7 IRODSFileFactory (org.irods.jargon.core.pub.io.IRODSFileFactory)7 DataGridConnectionRefusedException (com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException)2 DataGridException (com.emc.metalnx.core.domain.exceptions.DataGridException)2 CollectionAO (org.irods.jargon.core.pub.CollectionAO)2 DataGridCollectionAndDataObject (com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)1 FileNotFoundException (org.irods.jargon.core.exception.FileNotFoundException)1 JargonQueryException (org.irods.jargon.core.query.JargonQueryException)1