Package org.sonatype.nexus.proxy.repository

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


    // Hack to get the object created, so response contains the 'data'
    // element even if no mirrors defined
    dto.getData();

    try {
      Repository repository = getRepositoryRegistry().getRepository(getRepositoryId(request));

      for (Mirror mirror : getMirrors(repository)) {
        dto.addData(nexusToRestModel(mirror));
      }
    }
View Full Code Here


    try {
      List<MirrorResource> resources = (List<MirrorResource>) ((MirrorResourceListRequest) payload).getData();

      List<Mirror> mirrors = restToNexusModel(resources);

      Repository repository = getRepositoryRegistry().getRepository(getRepositoryId(request));

      setMirrors(repository, mirrors);

      dto.setData(nexusToRestModel(mirrors));
    }
View Full Code Here

          resource.addNfcContent(repoNfc);
        }
      }
      else if (getRepositoryId(request) != null) {
        Repository repository = getRepositoryRegistry().getRepository(getRepositoryId(request));

        NFCRepositoryResource repoNfc = createNFCRepositoryResource(repository);

        resource.addNfcContent(repoNfc);
      }
View Full Code Here

  protected <T extends MavenRepository> T getMavenRepository(final Request request, Class<T> clazz)
      throws ResourceException
  {
    final String repositoryId = request.getAttributes().get(REPOSITORY_ID_KEY).toString();
    try {
      final Repository repository = getRepositoryRegistry().getRepository(repositoryId);
      final T mavenRepository = repository.adaptToFacet(clazz);
      if (mavenRepository != null) {
        if (!getManager().isMavenRepositorySupported(mavenRepository)) {
          throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Repository with ID=\""
              + repositoryId + "\" unsupported!");
        }
View Full Code Here

  public void testRegistryWithViewAccessById()
      throws Exception
  {
    Subject subject = this.loginUser("repo1user");

    Repository repository = this.repositoryRegistry.getRepository("repo1");

    Assert.assertNotNull(repository);
    Assert.assertEquals("repo1", repository.getId());

    // logout user
    this.securitySystem.logout(subject);
  }
View Full Code Here

  public void testRegistryWithViewAccessFacetById()
      throws Exception
  {
    Subject subject = this.loginUser("repo1user");

    Repository repository = this.repositoryRegistry.getRepositoryWithFacet("repo1", Repository.class);

    Assert.assertNotNull(repository);
    Assert.assertEquals("repo1", repository.getId());

    // logout user
    this.securitySystem.logout(subject);
  }
View Full Code Here

    String repoId = getRepositoryId(request);

    try {
      RepositoryStatusResource resource = new RepositoryStatusResource();

      Repository repo = getRepositoryRegistry().getRepository(repoId);

      resource.setId(repo.getId());

      resource.setRepoType(getRestRepoType(repo));

      resource.setFormat(repo.getRepositoryContentClass().getId());

      resource.setLocalStatus(repo.getLocalStatus().toString());

      if (repo.getRepositoryKind().isFacetAvailable(ProxyRepository.class)) {
        ProxyRepository prepo = repo.adaptToFacet(ProxyRepository.class);

        resource.setRemoteStatus(getRestRepoRemoteStatus(prepo, request, response));

        resource.setProxyMode(prepo.getProxyMode().toString());
      }
View Full Code Here

          getNexusConfiguration().saveConfiguration();

          result = (RepositoryStatusResourceResponse) this.get(context, request, response, null);
        }
        else {
          Repository repository = getRepositoryRegistry().getRepository(repoId);

          repository.setLocalStatus(localStatus);

          if (repository.getRepositoryKind().isFacetAvailable(ProxyRepository.class)
              && resource.getProxyMode() != null) {
            ProxyMode proxyMode = EnumUtil.valueOf(resource.getProxyMode(), ProxyMode.class);
            repository.adaptToFacet(ProxyRepository.class).setProxyMode(proxyMode);
          }

          // update dependant shadows too
          for (ShadowRepository shadow : getRepositoryRegistry().getRepositoriesWithFacet(
              ShadowRepository.class)) {
            if (repository.getId().equals(shadow.getMasterRepository().getId())) {
              shadow.setLocalStatus(localStatus);
            }
          }

          getNexusConfiguration().saveConfiguration();

          result = (RepositoryStatusResourceResponse) this.get(context, request, response, null);

          for (ShadowRepository shadow : getRepositoryRegistry().getRepositoriesWithFacet(
              ShadowRepository.class)) {
            if (repository.getId().equals(shadow.getMasterRepository().getId())) {
              RepositoryDependentStatusResource dependent = new RepositoryDependentStatusResource();

              dependent.setId(shadow.getId());

              dependent.setRepoType(getRestRepoType(shadow));
View Full Code Here

  // ----------------------------------------------------------------------------

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

    }

    String repositoryId = getRepositoryId(request);

    try {
      Repository repository = getUnprotectedRepositoryRegistry().getRepository(repositoryId);

      if (GroupRepository.class.isInstance(repository) || repository.isSearchable()) {
        TreeNodeFactory factory =
            new IndexBrowserTreeNodeFactory(repository, createRedirectBaseRef(request).toString());

        HashMap<Field, String> hints = new HashMap<Field, String>();

        if (StringUtils.isNotBlank(groupIdHint)) {
          hints.put(MAVEN.GROUP_ID, groupIdHint);
        }

        if (StringUtils.isNotBlank(artifactIdHint)) {
          hints.put(MAVEN.ARTIFACT_ID, artifactIdHint);
        }

        if (StringUtils.isNotBlank(versionHint)) {
          hints.put(MAVEN.VERSION, versionHint);
        }

        TreeNode node = indexerManager.listNodes(factory, path, hints, null, repository.getId());

        if (node == null) {
          throw new PlexusResourceException(Status.CLIENT_ERROR_NOT_FOUND,
              "Unable to retrieve index tree nodes");
        }
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.