Package org.sonatype.nexus.proxy.item

Examples of org.sonatype.nexus.proxy.item.ChecksummingContentLocator


  protected void prepareStorageFileItemForStore(final StorageFileItem item)
      throws LocalStorageException
  {
    try {
      // replace content locator
      ChecksummingContentLocator sha1cl =
          new ChecksummingContentLocator(item.getContentLocator(), MessageDigest.getInstance("SHA1"),
              StorageFileItem.DIGEST_SHA1_KEY, item.getItemContext());

      // md5 is deprecated but still calculated
      ChecksummingContentLocator md5cl =
          new ChecksummingContentLocator(sha1cl, MessageDigest.getInstance("MD5"),
              StorageFileItem.DIGEST_MD5_KEY, item.getItemContext());

      item.setContentLocator(md5cl);
    }
    catch (NoSuchAlgorithmException e) {
View Full Code Here


  public void processStorageItem(final StorageItem item)
      throws Exception
  {
    if (item instanceof StorageFileItem) {
      final StorageFileItem file = (StorageFileItem) item;
      final ChecksummingContentLocator sha1cl =
          new ChecksummingContentLocator(file.getContentLocator(), MessageDigest.getInstance("SHA1"),
              StorageFileItem.DIGEST_SHA1_KEY, item.getItemContext());
      // md5 is deprecated but still calculated
      ChecksummingContentLocator md5cl =
          new ChecksummingContentLocator(sha1cl, MessageDigest.getInstance("MD5"),
              StorageFileItem.DIGEST_MD5_KEY, item.getItemContext());
      try (final InputStream is = md5cl.getContent()) {
        StreamSupport.copy(is, nullOutputStream(), StreamSupport.BUFFER_SIZE);
      }
      // we made sure that above operations will make values into context
      maybeGetFromContext(item);
    }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.item.ChecksummingContentLocator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.