Package org.sonatype.nexus.proxy.repository

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


      );
    }

    setDefaults();

    final Repository repository = findRepository();
    final RepositoryItemUid mdUid = repository.createUid("/" + PATH_OF_REPOMD_XML);
    try {
      mdUid.getLock().lock(Action.update);

      LOG.debug("Generating Yum-Repository for '{}' ...", getRpmDir());
      try {
        // NEXUS-6680: Nuke cache dir if force rebuild in effect
        if (shouldForceFullScan()) {
          DirSupport.deleteIfExists(getCacheDir().toPath());
        }
        DirSupport.mkdir(getRepoDir().toPath());

        File rpmListFile = createRpmListFile();
        commandLineExecutor.exec(buildCreateRepositoryCommand(rpmListFile));
      }
      catch (IOException e) {
        LOG.warn("Yum metadata generation failed", e);
        throw new IOException("Yum metadata generation failed", e);
      }
      // TODO dubious
      Thread.sleep(100);

      if (repository != null) {
        final MavenRepository mavenRepository = repository.adaptToFacet(MavenRepository.class);
        if (mavenRepository != null) {
          try {
            routingManager.forceUpdatePrefixFile(mavenRepository);
          }
          catch (Exception e) {
View Full Code Here


  }

  protected void setDefaults()
      throws MalformedURLException, URISyntaxException
  {
    final Repository repository = findRepository();
    if (isBlank(getRpmDir()) && repository != null) {
      setRpmDir(RepositoryUtils.getBaseDir(repository).getAbsolutePath());
    }
    if (isBlank(getParameter(PARAM_REPO_DIR)) && isNotBlank(getRpmDir())) {
      setRepoDir(new File(getRpmDir()));
View Full Code Here

  }

  private void regenerateMetadataForGroups() {
    if (StringUtils.isBlank(getVersion())) {
      try {
        final Repository repository = repositoryRegistry.getRepository(getRepositoryId());
        for (GroupRepository groupRepository : repositoryRegistry.getGroupsOfRepository(repository)) {
          Yum yum = yumRegistry.get(groupRepository.getId());
          if (yum != null && yum instanceof YumGroup) {
            ((YumGroup) yum).markDirty();
          }
View Full Code Here

  }

  @Subscribe
  @AllowConcurrentEvents
  public void on(final RepositoryRegistryEventAdd evt) {
    final Repository repository = evt.getRepository();
    // check do we need to handle it at all
    if (isArchetypeCatalogSubject(repository)) {
      manageArchetypeCatalog(repository);
    }
  }
View Full Code Here

  }

  @Subscribe
  @AllowConcurrentEvents
  public void on(final RepositoryConfigurationUpdatedEvent evt) {
    final Repository repository = evt.getRepository();
    // check do we need to handle it at all
    if (isArchetypeCatalogSubject(repository)) {
      manageArchetypeCatalog(repository);
    }
  }
View Full Code Here

  @Test
  public void Test_NEXUS_5995() throws IOException, NoSuchRepositoryException {
    P2MetadataGeneratorConfiguration config = mock(P2MetadataGeneratorConfiguration.class);
    when(config.repositoryId()).thenReturn("mockId");
    Repository repo = mock(Repository.class);
    DefaultFSLocalRepositoryStorage local = mock(DefaultFSLocalRepositoryStorage.class);
    when(local.getFileFromBase(any(Repository.class), any(ResourceStoreRequest.class))).thenReturn(tempFile);
    when(repo.getLocalStorage()).thenReturn(local);
    when(repo.getId()).thenReturn("mockId");
    when(repositories.getRepository("mockId")).thenReturn(repo);

    StorageItem item = mock(StorageItem.class);
    when(item.getPath()).thenReturn(new File(tempP2Repository, "feature.jar").getAbsolutePath());
    when(item.getRepositoryId()).thenReturn("mockId");
View Full Code Here

  }

  @Override
  public void onActivate(final C config) {
    try {
      final Repository repository = repositoryRegistry.getRepository(config.repository());
      configureYum(yumRegistry.register(repository.adaptToFacet(MavenRepository.class)), config);
    }
    catch (NoSuchRepositoryException e) {
      // TODO
      throw Throwables.propagate(e);
    }
View Full Code Here

  @Override
  public String renderStatus() {
    if (isConfigured()) {
      try {
        final Repository repository = repositoryRegistry.getRepository(getConfig().repository());
        final StorageItem storageItem = repository.retrieveItem(
            new ResourceStoreRequest(YumConfigContentGenerator.configFilePath(repository.getId()), true)
        );
        if (storageItem instanceof StorageFileItem) {
          try (InputStream in = ((StorageFileItem) storageItem).getInputStream()) {
            return
                "<b>Example Yum configuration file:</b><br/><br/>"
View Full Code Here

  }

  private void assertConvertion(String localUrl, String expected)
      throws Exception
  {
    final Repository repo = mock(Repository.class);
    when(repo.getLocalUrl()).thenReturn(localUrl);

    // make the expected path canonical, due to Windows
    String canonicalPath = new File(expected).getCanonicalPath();
    assertThat(getBaseDir(repo).getAbsolutePath(), is(canonicalPath));
  }
View Full Code Here

   * Condition should remain satisfied when another repository is removed.
   */
  @Test
  public void noReactionWhenAnotherRepositoryIsRemoved() {
    assertThat(underTest.isSatisfied(), is(true));
    final Repository anotherRepository = mock(Repository.class);
    when(anotherRepository.getId()).thenReturn("another");
    underTest.handle(new RepositoryRegistryEventRemove(repositoryRegistry, anotherRepository));
    assertThat(underTest.isSatisfied(), is(true));
  }
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.