public void addDependencies(ModuleFeatureName moduleFeatureName, final Collection<? extends Dependency> newDependencies) { for (String moduleName : getModuleNames(moduleFeatureName)) { getProjectOperations().addDependencies(moduleName, newDependencies); } }
public void removeDependencies(ModuleFeatureName moduleFeatureName, final Collection<? extends Dependency> newDependencies) { for (String moduleName : getModuleNames(moduleFeatureName)) { getProjectOperations().removeDependencies(moduleName, newDependencies); } }
public List<JavaPackage> getPackagesForModule(String moduleName) { return this.getPackagesForModule(getProjectOperations().getPomFromModuleName(moduleName)); }
private String getProposedJavaType(final String fileCanonicalPath) { Validate.notBlank(fileCanonicalPath, "File canonical path required"); // Determine the JavaType for this file String relativePath = ""; final Pom moduleForFileIdentifier = getProjectOperations().getModuleForFileIdentifier(fileCanonicalPath); if (moduleForFileIdentifier == null) { return relativePath; } for (final PhysicalPath physicalPath : moduleForFileIdentifier.getPhysicalPaths()) { final String moduleCanonicalPath = FileUtils.ensureTrailingSeparator(FileUtils.getCanonicalPath(physicalPath.getLocation())); if (fileCanonicalPath.startsWith(moduleCanonicalPath)) { relativePath = File.separator + StringUtils.replace(fileCanonicalPath, moduleCanonicalPath, "", 1); break; } } Validate.notBlank(relativePath, "Could not determine compilation unit name for file '%s'", fileCanonicalPath); Validate.isTrue(relativePath.startsWith(File.separator), "Relative path unexpectedly dropped the '%s' prefix (received '%s' from '%s')", File.separator, relativePath, fileCanonicalPath); relativePath = relativePath.substring(1); Validate.isTrue(relativePath.endsWith(".java"), "The relative path unexpectedly dropped the .java extension for file '%s'", fileCanonicalPath); relativePath = relativePath.substring(0, relativePath.lastIndexOf(".java")); return relativePath.replace(File.separatorChar, '.'); }
public void addModuleDependency(final String moduleName, final JavaType moduleJavaTypeToDependUpon) { if (moduleJavaTypeToDependUpon.getModule() != null) { getProjectOperations() .addModuleDependency(moduleName, moduleJavaTypeToDependUpon.getModule()); } else { ClassOrInterfaceTypeDetails details = getTypeDetails(moduleJavaTypeToDependUpon); if (details != null && details.getName().getModule() != null) { getProjectOperations().addModuleDependency(moduleName, details.getName().getModule()); } } }
private PhysicalPath getPhysicalPath(final JavaType javaType) { Validate.notNull(javaType, "Java type required"); final String parentPath = getParentPath(javaType); if (parentPath == null) { return null; } for (final Pom pom : getProjectOperations().getPoms()) { for (final PhysicalPath physicalPath : pom.getPhysicalPaths()) { if (physicalPath.isSource()) { final String pathLocation = FileUtils.ensureTrailingSeparator(physicalPath.getLocationPath()); if (pathLocation.startsWith(parentPath)) { getTypeCache().cacheTypeAgainstModule(pom, javaType); return physicalPath; } } } } return null; }
private void initTypeMap() { for (final Pom pom : getProjectOperations().getPoms()) { for (final PhysicalPath path : pom.getPhysicalPaths()) { if (path.isSource()) { final String allJavaFiles = FileUtils.ensureTrailingSeparator(path.getLocationPath()) + JAVA_FILES_ANT_PATH; for (final FileDetails file : getFileManager().findMatchingAntPath(allJavaFiles)) { cacheType(file.getCanonicalPath()); } } } } }
return null; final Pom module = getProjectOperations().getModuleForFileIdentifier(fileCanonicalPath); Validate.notNull(module, "The module for the file '" + fileCanonicalPath + "' could not be located");
public String getPhysicalTypeCanonicalPath(final String physicalTypeId) { final LogicalPath logicalPath = PhysicalTypeIdentifier.getPath(physicalTypeId); final JavaType javaType = PhysicalTypeIdentifier.getJavaType(physicalTypeId); final Pom pom = getProjectOperations().getPomFromModuleName(logicalPath.getModule()); final String canonicalFilePath = pom.getPathLocation(logicalPath.getPath()) + javaType.getRelativeFileName(); if (getFileManager().exists(canonicalFilePath)) { getTypeCache().cacheTypeAgainstModule(pom, javaType); getTypeCache().cacheFilePathAgainstTypeIdentifier(canonicalFilePath, physicalTypeId); } return canonicalFilePath; }
public void removeDependencies(ModuleFeatureName moduleFeatureName, final Collection<? extends Dependency> newDependencies) { for (String moduleName : getModuleNames(moduleFeatureName)) { getProjectOperations().removeDependencies(moduleName, newDependencies); } }
public void addDependencies(ModuleFeatureName moduleFeatureName, final Collection<? extends Dependency> newDependencies) { for (String moduleName : getModuleNames(moduleFeatureName)) { getProjectOperations().addDependencies(moduleName, newDependencies); } }
public List<JavaPackage> getPackagesForModule(String moduleName) { return this.getPackagesForModule(getProjectOperations().getPomFromModuleName(moduleName)); }
private String getProposedJavaType(final String fileCanonicalPath) { Validate.notBlank(fileCanonicalPath, "File canonical path required"); // Determine the JavaType for this file String relativePath = ""; final Pom moduleForFileIdentifier = getProjectOperations().getModuleForFileIdentifier(fileCanonicalPath); if (moduleForFileIdentifier == null) { return relativePath; } for (final PhysicalPath physicalPath : moduleForFileIdentifier.getPhysicalPaths()) { final String moduleCanonicalPath = FileUtils.ensureTrailingSeparator(FileUtils.getCanonicalPath(physicalPath.getLocation())); if (fileCanonicalPath.startsWith(moduleCanonicalPath)) { relativePath = File.separator + StringUtils.replace(fileCanonicalPath, moduleCanonicalPath, "", 1); break; } } Validate.notBlank(relativePath, "Could not determine compilation unit name for file '%s'", fileCanonicalPath); Validate.isTrue(relativePath.startsWith(File.separator), "Relative path unexpectedly dropped the '%s' prefix (received '%s' from '%s')", File.separator, relativePath, fileCanonicalPath); relativePath = relativePath.substring(1); Validate.isTrue(relativePath.endsWith(".java"), "The relative path unexpectedly dropped the .java extension for file '%s'", fileCanonicalPath); relativePath = relativePath.substring(0, relativePath.lastIndexOf(".java")); return relativePath.replace(File.separatorChar, '.'); }
public void addModuleDependency(final String moduleName, final JavaType moduleJavaTypeToDependUpon) { if (moduleJavaTypeToDependUpon.getModule() != null) { getProjectOperations() .addModuleDependency(moduleName, moduleJavaTypeToDependUpon.getModule()); } else { ClassOrInterfaceTypeDetails details = getTypeDetails(moduleJavaTypeToDependUpon); if (details != null && details.getName().getModule() != null) { getProjectOperations().addModuleDependency(moduleName, details.getName().getModule()); } } }
private PhysicalPath getPhysicalPath(final JavaType javaType) { Validate.notNull(javaType, "Java type required"); final String parentPath = getParentPath(javaType); if (parentPath == null) { return null; } for (final Pom pom : getProjectOperations().getPoms()) { for (final PhysicalPath physicalPath : pom.getPhysicalPaths()) { if (physicalPath.isSource()) { final String pathLocation = FileUtils.ensureTrailingSeparator(physicalPath.getLocationPath()); if (pathLocation.startsWith(parentPath)) { getTypeCache().cacheTypeAgainstModule(pom, javaType); return physicalPath; } } } } return null; }
private void initTypeMap() { for (final Pom pom : getProjectOperations().getPoms()) { for (final PhysicalPath path : pom.getPhysicalPaths()) { if (path.isSource()) { final String allJavaFiles = FileUtils.ensureTrailingSeparator(path.getLocationPath()) + JAVA_FILES_ANT_PATH; for (final FileDetails file : getFileManager().findMatchingAntPath(allJavaFiles)) { cacheType(file.getCanonicalPath()); } } } } }
return null; final Pom module = getProjectOperations().getModuleForFileIdentifier(fileCanonicalPath); Validate.notNull(module, "The module for the file '" + fileCanonicalPath + "' could not be located");
public String getPhysicalTypeCanonicalPath(final String physicalTypeId) { final LogicalPath logicalPath = PhysicalTypeIdentifier.getPath(physicalTypeId); final JavaType javaType = PhysicalTypeIdentifier.getJavaType(physicalTypeId); final Pom pom = getProjectOperations().getPomFromModuleName(logicalPath.getModule()); final String canonicalFilePath = pom.getPathLocation(logicalPath.getPath()) + javaType.getRelativeFileName(); if (getFileManager().exists(canonicalFilePath)) { getTypeCache().cacheTypeAgainstModule(pom, javaType); getTypeCache().cacheFilePathAgainstTypeIdentifier(canonicalFilePath, physicalTypeId); } return canonicalFilePath; }