public String toString() { return "S3Owner [name=" + getDisplayName() + ",id=" + getId() + "]"; }
@Override public boolean equals(Object obj) { if (!(obj instanceof Owner)) { return false; } Owner otherOwner = (Owner)obj; String otherOwnerId = otherOwner.getId(); String otherOwnerName = otherOwner.getDisplayName(); String thisOwnerId = this.getId(); String thisOwnerName = this.getDisplayName(); if (otherOwnerId == null) otherOwnerId = ""; if (otherOwnerName == null) otherOwnerName = ""; if (thisOwnerId == null) thisOwnerId = ""; if (thisOwnerName == null) thisOwnerName = ""; return (otherOwnerId.equals(thisOwnerId) && otherOwnerName.equals(thisOwnerName)); }
/** * Since there is no group in S3 acl, the owner is reused as the group. This method calls the * S3 API and requires additional permissions aside from just read only. This method is best * effort and will continue with default permissions (no owner, no group, 0700). * * @return the permissions associated with this under storage system */ private ObjectPermissions getPermissionsInternal() { short bucketMode = DEFAULT_MODE; String accountOwner = DEFAULT_OWNER; // if ACL enabled try to inherit bucket acl for all the objects. if (Boolean.parseBoolean(mConf.get(PropertyKey.UNDERFS_S3A_INHERIT_ACL))) { try { Owner owner = mClient.getS3AccountOwner(); AccessControlList acl = mClient.getBucketAcl(mBucketName); bucketMode = S3AUtils.translateBucketAcl(acl, owner.getId()); if (mConf.isSet(PropertyKey.UNDERFS_GCS_OWNER_ID_TO_USERNAME_MAPPING)) { accountOwner = CommonUtils.getValueFromStaticMapping( mConf.get(PropertyKey.UNDERFS_S3_OWNER_ID_TO_USERNAME_MAPPING), owner.getId()); } else { // If there is no user-defined mapping, use display name or id. accountOwner = owner.getDisplayName() != null ? owner.getDisplayName() : owner.getId(); } } catch (AmazonClientException e) { LOG.warn("Failed to inherit bucket ACLs, proceeding with defaults. {}", e.getMessage()); } } return new ObjectPermissions(accountOwner, accountOwner, bucketMode); }
xml.start("ID").value(owner.getId()).end(); if (owner.getDisplayName() != null) { xml.start("DisplayName").value(owner.getDisplayName()).end();
@Override public String toString() { return "S3Owner [name=" + getDisplayName() + ",id=" + getId() + "]"; }
@Override public boolean equals(Object obj) { if (!(obj instanceof Owner)) { return false; } Owner otherOwner = (Owner) obj; String otherOwnerId = otherOwner.getId(); String otherOwnerName = otherOwner.getDisplayName(); String thisOwnerId = this.getId(); String thisOwnerName = this.getDisplayName(); if (otherOwnerId == null) otherOwnerId = ""; if (otherOwnerName == null) otherOwnerName = ""; if (thisOwnerId == null) thisOwnerId = ""; if (thisOwnerName == null) thisOwnerName = ""; return (otherOwnerId.equals(thisOwnerId) && otherOwnerName.equals(thisOwnerName)); }
public String toString() { return "S3Owner [name=" + getDisplayName() + ",id=" + getId() + "]"; }
@Override public String toString() { return "S3Owner [name=" + getDisplayName() + ",id=" + getId() + "]"; }
xml.start("ID").value(owner.getId()).end(); if (owner.getDisplayName() != null) { xml.start("DisplayName").value(owner.getDisplayName()).end();
@Override public boolean equals(Object obj) { if (!(obj instanceof Owner)) { return false; } Owner otherOwner = (Owner) obj; String otherOwnerId = otherOwner.getId(); String otherOwnerName = otherOwner.getDisplayName(); String thisOwnerId = this.getId(); String thisOwnerName = this.getDisplayName(); if (otherOwnerId == null) otherOwnerId = ""; if (otherOwnerName == null) otherOwnerName = ""; if (thisOwnerId == null) thisOwnerId = ""; if (thisOwnerName == null) thisOwnerName = ""; return (otherOwnerId.equals(thisOwnerId) && otherOwnerName.equals(thisOwnerName)); }
@Override public boolean equals(Object obj) { if (!(obj instanceof Owner)) { return false; } Owner otherOwner = (Owner)obj; String otherOwnerId = otherOwner.getId(); String otherOwnerName = otherOwner.getDisplayName(); String thisOwnerId = this.getId(); String thisOwnerName = this.getDisplayName(); if (otherOwnerId == null) otherOwnerId = ""; if (otherOwnerName == null) otherOwnerName = ""; if (thisOwnerId == null) thisOwnerId = ""; if (thisOwnerName == null) thisOwnerName = ""; return (otherOwnerId.equals(thisOwnerId) && otherOwnerName.equals(thisOwnerName)); }
final Owner owner = this.s3Client.getS3AccountOwner(); LOG.info("Successfully established connection to Amazon S3 using the endpoint " + endpoint); LOG.info("Amazon S3 user is " + owner.getDisplayName());
final Owner owner = this.s3Client.getS3AccountOwner(); LOG.info("Successfully established connection to Amazon S3 using the endpoint " + endpoint); LOG.info("Amazon S3 user is " + owner.getDisplayName());
@SuppressWarnings("unchecked") @Override public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) { if (type != S3FileStoreAttributeView.class) throw new IllegalArgumentException("FileStoreAttributeView of type '" + type.getName() + "' is not supported."); Bucket buck = getBucket(); Owner owner = buck.getOwner(); return (V) new S3FileStoreAttributeView(buck.getCreationDate(), buck.getName(), owner.getId(), owner.getDisplayName()); }
public static Owner copyOf(com.amazonaws.services.s3.model.Owner owner) { return builder().withName(owner.getDisplayName()).withId(owner.getId()).build(); }
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, getBucketName()); Text.writeString(out, getKey()); Text.writeString(out, getETag()); Text.writeString(out, getStorageClass()); Text.writeString(out, getOwner().getId()); Text.writeString(out, getOwner().getDisplayName()); out.writeLong(getSize()); out.writeLong(getLastModified().getTime()); }
xml.start("ID").value(owner.getId()).end(); if (owner.getDisplayName() != null) { xml.start("DisplayName").value(owner.getDisplayName()).end();
xml.start("ID").value(owner.getId()).end(); if (owner.getDisplayName() != null) { xml.start("DisplayName").value(owner.getDisplayName()).end();
/** * get the S3PosixFileAttributes for a S3Path * @param s3Path Path mandatory not null * @return S3PosixFileAttributes never null * @throws NoSuchFileException if the Path doesnt exists */ public S3PosixFileAttributes getS3PosixFileAttributes(S3Path s3Path) throws NoSuchFileException { S3ObjectSummary objectSummary = getS3ObjectSummary(s3Path); String key = s3Path.getKey(); String bucketName = s3Path.getFileStore().name(); S3BasicFileAttributes attrs = toS3FileAttributes(objectSummary, key); S3UserPrincipal userPrincipal = null; Set<PosixFilePermission> permissions = null; if (!attrs.isDirectory()) { AmazonS3 client = s3Path.getFileSystem().getClient(); AccessControlList acl = client.getObjectAcl(bucketName, key); Owner owner = acl.getOwner(); userPrincipal = new S3UserPrincipal(owner.getId() + ":" + owner.getDisplayName()); permissions = toPosixFilePermissions(acl.getGrantsAsList()); } return new S3PosixFileAttributes((String)attrs.fileKey(), attrs.lastModifiedTime(), attrs.size(), attrs.isDirectory(), attrs.isRegularFile(), userPrincipal, null, permissions); }