Examples of DefaultCRepository


Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

    super(provider, id, description, new Maven1ContentClass(), MavenHostedRepository.class, repositoryPolicy);
  }

  @Override
  protected CRepositoryCoreConfiguration initCoreConfiguration() {
    CRepository repo = new DefaultCRepository();

    repo.setId("");
    repo.setName("");

    repo.setProviderRole(Repository.class.getName());
    repo.setProviderHint("maven1");

    Xpp3Dom ex = new Xpp3Dom(DefaultCRepository.EXTERNAL_CONFIGURATION_NODE_NAME);
    repo.setExternalConfiguration(ex);

    M1RepositoryConfiguration exConf = new M1RepositoryConfiguration(ex);
    // huh? see initConfig classes
    if (getRepositoryPolicy() != null) {
      exConf.setRepositoryPolicy(getRepositoryPolicy());
    }

    repo.externalConfigurationImple = exConf;

    repo.setWritePolicy(RepositoryWritePolicy.ALLOW_WRITE_ONCE.name());
    repo.setNotFoundCacheTTL(1440);

    CRepositoryCoreConfiguration result =
        new CRepositoryCoreConfiguration(
            getTemplateProvider().getApplicationConfiguration(),
            repo,
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

  private Repository getDummyRepository()
      throws Exception
  {
    M2Repository repository = (M2Repository) lookup(Repository.class, "maven2");

    CRepository cRepo = new DefaultCRepository();
    cRepo.setId("test-repo");
    cRepo.setLocalStatus(LocalStatus.IN_SERVICE.toString());
    cRepo.setNotFoundCacheTTL(1);
    cRepo.setLocalStorage(new CLocalStorage());
    cRepo.getLocalStorage().setProvider("file");
    cRepo.setProviderRole(Repository.class.getName());
    cRepo.setProviderHint("maven2");

    Xpp3Dom ex = new Xpp3Dom("externalConfiguration");
    cRepo.setExternalConfiguration(ex);
    M2RepositoryConfiguration extConf = new M2RepositoryConfiguration(ex);
    extConf.setRepositoryPolicy(RepositoryPolicy.RELEASE);

    repository.configure(cRepo);
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

    super(provider, id, description, new Maven2ContentClass(), MavenProxyRepository.class, repositoryPolicy);
  }

  @Override
  protected CRepositoryCoreConfiguration initCoreConfiguration() {
    CRepository repo = new DefaultCRepository();

    repo.setId("");
    repo.setName("");

    repo.setProviderRole(Repository.class.getName());
    repo.setProviderHint("maven2");

    repo.setRemoteStorage(new CRemoteStorage());
    repo.getRemoteStorage().setProvider(
        getTemplateProvider().getRemoteProviderHintFactory().getDefaultHttpRoleHint());
    repo.getRemoteStorage().setUrl("http://some-remote-repository/repo-root");

    Xpp3Dom ex = new Xpp3Dom(DefaultCRepository.EXTERNAL_CONFIGURATION_NODE_NAME);
    repo.setExternalConfiguration(ex);

    M2RepositoryConfiguration exConf = new M2RepositoryConfiguration(ex);
    // huh? see initConfig classes
    if (getRepositoryPolicy() != null) {
      exConf.setRepositoryPolicy(getRepositoryPolicy());
    }

    repo.externalConfigurationImple = exConf;

    repo.setWritePolicy(RepositoryWritePolicy.READ_ONLY.name());
    repo.setNotFoundCacheActive(true);
    repo.setNotFoundCacheTTL(1440);

    if (exConf.getRepositoryPolicy() != null && exConf.getRepositoryPolicy() == RepositoryPolicy.SNAPSHOT) {
      exConf.setArtifactMaxAge(1440);
    }
    else {
      exConf.setArtifactMaxAge(-1);
    }

    repo.setIndexable(true);
    repo.setSearchable(true);

    CRepositoryCoreConfiguration result =
        new CRepositoryCoreConfiguration(getTemplateProvider().getApplicationConfiguration(), repo,
            new CRepositoryExternalConfigurationHolderFactory<M2RepositoryConfiguration>()
            {
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

        localStorageDirectory =
            env.getApplicationConfiguration().getWorkingDirectory("proxy/store/" + REPO_ID);

        // ading one hosted only
        final M2Repository repo = (M2Repository) env.lookup(Repository.class, "maven2");
        CRepository repoConf = new DefaultCRepository();
        repoConf.setProviderRole(Repository.class.getName());
        repoConf.setProviderHint("maven2");
        repoConf.setId(REPO_ID);
        repoConf.setName(REPO_ID);
        repoConf.setLocalStorage(new CLocalStorage());
        repoConf.getLocalStorage().setProvider("file");
        repoConf.getLocalStorage().setUrl(localStorageDirectory.toURI().toURL().toString());
        Xpp3Dom exRepo = new Xpp3Dom("externalConfiguration");
        repoConf.setExternalConfiguration(exRepo);
        M2RepositoryConfiguration exRepoConf = new M2RepositoryConfiguration(exRepo);
        exRepoConf.setRepositoryPolicy(RepositoryPolicy.RELEASE);
        repo.configure(repoConf);
        env.getApplicationConfiguration().getConfigurationModel().addRepository(repoConf);
        env.getRepositoryRegistry().addRepository(repo);
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

    List<String> reposes = new ArrayList<String>();
    for (String remoteRepoId : repoIds()) {

      // create proxy for remote
      M1Repository repo = (M1Repository) env.lookup(Repository.class, "maven1");
      CRepository repoConf = new DefaultCRepository();
      repoConf.setProviderRole(Repository.class.getName());
      repoConf.setProviderHint("maven1");
      repoConf.setId(remoteRepoId);
      repoConf.setName(remoteRepoId);

      repoConf.setLocalStorage(new CLocalStorage());
      repoConf.getLocalStorage().setProvider("file");
      repoConf.getLocalStorage().setUrl(
          env
              .getApplicationConfiguration().getWorkingDirectory("proxy/store/" + remoteRepoId).toURI()
              .toURL().toString()
      );

      Xpp3Dom ex = new Xpp3Dom("externalConfiguration");
      repoConf.setExternalConfiguration(ex);
      M1RepositoryConfiguration exConf = new M1RepositoryConfiguration(ex);
      exConf.setRepositoryPolicy(RepositoryPolicy.RELEASE);
      exConf.setChecksumPolicy(ChecksumPolicy.STRICT_IF_EXISTS);

      repoConf.setRemoteStorage(new CRemoteStorage());
      repoConf.getRemoteStorage().setProvider(env.getRemoteProviderHintFactory().getDefaultHttpRoleHint());
      repoConf.getRemoteStorage().setUrl(server().getUrl() + "/" + remoteRepoId);
      repoConf.setIndexable(false);

      repo.configure(repoConf);

      // repo.setCacheManager( env.getCacheManager() );
      reposes.add(repo.getId());

      env.getApplicationConfiguration().getConfigurationModel().addRepository(repoConf);

      env.getRepositoryRegistry().addRepository(repo);
    }

    // ading one hosted only
    M1Repository repo = (M1Repository) env.lookup(Repository.class, "maven1");

    CRepository repoConf = new DefaultCRepository();

    repoConf.setProviderRole(Repository.class.getName());
    repoConf.setProviderHint("maven1");
    repoConf.setId("inhouse");
    repoConf.setIndexable(false);

    repoConf.setLocalStorage(new CLocalStorage());
    repoConf.getLocalStorage().setProvider("file");
    repoConf.getLocalStorage().setUrl(
        env.getApplicationConfiguration().getWorkingDirectory("proxy/store/inhouse").toURI().toURL().toString());

    Xpp3Dom exRepo = new Xpp3Dom("externalConfiguration");
    repoConf.setExternalConfiguration(exRepo);
    M1RepositoryConfiguration exRepoConf = new M1RepositoryConfiguration(exRepo);
    exRepoConf.setRepositoryPolicy(RepositoryPolicy.RELEASE);
    exRepoConf.setChecksumPolicy(ChecksumPolicy.STRICT_IF_EXISTS);

    repo.configure(repoConf);

    reposes.add(repo.getId());

    env.getApplicationConfiguration().getConfigurationModel().addRepository(repoConf);

    env.getRepositoryRegistry().addRepository(repo);

    // add a hosted snapshot repo
    M1Repository repoSnapshot = (M1Repository) env.lookup(Repository.class, "maven1");

    CRepository repoSnapshotConf = new DefaultCRepository();

    repoSnapshotConf.setProviderRole(Repository.class.getName());
    repoSnapshotConf.setProviderHint("maven1");
    repoSnapshotConf.setId("inhouse-snapshot");
    repoSnapshotConf.setIndexable(false);

    repoSnapshotConf.setLocalStorage(new CLocalStorage());
    repoSnapshotConf.getLocalStorage().setProvider("file");
    repoSnapshotConf.getLocalStorage().setUrl(
        env
            .getApplicationConfiguration().getWorkingDirectory("proxy/store/inhouse-snapshot").toURI().toURL()
            .toString()
    );

    Xpp3Dom exSnapRepo = new Xpp3Dom("externalConfiguration");
    repoSnapshotConf.setExternalConfiguration(exSnapRepo);
    M1RepositoryConfiguration exSnapRepoConf = new M1RepositoryConfiguration(exSnapRepo);
    exSnapRepoConf.setRepositoryPolicy(RepositoryPolicy.SNAPSHOT);
    exSnapRepoConf.setChecksumPolicy(ChecksumPolicy.STRICT_IF_EXISTS);

    repoSnapshot.configure(repoSnapshotConf);

    reposes.add(repoSnapshot.getId());

    env.getApplicationConfiguration().getConfigurationModel().addRepository(repoSnapshotConf);

    env.getRepositoryRegistry().addRepository(repoSnapshot);

    // add a group
    M1GroupRepository group = (M1GroupRepository) env.lookup(GroupRepository.class, "maven1");

    CRepository repoGroupConf = new DefaultCRepository();

    repoGroupConf.setProviderRole(GroupRepository.class.getName());
    repoGroupConf.setProviderHint("maven1");
    repoGroupConf.setId("test");
    repoGroupConf.setIndexable(false);

    repoGroupConf.setLocalStorage(new CLocalStorage());
    repoGroupConf.getLocalStorage().setProvider("file");
    repoGroupConf.getLocalStorage().setUrl(
        env.getApplicationConfiguration().getWorkingDirectory("proxy/store/test").toURI().toURL().toString());

    Xpp3Dom exGroupRepo = new Xpp3Dom("externalConfiguration");
    repoGroupConf.setExternalConfiguration(exGroupRepo);
    M1GroupRepositoryConfiguration exGroupRepoConf = new M1GroupRepositoryConfiguration(exGroupRepo);
    exGroupRepoConf.setMemberRepositoryIds(reposes);
    exGroupRepoConf.setMergeMetadata(true);

    group.configure(repoGroupConf);
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

    String masterId = "repo1-m1";

    M2LayoutedM1ShadowRepository shadow =
        (M2LayoutedM1ShadowRepository) getContainer().lookup(ShadowRepository.class, "m1-m2-shadow");

    CRepository repoConf = new DefaultCRepository();

    repoConf.setProviderRole(ShadowRepository.class.getName());
    repoConf.setProviderHint("m1-m2-shadow");
    repoConf.setId(masterId + "-m2");
    repoConf.setIndexable(false);

    repoConf.setLocalStorage(new CLocalStorage());
    repoConf.getLocalStorage().setProvider("file");

    Xpp3Dom exRepo = new Xpp3Dom("externalConfiguration");
    repoConf.setExternalConfiguration(exRepo);
    M1LayoutedM2ShadowRepositoryConfiguration exRepoConf = new M1LayoutedM2ShadowRepositoryConfiguration(exRepo);
    exRepoConf.setMasterRepositoryId(masterId);

    shadow.configure(repoConf);
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

    attributesHandler = createAttributesHandler();

    repository = (M2Repository) lookup(Repository.class, "maven2");

    CRepository repoConf = new DefaultCRepository();

    repoConf.setProviderRole(Repository.class.getName());
    repoConf.setProviderHint("maven2");
    repoConf.setId("dummy");

    repoConf.setLocalStorage(new CLocalStorage());
    repoConf.getLocalStorage().setProvider("file");
    File localStorageDirectory = new File(getBasedir(), "target/test-reposes/repo1");
    repoConf.getLocalStorage().setUrl(localStorageDirectory.toURI().toURL().toString());

    Xpp3Dom exRepo = new Xpp3Dom("externalConfiguration");
    repoConf.setExternalConfiguration(exRepo);
    M2RepositoryConfiguration exRepoConf = new M2RepositoryConfiguration(exRepo);
    exRepoConf.setRepositoryPolicy(RepositoryPolicy.RELEASE);
    exRepoConf.setChecksumPolicy(ChecksumPolicy.STRICT_IF_EXISTS);

    // LS is the default AttributeStorage, so no need for guessing
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

  private M2Repository buildRepository(String repoId, boolean exposed)
      throws Exception
  {
    M2Repository repo = (M2Repository) this.lookup(Repository.class, "maven2");
    CRepository repoConfig = new DefaultCRepository();
    repoConfig.setId(repoId);
    repoConfig.setExposed(exposed);
    repoConfig.setProviderRole(Repository.class.getName());
    repoConfig.setProviderHint("maven2");
    repo.configure(repoConfig);
    this.repositoryRegistry.addRepository(repo);
    this.applicationConfiguration.getConfigurationModel().addRepository(repoConfig);

    return repo;
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

  private Repository buildGroupRepository(String repoId, boolean exposed)
      throws Exception
  {
    M2GroupRepository repo = (M2GroupRepository) this.lookup(GroupRepository.class, "maven2");
    CRepository repoConfig = new DefaultCRepository();
    repoConfig.setId(repoId);
    repoConfig.setExposed(exposed);
    repoConfig.setProviderRole(GroupRepository.class.getName());
    repoConfig.setProviderHint("maven2");
    repo.configure(repoConfig);
    this.repositoryRegistry.addRepository(repo);
    this.applicationConfiguration.getConfigurationModel().addRepository(repoConfig);

    return repo;
View Full Code Here

Examples of org.sonatype.nexus.configuration.model.DefaultCRepository

  private Repository buildShadowRepository(String repoId, boolean exposed)
      throws Exception
  {
    M1Repository repo = (M1Repository) this.lookup(Repository.class, "maven1");
    CRepository repoConfig = new DefaultCRepository();
    repoConfig.setId(repoId);
    repoConfig.setExposed(exposed);
    repoConfig.setIndexable(false);
    repoConfig.setProviderRole(Repository.class.getName());
    repoConfig.setProviderHint("maven1");
    repo.configure(repoConfig);
    this.repositoryRegistry.addRepository(repo);
    this.applicationConfiguration.getConfigurationModel().addRepository(repoConfig);

    // now for the shadow
    M2LayoutedM1ShadowRepository shadow =
        (M2LayoutedM1ShadowRepository) this.lookup(ShadowRepository.class, "m1-m2-shadow");
    CRepository shadowConfig = new DefaultCRepository();
    shadowConfig.setId(repoId + "-shadow");
    shadowConfig.setExposed(exposed);
    shadowConfig.setProviderRole(ShadowRepository.class.getName());
    shadowConfig.setProviderHint("m2-m1-shadow");
    shadowConfig.setIndexable(false);

    Xpp3Dom exRepo = new Xpp3Dom("externalConfiguration");
    shadowConfig.setExternalConfiguration(exRepo);
    M1LayoutedM2ShadowRepositoryConfiguration exRepoConf = new M1LayoutedM2ShadowRepositoryConfiguration(exRepo);
    exRepoConf.setMasterRepositoryId(repo.getId());

    shadow.configure(shadowConfig);
    // shadow.
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.