Package org.sonatype.nexus.proxy

Examples of org.sonatype.nexus.proxy.ItemNotFoundException


    catch (ItemNotFoundException e) {
      // if it is thrown by super.doRetrieveItem()
      List<String> transformedPaths = transformShadow2Master(request.getRequestPath());

      if (transformedPaths == null || transformedPaths.isEmpty()) {
        throw new ItemNotFoundException(reasonFor(request, this,
            "Request path %s is not transformable to master.", request.getRequestPath()));
      }

      for (String transformedPath : transformedPaths) {
        // delegate the call to the master
        request.pushRequestPath(transformedPath);
        try {
          result = doRetrieveItemFromMaster(request);

          // try to create link on the fly
          try {
            StorageLinkItem link = createLink(result);

            if (link != null) {
              return link;
            }
            else {
              // fallback to result, but will not happen, see above
              return result;
            }
          }
          catch (Exception e1) {
            // fallback to result, but will not happen, see above
            return result;
          }
        }
        catch (ItemNotFoundException ex) {
          // neglect, we might try another transformed path
        }
        finally {
          request.popRequestPath();
        }
      }

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


    if (StorageCollectionItem.class.isAssignableFrom(item.getClass()) && !isBrowseable()) {
      log.debug(
          getId() + " retrieveItem() :: FOUND a collection on " + request.toString()
              + " but repository is not Browseable.");

      throw new ItemNotFoundException(reasonFor(request, this, "Repository %s is not browsable",
          this));
    }

    checkPostConditions(request, item);
View Full Code Here

    if (isBrowseable()) {
      items = list(false, request);
    }
    else {
      throw new ItemNotFoundException(reasonFor(request, this, "Repository %s is not browsable", this));
    }

    return items;
  }
View Full Code Here

          log.info(
              String.format(
                  "The file in repository %s on path=\"%s\" should be generated by ContentGeneratorId=%s, but component does not exists!",
                  RepositoryStringUtils.getHumanizedNameString(this), uid.getPath(), key));

          throw new ItemNotFoundException(reasonFor(request, this,
              "The generator for generated path %s with key %s not found in %s", request.getRequestPath(),
              key, this));
        }
      }
View Full Code Here

    if (item instanceof StorageCollectionItem) {
      return list(fromTask, (StorageCollectionItem) item);
    }
    else {
      throw new ItemNotFoundException(reasonFor(request, this, "Path %s in repository %s is not a collection",
          request.getRequestPath(), this));
    }
  }
View Full Code Here

            sb.append("until ").append(new DateTime(expirationTime)).append(" ");
          }
          final String message = sb.append("as not found in repository ").append(this).toString();

          log.debug(message);
          throw new ItemNotFoundException(reasonFor(request, this, message));
        }
      }
    }
  }
View Full Code Here

              this.validUrlContentMap.get(requestUrl).getBytes(),
              "plain/text"));
    }

    // else
    throw new ItemNotFoundException(request);
  }
View Full Code Here

            repository.getAttributesHandler().touchItemLastRequested(System.currentTimeMillis(), link);
          }
          catch (NoSuchRepositoryException e) {
            log.warn("Stale link object found on UID: {}, deleting it.", uid);
            DirSupport.delete(target.toPath());
            throw new ItemNotFoundException(reasonFor(request, repository,
                "Path %s not found in local storage of repository %s", request.getRequestPath(),
                RepositoryStringUtils.getHumanizedNameString(repository)), e);
          }
        }
        else {
          DefaultStorageFileItem file =
              new DefaultStorageFileItem(repository, request, target.canRead(), target.canWrite(),
                  fileContent);
          repository.getAttributesHandler().fetchAttributes(file);
          file.setModified(target.lastModified());
          file.setCreated(target.lastModified());
          result = file;

          repository.getAttributesHandler().touchItemLastRequested(System.currentTimeMillis(), file);
        }
      }
      catch (FileNotFoundException e) {
        // It is possible for this file to have been removed after the call to target.exists()
        // this could have been an external process
        // See: https://issues.sonatype.org/browse/NEXUS-4570
        log.debug("File '{}' removed before finished processing the directory listing", target, e);
        throw new ItemNotFoundException(reasonFor(request, repository,
            "Path %s not found in local storage of repository %s", request.getRequestPath(),
            RepositoryStringUtils.getHumanizedNameString(repository)), e);
      }
      catch (IOException e) {
        throw new LocalStorageException("Exception during reading up an item from FS storage!", e);
      }
    }
    else {
      throw new ItemNotFoundException(reasonFor(request, repository,
          "Path %s not found in local storage of repository %s", request.getRequestPath(),
          RepositoryStringUtils.getHumanizedNameString(repository)));
    }

    return result;
View Full Code Here

    if (log.isDebugEnabled()) {
      log.debug("Deleting file: {}", target.getAbsolutePath());
    }
    try {
      if (!DirSupport.deleteIfExists(target.toPath())) {
        throw new ItemNotFoundException(reasonFor(request, repository,
            "Path %s not found in local storage of repository %s", request.getRequestPath(),
            RepositoryStringUtils.getHumanizedNameString(repository)));
      }
    }
    catch (IOException e) {
View Full Code Here

    if (log.isDebugEnabled()) {
      log.debug("Moving file from {} to {}", fromTarget.getAbsolutePath(), toTarget.getAbsolutePath());
    }
    try {
      if (!DirSupport.moveIfExists(fromTarget.toPath(), toTarget.toPath())) {
        throw new ItemNotFoundException(reasonFor(from, repository,
            "Path %s not found in local storage of repository %s", from.getRequestPath(),
            RepositoryStringUtils.getHumanizedNameString(repository)));
      }
    }
    catch (IOException e) {
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.