private void detectCircularDependency(final Pom module, final Pom dependencyModule) { if (hasModuleDependency(dependencyModule, module)) { throw new IllegalStateException("ERROR: Circular dependency detected, '" + dependencyModule.getModuleName() + "' already depends on '" + module.getModuleName() + "'."); } }
public Collection<String> getModuleNames() { final Set<String> moduleNames = new HashSet<String>(); for (final Pom module : pomMap.values()) { moduleNames.add(module.getModuleName()); } return moduleNames; }
private void addCompletionsForOtherModuleNames(final Collection<Completion> completions, final Pom targetModule, String optionContext) { for (final Pom pom : getValidModules(optionContext)) { if (StringUtils.isNotBlank(pom.getModuleName()) && (targetModule == null || !pom.getModuleName().equals(targetModule.getModuleName()))) { completions.add(new Completion(pom.getModuleName() + MODULE_PATH_SEPARATOR, decorate( pom.getModuleName() + MODULE_PATH_SEPARATOR, FG_CYAN), "Modules", 0)); } } }
/** * Constructor * * @param pom the POM for this module of the project (required) */ public ProjectMetadata(final Pom pom) { super(getProjectIdentifier(pom.getModuleName())); Validate.notNull(pom, "POM is required"); this.pom = pom; }
public boolean isFeatureInstalled(final Pom module, final String featureName) { final Feature feature = features.get(featureName); if (feature == null) { return false; } if (feature.isInstalledInModule(module.getModuleName())) { return true; } return false; }
public Pom getPomFromModuleName(final String moduleName) { for (final Pom pom : getPoms()) { if (pom.getModuleName().equals(moduleName)) { return pom; } } return null; }
private void addCompletionsForOtherModuleNames(final List<Completion> completions, final Pom targetModule) { for (final String moduleName : projectOperations.getModuleNames()) { if (StringUtils.isNotBlank(moduleName) && !moduleName.equals(targetModule.getModuleName())) { completions.add(new Completion(moduleName + MODULE_PATH_SEPARATOR, decorate(moduleName + MODULE_PATH_SEPARATOR, FG_CYAN), "Modules", 0)); } } }
public String getTopLevelPackageForModule(final Pom module) { if (StringUtils.isBlank(module.getModuleName())) { // Parent module or project package return module.getGroupId(); } else { //Module package return module.getGroupId().concat(".").concat(module.getArtifactId()); } }
public Collection<JavaType> getTypesForModule(final Pom module) { if ("pom".equals(module.getPackaging())) { return Collections.emptySet(); } final Set<String> typeNames = getTypesForModule(module.getPath()); final Collection<JavaType> javaTypes = new ArrayList<JavaType>(); for (final String typeName : typeNames) { javaTypes.add(new JavaType(typeName, module.getModuleName())); } return javaTypes; }
@Override public String getWsdlAbsolutePathFromWsdlName(String wsdlLocation) { // Getting root path String rootPath = getPathResolver().getRoot(); // Getting module name and wsdl name from the provided wsdlName String wsdlName = getWsdlNameWithoutModule(wsdlLocation); String moduleName = getModuleFromWsdlLocation(wsdlLocation).getModuleName(); return rootPath.concat("/").concat(moduleName).concat("/src/main/resources/").concat(wsdlName); }
public String getFocusedModuleName() { if (getFocusedModule() == null) { return ""; } return getFocusedModule().getModuleName(); }
private String getTopLevelPackage(final Pom module) { if (projectOperations.isProjectAvailable(module.getModuleName())) { return typeLocationService.getTopLevelPackageForModule(module); } // Shouldn't happen if there's a project, i.e. most of the time return ""; }
public void cacheTypeAgainstModule(final Pom pom, final JavaType javaType) { Validate.notNull(pom, "Pom cannot be null"); Validate.notNull(javaType, "Java type cannot be null"); typeNameToModuleFilePathMap.put(javaType.getFullyQualifiedTypeName(), pom.getPath()); typeNameToModuleNameMap.put(javaType.getFullyQualifiedTypeName(), pom.getModuleName()); if (!moduleFilePathToTypeNamesMap.containsKey(pom.getPath())) { moduleFilePathToTypeNamesMap.put(pom.getPath(), new HashSet<String>()); } moduleFilePathToTypeNamesMap.get(pom.getPath()).add(javaType.getFullyQualifiedTypeName()); }
public void setFocusedModule(final Pom focusedModule) { Validate.notNull(focusedModule, "Module required"); if (focusedModule.getPath().equals(focusedModulePath)) { return; } focusedModulePath = focusedModule.getPath(); getShell().setPromptPath(focusedModule.getModuleName()); }
@Override public void install(Pom module) { // Including dependency with Spring Boot Starter Security getProjectOperations().addDependency(module.getModuleName(), SPRING_SECURITY_STARTER); // Add thymeleaf-extras-springsecurity4 dependency with Thymeleaf 3 support getProjectOperations().addProperty("", THYMELEAF_SPRING_SECURITY_VERSION_PROPERTY); getProjectOperations().addDependency(module.getModuleName(), THYMELEAF_SPRING_SECURITY); }
/** * 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); }
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); }
@Override public void setupJpaAudit(Pom module) { // Include Springlets Starter project dependencies and properties getProjectOperations().addProperty("", SPRINGLETS_VERSION_PROPERTY); // If current project is a multimodule project, include dependencies first // on dependencyManagement and then on current module getProjectOperations().addDependency(module.getModuleName(), SPRINGLETS_DATA_JPA_STARTER); }
@CliCommand(value = METADATA_FOR_MODULE_COMMAND, help = "Shows the ProjectMetadata for the indicated project module.") public String metadataForModule(@CliOption(key = {"", "module"}, mandatory = false, optionContext = INCLUDE_CURRENT_MODULE, help = "The module for which to retrieve the metadata. " + "Default if option not present: the Roo Shell focused module.") final Pom pom) { final Pom targetPom = ObjectUtils.defaultIfNull(pom, projectOperations.getFocusedModule()); if (targetPom == null) { return "This project has no modules"; } final String projectMID = ProjectMetadata.getProjectIdentifier(targetPom.getModuleName()); return metadataService.get(projectMID).toString(); }
private void updateProjectMetadataForModules(final Iterable<Pom> newPoms) { for (final Pom pom : newPoms) { final String projectMetadataId = ProjectMetadata.getProjectIdentifier(pom.getModuleName()); getMetadataService().evictAndGet(projectMetadataId); getMetadataDependencyRegistry().notifyDownstream(projectMetadataId); } }