/** * Returns an XML fragment representing the specified Grantee. * * @param grantee * The grantee to convert to an XML representation that can be * sent to Amazon S3 as part of a request. * @param xml * The XmlWriter to which to concatenate this node to. * * @return The given XmlWriter containing the specified grantee. * * @throws SdkClientException * If the specified grantee type isn't recognized. */ protected XmlWriter convertToXml(Grantee grantee, XmlWriter xml) throws SdkClientException { if (grantee instanceof CanonicalGrantee) { return convertToXml((CanonicalGrantee)grantee, xml); } else if (grantee instanceof EmailAddressGrantee) { return convertToXml((EmailAddressGrantee)grantee, xml); } else if (grantee instanceof GroupGrantee) { return convertToXml((GroupGrantee)grantee, xml); } else { throw new SdkClientException("Unknown Grantee type: " + grantee.getClass().getName()); } }
/** * Returns an XML fragment representing the specified canonical grantee. * * @param grantee * The canonical grantee to convert to an XML representation that * can be sent to Amazon S3 as part of request. * @param xml * The XmlWriter to which to concatenate this node to. * * @return The given XmlWriter containing the specified canonical grantee. */ protected XmlWriter convertToXml(CanonicalGrantee grantee, XmlWriter xml) { xml.start("Grantee", new String[] {"xmlns:xsi" , "xsi:type"}, new String[] {"http://www.w3.org/2001/XMLSchema-instance", "CanonicalUser"}); xml.start("ID").value(grantee.getIdentifier()).end(); xml.end(); return xml; }