List of usage examples for com.amazonaws.services.s3.model TagSet TagSet
public TagSet(Map<String, String> tags)
Creates a new TagSet with the set of tags defined.
From source file:org.duracloud.s3storage.S3StorageProvider.java
License:Apache License
/** * {@inheritDoc}/*from w ww . j a v a2s. co m*/ */ protected void doSetSpaceProperties(String spaceId, Map<String, String> spaceProperties) { log.debug("setSpaceProperties(" + spaceId + ")"); // Will throw if bucket does not exist String bucketName = getBucketName(spaceId); Map<String, String> originalProperties; try { originalProperties = getAllSpaceProperties(spaceId); } catch (NotFoundException e) { // Likely adding a new space, so no existing properties yet. originalProperties = new HashMap<>(); } // Set creation date String creationDate = originalProperties.get(PROPERTIES_SPACE_CREATED); if (creationDate == null) { creationDate = spaceProperties.get(PROPERTIES_SPACE_CREATED); if (creationDate == null) { creationDate = getBucketCreationDate(bucketName); } } spaceProperties.put(PROPERTIES_SPACE_CREATED, creationDate); // Handle @ symbol (change to +), to allow for email usernames in ACLs spaceProperties = replaceInMapValues(spaceProperties, "@", "+"); // Store properties BucketTaggingConfiguration tagConfig = new BucketTaggingConfiguration() .withTagSets(new TagSet(spaceProperties)); s3Client.setBucketTaggingConfiguration(bucketName, tagConfig); }