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/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder DefaultProjectBuilder.java
Date Sun, 17 Jun 2001 00:27:18 GMT
donaldp     01/06/16 17:27:18

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/components/builder
                        DefaultProjectBuilder.java
  Log:
  Modified interface to reflect the fact it is no longer a flyweight and
  thus can be passed Parameters via standard mechanisms (Parameterizable).
  
  Also rearranged implementation so that it is friendly for inheritance (Still needs lots
more work).
  
  Revision  Changes    Path
  1.9       +32 -14    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java
  
  Index: DefaultProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultProjectBuilder.java	2001/06/14 12:11:05	1.8
  +++ DefaultProjectBuilder.java	2001/06/17 00:27:18	1.9
  @@ -51,7 +51,7 @@
        * @exception IOException if an error occurs
        * @exception Exception if an error occurs
        */
  -    public Project build( final String source, final Parameters parameters )
  +    public Project build( final String source )
           throws Exception
       {
           final File file = new File( source );
  @@ -62,25 +62,15 @@
           throws Exception
       {
           final String systemID = file.toURL().toString();
  -
  -        Project result = (Project)projects.get( systemID );
  +        final Project result = (Project)projects.get( systemID );
           if( null != result )
           {
               return result;
           }
   
  -        final SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
  -        final SAXParser saxParser = saxParserFactory.newSAXParser();
  -        final XMLReader parser = saxParser.getXMLReader();
  -        parser.setFeature( "http://xml.org/sax/features/namespace-prefixes", false );
  -        parser.setFeature( "http://xml.org/sax/features/namespaces", false );
  -        //parser.setFeature( "http://xml.org/sax/features/validation", false );
  -
           final SAXConfigurationHandler handler = new SAXConfigurationHandler();
  -        parser.setContentHandler( handler );
  -        parser.setErrorHandler( handler );
   
  -        parser.parse( systemID );
  +        process( systemID, handler );
   
           final Configuration configuration = handler.getConfiguration();
           final DefaultProject project = buildProject( file, configuration );
  @@ -93,6 +83,34 @@
           return project;
       }
   
  +    protected void process( final String systemID, 
  +                            final SAXConfigurationHandler handler )
  +        throws Exception
  +    {
  +        final SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
  +        final SAXParser saxParser = saxParserFactory.newSAXParser();
  +        final XMLReader parser = saxParser.getXMLReader();
  +        parser.setFeature( "http://xml.org/sax/features/namespace-prefixes", false );
  +        parser.setFeature( "http://xml.org/sax/features/namespaces", false );
  +        //parser.setFeature( "http://xml.org/sax/features/validation", false );
  +
  +        parser.setContentHandler( handler );
  +        parser.setErrorHandler( handler );
  +        parser.parse( systemID );
  +/*
  +        // Create a transform factory instance.
  +        final TransformerFactory factory = TransformerFactory.newInstance();
  +    
  +        // Create a transformer for the stylesheet.
  +        final Transformer transformer = factory.newTransformer( new StreamSource(xslID)
);
  +
  +        final Result result = new SAXResult( handler );
  +
  +        // Transform the source XML to System.out.
  +        transformer.transform( new StreamSource(sourceID), result );
  +*/
  +    }
  +
       /**
        * build project from configuration.
        *
  @@ -139,7 +157,7 @@
        * @param configuration the Configuration
        * @exception Exception if an error occurs
        */
  -    private void buildTopLevelProject( final DefaultProject project,
  +    private void buildTopLevelProject( final DefaultProject project, 
                                          final Configuration configuration,
                                          final HashMap projects )
           throws Exception
  
  
  

Mime
View raw message