use of org.irods.jargon.core.pub.ResourceAO in project metalnx-web by irods-contrib.
the class ResourceServiceImpl method createResource.
@Override
public boolean createResource(DataGridResource newDataGridResource) throws DataGridConnectionRefusedException {
try {
ResourceAO resourceAO = irodsServices.getResourceAO();
ZoneAO zoneAO = irodsServices.getZoneAO();
// mapping data grid resource to iRODS Resource
Resource irodsResource = new Resource();
irodsResource.setName(newDataGridResource.getName());
irodsResource.setType(newDataGridResource.getType());
irodsResource.setZone(zoneAO.getZoneByName(newDataGridResource.getZone()));
irodsResource.setCreateTime(newDataGridResource.getCreateTime());
irodsResource.setModifyTime(newDataGridResource.getModifyTime());
irodsResource.setStatus(newDataGridResource.getStatus());
irodsResource.setInfo(newDataGridResource.getInfo());
irodsResource.setParentName(newDataGridResource.getParent());
irodsResource.setVaultPath(newDataGridResource.getPath());
irodsResource.setLocation(newDataGridResource.getHost());
// context string is not always set
if (newDataGridResource.getContextString() != null) {
irodsResource.setContextString(newDataGridResource.getContextString());
}
// adding the new resource to iRODS
resourceAO.addResource(irodsResource);
return true;
} catch (JargonException e) {
logger.error("Could not create resource: ", e);
}
return false;
}
Aggregations