Return-Path: Delivered-To: apmail-xml-cocoon-cvs-archive@xml.apache.org Received: (qmail 26094 invoked by uid 500); 23 Jul 2001 13:52:46 -0000 Mailing-List: contact cocoon-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: cocoon-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cocoon-cvs@xml.apache.org Received: (qmail 26085 invoked by uid 500); 23 Jul 2001 13:52:46 -0000 Delivered-To: apmail-xml-cocoon2-cvs@apache.org Date: 23 Jul 2001 13:50:19 -0000 Message-ID: <20010723135019.72042.qmail@icarus.apache.org> From: dims@apache.org To: xml-cocoon2-cvs@apache.org Subject: cvs commit: xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp XSPMarkupLanguage.java X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N dims 01/07/23 06:50:19 Modified: src/org/apache/cocoon/components/language/markup Tag: cocoon_20_branch AbstractMarkupLanguage.java src/org/apache/cocoon/components/language/markup/sitemap Tag: cocoon_20_branch SitemapMarkupLanguage.java src/org/apache/cocoon/components/language/markup/xsp Tag: cocoon_20_branch XSPMarkupLanguage.java Log: Use SourceResolver in AbstractMarkupLanguage.java Revision Changes Path No revision No revision 1.4.2.2 +11 -20 xml-cocoon2/src/org/apache/cocoon/components/language/markup/AbstractMarkupLanguage.java Index: AbstractMarkupLanguage.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/AbstractMarkupLanguage.java,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -u -r1.4.2.1 -r1.4.2.2 --- AbstractMarkupLanguage.java 2001/07/07 19:07:49 1.4.2.1 +++ AbstractMarkupLanguage.java 2001/07/23 13:50:19 1.4.2.2 @@ -35,7 +35,9 @@ import org.apache.cocoon.components.store.Store; import org.apache.cocoon.components.url.URLFactory; import org.apache.cocoon.environment.SourceResolver; +import org.apache.cocoon.environment.Source; import org.apache.cocoon.util.IOUtils; +import org.apache.cocoon.ProcessingException; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -49,7 +51,7 @@ * logicsheets as the only means of code generation. Code generation should be decoupled from this context!!! * @author Ricardo Rocha * @author Davanum Srinivas - * @version CVS $Revision: 1.4.2.1 $ $Date: 2001/07/07 19:07:49 $ + * @version CVS $Revision: 1.4.2.2 $ $Date: 2001/07/23 13:50:19 $ */ public abstract class AbstractMarkupLanguage extends AbstractLoggable implements MarkupLanguage, Composable, Configurable { /** The supported language table */ @@ -310,38 +312,25 @@ * @exception SAXException Logicsheet parse error */ protected void addLogicsheetToList(LanguageDescriptor language, String logicsheetLocation, SourceResolver resolver) - throws MalformedURLException, IOException, SAXException { - InputSource inputSource = null; - - URL url = null; - URLFactory urlFactory = null; - try { - urlFactory = (URLFactory)this.manager.lookup(URLFactory.ROLE); - url = urlFactory.getURL(logicsheetLocation); - } catch (Exception e) { - getLogger().error("cannot get logicsheet at " + logicsheetLocation); - new SAXException ("cannot get logicsheet at " + logicsheetLocation, e); - } finally { - if(urlFactory != null) this.manager.release((Component)urlFactory); - } + throws MalformedURLException, IOException, SAXException, ProcessingException { + Source inputSource = resolver.resolve(logicsheetLocation); + URL url = new URL(inputSource.getSystemId()); getLogger().debug("Logicsheet Used:" + url.toExternalForm()); - inputSource = new InputSource(url.openStream()); - inputSource.setSystemId(url.toString()); - String logicsheetName = url.toExternalForm(); + String logicsheetName = inputSource.getSystemId(); CachedURL entry = (CachedURL)this.logicsheetCache.get(logicsheetName); Logicsheet logicsheet = null; if (entry == null) { logicsheet = new Logicsheet(); logicsheet.setLogger(getLogger()); - logicsheet.setInputSource(inputSource); + logicsheet.setInputSource(inputSource.getInputSource()); entry = new CachedURL(url, logicsheet); entry.setLogger(getLogger()); this.logicsheetCache.store(logicsheetName, entry); } logicsheet = entry.getLogicsheet(); if (entry.hasChanged()) { - logicsheet.setInputSource(inputSource); + logicsheet.setInputSource(inputSource.getInputSource()); } if (entry.isFile()) { this.addDependency(IOUtils.getFullFilename(entry.getFile())); @@ -585,6 +574,8 @@ // Add the language stylesheet (Always the last one) AbstractMarkupLanguage.this.addLogicsheetToList(language, this.language.getLogicsheet(), resolver); AbstractMarkupLanguage.this.addLogicsheetsToGenerator(this.logicsheetMarkupGenerator); + } catch (ProcessingException pe) { + throw new SAXException (pe); } catch (IOException ioe) { throw new SAXException(ioe); } No revision No revision 1.2.2.1 +8 -1 xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/SitemapMarkupLanguage.java Index: SitemapMarkupLanguage.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/SitemapMarkupLanguage.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- SitemapMarkupLanguage.java 2001/05/22 14:33:37 1.2 +++ SitemapMarkupLanguage.java 2001/07/23 13:50:19 1.2.2.1 @@ -22,6 +22,7 @@ import org.apache.cocoon.components.language.markup.LogicsheetCodeGenerator; import org.apache.cocoon.components.language.programming.ProgrammingLanguage; import org.apache.cocoon.environment.SourceResolver; +import org.apache.cocoon.ProcessingException; import org.apache.log.Logger; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -35,7 +36,7 @@ * Sitemap. * * @author Giacomo Pati - * @version CVS $Revision: 1.2 $ $Date: 2001/05/22 14:33:37 $ + * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/07/23 13:50:19 $ */ public class SitemapMarkupLanguage extends AbstractMarkupLanguage { @@ -295,6 +296,9 @@ SitemapMarkupLanguage.this.addLogicsheetToList( language, href, this.resolver ); + } catch (ProcessingException pe) { + log.warn("ProcessingException in SitemapMarkupLanguage", pe); + throw new SAXException (pe); } catch (IOException ioe) { log.warn("IOException in SitemapMarkupLanguage", ioe); throw new SAXException (ioe); @@ -337,6 +341,9 @@ SitemapMarkupLanguage.this.addLogicsheetToList( language, location,this.resolver ); + } catch (ProcessingException pe) { + log.warn("ProcessingException in SitemapMarkupLanguage", pe); + throw new SAXException (pe); } catch (IOException ioe) { log.warn("IOException in SitemapMarkupLanguage", ioe); throw new SAXException (ioe); No revision No revision 1.2.2.1 +8 -1 xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPMarkupLanguage.java Index: XSPMarkupLanguage.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPMarkupLanguage.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- XSPMarkupLanguage.java 2001/05/22 14:34:19 1.2 +++ XSPMarkupLanguage.java 2001/07/23 13:50:19 1.2.2.1 @@ -22,6 +22,7 @@ import org.apache.cocoon.components.language.markup.LogicsheetCodeGenerator; import org.apache.cocoon.components.language.programming.ProgrammingLanguage; import org.apache.cocoon.environment.SourceResolver; +import org.apache.cocoon.ProcessingException; import org.apache.log.Logger; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -36,7 +37,7 @@ * * @author Ricardo Rocha * @author Sebastien Sahuc - * @version CVS $Revision: 1.2 $ $Date: 2001/05/22 14:34:19 $ + * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/07/23 13:50:19 $ */ public class XSPMarkupLanguage extends AbstractMarkupLanguage { @@ -357,6 +358,9 @@ XSPMarkupLanguage.this.addLogicsheetToList( language, href, this.resolver ); + } catch (ProcessingException pe) { + log.warn("ProcessingException in SitemapMarkupLanguage", pe); + throw new SAXException (pe); } catch (IOException ioe) { log.warn("XSPMarkupLanguage.processingInstruction", ioe); throw new SAXException (ioe); @@ -409,6 +413,9 @@ XSPMarkupLanguage.this.addLogicsheetToList( language, location, this.resolver ); + } catch (ProcessingException pe) { + log.warn("XSPMarkupLanguage.startElement", pe); + throw new SAXException (pe); } catch (IOException ioe) { log.warn("XSPMarkupLanguage.startElement", ioe); throw new SAXException (ioe); ---------------------------------------------------------------------- In case of troubles, e-mail: webmaster@xml.apache.org To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org For additional commands, e-mail: cocoon-cvs-help@xml.apache.org