public String getFocusedRoot(final Path path) { return pomManagementService.getFocusedModule().getPathLocation(path); }
public String getFocusedModuleName() { return pomManagementService.getFocusedModuleName(); }
public Pom getModuleForFileIdentifier(final String fileIdentifier) { return pomManagementService.getModuleForFileIdentifier(fileIdentifier); }
public LogicalPath getPath(final String moduleName, final Path path) { Validate.notNull(moduleName, "ModuleName required"); final PhysicalPath physicalPath = pomManagementService.getPomFromModuleName(moduleName).getPhysicalPath(path); Validate.notNull(physicalPath, "Physical path for '%s' not found", path.name()); return physicalPath.getLogicalPath(); }
public Collection<Pom> getPoms() { return pomManagementService.getPoms(); }
public void onFileEvent(final FileEvent fileEvent) { Validate.notNull(fileEvent, "File event required"); if (fileEvent.getFileDetails().getCanonicalPath().endsWith(POM_RELATIVE_PATH)) { // Something happened to the POM // Don't notify if we're shutting down if (fileEvent.getOperation() == FileOperation.MONITORING_FINISH) { return; } // Retrieval will cause an eviction and notification pomManagementService.getPomFromPath(fileEvent.getFileDetails().getCanonicalPath()); } } }
public boolean isActive() { return pomManagementService.getRootPom() != null; }
public Collection<String> getModuleNames() { return pomManagementService.getModuleNames(); }
public void setModule(final Pom module) { // Update window title with project name shell.flash(Level.FINE, "Spring Roo: " + getTopLevelPackage(module.getModuleName()), Shell.WINDOW_TITLE_SLOT); pomManagementService.setFocusedModule(module); }
private File getPath(final LogicalPath logicalPath) { final Pom pom = pomManagementService.getPomFromModuleName(logicalPath.getModule()); final File moduleRoot = getModuleRoot(logicalPath.getModule(), pom); final String pathRelativeToPom = logicalPath.getPathRelativeToPom(pom); return new File(moduleRoot, pathRelativeToPom); }
@Override protected Collection<LogicalPath> getPaths(final boolean sourceOnly) { final Collection<LogicalPath> pathIds = new ArrayList<LogicalPath>(); for (final Pom pom : pomManagementService.getPoms()) { for (final PhysicalPath modulePath : pom.getPhysicalPaths()) { if (!sourceOnly || modulePath.isSource()) { pathIds.add(modulePath.getLogicalPath()); } } } return pathIds; }
private void createModule(final String moduleName, final PackagingProvider selectedPackagingProvider, final String artifactId, final String folder) { Validate.isTrue(isCreateModuleAvailable(), "Cannot create modules at this time"); if (getProjectOperations().getPomFromModuleName(moduleName) != null) { throw new IllegalArgumentException(String.format("Module %s already exists", moduleName)); } // Get parent pom Pom parentPom = getProjectOperations().getPomFromModuleName(""); setModule(parentPom); // Validate parent has POM packaging if (!parentPom.getPackaging().equals("pom")) { throw new IllegalArgumentException("ERROR: Parent module packaging is not POM"); } final PackagingProvider packagingProvider = getPackagingProvider(selectedPackagingProvider); final String pathToNewPom = packagingProvider.createArtifacts( getProjectOperations().getTopLevelPackage(parentPom.getModuleName()), artifactId, "", new GAV(parentPom.getGroupId(), parentPom.getArtifactId(), parentPom.getVersion()), moduleName, this); updateParentModulePom(moduleName); setModule(pomManagementService.getPomFromPath(pathToNewPom)); if (folder == null) { createFolder(getProjectOperations().getTopLevelPackage(moduleName), null); } else { createFolder(getProjectOperations().getTopLevelPackage(parentPom.getModuleName()), folder); } }
public MetadataItem get(final String metadataId) { Validate.isTrue(ProjectMetadata.isValid(metadataId), "Unexpected metadata request '%s' for this provider", metadataId); // Just rebuild on demand. We always do this as we expect // MetadataService to cache on our behalf final Pom pom = pomManagementService.getPomFromModuleName(ProjectMetadata.getModuleName(metadataId)); // Read the file, if it is available if (pom == null || !fileManager.exists(pom.getPath())) { return null; } return new ProjectMetadata(pom); }
private File getModuleRoot(final String module, final Pom pom) { if (pom == null) { // No POM exists for this module; we must be creating it return new File(pomManagementService.getFocusedModule().getRoot(), module); } // This is a known module; use its known root path return new File(pom.getRoot()); }
public String getFocusedCanonicalPath(final Path path, final JavaType javaType) { return getCanonicalPath(pomManagementService.getFocusedModuleName(), path, javaType); }
PhysicalPath physicalPath = null; int longest = 0; for (final Pom pom : pomManagementService.getPoms()) { if (removeTrailingSeparator(identifier).startsWith(removeTrailingSeparator(pom.getRoot())) && removeTrailingSeparator(pom.getRoot()).length() > longest) {
public String getRoot(final LogicalPath modulePathId) { final Pom pom = pomManagementService.getPomFromModuleName(modulePathId.getModule()); return pom.getPhysicalPath(modulePathId.getPath()).getLocationPath(); }
public LogicalPath getFocusedPath(final Path path) { final PhysicalPath physicalPath = pomManagementService.getFocusedModule().getPhysicalPath(path); Validate.notNull(physicalPath, "Physical path for '%s' not found", path.name()); return physicalPath.getLogicalPath(); }
public String getProjectRoot() { return pathResolver.getRoot(Path.ROOT.getModulePathId(pomManagementService .getFocusedModuleName())); }
private void updateParentModulePom(final String moduleName) { final String parentPomPath = pomManagementService.getFocusedModule().getPath(); final Document parentPomDocument = XmlUtils.readXml(fileManager.getInputStream(parentPomPath)); final Element parentPomRoot = parentPomDocument.getDocumentElement(); DomUtils.createChildIfNotExists("packaging", parentPomRoot, parentPomDocument).setTextContent( "pom"); addModuleDeclaration(moduleName, parentPomDocument, parentPomRoot); final String addModuleMessage = getDescriptionOfChange(ADDED, Collections.singleton(moduleName), "module", "modules"); fileManager.createOrUpdateTextFileIfRequired(getFocusedModule().getPath(), XmlUtils.nodeToString(parentPomDocument), addModuleMessage, false); }