svn commit: r541504 [1/7] - in /xml/xindice/trunk: ./ config/ java/scratchpad/webadmin/ java/src/org/apache/xindice/client/xmldb/embed/ java/src/org/apache/xindice/core/ java/src/org/apache/xindice/core/data/ java/src/org/apache/xindice/core/filer/ jav...

[email protected]
Newsgroups gmane.text.xml.xindice.devel
Message-ID <[email protected]>
Author: vgritsenko
Date: Thu May 24 18:43:39 2007
New Revision: 541504

URL: http://svn.apache.org/viewvc?view=rev&rev=541504
Log:
      <action dev="VG" type="add" fixes-bug="42478" due-to="Natalia Shilenkova">
        Add WebAdmin to the Xindice core (from scratchpad).
      </action>


Added:
    xml/xindice/trunk/config/MimeTypes.xml   (with props)
    xml/xindice/trunk/config/webadmin.xml   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/core/data/Entry.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/
      - copied from r541498, xml/xindice/trunk/java/scratchpad/webadmin/src/org/apache/xindice/webadmin/
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/Location.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/PartialResponse.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/WebAdminManager.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/HtmlDatabaseViewer.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/ContentResourceViewer.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/ListDatabaseViewer.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/MetadataResourceViewer.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/DAVRequest.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/DAVResponse.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/DAVComponent.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/props/
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/props/ContentType.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/props/CreationDate.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/props/DAVProperty.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/props/DisplayName.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/props/LastModified.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/props/ResourceType.java   (with props)
    xml/xindice/trunk/java/src/org/apache/xindice/xml/Xml2HtmlWriter.java
      - copied, changed from r541498, xml/xindice/trunk/java/scratchpad/webadmin/src/org/apache/xindice/xml/Xml2HtmlWriter.java
    xml/xindice/trunk/lib/commons-fileupload.jar   (with props)
Removed:
    xml/xindice/trunk/java/scratchpad/webadmin/
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/WebAdminContainer.java
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/util/CollectionConfigurationHelperImpl.java
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/util/DAVOperationsImpl.java
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/util/MimeTableImpl.java
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/ContentsResourceViewer.java
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/DAVComponent.java
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Trace.java
Modified:
    xml/xindice/trunk/build.xml
    xml/xindice/trunk/config/commands.xml   (props changed)
    xml/xindice/trunk/config/symbols.xml   (props changed)
    xml/xindice/trunk/config/system.xml   (props changed)
    xml/xindice/trunk/config/web.xml   (contents, props changed)
    xml/xindice/trunk/config/xindice.xml   (props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/client/xmldb/embed/CollectionImpl.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/DocumentCache.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/FaultCodes.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/filer/BTreeFiler.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/filer/FSFiler.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Filer.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/filer/HashFiler.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/filer/MemFiler.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/filer/SizeableMemFiler.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/query/XPathQueryResolver.java
    xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/GetResource.java
    xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/InsertResource.java
    xml/xindice/trunk/java/src/org/apache/xindice/util/StringUtilities.java
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/WebAdminServlet.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/util/CollectionConfigurationHelper.java
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/util/DAVOperations.java
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/util/MimeTable.java
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/HtmlCollectionViewer.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/HtmlResourceViewer.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/HtmlViewerComponent.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/CollectionConfigurationViewer.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/CollectionIndexesViewer.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/CreateCollectionViewer.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/DeleteCollectionViewer.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/DeleteResourceViewer.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/ListCollectionViewer.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/MetadataCollectionViewer.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/UploadCollectionViewer.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/XPathSearchCollectionViewer.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/viewer/components/XUpdateCollectionViewer.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/WebdavStatus.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Copy.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Delete.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Get.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Head.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Mkcol.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Move.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Options.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Post.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Propfind.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Proppatch.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Put.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/components/Search.java   (contents, props changed)
    xml/xindice/trunk/java/src/org/apache/xindice/xml/TextWriter.java
    xml/xindice/trunk/java/tests/src/org/apache/xindice/core/filer/BTreeFilerTest.java
    xml/xindice/trunk/java/tests/src/org/apache/xindice/core/filer/FilerTestBase.java
    xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/ValueIndexerTest.java
    xml/xindice/trunk/status.xml

Modified: xml/xindice/trunk/build.xml
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/build.xml?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/build.xml (original)
+++ xml/xindice/trunk/build.xml Thu May 24 18:43:39 2007
@@ -313,6 +313,8 @@
             <webinf dir=".">
                 <include name="${config.dir}/system.xml"/>
                 <include name="${config.dir}/commands.xml"/>
+                <include name="${config.dir}/webadmin.xml"/>
+                <include name="${config.dir}/MimeTypes.xml"/>
             </webinf>
             <lib refid="endorsed.jars"/>
             <lib refid="core.jars"/>

Added: xml/xindice/trunk/config/MimeTypes.xml
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/config/MimeTypes.xml?view=auto&rev=541504
==============================================================================
--- xml/xindice/trunk/config/MimeTypes.xml (added)
+++ xml/xindice/trunk/config/MimeTypes.xml Thu May 24 18:43:39 2007
@@ -0,0 +1,555 @@
+<?xml version="1.0"?>
+<mime>
+ <mime-mapping>
+  <extension>wml</extension>
+  <mime-type>text/vnd.wap.wml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>pbm</extension>
+  <mime-type>image/x-portable-bitmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>snd</extension>
+  <mime-type>audio/basic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>mid</extension>
+  <mime-type>audio/midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>tar</extension>
+  <mime-type>application/x-tar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>djv</extension>
+  <mime-type>image/vnd.djvu</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>eps</extension>
+  <mime-type>application/postscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>qt</extension>
+  <mime-type>video/quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>rtf</extension>
+  <mime-type>text/rtf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>pnm</extension>
+  <mime-type>image/x-portable-anymap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>tsv</extension>
+  <mime-type>text/tab-separated-values</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>ras</extension>
+  <mime-type>image/x-cmu-raster</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>movie</extension>
+  <mime-type>video/x-sgi-movie</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>png</extension>
+  <mime-type>image/png</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>sgm</extension>
+  <mime-type>text/sgml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>xls</extension>
+  <mime-type>application/vnd.ms-excel</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>ice</extension>
+  <mime-type>x-conference/x-cooltalk</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>ram</extension>
+  <mime-type>audio/x-pn-realaudio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>cpt</extension>
+  <mime-type>application/mac-compactpro</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>mpga</extension>
+  <mime-type>audio/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>wbxml</extension>
+  <mime-type>application/vnd.wap.wbxml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>cdf</extension>
+  <mime-type>application/x-netcdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>mp3</extension>
+  <mime-type>audio/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>mp2</extension>
+  <mime-type>audio/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>smi</extension>
+  <mime-type>application/smil</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>aiff</extension>
+  <mime-type>audio/x-aiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>dvi</extension>
+  <mime-type>application/x-dvi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>aifc</extension>
+  <mime-type>audio/x-aiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>rgb</extension>
+  <mime-type>image/x-rgb</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>gif</extension>
+  <mime-type>image/gif</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>pgn</extension>
+  <mime-type>application/x-chess-pgn</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>wrl</extension>
+  <mime-type>model/vrml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>pgm</extension>
+  <mime-type>image/x-portable-graymap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>dcr</extension>
+  <mime-type>application/x-director</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>js</extension>
+  <mime-type>application/x-javascript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>xhtml</extension>
+  <mime-type>application/xhtml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>dir</extension>
+  <mime-type>application/x-director</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>lha</extension>
+  <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>ps</extension>
+  <mime-type>application/postscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>avi</extension>
+  <mime-type>video/x-msvideo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>vrml</extension>
+  <mime-type>model/vrml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>man</extension>
+  <mime-type>application/x-troff-man</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>lzh</extension>
+  <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>txt</extension>
+  <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>kar</extension>
+  <mime-type>audio/midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>bin</extension>
+  <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>jpeg</extension>
+  <mime-type>image/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>doc</extension>
+  <mime-type>application/msword</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>htm</extension>
+  <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>tex</extension>
+  <mime-type>application/x-tex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>msh</extension>
+  <mime-type>model/mesh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>src</extension>
+  <mime-type>application/x-wais-source</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>etx</extension>
+  <mime-type>text/x-setext</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>aif</extension>
+  <mime-type>audio/x-aiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>igs</extension>
+  <mime-type>model/iges</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>xwd</extension>
+  <mime-type>image/x-xwindowdump</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>t</extension>
+  <mime-type>application/x-troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>mpeg</extension>
+  <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>shar</extension>
+  <mime-type>application/x-shar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>roff</extension>
+  <mime-type>application/x-troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>skt</extension>
+  <mime-type>application/x-koan</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>skp</extension>
+  <mime-type>application/x-koan</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>skm</extension>
+  <mime-type>application/x-koan</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>cpio</extension>
+  <mime-type>application/x-cpio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>mesh</extension>
+  <mime-type>model/mesh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>xpm</extension>
+  <mime-type>image/x-xpixmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>mxu</extension>
+  <mime-type>video/vnd.mpegurl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>sv4cpio</extension>
+  <mime-type>application/x-sv4cpio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>skd</extension>
+  <mime-type>application/x-koan</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>sgml</extension>
+  <mime-type>text/sgml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>iges</extension>
+  <mime-type>model/iges</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>latex</extension>
+  <mime-type>application/x-latex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>djvu</extension>
+  <mime-type>image/vnd.djvu</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>swf</extension>
+  <mime-type>application/x-shockwave-flash</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>zip</extension>
+  <mime-type>application/zip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>wmls</extension>
+  <mime-type>text/vnd.wap.wmlscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>dms</extension>
+  <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>tr</extension>
+  <mime-type>application/x-troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>texinfo</extension>
+  <mime-type>application/x-texinfo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>silo</extension>
+  <mime-type>model/mesh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>css</extension>
+  <mime-type>text/css</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>nc</extension>
+  <mime-type>application/x-netcdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>bmp</extension>
+  <mime-type>image/bmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>spl</extension>
+  <mime-type>application/x-futuresplash</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>wmlc</extension>
+  <mime-type>application/vnd.wap.wmlc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>au</extension>
+  <mime-type>audio/basic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>tiff</extension>
+  <mime-type>image/tiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>rpm</extension>
+  <mime-type>audio/x-pn-realaudio-plugin</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>csh</extension>
+  <mime-type>application/x-csh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>m3u</extension>
+  <mime-type>audio/x-mpegurl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>ppt</extension>
+  <mime-type>application/vnd.ms-powerpoint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>vcd</extension>
+  <mime-type>application/x-cdlink</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>ai</extension>
+  <mime-type>application/postscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>ms</extension>
+  <mime-type>application/x-troff-ms</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>gtar</extension>
+  <mime-type>application/x-gtar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>pdf</extension>
+  <mime-type>application/pdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>tcl</extension>
+  <mime-type>application/x-tcl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>ppm</extension>
+  <mime-type>image/x-portable-pixmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>pdb</extension>
+  <mime-type>chemical/x-pdb</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>sit</extension>
+  <mime-type>application/x-stuffit</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>xht</extension>
+  <mime-type>application/xhtml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>xbm</extension>
+  <mime-type>image/x-xbitmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>so</extension>
+  <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>wbmp</extension>
+  <mime-type>image/vnd.wap.wbmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>hqx</extension>
+  <mime-type>application/mac-binhex40</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>dll</extension>
+  <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>asc</extension>
+  <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>ief</extension>
+  <mime-type>image/ief</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>midi</extension>
+  <mime-type>audio/midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>oda</extension>
+  <mime-type>application/oda</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>tif</extension>
+  <mime-type>image/tiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>me</extension>
+  <mime-type>application/x-troff-me</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>dxr</extension>
+  <mime-type>application/x-director</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>sh</extension>
+  <mime-type>application/x-sh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>html</extension>
+  <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>exe</extension>
+  <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>texi</extension>
+  <mime-type>application/x-texinfo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>wmlsc</extension>
+  <mime-type>application/vnd.wap.wmlscriptc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>class</extension>
+  <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>mpg</extension>
+  <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>mpe</extension>
+  <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>wav</extension>
+  <mime-type>audio/x-wav</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>rm</extension>
+  <mime-type>audio/x-pn-realaudio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>sv4crc</extension>
+  <mime-type>application/x-sv4crc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>mov</extension>
+  <mime-type>video/quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>jpg</extension>
+  <mime-type>image/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>xyz</extension>
+  <mime-type>chemical/x-xyz</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>rtx</extension>
+  <mime-type>text/richtext</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>jpe</extension>
+  <mime-type>image/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>ez</extension>
+  <mime-type>application/andrew-inset</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>hdf</extension>
+  <mime-type>application/x-hdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>xml</extension>
+  <mime-type>text/xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>ustar</extension>
+  <mime-type>application/x-ustar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>bcpio</extension>
+  <mime-type>application/x-bcpio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>smil</extension>
+  <mime-type>application/smil</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>ra</extension>
+  <mime-type>audio/x-realaudio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>xsl</extension>
+  <mime-type>text/xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+  <extension>mif</extension>
+  <mime-type>application/vnd.mif</mime-type>
+ </mime-mapping>
+ </mime>
\ No newline at end of file

Propchange: xml/xindice/trunk/config/MimeTypes.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xml/xindice/trunk/config/MimeTypes.xml
------------------------------------------------------------------------------
    svn:keywords = Id Revision Author Date

Propchange: xml/xindice/trunk/config/commands.xml
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu May 24 18:43:39 2007
@@ -1 +1 @@
-Author Date Id Revision
+Id Revision Author Date

Propchange: xml/xindice/trunk/config/symbols.xml
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu May 24 18:43:39 2007
@@ -1 +1 @@
-Author Date Id Revision
+Id Revision Author Date

Propchange: xml/xindice/trunk/config/system.xml
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu May 24 18:43:39 2007
@@ -1 +1 @@
-Author Date Id Revision
+Id Revision Author Date

Modified: xml/xindice/trunk/config/web.xml
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/config/web.xml?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/config/web.xml (original)
+++ xml/xindice/trunk/config/web.xml Thu May 24 18:43:39 2007
@@ -51,9 +51,24 @@
     <load-on-startup>1</load-on-startup>
   </servlet>
 
+    <servlet>
+      <servlet-name>webadmin</servlet-name>
+      <servlet-class>org.apache.xindice.webadmin.WebAdminServlet</servlet-class>
+      <init-param>
+        <param-name>webadmin.configuration</param-name>
+        <param-value>WEB-INF/config/webadmin.xml</param-value>
+      </init-param>
+      <init-param>
+        <param-name>mimetable.configuration</param-name>
+        <param-value>WEB-INF/config/MimeTypes.xml</param-value>
+      </init-param>
+
+      <load-on-startup>1</load-on-startup>
+    </servlet>
+
   <servlet-mapping>
-    <servlet-name>xindice</servlet-name>
-    <url-pattern>/*</url-pattern>
+    <servlet-name>webadmin</servlet-name>
+    <url-pattern>/dav/*</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
     <servlet-name>xindice</servlet-name>

Propchange: xml/xindice/trunk/config/web.xml
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu May 24 18:43:39 2007
@@ -1 +1 @@
-Author Date Id Revision
+Id Revision Author Date

Added: xml/xindice/trunk/config/webadmin.xml
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/config/webadmin.xml?view=auto&rev=541504
==============================================================================
--- xml/xindice/trunk/config/webadmin.xml (added)
+++ xml/xindice/trunk/config/webadmin.xml Thu May 24 18:43:39 2007
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<webadmin>
+    <methods>
+        <method id="GET" class="org.apache.xindice.webadmin.webdav.components.Get" default="true"/>
+        <method id="COPY" class="org.apache.xindice.webadmin.webdav.components.Copy"/>
+        <method id="DELETE" class="org.apache.xindice.webadmin.webdav.components.Delete"/>
+        <method id="HEAD" class="org.apache.xindice.webadmin.webdav.components.Head"/>
+        <method id="MKCOL" class="org.apache.xindice.webadmin.webdav.components.Mkcol"/>
+        <method id="MOVE" class="org.apache.xindice.webadmin.webdav.components.Move"/>
+        <method id="OPTIONS" class="org.apache.xindice.webadmin.webdav.components.Options"/>
+        <method id="POST" class="org.apache.xindice.webadmin.webdav.components.Post"/>
+        <method id="PROPFIND" class="org.apache.xindice.webadmin.webdav.components.Propfind"/>
+        <method id="PROPPATCH" class="org.apache.xindice.webadmin.webdav.components.Proppatch"/>
+        <method id="PUT" class="org.apache.xindice.webadmin.webdav.components.Put"/>
+        <method id="SEARCH" class="org.apache.xindice.webadmin.webdav.components.Search"/>
+    </methods>
+
+    <dbviewers>
+        <viewer id="list" class="org.apache.xindice.webadmin.viewer.components.ListDatabaseViewer" default="true"/>
+    </dbviewers>
+
+    <colviewers>
+        <viewer id="list" class="org.apache.xindice.webadmin.viewer.components.ListCollectionViewer" default="true"/>
+        <viewer id="config" class="org.apache.xindice.webadmin.viewer.components.CollectionConfigurationViewer"/>
+        <viewer id="indexes" class="org.apache.xindice.webadmin.viewer.components.CollectionIndexesViewer"/>
+        <viewer id="create" class="org.apache.xindice.webadmin.viewer.components.CreateCollectionViewer"/>
+        <viewer id="delete" class="org.apache.xindice.webadmin.viewer.components.DeleteCollectionViewer"/>
+        <viewer id="meta" class="org.apache.xindice.webadmin.viewer.components.MetadataCollectionViewer"/>
+        <viewer id="upload" class="org.apache.xindice.webadmin.viewer.components.UploadCollectionViewer"/>
+        <viewer id="xpath" class="org.apache.xindice.webadmin.viewer.components.XPathSearchCollectionViewer"/>
+        <viewer id="xupdate" class="org.apache.xindice.webadmin.viewer.components.XUpdateCollectionViewer"/>
+    </colviewers>
+
+    <resviewers>
+        <viewer id="content" class="org.apache.xindice.webadmin.viewer.components.ContentResourceViewer" default="true"/>
+        <viewer id="delete" class="org.apache.xindice.webadmin.viewer.components.DeleteResourceViewer"/>
+        <viewer id="meta" class="org.apache.xindice.webadmin.viewer.components.MetadataResourceViewer"/>
+    </resviewers>
+</webadmin>
\ No newline at end of file

Propchange: xml/xindice/trunk/config/webadmin.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xml/xindice/trunk/config/webadmin.xml
------------------------------------------------------------------------------
    svn:keywords = Id Revision Author Date

Propchange: xml/xindice/trunk/config/xindice.xml
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu May 24 18:43:39 2007
@@ -1 +1 @@
-Author Date Id Revision
+Id Revision Author Date

Modified: xml/xindice/trunk/java/src/org/apache/xindice/client/xmldb/embed/CollectionImpl.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/client/xmldb/embed/CollectionImpl.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/client/xmldb/embed/CollectionImpl.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/client/xmldb/embed/CollectionImpl.java Thu May 24 18:43:39 2007
@@ -27,6 +27,7 @@
 import org.apache.xindice.core.Database;
 import org.apache.xindice.core.FaultCodes;
 import org.apache.xindice.core.data.NodeSet;
+import org.apache.xindice.core.data.Entry;
 import org.apache.xindice.core.meta.MetaData;
 import org.apache.xindice.core.query.QueryUtil;
 import org.apache.xindice.util.Configuration;
@@ -113,11 +114,11 @@
 
         checkOpen();
         try {
-            Object entry = col.getEntry(id);
+            Entry entry = col.getEntry(id);
             if (entry == null) {
                 return null;
-            } else if (entry instanceof Document) {
-                DocumentImpl doc = (DocumentImpl) entry;
+            } else if (entry.getEntryType() == Entry.DOCUMENT) {
+                DocumentImpl doc = (DocumentImpl) entry.getValue();
 
                 // This should probably just pass the document.
                 if (doc.getDataBytes() == null) {
@@ -126,8 +127,8 @@
                     return new XMLResourceImpl(id, id, this, doc.getSymbols(), doc.getDataBytes());
                 }
 
-            } else if (entry instanceof byte[]) {
-                return new BinaryResourceImpl(id, this, (byte[])entry);
+            } else if (entry.getEntryType() == Entry.BINARY) {
+                return new BinaryResourceImpl(id, this, (byte[]) entry.getValue());
             } else {
                 throw new XMLDBException(ErrorCodes.UNKNOWN_RESOURCE_TYPE,
                                          "Internal error: Unexpected resource type " + entry.getClass().getName());
@@ -192,7 +193,7 @@
 
             try {
                 if (res.getId() != null) {
-                    col.insertBinary(res.getId(), bytes);
+                    col.setBinary(res.getId(), bytes);
                 } else {
                     String name = col.insertBinary(bytes).toString();
                     ((BinaryResourceImpl) res).setId(name);
@@ -207,7 +208,7 @@
                 Node content = ((XMLResourceImpl) res).getContentAsDOM();
                 if (content != null && content instanceof Document) {
                     if (res.getId() != null) {
-                        col.insertDocument(res.getId(), (Document) content);
+                        col.setDocument(res.getId(), (Document) content);
                     } else {
                         String name = col.insertDocument((Document) content).toString();
                         ((XMLResourceImpl) res).setId(name);

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java Thu May 24 18:43:39 2007
@@ -29,6 +29,7 @@
 import org.apache.xindice.core.data.Record;
 import org.apache.xindice.core.data.RecordSet;
 import org.apache.xindice.core.data.Value;
+import org.apache.xindice.core.data.Entry;
 import org.apache.xindice.core.filer.Filer;
 import org.apache.xindice.core.indexer.IndexManager;
 import org.apache.xindice.core.indexer.Indexer;
@@ -87,6 +88,10 @@
     private static final String NAME = "name";
     private static final String SYMBOLS = "symbols";
 
+    private static final byte ACTION_INSERT = 1;
+    private static final byte ACTION_UPDATE = 2;
+    private static final byte ACTION_STORE = 3;
+
     private static final DocumentSet EMPTY_DOCUMENTSET = new EmptyDocumentSet();
     private static final NodeSet EMPTY_NODESET = new EmptyNodeSet();
     private static final String[] EMPTY_STRING_ARRAY = {};
@@ -122,7 +127,7 @@
         }
 
         public void commit() throws DBException {
-            putDocument(this.key, this.document /*, false */);
+            putDocument(this.key, this.document, ACTION_STORE);
         }
 
         public void commit(Document doc) throws DBException {
@@ -331,12 +336,12 @@
 
     private String debugHeader() {
         return "["
-                + Thread.currentThread().getName()
-                + "] '"
-                + (parent != null ? parent.getCanonicalName() : "")
-                + "/"
-                + name
-                + "' ";
+               + Thread.currentThread().getName()
+               + "] '"
+               + (parent != null ? parent.getCanonicalName() : "")
+               + "/"
+               + name
+               + "' ";
     }
 
     /**
@@ -446,18 +451,18 @@
                                   "' has no binary resources (inline metadata is not enabled)");
         }
 
-        Object entry = getEntry(key);
+        Entry entry = getEntry(key);
         if (entry == null) {
             return null;
         }
 
-        if (!(entry instanceof byte[])) {
+        if (entry.getEntryType() != Entry.BINARY) {
             throw new DBException(FaultCodes.COL_INVALID_RESULT,
                                   "Resource '" + key + "' in collection '" +
                                   getCanonicalName() + "' is not a binary resource");
         }
 
-        return (byte[]) entry;
+        return (byte[]) entry.getValue();
     }
 
     /**
@@ -567,18 +572,18 @@
             log.debug(debugHeader() + "Get document: " + key);
         }
 
-        Object entry = getEntry(key);
+        Entry entry = getEntry(key);
         if (entry == null) {
             return null;
         }
 
-        if (!(entry instanceof Document)) {
+        if (entry.getEntryType() != Entry.DOCUMENT) {
             throw new DBException(FaultCodes.COL_INVALID_RESULT,
                                   "Resource '" + key + "' in collection '" +
                                   getCanonicalName() + "' is not a document");
         }
 
-        return (Document) entry;
+        return (Document) entry.getValue();
     }
 
     /**
@@ -662,19 +667,17 @@
     /**
      * Retrieve a database entry by key.
      *
-     * If no matching entry is found, null is returned; if
-     * an XML entry is found, a Document is returned; if a
-     * binary entryis found, byte[] is returned.
-     *
-     * This low-level method will not update non-inline metadata.
+     * If no matching entry is found, null is returned, otherwise this
+     * method returns Entry that identifies resource type and holds its
+     * value and metadata.
      *
      * @param docKey identifying the desired database entry
-     * @return Object containing the database entry, or null if no
-     *         matching entry is found
+     * @return Entry containing the database entry and its metadata, or null
+     *         if no matching entry is found
      * @throws DBException in case of backing store error,
      *         and in case of header corruption
      */
-    public final Object getEntry(Object docKey) throws DBException {
+    public final Entry getEntry(Object docKey) throws DBException {
 
         // I would prefer to throw an exception (NPE) in this case,
         // but we have a test indicating a null return...
@@ -702,17 +705,17 @@
              * Document and byte[].
              */
             if (documentCache != null) {
-                Document document = documentCache.getDocument(this, key);
-                if (document != null) {
+                Entry entry = documentCache.getDocument(this, key);
+                if (entry != null) {
                     if (log.isTraceEnabled()) {
-                        log.trace(localDebugHeader + "Returning cached: " + document);
+                        log.trace(localDebugHeader + "Returning cached: " + entry.getValue());
                     }
 
-                    return document;
+                    return entry;
                 }
             }
 
-            Record record = filer.readRecord(key);
+            Record record = filer.readRecord(key, false);
             if (record == null) {
                 return null;
             }
@@ -735,6 +738,7 @@
                 }
             }
 
+            Map entryMeta = Entry.createMetaMap(record);
             if (inlineMetaService == null || metaMap.get("type").equals(ResourceTypeReader.XML)) {
                 Document document;
                 if (compressed) {
@@ -746,7 +750,7 @@
                     }
 
                     if (documentCache != null) {
-                        documentCache.putDocument(this, key, value.getData());
+                        documentCache.putDocument(this, key, value.getData(), entryMeta);
                     }
                 } else {
                     String documentChars = value.toString();
@@ -759,23 +763,65 @@
                     flushSymbolTable();
 
                     if (documentCache != null) {
-                        documentCache.putDocument(this, key, documentChars);
+                        documentCache.putDocument(this, key, documentChars, entryMeta);
                     }
                 }
 
                 DBObserver.getInstance().loadDocument(this, record, document);
-                return document;
+                return new Entry(key, document, entryMeta);
             } else {
                 if (log.isTraceEnabled()) {
                     log.trace(localDebugHeader + "Binary document");
                 }
 
-                return value.getData();
+                return new Entry(key, value.getData(), entryMeta);
             }
         }
     }
 
     /**
+     * Retrieve a database entry metadata by key.
+     *
+     * If no matching entry is found, null is returned, otherwise this method
+     * return Entry that holds metadata only.
+     *
+     * @param docKey identifying the desired database entry
+     * @return Entry containing the metadata of the database entry, or null if no
+     *         matching entry is found
+     * @throws DBException in case of backing store error,
+     *         and in case of header corruption
+     */
+    public final Entry getEntryMeta(Object docKey) throws DBException {
+        if (docKey == null) {
+            return null;
+        }
+
+        checkFiler(FaultCodes.COL_NO_FILER);
+
+        Key key = getIdentityKey(createNewKey(docKey));
+        synchronized (key) {
+            /*
+             * If the key has a corresponding value in the cache, return it
+             * and save a disk access.
+             */
+            if (documentCache != null) {
+                Entry entry = documentCache.getDocumentMeta(this, key);
+                if (entry != null) {
+                    return entry;
+                }
+            }
+
+            Record record = filer.readRecord(key, true);
+            if (record == null) {
+                return null;
+            }
+
+            Map entryMeta = Entry.createMetaMap(record);
+            return new Entry(key, entryMeta);
+        }
+    }
+
+    /**
      * getFiler returns the low-level Filer instances underlying the
      * Collection instance.
      *
@@ -935,7 +981,7 @@
         if (log.isInfoEnabled()) {
             log.info(debugHeader() + "Insert binary: " + key);
         }
-        putBinary(key, bytes, true);
+        putBinary(key, bytes, ACTION_INSERT);
 
         // update the meta information if necessary
         updateCollectionMeta();
@@ -963,7 +1009,7 @@
         if (log.isInfoEnabled()) {
             log.info(debugHeader() + "Insert document: " + key);
         }
-        putDocument(key, document /*, true */);
+        putDocument(key, document, ACTION_INSERT);
 
         // update the meta information if necessary
         updateCollectionMeta();
@@ -995,7 +1041,7 @@
         if (log.isInfoEnabled()) {
             log.info(debugHeader() + "Insert object: " + key);
         }
-        putObject(key, obj /*, true */);
+        putObject(key, obj, ACTION_INSERT);
 
         // update the meta information if necessary
         updateCollectionMeta();
@@ -1015,10 +1061,10 @@
     }
 
     /**
-     * listDocuments returns a list of all document keys stored by this
+     * listDocuments returns a list of all entry keys stored by this
      * collection.
      *
-     * @return the list of document keys
+     * @return the list of entry keys
      */
     public final String[] listDocuments() throws DBException {
         // a collection in which you are unable to file documents will have no filer
@@ -1081,46 +1127,77 @@
         }
     }
 
-    /*
+    /**
      * Lowest-level method for saving a binary entry into the database. At this moment,
      * presence of inline metadata is known.
      * It now does update non-inline metadata if the user has configured it.
+     * <br/><br/>
+     * putBinary attempts to perform requested action, and success depends on action
+     * and presense of the key in the collection.
+     * <br/><br/>
+     * @param key Entry key
+     * @param bytes Value
+     * @param action It can be either ACTION_INSERT, ACTION_UPDATE or ACTION_STORE
+     * @return True if new binary entry was created, false otherwise
+     * @throws DBException<ul>
+     * <li>FaultCodes.COL_DUPLICATE_RESOURCE If entry with that key already present in
+     * collection and action is ACTION_INSERT</li>
+     * <li>FaultCodes.COL_DOCUMENT_NOT_FOUND If entry with that key is not present in
+     * collection and action is ACTION_UPDATE
+     * </ul>
      */
-    private void putBinary(Key key, byte[] bytes, boolean create) throws DBException {
+    private boolean putBinary(Key key, byte[] bytes, byte action) throws DBException {
         synchronized (getIdentityKey(key)) {
-            Object entry = getEntry(key);
-            if (!create) {
-                if (entry == null) {
-                    // TODO: Do we need a COL_KEY_ALREADY_PRESENT fault so that the caller can interpret this exception?
-                    throw new DBException(FaultCodes.COL_CANNOT_STORE,
-                                          "Error storing binary resource '" + key + "' in '" + getCanonicalName() +
-                                          "': the 'create' flag is false and the key is already in database");
-                }
+            Entry entry = getEntry(key);
+            if (action == ACTION_INSERT && entry != null) {
+                    throw new DBException(FaultCodes.COL_DUPLICATE_RESOURCE,
+                                          "Error inserting binary resource '" + key + "' in '" + getCanonicalName() +
+                                          "': key is already in database");
+            } else if (action == ACTION_UPDATE && entry == null) {
+                    throw new DBException(FaultCodes.COL_DOCUMENT_NOT_FOUND,
+                                          "Error updating binary resource '" + key + "' in '" + getCanonicalName() +
+                                          "': key does not exist in database");
             }
 
-            if (entry != null && entry instanceof Document) {
+            if (entry != null && entry.getEntryType() == Entry.DOCUMENT) {
                 // binary resources aren't stored in cache or indexes
                 if (documentCache != null) {
                     documentCache.removeDocument(this, key);
                 }
-                indexManager.removeDocument(key, (Document) entry);
+                indexManager.removeDocument(key, (Document) entry.getValue());
             }
 
             InlineMetaMap map = inlineMetaService.getEmptyMap();
             map.put("type", ResourceTypeReader.BINARY);
             Value value = inlineMetaService.createValue(map, bytes, 0, bytes.length);
-            filer.writeRecord(key, value);
+            Record record = filer.writeRecord(key, value);
 
             // update the meta for this document
-            updateDocumentMeta(key.toString());
+            updateDocumentMeta(record);
+            return entry == null;
         }
     }
 
     /**
      * This is the lowest-level method for storing a record into the backing store.
      * It now does update non-inline metadata if the user has configured it.
+     *
+     * <br/><br/>
+     * putDocuemnt attempts to perform requested action, and success depends on action
+     * and presense of the key in the collection.
+     * <br/><br/>
+     * @param key Entry key
+     * @param document Document to store
+     * @param action It can be either ACTION_INSERT, ACTION_UPDATE or ACTION_STORE
+     * @return True if new document entry was created, false otherwise
+     * @throws DBException<ul>
+     * <li>FaultCodes.COL_DUPLICATE_RESOURCE If entry with that key already present in
+     * collection and action is ACTION_INSERT</li>
+     * <li>FaultCodes.COL_DOCUMENT_NOT_FOUND If entry with that key is not present in
+     * collection and action is ACTION_UPDATE
+     * </ul>
      */
-    private void putDocument(Key key, Document document) throws DBException {
+    private boolean putDocument(Key key, Document document, byte action) throws DBException {
         final String localDebugHeader = debugHeader() + "putDocument: docKey=<" + key + ">: ";
         if (log.isTraceEnabled()) {
             log.trace(localDebugHeader + "document=<" + TextWriter.toString(document) + ">");
@@ -1197,12 +1274,19 @@
         flushSymbolTable();
 
         key = getIdentityKey(key);
-        Object oldDoc;
+        Entry entry;
         synchronized (key) {
             // Temporary until insert and update are separate
-            oldDoc = getEntry(key);
-            if (oldDoc != null && oldDoc instanceof Document) {
-                indexManager.removeDocument(key, (Document) oldDoc);
+            entry = getEntry(key);
+
+            if (action == ACTION_INSERT && entry != null) {
+                throw new DBException(FaultCodes.COL_DUPLICATE_RESOURCE);
+            } else if (action == ACTION_UPDATE && entry == null) {
+                throw new DBException(FaultCodes.COL_DOCUMENT_NOT_FOUND);
+            }
+
+            if (entry != null && entry.getEntryType() == Entry.DOCUMENT) {
+                indexManager.removeDocument(key, (Document) entry.getValue());
             }
             indexManager.addDocument(key, document);
 
@@ -1215,25 +1299,26 @@
                 map.put("type", ResourceTypeReader.XML);
                 value = inlineMetaService.createValue(map, documentBytes, 0, documentBytes.length);
             }
-            filer.writeRecord(key, value);
+            Record record = filer.writeRecord(key, value);
 
             // Cache Stuff
             if (documentCache != null) {
                 if (compressed) {
-                    documentCache.putDocument(this, key, documentBytes);
+                    documentCache.putDocument(this, key, documentBytes, Entry.createMetaMap(record));
                 } else {
-                    documentCache.putDocument(this, key, documentChars);
+                    documentCache.putDocument(this, key, documentChars, Entry.createMetaMap(record));
                 }
             }
 
             // Update the meta for this document
-            updateDocumentMeta(key.toString());
+            updateDocumentMeta(record);
         }
 
-        DBObserver.getInstance().putDocument(this, key, document, oldDoc == null);
+        DBObserver.getInstance().putDocument(this, key, document, entry == null);
+        return entry == null;
     }
 
-    private void putObject(Key key, XMLSerializable obj) throws DBException {
+    private boolean putObject(Key key, XMLSerializable obj, byte action) throws DBException {
         if (log.isTraceEnabled()) {
             log.trace(debugHeader() + "putObject: key=<" + key + "> class=<" + obj.getClass().getName() + ">");
         }
@@ -1243,7 +1328,7 @@
         doc.appendChild(pi);
         Element elem = obj.streamToXML(doc);
         doc.appendChild(elem);
-        putDocument(key, doc /*, create */);
+        return putDocument(key, doc, action);
     }
 
     /**
@@ -1308,9 +1393,9 @@
 
         objKey = getIdentityKey(objKey);
         synchronized (objKey) {
-            Object oldDoc = getEntry(objKey);
-            if (oldDoc != null && oldDoc instanceof Document) {
-                indexManager.removeDocument(objKey, (Document)oldDoc);
+            Entry entry = getEntry(objKey);
+            if (entry != null && entry.getEntryType() == Entry.DOCUMENT) {
+                indexManager.removeDocument(objKey, (Document) entry.getValue());
             }
 
             if (documentCache != null) {
@@ -1498,17 +1583,52 @@
     }
 
     /**
-     * setDocument overwrites/updates an existing Document in a
+     * setDocument inserts or updates an existing Document in a
      * Xindice Collection.
      *
      * @param docKey The Document Key
      * @param document The Document
      */
-    public final void setDocument(Object docKey, Document document) throws DBException {
+    public final boolean setDocument(Object docKey, Document document) throws DBException {
         if (log.isInfoEnabled()) {
             log.info(debugHeader() + "Set document " + docKey);
         }
-        putDocument(createNewKey(docKey), document);
+
+        boolean res = putDocument(createNewKey(docKey), document, ACTION_STORE);
+
+        if (res) {
+            updateCollectionMeta();
+        }
+
+        return res;
+    }
+
+    /**
+     * setBinary inserts or updates binary object into a Xindice Collection.
+     *
+     * @param docKey The document Key
+     * @param bytes The document to insert
+     * @throws DBException if inline-metadata is not enabled, the key is
+     *         already in the database, or an error occurs while saving.
+     */
+    public boolean setBinary(Object docKey, byte[] bytes) throws DBException {
+        if (inlineMetaService == null) {
+            throw new DBException(FaultCodes.COL_CANNOT_STORE,
+                                  "Cannot insert a binary resource in '" + getCanonicalName() +
+                                  "' (inline-metadata is not enabled)");
+        }
+
+        if (log.isInfoEnabled()) {
+            log.info(debugHeader() + "Set binary " + docKey);
+        }
+
+        boolean res = putBinary(createNewKey(docKey), bytes, ACTION_STORE);
+
+        if (res) {
+            updateCollectionMeta();
+        }
+
+        return res;
     }
 
     /**
@@ -1527,8 +1647,7 @@
 
         Key key = getIdentityKey(createNewKey(id));
         synchronized (key) {
-            Object obj = getEntry(id);
-            if (null == obj) {
+            if (null == getEntry(id)) {
                 throw new DBException(FaultCodes.COL_DOCUMENT_NOT_FOUND,
                                       "Resource '" + id + "' does not exist in '" + getCanonicalName() + "'");
             }
@@ -1569,7 +1688,7 @@
         if (log.isInfoEnabled()) {
             log.info(debugHeader() + "Set object " + key);
         }
-        putObject(createNewKey(key), obj /*, false */ );
+        putObject(createNewKey(key), obj, ACTION_STORE);
     }
 
     /**
@@ -1618,43 +1737,38 @@
     /**
      * update the modified time of this document when appropriate
      */
-    protected void updateDocumentMeta(String id) throws DBException {
+    protected void updateDocumentMeta(Record record) throws DBException {
         // update the meta data if necessary
         if (!isMetaEnabled()) {
             return;
         }
 
-        Object obj = getEntry(id);
-        if (null == obj) {
-            throw new DBException(FaultCodes.COL_DOCUMENT_NOT_FOUND,
-                                  "Resource '" + id + "' does not exist in '" + getCanonicalName() + "'");
-        }
-
         MetaSystemCollection metacol = getMetaSystemCollection();
+        String id = record.getKey().toString();
         MetaData meta = metacol.getDocumentMeta(this, id);
         String path = getCanonicalDocumentName(id);
 
-        /*
-        TimeRecord rec = null;
-        if( null == meta || !meta.hasContext() )
-           rec = getDatabase().getTime(path);
-
-        long created = (null != rec) ? rec.getCreatedTime() : System.currentTimeMillis();
-        long modified = (null != rec) ? rec.getModifiedTime() : System.currentTimeMillis();
-        */
-
-        // this is wrong.. but it should work for now...
         if (log.isTraceEnabled()) {
             log.trace(debugHeader() + "Updating modified time for document '" + id + "'");
         }
+
         long now = System.currentTimeMillis();
+        // Creation and modification time are not necessary will be available.
+        // Some filers may not have that information, in which case current time is used
+        Long time = (Long) record.getMetaData(Record.CREATED);
+        long created = time != null ? time.longValue() : now;
+
+        time = (Long) record.getMetaData(Record.MODIFIED);
+        long modified = time != null ? time.longValue() : now;
+
         if (null == meta) {
-            meta = new MetaData(MetaData.DOCUMENT, path, now, now);
+            meta = new MetaData(MetaData.DOCUMENT, path, created, modified);
         } else if (!meta.hasContext()) {
-            meta.setContext(now, now);
+            meta.setContext(created, modified);
         } else {
-            meta.setContext(0, now);
+            meta.setContext(0, modified);
         }
+
         metacol.setDocumentMeta(this, id, meta);
     }
 

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/DocumentCache.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/DocumentCache.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/DocumentCache.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/DocumentCache.java Thu May 24 18:43:39 2007
@@ -22,6 +22,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.xindice.core.data.Key;
+import org.apache.xindice.core.data.Entry;
 import org.apache.xindice.xml.NodeSource;
 import org.apache.xindice.xml.SymbolTable;
 import org.apache.xindice.xml.dom.DBDocument;
@@ -59,31 +60,29 @@
      * @param key document key
      * @return document from the cache or null if not present
      */
-    public Document getDocument(Collection col, Key key) {
-        Object v = table.get(new CacheKey(col, key));
+    public Entry getDocument(Collection col, Key key) {
+        CacheValue v = (CacheValue) table.get(new CacheKey(col, key));
 
         if (v == null) {
             return null;
-
-        } else if (v instanceof Document) {
-            return (Document) v;
-
-        } else if (v instanceof String) {
+        } else if (v.getValue() instanceof Document) {
+            return new Entry(key, (Document) v.getValue(), v.getMeta());
+        } else if (v.getValue() instanceof String) {
             try {
-                Document doc = DOMParser.toDocument((String) v);
+                Document doc = DOMParser.toDocument((String) v.getValue());
                 ((DBDocument) doc).setSource(new NodeSource(col, key));
-                return doc;
+                return new Entry(key, doc, v.getMeta());
             } catch (Exception e) {
                 if (log.isWarnEnabled()) {
                     log.warn("ignored exception", e);
                 }
             }
-
-        } else if (v instanceof byte[]) {
+        } else if (v.getValue() instanceof byte[]) {
             try {
                 SymbolTable s = col.getSymbols();
                 NodeSource ns = new NodeSource(col, key);
-                return new DocumentImpl((byte[]) v, s, ns);
+                Document doc =  new DocumentImpl((byte[]) v.getValue(), s, ns);
+                return new Entry(key, doc, v.getMeta());
             } catch (Exception e) {
                 if (log.isWarnEnabled()) {
                     log.warn("ignored exception", e);
@@ -95,14 +94,31 @@
     }
 
     /**
+     * Obtains entry metadata from cache.
+     *
+     * @param col document collection
+     * @param key document key
+     * @return document from the cache or null if not present
+     */
+    public Entry getDocumentMeta(Collection col, Key key) {
+        CacheValue v = (CacheValue) table.get(new CacheKey(col, key));
+
+        if (v != null) {
+            return new Entry(key, v.getMeta());
+        }
+
+        return null;
+    }
+    /**
      * Stores compressed document's bytes in the cache
      *
      * @param col document collection
      * @param key document key
      * @param bytes compressed document
      */
-    public void putDocument(Collection col, Key key, byte[] bytes) {
-        table.put(new CacheKey(col, key), bytes);
+    public void putDocument(Collection col, Key key, byte[] bytes, Map meta) {
+        CacheKey ckey = new CacheKey(col, key);
+        table.put(ckey, new CacheValue(bytes, meta));
     }
 
     /**
@@ -112,8 +128,9 @@
      * @param key document key
      * @param chars uncompressed document
      */
-    public void putDocument(Collection col, Key key, String chars) {
-        table.put(new CacheKey(col, key), chars);
+    public void putDocument(Collection col, Key key, String chars, Map meta) {
+        CacheKey ckey = new CacheKey(col, key);
+        table.put(ckey, new CacheValue(chars, meta));
     }
 
     /**
@@ -193,6 +210,27 @@
 
         public boolean equals(Object o) {
             return (o instanceof CacheKey) && col == ((CacheKey) o).col && key.equals(((CacheKey) o).key);
+        }
+    }
+
+    /**
+     * Cache value helper class
+     */
+    private static class CacheValue {
+        private Object value;
+        private Map meta;
+
+        public CacheValue(Object value, Map meta) {
+            this.value = value;
+            this.meta = meta;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Map getMeta() {
+            return meta;
         }
     }
 }

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/FaultCodes.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/FaultCodes.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/FaultCodes.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/FaultCodes.java Thu May 24 18:43:39 2007
@@ -69,6 +69,7 @@
     public static final int COL_CANNOT_RETRIEVE      = 245;
     public static final int COL_COLLECTION_READ_ONLY = 246;
     public static final int COL_COLLECTION_CLOSED    = 247;
+    public static final int COL_DUPLICATE_RESOURCE   = 248;
     public static final int COL_CANNOT_CREATE        = 270;
     public static final int COL_CANNOT_DROP          = 271;
     public static final int COL_INVALID_RESULT       = 277;
@@ -137,6 +138,7 @@
         putCodeMessage(COL_CANNOT_RETRIEVE, "Collection Cannot Retrieve");
         putCodeMessage(COL_COLLECTION_READ_ONLY, "Collection Read-only");
         putCodeMessage(COL_COLLECTION_CLOSED, "Collection Closed");
+        putCodeMessage(COL_DUPLICATE_RESOURCE, "Resource Duplicated");
         putCodeMessage(COL_CANNOT_CREATE, "Collection Cannot Create");
         putCodeMessage(COL_CANNOT_DROP, "Collection Cannot Drop");
         putCodeMessage(COL_INVALID_RESULT, "Collection Invalid Result");

Added: xml/xindice/trunk/java/src/org/apache/xindice/core/data/Entry.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/data/Entry.java?view=auto&rev=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/data/Entry.java (added)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/data/Entry.java Thu May 24 18:43:39 2007
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.xindice.core.data;
+
+import org.w3c.dom.Document;
+import org.apache.xindice.xml.XMLSerializable;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Entry is a high-level representation of a database record, that includes
+ * its internal meta information
+ */
+public class Entry {
+
+    public static final byte UNKNOWN = 0;
+    public static final byte DOCUMENT = 1;
+    public static final byte BINARY = 2;
+    public static final byte OBJECT = 3;
+
+    public static final String CREATED = "created";
+    public static final String MODIFIED = "modified";
+
+    private final Key key;
+    private final Object value;
+    private final Map meta;
+    private final byte type;
+
+    public Entry(Key key, Document value, Map meta) {
+        this.key = key;
+        this.value = value;
+        this.meta = meta;
+        type = DOCUMENT;
+    }
+
+    public Entry(Key key, byte[] value, Map meta) {
+        this.key = key;
+        this.value = value;
+        this.meta = meta;
+        type = BINARY;
+    }
+
+    public Entry(Key key, XMLSerializable value, Map meta) {
+        this.key = key;
+        this.value = value;
+        this.meta = meta;
+        type = OBJECT;
+    }
+
+    public Entry(Key key, Map meta) {
+        this.key = key;
+        this.value = null;
+        this.meta = meta;
+        type = UNKNOWN;
+    }
+
+    public byte getEntryType() {
+        return type;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public Key getKey() {
+        return key;
+    }
+
+    public long getCreationTime() {
+        Long date = (Long) meta.get(CREATED);
+        return date != null ? date.longValue() : 0;
+    }
+
+    public long getModificationTime() {
+        Long date = (Long) meta.get(MODIFIED);
+        return date != null ? date.longValue() : 0;
+    }
+
+    public static Map createMetaMap(Record record) {
+        Map entryMeta = new HashMap();
+        entryMeta.put(Entry.CREATED, record.getMetaData(Record.CREATED));
+        entryMeta.put(Entry.MODIFIED, record.getMetaData(Record.MODIFIED));
+        return entryMeta;
+    }
+}

Propchange: xml/xindice/trunk/java/src/org/apache/xindice/core/data/Entry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xml/xindice/trunk/java/src/org/apache/xindice/core/data/Entry.java
------------------------------------------------------------------------------
    svn:keywords = Id Revision Author Date

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/filer/BTreeFiler.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/filer/BTreeFiler.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/filer/BTreeFiler.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/filer/BTreeFiler.java Thu May 24 18:43:39 2007
@@ -89,7 +89,7 @@
         return "BTreeFiler";
     }
 
-    public Record readRecord(Key key) throws DBException {
+    public Record readRecord(Key key, boolean metaOnly) throws DBException {
         if (key == null || key.getLength() == 0) {
             return null;
         }
@@ -98,7 +98,7 @@
         try {
             long pos = findValue(key);
             Page startPage = getPage(pos);
-            Value v = readValue(startPage);
+            Value v = metaOnly ? null : readValue(startPage);
             BTreeFilerPageHeader sph = (BTreeFilerPageHeader) startPage.getPageHeader();
 
             HashMap meta = new HashMap(2, 1.5F);
@@ -117,14 +117,12 @@
         return null;
     }
 
-    public boolean writeRecord(Key key, Value value) throws DBException {
+    public Record writeRecord(Key key, Value value) throws DBException {
         if (key == null || key.getLength() == 0) {
-            throw new FilerException(FaultCodes.DBE_CANNOT_CREATE,
-                                     "Invalid key: null or empty");
+            throw new FilerException(FaultCodes.DBE_CANNOT_CREATE, "Invalid key: null or empty");
         }
         if (value == null) {
-            throw new FilerException(FaultCodes.DBE_CANNOT_CREATE,
-                                     "Invalid value: null");
+            throw new FilerException(FaultCodes.DBE_CANNOT_CREATE, "Invalid value: null");
         }
 
         checkOpened();
@@ -142,12 +140,17 @@
 
             writeValue(p, value);
             flush();
+
+            HashMap meta = new HashMap(3);
+            meta.put(Record.CREATED, new Long(ph.getCreated()));
+            meta.put(Record.MODIFIED, new Long(t));
+            return new Record(key, value, meta);
+
         } catch (IOException e) {
             // FIXME: cleanup?
             throw new FilerException(FaultCodes.DBE_CANNOT_CREATE,
                                      "Can't write record '" + key + "': " + e.getMessage(), e);
         }
-        return true;
     }
 
     public boolean deleteRecord(Key key) throws DBException {
@@ -214,7 +217,7 @@
         }
 
         public synchronized Record getNextRecord() throws DBException {
-            return readRecord((Key) iter.next());
+            return readRecord((Key) iter.next(), false);
         }
 
         public synchronized Value getNextValue() throws DBException {

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/filer/FSFiler.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/filer/FSFiler.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/filer/FSFiler.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/filer/FSFiler.java Thu May 24 18:43:39 2007
@@ -139,7 +139,7 @@
     public void flush() {
     }
 
-    public Record readRecord(Key key) throws DBException {
+    public Record readRecord(Key key, boolean metaOnly) throws DBException {
         if (key == null || key.getLength() == 0) {
             return null;
         }
@@ -158,9 +158,13 @@
             HashMap meta = new HashMap(2, 1.5F);
             meta.put(Record.MODIFIED, new Long(file.lastModified()));
 
-            byte[] valueData = cache.getFile(file);
-            if (valueData != null) {
-                return new Record(key, new Value(valueData), meta);
+            if (metaOnly && file.exists()) {
+                return new Record(key, null, meta);
+            } else {
+                byte[] valueData = cache.getFile(file);
+                if (valueData != null) {
+                    return new Record(key, new Value(valueData), meta);
+                }
             }
         } catch (IOException e) {
             throw new FilerException(FaultCodes.DBE_CANNOT_READ,
@@ -171,7 +175,7 @@
         return null;
     }
 
-    public boolean writeRecord(Key key, Value value) throws DBException {
+    public Record writeRecord(Key key, Value value) throws DBException {
         if (key == null || key.getLength() == 0) {
             throw new FilerException(FaultCodes.DBE_CANNOT_CREATE, "Invalid key: '" + key + "'");
         }
@@ -184,7 +188,7 @@
 
         String fname = key.toString();
         if (!isExtensionValid(fname)) {
-            return false;
+            throw new FilerException(FaultCodes.DBE_CANNOT_CREATE, "Invalid extention");
         }
 
         File file = new File(dir, fname);
@@ -193,7 +197,11 @@
             FileOutputStream fos = new FileOutputStream(file);
             value.streamTo(fos);
             fos.close();
-            return true;
+
+            HashMap meta = new HashMap(2);
+            meta.put(Record.MODIFIED, new Long(file.lastModified()));
+
+            return new Record(key, value, meta);
         } catch (IOException e) {
             throw new FilerException(FaultCodes.DBE_CANNOT_CREATE,
                                      "Can't write record '" + key + "': " + e.getMessage(), e);
@@ -276,7 +284,7 @@
 
         public synchronized Record getNextRecord() throws DBException {
             File file = files[pos++];
-            return readRecord(new Key(file.getName()));
+            return readRecord(new Key(file.getName()), false);
         }
 
         public synchronized Value getNextValue() throws DBException {

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Filer.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Filer.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Filer.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Filer.java Thu May 24 18:43:39 2007
@@ -53,18 +53,19 @@
      * Key.
      *
      * @param key The Record's Key
+     * @param metaOnly
      * @return The returned Record
      */
-    Record readRecord(Key key) throws DBException;
+    Record readRecord(Key key, boolean metaOnly) throws DBException;
 
     /**
      * writeRecord writes a Value to the Filer based on the specified Key.
      *
      * @param key The Record's Key
      * @param value The Record's Value
-     * @return Whether or not the Record could be written
+     * @return Written Record
      */
-    boolean writeRecord(Key key, Value value) throws DBException;
+    Record writeRecord(Key key, Value value) throws DBException;
 
     /**
      * deleteRecord removes a Record from the Filer based on the

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/filer/HashFiler.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/filer/HashFiler.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/filer/HashFiler.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/filer/HashFiler.java Thu May 24 18:43:39 2007
@@ -123,7 +123,7 @@
         }
     }
 
-    public Record readRecord(Key key) throws DBException {
+    public Record readRecord(Key key, boolean metaOnly) throws DBException {
         if (key == null || key.getLength() == 0) {
             return null;
         }
@@ -131,7 +131,7 @@
         try {
             Page startPage = seekRecordPage(key);
             if (startPage != null) {
-                Value v = readValue(startPage);
+                Value v = metaOnly ? null: readValue(startPage);
                 HashPageHeader sph = (HashPageHeader) startPage.getPageHeader();
 
                 HashMap meta = new HashMap(3);
@@ -197,7 +197,7 @@
         return p;
     }
 
-    public boolean writeRecord(Key key, Value value) throws DBException {
+    public Record writeRecord(Key key, Value value) throws DBException {
         // Check that key is not larger than space on the page
         if (key == null || key.getLength() == 0 || key.getLength() > fileHeader.getPageSize() - fileHeader.getPageHeaderSize()) {
             throw new FilerException(FaultCodes.DBE_CANNOT_CREATE, "Invalid key: '" + key + "'");
@@ -226,7 +226,12 @@
         }
 
         flush();
-        return true;
+
+        HashPageHeader ph = (HashPageHeader) p.getPageHeader();
+        HashMap meta = new HashMap(3);
+        meta.put(Record.CREATED, new Long(ph.getCreated()));
+        meta.put(Record.MODIFIED, new Long(ph.getModified()));
+        return new Record(key, value, meta);
     }
 
     /**
@@ -360,7 +365,7 @@
         }
 
         public synchronized Record getNextRecord() throws DBException {
-            return readRecord((Key) iter.next());
+            return readRecord((Key) iter.next(), false);
         }
 
         public synchronized Value getNextValue() throws DBException {

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/filer/MemFiler.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/filer/MemFiler.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/filer/MemFiler.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/filer/MemFiler.java Thu May 24 18:43:39 2007
@@ -109,15 +109,15 @@
     public void flush() {
     }
 
-    public Record readRecord(Key key) throws DBException {
+    public Record readRecord(Key key, boolean metaOnly) throws DBException {
         if (key == null || key.getLength() == 0) {
             return null;
         }
         checkOpened();
-        return (Record) hashTable.get(key);
+        return metaOnly ? new Record(key, null) : (Record) hashTable.get(key);
     }
 
-    public boolean writeRecord(Key key, Value value) throws DBException {
+    public Record writeRecord(Key key, Value value) throws DBException {
         if (key == null || key.getLength() == 0) {
             throw new FilerException(FaultCodes.DBE_CANNOT_CREATE, "Invalid key: '" + key + "'");
         }
@@ -127,7 +127,7 @@
         checkOpened();
         checkReadOnly();
         hashTable.put(key, new Record(key, value));
-        return true;
+        return new Record(key, value);
     }
 
     public boolean deleteRecord(Key key) throws DBException {

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/filer/SizeableMemFiler.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/filer/SizeableMemFiler.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/filer/SizeableMemFiler.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/filer/SizeableMemFiler.java Thu May 24 18:43:39 2007
@@ -124,15 +124,15 @@
     public void flush() {
     }
 
-    public Record readRecord(Key key) throws DBException {
+    public Record readRecord(Key key, boolean metaOnly) throws DBException {
         if (key == null || key.getLength() == 0) {
             return null;
         }
         checkOpened();
-        return (Record) hashTable.get(key);
+        return metaOnly ? new Record(key, null) : (Record) hashTable.get(key);
     }
 
-    public boolean writeRecord(Key key, Value value) throws DBException {
+    public Record writeRecord(Key key, Value value) throws DBException {
         if (key == null || key.getLength() == 0) {
             throw new FilerException(FaultCodes.DBE_CANNOT_CREATE, "Invalid key: '" + key + "'");
         }
@@ -142,7 +142,7 @@
         checkOpened();
         checkReadOnly();
         hashTable.put(key, new Record(key, value));
-        return true;
+        return new Record(key, value);
     }
 
     public boolean deleteRecord(Key key) throws DBException {

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/indexer/IndexManager.java Thu May 24 18:43:39 2007
@@ -26,6 +26,7 @@
 import org.apache.xindice.core.DBException;
 import org.apache.xindice.core.data.Key;
 import org.apache.xindice.core.data.RecordSet;
+import org.apache.xindice.core.data.Entry;
 import org.apache.xindice.util.Configuration;
 import org.apache.xindice.util.ConfigurationCallback;
 import org.apache.xindice.util.ObjectStack;
@@ -341,10 +342,10 @@
             while (rs.hasMoreRecords()) {
                 // Read only key, we don't need filer-level value
                 Key key = rs.getNextKey();
-                Object value = collection.getEntry(key);
-                if (value instanceof Document) {
+                Entry entry = collection.getEntry(key);
+                if (entry.getEntryType() == Entry.DOCUMENT) {
                     try {
-                        new SAXHandler(key, (Document)value, ACTION_CREATE, list);
+                        new SAXHandler(key, (Document) entry.getValue(), ACTION_CREATE, list);
                     } catch (Exception e) {
                         if (log.isWarnEnabled()) {
                             log.warn("Failed to index document " + key, e);

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/query/XPathQueryResolver.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/query/XPathQueryResolver.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/query/XPathQueryResolver.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/query/XPathQueryResolver.java Thu May 24 18:43:39 2007
@@ -27,6 +27,7 @@
 import org.apache.xindice.core.data.NodeSet;
 import org.apache.xindice.core.data.RecordSet;
 import org.apache.xindice.core.data.Value;
+import org.apache.xindice.core.data.Entry;
 import org.apache.xindice.core.indexer.IndexManager;
 import org.apache.xindice.core.indexer.IndexMatch;
 import org.apache.xindice.core.indexer.IndexPattern;
@@ -1244,12 +1245,12 @@
 			while (keyPos < keySet.length) {
                 final Key key = keySet[keyPos++];
 
-                Object entry = context.getEntry(key);
-                if (!(entry instanceof DBDocument)) {
+                Entry entry = context.getEntry(key);
+                if (entry.getEntryType() != Entry.DOCUMENT) {
                     continue;
                 }
 
-                DBDocument d = (DBDocument) entry;
+                DBDocument d = (DBDocument) entry.getValue();
 
                 final Node n = d.getDocumentElement();
                 if (n == null) {

Modified: xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/GetResource.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/GetResource.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/GetResource.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/GetResource.java Thu May 24 18:43:39 2007
@@ -22,6 +22,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.xindice.core.Collection;
+import org.apache.xindice.core.data.Entry;
 import org.apache.xindice.server.rpc.RPCDefaultMessage;
 import org.apache.xindice.util.SymbolSerializer;
 import org.apache.xindice.xml.TextWriter;
@@ -50,14 +51,14 @@
         }
 
         Collection col = getCollection((String) message.get(COLLECTION));
-        Object obj = col.getEntry(message.get(NAME));
+        Entry obj = col.getEntry(message.get(NAME));
 
         Hashtable result = new Hashtable();
         if (obj == null) {
             // Return empty result
-        } else if (obj instanceof byte[]) {
+        } else if (obj.getEntryType() == Entry.BINARY) {
             // Binary resource
-            result.put(RESULT, obj);
+            result.put(RESULT, obj.getValue());
         } else if (message.containsKey(COMPRESSED)) {
             SymbolSerializer symbolSerializer = null;
             try {
@@ -80,15 +81,14 @@
             */
 
             // Document might be compressed (with bytes) or not. In a latter case, convert to string.
-            Document doc = (Document) obj;
+            Document doc = (Document) obj.getValue();
             if (/*( timestamp != -1) &&*/ symbolSerializer != null && ((CompressedDocument) doc).getDataBytes() != null) {
-                result.put(RESULT,
-                           symbolSerializer.convertFromDocument(doc, timestamp));
+                result.put(RESULT, symbolSerializer.convertFromDocument(doc, timestamp));
             } else {
                 result.put(RESULT, TextWriter.toString(doc));
             }
         } else {
-            Document doc = (Document) obj;
+            Document doc = (Document) obj.getValue();
             result.put(RESULT, TextWriter.toString(doc));
         }
 

Modified: xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/InsertResource.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/InsertResource.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/InsertResource.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/server/rpc/messages/InsertResource.java Thu May 24 18:43:39 2007
@@ -58,10 +58,18 @@
 
         Collection col = getCollection((String) message.get(COLLECTION));
         if (obj instanceof byte[]) {
-            id = col.insertBinary(id, (byte[])obj).toString();
+            if (id == null) {
+                id = col.insertBinary((byte[])obj).toString();
+            } else {
+                col.setBinary(id, (byte[])obj);
+            }
         } else {
             Document doc = DOMParser.toDocument((String) obj);
-            id = col.insertDocument(id, doc).toString();
+            if (id == null) {
+                id = col.insertDocument(doc).toString();
+            } else {
+                col.setDocument(id, doc);
+            }
         }
 
         Hashtable result = new Hashtable();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.