Package org.sonatype.nexus.proxy

Examples of org.sonatype.nexus.proxy.ItemNotFoundException


        }
      }

      // if no prefix matched, Item not found
      if (repositories == null || repositories.isEmpty()) {
        throw new ItemNotFoundException(reasonFor(request,
            "No repositories found for given %s prefix!", route.getStrippedPrefix()));
      }

      // filter access to the repositories
      // NOTE: do this AFTER the null/empty check so we return an empty list vs. an ItemNotFound
      repositories = filterAccessToRepositories(repositories);

      ArrayList<StorageItem> result = new ArrayList<StorageItem>(repositories.size());

      for (Repository repository : repositories) {
        if (repository.isExposed() && repository.isBrowseable()) {
          ResourceStoreRequest req = null;
          if (Repository.class.equals(kind)) {
            req =
                new ResourceStoreRequest(PathUtils.concatPaths(request.getRequestPath(),
                    repository.getId()));
          }
          else {
            req =
                new ResourceStoreRequest(PathUtils.concatPaths(request.getRequestPath(),
                    repository.getPathPrefix()));
          }
          req.getRequestContext().setParentContext(request.getRequestContext());
          DefaultStorageCollectionItem repoItem = new DefaultStorageCollectionItem(this, req, true, false);
          result.add(repoItem);
        }
      }

      return result;
    }
    else {
      throw new ItemNotFoundException(reasonFor(request,
          "BUG: request depth is bigger than 1, route=%s", route));
    }
  }
View Full Code Here


      if (log.isDebugEnabled()) {
        log.debug(
            "The serving of item " + request.toString() + " is forbidden by Maven repository policy.");
      }

      throw new ItemNotFoundException(reasonFor(request, this,
          "Retrieval of %s from %s is forbidden by repository policy %s.", request.getRequestPath(),
          this, getRepositoryPolicy()));
    }

    if (getRepositoryKind().isFacetAvailable(ProxyRepository.class)
View Full Code Here

    if (!uid.getBooleanAttributeValue(IsHiddenAttribute.class)) {
      // but filter it only if request is not marked as NFS
      if (!request.getRequestContext().containsKey(Manager.ROUTING_REQUEST_NFS_FLAG_KEY)) {
        final boolean proxyFilterAllowed = getProxyRequestFilter().allowed(this, request);
        if (!proxyFilterAllowed) {
          throw new ItemNotFoundException(ItemNotFoundException.reasonFor(request, this,
              "Automatic routing filter rejected remote request for path %s from %s", request.getRequestPath(),
              this));
        }
      }
    }
View Full Code Here

          currentLink = (StorageLinkItem) item;
        }
      }
      else {
        // cycle detected, current link already processed
        throw new ItemNotFoundException(ItemNotFoundException.reasonFor(link.getResourceStoreRequest(), link
            .getRepositoryItemUid().getRepository(),
            "Link item %s introduced a cycle while referencing it, cycle is %s", link.getRepositoryItemUid(), hops));
      }
    }
  }
View Full Code Here

  @Override
  public void onHandle(final Repository repository, final ResourceStoreRequest request, final Action action)
      throws ItemNotFoundException, IllegalOperationException
  {
    if (request.getRequestPath().matches("/" + Yum.PATH_OF_REPODATA + "/.*\\.sqlite\\.bz2")) {
      throw new ItemNotFoundException(
          ItemNotFoundException.reasonFor(request, repository, "Yum sqlite metadata databases are not supported")
      );
    }
  }
View Full Code Here

  @Test
  public void shouldRegenerateRepositoryWithRpm()
      throws Exception
  {
    when(repository.retrieveItem(any(ResourceStoreRequest.class)))
        .thenThrow(new ItemNotFoundException(new ResourceStoreRequest("/some/fake/path")));

    yum.regenerateWhenDirectoryIsRemoved(BASE_PATH);
    yum.regenerateWhenPathIsRemoved(SUB_PATH1);

    sleep(TIMEOUT_IN_SEC * 2000);
 
View Full Code Here

  @Test
  public void shouldRegenerateRepositoryWithRpms()
      throws Exception
  {
    when(repository.retrieveItem(any(ResourceStoreRequest.class)))
        .thenThrow(new ItemNotFoundException(new ResourceStoreRequest("/some/fake/path")));

    yum.regenerateWhenDirectoryIsRemoved(BASE_PATH);
    yum.regenerateWhenPathIsRemoved(SUB_PATH1);
    yum.regenerateWhenPathIsRemoved(SUB_PATH2);
    yum.regenerateWhenPathIsRemoved(SUB_PATH3);
View Full Code Here

      throws Exception
  {
    when(repository.retrieveItem(any(ResourceStoreRequest.class)))
        .thenReturn(null)
        .thenReturn(null)
        .thenThrow(new ItemNotFoundException(new ResourceStoreRequest("/some/fake/path")));

    yum.regenerateWhenDirectoryIsRemoved(BASE_PATH);
    yum.regenerateWhenPathIsRemoved(SUB_PATH1);

    sleep(TIMEOUT_IN_SEC * 1500);
 
View Full Code Here

      finally {
        IOUtils.closeQuietly(reader);
      }
    }

    throw new ItemNotFoundException(request, this);
  }
View Full Code Here

TOP

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

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.