vgritsenko 2003/12/23 04:22:46
Modified: java/src/org/apache/xindice/client/xmldb/embed CollectionImpl.java java/src/org/apache/xindice/client/xmldb/xmlrpc CollectionImpl.java Log: XML-RPC: add TODO for BinaryResource support Revision Changes Path 1.28 +3 -4 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.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- CollectionImpl.java 22 Dec 2003 14:13:04 -0000 1.27 +++ CollectionImpl.java 23 Dec 2003 12:22:46 -0000 1.28 @@ -199,7 +199,6 @@ * method has been called on the <code>Collection</code><br /> */ public void storeResource(Resource res) throws XMLDBException { - if (res.getContent() == null) { throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "No resource data"); @@ -230,7 +229,6 @@ } } else if (res instanceof XMLResource) { - try { String name = ""; Node content = ((XMLResourceImpl) res).getContentAsDOM(); @@ -249,6 +247,7 @@ throw FaultCodes.createXMLDBException(ErrorCodes.INVALID_RESOURCE, "Invalid resource: " + res.getId(), e); } + } else { throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "Only XMLResource and BinaryResource supported"); 1.37 +4 -13 xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/CollectionImpl.java Index: CollectionImpl.java =================================================================== RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/CollectionImpl.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- CollectionImpl.java 11 Dec 2003 14:06:16 -0000 1.36 +++ CollectionImpl.java 23 Dec 2003 12:22:46 -0000 1.37 @@ -292,22 +292,19 @@ */ public void storeResource(Resource res) throws XMLDBException { - if (!(res instanceof XMLResource)) { - throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "Only XML resources supported"); - } if (res.getContent() == null) { throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "no resource data"); } checkOpen(); try { - Hashtable params = new Hashtable(); params.put(RPCDefaultMessage.COLLECTION, collPath); params.put(RPCDefaultMessage.NAME, res.getId()); params.put(RPCDefaultMessage.DOCUMENT, res.getContent()); String name = (String) runRemoteCommand("InsertDocument", params); + // TODO: BinaryResource ((XMLResourceImpl) res).setId(name); } catch (XMLDBException x) { @@ -344,7 +341,6 @@ public Collection getChildCollection(String name) throws XMLDBException { if (name.indexOf('/') != -1) { - throw new XMLDBException(ErrorCodes.INVALID_COLLECTION); } @@ -449,11 +445,6 @@ */ public void removeResource(Resource res) throws XMLDBException { - if (!(res instanceof XMLResource)) { - 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 " + @@ -462,7 +453,7 @@ checkOpen(); try { - + // TODO: Test BinaryResource workings Hashtable params = new Hashtable(); params.put(RPCDefaultMessage.COLLECTION, collPath); params.put(RPCDefaultMessage.NAME, res.getId());