@Override public boolean createContainerInLocation(String containerName, Location location, CreateContainerOptions options) { ConcurrentMap<String, Blob> origValue = containerToBlobs.putIfAbsent( containerName, new ConcurrentHashMap<String, Blob>()); if (origValue != null) { return false; } containerToBlobAccess.putIfAbsent(containerName, new ConcurrentHashMap<String, BlobAccess>()); MutableStorageMetadata metadata = new MutableStorageMetadataImpl(); metadata.setName(containerName); metadata.setType(StorageType.CONTAINER); metadata.setLocation(location); metadata.setCreationDate(new Date()); containerMetadata.put(containerName, metadata); containerAccessMap.put(containerName, options.isPublicRead() ? ContainerAccess.PUBLIC_READ : ContainerAccess.PRIVATE); return true; }
@Override public boolean createContainerInLocation(String containerName, Location location, CreateContainerOptions options) { ConcurrentMap<String, Blob> origValue = containerToBlobs.putIfAbsent( containerName, new ConcurrentHashMap<String, Blob>()); if (origValue != null) { return false; } containerToBlobAccess.putIfAbsent(containerName, new ConcurrentHashMap<String, BlobAccess>()); MutableStorageMetadata metadata = new MutableStorageMetadataImpl(); metadata.setName(containerName); metadata.setType(StorageType.CONTAINER); metadata.setLocation(location); metadata.setCreationDate(new Date()); containerMetadata.put(containerName, metadata); containerAccessMap.put(containerName, options.isPublicRead() ? ContainerAccess.PUBLIC_READ : ContainerAccess.PRIVATE); return true; }
@Override public boolean createContainerInLocation(String containerName, Location location, CreateContainerOptions options) { ConcurrentMap<String, Blob> origValue = containerToBlobs.putIfAbsent( containerName, new ConcurrentHashMap<String, Blob>()); if (origValue != null) { return false; } containerToBlobAccess.putIfAbsent(containerName, new ConcurrentHashMap<String, BlobAccess>()); MutableStorageMetadata metadata = new MutableStorageMetadataImpl(); metadata.setName(containerName); metadata.setType(StorageType.CONTAINER); metadata.setLocation(location); metadata.setCreationDate(new Date()); containerMetadata.put(containerName, metadata); containerAccessMap.put(containerName, options.isPublicRead() ? ContainerAccess.PUBLIC_READ : ContainerAccess.PRIVATE); return true; }
@Override public boolean createContainerInLocation(String containerName, Location location, CreateContainerOptions options) { ConcurrentMap<String, Blob> origValue = containerToBlobs.putIfAbsent( containerName, new ConcurrentSkipListMap<String, Blob>()); if (origValue != null) { return false; } containerToBlobAccess.putIfAbsent(containerName, new ConcurrentHashMap<String, BlobAccess>()); MutableStorageMetadata metadata = new MutableStorageMetadataImpl(); metadata.setName(containerName); metadata.setType(StorageType.CONTAINER); metadata.setLocation(location); metadata.setCreationDate(new Date()); containerMetadata.put(containerName, metadata); containerAccessMap.put(containerName, options.isPublicRead() ? ContainerAccess.PUBLIC_READ : ContainerAccess.PRIVATE); return true; }
@Override public StorageMetadata getContainerMetadata(String container) { MutableStorageMetadata metadata = new MutableStorageMetadataImpl(); metadata.setName(container); metadata.setType(StorageType.CONTAINER); metadata.setLocation(getLocation(container)); Path path = new File(buildPathStartingFromBaseDir(container)).toPath(); BasicFileAttributes attr; try { attr = readAttributes(path, BasicFileAttributes.class); } catch (NoSuchFileException nsfe) { return null; } catch (IOException e) { throw Throwables.propagate(e); } metadata.setCreationDate(new Date(attr.creationTime().toMillis())); return metadata; }
@Override public StorageMetadata getContainerMetadata(String container) { MutableStorageMetadata metadata = new MutableStorageMetadataImpl(); metadata.setName(container); metadata.setType(StorageType.CONTAINER); metadata.setLocation(getLocation(container)); Path path = new File(buildPathStartingFromBaseDir(container)).toPath(); BasicFileAttributes attr; try { attr = readAttributes(path, BasicFileAttributes.class); } catch (NoSuchFileException nsfe) { return null; } catch (IOException e) { throw Throwables.propagate(e); } metadata.setCreationDate(new Date(attr.creationTime().toMillis())); return metadata; }
@Override public StorageMetadata getContainerMetadata(String container) { MutableStorageMetadata metadata = new MutableStorageMetadataImpl(); metadata.setName(container); metadata.setType(StorageType.CONTAINER); metadata.setLocation(getLocation(container)); Path path = new File(buildPathStartingFromBaseDir(container)).toPath(); BasicFileAttributes attr; try { attr = readAttributes(path, BasicFileAttributes.class); } catch (NoSuchFileException nsfe) { return null; } catch (IOException e) { throw Throwables.propagate(e); } metadata.setCreationDate(new Date(attr.creationTime().toMillis())); return metadata; }
public StorageMetadata apply(BucketMetadata from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setType(StorageType.CONTAINER); to.setLocation(locationOfBucket.apply(from.getName())); to.setCreationDate(from.getCreationDate()); return to; } }
public StorageMetadata apply(BucketMetadata from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setType(StorageType.CONTAINER); to.setLocation(locationOfBucket.apply(from.getName())); to.setCreationDate(from.getCreationDate()); return to; } }
public StorageMetadata apply(BucketMetadata from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setType(StorageType.CONTAINER); to.setLocation(locationOfBucket.apply(from.getName())); to.setCreationDate(from.getCreationDate()); return to; } }
public StorageMetadata apply(BucketMetadata from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setType(StorageType.CONTAINER); to.setLocation(locationOfBucket.apply(from.getName())); to.setCreationDate(from.getCreationDate()); return to; } }
public StorageMetadata apply(BucketMetadata from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setType(StorageType.CONTAINER); to.setLocation(locationOfBucket.apply(from.getName())); to.setCreationDate(from.getCreationDate()); return to; } }