Package org.sonatype.nexus.proxy

Examples of org.sonatype.nexus.proxy.RequestContext


      getRepository().getAttributesHandler().storeAttributes(item, null);
    }
  }

  protected boolean isForceAttributeRecreation(final WalkerContext ctx) {
    final RequestContext reqestContext = ctx.getResourceStoreRequest().getRequestContext();
    if (reqestContext.containsKey(FORCE_ATTRIBUTE_RECREATION, false)) {
      // obey the "hint"
      return Boolean.parseBoolean(String.valueOf(reqestContext.get(FORCE_ATTRIBUTE_RECREATION, false)));
    }
    else {
      // fallback to default behavior: do force it
      return true;
    }
View Full Code Here


    when(collectionItem.getRepositoryItemUid()).thenReturn(itemUid);
    when(fileItem.getRepositoryItemUid()).thenReturn(itemUid);
    when(fileItem.getResourceStoreRequest()).thenReturn(new ResourceStoreRequest("/some/path"));
    when(fileItem.getRepositoryItemAttributes()).thenReturn(attributes);
    when(fileItem.getItemContext()).thenReturn(new RequestContext());

  }
View Full Code Here

   * This method should be called ONLY when you load up a _legacy_ attribute using _legacy_ attribute store! Basically
   * it "repacks" the deprecated fields as loaded by XStream (as back then XStream was used to serialize Item instances)
   * into new Attributes.
   */
  public void upgrade() {
    this.context = new RequestContext();
    this.itemAttributes = new DefaultAttributes();

    // this here is for ITs only, some of them use "manually crafter" attributes XML files and would NPE
    // In "real life", all the files stored in Nexus have at least sha1/md5 set as attributes, meaning,
    // all the real life items has at least two attributes and this map would never be null!
View Full Code Here

   *
   * @deprecated This constructor is here for legacy reasons, do not use it!
   */
  @Deprecated
  private AbstractStorageItem() {
    this.context = new RequestContext();
    this.itemAttributes = new DefaultAttributes();
  }
View Full Code Here

    return request;
  }

  public void setResourceStoreRequest(ResourceStoreRequest request) {
    this.request = request;
    this.context = new RequestContext(request.getRequestContext());
  }
View Full Code Here

  }

  // ==

  private RequestContext filterItemContext(final RequestContext itemContext) {
    final RequestContext filtered = new RequestContext();
    filtered.setParentContext(itemContext);
    return filtered;
  }
View Full Code Here

    final StorageItem item = mock(StorageItem.class);
    final RepositoryItemUid uid = mock(RepositoryItemUid.class);

    when(item.getPath()).thenReturn("foo/" + version + "/" + filename);
    when(item.getParentPath()).thenReturn("foo/" + version);
    when(item.getItemContext()).thenReturn(new RequestContext());
    when(item.getRepositoryItemUid()).thenReturn(uid);
    when(uid.getBooleanAttributeValue(IsHiddenAttribute.class)).thenReturn(true);

    return item;
  }
View Full Code Here

  @Before
  public void setup() {
    when(repository.getId()).thenReturn("test");
    when(repository.getName()).thenReturn("test");
    when(storageFileItem.getItemContext()).thenReturn(new RequestContext());
    when(storageFileItem.getRepositoryItemUid()).thenReturn(repositoryItemUid);
    when(storageFileItem.getRepositoryItemAttributes()).thenReturn(new DefaultAttributes());
    when(storageFileItem.getResourceStoreRequest()).thenReturn(new ResourceStoreRequest("blah"));
    when(repositoryItemUid.getRepository()).thenReturn(repository);
  }
View Full Code Here

TOP

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

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.