Refine search
/** * Returns an XML fragment representing the specified email address grantee. * * @param grantee * The email address 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 email address grantee */ protected XmlWriter convertToXml(EmailAddressGrantee grantee, XmlWriter xml) { xml.start("Grantee", new String[] {"xmlns:xsi" , "xsi:type"}, new String[] {"http://www.w3.org/2001/XMLSchema-instance", "AmazonCustomerByEmail"}); xml.start("EmailAddress").value(grantee.getIdentifier()).end(); xml.end(); return xml; }
private static void addTaggingIfNotNull(XmlWriter xml, ObjectTagging tagSet) { if (tagSet == null) { return; } xml.start("Tagging"); xml.start("TagSet"); for(Tag tag : tagSet.getTagSet()) { xml.start("Tag"); xml.start("Key").value(tag.getKey()).end(); xml.start("Value").value(tag.getValue()).end(); xml.end(); } xml.end(); xml.end(); }
/** * 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; }
/** * Returns an XML fragment representing the specified group grantee. * * @param grantee * The group 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 group grantee. */ protected XmlWriter convertToXml(GroupGrantee grantee, XmlWriter xml) { xml.start("Grantee", new String[] {"xmlns:xsi" , "xsi:type"}, new String[] {"http://www.w3.org/2001/XMLSchema-instance", "Group"}); xml.start("URI").value(grantee.getIdentifier()).end(); xml.end(); return xml; }
public byte[] convertToXmlByteArray(ObjectTagging tagging) { XmlWriter writer = new XmlWriter(); writer.start("Tagging").start("TagSet"); for (Tag tag : tagging.getTagSet()) { writer.start("Tag"); writer.start("Key").value(tag.getKey()).end(); writer.start("Value").value(tag.getValue()).end(); writer.end(); // </Tag> } writer.end(); // </TagSet> writer.end(); // </Tagging> return writer.getBytes(); } }
private static void writeDefaultRetention(XmlWriter writer, DefaultRetention retention) { if (retention == null) { return; } writer.start("DefaultRetention"); addIfNotNull(writer, "Mode", retention.getMode()); Integer days = retention.getDays(); if (days != null) { writer.start("Days").value(Integer.toString(days)).end(); } Integer years = retention.getYears(); if (years != null) { writer.start("Years").value(Integer.toString(years)).end(); } writer.end(); } }
/** * Converts the specified versioning configuration into an XML byte array. * * @param versioningConfiguration * The configuration to convert. * * @return The XML byte array representation. */ public byte[] convertToXmlByteArray(BucketVersioningConfiguration versioningConfiguration) { XmlWriter xml = new XmlWriter(); xml.start("VersioningConfiguration", "xmlns", Constants.XML_NAMESPACE); xml.start("Status").value(versioningConfiguration.getStatus()).end(); Boolean mfaDeleteEnabled = versioningConfiguration.isMfaDeleteEnabled(); if (mfaDeleteEnabled != null) { if (mfaDeleteEnabled) { xml.start("MfaDelete").value("Enabled").end(); } else { xml.start("MfaDelete").value("Disabled").end(); } } xml.end(); return xml.getBytes(); }
private void addNoncurrentTransitions(XmlWriter xml, List<NoncurrentVersionTransition> transitions) { if (transitions == null || transitions.isEmpty()) { return; } for (NoncurrentVersionTransition t : transitions) { if (t != null) { xml.start("NoncurrentVersionTransition"); if (t.getDays() != -1) { xml.start("NoncurrentDays"); xml.value(Integer.toString(t.getDays())); xml.end(); } xml.start("StorageClass"); xml.value(t.getStorageClass().toString()); xml.end(); // </StorageClass> xml.end(); // </NoncurrentVersionTransition> } } }
/** * Converts the specified accelerate configuration into an XML byte array. * * @param accelerateConfiguration * The configuration to convert. * * @return The XML byte array representation. */ public byte[] convertToXmlByteArray(BucketAccelerateConfiguration accelerateConfiguration) { XmlWriter xml = new XmlWriter(); xml.start("AccelerateConfiguration", "xmlns", Constants.XML_NAMESPACE); xml.start("Status").value(accelerateConfiguration.getStatus()).end(); xml.end(); return xml.getBytes(); }