@Test public void testCopy() throws IOException { Binary binary = binaryManager.getBinary(Blobs.createBlob(CONTENT)); binary = binaryManager.getBinary(CONTENT_MD5); try (InputStream stream = binary.getStream()) { assertNotNull(stream); assertEquals(CONTENT, toString(stream)); } Binary binary2 = binaryManager2.getBinary(CONTENT_MD5); try (InputStream stream2 = binary2.getStream()) { assertNull(stream2); } BlobInfo blobInfo = new BlobInfo(); blobInfo.key = CONTENT_MD5; Blob blob = binaryManager.readBlob(blobInfo); binaryManager2.writeBlob(blob); binary2 = binaryManager2.getBinary(CONTENT_MD5); try (InputStream stream2 = binary2.getStream()) { assertNotNull(stream2); assertEquals(CONTENT, toString(stream2)); } binaryManager.fileCache.clear(); binary = binaryManager.getBinary(CONTENT_MD5); try (InputStream stream = binary.getStream()) { assertNotNull(stream); assertEquals(CONTENT, toString(stream)); } }
@Override public String writeBlob(Blob blob) throws IOException { if (blob instanceof ManagedBlob) { ManagedBlob managedBlob = (ManagedBlob) blob; BlobProvider blobProvider = Framework.getService(BlobManager.class) .getBlobProvider(managedBlob.getProviderId()); if (blobProvider instanceof S3BinaryManager && blobProvider != this) { String key = copyBlob((S3BinaryManager) blobProvider, managedBlob.getKey()); if (key != null) { return key; } } } return super.writeBlob(blob); }
S3BinaryManager extends AbstractCloudBinaryManager implements S3ManagedTransfer { @Override public String writeBlob(Blob blob) throws IOException { if (blob instanceof ManagedBlob) { ManagedBlob managedBlob = (ManagedBlob) blob; BlobProvider blobProvider = Framework.getService(BlobManager.class) .getBlobProvider(managedBlob.getProviderId()); if (blobProvider instanceof S3BinaryManager && blobProvider != this) { String key = copyBlob((S3BinaryManager) blobProvider, managedBlob.getKey()); if (key != null) { return key; } } } return super.writeBlob(blob); } }
S3BinaryManager extends AbstractCloudBinaryManager implements S3ManagedTransfer { @Override public String writeBlob(Blob blob) throws IOException { if (blob instanceof ManagedBlob) { ManagedBlob managedBlob = (ManagedBlob) blob; BlobProvider blobProvider = Framework.getService(BlobManager.class) .getBlobProvider(managedBlob.getProviderId()); if (blobProvider instanceof S3BinaryManager && blobProvider != this) { String key = copyBlob((S3BinaryManager) blobProvider, managedBlob.getKey()); if (key != null) { return key; } } } return super.writeBlob(blob); }  }
S3BinaryManager extends AbstractCloudBinaryManager implements S3ManagedTransfer { @Override public String writeBlob(Blob blob) throws IOException { if (blob instanceof ManagedBlob) { ManagedBlob managedBlob = (ManagedBlob) blob; BlobProvider blobProvider = Framework.getService(BlobManager.class) .getBlobProvider(managedBlob.getProviderId()); if (blobProvider instanceof S3BinaryManager && blobProvider != this) { String key = copyBlob((S3BinaryManager) blobProvider, managedBlob.getKey()); if (key != null) { return key; } } } return super.writeBlob(blob); }  @Override void close(); @Override TransferManager getTransferManager(); @Override void removeBinaries(Collection<String> digests); @Deprecated static boolean isMD5(String digest); boolean canAccessBucket(); AWSCredentialsProvider getAwsCredentialsProvider(); AmazonS3 getAmazonS3(); String getBucketName(); String getBucketPrefix(); @Override String writeBlob(Blob blob); }
S3BinaryManager extends AbstractCloudBinaryManager implements S3ManagedTransfer { @Override public String writeBlob(Blob blob) throws IOException { if (blob instanceof ManagedBlob) { ManagedBlob managedBlob = (ManagedBlob) blob; BlobProvider blobProvider = Framework.getService(BlobManager.class) .getBlobProvider(managedBlob.getProviderId()); if (blobProvider instanceof S3BinaryManager && blobProvider != this) { String key = copyBlob((S3BinaryManager) blobProvider, managedBlob.getKey()); if (key != null) { return key; } } } return super.writeBlob(blob); }  @Override void close(); @Override TransferManager getTransferManager(); @Override void removeBinaries(Collection<String> digests); @Deprecated static boolean isMD5(String digest); boolean canAccessBucket(); AWSCredentialsProvider getAwsCredentialsProvider(); AmazonS3 getAmazonS3(); String getBucketName(); String getBucketPrefix(); @Override String writeBlob(Blob blob); static final String SYSTEM_PROPERTY_PREFIX; static final String BUCKET_NAME_PROPERTY; static final String BUCKET_PREFIX_PROPERTY; static final String BUCKET_REGION_PROPERTY; static final String AWS_ID_PROPERTY; static final String AWS_SECRET_PROPERTY; static final String AWS_SESSION_TOKEN_PROPERTY; static final String CONNECTION_MAX_PROPERTY; static final String CONNECTION_RETRY_PROPERTY; static final String CONNECTION_TIMEOUT_PROPERTY; static final String SOCKET_TIMEOUT_PROPERTY; static final String KEYSTORE_FILE_PROPERTY; static final String KEYSTORE_PASS_PROPERTY; static final String SERVERSIDE_ENCRYPTION_PROPERTY; static final String SERVERSIDE_ENCRYPTION_KMS_KEY_PROPERTY; static final String PRIVKEY_ALIAS_PROPERTY; static final String PRIVKEY_PASS_PROPERTY; static final String ENDPOINT_PROPERTY; static final String PATHSTYLEACCESS_PROPERTY; static final String ACCELERATE_MODE_PROPERTY; static final String DIRECTDOWNLOAD_PROPERTY_COMPAT; static final String DIRECTDOWNLOAD_EXPIRE_PROPERTY_COMPAT; static final String DELIMITER; }