Package org.sonatype.nexus.configuration.model

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


      throws IOException
  {
    List<CPathMappingItem> routes = getNexusConfig().getRepositoryGrouping().getPathMappings();

    for (Iterator<CPathMappingItem> iter = routes.iterator(); iter.hasNext(); ) {
      CPathMappingItem groupsSettingPathMappingItem = iter.next();

      if (groupsSettingPathMappingItem.getId().equals(id)) {
        return groupsSettingPathMappingItem;
      }

    }
    return null;
View Full Code Here


  public void validateRoutesConfig(RepositoryRouteResource resource)
      throws IOException
  {

    CPathMappingItem cRoute = new NexusConfigUtil().getRoute(resource.getId());

    String msg =
        "Should be the same route. \n Expected:\n" + new XStream().toXML(resource) + " \n \n Got: \n"
            + new XStream().toXML(cRoute);

    Assert.assertEquals(msg, cRoute.getId(), resource.getId());
    Assert.assertEquals(msg, cRoute.getGroupId(), resource.getGroupId());
    Assert.assertEquals(msg, cRoute.getRoutePatterns(), Collections.singletonList(resource.getPattern()));
    Assert.assertEquals(msg, cRoute.getRouteType(), resource.getRuleType());

    this.validateSameRepoIds(resource.getRepositories(), cRoute.getRepositories());

  }
View Full Code Here

    }
    else if (MappingType.EXCLUSION.equals(item.getMappingType())) {
      routeType = CPathMappingItem.EXCLUSION_RULE_TYPE;
    }

    CPathMappingItem result = new CPathMappingItem();
    result.setId(item.getId());
    result.setGroupId(item.getGroupId());
    result.setRepositories(item.getMappedRepositories());
    result.setRouteType(routeType);
    ArrayList<String> patterns = new ArrayList<String>(item.getPatterns().size());
    for (Pattern pattern : item.getPatterns()) {
      patterns.add(pattern.toString());
    }
    result.setRoutePatterns(patterns);
    return result;
  }
View Full Code Here

  public boolean addMapping(RepositoryPathMapping mapping)
      throws ConfigurationException
  {
    removeMapping(mapping.getId());

    CPathMappingItem pathItem = convert(mapping);

    // validate
    this.validate(pathItem);

    getCurrentConfiguration(true).addPathMapping(convert(mapping));
View Full Code Here

  }

  @Override
  public boolean removeMapping(String id) {
    for (Iterator<CPathMappingItem> i = getCurrentConfiguration(true).getPathMappings().iterator(); i.hasNext(); ) {
      CPathMappingItem mapping = i.next();

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

        return true;
      }
    }
View Full Code Here

    final String repoId = evt.getRepository().getId();

    List<CPathMappingItem> pathMappings = getCurrentConfiguration(true).getPathMappings();

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

      if (item.getGroupId().equals(repoId)) {
        iterator.remove();
      }
      else {
        item.removeRepository(repoId);
      }
    }
  }
View Full Code Here

    // (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)
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.configuration.model.CPathMappingItem

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.