Package org.codehaus.plexus.util.xml

Examples of org.codehaus.plexus.util.xml.Xpp3Dom


    public void testAddToArchive_ShouldWriteTwoComponentToArchivedFile()
        throws IOException, ArchiverException, JDOMException
    {
        filter.components = new LinkedHashMap<String, Xpp3Dom>();

        final Xpp3Dom dom = createComponentDom( new ComponentDef( "role", "hint", "impl" ) );

        filter.components.put( "rolehint", dom );

        final Xpp3Dom dom2 = createComponentDom( new ComponentDef( "role", "hint2", "impl" ) );

        filter.components.put( "rolehint2", dom2 );

        final ZipArchiver archiver = new ZipArchiver();
View Full Code Here


    }

    private Xpp3Dom createComponentDom( final ComponentDef def )
    {
        final Xpp3Dom dom = new Xpp3Dom( "component" );

        final Xpp3Dom role = new Xpp3Dom( "role" );
        role.setValue( def.role );
        dom.addChild( role );

        final String hint = def.roleHint;
        if ( hint != null )
        {
            final Xpp3Dom roleHint = new Xpp3Dom( "role-hint" );
            roleHint.setValue( hint );
            dom.addChild( roleHint );
        }

        final Xpp3Dom impl = new Xpp3Dom( "implementation" );
        impl.setValue( def.implementation );
        dom.addChild( impl );

        return dom;
    }
View Full Code Here

    public static final String COMPONENTS_XML_PATH = "META-INF/plexus/components.xml";

    protected void addComponentsXml( final Reader componentsReader ) throws XmlPullParserException, IOException
    {
        Xpp3Dom newDom = Xpp3DomBuilder.build( componentsReader );

        if ( newDom != null )
        {
            newDom = newDom.getChild( "components" );
        }

        if ( newDom != null )
        {
            final Xpp3Dom[] children = newDom.getChildren();

            for ( int i = 0; i < children.length; i++ )
            {
                final Xpp3Dom component = children[i];

                if ( components == null )
                {
                    components = new LinkedHashMap<String, Xpp3Dom>();
                }

                final String role = component.getChild( "role" )
                                             .getValue();
                final Xpp3Dom child = component.getChild( "role-hint" );
                final String roleHint = child != null ? child.getValue() : "";

                final String key = role + roleHint;
                if ( !components.containsKey( key ) )
                {
                    System.out.println( "Adding " + key );
View Full Code Here

            // TODO use WriterFactory.newXmlWriter() when plexus-utils is upgraded to 1.4.5+
            final Writer fileWriter = new OutputStreamWriter( new FileOutputStream( f ), "UTF-8" );
            try
            {
                final Xpp3Dom dom = new Xpp3Dom( "component-set" );
                final Xpp3Dom componentDom = new Xpp3Dom( "components" );
                dom.addChild( componentDom );

                for ( final Iterator<Xpp3Dom> i = components.values()
                                                            .iterator(); i.hasNext(); )
                {
                    final Xpp3Dom component = i.next();
                    componentDom.addChild( component );
                }

                Xpp3DomWriter.write( fileWriter, dom );
            }
View Full Code Here

    }

    private void configureArchiver( final Archiver archiver, final AssemblerConfigurationSource configSource )
        throws ArchiverException
    {
        Xpp3Dom config;
        try
        {
            config = Xpp3DomBuilder.build( new StringReader( configSource.getArchiverConfig() ) );
        }
        catch ( final XmlPullParserException e )
View Full Code Here

    return participant;
  }

  private List<String> retrieveOutputDirs(MojoExecution execution) {
    List<String> outputDirs = new ArrayList<String>();
    Xpp3Dom config = execution.getConfiguration();
    if (config != null) {
      Xpp3Dom transformations = config.getChild("transformationSets");
      if (transformations != null) {
        Xpp3Dom[] transformationArray = transformations.getChildren("transformationSet");
        if (transformationArray != null) {
          for (Xpp3Dom transformation : transformationArray) {
            boolean add = getBooleanChild(transformation, "addedToClasspath", true);
            if (add) {
              String outputDir = getStringChild(transformation, "outputDir", "target/generated-resources/xml/xslt");
View Full Code Here

    }
    return outputDirs;
  }

  private String getStringChild(Xpp3Dom transformation, String name, String defaultValue) {
    Xpp3Dom child = transformation.getChild(name);
    if (child != null) {
      String value = child.getValue();
      if (value != null && !value.trim().equals("")) {
        return value;
      }
    }
    return defaultValue;
View Full Code Here

    }
    return defaultValue;
  }

  private boolean getBooleanChild(Xpp3Dom transformation, String name, boolean defaultValue) {
    Xpp3Dom child = transformation.getChild(name);
    if (child != null) {
      String value = child.getValue();
      if (value != null && !value.trim().equals("")) {
        return Boolean.valueOf(value);
      }
    }
    return defaultValue;
View Full Code Here

  private String sourceRoot = null;

  public CxfBuildParticipant(MojoExecution execution) {
    super(execution, true);
    LOG.debug("Created new instance for execution: " + execution);
    Xpp3Dom config = execution.getConfiguration();
    sourceRoot = config.getChild("sourceRoot").getValue();
    LOG.debug("source root: " + sourceRoot);

  }
View Full Code Here

  private String sourceRoot = null;

  public CxfBuildParticipant(MojoExecution execution) {
    super(execution, true);
    LOG.debug("Created new instance for execution: " + execution);
    Xpp3Dom config = execution.getConfiguration();
    sourceRoot = config.getChild("sourceRoot").getValue();
    LOG.debug("source root: " + sourceRoot);

  }
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.util.xml.Xpp3Dom

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.