Package org.sonatype.nexus.proxy

Examples of org.sonatype.nexus.proxy.LocalStorageException


    try {
      try {
        storeItem(request, is, userAttributes);
      }
      catch (IOException e) {
        throw new LocalStorageException("Could not get the content from the ContentLocator!", e);
      }

      StorageFileItem storedFile = (StorageFileItem) retrieveItem(false, request);

      String sha1Hash = storedFile.getRepositoryItemAttributes().get(DigestCalculatingInspector.DIGEST_SHA1_KEY);

      String md5Hash = storedFile.getRepositoryItemAttributes().get(DigestCalculatingInspector.DIGEST_MD5_KEY);

      if (!StringUtils.isEmpty(sha1Hash)) {
        request.setRequestPath(storedFile.getPath() + ".sha1");

        storeItem(false, new DefaultStorageFileItem(this, request, true, true, new StringContentLocator(
            sha1Hash)));
      }

      if (!StringUtils.isEmpty(md5Hash)) {
        request.setRequestPath(storedFile.getPath() + ".md5");

        storeItem(false, new DefaultStorageFileItem(this, request, true, true, new StringContentLocator(
            md5Hash)));
      }
    }
    catch (ItemNotFoundException e) {
      throw new LocalStorageException("Storage inconsistency!", e);
    }
    finally {
      request.setRequestPath(originalPath);
    }
  }
View Full Code Here


    try {
      try {
        storeItem(fromTask, item);
      }
      catch (IOException e) {
        throw new LocalStorageException("Could not get the content from the ContentLocator!", e);
      }

      StorageFileItem storedFile = (StorageFileItem) retrieveItem(fromTask, new ResourceStoreRequest(item));

      ResourceStoreRequest req = new ResourceStoreRequest(storedFile);

      String sha1Hash = storedFile.getRepositoryItemAttributes().get(DigestCalculatingInspector.DIGEST_SHA1_KEY);

      String md5Hash = storedFile.getRepositoryItemAttributes().get(DigestCalculatingInspector.DIGEST_MD5_KEY);

      if (!StringUtils.isEmpty(sha1Hash)) {
        req.setRequestPath(item.getPath() + ".sha1");

        storeItem(fromTask, new DefaultStorageFileItem(this, req, true, true, new StringContentLocator(
            sha1Hash)));
      }

      if (!StringUtils.isEmpty(md5Hash)) {
        req.setRequestPath(item.getPath() + ".md5");

        storeItem(fromTask, new DefaultStorageFileItem(this, req, true, true, new StringContentLocator(
            md5Hash)));
      }
    }
    catch (ItemNotFoundException e) {
      throw new LocalStorageException("Storage inconsistency!", e);
    }
  }
View Full Code Here

          try {
            file.setContentLocator(generator.generateContent(this, uid.getPath(), file));
          }
          catch (Exception e) {
            throw new LocalStorageException("Could not generate content:", e);
          }
        }
        else {
          log.info(
              String.format(
View Full Code Here

          // remove the "to" item from n-cache if there
          removeFromNotFoundCache(to);
        }
        catch (IOException e) {
          throw new LocalStorageException("Could not get the content of source file (is it file?)!", e);
        }
      }
    }
    finally {
      toUidLock.unlock();
View Full Code Here

    catch (ItemNotFoundException e) {
      // silent
    }
    catch (UnsupportedStorageOperationException e) {
      // yell
      throw new LocalStorageException("Delete operation is unsupported!", e);
    }
  }
View Full Code Here

    catch (ItemNotFoundException e) {
      // silent
    }
    catch (UnsupportedStorageOperationException e) {
      // yell
      throw new LocalStorageException("Undelete operation is unsupported!", e);
    }

    return false;
  }
View Full Code Here

        }

      }
    }
    catch (MetadataException e) {
      throw new LocalStorageException("Not able to apply changes!", e);
    }
  }
View Full Code Here

    }
    catch (LocalStorageException e) {
      throw e;
    }
    catch (IOException e) {
      throw new LocalStorageException("Could not update context", e);
    }
  }
View Full Code Here

    catch (MalformedURLException e) {
      try {
        return new File(urlStr.toString()).toURI().toURL();
      }
      catch (MalformedURLException e1) {
        throw new LocalStorageException("The local storage has a malformed URL as baseUrl!", e);
      }
    }
  }
View Full Code Here

              StorageFileItem.DIGEST_MD5_KEY, item.getItemContext());

      item.setContentLocator(md5cl);
    }
    catch (NoSuchAlgorithmException e) {
      throw new LocalStorageException(
          "The JVM does not support SHA1 MessageDigest or MD5 MessageDigest, that is essential for Nexus. We cannot write to local storage! Please run Nexus on JVM that does provide these MessageDigests.",
          e);
    }
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.LocalStorageException

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.