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 TransformingModelBuilder.java
Date Sun, 09 Jun 2002 03:41:16 GMT
donaldp     2002/06/08 20:41:16

  Modified:    container/src/java/org/apache/myrmidon/components/builder
                        TransformingModelBuilder.java
  Log:
  Make it possible to pass in stylesheet to use.
  
  Revision  Changes    Path
  1.3       +27 -2     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/TransformingModelBuilder.java
  
  Index: TransformingModelBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/TransformingModelBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TransformingModelBuilder.java	19 May 2002 10:47:36 -0000	1.2
  +++ TransformingModelBuilder.java	9 Jun 2002 03:41:16 -0000	1.3
  @@ -29,7 +29,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.2 $ $Date: 2002/05/19 10:47:36 $
  + * @version $Revision: 1.3 $ $Date: 2002/06/09 03:41:16 $
    *
    * @ant.type type="model-builder" name="ant-transform"
    */
  @@ -50,6 +50,31 @@
        */
       private Transformer m_transformer;
   
  +    /**
  +     * Stylesheet to use during transformation process.
  +     */
  +    private final String m_stylesheet;
  +
  +    /**
  +     * Create transformer that uses default Ant1 transformer.
  +     */
  +    public TransformingModelBuilder()
  +    {
  +        this( STYLESHEET );
  +    }
  +
  +    /**
  +     * Create transformer that uses default specified stylesheet transformer.
  +     */
  +    public TransformingModelBuilder( final String stylesheet )
  +    {
  +        if( null == stylesheet )
  +        {
  +            throw new NullPointerException( "stylesheet" );
  +        }
  +        m_stylesheet = stylesheet;
  +    }
  +
       public ModelElement build( final String systemID )
           throws ModelException
       {
  @@ -108,7 +133,7 @@
       protected Transformer createTransformer()
           throws TransformerConfigurationException
       {
  -        final InputStream stylesheet = getClass().getResourceAsStream( STYLESHEET );
  +        final InputStream stylesheet = getClass().getResourceAsStream( m_stylesheet );
           final StreamSource source = new StreamSource( stylesheet );
           final TransformerFactory factory = TransformerFactory.newInstance();
           return factory.newTransformer( source );
  
  
  

--
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