public Pom getModuleForFileIdentifier(final String fileIdentifier) { updatePomCache(); String startingPoint = FileUtils.getFirstDirectory(fileIdentifier); String pomPath = FileUtils.ensureTrailingSeparator(startingPoint) + DEFAULT_POM_NAME; File pom = new File(pomPath); while (!pom.exists()) { if (startingPoint.equals(SEPARATOR)) { break; } startingPoint = StringUtils.removeEnd(startingPoint, SEPARATOR); if (startingPoint.lastIndexOf(SEPARATOR) < 0) { break; } startingPoint = startingPoint.substring(0, startingPoint.lastIndexOf(SEPARATOR)); startingPoint = StringUtils.removeEnd(startingPoint, SEPARATOR); pomPath = FileUtils.ensureTrailingSeparator(startingPoint) + DEFAULT_POM_NAME; pom = new File(pomPath); } return getPomFromPath(pomPath); }
private Set<Pom> parseUnparsedPoms() { final Map<String, String> pomModuleMap = new HashMap<String, String>(); final Set<Pom> newPoms = new HashSet<Pom>(); for (final Iterator<String> iter = toBeParsed.iterator(); iter.hasNext();) { final String pathToChangedPom = iter.next(); if (new File(pathToChangedPom).exists()) { String pomContents = ""; try { pomContents = org.apache.commons.io.FileUtils.readFileToString(new File(pathToChangedPom)); } catch (IOException ignored) { } if (StringUtils.isNotBlank(pomContents)) { final Element rootElement = XmlUtils.stringToElement(pomContents); resolvePoms(rootElement, pathToChangedPom, pomModuleMap); final String moduleName = getModuleName(FileUtils.getFirstDirectory(pathToChangedPom)); final Pom pom = getPomFactory().getInstance(rootElement, pathToChangedPom, moduleName); Validate.notNull(pom, "POM is null for module '%s' and path '%s'", moduleName, pathToChangedPom); pomMap.put(pathToChangedPom, pom); newPoms.add(pom); iter.remove(); } } } return newPoms; }
/** * Returns the {@link PhysicalPath} of this {@link Path} within the module * to which the given POM belongs. * * @param pom the POM of the module in question (required) * @return a non-<code>null</code> instance */ public PhysicalPath getModulePath(final Pom pom) { return getModulePath(pom.getModuleName(), FileUtils.getFirstDirectory(pom.getPath()), pom); }
return physicalTypeIdentifier; final String typeDirectory = FileUtils.getFirstDirectory(fileCanonicalPath); final String simpleTypeName = StringUtils.replace(fileCanonicalPath, typeDirectory + File.separator, "", 1).replace(
return physicalTypeIdentifier; final String typeDirectory = FileUtils.getFirstDirectory(fileCanonicalPath); final String simpleTypeName = StringUtils.replace(fileCanonicalPath, typeDirectory + File.separator, "", 1).replace(