Package org.sonatype.nexus.proxy

Examples of org.sonatype.nexus.proxy.ResourceStoreRequest


      throws Exception
  {
    // net/test/tamas/test/1.0-SNAPSHOT
    String mdPath = "/net/test/tamas/test/1.0-SNAPSHOT/maven-metadata.xml";

    StorageItem item = getRootRouter().retrieveItem(new ResourceStoreRequest("/groups/test" + mdPath, false));
    assertTrue(StorageFileItem.class.isAssignableFrom(item.getClass()));

    Metadata md = parseMetadata((StorageFileItem) item);

    assertEquals(ModelVersionUtility.Version.V110, ModelVersionUtility.getModelVersion(md));
View Full Code Here


      throws Exception
  {
    // net/test/tamas/test/2.0-SNAPSHOT
    String mdPath = "/net/test/tamas/test/2.0-SNAPSHOT/maven-metadata.xml";

    StorageItem item = getRootRouter().retrieveItem(new ResourceStoreRequest("/groups/test" + mdPath, false));
    assertTrue(StorageFileItem.class.isAssignableFrom(item.getClass()));

    Metadata md = parseMetadata((StorageFileItem) item);

    assertEquals(ModelVersionUtility.Version.V110, ModelVersionUtility.getModelVersion(md));
View Full Code Here

  }

  protected void doTestAllowed(final ProxyRequestFilterImpl filter, final String path,
                               final boolean shouldBeAllowed)
  {
    final ResourceStoreRequest resourceStoreRequest = new ResourceStoreRequest(path);
    assertThat(String.format("%s path is expected to return %s", path, shouldBeAllowed),
        filter.allowed(mavenProxyRepository, resourceStoreRequest), is(shouldBeAllowed));
  }
View Full Code Here

        request.getAttributes().get(AbstractRepositoryPlexusResource.REPOSITORY_ID_KEY).toString());
  }

  @Override
  protected ResourceStoreRequest getResourceStoreRequest(Request request, String resourceStorePath) {
    ResourceStoreRequest resourceStoreRequest = super.getResourceStoreRequest(request, resourceStorePath);

    // welcome files should not be used with this resource.
    resourceStoreRequest.getRequestContext().put(USE_WELCOME_FILES, Boolean.FALSE);

    return resourceStoreRequest;
  }
View Full Code Here

      try {
        log.debug("Removing obsolete metadata files... ({}:{} cached)", repository.getId(), item.getPath());
        RepoMD repoMD = new RepoMD(((StorageFileItem) item).getInputStream());
        final Collection<String> locations = repoMD.getLocations();
        ResourceStoreRequest request = new ResourceStoreRequest("/" + Yum.PATH_OF_REPODATA);
        request.getRequestContext().put(AccessManager.REQUEST_AUTHORIZED, Boolean.TRUE);
        DefaultWalkerContext context = new DefaultWalkerContext(repository, request);
        context.getProcessors().add(new AbstractFileWalkerProcessor()
        {
          @Override
          protected void processFileItem(final WalkerContext context, final StorageFileItem item) throws Exception {
View Full Code Here

    if (repository.getLocalUrl() != null
        && repository.getLocalStorage() instanceof DefaultFSLocalRepositoryStorage) {
      try {
        File baseDir =
            ((DefaultFSLocalRepositoryStorage) repository.getLocalStorage()).getBaseDir(repository,
                new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT));

        return baseDir;
      }
      catch (LocalStorageException e) {
        log.warn(String.format("Cannot determine \"%s\" (ID=%s) repository's basedir:",
View Full Code Here

      // if we have a valid indexing context and have access to a File
      if (DefaultFSLocalRepositoryStorage.class.isAssignableFrom(repository.getLocalStorage().getClass())) {
        File file =
            ((DefaultFSLocalRepositoryStorage) repository.getLocalStorage()).getFileFromBase(repository,
                new ResourceStoreRequest(item));

        if (file.exists()) {
          try {
            ac = artifactContextProducer.getArtifactContext(context, file);
          }
View Full Code Here

    log.info(RepositoryStringUtils.getFormattedMessage("Trying to get remote index for repository %s",
        repository));

    // this will force remote check for newer files
    repository.expireCaches(new ResourceStoreRequest(PUBLISHING_PATH_PREFIX));

    IndexUpdateRequest updateRequest = new IndexUpdateRequest(context, new ResourceFetcher()
    {
      public void connect(String id, String url)
          throws IOException
      {
      }

      public void disconnect()
          throws IOException
      {
      }

      public InputStream retrieve(String name)
          throws IOException
      {
        TaskUtil.checkInterruption();

        ResourceStoreRequest req = new ResourceStoreRequest(PUBLISHING_PATH_PREFIX + "/" + name);

        try {
          StorageFileItem item = null;

          // XXX: ensure it goes to remote only and throws FileNotFoundException if nothing found on remote
View Full Code Here

    }
  }

  @SuppressWarnings("deprecation")
  protected void deleteIndexItems(Repository repository) {
    ResourceStoreRequest request = new ResourceStoreRequest(PUBLISHING_PATH_PREFIX);

    try {
      repository.deleteItem(false, request);
    }
    catch (ItemNotFoundException e) {
View Full Code Here

  protected void storeIndexItem(Repository repository, File file, IndexingContext context) {
    String path = PUBLISHING_PATH_PREFIX + "/" + file.getName();

    try {
      ResourceStoreRequest request = new ResourceStoreRequest(path);
      DefaultStorageFileItem fItem =
          new DefaultStorageFileItem(repository, request, true, true, new FileContentLocator(file,
              mimeSupport.guessMimeTypeFromPath(repository.getMimeRulesSource(), file.getAbsolutePath())));

      if (context.getTimestamp() == null) {
View Full Code Here

TOP

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

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.