Package org.sonatype.nexus.proxy.repository

Examples of org.sonatype.nexus.proxy.repository.Repository


  }

  public void removeRepositoryIndexContext(String repositoryId, final boolean deleteFiles)
      throws IOException, NoSuchRepositoryException
  {
    final Repository repository = repositoryRegistry.getRepository(repositoryId);
    removeRepositoryIndexContext(repository, deleteFiles);
  }
View Full Code Here


  }

  public void updateRepositoryIndexContext(final String repositoryId)
      throws IOException, NoSuchRepositoryException
  {
    final Repository repository = repositoryRegistry.getRepository(repositoryId);

    // cannot do "!repository.isIndexable()" since we may be called to handle that config change (using events)!
    // the repo might be already non-indexable, but the context would still exist!
    if (!SUPPORTED(repository)) {
      return;
    }

    // the point of this if-else is to trigger NoSuchRepositoryException
    if (repository.getRepositoryKind().isFacetAvailable(GroupRepository.class)) {
      // group repository
      repositoryRegistry.getRepositoryWithFacet(repositoryId, GroupRepository.class);
    }
    else {
      repositoryRegistry.getRepositoryWithFacet(repositoryId, Repository.class);
    }

    exclusiveSingle(repository, new Runnable()
    {
      @Override
      public void run(IndexingContext context)
          throws IOException
      {
        log.debug("Updating indexing context for repository {}", repository.getId());

        File repoRoot = getRepositoryLocalStorageAsFile(repository);

        // remove context, if it already existed (ctx != null) and any of the following is true:
        // is a group OR repo path changed OR we have an isIndexed transition happening
        if (context != null
            && (ISGROUP(repository) || !INDEXABLE(repository)
            || !context.getRepository().getAbsolutePath().equals(repoRoot.getAbsolutePath()) ||
            context.isSearchable() != repository.isSearchable())) {
          // remove the context
          removeRepositoryIndexContext(repository, false);
          context = null;
        }

        // add context, if it did not existed yet (ctx == null) or any of the following is true:
        // is a group OR repo path changed OR we have an isIndexed transition happening
        if (INDEXABLE(repository) && context == null) {
          // recreate the context
          try {
            addRepositoryIndexContext(repository);
          }
          catch (NoSuchRepositoryException e) {
            // this can only happen if the repository was removed or changed type by another thread
            log.debug("Could not add indexing context for repository {}", repositoryId, e);
          }
        }

        log.debug("Updated indexing context for repository {}", repository.getId());
      }
    });
  }
View Full Code Here

  }

  public void reindexRepository(final String path, final String repositoryId, final boolean fullReindex)
      throws NoSuchRepositoryException, IOException
  {
    final Repository repository = repositoryRegistry.getRepository(repositoryId);
    reindexRepository(path, repository, fullReindex, new HashSet<String>());
  }
View Full Code Here

  }

  public void downloadRepositoryIndex(final String repositoryId)
      throws IOException, NoSuchRepositoryException
  {
    final Repository repository = repositoryRegistry.getRepository(repositoryId);
    downloadRepositoryIndex(repository, new HashSet<String>());
  }
View Full Code Here

  }

  public void publishRepositoryIndex(final String repositoryId)
      throws IOException, NoSuchRepositoryException
  {
    final Repository repository = repositoryRegistry.getRepository(repositoryId);
    publishRepositoryIndex(repository, new HashSet<String>());
  }
View Full Code Here

  }

  public void optimizeRepositoryIndex(final String repositoryId)
      throws NoSuchRepositoryException, IOException
  {
    final Repository repository = repositoryRegistry.getRepository(repositoryId);
    optimizeIndex(repository, new HashSet<String>());
  }
View Full Code Here

   */
  @Test
  public void operatorReturnedWhenTrustStoreEnabled()
      throws Exception
  {
    final Repository repository = mock(Repository.class);
    when(repository.getId()).thenReturn("foo");

    final TrustStore trustStore = mock(TrustStore.class);
    when(trustStore.getSSLContextFor(repositoryTrustStoreKey("foo"))).thenReturn(SSLContext.getDefault());

    final HttpContext httpContext = mock(HttpContext.class);
View Full Code Here

  @Deprecated
  protected String formatContextId(ArtifactInfo ai) {
    String result = ai.context;

    try {
      Repository sourceRepository = repositoryRegistry.getRepository(ai.repository);

      result = sourceRepository.getName();
    }
    catch (NoSuchRepositoryException e) {
      // nothing
    }
View Full Code Here

   */
  @Test
  public void noOperatorReturnedWhenTrustStoreIsNotEnabled()
      throws Exception
  {
    final Repository repository = mock(Repository.class);
    when(repository.getId()).thenReturn("foo");

    final TrustStore trustStore = mock(TrustStore.class);
    when(trustStore.getSSLContextFor(repositoryTrustStoreKey("foo"))).thenReturn(null);

    final HttpContext httpContext = mock(HttpContext.class);
View Full Code Here

      {
        public void postprocess(IndexingContext ctx, ArtifactInfo ai) {
          String result = ai.context;

          try {
            Repository sourceRepository = repositoryRegistry.getRepository(ai.repository);

            result = sourceRepository.getName();
          }
          catch (NoSuchRepositoryException e) {
            // nothing
          }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.repository.Repository

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.