use of com.axway.ats.action.azure.BlobInfo in project ats-framework by Axway.
the class BlobStorageFolder method getAllMetaData.
@Override
public List<MetaData> getAllMetaData() throws RbvException {
// first check if the folder is already open
if (!isOpen) {
throw new MatchableNotOpenException("Azure Blob Storage folder is not open");
}
newMetaData.clear();
HashMap<String, MetaData> tempMetaData = new HashMap<String, MetaData>();
if (containerOperationsOnly) {
MetaData md = getContainerAllMetaData();
if (md != null) {
tempMetaData.put(this.containerName, md);
}
} else {
if (blobName == null) {
blobName = ".*";
}
List<BlobInfo> blobs = null;
String directory = null;
String actualBlobName = blobName;
if (blobName.contains("/")) {
if (blobName.endsWith("/")) {
directory = blobName;
actualBlobName = ".*";
} else {
directory = blobName.substring(0, blobName.lastIndexOf("/"));
actualBlobName = blobName.substring(blobName.lastIndexOf("/"));
}
}
if (searchRecursively) {
throw new RuntimeException("Not implemented for searchRecursively = " + searchRecursively);
} else {
if (StringUtils.isNullOrEmpty(directory)) {
blobs = this.operations.listBlobs(this.containerName, actualBlobName);
} else {
blobs = this.operations.listBlobs(this.containerName, directory, actualBlobName);
}
}
if (blobs != null) {
for (BlobInfo blob : blobs) {
MetaData metaData = new BlobStorageMetaData();
metaData.putProperty(BlobStorageMetaData.BLOB_NAME, blob.getBlobName());
metaData.putProperty(BlobStorageMetaData.BLOB_TYPE, blob.getBlobType());
metaData.putProperty(BlobStorageMetaData.CONTAINER_NAME, blob.getContainerName());
metaData.putProperty(BlobStorageMetaData.CONTENT_TYPE, blob.getContentType());
metaData.putProperty(BlobStorageMetaData.CREATION_TIME, blob.getCreationTime());
metaData.putProperty(BlobStorageMetaData.E_TAG, blob.getETag());
metaData.putProperty(BlobStorageMetaData.LAST_MODIFIED, blob.getLastModified());
metaData.putProperty(BlobStorageMetaData.MD5, blob.getMd5());
metaData.putProperty(BlobStorageMetaData.META_DATA, blob.getMetadata());
metaData.putProperty(BlobStorageMetaData.SIZE, blob.getSize());
String hashKey = blob.toString();
if (!allMetaData.containsKey(hashKey)) {
newMetaData.add(metaData);
}
tempMetaData.put(hashKey, metaData);
}
}
}
allMetaData.clear();
allMetaData.putAll(tempMetaData);
return new ArrayList<MetaData>(allMetaData.values());
}
use of com.axway.ats.action.azure.BlobInfo in project ats-framework by Axway.
the class BlobStorageVerifications method constructMatchedObjects.
private BlobInfo[] constructMatchedObjects(List<MetaData> matchedMetaData) {
BlobInfo[] matchedObjects = new BlobInfo[matchedMetaData.size()];
for (int i = 0; i < matchedMetaData.size(); i++) {
BlobInfo newMatchedObject = new BlobInfo();
matchedObjects[i] = newMatchedObject;
MetaData currentMetaData = matchedMetaData.get(i);
newMatchedObject.setBlobName((String) currentMetaData.getProperty(BlobStorageMetaData.BLOB_NAME));
newMatchedObject.setBlobType((com.axway.ats.action.azure.BlobInfo.BlobType) currentMetaData.getProperty(BlobStorageMetaData.BLOB_TYPE));
newMatchedObject.setContainerName((String) currentMetaData.getProperty(BlobStorageMetaData.CONTAINER_NAME));
newMatchedObject.setContentType((String) currentMetaData.getProperty(BlobStorageMetaData.CONTENT_TYPE));
newMatchedObject.setCreationTime((Date) currentMetaData.getProperty(BlobStorageMetaData.CREATION_TIME));
newMatchedObject.setETag((String) currentMetaData.getProperty(BlobStorageMetaData.E_TAG));
newMatchedObject.setLastModified((Date) currentMetaData.getProperty(BlobStorageMetaData.LAST_MODIFIED));
newMatchedObject.setMd5((String) currentMetaData.getProperty(BlobStorageMetaData.BLOB_NAME));
newMatchedObject.setMetadata((Map<String, String>) currentMetaData.getProperty(BlobStorageMetaData.META_DATA));
newMatchedObject.setSize((long) currentMetaData.getProperty(BlobStorageMetaData.SIZE));
}
return matchedObjects;
}
Aggregations