Search in sources :

Example 1 with ZoneAO

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;
}
Also used : DataGridZone(com.emc.metalnx.core.domain.entity.DataGridZone) Zone(org.irods.jargon.core.pub.domain.Zone) DataGridZone(com.emc.metalnx.core.domain.entity.DataGridZone) JargonException(org.irods.jargon.core.exception.JargonException) ZoneAO(org.irods.jargon.core.pub.ZoneAO)

Example 2 with ZoneAO

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;
}
Also used : ResourceAO(org.irods.jargon.core.pub.ResourceAO) JargonException(org.irods.jargon.core.exception.JargonException) Resource(org.irods.jargon.core.pub.domain.Resource) DataGridResource(com.emc.metalnx.core.domain.entity.DataGridResource) ZoneAO(org.irods.jargon.core.pub.ZoneAO)

Aggregations

JargonException (org.irods.jargon.core.exception.JargonException)2 ZoneAO (org.irods.jargon.core.pub.ZoneAO)2 DataGridResource (com.emc.metalnx.core.domain.entity.DataGridResource)1 DataGridZone (com.emc.metalnx.core.domain.entity.DataGridZone)1 ResourceAO (org.irods.jargon.core.pub.ResourceAO)1 Resource (org.irods.jargon.core.pub.domain.Resource)1 Zone (org.irods.jargon.core.pub.domain.Zone)1