@Override public boolean directoryExists(String container, String directory) { return delegate().directoryExists(container, directory); }
@Override public boolean directoryExists(String container, String directory) { return delegate().directoryExists(container, directory); }
@Override public boolean directoryExists(String container, String directory) { return delegate().directoryExists(container, directory); }
@Override public boolean directoryExists(String container, String directory) { return delegate().directoryExists(container, directory); }
public void execute(final String containerName, String directory) { Set<String> names = Sets.newHashSet(); names.add(directory); for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) { names.add(directory + suffix); } Map<String, ListenableFuture<?>> responses = Maps.newHashMap(); for (final String name : names) { responses.put(name, userExecutor.submit(new Callable<Void>() { @Override public Void call() throws Exception { blobstore.removeBlob(containerName, name); return null; } })); } String message = String.format("deleting directory %s in containerName: %s", directory, containerName); Map<String, Exception> exceptions; try { exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message); } catch (TimeoutException te) { throw propagate(te); } if (!exceptions.isEmpty()) throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions)); assert !blobstore.directoryExists(containerName, directory) : String.format( "still exists %s: %s", message, exceptions); } }
public void execute(String containerName, String directory) { Set<String> names = Sets.newHashSet(); names.add(directory); for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) { names.add(directory + suffix); } Map<String, ListenableFuture<?>> responses = Maps.newHashMap(); for (String name : names) { responses.put(name, ablobstore.removeBlob(containerName, name)); } String message = String.format("deleting directory %s in containerName: %s", directory, containerName); Map<String, Exception> exceptions; try { exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message); } catch (TimeoutException te) { throw propagate(te); } if (exceptions.size() > 0) throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions)); assert !blobstore.directoryExists(containerName, directory) : String.format( "still exists %s: %s", message, exceptions); } }
public void execute(final String containerName, String directory) { Set<String> names = Sets.newHashSet(); names.add(directory); for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) { names.add(directory + suffix); } Map<String, ListenableFuture<?>> responses = Maps.newHashMap(); for (final String name : names) { responses.put(name, userExecutor.submit(new Callable<Void>() { @Override public Void call() throws Exception { blobstore.removeBlob(containerName, name); return null; } })); } String message = String.format("deleting directory %s in containerName: %s", directory, containerName); Map<String, Exception> exceptions; try { exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message); } catch (TimeoutException te) { throw propagate(te); } if (!exceptions.isEmpty()) throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions)); assert !blobstore.directoryExists(containerName, directory) : String.format( "still exists %s: %s", message, exceptions); } }
public void execute(final String containerName, String directory) { Set<String> names = Sets.newHashSet(); names.add(directory); for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) { names.add(directory + suffix); } Map<String, ListenableFuture<?>> responses = Maps.newHashMap(); for (final String name : names) { responses.put(name, userExecutor.submit(new Callable<Void>() { @Override public Void call() throws Exception { blobstore.removeBlob(containerName, name); return null; } })); } String message = String.format("deleting directory %s in containerName: %s", directory, containerName); Map<String, Exception> exceptions; try { exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message); } catch (TimeoutException te) { throw propagate(te); } if (!exceptions.isEmpty()) throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions)); assert !blobstore.directoryExists(containerName, directory) : String.format( "still exists %s: %s", message, exceptions); } }
public void execute(String containerName, String directory) { Set<String> names = Sets.newHashSet(); names.add(directory); for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) { names.add(directory + suffix); } Map<String, ListenableFuture<?>> responses = Maps.newHashMap(); for (String name : names) { responses.put(name, ablobstore.removeBlob(containerName, name)); } String message = String.format("deleting directory %s in containerName: %s", directory, containerName); Map<String, Exception> exceptions; try { exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message); } catch (TimeoutException te) { throw propagate(te); } if (exceptions.size() > 0) throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions)); assert !blobstore.directoryExists(containerName, directory) : String.format( "still exists %s: %s", message, exceptions); } }
public void execute(String containerName, String directory) { Set<String> names = Sets.newHashSet(); names.add(directory); for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) { names.add(directory + suffix); } Map<String, ListenableFuture<?>> responses = Maps.newHashMap(); for (String name : names) { responses.put(name, ablobstore.removeBlob(containerName, name)); } String message = String.format("deleting directory %s in containerName: %s", directory, containerName); Map<String, Exception> exceptions; try { exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message); } catch (TimeoutException te) { throw propagate(te); } if (exceptions.size() > 0) throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions)); assert !blobstore.directoryExists(containerName, directory) : String.format( "still exists %s: %s", message, exceptions); } }
public void execute(final String containerName, String directory) { Set<String> names = Sets.newHashSet(); names.add(directory); for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) { names.add(directory + suffix); } Map<String, ListenableFuture<?>> responses = Maps.newHashMap(); for (final String name : names) { responses.put(name, userExecutor.submit(new Callable<Void>() { @Override public Void call() throws Exception { blobstore.removeBlob(containerName, name); return null; } })); } String message = String.format("deleting directory %s in containerName: %s", directory, containerName); Map<String, Exception> exceptions; try { exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, message); } catch (TimeoutException te) { throw propagate(te); } if (!exceptions.isEmpty()) throw new BlobRuntimeException(String.format("error %s: %s", message, exceptions)); assert !blobstore.directoryExists(containerName, directory) : String.format( "still exists %s: %s", message, exceptions); } }
/** * Get the indicated object from storage. * * @param oid * the Object ID to retrieve * @return DigitalObject the instantiated DigitalObject requested * @throws StorageException * if any errors occur */ @Override public DigitalObject getObject(String oid) throws StorageException { if (oid == null) { throw new StorageException("Error; Null OID received"); } if (!BlobStoreClient.getClient().directoryExists(BlobStoreClient.getContainerName(), oid)) { throw new StorageException("Error; Object with OID does not exist in storage"); } // Instantiate and return return new BlobStoreDigitalObject(oid); }
/** * Perform the actual removal from Fedora * * @param fedoraPid * the Fedora PID to remove from storage * @throws StorageException * if any errors occur */ private void removeBlobStoreObject(String oid) throws StorageException { if (BlobStoreClient.getClient().directoryExists(BlobStoreClient.getContainerName(), oid)) { BlobStoreClient.getClient().deleteDirectory(BlobStoreClient.getContainerName(), oid); } else { throw new StorageException("Object " + oid + " doesn't exist to be deleted"); } }
public void testDirectoryEndingWithSlash() throws InterruptedException { String containerName = getContainerName(); try { BlobStore blobStore = view.getBlobStore(); blobStore.createDirectory(containerName, "someDir"); // According to the S3 documentation, a directory is nothing but a blob // whose name ends with a '/'. So let's try to remove the blob we just // created. blobStore.removeBlob(containerName, "someDir/"); // The directory "someDir" shouldn't exist since we removed it. If this // test succeeds, it confirms that a directory (or folder) is nothing // but a blob with a name ending in '/'. assertEquals(blobStore.directoryExists(containerName, "someDir"), false); } finally { returnContainer(containerName); } } }
public void testDirectoryEndingWithSlash() throws InterruptedException { String containerName = getContainerName(); try { BlobStore blobStore = view.getBlobStore(); blobStore.createDirectory(containerName, "someDir"); // According to the S3 documentation, a directory is nothing but a blob // whose name ends with a '/'. So let's try to remove the blob we just // created. blobStore.removeBlob(containerName, "someDir/"); // The directory "someDir" shouldn't exist since we removed it. If this // test succeeds, it confirms that a directory (or folder) is nothing // but a blob with a name ending in '/'. assertEquals(blobStore.directoryExists(containerName, "someDir"), false); } finally { returnContainer(containerName); } }
/** * Create a new object in storage. An object identifier may be provided, or * a null value will try to have Fedora auto-generate the new OID. * * @param oid * the Object ID to use during creation, null is allowed * @return DigitalObject the instantiated DigitalObject created * @throws StorageException * if any errors occur */ @Override public synchronized DigitalObject createObject(String oid) throws StorageException { // log.debug("createObject({})", oid); if (oid == null) { throw new StorageException("Error; Null OID recieved"); } // Can we see object? if (BlobStoreClient.getClient().directoryExists(BlobStoreClient.getContainerName(), oid)) { throw new StorageException("Error; object '" + oid + "' already exists in Blobstore"); } BlobStoreClient.getClient().createDirectory(BlobStoreClient.getContainerName(), oid); // Instantiate and return return new BlobStoreDigitalObject(oid); }
String directory = "directory"; assert !view.getBlobStore().directoryExists(containerName, directory); assert view.getBlobStore().directoryExists(containerName, directory); PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName); assert !view.getBlobStore().directoryExists(containerName, directory + "/" + directory); view.getBlobStore().createDirectory(containerName, directory + "/" + directory); assert view.getBlobStore().directoryExists(containerName, directory + "/" + directory); assert view.getBlobStore().directoryExists(containerName, directory); assertThat(view.getBlobStore().directoryExists(containerName, directory + "/" + directory)).isFalse();
String directory = "directory"; assert !view.getBlobStore().directoryExists(containerName, directory); assert view.getBlobStore().directoryExists(containerName, directory); PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName); assert !view.getBlobStore().directoryExists(containerName, directory + "/" + directory); view.getBlobStore().createDirectory(containerName, directory + "/" + directory); assert view.getBlobStore().directoryExists(containerName, directory + "/" + directory); assert view.getBlobStore().directoryExists(containerName, directory); assert view.getBlobStore().directoryExists(containerName, directory + "/" + directory);