public RepositoryShadowResource getRepositoryShadowRestModel(
      Request request, ShadowRepository shadow) {
    RepositoryShadowResource resource = new RepositoryShadowResource();

    resource.setId(shadow.getId());

    resource.setName(shadow.getName());

    resource.setContentResourceURI(repositoryURLBuilder.getExposedRepositoryContentUrl(shadow));

    resource.setProvider(NexusCompat.getRepositoryProviderHint(shadow));

    resource.setRepoType(RepositoryBaseResourceConverter.REPO_TYPE_VIRTUAL);

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

    resource.setShadowOf(shadow.getMasterRepository().getId());

    resource.setSyncAtStartup(shadow.isSynchronizeAtStartup());

    resource.setExposed(shadow.isExposed());

    return resource;
  }
  public synchronized void deleteRepository(String id)
      throws NoSuchRepositoryException, IOException, ConfigurationException {
    Repository repository = repositoryRegistry.getRepository(id);
    // put out of service so wont be accessed any longer
    repository.setLocalStatus(LocalStatus.OUT_OF_SERVICE);
    // disable indexing for same purpose
    repository.setIndexable(false);
    repository.setSearchable(false);

    // remove dependants too

    // =======
    // 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);
      }
    }

    // ======
    // groups
    // (correction in config only, registry DOES handle it)
    // since NEXUS-1770, groups are "self maintaining"

    // ===========
    // pahMappings
    // (correction, since registry is completely unaware of this component)

    List<CPathMappingItem> pathMappings =
        getConfigurationModel().getRepositoryGrouping().getPathMappings();

    for (Iterator<CPathMappingItem> i = pathMappings.iterator(); i.hasNext(); ) {
      CPathMappingItem item = i.next();

      item.removeRepository(id);
    }

    // ===========
    // and finally
    // this cleans it properly from the registry (from reposes and repo groups)
    repositoryRegistry.removeRepository(id);

    List<CRepository> reposes = getConfigurationModel().getRepositories();

    for (Iterator<CRepository> i = reposes.iterator(); i.hasNext(); ) {
      CRepository repo = i.next();

      if (repo.getId().equals(id)) {
        i.remove();

        saveConfiguration();

        releaseRepository(repository, getConfigurationModel(), repo);

        return;
      }
    }

    throw new NoSuchRepositoryException(id);
  }