use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.
the class ApplicationModuleFeature method getModules.
@Override
public List<Pom> getModules() {
List<Pom> modules = new ArrayList<Pom>();
Pom module;
for (String moduleName : getModuleNames()) {
module = getProjectOperations().getPomFromModuleName(moduleName);
if (module == null) {
throw new NullPointerException(String.format("ERROR: Pom not found for module %s", moduleName));
}
modules.add(module);
}
return modules;
}
use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.
the class TypeLocationServiceImpl method getPhysicalTypeCanonicalPath.
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;
}
use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.
the class TypeLocationServiceImpl method getPhysicalPath.
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;
}
use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.
the class ViewCommands method getControllerMVCResponseTypes.
/**
* This method gets all implementations of ControllerMVCResponseService interface to be able
* to locate all ControllerMVCResponseService. Uses param installed to obtain only the installed
* or not installed response types.
*
* @param installed indicates if returned responseType should be installed or not.
*
* @return Map with responseTypes identifier and the ControllerMVCResponseService implementation
*/
public Map<String, ControllerMVCResponseService> getControllerMVCResponseTypes(boolean installed) {
Map<String, ControllerMVCResponseService> responseTypes = new HashMap<String, ControllerMVCResponseService>();
try {
ServiceReference<?>[] references = this.context.getAllServiceReferences(ControllerMVCResponseService.class.getName(), null);
for (ServiceReference<?> ref : references) {
ControllerMVCResponseService responseTypeService = (ControllerMVCResponseService) this.context.getService(ref);
boolean isAbleToInstall = false;
for (Pom module : getProjectOperations().getPoms()) {
if (responseTypeService.isInstalledInModule(module.getModuleName()) == installed) {
isAbleToInstall = true;
break;
}
}
if (isAbleToInstall) {
responseTypes.put(responseTypeService.getResponseType(), responseTypeService);
}
}
return responseTypes;
} catch (InvalidSyntaxException e) {
LOGGER.warning("Cannot load ControllerMVCResponseService on ViewCommands.");
return null;
}
}
use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.
the class ControllerOperationsImpl method isSetupAvailable.
/**
* This operation will check if setup operation is available
*
* @return true if setup operation is available. false if not.
*/
@Override
public boolean isSetupAvailable() {
Collection<Pom> applicationModules = getTypeLocationService().getModules(ModuleFeatureName.APPLICATION);
boolean notInstalledInSomeModule = false;
for (Pom module : applicationModules) {
if (!isInstalledInModule(module.getModuleName())) {
notInstalledInSomeModule = true;
break;
}
}
return getProjectOperations().isFocusedProjectAvailable() && notInstalledInSomeModule;
}
Aggregations