pluginDescriptor.setGroupId( c.getChild( "groupId" ).getValue() ); pluginDescriptor.setArtifactId( c.getChild( "artifactId" ).getValue() ); pluginDescriptor.setVersion( c.getChild( "version" ).getValue() ); pluginDescriptor.setGoalPrefix( c.getChild( "goalPrefix" ).getValue() ); pluginDescriptor.setName( c.getChild( "name" ).getValue() ); pluginDescriptor.setDescription( c.getChild( "description" ).getValue() ); String isolatedRealm = c.getChild( "isolatedRealm" ).getValue(); String inheritedByDefault = c.getChild( "inheritedByDefault" ).getValue(); cd.setArtifactId( d.getChild( "artifactId" ).getValue() ); cd.setGroupId( d.getChild( "groupId" ).getValue() ); cd.setType( d.getChild( "type" ).getValue() ); cd.setVersion( d.getChild( "version" ).getValue() );
mojo.setGoal( c.getChild( "goal" ).getValue() ); mojo.setImplementation( c.getChild( "implementation" ).getValue() ); mojo.setLanguage( langConfig.getValue() ); mojo.setComponentConfigurator( configuratorConfig.getValue() ); mojo.setComponentComposer( composerConfig.getValue() ); String since = c.getChild( "since" ).getValue(); mojo.setDeprecated( deprecated.getValue() ); String phase = c.getChild( "phase" ).getValue(); String executePhase = c.getChild( "executePhase" ).getValue(); String executeMojo = c.getChild( "executeGoal" ).getValue(); String executeLifecycle = c.getChild( "executeLifecycle" ).getValue(); mojo.setInstantiationStrategy( c.getChild( "instantiationStrategy" ).getValue() ); mojo.setDescription( c.getChild( "description" ).getValue() ); mojo.setDependencyResolutionRequired( dependencyResolution.getValue() ); mojo.setDependencyCollectionRequired( dependencyCollection.getValue() );
pluginDescriptor.setGroupId( c.getChild( "groupId" ).getValue() ); pluginDescriptor.setArtifactId( c.getChild( "artifactId" ).getValue() ); pluginDescriptor.setVersion( c.getChild( "version" ).getValue() ); pluginDescriptor.setGoalPrefix( c.getChild( "goalPrefix" ).getValue() ); pluginDescriptor.setName( c.getChild( "name" ).getValue() ); pluginDescriptor.setDescription( c.getChild( "description" ).getValue() ); String isolatedRealm = c.getChild( "isolatedRealm" ).getValue(); String inheritedByDefault = c.getChild( "inheritedByDefault" ).getValue(); cd.setArtifactId( d.getChild( "artifactId" ).getValue() ); cd.setGroupId( d.getChild( "groupId" ).getValue() ); cd.setType( d.getChild( "type" ).getValue() ); cd.setVersion( d.getChild( "version" ).getValue() );
mojo.setGoal( c.getChild( "goal" ).getValue() ); mojo.setImplementation( c.getChild( "implementation" ).getValue() ); mojo.setLanguage( langConfig.getValue() ); mojo.setComponentConfigurator( configuratorConfig.getValue() ); mojo.setComponentComposer( composerConfig.getValue() ); String since = c.getChild( "since" ).getValue(); mojo.setDeprecated( deprecated.getValue() ); String phase = c.getChild( "phase" ).getValue(); String executePhase = c.getChild( "executePhase" ).getValue(); String executeMojo = c.getChild( "executeGoal" ).getValue(); String executeLifecycle = c.getChild( "executeLifecycle" ).getValue(); mojo.setInstantiationStrategy( c.getChild( "instantiationStrategy" ).getValue() ); mojo.setDescription( c.getChild( "description" ).getValue() ); mojo.setDependencyResolutionRequired( dependencyResolution.getValue() ); mojo.setDependencyCollectionRequired( dependencyCollection.getValue() );
if ( config != null ) String expression = config.getValue( null );
private 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; }
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; }
protected Object fromExpression( PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator, Class type ) throws ComponentConfigurationException { Object v = fromExpression( configuration, expressionEvaluator ); if ( v != null ) { if ( !type.isAssignableFrom( v.getClass() ) ) { String msg = "Cannot assign configuration entry '" + configuration.getName() + "' to '" + type + "' from '" + configuration.getValue( null ) + "', which is of type " + v.getClass(); throw new ComponentConfigurationException( configuration, msg ); } } return v; }
private static void writeConfiguration( PrintStream out, PlexusConfiguration configuration, String indent ) throws PlexusConfigurationException { out.print( indent + "<" + configuration.getName() ); String[] atts = configuration.getAttributeNames(); if ( atts.length > 0 ) { for (String att : atts) { out.print("\n" + indent + " " + att + "='" + configuration.getAttribute(att) + "'"); } } PlexusConfiguration[] pc = configuration.getChildren(); if ( ( configuration.getValue() != null && configuration.getValue().trim().length() > 0 ) || pc.length > 0 ) { out.print( ">" + ( configuration.getValue() == null ? "" : configuration.getValue().trim() ) ); if ( pc.length > 0 ) { out.println(); for (PlexusConfiguration aPc : pc) { writeConfiguration(out, aPc, indent + " "); } out.print( indent ); } out.println( "</" + configuration.getName() + ">" ); } else { out.println( "/>" ); } }
private void displayTag( PlexusConfiguration c, Writer w, int depth ) throws IOException { String value = c.getValue( null ); if ( value != null ) { indent( depth, w ); w.write( '<' ); w.write( c.getName() ); attributes( c, w ); w.write( '>' ); w.write( c.getValue( null ) ); w.write( '<' ); w.write( '/' ); w.write( c.getName() ); w.write( '>' ); w.write( '\n' ); } else { indent( depth, w ); w.write( '<' ); w.write( c.getName() ); attributes( c, w ); w.write( '/' ); w.write( '>' ); w.write( "\n" ); } }
public Object fromConfiguration( ConverterLookup converterLookup, PlexusConfiguration configuration, Class type, Class baseType, ClassLoader classLoader, ExpressionEvaluator expressionEvaluator, ConfigurationListener listener ) throws ComponentConfigurationException { Object retValue; String expression = configuration.getValue( null ); if ( expression == null ) { expression = configuration.getAttribute( "default-value", null ); } if ( expression == null ) { Map map = new TreeMap(); PlexusConfiguration[] children = configuration.getChildren(); for (PlexusConfiguration child : children) { String name = child.getName(); map.put(name, fromExpression(child, expressionEvaluator)); } retValue = map; } else { retValue = fromExpression( configuration, expressionEvaluator ); } return retValue; }
private static void copyComponentComposers( PlexusConfiguration source, PlexusConfiguration destination ) { try { PlexusConfiguration id = destination.getChild( "default-component-composer-id" ); String sid = source.getChild( "default-component-composer-id" ).getValue(); if ( id.getValue() == null ) { id.setValue( sid ); } } catch ( PlexusConfigurationException e ) { // do nothing } PlexusConfiguration composers[] = source.getChild( "component-composers" ).getChildren( "component-composer" ); PlexusConfiguration dest = destination.getChild( "component-composers" ); for (PlexusConfiguration composer : composers) { dest.addChild(composer); } }
private static void copyComponentManagers( PlexusConfiguration source, PlexusConfiguration destination ) { try { PlexusConfiguration id = destination.getChild( "default-component-manager-id" ); String sid = source.getChild( "default-component-manager-id" ).getValue(); if ( id.getValue() == null ) { id.setValue( sid ); } } catch ( PlexusConfigurationException e ) { // do nothing } PlexusConfiguration handlers[] = source.getChild( "component-managers" ).getChildren( "component-manager" ); PlexusConfiguration dest = destination.getChild( "component-managers" ); for (PlexusConfiguration handler : handlers) { dest.addChild(handler); } }
String implementation = configuration.getChild( "implementation" ).getValue(); if (implementation == null) cd.setRole( configuration.getChild( "role" ).getValue() ); cd.setRoleHint( configuration.getChild( "role-hint" ).getValue() ); cd.setVersion( configuration.getChild( "version" ).getValue() ); cd.setComponentType( configuration.getChild( "component-type" ).getValue() ); cd.setInstantiationStrategy( configuration.getChild( "instantiation-strategy" ).getValue() ); cd.setLifecycleHandler( configuration.getChild( "lifecycle-handler" ).getValue() ); cd.setComponentProfile( configuration.getChild( "component-profile" ).getValue() ); cd.setComponentComposer( configuration.getChild( "component-composer" ).getValue() ); cd.setComponentConfigurator( configuration.getChild( "component-configurator" ).getValue() ); cd.setComponentFactory( configuration.getChild( "component-factory" ).getValue() ); cd.setDescription( configuration.getChild( "description" ).getValue() ); cd.setAlias( configuration.getChild( "alias" ).getValue() ); String s = configuration.getChild( "isolated-realm" ).getValue();
public static ComponentSetDescriptor buildComponentSet( PlexusConfiguration c, ClassRealm realm ) throws PlexusConfigurationException { ComponentSetDescriptor csd = new ComponentSetDescriptor(); // ---------------------------------------------------------------------- // Components // ---------------------------------------------------------------------- PlexusConfiguration[] components = c.getChild( "components" ).getChildren( "component" ); for (PlexusConfiguration component : components) { csd.addComponentDescriptor(buildComponentDescriptorImpl(component, realm)); } // ---------------------------------------------------------------------- // Dependencies // ---------------------------------------------------------------------- PlexusConfiguration[] dependencies = c.getChild( "dependencies" ).getChildren( "dependency" ); for (PlexusConfiguration d : dependencies) { ComponentDependency cd = new ComponentDependency(); cd.setArtifactId(d.getChild("artifact-id").getValue()); cd.setGroupId(d.getChild("group-id").getValue()); String type = d.getChild("type").getValue(); if (type != null) { cd.setType(type); } cd.setVersion(d.getChild("version").getValue()); csd.addDependency(cd); } return csd; }
String value = configuration.getValue( null ); if ( value != null && value.length() > 0 )
String value = configuration.getValue( null );
private void writeTag( PlexusConfiguration c, XMLWriter w, int depth ) throws IOException { w.startElement( c.getName() ); writeAttributes( c, w ); String value = c.getValue( null ); if ( value != null ) { w.writeText( value ); } w.endElement(); }