forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From je...@apache.org
Subject cvs commit: xml-forrest/src/scratchpad/src/java/org/apache/forrest/yer/use/cocoon HierarchyGenerator.java
Date Sat, 15 Mar 2003 06:18:29 GMT
jefft       2003/03/14 22:18:29

  Modified:    src/scratchpad/src/java/org/apache/forrest/components/generator
                        XNIConfigurableFileGenerator.java
               src/scratchpad/src/java/org/apache/forrest/yer/libre
                        LibreConfigHelper.java XPathAttributeReader.java
               src/scratchpad/src/java/org/apache/forrest/yer/use/cocoon
                        HierarchyGenerator.java
  Log:
  Upgrade to latest Cocoon/Excalibur interfaces
  
  Revision  Changes    Path
  1.6       +7 -6      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XNIConfigurableFileGenerator.java	4 Nov 2002 10:53:53 -0000	1.5
  +++ XNIConfigurableFileGenerator.java	15 Mar 2003 06:18:29 -0000	1.6
  @@ -63,7 +63,8 @@
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.caching.CacheableProcessingComponent;
   import org.apache.avalon.excalibur.pool.Recyclable;
  -import org.apache.avalon.excalibur.xml.EntityResolver;
  +import org.apache.excalibur.xml.EntityResolver;
  +import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.avalon.framework.parameters.ParameterException;
   import org.apache.xerces.xni.parser.XMLParserConfiguration;
  @@ -175,7 +176,7 @@
      *              is currently not cacheable.
      */
     public java.io.Serializable generateKey() {
  -    return this.inputSource.getSystemId();
  +    return this.inputSource.getURI();
     }
   
     /**
  @@ -222,7 +223,7 @@
       } catch (IOException e){
         getLogger().warn("XNIConfigurable.generate()", e);
         throw new ResourceNotFoundException("Could not get resource to process:\n["
  -              + "src = " + this.inputSource.getSystemId() + "]\n", e);
  +              + "src = " + this.inputSource.getURI() + "]\n", e);
       } catch (SAXException e){
         getLogger().error("XNIConfigurable.generate()", e);
         throw e;
  @@ -233,7 +234,7 @@
         getLogger().error("Some strange thing just happened!!", e);
         throw new ProcessingException("XNIConfigurable.generate()",e);
       } finally {
  -      this.manager.release(catalogResolver);
  +      this.manager.release((Component)catalogResolver);
       }
     }
   }
  
  
  
  1.5       +19 -8     xml-forrest/src/scratchpad/src/java/org/apache/forrest/yer/libre/LibreConfigHelper.java
  
  Index: LibreConfigHelper.java
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/scratchpad/src/java/org/apache/forrest/yer/libre/LibreConfigHelper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LibreConfigHelper.java	5 Nov 2002 05:52:41 -0000	1.4
  +++ LibreConfigHelper.java	15 Mar 2003 06:18:29 -0000	1.5
  @@ -59,8 +59,9 @@
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.ComponentException;
  -import org.apache.avalon.excalibur.xml.Parser;
  -import org.apache.avalon.excalibur.xml.EntityResolver;
  +import org.apache.excalibur.xml.sax.SAXParser;
  +import org.apache.excalibur.xml.dom.DOMParser;
  +import org.apache.excalibur.xml.EntityResolver;
   import org.apache.xml.resolver.tools.CatalogResolver;
   //import org.apache.cocoon.components.resolver.Resolver;
   import org.apache.forrest.yer.hierarchy.HierarchyConfig;
  @@ -71,7 +72,7 @@
   //import org.xml.sax.EntityResolver;
   
   import javax.xml.parsers.SAXParserFactory;
  -import javax.xml.parsers.SAXParser;
  +// import javax.xml.parsers.SAXParser;
   import javax.xml.parsers.FactoryConfigurationError;
   import javax.xml.parsers.ParserConfigurationException;
   import javax.xml.parsers.DocumentBuilder;
  @@ -113,7 +114,7 @@
       LibreConfigBuilder lcb = new LibreConfigBuilder(parentCfg, this);
       if (this.manager != null) {
         try {
  -        Parser parser = getExcaliburParser();
  +        SAXParser parser = getExcaliburSAXParser();
           parser.parse(new InputSource(fromStream), lcb);
         } catch(SAXException e) {
           e.printStackTrace();
  @@ -134,10 +135,20 @@
       return lcb.getLibreConfig();
     }
   
  -  public Parser getExcaliburParser(){
  +  public SAXParser getExcaliburSAXParser(){
       if (this.manager == null) return null;
       try {
  -      return (Parser)this.manager.lookup(Parser.ROLE);
  +      return (SAXParser)this.manager.lookup(SAXParser.ROLE);
  +    } catch(ComponentException e) {
  +      e.printStackTrace();
  +    }
  +    return null;
  +  }
  +
  +  public DOMParser getExcaliburDOMParser(){
  +    if (this.manager == null) return null;
  +    try {
  +      return (DOMParser)this.manager.lookup(DOMParser.ROLE);
       } catch(ComponentException e) {
         e.printStackTrace();
       }
  @@ -155,7 +166,7 @@
         // but namespace-aware.
         spf.setNamespaceAware(true);
         spf.setValidating(false);
  -      SAXParser sp = spf.newSAXParser();
  +      javax.xml.parsers.SAXParser sp = spf.newSAXParser();
         parser = sp.getXMLReader();
         parser.setEntityResolver(getCatalogResolver());
       } catch(FactoryConfigurationError error) {
  
  
  
  1.4       +3 -3      xml-forrest/src/scratchpad/src/java/org/apache/forrest/yer/libre/XPathAttributeReader.java
  
  Index: XPathAttributeReader.java
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/scratchpad/src/java/org/apache/forrest/yer/libre/XPathAttributeReader.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XPathAttributeReader.java	5 Nov 2002 05:52:41 -0000	1.3
  +++ XPathAttributeReader.java	15 Mar 2003 06:18:29 -0000	1.4
  @@ -61,7 +61,7 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.DOMException;
   import org.apache.xpath.XPathAPI;
  -import org.apache.avalon.excalibur.xml.Parser;
  +import org.apache.excalibur.xml.dom.DOMParser;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
   
  @@ -129,7 +129,7 @@
     public Document getDOMDocument(InputStream inXML)  {
   
       Document doc = null;
  -    Parser excaliburParser = this.helper.getExcaliburParser();
  +    DOMParser excaliburParser = this.helper.getExcaliburDOMParser();
       if (excaliburParser != null) {
         try {
           doc = excaliburParser.parseDocument(new InputSource(inXML));
  
  
  
  1.6       +3 -3      xml-forrest/src/scratchpad/src/java/org/apache/forrest/yer/use/cocoon/HierarchyGenerator.java
  
  Index: HierarchyGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/scratchpad/src/java/org/apache/forrest/yer/use/cocoon/HierarchyGenerator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HierarchyGenerator.java	9 Jan 2003 00:06:46 -0000	1.5
  +++ HierarchyGenerator.java	15 Mar 2003 06:18:29 -0000	1.6
  @@ -117,7 +117,7 @@
       super.setup(resolver, objectModel, src, par);
       //this is a dirty hack!
         try {
  -          this.startLocation = resolver.resolveURI(super.source).getSystemId();
  +          this.startLocation = resolver.resolveURI(super.source).getURI();
             this.theDepth = par.getParameterAsInteger(DEPTH_PARAMETER, DEPTH_DEFAULT);
         } catch (SourceException e) {
             getLogger().error("Can not resolve " + super.source);
  
  
  

Mime
View raw message