Package org.sonatype.nexus.proxy.repository

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


        if (RepositoryBaseResourceConverter.REPO_TYPE_VIRTUAL.equals(resource.getRepoType())) {
          RepositoryShadowResource model = (RepositoryShadowResource) resource;

          try {
            ShadowRepository shadow =
                getRepositoryRegistry().getRepositoryWithFacet(repoId, ShadowRepository.class);

            shadow.setName(model.getName());

            shadow.setExposed(resource.isExposed());

            shadow.setMasterRepository(getRepositoryRegistry().getRepository(model.getShadowOf()));

            shadow.setSynchronizeAtStartup(model.isSyncAtStartup());

            getNexusConfiguration().saveConfiguration();
          }
          catch (NoSuchRepositoryAccessException e) {
            getLogger().warn("Repository access denied, id=" + repoId);
View Full Code Here


          throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Local status must be defined");
        }

        LocalStatus localStatus = EnumUtil.valueOf(resource.getLocalStatus(), LocalStatus.class);
        if (RepositoryBaseResourceConverter.REPO_TYPE_VIRTUAL.equals(resource.getRepoType())) {
          ShadowRepository shadow =
              getRepositoryRegistry().getRepositoryWithFacet(repoId, ShadowRepository.class);

          shadow.setLocalStatus(localStatus);

          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));

              dependent.setFormat(shadow.getRepositoryContentClass().getId());

              dependent.setLocalStatus(shadow.getLocalStatus().toString());

              result.getData().addDependentRepo(dependent);
            }
          }
        }
View Full Code Here

  @Override
  protected Object doRun()
      throws Exception
  {
    ShadowRepository shadow =
        getRepositoryRegistry().getRepositoryWithFacet(getShadowRepositoryId(), ShadowRepository.class);

    shadow.synchronizeWithMaster();

    return null;
  }
View Full Code Here

    // shadows
    // (fail if any repo references the currently processing one)
    List<ShadowRepository> shadows = repositoryRegistry.getRepositoriesWithFacet(ShadowRepository.class);

    for (Iterator<ShadowRepository> i = shadows.iterator(); i.hasNext(); ) {
      ShadowRepository shadow = i.next();

      if (repository.getId().equals(shadow.getMasterRepository().getId())) {
        throw new RepositoryDependentException(repository, shadow);
      }
    }

    // ======
View Full Code Here

TOP

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

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.