本文整理汇总了Java中org.codehaus.plexus.configuration.PlexusConfiguration.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java PlexusConfiguration.getChildren方法的具体用法?Java PlexusConfiguration.getChildren怎么用?Java PlexusConfiguration.getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.plexus.configuration.PlexusConfiguration
的用法示例。
在下文中一共展示了PlexusConfiguration.getChildren方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toXppDom
import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
/**
* Recursively convert PLEXUS config to Xpp3Dom.
* @param config The config to convert
* @return The Xpp3Dom document
* @see #execute(String,String,Properties)
*/
private Xpp3Dom toXppDom(final PlexusConfiguration config) {
final Xpp3Dom result = new Xpp3Dom(config.getName());
result.setValue(config.getValue(null));
for (final String name : config.getAttributeNames()) {
try {
result.setAttribute(name, config.getAttribute(name));
} catch (final PlexusConfigurationException ex) {
throw new IllegalArgumentException(ex);
}
}
for (final PlexusConfiguration child : config.getChildren()) {
result.addChild(this.toXppDom(child));
}
return result;
}
示例2: fromConfiguration
import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
private JdkToolchain fromConfiguration( PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator )
throws ComponentConfigurationException
{
PlexusConfiguration[] params = configuration.getChildren();
Map parameters = new HashMap();
for ( int j = 0; j < params.length; j++ )
{
try
{
String name = params[j].getName();
String val = params[j].getValue();
parameters.put( name, val );
}
catch ( PlexusConfigurationException ex )
{
throw new ComponentConfigurationException( ex );
}
}
final JdkToolchain result = new JdkToolchain();
result.setParameters( Collections.unmodifiableMap( parameters ) );
return result;
}
示例3: convertPlexusConfiguration
import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
private Xpp3Dom convertPlexusConfiguration(PlexusConfiguration config) {
Xpp3Dom xpp3DomElement = new Xpp3Dom(config.getName());
xpp3DomElement.setValue(config.getValue());
for (String name : config.getAttributeNames()) {
xpp3DomElement.setAttribute(name, config.getAttribute(name));
}
for (PlexusConfiguration child : config.getChildren()) {
xpp3DomElement.addChild(convertPlexusConfiguration(child));
}
return xpp3DomElement;
}
示例4: parseHibernateTool
import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
public static PlexusConfiguration parseHibernateTool( PlexusConfiguration hibernatetool, String goalName,
ClassLoader classLoader, MavenSession session )
throws PlexusConfigurationException
{
// let's create the expression evaluator first
HibernateExpressionEvaluator evaluator = new HibernateExpressionEvaluator( session );
// now let's extract some basic information
PlexusConfiguration defaultConfiguration = findConfiguration( hibernatetool, evaluator );
List<PlexusConfiguration> goals = new Vector<PlexusConfiguration>();
List<PlexusConfiguration> properties = new Vector<PlexusConfiguration>();
for ( PlexusConfiguration child : hibernatetool.getChildren() )
{
if ( "goal".equals( PropertyUtils.getProperty( child.getName() ) ) )
{
goals.add( child );
}
else if ( !isConfiguration( child ) )
{
properties.add( child );
}
}
PlexusConfiguration target = getTarget( "hibernatetool", classLoader );
for ( PlexusConfiguration originalGoal : goals )
{
if ( "run".equals( goalName ) || originalGoal.getName().equals( goalName ) )
{
PlexusConfiguration task = getHibernateTask( hibernatetool, evaluator );
setDestinationDirectory( task, originalGoal, target, session, evaluator );
setHibernateConfiguration( task, originalGoal, defaultConfiguration, evaluator );
setHibernateGoal( task, originalGoal, evaluator );
setHibernateProperties( task, properties, evaluator );
target.addChild( task );
}
}
return target;
}
示例5: toIndentedString
import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
static void toIndentedString(PlexusConfiguration xml, int indentationSize, int currentDepth, Writer wrt)
throws IOException {
indent(indentationSize, currentDepth, wrt);
boolean hasChildren = xml.getChildCount() > 0;
boolean hasContent = xml.getValue() != null && !xml.getValue().isEmpty();
wrt.write('<');
wrt.write(xml.getName());
if (!hasChildren && !hasContent) {
wrt.write("/>");
} else {
wrt.write('>');
if (hasChildren) {
wrt.write('\n');
for (PlexusConfiguration c : xml.getChildren()) {
toIndentedString(c, indentationSize, currentDepth + 1, wrt);
wrt.append('\n');
}
if (!hasContent) {
indent(indentationSize, currentDepth, wrt);
}
}
if (hasContent) {
wrt.write(xml.getValue());
}
wrt.write("</");
wrt.write(xml.getName());
wrt.write('>');
}
}
示例6: extractAndMerge
import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
/**
* Extract the Mojo specific configuration from the incoming plugin configuration from Maven by looking at an enclosing element with the goal name. Use this and merge it with the default Mojo
* configuration and use this to apply values to the Mojo.
*
* @param goal
* @param pluginConfigurationFromMaven
* @param defaultMojoConfiguration
* @return
* @throws ComponentConfigurationException
*/
PlexusConfiguration extractAndMerge(String goal, PlexusConfiguration pluginConfigurationFromMaven, PlexusConfiguration defaultMojoConfiguration) throws ComponentConfigurationException {
//
// We need to extract the specific configuration for this goal out of the POM configuration
//
PlexusConfiguration mojoConfigurationFromPom = new XmlPlexusConfiguration("configuration");
for (PlexusConfiguration element : pluginConfigurationFromMaven.getChildren()) {
if (element.getName().equals(goal)) {
for (PlexusConfiguration goalConfigurationElements : element.getChildren()) {
mojoConfigurationFromPom.addChild(goalConfigurationElements);
}
}
}
return new XmlPlexusConfiguration(Xpp3Dom.mergeXpp3Dom(convert(mojoConfigurationFromPom), convert(defaultMojoConfiguration)));
}
示例7: toXpp3Dom
import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
/**
* Taken from MojoExecutor of Don Brown. Converts PlexusConfiguration to a Xpp3Dom.
*
* @param config the PlexusConfiguration. Must not be {@code null}.
* @return the Xpp3Dom representation of the PlexusConfiguration
*/
public Xpp3Dom toXpp3Dom( PlexusConfiguration config )
{
Xpp3Dom result = new Xpp3Dom( config.getName() );
result.setValue( config.getValue( null ) );
for ( String name : config.getAttributeNames() )
{
result.setAttribute( name, config.getAttribute( name ) );
}
for ( PlexusConfiguration child : config.getChildren() )
{
result.addChild( toXpp3Dom( child ) );
}
return result;
}
示例8: convert
import org.codehaus.plexus.configuration.PlexusConfiguration; //导入方法依赖的package包/类
public static Xpp3Dom convert( MojoDescriptor mojoDescriptor )
{
Xpp3Dom dom = new Xpp3Dom( "configuration" );
PlexusConfiguration c = mojoDescriptor.getMojoConfiguration();
PlexusConfiguration[] ces = c.getChildren();
if ( ces != null )
{
for ( PlexusConfiguration ce : ces )
{
String value = ce.getValue( null );
String defaultValue = ce.getAttribute( "default-value", null );
if ( value != null || defaultValue != null )
{
Xpp3Dom e = new Xpp3Dom( ce.getName() );
e.setValue( value );
if ( defaultValue != null )
{
e.setAttribute( "default-value", defaultValue );
}
dom.addChild( e );
}
}
}
return dom;
}