cziegeler 01/09/06 07:04:11
Modified: src/org/apache/cocoon/components/source SitemapSource.java
URLSource.java
src/org/apache/cocoon/components/xslt XSLTProcessorImpl.java
Log:
Added automatic refreshing of Source objects according to Berins proposal
Revision Changes Path
1.20 +9 -1
xml-cocoon2/src/org/apache/cocoon/components/source/SitemapSource.java
Index: SitemapSource.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/source/SitemapSource.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- SitemapSource.java 2001/09/06 11:10:54 1.19
+++ SitemapSource.java 2001/09/06 14:04:11 1.20
@@ -48,7 +48,7 @@
* Description of a source which is defined by a pipeline.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.19 $ $Date: 2001/09/06 11:10:54 $
+ * @version CVS $Revision: 1.20 $ $Date: 2001/09/06 14:04:11 $
*/
public final class SitemapSource
@@ -88,6 +88,9 @@
/** The <code>SAXException</code> if unable to get resource */
private SAXException exception;
+ /** Do I need a refresh ? */
+ private boolean needsRefresh;
+
/**
* Construct a new object
*/
@@ -152,6 +155,7 @@
* is not possible to determine the date.
*/
public long getLastModified() {
+ if (this.needsRefresh == true) this.refresh();
return this.lastModificationDate;
}
@@ -172,6 +176,7 @@
if (this.exception != null) {
throw new ProcessingException(this.exception);
}
+ if (this.needsRefresh == true) this.refresh();
SitemapComponentSelector serializerSelector = null;
Serializer serializer = null;
try {
@@ -248,6 +253,7 @@
this.exception = new SAXException("Could not get sitemap source "
+ this.systemId, e);
}
+ this.needsRefresh = false;
}
/**
@@ -268,6 +274,7 @@
if (this.exception != null) {
throw this.exception;
}
+ if (this.needsRefresh == true) this.refresh();
try {
XMLConsumer consumer;
if (contentHandler instanceof XMLConsumer) {
@@ -303,6 +310,7 @@
if (this.redirectSource != null) this.redirectSource.recycle();
this.redirectSource = null;
this.exception = null;
+ this.needsRefresh = true;
}
public void recycle() {
1.12 +8 -3
xml-cocoon2/src/org/apache/cocoon/components/source/URLSource.java
Index: URLSource.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/source/URLSource.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- URLSource.java 2001/09/06 11:10:54 1.11
+++ URLSource.java 2001/09/06 14:04:11 1.12
@@ -31,7 +31,7 @@
* Description of a source which is described by an URL.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.11 $ $Date: 2001/09/06 11:10:54 $
+ * @version CVS $Revision: 1.12 $ $Date: 2001/09/06 14:04:11 $
*/
public final class URLSource implements ModifiableSource {
@@ -128,8 +128,10 @@
*/
public InputStream getInputStream()
throws IOException {
+ this.getInfos();
+ InputStream input = null;
if (this.isFile == true) {
- return new FileInputStream(this.systemId.substring(FILE.length()));
+ input = new FileInputStream(this.systemId.substring(FILE.length()));
} else {
if (this.connection == null) {
this.connection = this.url.openConnection();
@@ -139,8 +141,11 @@
this.connection.setRequestProperty("Authorization","Basic
"+encodeBASE64(userInfo));
}
}
- return this.connection.getInputStream();
+
+ input = this.connection.getInputStream();
+ this.connection = null; // make sure a new connection is created next
time
}
+ return input;
}
private static boolean checkedURLClass = false;
1.5 +0 -3
xml-cocoon2/src/org/apache/cocoon/components/xslt/XSLTProcessorImpl.java
Index: XSLTProcessorImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/xslt/XSLTProcessorImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSLTProcessorImpl.java 2001/09/05 07:00:10 1.4
+++ XSLTProcessorImpl.java 2001/09/06 14:04:11 1.5
@@ -271,9 +271,6 @@
store.remove(is.getSystemId());
}
}
- if (stylesheet instanceof ModifiableSource) {
- ((ModifiableSource)stylesheet).refresh();
- }
return templates;
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]