dims 01/07/23 06:50:29
Modified: src/org/apache/cocoon/components/language/markup
AbstractMarkupLanguage.java
src/org/apache/cocoon/components/language/markup/sitemap
SitemapMarkupLanguage.java
src/org/apache/cocoon/components/language/markup/xsp
XSPMarkupLanguage.java
Log:
Use SourceResolver in AbstractMarkupLanguage.java
Revision Changes Path
1.6 +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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AbstractMarkupLanguage.java 2001/07/07 11:43:14 1.5
+++ AbstractMarkupLanguage.java 2001/07/23 13:50:29 1.6
@@ -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 <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @version CVS $Revision: 1.5 $ $Date: 2001/07/07 11:43:14 $
+ * @version CVS $Revision: 1.6 $ $Date: 2001/07/23 13:50:29 $
*/
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);
}
1.3 +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.3
diff -u -r1.2 -r1.3
--- SitemapMarkupLanguage.java 2001/05/22 14:33:37 1.2
+++ SitemapMarkupLanguage.java 2001/07/23 13:50:29 1.3
@@ -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 @@
* <a href="http://xml.apache.org/cocoon/sitemap.html">Sitemap</a>.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/22 14:33:37 $
+ * @version CVS $Revision: 1.3 $ $Date: 2001/07/23 13:50:29 $
*/
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);
1.3 +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.3
diff -u -r1.2 -r1.3
--- XSPMarkupLanguage.java 2001/05/22 14:34:19 1.2
+++ XSPMarkupLanguage.java 2001/07/23 13:50:29 1.3
@@ -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 <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Sahuc</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/22 14:34:19 $
+ * @version CVS $Revision: 1.3 $ $Date: 2001/07/23 13:50:29 $
*/
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: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]