Search in sources :

Example 16 with PlexusConfiguration

use of org.codehaus.plexus.configuration.PlexusConfiguration in project liquibase by liquibase.

the class LiquibaseUpdateMojoTest method createUpdateMojo.

/*-------------------------------------------------------------------------*\
   * PRIVATE METHODS
  \*-------------------------------------------------------------------------*/
private LiquibaseUpdate createUpdateMojo() throws Exception {
    LiquibaseUpdate mojo = new LiquibaseUpdate();
    PlexusConfiguration config = loadConfiguration(CONFIG_FILE);
    configureMojo(mojo, config);
    return mojo;
}
Also used : PlexusConfiguration(org.codehaus.plexus.configuration.PlexusConfiguration)

Example 17 with PlexusConfiguration

use of org.codehaus.plexus.configuration.PlexusConfiguration in project sonatype-aether by sonatype.

the class PlexusWagonConfigurator method configure.

public void configure(Wagon wagon, Object configuration) throws Exception {
    PlexusConfiguration config = null;
    if (configuration instanceof PlexusConfiguration) {
        config = (PlexusConfiguration) configuration;
    } else if (configuration instanceof Xpp3Dom) {
        config = new XmlPlexusConfiguration((Xpp3Dom) configuration);
    } else if (configuration == null) {
        return;
    } else {
        throw new IllegalArgumentException("Unexpected configuration type: " + configuration.getClass().getName());
    }
    WagonComponentConfigurator configurator = new WagonComponentConfigurator();
    configurator.configureComponent(wagon, config, container.getContainerRealm());
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) XmlPlexusConfiguration(org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration) PlexusConfiguration(org.codehaus.plexus.configuration.PlexusConfiguration) XmlPlexusConfiguration(org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration)

Example 18 with PlexusConfiguration

use of org.codehaus.plexus.configuration.PlexusConfiguration in project maven-plugins by apache.

the class GenerateApplicationXmlMojo method buildEjbEntries.

/**
     * Builds the ejb-ref based on the configuration.
     * 
     * @return a list of EjbRef object(s)
     * @throws EarPluginException if the configuration is invalid
     */
private List<EjbRef> buildEjbEntries() throws EarPluginException {
    final List<EjbRef> result = new ArrayList<EjbRef>();
    if (ejbRefs == null) {
        return result;
    }
    try {
        StringSearchInterpolator ssi = new StringSearchInterpolator();
        ValueSource vs = new MapBasedValueSource(project.getProperties());
        ssi.addValueSource(vs);
        final PlexusConfiguration[] allEjbEntries = ejbRefs.getChildren(EjbRef.EJB_REF);
        for (PlexusConfiguration ejbEntry : allEjbEntries) {
            // CHECKSTYLE_OFF: LineLength
            final String childDescription = interpolate(ssi, ejbEntry.getChild(EnvEntry.DESCRIPTION).getValue());
            final String childEjbEntryName = interpolate(ssi, ejbEntry.getChild(EjbRef.EJB_NAME).getValue());
            final String childEjbEntryType = interpolate(ssi, ejbEntry.getChild(EjbRef.EJB_TYPE).getValue());
            final String childEjbLookupNameValue = interpolate(ssi, ejbEntry.getChild(EjbRef.EJB_LOOKUP_NAME).getValue());
            try {
                result.add(new EjbRef(childDescription, childEjbEntryName, childEjbEntryType, childEjbLookupNameValue));
            } catch (IllegalArgumentException e) {
                throw new EarPluginException("Invalid ejb-ref [" + ejbEntry + "]", e);
            }
        }
        return result;
    } catch (InterpolationException e) {
        throw new EarPluginException("Interpolation exception:", e);
    }
}
Also used : PlexusConfiguration(org.codehaus.plexus.configuration.PlexusConfiguration) StringSearchInterpolator(org.codehaus.plexus.interpolation.StringSearchInterpolator) ValueSource(org.codehaus.plexus.interpolation.ValueSource) MapBasedValueSource(org.codehaus.plexus.interpolation.MapBasedValueSource) ArrayList(java.util.ArrayList) InterpolationException(org.codehaus.plexus.interpolation.InterpolationException) MapBasedValueSource(org.codehaus.plexus.interpolation.MapBasedValueSource)

Example 19 with PlexusConfiguration

use of org.codehaus.plexus.configuration.PlexusConfiguration in project maven-plugins by apache.

the class ToolchainConverter method processConfiguration.

private void processConfiguration(ToolchainsRequirement requirement, PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator) throws ComponentConfigurationException {
    Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>>();
    PlexusConfiguration[] tools = configuration.getChildren();
    for (PlexusConfiguration tool : tools) {
        String type = tool.getName();
        PlexusConfiguration[] params = tool.getChildren();
        Map<String, String> parameters = new HashMap<String, String>();
        for (PlexusConfiguration param : params) {
            parameters.put(param.getName(), param.getValue());
        }
        map.put(type, parameters);
    }
    requirement.toolchains = map;
}
Also used : PlexusConfiguration(org.codehaus.plexus.configuration.PlexusConfiguration) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

PlexusConfiguration (org.codehaus.plexus.configuration.PlexusConfiguration)19 ArrayList (java.util.ArrayList)5 XmlPlexusConfiguration (org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration)5 Map (java.util.Map)2 PluginParameterExpressionEvaluator (org.apache.maven.plugin.PluginParameterExpressionEvaluator)2 InterpolationException (org.codehaus.plexus.interpolation.InterpolationException)2 MapBasedValueSource (org.codehaus.plexus.interpolation.MapBasedValueSource)2 StringSearchInterpolator (org.codehaus.plexus.interpolation.StringSearchInterpolator)2 ValueSource (org.codehaus.plexus.interpolation.ValueSource)2 CheckstyleException (com.puppycrawl.tools.checkstyle.api.CheckstyleException)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 IOException (java.io.IOException)1 Reader (java.io.Reader)1 HashMap (java.util.HashMap)1 List (java.util.List)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1 CheckstyleExecutorException (org.apache.maven.plugins.checkstyle.exec.CheckstyleExecutorException)1 CheckstyleExecutorRequest (org.apache.maven.plugins.checkstyle.exec.CheckstyleExecutorRequest)1