@Test public void testReadVersioned() throws Exception { final Path container = new Path("versioning-test-us-east-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path test = new S3TouchFeature(session).touch(new Path(container, new AsciiRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); assertTrue(new DefaultFindFeature(session).find(test)); try { new S3AccessControlListFeature(session).getPermission(test); } catch(NotfoundException e) { fail(); } new S3DefaultDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public Acl getPermission(final Path file) throws BackgroundException { try { if(file.getType().contains(Path.Type.upload)) { return Acl.EMPTY; } if(containerService.isContainer(file)) { return this.convert(session.getClient().getBucketAcl(containerService.getContainer(file).getName())); } else if(file.isFile() || file.isPlaceholder()) { return this.convert(session.getClient().getVersionedObjectAcl(file.attributes().getVersionId(), containerService.getContainer(file).getName(), containerService.getKey(file))); } return Acl.EMPTY; } catch(ServiceException e) { final BackgroundException failure = new S3ExceptionMappingService().map("Failure to read attributes of {0}", e, file); if(file.isPlaceholder()) { if(failure instanceof NotfoundException) { return Acl.EMPTY; } } if(failure instanceof InteroperabilityException) { return Acl.EMPTY; } throw failure; } }
S3AccessControlListFeature extends DefaultAclFeature implements AclPermission { @Override public Acl getPermission(final Path file) throws BackgroundException { try { if(file.getType().contains(Path.Type.upload)) { return Acl.EMPTY; } if(containerService.isContainer(file)) { return this.convert(session.getClient().getBucketAcl(containerService.getContainer(file).getName())); } else if(file.isFile() || file.isPlaceholder()) { return this.convert(session.getClient().getVersionedObjectAcl(file.attributes().getVersionId(), containerService.getContainer(file).getName(), containerService.getKey(file))); } return Acl.EMPTY; } catch(ServiceException e) { final BackgroundException failure = new S3ExceptionMappingService().map("Failure to read attributes of {0}", e, file); if(file.isPlaceholder()) { if(failure instanceof NotfoundException) { return Acl.EMPTY; } } if(failure instanceof InteroperabilityException) { return Acl.EMPTY; } throw failure; } } }
S3AccessControlListFeature extends DefaultAclFeature implements AclPermission { @Override public Acl getPermission(final Path file) throws BackgroundException { try { if(file.getType().contains(Path.Type.upload)) { return Acl.EMPTY; } if(containerService.isContainer(file)) { return this.convert(session.getClient().getBucketAcl(containerService.getContainer(file).getName())); } else if(file.isFile() || file.isPlaceholder()) { return this.convert(session.getClient().getVersionedObjectAcl(file.attributes().getVersionId(), containerService.getContainer(file).getName(), containerService.getKey(file))); } return Acl.EMPTY; } catch(ServiceException e) { final BackgroundException failure = new S3ExceptionMappingService().map("Failure to read attributes of {0}", e, file); if(file.isPlaceholder()) { if(failure instanceof NotfoundException) { return Acl.EMPTY; } } if(failure instanceof InteroperabilityException) { return Acl.EMPTY; } throw failure; } } S3AccessControlListFeature(final S3Session session); }
S3AccessControlListFeature extends DefaultAclFeature implements AclPermission { @Override public Acl getPermission(final Path file) throws BackgroundException { try { if(file.getType().contains(Path.Type.upload)) { return Acl.EMPTY; } if(containerService.isContainer(file)) { return this.convert(session.getClient().getBucketAcl(containerService.getContainer(file).getName())); } else if(file.isFile() || file.isPlaceholder()) { return this.convert(session.getClient().getVersionedObjectAcl(file.attributes().getVersionId(), containerService.getContainer(file).getName(), containerService.getKey(file))); } return Acl.EMPTY; } catch(ServiceException e) { final BackgroundException failure = new S3ExceptionMappingService().map("Failure to read attributes of {0}", e, file); if(file.isPlaceholder()) { if(failure instanceof NotfoundException) { return Acl.EMPTY; } } if(failure instanceof InteroperabilityException) { return Acl.EMPTY; } throw failure; } } S3AccessControlListFeature(final S3Session session); @Override Acl getPermission(final Path file); @Override void setPermission(final Path file, final Acl acl); @Override List<Acl.Role> getAvailableAclRoles(final List<Path> files); @Override List<Acl.User> getAvailableAclUsers(); }
S3AccessControlListFeature extends DefaultAclFeature implements AclPermission { @Override public Acl getPermission(final Path file) throws BackgroundException { try { if(file.getType().contains(Path.Type.upload)) { return Acl.EMPTY; } if(containerService.isContainer(file)) { return this.convert(session.getClient().getBucketAcl(containerService.getContainer(file).getName())); } else if(file.isFile() || file.isPlaceholder()) { return this.convert(session.getClient().getVersionedObjectAcl(file.attributes().getVersionId(), containerService.getContainer(file).getName(), containerService.getKey(file))); } return Acl.EMPTY; } catch(ServiceException e) { final BackgroundException failure = new S3ExceptionMappingService().map("Failure to read attributes of {0}", e, file); if(file.isPlaceholder()) { if(failure instanceof NotfoundException) { return Acl.EMPTY; } } if(failure instanceof InteroperabilityException) { return Acl.EMPTY; } throw failure; } } S3AccessControlListFeature(final S3Session session); @Override Acl getPermission(final Path file); @Override void setPermission(final Path file, final Acl acl); @Override List<Acl.Role> getAvailableAclRoles(final List<Path> files); @Override List<Acl.User> getAvailableAclUsers();  }