@Override public String getProjectName() { return getConfiguration().getString(PROJECT_NAME_KEY); }
@Override public MetadataFacet setProjectName(String name) { getConfiguration().setProperty(PROJECT_NAME_KEY, name); return this; }
@Override public String removeDirectProperty(String name) { Configuration subset = getConfiguration().subset(PROPERTIES_SUBSET_KEY); String value = subset.getString(name); subset.clearProperty(name); return value; }
@Override public MetadataFacet setDirectProperty(String name, String value) { Configuration subset = getConfiguration().subset(PROPERTIES_SUBSET_KEY); subset.setProperty(name, value); return this; }
private File getUserProvidedRulesFolder() { if (supplementalRulesFolder.getValue() != null) { File userProvidedRulesFolderFile = supplementalRulesFolder.getValue().getUnderlyingResourceObject(); configuration.setProperty(KEY_SUPPLEMENTAL_RULES_DIRECTORY, userProvidedRulesFolderFile.getAbsolutePath()); return userProvidedRulesFolderFile; } else { String userProvidedRulesFolder = configuration.getString(KEY_SUPPLEMENTAL_RULES_DIRECTORY); if (StringUtils.isEmpty(userProvidedRulesFolder)) { Path windupConfigHomePath = SharedProperties.getWindupConfigurationDirectory(); return windupConfigHomePath.resolve(".windup").resolve("rules").toFile(); } else { return new File(userProvidedRulesFolder); } } }
public String remoteRepository() { Configuration user = userConfig(); if (user.containsKey(REPOSITORY_KEY)) { return user.getString(REPOSITORY_KEY); } return defaultRemoteRepository(); }
/** * Registers the {@link ArchetypeCatalogFactory} objects from the user {@link Configuration} */ @Override protected void handleThisPostStartup() { services = SimpleContainer.getServices(getClass().getClassLoader(), ArchetypeCatalogFactory.class); Configuration archetypeConfiguration = getArchetypeConfiguration(); Iterator<?> keys = archetypeConfiguration.getKeys(); while (keys.hasNext()) { String name = keys.next().toString(); if (!name.isEmpty()) { String url = archetypeConfiguration.getString(name); try { addArchetypeCatalogFactory(name, new URL(url)); } catch (MalformedURLException e) { log.log(Level.SEVERE, "Malformed URL for " + name, e); } } } }
config.clearProperty("connection-profiles"); config.setProperty("connection-profiles", XMLParser.toXMLString(root));
@Override public boolean uninstall() { if (isInstalled()) { final ConfigurationFacet configFacet = project.getFacet(ConfigurationFacet.class); final Configuration config = configFacet.getConfiguration(); for (final ProjectProperty property : Arrays.asList(ProjectProperty.values())) { if (config.containsKey(getProjectAttribute(property))) { config.clearProperty(getProjectAttribute(property)); } } return true; } else { return false; } } }
@Override public Result execute(UIExecutionContext context) throws Exception { getConfiguration().clearProperty(named.getValue()); getArchetypeCatalogFactoryRegistry().removeArchetypeCatalogFactory(named.getValue()); return Results.success(); }
protected Configuration getConfiguration() { return SimpleContainer.getServices(getClass().getClassLoader(), Configuration.class).get() .subset("maven.archetypes"); }
public static boolean isInstalled(Configuration configuration) { return configuration.containsKey(PROJECT_NAME_KEY); } }
public File localRepository() { Configuration user = userConfig(); if (user.containsKey(CLONE_LOCATION_KEY)) { return new File(user.getString(CLONE_LOCATION_KEY)); } return defaultLocalRepository(); }
private Configuration getArchetypeConfiguration() { return SimpleContainer.getServices(getClass().getClassLoader(), Configuration.class).get() .subset("maven.archetypes"); }
@Override public String getProjectGroupName() { return getConfiguration().getString(PROJECT_GROUP_NAME_KEY); }
@Override public MetadataFacet setProjectVersion(String version) { getConfiguration().setProperty(PROJECT_VERSION_KEY, version); return this; }
@Override public String getProjectVersion() { return getConfiguration().getString(PROJECT_VERSION_KEY); }
@Override public MetadataFacet setProjectGroupName(String groupId) { getConfiguration().setProperty(PROJECT_GROUP_NAME_KEY, groupId); return this; }
private String getTargetDir() { String target = this.config.getString(FacesScaffoldProvider.class.getName() + "_targetDir"); target = Strings.isNullOrEmpty(target) ? "" : target; if (!target.startsWith("/")) { target = "/" + target; } if (target.endsWith("/")) { target = target.substring(0, target.length() - 1); } return target; }