Java Code Examples for org.jclouds.blobstore.domain.StorageMetadata#getUserMetadata()

The following examples show how to use org.jclouds.blobstore.domain.StorageMetadata#getUserMetadata() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ObjectStoreFileStorage.java    From multiapps-controller with Apache License 2.0 6 votes vote down vote up
private boolean filterByModificationTime(StorageMetadata blobMetadata, Date modificationTime) {
    Map<String, String> userMetadata = blobMetadata.getUserMetadata();
    // Clean up any blobStore entries that don't have any metadata as we can't check their creation date
    if (CollectionUtils.isEmpty(userMetadata)) {
        return true;
    }
    String longString = userMetadata.get(Constants.FILE_ENTRY_MODIFIED.toLowerCase());
    try {
        long dateLong = Long.parseLong(longString);
        Date date = new Date(dateLong);
        return date.before(modificationTime);
    } catch (NumberFormatException e) {
        // Clean up any blobStore entries that have invalid timestamp
        return true;
    }
}
 
Example 2
Source File: ObjectStoreFileStorage.java    From multiapps-controller with Apache License 2.0 5 votes vote down vote up
private boolean filterBySpace(StorageMetadata blobMetadata, String space) {
    Map<String, String> userMetadata = blobMetadata.getUserMetadata();
    if (CollectionUtils.isEmpty(userMetadata)) {
        return false;
    }
    String spaceParameter = userMetadata.get(Constants.FILE_ENTRY_SPACE.toLowerCase());
    return space.equals(spaceParameter);
}
 
Example 3
Source File: ObjectStoreFileStorage.java    From multiapps-controller with Apache License 2.0 5 votes vote down vote up
private boolean filterBySpaceAndNamespace(StorageMetadata blobMetadata, String space, String namespace) {
    Map<String, String> userMetadata = blobMetadata.getUserMetadata();
    if (CollectionUtils.isEmpty(userMetadata)) {
        return false;
    }
    String spaceParameter = userMetadata.get(Constants.FILE_ENTRY_SPACE.toLowerCase());
    String namespaceParameter = userMetadata.get(Constants.FILE_ENTRY_NAMESPACE.toLowerCase());
    return space.equals(spaceParameter) && namespace.equals(namespaceParameter);
}