forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cross...@apache.org
Subject cvs commit: xml-forrest/src/scratchpad/src/java/org/apache/forrest/components/generator XNIConfigurableFileGenerator.java
Date Fri, 12 Jul 2002 07:14:29 GMT
crossley    2002/07/12 00:14:29

  Modified:    src/scratchpad/src/java/org/apache/forrest/components/generator
                        XNIConfigurableFileGenerator.java
  Log:
  Move release() of catalog component moved to finally{} block.
  Submitted by: Marc Portier <mpo@outerthought.org>
  
  Revision  Changes    Path
  1.3       +15 -14    xml-forrest/src/scratchpad/src/java/org/apache/forrest/components/generator/XNIConfigurableFileGenerator.java
  
  Index: XNIConfigurableFileGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/scratchpad/src/java/org/apache/forrest/components/generator/XNIConfigurableFileGenerator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XNIConfigurableFileGenerator.java	12 Jul 2002 01:58:07 -0000	1.2
  +++ XNIConfigurableFileGenerator.java	12 Jul 2002 07:14:29 -0000	1.3
  @@ -110,7 +110,7 @@
   {
   
     /** Default constructor
  -   * 
  +   *
      */
     public XNIConfigurableFileGenerator()
     {
  @@ -205,28 +205,27 @@
      */
     public void generate()
     throws IOException, SAXException, ProcessingException {
  +    EntityResolver catalogResolver = null;
  +    final String[] extendRecognizedProperties = {FULL_ENTITY_RESOLVER_PROPERTY_URI};
       try {
         getLogger().debug("XNIConfigurable generator start generate()");
   
  -      //TODO: The Configurable Parser should become a full blown avalon component
  -      //      And the resolver should be configured and composed on that level.
  -
  -      final EntityResolver catalogResolver = (EntityResolver)this.manager.lookup(EntityResolver.ROLE);
  -      final String[] extendRecognizedProperties = {FULL_ENTITY_RESOLVER_PROPERTY_URI};
  +      //TODO?: Make XNIConfigurableParser an avalon component in it's own right
  +      //      Let the resolver and namespace stuff be configured and composed on that level.
  +      //  some ideas on this: (any others?)
  +      // - build a XNIConfigurableParser Component Interface with its ROLE
  +      // - add a XNIConfigurableParserSelector that can select() based on full qualified
class name
  +      // - and release() after usage
  +      // the select method could do 6 next lines:
  +      catalogResolver = (EntityResolver)this.manager.lookup(EntityResolver.ROLE);
         parserConfig.addRecognizedProperties(extendRecognizedProperties);
         parserConfig.setProperty(FULL_ENTITY_RESOLVER_PROPERTY_URI, new EntityResolverWrapper(catalogResolver));
         final XMLReader parser = new AbstractSAXParser(parserConfig){};
         parser.setFeature("http://xml.org/sax/features/namespaces", true);
         parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
  -
  -      //parser.setEntityResolver(catalogResolver);
  -
  -
         parser.setContentHandler(this.contentHandler);
         parser.parse(this.inputSource.getInputSource());
   
  -      // TODO: and afterwards we could release that Parser.
  -      this.manager.release(catalogResolver);
       } catch (IOException e){
         getLogger().warn("XNIConfigurable.generate()", e);
         throw new ResourceNotFoundException("Could not get resource to process:\n["
  @@ -242,6 +241,8 @@
       } catch (Exception e){
         getLogger().error("Some strange thing just happened!!", e);
         throw new ProcessingException("XNIConfigurable.generate()",e);
  +    } finally {
  +      this.manager.release(catalogResolver);
       }
     }
   }
  
  
  

Mime
View raw message