Examples of RepositoryItemUid


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

  @Override
  public StorageItem retrieveItem(final boolean fromTask, final ResourceStoreRequest request)
      throws IllegalOperationException, ItemNotFoundException, StorageException
  {
    final RepositoryItemUid uid = createUid(P2Constants.METADATA_LOCK_PATH);
    final RepositoryItemUidLock lock = uid.getLock();

    try {
      // Lock the metadata do be sure that the artifacts are retrieved from consistent paths.
      lock.lock(Action.read);
      try {
View Full Code Here

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

      throws IllegalOperationException, StorageException
  {
    // cstamas: this method is called from other paths, not like getMirrorsURLsByRepositoryURL() above (called from
    // configureMirrors()), so the safest is to protect it with similar locking stuff even if we do suffer in
    // performance, but we avoiding potential deadlocks (this method was synchronized).
    final RepositoryItemUid uid = createUid(P2Constants.METADATA_LOCK_PATH);
    final RepositoryItemUidLock lock = uid.getLock();

    try {
      lock.lock(Action.create);
      if (!hasArtifactMappings) {
        return null;
View Full Code Here

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

    }

    final long start = System.currentTimeMillis();

    // because we are outside realm of nexus here, we need to handle locking ourselves...
    final RepositoryItemUid repoUid = repository.createUid(P2Constants.METADATA_LOCK_PATH);
    final RepositoryItemUidLock repoLock = repoUid.getLock();

    // needed to give away the lock on actual metadata file (content.xml or artifact.xml) as we will regenerate it
    final RepositoryItemUid itemUid = repository.createUid(request.getRequestPath());
    final RepositoryItemUidLock itemLock = itemUid.getLock();

    // start with read lock, no need to do a write lock until we find it necessary
    try {
      repoLock.lock(Action.read);
      if (P2Constants.CONTENT_XML.equals(request.getRequestPath())
View Full Code Here

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

  {
    if (isValidRepository()) {
      deleteYumTempDirs();

      final File repoBaseDir = RepositoryUtils.getBaseDir(groupRepository);
      RepositoryItemUid groupRepoMdUid = groupRepository.createUid("/" + PATH_OF_REPOMD_XML);
      try {
        groupRepoMdUid.getLock().lock(Action.update);

        final List<File> memberReposBaseDirs = getBaseDirsOfMemberRepositories();
        if (memberReposBaseDirs.size() > 1) {
          log.debug("Merging repository group '{}' out of {}", groupRepository.getId(), memberReposBaseDirs);
          commandLineExecutor.exec(buildCommand(repoBaseDir, memberReposBaseDirs));
          MetadataProcessor.processMergedMetadata(groupRepository, memberReposBaseDirs);
          log.debug("Group repository '{}' merged", groupRepository.getId());
        }
        else {
          // delete without using group repository API as group repositories does not allow delete (read only)
          File groupRepodata = new File(repoBaseDir, PATH_OF_REPODATA);
          deleteQuietly(groupRepodata);
          if (memberReposBaseDirs.size() == 1) {
            log.debug(
                "Copying Yum metadata from {} to group repository {}",
                memberReposBaseDirs.get(0), groupRepository.getId()
            );
            copyDirectory(new File(memberReposBaseDirs.get(0), PATH_OF_REPODATA), groupRepodata);
          }
        }
      }
      finally {
        groupRepoMdUid.getLock().unlock();
      }

      deleteYumTempDirs();

      return new YumRepositoryImpl(repoBaseDir, groupRepository.getId(), null);
View Full Code Here

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

  @Override
  public StorageItem retrieveItem(final boolean fromTask, final ResourceStoreRequest request)
      throws IllegalOperationException, ItemNotFoundException, StorageException
  {
    final RepositoryItemUid uid = createUid(P2Constants.METADATA_LOCK_PATH);
    final RepositoryItemUidLock lock = uid.getLock();

    try {
      lock.lock(Action.read);
      return super.retrieveItem(fromTask, request);
    }
View Full Code Here

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

  @Override
  protected StorageItem doRetrieveItem(final ResourceStoreRequest request)
      throws IllegalOperationException, ItemNotFoundException, StorageException
  {
    final RepositoryItemUid uid = createUid(P2Constants.METADATA_LOCK_PATH);
    final RepositoryItemUidLock lock = uid.getLock();
    final boolean requestGroupLocalOnly = request.isRequestGroupLocalOnly();
    try {
      lock.lock(Action.read);
      request.setRequestGroupLocalOnly(true);
      return super.doRetrieveItem(request);
View Full Code Here

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

  @Override
  protected Collection<StorageItem> doListItems(final ResourceStoreRequest request)
      throws ItemNotFoundException, StorageException
  {
    final RepositoryItemUid uid = createUid(P2Constants.METADATA_LOCK_PATH);
    final RepositoryItemUidLock lock = uid.getLock();
    final boolean requestGroupLocalOnly = request.isRequestGroupLocalOnly();
    try {
      lock.lock(Action.read);
      request.setRequestGroupLocalOnly(true);
      return super.doListItems(request);
View Full Code Here

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

        final URI[] memberRepositoryUris = toUris(memberRepositoryIds);

        compositeRepository.addArtifactsRepository(tempP2Repository.toURI(), memberRepositoryUris);
        compositeRepository.addMetadataRepository(tempP2Repository.toURI(), memberRepositoryUris);

        final RepositoryItemUid uid = createUid(P2Constants.METADATA_LOCK_PATH);
        final RepositoryItemUidLock lock = uid.getLock();
        try {
          lock.lock(Action.create);

          NexusUtils.storeItemFromFile(
              COMPOSITE_ARTIFACTS_XML,
View Full Code Here

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

    when(repository.getProviderRole()).thenReturn(Repository.class.getName());
    when(repository.getProviderHint()).thenReturn("maven2");
    when(repository.adaptToFacet(HostedRepository.class)).thenReturn(repository);
    when(repository.adaptToFacet(MavenRepository.class)).thenReturn(repository);
    when(repository.adaptToFacet(MavenHostedRepository.class)).thenReturn(repository);
    final RepositoryItemUid uid = mock(RepositoryItemUid.class);
    when(uid.getLock()).thenReturn(mock(RepositoryItemUidLock.class));
    when(repository.createUid(anyString())).thenReturn(uid);
    when(repository.getRepositoryContentClass()).thenReturn(new Maven2ContentClass());
    when(repository.isExposed()).thenReturn(true);

    final RepositoryKind repositoryKind = mock(RepositoryKind.class);
View Full Code Here

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

    try {
      final Repository repository = repositories.getRepository(configuration.repositoryId());
      final StorageItem p2Dir = safeRetrieveItem(repository, P2_REPOSITORY_ROOT_PATH);
      // create if it does not exist
      if (p2Dir == null) {
        final RepositoryItemUid p2RepoUid = repository.createUid(P2_REPOSITORY_ROOT_PATH);
        try {
          p2RepoUid.getLock().lock(Action.create);

          createP2Repository(repository);
        }
        finally {
          p2RepoUid.getLock().unlock();
        }
      }
    }
    catch (final NoSuchRepositoryException e) {
      logger.warn("Could not delete P2 repository [{}] as repository could not be found");
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.