Refine search
/** * Method that get application config file location * * @return Path where application config file is located */ private LogicalPath getApplicationConfigFileLocation(String moduleName) { Validate.notNull(moduleName, "Module name is required"); LogicalPath location = LogicalPath.getInstance(DEFAULT_APPLICATION_CONFIG_FILE_LOCATION, moduleName); // ROO-3706: Check if exists some specific configuration to the // location of application config properties file String fileLocationShellConfig = settingsService.getProperty(CONFIG_FILE_LOCATION_SHELL_PROPERTY); if (fileLocationShellConfig != null && StringUtils.isNotBlank(fileLocationShellConfig)) { location = LogicalPath.getInstance(Path.ROOT, fileLocationShellConfig); } return location; }
public LogicalPath convertFromText(final String value, final Class<?> targetType, final String optionContext) { LogicalPath logicalPath = LogicalPath.getInstance(value); if (logicalPath.getModule().equals("FOCUSED")) { logicalPath = LogicalPath.getInstance(logicalPath.getPath(), projectOperations.getFocusedModuleName()); } return logicalPath; }
private boolean requiresMonitoring(final LogicalPath logicalPath) { if (logicalPath.isProjectRoot()) { return false; // already monitored by ProcessManager } if (StringUtils.isBlank(logicalPath.getModule())) { return true; // non-root path within root module } return logicalPath.isModuleRoot(); } }
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); }
Validate.notNull(entity, "Entity to produce a data on demand provider for is required"); Validate.notNull(name, "Name of the new data on demand provider is required"); final LogicalPath path = LogicalPath.getInstance(Path.SRC_TEST_JAVA, name.getModule()); Validate.notNull(path, "Location of the new data on demand provider is required");
/** * Returns the {@link LogicalPath} of the metadata item with the given id. * * @param metadataId must be a valid metadata instance id * @return a non-<code>null</code> path */ public static LogicalPath getPath(final String metadataId) { Validate.isTrue(MetadataIdentificationUtils.isIdentifyingInstance(metadataId), "Metadata id '%s' does not appear to be a valid identifier", metadataId); final String instanceKey = MetadataIdentificationUtils.getMetadataInstance(metadataId); final int index = instanceKey.indexOf("?"); return LogicalPath.getInstance(instanceKey.substring(0, index)); }
@Override protected ItdTypeDetailsProvidingMetadataItem getMetadata( final String metadataIdentificationString, final JavaType aspectName, final PhysicalTypeMetadata governorPhysicalTypeMetadata, final String itdFilename) { if (projectOperations == null) { projectOperations = getProjectOperations(); } Validate.notNull(projectOperations, "ProjectOperations is required"); final IdentifierAnnotationValues annotationValues = new IdentifierAnnotationValues(governorPhysicalTypeMetadata); if (!annotationValues.isAnnotationFound()) { return null; } // We know governor type details are non-null and can be safely cast final JavaType javaType = IdentifierMetadata.getJavaType(metadataIdentificationString); final List<Identifier> identifierServiceResult = getIdentifiersForType(javaType); final LogicalPath path = PhysicalTypeIdentifierNamingUtils.getPath(metadataIdentificationString); if (projectOperations.isProjectAvailable(path.getModule())) { // If the project itself changes, we want a chance to refresh this // item getMetadataDependencyRegistry().registerDependency( ProjectMetadata.getProjectIdentifier(path.getModule()), metadataIdentificationString); } return new IdentifierMetadata(metadataIdentificationString, aspectName, governorPhysicalTypeMetadata, annotationValues, identifierServiceResult); }
projectOperations = getProjectOperations(); Validate.notNull(projectOperations, "ProjectOperations is required"); PhysicalTypeIdentifierNamingUtils.getPath(metadataIdentificationString).getModule(); if (projectOperations.isProjectAvailable(moduleName)) { entityDetails.getFieldsWithAnnotation(EMBEDDED_ID); Validate.isTrue(!(identifierFields.isEmpty() && embeddedIdentifierFields.isEmpty()), String .format("ERROR: The annotated entity '%s' doesn't contain any identifier field.", entityDetails.getType().getFullyQualifiedTypeName()));
public String getPhysicalTypeIdentifier(final String fileCanonicalPath) { Validate.notBlank(fileCanonicalPath, "File canonical path required"); if (!doesPathIndicateJavaType(fileCanonicalPath)) { return null; Validate.notNull(module, "The module for the file '" + fileCanonicalPath + "' could not be located"); final JavaType javaType = physicalTypeIdentifier = MetadataIdentificationUtils.create(PhysicalTypeIdentifier.class.getName(), path.getName() + "?" + javaType.getFullyQualifiedTypeName()); break;
/** * Get mutable class or interface type details from java type. * * @param javaType Java type * @return Mutable class or interface type */ protected ClassOrInterfaceTypeDetails getTypeDetails(JavaType javaType) { // Get mutable class or interface type details from java type String id = PhysicalTypeIdentifier.createIdentifier(javaType, LogicalPath.getInstance(Path.SRC_MAIN_JAVA, "")); PhysicalTypeMetadata ptm = (PhysicalTypeMetadata) metadataService .get(id); Validate.notNull(ptm, "Java source class doesn't exists."); PhysicalTypeDetails ptd = ptm.getMemberHoldingTypeDetails(); Validate.notNull(ptd, "Java source code details unavailable for type " + PhysicalTypeIdentifier.getFriendlyName(id)); Validate.isInstanceOf(ClassOrInterfaceTypeDetails.class, ptd, "Java source code is immutable for type " + PhysicalTypeIdentifier.getFriendlyName(id)); return (ClassOrInterfaceTypeDetails) ptd; }
.getJavaTypeMetadataDetails(formBackingType, memberDetails, jspMetadataId); Validate.notNull(formBackingTypeMetadataDetails, "Unable to obtain metadata for type %s", formBackingType.getFullyQualifiedTypeName()); final JavaTypeMetadataDetails formbackingTypeMetadata = relatedTypeMd .get(formBackingType); Validate.notNull(formbackingTypeMetadata, "Form backing type metadata required"); final JavaTypePersistenceMetadataDetails formBackingTypePersistenceMetadata = formbackingTypeMetadata final LogicalPath webappPath = LogicalPath.getInstance( Path.SRC_MAIN_WEBAPP, path.getModule()); jspOperations.installCommonViewArtefacts(path.getModule()); Validate.isTrue(file.isDirectory(), "%s is a file, when a directory was expected", destinationDirectory);
public String getRoot(final LogicalPath logicalPath) { Validate.notNull(logicalPath, "Path required"); final PhysicalPath pathInfo = rootModulePaths.get(logicalPath.getPath()); Validate.notNull(pathInfo, "Unable to determine information for path '" + logicalPath + "'"); final File root = pathInfo.getLocation(); return FileUtils.getCanonicalPath(root); }
private void writeTextFile(final String fullPathFromRoot, final String message, String folder) { Validate.notBlank(fullPathFromRoot, "Text file name to write is required"); Validate.notBlank(message, "Message required"); MutableFile mutableFile; if (folder != null) { LogicalPath rootPath = LogicalPath.getInstance(Path.ROOT, ""); mutableFile = fileManager.createFile(pathResolver.getIdentifier(rootPath, folder + "/" + fullPathFromRoot)); } else { LogicalPath rootPath = LogicalPath.getInstance(Path.ROOT, ""); mutableFile = fileManager.createFile(pathResolver.getIdentifier(rootPath, fullPathFromRoot)); } OutputStream outputStream = null; try { outputStream = mutableFile.getOutputStream(); IOUtils.write(message, outputStream); } catch (final IOException ioe) { throw new IllegalStateException(ioe); } finally { IOUtils.closeQuietly(outputStream); } }
/** * Returns the {@link LogicalPath} for this path in the given module * * @param moduleName can be blank for the root or only module * @return a non-<code>null</code> instance */ public LogicalPath getModulePathId(final String moduleName) { return LogicalPath.getInstance(this, moduleName); }
@Override protected String getGovernorPhysicalTypeIdentifier( String metadataIdentificationString) { JavaType javaType = StringTrimmerBinderMetadata .getJavaType(metadataIdentificationString); LogicalPath path = StringTrimmerBinderMetadata .getPath(metadataIdentificationString); return PhysicalTypeIdentifier.createIdentifier(javaType, LogicalPath .getInstance(path.getPath(), getProjectOperations() .getFocusedModuleName())); }
/** * Returns the name of the project module that contains the metadata item * with the given id. * * @param metadataId must be a valid metadata instance id * @return a non-<code>null</code> module name (blank means the root or only * module) * @since 1.2.0 */ public static String getModule(final String metadataId) { return getPath(metadataId).getModule(); }
public Path getPath() { return logicalPath.getPath(); }
@Override public final String toString() { return getName(); } }