org.apache.tools.ant.types.resources.Resources Java Examples

The following examples show how to use org.apache.tools.ant.types.resources.Resources. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GetMavenDependenciesTask.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/**
 * Visits all ivy.xml files and collects module and organisation attributes into a map.
 */
private static Map<String,String> getIvyModuleInfo(Resources ivyXmlResources,
    DocumentBuilder documentBuilder, XPath xpath) {
  Map<String,String> ivyInfoModuleToOrganisation = new HashMap<String,String>();
  traverseIvyXmlResources(ivyXmlResources, new Consumer<File>() {
    @Override
    public void accept(File f) {
      try {
        Document document = documentBuilder.parse(f);
        {
          String infoPath = "/ivy-module/info";
          NodeList infos = (NodeList)xpath.evaluate(infoPath, document, XPathConstants.NODESET);
          for (int infoNum = 0 ; infoNum < infos.getLength() ; ++infoNum) {
            Element infoElement = (Element)infos.item(infoNum);
            String infoOrg = infoElement.getAttribute("organisation");
            String infoOrgSuffix = infoOrg.substring(infoOrg.lastIndexOf('.')+1);
            String infoModule = infoElement.getAttribute("module");
            String module = infoOrgSuffix+"-"+infoModule;
            ivyInfoModuleToOrganisation.put(module, infoOrg);
          }
        }
      } catch (XPathExpressionException | IOException | SAXException e) {
        throw new RuntimeException(e);
      }
    }
  });
  return ivyInfoModuleToOrganisation;
}
 
Example #2
Source File: CompileTask.java    From textuml with Eclipse Public License 1.0 5 votes vote down vote up
public synchronized void add(ResourceCollection c) {
	if (c == null) {
		return;
	}
	resources = (resources == null) ? new Resources() : resources;
	resources.add(c);
}