if (grantee instanceof Group) {
GroupGrantee jets3tGrantee = new GroupGrantee();
jets3tGrantee.setIdentifier(((Group)grantee).getURI());
acl.grantPermission(jets3tGrantee, permission);
} else if (grantee instanceof CanonicalUser) {
CanonicalUser canonicalUser = (CanonicalUser) grantee;
CanonicalGrantee jets3tGrantee = new CanonicalGrantee();
jets3tGrantee.setIdentifier(canonicalUser.getID());
jets3tGrantee.setDisplayName(canonicalUser.getDisplayName());
acl.grantPermission(jets3tGrantee, permission);
} else if (grantee instanceof AmazonCustomerByEmail) {
AmazonCustomerByEmail customerByEmail = (AmazonCustomerByEmail) grantee;
EmailAddressGrantee jets3tGrantee = new EmailAddressGrantee();
jets3tGrantee.setIdentifier(customerByEmail.getEmailAddress());