Search in sources :

Example 6 with JargonException

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

the class SpecificQueryServiceImpl method findByAlias.

@Override
public DataGridSpecificQuery findByAlias(String alias) throws DataGridConnectionRefusedException {
    SpecificQueryAO specificQueryAO = irodsServices.getSpecificQueryAO();
    SpecificQueryDefinition query;
    try {
        query = specificQueryAO.findSpecificQueryByAlias(alias);
        return createDataGridSpecificQuery(query);
    } catch (JargonException e) {
        logger.error("Could not retrieve specific query with alias {}", alias, e);
    }
    return null;
}
Also used : JargonException(org.irods.jargon.core.exception.JargonException) SpecificQueryAO(org.irods.jargon.core.pub.SpecificQueryAO) SpecificQueryDefinition(org.irods.jargon.core.pub.domain.SpecificQueryDefinition)

Example 7 with JargonException

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

the class SpecificQueryServiceImpl method updateSpecificQuery.

@Override
public boolean updateSpecificQuery(DataGridSpecificQuery specificQuery) throws DataGridConnectionRefusedException {
    SpecificQueryAO specificQueryAO = irodsServices.getSpecificQueryAO();
    try {
        // Jargon does not support SpecificQueries update, so we'll remove and create
        // a new one.
        specificQueryAO.removeSpecificQueryByAlias(specificQuery.getAlias());
        this.createSpecificQuery(specificQuery);
        return true;
    } catch (JargonException e) {
        logger.error("Could not create specific query {}", specificQuery.getAlias(), e);
    }
    return false;
}
Also used : JargonException(org.irods.jargon.core.exception.JargonException) SpecificQueryAO(org.irods.jargon.core.pub.SpecificQueryAO)

Example 8 with JargonException

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

the class TicketServiceImpl method modify.

@Override
public DataGridTicket modify(DataGridTicket t) throws DataGridConnectionRefusedException, DataGridTicketException {
    logger.info("Modify ticket");
    if (t == null) {
        logger.error("Null ticket provided.");
        throw new DataGridTicketException("Null ticket instance");
    }
    if (t.getTicketString().isEmpty()) {
        logger.error("Ticket with empty string provided.");
        throw new DataGridTicketException("Ticket string missing");
    }
    String ticketString = t.getTicketString();
    DataGridTicket dgTicket;
    try {
        updateHostRestrictions(t);
        updateUserRestrictions(t);
        updateGroupRestrictions(t);
        TicketAdminService tas = irodsServices.getTicketAdminService();
        Ticket ticketUpdated = tas.compareGivenTicketToActualAndUpdateAsNeeded(convertDataGridTicketToTicket(t));
        dgTicket = convertTicketToDataGridTicket(ticketUpdated);
        dgTicket.setHosts(tas.listAllHostRestrictionsForSpecifiedTicket(ticketString, OFFSET));
        dgTicket.setUsers(tas.listAllUserRestrictionsForSpecifiedTicket(ticketString, OFFSET));
        dgTicket.setGroups(tas.listAllGroupRestrictionsForSpecifiedTicket(ticketString, OFFSET));
    } catch (JargonException e) {
        logger.error("Could not modify ticket");
        throw new DataGridTicketException(e.getMessage());
    }
    return dgTicket;
}
Also used : DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) Ticket(org.irods.jargon.ticket.Ticket) JargonException(org.irods.jargon.core.exception.JargonException) DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) DataGridTicketException(com.emc.metalnx.core.domain.exceptions.DataGridTicketException) TicketAdminService(org.irods.jargon.ticket.TicketAdminService)

Example 9 with JargonException

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

the class CollectionServiceImpl method getPermissionsForPath.

@Override
public String getPermissionsForPath(String path) throws DataGridConnectionRefusedException {
    logger.info("getPermissionsForPath()");
    FilePermissionEnum filePermissionEnum = null;
    String permissionType = "none";
    try {
        String user = irodsServices.getCurrentUser();
        String zone = irodsServices.getCurrentUserZone();
        Object obj = irodsServices.getCollectionAndDataObjectListAndSearchAO().getFullObjectForType(path);
        if (obj instanceof Collection) {
            CollectionAO collectionAO = irodsServices.getCollectionAO();
            filePermissionEnum = collectionAO.getPermissionForCollection(path, user, zone);
        } else {
            DataObjectAO dataObjectAO = irodsServices.getDataObjectAO();
            filePermissionEnum = dataObjectAO.getPermissionForDataObject(path, user, zone);
        }
        if (filePermissionEnum != null) {
            permissionType = filePermissionEnum.toString().toLowerCase();
        }
    } catch (FileNotFoundException e) {
        logger.error("Could not find path: {}", e.getMessage());
    } catch (JargonException e) {
        logger.error("Could not get permission for path: {}", e.getMessage());
    }
    return permissionType;
}
Also used : CollectionAO(org.irods.jargon.core.pub.CollectionAO) JargonException(org.irods.jargon.core.exception.JargonException) FileNotFoundException(org.irods.jargon.core.exception.FileNotFoundException) Collection(org.irods.jargon.core.pub.domain.Collection) IconObject(com.emc.metalnx.core.domain.entity.IconObject) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) IRODSDomainObject(org.irods.jargon.core.pub.domain.IRODSDomainObject) DataObject(org.irods.jargon.core.pub.domain.DataObject) DataObjectAO(org.irods.jargon.core.pub.DataObjectAO) FilePermissionEnum(org.irods.jargon.core.protovalues.FilePermissionEnum)

Example 10 with JargonException

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

the class CollectionServiceImpl method listInheritanceForPath.

@Override
public Set<String> listInheritanceForPath(String path) throws DataGridConnectionRefusedException {
    logger.info("listInheritanceForPath()");
    Set<String> collections = new HashSet<String>();
    CollectionAO collectionAO = irodsServices.getCollectionAO();
    CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = irodsServices.getCollectionAndDataObjectListAndSearchAO();
    try {
        List<CollectionAndDataObjectListingEntry> collList = collectionAndDataObjectListAndSearchAO.listCollectionsUnderPathWithPermissions(path, 0);
        for (CollectionAndDataObjectListingEntry collEntry : collList) {
            String currentCollPath = collEntry.getPathOrName();
            if (collectionAO.isCollectionSetForPermissionInheritance(currentCollPath)) {
                collections.add(currentCollPath);
            }
        }
        return collections;
    } catch (JargonException e) {
        logger.error("Could not get collections with inheritance option enabled: ", e);
    }
    return null;
}
Also used : CollectionAndDataObjectListAndSearchAO(org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO) CollectionAO(org.irods.jargon.core.pub.CollectionAO) JargonException(org.irods.jargon.core.exception.JargonException) CollectionAndDataObjectListingEntry(org.irods.jargon.core.query.CollectionAndDataObjectListingEntry) 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