com.amazonaws.services.s3.model.lifecycle.LifecycleFilterPredicate Java Examples

The following examples show how to use com.amazonaws.services.s3.model.lifecycle.LifecycleFilterPredicate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: S3BlobStore.java    From nexus-blobstore-s3 with Eclipse Public License 1.0 5 votes vote down vote up
boolean isExpirationLifecycleConfigurationPresent(BucketLifecycleConfiguration lifecycleConfiguration) {
  return lifecycleConfiguration != null &&
      lifecycleConfiguration.getRules() != null &&
      lifecycleConfiguration.getRules().stream()
      .filter(r -> r.getExpirationInDays() == getConfiguredExpirationInDays())
      .filter(r -> {
        LifecycleFilterPredicate predicate = r.getFilter().getPredicate();
        if (predicate instanceof LifecycleTagPredicate) {
          LifecycleTagPredicate tagPredicate = (LifecycleTagPredicate) predicate;
          return DELETED_TAG.equals(tagPredicate.getTag());
        }
        return false;
      })
      .findAny().isPresent();
}
 
Example #2
Source File: BucketManager.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private boolean isDeletedTagPredicate(final LifecycleFilterPredicate filterPredicate, final String bucketPrefix) {
  if (filterPredicate instanceof LifecycleTagPredicate) {
    LifecycleTagPredicate tagPredicate = (LifecycleTagPredicate) filterPredicate;
    return S3BlobStore.DELETED_TAG.equals(tagPredicate.getTag());
  }
  else if (filterPredicate instanceof LifecycleAndOperator) {
    LifecycleAndOperator andOperator = (LifecycleAndOperator) filterPredicate;
    return
        andOperator.getOperands().stream().anyMatch(op -> isDeletedTagPredicate(op, bucketPrefix)) &&
        andOperator.getOperands().stream().anyMatch(op -> isBucketPrefixPredicate(op, bucketPrefix));
  }
  else {
    return false;
  }
}
 
Example #3
Source File: BucketManager.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private boolean isBucketPrefixPredicate(final LifecycleFilterPredicate filterPredicate, final String bucketPrefix) {
  if (filterPredicate instanceof LifecyclePrefixPredicate) {
    LifecyclePrefixPredicate prefixPredicate = (LifecyclePrefixPredicate) filterPredicate;
    return prefixPredicate.getPrefix().equals(bucketPrefix);
  }
  else {
    return false;
  }
}
 
Example #4
Source File: XmlResponsesSaxParser.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected void doStartElement(
    String uri,
    String name,
    String qName,
    Attributes attrs) {

    if (in("LifecycleConfiguration")) {
        if (name.equals("Rule")) {
            currentRule = new Rule();
        }
    } else if (in("LifecycleConfiguration", "Rule")) {
        if (name.equals("Transition")) {
            currentTransition = new Transition();
        } else if (name.equals("NoncurrentVersionTransition")) {
            currentNcvTransition = new NoncurrentVersionTransition();
        } else if (name.equals("AbortIncompleteMultipartUpload")) {
            abortIncompleteMultipartUpload = new
                AbortIncompleteMultipartUpload();
        } else if (name.equals("Filter")) {
            currentFilter = new LifecycleFilter();
        }
    } else if (in("LifecycleConfiguration", "Rule", "Filter")) {
        if (name.equals("And")) {
            andOperandsList = new ArrayList<LifecycleFilterPredicate>();
        }
    }
}