use of org.irods.jargon.core.pub.ZoneAO in project metalnx-web by irods-contrib.
the class ZoneServiceImpl method findAll.
@Override
public List<DataGridZone> findAll() throws DataGridConnectionRefusedException {
ZoneAO zoneAO = irodsServices.getZoneAO();
List<DataGridZone> dataGridZones = null;
try {
List<Zone> zones = zoneAO.listZones();
dataGridZones = new ArrayList<DataGridZone>();
for (Zone zone : zones) {
DataGridZone dataGridZone = new DataGridZone();
dataGridZone.setId(Long.valueOf(zone.getZoneId()));
dataGridZone.setName(zone.getZoneName());
dataGridZone.setType(zone.getZoneType());
dataGridZone.setCreateTime(zone.getZoneCreateTime());
dataGridZone.setModifyTime(zone.getZoneModifyTime());
dataGridZone.setConnectionString(zone.getZoneConnection());
dataGridZone.setComment(zone.getZoneComment());
// adding this current zone to the list
dataGridZones.add(dataGridZone);
}
} catch (JargonException e) {
logger.info("Could not find all zones ", e);
}
return dataGridZones;
}
use of org.irods.jargon.core.pub.ZoneAO 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