cziegeler 2003/07/04 04:20:51
Modified: . status.xml
src/blocks/xmldb/java/org/apache/cocoon/components/source/impl
XMLDBSource.java
Log:
Applying patch 20115
Revision Changes Path
1.75 +4 -2 cocoon-2.1/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/status.xml,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- status.xml 4 Jul 2003 08:59:23 -0000 1.74
+++ status.xml 4 Jul 2003 11:20:51 -0000 1.75
@@ -183,7 +183,9 @@
<changes>
<release version="@version@" date="@date@">
- <action dev="NN" type="add">Dummy action</action>
+ <action dev="CZ" type="fix" fixes-bug="20115" due-to="Tim Goodwin"
due-to-email="[EMAIL PROTECTED]">
+ Applied patch for implementing exists for the xmldb source.
+ </action>
</release>
<release version="2.1m3" date="July 5 2003">
<action dev="JH" type="update">
1.5 +33 -3
cocoon-2.1/src/blocks/xmldb/java/org/apache/cocoon/components/source/impl/XMLDBSource.java
Index: XMLDBSource.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/xmldb/java/org/apache/cocoon/components/source/impl/XMLDBSource.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLDBSource.java 16 May 2003 23:24:32 -0000 1.4
+++ XMLDBSource.java 4 Jul 2003 11:20:51 -0000 1.5
@@ -384,8 +384,38 @@
}
public boolean exists() {
- // FIXME
- return true;
+ final String col = url.substring(0, url.lastIndexOf('/'));
+ final String res = url.substring(url.lastIndexOf('/') + 1);
+ boolean result = true;
+
+ /* Ignore the query: we're just testing if the document exists. */
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Testing existence of resource `" + res + "'
from collection `" + url + "'; query (ignored) = `" + this.query + "'");
+ }
+
+ Collection collection = null;
+ try {
+ collection = DatabaseManager.getCollection(col, user, password);
+ if (collection == null) {
+ result = false;
+ } else {
+ XMLResource xmlResource = (XMLResource)
collection.getResource(res);
+ if (xmlResource == null) {
+ result = false;
+ }
+ }
+ } catch (XMLDBException xde) {
+ result = false;
+ } finally {
+ if (collection != null) {
+ try {
+ collection.close();
+ } catch (XMLDBException ignored) {
+ }
+ }
+ }
+
+ return result;
}
public String getMimeType() {