vgritsenko 2003/12/23 18:52:44
Modified: java/src/org/apache/xindice/client/xmldb/embed CollectionImpl.java java/src/org/apache/xindice/client/xmldb/resources BinaryResourceImpl.java Log: As per XML:DB API, BinaryResource supports only byte[] data. Revision Changes Path 1.29 +6 -6 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.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- CollectionImpl.java 23 Dec 2003 12:22:46 -0000 1.28 +++ CollectionImpl.java 24 Dec 2003 02:52:44 -0000 1.29 @@ -145,15 +145,15 @@ if (entry == null) { return null; } else if (entry instanceof Document) { - Document doc = (Document) entry; + DocumentImpl doc = (DocumentImpl) entry; // This should probably just pass the document. return new XMLResourceImpl(id, id, this, - ((DocumentImpl) doc).getSymbols(), - ((DocumentImpl) doc).getDataBytes()); + doc.getSymbols(), + doc.getDataBytes()); } else if (entry instanceof byte[]) { - return new BinaryResourceImpl(id, entry); + return new BinaryResourceImpl(id, this, (byte[])entry); } else { throw new XMLDBException(ErrorCodes.UNKNOWN_RESOURCE_TYPE, "Internal error: Unexpected resource type " + entry.getClass().getName()); 1.5 +10 -8 xml-xindice/java/src/org/apache/xindice/client/xmldb/resources/BinaryResourceImpl.java Index: BinaryResourceImpl.java =================================================================== RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/resources/BinaryResourceImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- BinaryResourceImpl.java 22 Dec 2003 14:07:13 -0000 1.4 +++ BinaryResourceImpl.java 24 Dec 2003 02:52:44 -0000 1.5 @@ -64,23 +64,25 @@ import org.xmldb.api.modules.BinaryResource; /** - * BinaryResourceImpl provides an implementation to handle binary - * resource . + * BinaryResourceImpl provides an implementation to handle XML:DB binary + * resource. + * + * As per XML:DB spec, binary resource supports only byte[] data. * * @version CVS $Revision$, $Date$ */ public class BinaryResourceImpl implements BinaryResource { private String id; - private Object content; + private byte[] content; private Collection collection; - public BinaryResourceImpl(String id, Object content) { + public BinaryResourceImpl(String id, byte[] content) { this(id, null, content); } - public BinaryResourceImpl(String id, Collection collection, Object content) { + public BinaryResourceImpl(String id, Collection collection, byte[] content) { this.id = id; this.content = content; this.collection = collection; @@ -118,7 +120,7 @@ * @see org.xmldb.api.base.Resource#setContent(Object) */ public void setContent(Object content) throws XMLDBException { - this.content = content; + this.content = (byte[])content; } public void setId(String id) {