Search in sources :

Example 1 with StorageObject

use of org.openstack.model.storage.StorageObject in project platformlayer by platformlayer.

the class OpenstackCasStore method findArtifact.

@Override
public CasStoreObject findArtifact(Md5Hash hash) {
    OpenstackStorageClient storageClient = getStorageClient();
    try {
        List<StorageObject> storageObjects = Lists.newArrayList(storageClient.listObjects(containerName, null, null));
        String findHash = hash.toHex();
        for (StorageObject storageObject : storageObjects) {
            String storageObjectHash = storageObject.getHash();
            if (storageObjectHash.equalsIgnoreCase(findHash)) {
                return new OpenstackCasObject(storageObject);
            }
        }
    } catch (OpenstackNotFoundException e) {
        log.debug("Not found (404) returned from Openstack");
        return null;
    }
    return null;
}
Also used : StorageObject(org.openstack.model.storage.StorageObject) OpenstackStorageClient(org.openstack.client.storage.OpenstackStorageClient) OpenstackNotFoundException(org.openstack.client.OpenstackNotFoundException)

Aggregations

OpenstackNotFoundException (org.openstack.client.OpenstackNotFoundException)1 OpenstackStorageClient (org.openstack.client.storage.OpenstackStorageClient)1 StorageObject (org.openstack.model.storage.StorageObject)1