Examples of AbstractStorageItem


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

  private boolean cachedHashItem(final String itemPath, String suffix)
      throws Exception
  {
    final M2Repository repository = getRepository();
    try {
      AbstractStorageItem item =
          repository.getLocalStorage().retrieveItem(repository, new ResourceStoreRequest(itemPath, true, false));

      String attrname;
      if (ChecksumContentValidator.SUFFIX_SHA1.equals(suffix)) {
        attrname = ChecksumContentValidator.ATTR_REMOTE_SHA1;
      }
      else if (ChecksumContentValidator.SUFFIX_MD5.equals(suffix)) {
        attrname = ChecksumContentValidator.ATTR_REMOTE_MD5;
      }
      else {
        throw new IllegalArgumentException("Invalid checksum item suffix" + suffix);
      }

      return item.getRepositoryItemAttributes().containsKey(attrname);
    }
    catch (ItemNotFoundException e) {
      return false;
    }
  }
View Full Code Here

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

  @Override
  public AbstractStorageItem doCacheItem(AbstractStorageItem item)
      throws LocalStorageException
  {
    final AbstractStorageItem result = super.doCacheItem(item);
    result.getRepositoryItemAttributes().remove(ATTR_REMOTE_SHA1);
    result.getRepositoryItemAttributes().remove(ATTR_REMOTE_MD5);
    return result;
  }
View Full Code Here

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

    boolean corrupt = false;

    try {
      final Repository repository = uid.getRepository();

      AbstractStorageItem attributeItemCandidate =
          repository.getLocalStorage().retrieveItem(repository,
              new ResourceStoreRequest(getAttributePath(repository, uid.getPath())));

      if (attributeItemCandidate instanceof StorageFileItem) {
        StorageFileItem attributeItem = (StorageFileItem) attributeItemCandidate;
View Full Code Here

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

      path = RepositoryItemUid.PATH_ROOT;
    }

    final RepositoryItemUid uid = repository.createUid(path);

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

      DefaultStorageCollectionItem coll =
          new DefaultStorageCollectionItem(repository, request, target.canRead(), target.canWrite());
View Full Code Here

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

  }

  protected AbstractStorageItem doRetrieveLocalItem(final ResourceStoreRequest request)
      throws ItemNotFoundException, LocalStorageException
  {
    AbstractStorageItem localItem = null;
    try {
      localItem = getLocalStorage().retrieveItem(this, request);
      if (localItem instanceof StorageFileItem) {
        StorageFileItem file = (StorageFileItem) localItem;
        // wrap the content locator if needed
View Full Code Here

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

  @Override
  public AbstractStorageItem doCacheItem(AbstractStorageItem item)
      throws LocalStorageException
  {
    AbstractStorageItem result = null;

    try {
      if (log.isDebugEnabled()) {
        log.debug(
            "Caching item " + item.getRepositoryItemUid().toString() + " in local storage of repository.");
      }

      final RepositoryItemUidLock itemLock = item.getRepositoryItemUid().getLock();

      itemLock.lock(Action.create);

      final Action action;

      try {
        action = getResultingActionOnWrite(item.getResourceStoreRequest());

        getLocalStorage().storeItem(this, item);

        removeFromNotFoundCache(item.getResourceStoreRequest());

        // we swapped the remote item with the one from local storage
        // using this method below, we ensure that we get a "wrapped"
        // content locator that will keel shared-lock on the content
        // until being fully read
        result = doRetrieveLocalItem(item.getResourceStoreRequest());

      }
      finally {
        itemLock.unlock();
      }

      result.getItemContext().setParentContext(item.getItemContext());

      if (Action.create.equals(action)) {
        eventBus().post(new RepositoryItemEventCacheCreate(this, result));
      }
      else {
View Full Code Here

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

      else {
        // we have Proxy facet, so we want to check carefully local storage
        // Reason: a previous thread may still _downloading_ the stuff we want to
        // serve to another client, so we have to _wait_ for download, but for download
        // only.
        AbstractStorageItem localItem = null;

        if (!request.isRequestRemoteOnly()) {
          try {
            localItem = (AbstractStorageItem) super.doRetrieveItem(request);
View Full Code Here

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

  }

  protected StorageItem doRetrieveItem0(ResourceStoreRequest request, AbstractStorageItem localItem)
      throws IllegalOperationException, ItemNotFoundException, StorageException
  {
    AbstractStorageItem item = null;
    AbstractStorageItem remoteItem = null;

    // proxyMode and request.localOnly decides 1st
    ItemNotFoundException noRemoteAccessReason = null;
    try {
      shouldTryRemote(request);
View Full Code Here

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

        for (int i = 0; i < retryCount; i++) {
          try {
            // events.clear();

            AbstractStorageItem remoteItem =
                getRemoteStorage().retrieveItem(this, request, remoteUrl);

            remoteItem = doCacheItem(remoteItem);

            if (doValidateRemoteItemContent(request, remoteUrl, remoteItem, events)) {
View Full Code Here

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

    return (P2ProxyRepositoryConfiguration) super.getExternalConfiguration(forModification);
  }

  protected void configureMirrors(final ResourceStoreRequest incomingRequest) {
    log.debug("Repository " + getId() + ": configureMirrors: mirrorsConfigured=" + mirrorsConfigured);
    AbstractStorageItem mirrorsItem = null;

    // Try to get the mirrors from local storage
    try {
      final ResourceStoreRequest request = new ResourceStoreRequest(PRIVATE_MIRRORS_PATH);
      mirrorsItem = getLocalStorage().retrieveItem(this, request);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.