ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder TransformingProjectBuilder.java
Date Tue, 21 May 2002 00:29:51 GMT
donaldp     02/05/20 17:29:51

  Modified:    container/src/java/org/apache/myrmidon/components/builder
                        TransformingProjectBuilder.java
  Log:
  Delegate to TransformingModelBuilder.
  
  Revision  Changes    Path
  1.7       +4 -59     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/TransformingProjectBuilder.java
  
  Index: TransformingProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/TransformingProjectBuilder.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TransformingProjectBuilder.java	17 May 2002 07:41:27 -0000	1.6
  +++ TransformingProjectBuilder.java	21 May 2002 00:29:51 -0000	1.7
  @@ -7,76 +7,21 @@
    */
   package org.apache.myrmidon.components.builder;
   
  -import java.io.InputStream;
  -import javax.xml.transform.Result;
  -import javax.xml.transform.Source;
  -import javax.xml.transform.Transformer;
  -import javax.xml.transform.TransformerConfigurationException;
  -import javax.xml.transform.TransformerFactory;
  -import javax.xml.transform.sax.SAXResult;
  -import javax.xml.transform.stream.StreamSource;
  -import org.apache.avalon.excalibur.i18n.ResourceManager;
  -import org.apache.avalon.excalibur.i18n.Resources;
  -import org.xml.sax.ContentHandler;
  -import org.xml.sax.ErrorHandler;
  +import org.apache.myrmidon.interfaces.builder.ModelBuilder;
   
   /**
    * A Project Builder which performs an XSL transformation on a project.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.6 $ $Date: 2002/05/17 07:41:27 $
  + * @version $Revision: 1.7 $ $Date: 2002/05/21 00:29:51 $
    *
    * @ant.type type="project-builder" name="ant-transform"
    */
   public class TransformingProjectBuilder
       extends DefaultProjectBuilder
   {
  -    private static final Resources REZ =
  -        ResourceManager.getPackageResources( TransformingProjectBuilder.class );
  -
  -    private static final String STYLESHEET = "ant1convert.xsl";
  -    private Transformer m_transformer;
  -
  -    /**
  -     * Parses the project file using the supplied handler.
  -     */
  -    protected void parseProject( final String systemId,
  -                                 final ContentHandler contentHandler )
  -        throws Exception
  -    {
  -        if( getLogger().isDebugEnabled() )
  -        {
  -            final String message = REZ.getString( "ant.project-convert.notice" );
  -            getLogger().debug( message );
  -        }
  -
  -        // Create a XSLT source for the build file.
  -        final Source source = new StreamSource( systemId );
  -
  -        // Create a configuration handler for the output.
  -        final Result result = new SAXResult( contentHandler );
  -
  -        // Perform the transformation.
  -        getTransformer().transform( source, result );
  -    }
  -
  -    /**
  -     * Lazy load a Transformer with the conversion stylesheet.
  -     * @return the initialised Transformer
  -     * @throws TransformerConfigurationException
  -     */
  -    private Transformer getTransformer()
  -        throws TransformerConfigurationException
  +    protected ModelBuilder getModelBuilder()
       {
  -        // Lazy loading of stylesheet source.
  -        if( m_transformer == null )
  -        {
  -            InputStream stylesheet =
  -                this.getClass().getResourceAsStream( STYLESHEET );
  -            StreamSource stylesheetSource = new StreamSource( stylesheet );
  -            TransformerFactory xformFactory = TransformerFactory.newInstance();
  -            m_transformer = xformFactory.newTransformer( stylesheetSource );
  -        }
  -        return m_transformer;
  +        return new TransformingModelBuilder();
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message