use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.
the class CollectionServiceImpl method getSubCollectionsAndDataObjectsUnderPath.
@Override
public List<DataGridCollectionAndDataObject> getSubCollectionsAndDataObjectsUnderPath(String parent) throws DataGridConnectionRefusedException, JargonException {
logger.info("getSubCollectionsAndDataObjectsUnderPath()");
if (parent == null || parent.isEmpty()) {
throw new IllegalArgumentException("null or empty parent");
}
logger.info("parent:{}", parent);
CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = irodsServices.getCollectionAndDataObjectListAndSearchAO();
List<DataGridCollectionAndDataObject> dataGridCollectionAndDataObjects = null;
try {
List<CollectionAndDataObjectListingEntry> collectionAndDataObjects = collectionAndDataObjectListAndSearchAO.listDataObjectsAndCollectionsUnderPath(parent);
dataGridCollectionAndDataObjects = new ArrayList<DataGridCollectionAndDataObject>();
dataGridCollectionAndDataObjects = this.mapListingEntryToDataGridCollectionAndDataObject(collectionAndDataObjects);
return dataGridCollectionAndDataObjects;
} catch (FileNotFoundException e) {
logger.error("Could not locate file: ", e);
throw e;
} catch (JargonException e) {
logger.error("Error: ", e);
throw e;
}
}
use of org.irods.jargon.core.exception.JargonException 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();
}
use of org.irods.jargon.core.exception.JargonException 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);
}
use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.
the class CollectionServiceImpl method findByName.
@Override
public DataGridCollectionAndDataObject findByName(String path) throws FileNotFoundException, DataGridException {
logger.info("findByName()");
if (path == null || path.isEmpty()) {
logger.info("Could not find collection or data object by name: path is null");
return null;
}
logger.info("Find collection or data object by name: {}", path);
CollectionAndDataObjectListAndSearchAO objectsAO = irodsServices.getCollectionAndDataObjectListAndSearchAO();
DataGridCollectionAndDataObject dataGridCollectionAndDataObject;
try {
CollectionAndDataObjectListingEntry entry = objectsAO.getCollectionAndDataObjectListingEntryAtGivenAbsolutePathWithHeuristicPathGuessing(path);
dataGridCollectionAndDataObject = this.mapListingEntryToDataGridCollectionAndDataObject(entry);
} catch (FileNotFoundException fnf) {
logger.warn("file not found for path:{}", path);
throw fnf;
} catch (JargonException e) {
logger.debug("error finding collection/data object by name: {}", path);
throw new DataGridException("Could not find path " + path);
}
return dataGridCollectionAndDataObject;
}
use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.
the class CollectionServiceImpl method searchCollectionAndDataObjectsByName.
@Override
public List<DataGridCollectionAndDataObject> searchCollectionAndDataObjectsByName(String collectionName) throws DataGridConnectionRefusedException {
logger.info("searchCollectionAndDataObjectsByName()");
CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = irodsServices.getCollectionAndDataObjectListAndSearchAO();
List<CollectionAndDataObjectListingEntry> collectionAndDataObjects = null;
List<DataGridCollectionAndDataObject> dataGridCollectionAndDataObjects = null;
try {
collectionAndDataObjects = collectionAndDataObjectListAndSearchAO.searchCollectionsAndDataObjectsBasedOnName(collectionName);
dataGridCollectionAndDataObjects = this.mapListingEntryToDataGridCollectionAndDataObject(collectionAndDataObjects);
return dataGridCollectionAndDataObjects;
} catch (JargonException e) {
logger.error("Could not search collections: {}", e.getMessage());
}
return null;
}
Aggregations