Search in sources :

Example 1 with StorageResourceResource

use of org.apache.airavata.registry.core.app.catalog.resources.StorageResourceResource in project airavata by apache.

the class StorageResourceImpl method saveStorageResource.

protected StorageResourceResource saveStorageResource(StorageResourceDescription description) throws AppCatalogException {
    StorageResourceResource storageResourceResource = AppCatalogThriftConversion.getStorageResource(description);
    storageResourceResource.save();
    saveDataMovementInterfaces(description, storageResourceResource);
    return storageResourceResource;
}
Also used : StorageResourceResource(org.apache.airavata.registry.core.app.catalog.resources.StorageResourceResource)

Example 2 with StorageResourceResource

use of org.apache.airavata.registry.core.app.catalog.resources.StorageResourceResource in project airavata by apache.

the class StorageResourceImpl method getStorageResource.

/**
 * This method will retrieve storage resource object on given resource id
 *
 * @param resourceId unique resource id
 * @return StorageResource object
 */
@Override
public StorageResourceDescription getStorageResource(String resourceId) throws AppCatalogException {
    try {
        StorageResourceResource resource = new StorageResourceResource();
        StorageResourceResource storageResource = (StorageResourceResource) resource.get(resourceId);
        return AppCatalogThriftConversion.getStorageDescription(storageResource);
    } catch (Exception e) {
        logger.error("Error while retrieving storage resource...", e);
        throw new AppCatalogException(e);
    }
}
Also used : StorageResourceResource(org.apache.airavata.registry.core.app.catalog.resources.StorageResourceResource) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException)

Example 3 with StorageResourceResource

use of org.apache.airavata.registry.core.app.catalog.resources.StorageResourceResource in project airavata by apache.

the class StorageResourceImpl method getAllStorageResourceIdList.

/**
 * This method will retrieve all the storage resource id with it's name
 *
 * @return map of storage resource ids + name
 * @throws AppCatalogException
 */
@Override
public Map<String, String> getAllStorageResourceIdList() throws AppCatalogException {
    try {
        Map<String, String> storageResourceMap = new HashMap<String, String>();
        StorageResourceResource resource = new StorageResourceResource();
        List<AppCatalogResource> allStorageResources = resource.getAll();
        if (allStorageResources != null && !allStorageResources.isEmpty()) {
            for (AppCatalogResource sr : allStorageResources) {
                StorageResourceResource srr = (StorageResourceResource) sr;
                storageResourceMap.put(srr.getStorageResourceId(), srr.getHostName());
            }
        }
        return storageResourceMap;
    } catch (Exception e) {
        logger.error("Error while retrieving storage resource list...", e);
        throw new AppCatalogException(e);
    }
}
Also used : StorageResourceResource(org.apache.airavata.registry.core.app.catalog.resources.StorageResourceResource) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) HashMap(java.util.HashMap) AppCatalogResource(org.apache.airavata.registry.core.app.catalog.resources.AppCatalogResource) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException)

Example 4 with StorageResourceResource

use of org.apache.airavata.registry.core.app.catalog.resources.StorageResourceResource in project airavata by apache.

the class StorageResourceImpl method getAllStorageResourceList.

/**
 * This method will retrieve all the storage resources
 *
 * @return list of storage resources
 * @throws AppCatalogException
 */
@Override
public List<StorageResourceDescription> getAllStorageResourceList() throws AppCatalogException {
    List<StorageResourceDescription> storageResourceDescriptions = new ArrayList<StorageResourceDescription>();
    try {
        StorageResourceResource resource = new StorageResourceResource();
        List<AppCatalogResource> resources = resource.getAll();
        if (resources != null && !resources.isEmpty()) {
            storageResourceDescriptions = AppCatalogThriftConversion.getStorageDescriptionList(resources);
        }
    } catch (Exception e) {
        logger.error("Error while retrieving storage resource list...", e);
        throw new AppCatalogException(e);
    }
    return storageResourceDescriptions;
}
Also used : StorageResourceResource(org.apache.airavata.registry.core.app.catalog.resources.StorageResourceResource) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) StorageResourceDescription(org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription) AppCatalogResource(org.apache.airavata.registry.core.app.catalog.resources.AppCatalogResource) ArrayList(java.util.ArrayList) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException)

Example 5 with StorageResourceResource

use of org.apache.airavata.registry.core.app.catalog.resources.StorageResourceResource in project airavata by apache.

the class StorageResourceImpl method removeStorageResource.

/**
 * This method will remove given resource from the system
 *
 * @param resourceId unique resource id
 */
@Override
public void removeStorageResource(String resourceId) throws AppCatalogException {
    try {
        StorageResourceResource resource = new StorageResourceResource();
        resource.remove(resourceId);
    } catch (Exception e) {
        logger.error("Error while removing storage resource...", e);
        throw new AppCatalogException(e);
    }
}
Also used : StorageResourceResource(org.apache.airavata.registry.core.app.catalog.resources.StorageResourceResource) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException)

Aggregations

StorageResourceResource (org.apache.airavata.registry.core.app.catalog.resources.StorageResourceResource)6 AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)5 AppCatalogResource (org.apache.airavata.registry.core.app.catalog.resources.AppCatalogResource)3 HashMap (java.util.HashMap)2 ArrayList (java.util.ArrayList)1 StorageResourceDescription (org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription)1