Package org.sonatype.nexus.proxy.item

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


          if (!request.getProcessedRepositories().contains(repo.getId())) {
            try {
              StorageItem item = repo.retrieveItem(request);

              if (item instanceof StorageCollectionItem) {
                item = new DefaultStorageCollectionItem(this, request, true, false);
              }

              return item;
            }
            catch (IllegalOperationException e) {
View Full Code Here


    final AbstractStorageItem result;
    if (target.isDirectory()) {
      request.setRequestPath(path);

      DefaultStorageCollectionItem coll =
          new DefaultStorageCollectionItem(repository, request, target.canRead(), target.canWrite());
      coll.setModified(target.lastModified());
      coll.setCreated(target.lastModified());
      result = coll;
    }
    else if (target.isFile() && !mustBeACollection) {
      request.setRequestPath(path);
View Full Code Here

    }
    catch (ItemNotFoundException e) {
      throw new AccessDeniedException(request, e.getMessage());
    }

    DefaultStorageCollectionItem coll = new DefaultStorageCollectionItem(this, request, true, true);

    if (userAttributes != null) {
      coll.getRepositoryItemAttributes().putAll(userAttributes);
    }

    storeItem(false, coll);
  }
View Full Code Here

  protected StorageItem retrieveVirtualPath(ResourceStoreRequest request, RequestRoute route)
      throws ItemNotFoundException
  {
    final ResourceStoreRequest req = new ResourceStoreRequest(route.getOriginalRequestPath());
    req.getRequestContext().setParentContext(request.getRequestContext());
    return new DefaultStorageCollectionItem(this, req, true, false);
  }
View Full Code Here

        // check is there any repo registered
        if (!repositoryRegistry.getRepositoriesWithFacet(rtd.getRole()).isEmpty()) {
          ResourceStoreRequest req =
              new ResourceStoreRequest(PathUtils.concatPaths(request.getRequestPath(), rtd.getPrefix()));
          req.getRequestContext().setParentContext(request.getRequestContext());
          DefaultStorageCollectionItem repositories =
              new DefaultStorageCollectionItem(this, req, true, false);
          result.add(repositories);
        }
      }

      return result;
    }
    else if (route.getRequestDepth() == 1) {
      // 2nd level
      List<? extends Repository> repositories = null;

      Class<? extends Repository> kind = null;

      for (RepositoryTypeDescriptor rtd : repositoryTypeRegistry.getRegisteredRepositoryTypeDescriptors()) {
        if (route.getStrippedPrefix().startsWith("/" + rtd.getPrefix())) {
          kind = rtd.getRole();

          repositories = repositoryRegistry.getRepositoriesWithFacet(kind);

          break;
        }
      }

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

    try {
      if ("/".equals(uid.getPath())) {
        request = new ResourceStoreRequest(META_PATH);
        if (!storage.containsItem(repository, request)) {
          // need to create /.meta so we can safely traverse into it later on...
          final StorageItem metaDir = new DefaultStorageCollectionItem(repository, request, true, true);
          storage.storeItem(repository, metaDir);
          augmentedItems.add(metaDir);
        }
      }
      else if (META_PATH.equals(uid.getPath())) {
View Full Code Here

TOP

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

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.