public void endElement(String uri, String name, String qName) { if (qName.equals("ID")) { // owner stuff currentOwner = new CanonicalUser(currentText.toString().trim()); } else if (qName.equals("DisplayName")) { currentOwner.setDisplayName(currentText.toString().trim()); } else if (qName.equals("Bucket")) { buckets.add(new BucketMetadata(currentName, currentCreationDate, currentOwner)); } else if (qName.equals("Name")) { currentName = currentText.toString().trim(); } else if (qName.equals("CreationDate")) { currentCreationDate = dateParser.iso8601DateParse(currentText.toString().trim()); } currentText = new StringBuilder(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AccessControlList other = (AccessControlList) obj; if (grants == null) { if (other.grants != null) return false; } else if (!grants.equals(other.grants)) return false; if (owner == null) { if (other.owner != null) return false; } else if (!owner.equals(other.owner)) return false; return true; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((grants == null) ? 0 : grants.hashCode()); result = prime * result + ((owner == null) ? 0 : owner.hashCode()); return result; }
if (acl.getOwner() != null) { XMLBuilder ownerBuilder = rootBuilder.elem("Owner"); ownerBuilder.elem("ID").text(acl.getOwner().getId()).up(); if (acl.getOwner().getDisplayName() != null) { ownerBuilder.elem("DisplayName").text(acl.getOwner().getDisplayName()).up();
/** * Converts a canned access control policy into the equivalent access control list. * * @param cannedAP * @param ownerId */ public static AccessControlList fromCannedAccessPolicy(CannedAccessPolicy cannedAP, String ownerId) { AccessControlList acl = new AccessControlList(); acl.setOwner(new CanonicalUser(ownerId)); // Canned access policies always allow full control to the owner. acl.addPermission(new CanonicalUserGrantee(ownerId), Permission.FULL_CONTROL); if (CannedAccessPolicy.PRIVATE == cannedAP) { // No more work to do. } else if (CannedAccessPolicy.AUTHENTICATED_READ == cannedAP) { acl.addPermission(GroupGranteeURI.AUTHENTICATED_USERS, Permission.READ); } else if (CannedAccessPolicy.PUBLIC_READ == cannedAP) { acl.addPermission(GroupGranteeURI.ALL_USERS, Permission.READ); } else if (CannedAccessPolicy.PUBLIC_READ_WRITE == cannedAP) { acl.addPermission(GroupGranteeURI.ALL_USERS, Permission.READ); acl.addPermission(GroupGranteeURI.ALL_USERS, Permission.WRITE); } return acl; }
public void endElement(String uri, String name, String qName) { if (qName.equals("Owner")) { CanonicalUser owner = new CanonicalUser(currentId); owner.setDisplayName(currentDisplayName); acl.setOwner(owner); } else if (qName.equals("Grantee")) { if ("AmazonCustomerByEmail".equals(currentGranteeType)) { currentGrantee = new EmailAddressGrantee(currentId); } else if ("CanonicalUser".equals(currentGranteeType)) { currentGrantee = new CanonicalUserGrantee(currentId, currentDisplayName); } else if ("Group".equals(currentGranteeType)) { currentGrantee = new GroupGrantee(GroupGranteeURI.fromURI(currentId)); } } else if (qName.equals("Grant")) { acl.addPermission(currentGrantee, Permission.valueOf(currentPermission)); } else if (qName.equals("ID") || qName.equals("EmailAddress") || qName.equals("URI")) { currentId = currentText.toString(); } else if (qName.equals("DisplayName")) { currentDisplayName = currentText.toString(); } else if (qName.equals("Permission")) { currentPermission = currentText.toString(); } currentText = new StringBuilder(); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((owner == null) ? 0 : owner.hashCode()); return result; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BucketMetadata other = (BucketMetadata) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (owner == null) { if (other.owner != null) return false; } else if (!owner.equals(other.owner)) return false; return true; } }
public void endElement(String uri, String name, String qName) { if (qName.equals("ID")) { currentOwner = new CanonicalUser(currentText.toString().trim()); } else if (qName.equals("DisplayName")) { currentOwner.setDisplayName(currentText.toString().trim()); } else if (qName.equals("Key")) { // content stuff currentKey = currentText.toString().trim();
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((cacheControl == null) ? 0 : cacheControl.hashCode()); result = prime * result + ((contentMetadata == null) ? 0 : contentMetadata.hashCode()); result = prime * result + ((eTag == null) ? 0 : eTag.hashCode()); result = prime * result + ((key == null) ? 0 : key.hashCode()); result = prime * result + ((lastModified == null) ? 0 : lastModified.hashCode()); result = prime * result + ((owner == null) ? 0 : owner.hashCode()); result = prime * result + ((storageClass == null) ? 0 : storageClass.hashCode()); result = prime * result + ((userMetadata == null) ? 0 : userMetadata.hashCode()); return result; }
if (other.owner != null) return false; } else if (!owner.equals(other.owner)) return false; if (storageClass == null) {
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((cacheControl == null) ? 0 : cacheControl.hashCode()); result = prime * result + ((contentMetadata == null) ? 0 : contentMetadata.hashCode()); result = prime * result + ((eTag == null) ? 0 : eTag.hashCode()); result = prime * result + ((key == null) ? 0 : key.hashCode()); result = prime * result + ((lastModified == null) ? 0 : lastModified.hashCode()); result = prime * result + ((owner == null) ? 0 : owner.hashCode()); result = prime * result + ((storageClass == null) ? 0 : storageClass.hashCode()); result = prime * result + ((userMetadata == null) ? 0 : userMetadata.hashCode()); return result; }
if (other.owner != null) return false; } else if (!owner.equals(other.owner)) return false; if (storageClass == null) {
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((cacheControl == null) ? 0 : cacheControl.hashCode()); result = prime * result + ((contentMetadata == null) ? 0 : contentMetadata.hashCode()); result = prime * result + ((eTag == null) ? 0 : eTag.hashCode()); result = prime * result + ((key == null) ? 0 : key.hashCode()); result = prime * result + ((lastModified == null) ? 0 : lastModified.hashCode()); result = prime * result + ((owner == null) ? 0 : owner.hashCode()); result = prime * result + ((storageClass == null) ? 0 : storageClass.hashCode()); result = prime * result + ((userMetadata == null) ? 0 : userMetadata.hashCode()); return result; }
if (other.owner != null) return false; } else if (!owner.equals(other.owner)) return false; if (storageClass == null) {