vgritsenko 2003/12/22 06:13:05
Modified: java/src/org/apache/xindice/client/xmldb/embed
CollectionImpl.java
Log:
Support remove binary resource in embed driver
Revision Changes Path
1.27 +7 -13
xml-xindice/java/src/org/apache/xindice/client/xmldb/embed/CollectionImpl.java
Index: CollectionImpl.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/embed/CollectionImpl.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- CollectionImpl.java 19 Dec 2003 13:55:28 -0000 1.26
+++ CollectionImpl.java 22 Dec 2003 14:13:04 -0000 1.27
@@ -145,7 +145,6 @@
if (entry == null) {
return null;
} else if (entry instanceof Document) {
-
Document doc = (Document) entry;
// This should probably just pass the document.
@@ -157,7 +156,7 @@
return new BinaryResourceImpl(id, entry);
} else {
throw new XMLDBException(ErrorCodes.UNKNOWN_RESOURCE_TYPE,
- "Internal error: unexpected type "
+ entry.getClass().getName());
+ "Internal error: Unexpected
resource type " + entry.getClass().getName());
}
} catch (Exception e) {
throw FaultCodes.createXMLDBException("Resource not available: "
+ id, e);
@@ -248,7 +247,7 @@
}
} catch (Exception e) {
throw
FaultCodes.createXMLDBException(ErrorCodes.INVALID_RESOURCE,
- "Invalid resource:" +
res.getId(), e);
+ "Invalid resource: " +
res.getId(), e);
}
} else {
throw new XMLDBException(ErrorCodes.INVALID_RESOURCE,
@@ -387,15 +386,10 @@
*/
public void removeResource(Resource res) throws XMLDBException {
- if (!(res instanceof XMLResource)) {
+ if (res == null || res.getId() == null || res.getId().length() == 0)
{
+ // Query result resource will have null ID
throw new XMLDBException(ErrorCodes.INVALID_RESOURCE,
- "Only XML resources supported");
- }
-
- if (res.getId() == null) {
- throw new XMLDBException(ErrorCodes.VENDOR_ERROR,
- "This resource is a query result and
can " +
- "not be removed from the database.");
+ "Resource passed is null or its ID is
empty.");
}
checkOpen();