public String getCanonicalPath(final String moduleName, final Path path, final JavaType javaType) { Validate.notNull(moduleName, "Module name is null"); return getCanonicalPath(path.getModulePathId(moduleName), javaType); }
public boolean getAllPossibleValues(final List<Completion> completions, final Class<?> requiredType, final String existingData, final String optionContext, final MethodTarget target) { for (final Path candidate : Path.values()) { if ("".equals(existingData) || candidate.name().startsWith(existingData)) { completions.add(new Completion(candidate.name())); } } return true; }
/** * Returns the physical path of this logical {@link Path} relative to the * given POM. This implementation simply delegates to * {@link #getDefaultLocation()}; individual enum values can override this. * * @param pom can be <code>null</code> * @return */ public String getPathRelativeToPom(final Pom pom) { return getDefaultLocation(); }
private void populatePaths(final String projectDirectory) { for (final Path subPath : Path.values()) { rootModulePaths.put(subPath, subPath.getRootModulePath(projectDirectory)); } } }
private PhysicalPath getModulePath(final String moduleName, final String moduleRoot, final Pom pom) { return new PhysicalPath(getModulePathId(moduleName), new File(moduleRoot, getPathRelativeToPom(pom))); }
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 Path convertFromText(final String value, final Class<?> requiredType, final String optionContext) { if (StringUtils.isBlank(value)) { return null; } return Path.valueOf(value); }
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(); }
/** * Creates a {@link LogicalPath} by parsing the given concatenation of * optional module name and mandatory path name. * * @param modulePlusPath a string consisting of an optional module name plus * the {@link #MODULE_PATH_SEPARATOR} plus the path, or more * precisely: * <code>[<i>module_name</i>{@value #MODULE_PATH_SEPARATOR}]<i>path</i></code> */ public static LogicalPath getInstance(final String modulePlusPath) { Validate.notBlank(modulePlusPath, "Module path required"); final int separatorIndex = modulePlusPath.indexOf(MODULE_PATH_SEPARATOR); if (separatorIndex == -1) { return new LogicalPath(null, Path.valueOf(modulePlusPath)); } final Path path = Path.valueOf(modulePlusPath.substring(separatorIndex + 1, modulePlusPath.length())); final String module = modulePlusPath.substring(0, separatorIndex); return new LogicalPath(module, path); }
public String getProjectRoot() { return pathResolver.getRoot(Path.ROOT.getModulePathId(pomManagementService .getFocusedModuleName())); }
IOUtils.closeQuietly(os); logger.info("Created ".concat(Path.SRC_MAIN_RESOURCES.name()) .concat("/").concat(aliasCerFileName));
public String getFocusedIdentifier(final Path path, final String relativePath) { String completePath = getRoot(); if (StringUtils.isNotBlank(path.getDefaultLocation())) { completePath = completePath.concat(File.separator).concat(path.getDefaultLocation()); if (StringUtils.isNotBlank(relativePath)) { completePath = completePath.concat(File.separator).concat(relativePath); } } return completePath; }
private void addAddonsDependencies(Document pom, String folder, JavaPackage topLevelPackage) { projectOperations.getPathResolver().getIdentifier(Path.ROOT.getModulePathId(""), folder + "/pom.xml");
fileManager.exists(propertiesAbsolutePath), "Missing certificated file '" .concat(Path.SRC_MAIN_RESOURCES.name()).concat("/") .concat(propertiesPath).concat("' for ") .concat(governorPhysicalTypeMetadata.getId())); fileManager.exists(certificateAbsolutePath), "Missing certificated file '" .concat(Path.SRC_MAIN_RESOURCES.name()).concat("/") .concat(certificatePath).concat("' for ") .concat(governorPhysicalTypeMetadata.getId()));
public String getFocusedRoot(final Path path) { return getRoot().concat(File.separator).concat(path.getDefaultLocation()); }
getPathResolver().getIdentifier(Path.ROOT.getModulePathId(module), "pom.xml"); getFileManager().createOrUpdateTextFileIfRequired(pomPath, XmlUtils.nodeToString(pom), true); return pomPath;
path.getDefaultLocation() + "/" + packagePath } else { destinationFile = path.getDefaultLocation() + "/" + packagePath + separatorChar + targetFilename; path.getDefaultLocation() + "/" + packagePath
@Override public void createUnitTest(final JavaType entity) { Validate.notNull(entity, "Class to produce an unit test class for is required"); // Check if provided JavaType is a Repository ClassOrInterfaceTypeDetails cid = typeLocationService.getTypeDetails(entity); Validate.notNull(cid.getAnnotation(RooJavaType.ROO_JPA_ENTITY), "Type must be a Roo JPA Entity type."); // Create JPA DataOnDemand artifacts List<DataOnDemandCreatorProvider> dodCreators = getValidDataOnDemandCreatorsForType(entity); for (DataOnDemandCreatorProvider dodCreator : dodCreators) { dodCreator.createDataOnDemand(entity); } final JavaType name = new JavaType(entity + "Test", entity.getModule()); final String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(name, Path.SRC_TEST_JAVA.getModulePathId(entity.getModule())); if (metadataService.get(declaredByMetadataId) != null) { // The file already exists return; } // Add @RooUnitTest to source file AnnotationMetadataBuilder rooUnitTestAnnotation = new AnnotationMetadataBuilder(RooJavaType.ROO_JPA_UNIT_TEST); rooUnitTestAnnotation.addClassAttribute("targetClass", entity); final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId, Modifier.PUBLIC, name, PhysicalTypeCategory.CLASS); cidBuilder.addAnnotation(rooUnitTestAnnotation); typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build()); }
StringUtils.defaultIfEmpty(sourceDirectory, Path.SRC_MAIN_JAVA.getDefaultLocation()); this.testSourceDirectory = StringUtils.defaultIfEmpty(testSourceDirectory, Path.SRC_TEST_JAVA.getDefaultLocation());
final String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(name, Path.SRC_TEST_JAVA.getModulePathId(module.getModuleName())); if (metadataService.get(declaredByMetadataId) != null) {