use of org.jboss.galleon.ProvisioningOption in project galleon by wildfly.
the class ProvisioningLayout method processOptions.
private void processOptions(Iterable<? extends ProvisioningOption> pluginOptions, Map<String, String> extraOptions, final Map<String, ProvisioningOption> recognizedOptions, final List<ProvisioningOption> overridenOptions) throws ProvisioningException {
for (ProvisioningOption pluginOption : pluginOptions) {
final String optionName = pluginOption.getName();
if (!options.containsKey(optionName)) {
if (pluginOption.isRequired()) {
throw new ProvisioningException(Errors.pluginOptionRequired(optionName));
}
continue;
}
final ProvisioningOption existing = recognizedOptions.put(optionName, pluginOption);
// doesn't override a persistent one
if (existing != null && existing.isPersistent() && !pluginOption.isPersistent()) {
recognizedOptions.put(existing.getName(), existing);
} else if (pluginOption.isPersistent() || extraOptions.containsKey(optionName) && config.hasOption(optionName)) {
overridenOptions.add(pluginOption);
}
}
}
use of org.jboss.galleon.ProvisioningOption in project galleon by wildfly.
the class StateProvisionCommand method getDynamicOptions.
@Override
protected List<AbstractDynamicCommand.DynamicOption> getDynamicOptions(State state) throws Exception {
if (state == null) {
return Collections.emptyList();
}
List<AbstractDynamicCommand.DynamicOption> options = new ArrayList<>();
ProvisioningRuntime rt = state.getRuntime();
Set<ProvisioningOption> opts = getPluginOptions(rt);
for (ProvisioningOption opt : opts) {
AbstractDynamicCommand.DynamicOption dynOption = new AbstractDynamicCommand.DynamicOption(opt.getName(), opt.isRequired());
options.add(dynOption);
}
return options;
}
use of org.jboss.galleon.ProvisioningOption in project galleon by wildfly.
the class AbstractPluginsCommand method getDynamicOptions.
@Override
protected List<DynamicOption> getDynamicOptions(State state) throws Exception {
List<DynamicOption> options = new ArrayList<>();
FeaturePackLocation fpl = pmSession.getResolvedLocation(getInstallationDirectory(pmSession.getAeshContext()), getId(pmSession));
Set<ProvisioningOption> pluginOptions = getPluginOptions(fpl);
for (ProvisioningOption opt : pluginOptions) {
DynamicOption dynOption = new DynamicOption(opt.getName(), opt.isRequired());
options.add(dynOption);
}
return options;
}
use of org.jboss.galleon.ProvisioningOption in project galleon by wildfly.
the class UpdateCommand method getDynamicOptions.
@Override
protected List<DynamicOption> getDynamicOptions(State state) throws Exception {
String targetDirArg = (String) getValue(DIR_OPTION_NAME);
if (targetDirArg == null) {
// Check in argument or option, that is the option completion case.
targetDirArg = getOptionValue(DIR_OPTION_NAME);
}
Path installation = getAbsolutePath(targetDirArg, pmSession.getAeshContext());
ProvisioningConfig config = pmSession.newProvisioningManager(installation, false).getProvisioningConfig();
Set<ProvisioningOption> opts = pmSession.getResolver().get(null, PluginResolver.newResolver(pmSession, config)).getDiff();
List<DynamicOption> options = new ArrayList<>();
for (ProvisioningOption opt : opts) {
DynamicOption dynOption = new DynamicOption(opt.getName(), opt.isRequired());
options.add(dynOption);
}
return options;
}
use of org.jboss.galleon.ProvisioningOption in project galleon by wildfly.
the class ProvisionCommand method getDynamicOptions.
@Override
protected List<DynamicOption> getDynamicOptions(State state) throws Exception {
List<DynamicOption> options = new ArrayList<>();
Set<ProvisioningOption> opts;
String file = getFile();
if (file == null) {
return Collections.emptyList();
}
ProvisioningConfig config = ProvisioningXmlParser.parse(getAbsolutePath(file, pmSession.getAeshContext()));
opts = pmSession.getResolver().get(null, PluginResolver.newResolver(pmSession, config)).getInstall();
for (ProvisioningOption opt : opts) {
DynamicOption dynOption = new DynamicOption(opt.getName(), opt.isRequired());
options.add(dynOption);
}
return options;
}
Aggregations