Package org.sonatype.nexus.proxy.item

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


              {
                // Packages.gz
                  DefaultStorageFileItem file =
                          new DynamicStorageFileItem( repository,
                              new ResourceStoreRequest( entry.getKey() ), true, false,
                                  new StringContentLocator( entry.getValue() ) );
                  file.setContentGeneratorId( entry.getValue() );
                  repository.storeItem( false, file );
              }
            }
            catch ( RepositoryNotAvailableException e )
View Full Code Here


      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);
View Full Code Here

      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

  @Override
  public void store(String content, String path)
      throws IOException
  {
    ContentLocator contentLocator = new StringContentLocator(content);

    putStorageItem(path, contentLocator);
  }
View Full Code Here

    // a "release"
    repository.setRepositoryPolicy(RepositoryPolicy.RELEASE);
    repository.getCurrentCoreConfiguration().commitChanges();

    DefaultStorageFileItem item = new DefaultStorageFileItem(
        repository, new ResourceStoreRequest(SPOOF_RELEASE), true, true, new StringContentLocator(SPOOF_RELEASE)
    );

    repository.storeItem(false, item);

    try {
      item = new DefaultStorageFileItem(
          repository, new ResourceStoreRequest(SPOOF_SNAPSHOT), true, true, new StringContentLocator(SPOOF_SNAPSHOT)
      );

      repository.storeItem(false, item);

      assertThat("Should not be able to store snapshot to release repo", false);
    }
    catch (UnsupportedStorageOperationException e) {
      // good
    }

    // reset NFC
    repository.expireCaches(new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT, true));

    // a "snapshot"
    repository.setRepositoryPolicy(RepositoryPolicy.SNAPSHOT);
    repository.getCurrentCoreConfiguration().commitChanges();

    item = new DefaultStorageFileItem(
        repository, new ResourceStoreRequest(SPOOF_SNAPSHOT), true, true, new StringContentLocator(SPOOF_SNAPSHOT)
    );

    repository.storeItem(false, item);

    try {
      item = new DefaultStorageFileItem(
          repository, new ResourceStoreRequest(SPOOF_RELEASE), true, true, new StringContentLocator(SPOOF_RELEASE)
      );

      repository.storeItem(false, item);

      assertThat("Should not be able to store release to snapshot repo", false);
View Full Code Here

    String md5str = "01234567012345670123456701234567";

    StorageItem item = repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt"));

    repository.storeItem(false, new DefaultStorageFileItem(
        repository, new ResourceStoreRequest(item.getPath() + ".sha1"), true, true, new StringContentLocator(sha1str))
    );
    repository.storeItem(false, new DefaultStorageFileItem(
        repository, new ResourceStoreRequest(item.getPath() + ".md5"), true, true, new StringContentLocator(md5str))
    );

    // reread the item to refresh attributes map
    item = repository.retrieveItem(new ResourceStoreRequest("/spoof/simple.txt"));
View Full Code Here

    outputStream.close();

    DefaultStorageFileItem file =
        new DefaultStorageFileItem(uid.getRepository(), new ResourceStoreRequest(uid.getPath()), true, true,
            new StringContentLocator(mdString));

    ((MavenRepository) uid.getRepository()).storeItemWithChecksums(false, file);
  }
View Full Code Here

  }

  public static DefaultStorageFileItem newHashItem(ProxyRepository proxy, ResourceStoreRequest request,
                                                   StorageItem artifact, String hash)
  {
    StringContentLocator content = new StringContentLocator(hash);
    // XXX do we need to clone request here?
    DefaultStorageFileItem hashItem =
        new DefaultStorageFileItem(proxy, request, true /* canRead */, false/* canWrite */, content);
    hashItem.setModified(artifact.getModified());
    return hashItem;
View Full Code Here

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

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

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

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

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

        getMavenRepository().storeItem(
            false,
            new DefaultStorageFileItem(getMavenRepository(), req, true, true, new StringContentLocator(
                sha1Hash)));
      }

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

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

TOP

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

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.