Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 16037 invoked from network); 21 Mar 2011 15:19:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Mar 2011 15:19:32 -0000 Received: (qmail 3409 invoked by uid 500); 21 Mar 2011 15:19:32 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 3376 invoked by uid 500); 21 Mar 2011 15:19:32 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 3369 invoked by uid 99); 21 Mar 2011 15:19:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Mar 2011 15:19:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Mar 2011 15:19:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id F378B23888EA; Mon, 21 Mar 2011 15:18:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1083827 - /jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java Date: Mon, 21 Mar 2011 15:18:55 -0000 To: commits@jackrabbit.apache.org From: stefan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110321151855.F378B23888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: stefan Date: Mon Mar 21 15:18:55 2011 New Revision: 1083827 URL: http://svn.apache.org/viewvc?rev=1083827&view=rev Log: drafting a MicroKernel api (WIP) Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java?rev=1083827&r1=1083826&r2=1083827&view=diff ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java (original) +++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java Mon Mar 21 15:18:55 2011 @@ -29,7 +29,7 @@ import java.io.InputStream; *
  • predefined timeout (e.g. 50ms) for reading methods
  • *
  • portable to C
  • *
  • efficient support for large number of child nodes
  • - *
  • integrated DataStore for storing/retrieving large binaries
  • + *
  • integrated API for storing/retrieving large binaries (correspond
  • * * * The MicroKernel Data Model: @@ -127,8 +127,6 @@ public interface MicroKernel { * [ { "id" : "", "ts" : , "changes" : "" }, ... ] * * - * @todo format of embedded JSON diff? encoding? (TBD) - * * @param fromRevisionId first revision to be returned in journal * @param toRevisionId last revision to be returned in journal * @return a chronological list of revisions in JSON format @@ -141,57 +139,60 @@ public interface MicroKernel { //-------------------------------------------------------------< READ ops > /** + * Determines whether the specified node exists. * - * @param idOrPath - * @param revisionId - * @return + * @param idOrPath identifier or path + * @param revisionId revision + * @return true if the specified node exists, otherwise false * @throws MicroKernelException if an error occurs */ boolean nodeExists(String idOrPath, String revisionId) throws MicroKernelException; /** * - * @param idOrPath + * @param idOrPath identifier or path * @param depth - * @param revisionId + * @param revisionId revision * @return * @throws MicroKernelException if an error occurs */ /* @todo how should flat hierarchies be handled/represented? use special child node entry/placeholder ([...]) if child node list is truncated?*/ String /* jsonTree */ getNodes(String idOrPath, int depth, String revisionId) throws MicroKernelException; + // specialized methods for reading flat hierarchies + /** * - * @param idOrPath + * @param idOrPath identifier or path denoting parent node * @param offset * @param count * @param depth - * @param revisionId + * @param revisionId revision * @return * @throws MicroKernelException if an error occurs */ - // specialized methods for reading flat hierarchies String /* array of jsonTrees */ getChildNodes(String idOrPath, long offset, long count, int depth, String revisionId) throws MicroKernelException; /** * - * @param idOrPath - * @param revisionId + * @param idOrPath identifier or path denoting parent node + * @param revisionId revision * @return * @throws MicroKernelException if an error occurs */ // maybe represented as special property (":childNodeCount") -> no need for specific api method? - long getChildNodeCount(String idOrPath, String revisionId) + long /* count */ getChildNodeCount(String idOrPath, String revisionId) throws MicroKernelException; //------------------------------------------------------------< WRITE ops > /** + * Applies the specified changes on the specified target node. * - * @param idOrPath - * @param jsonDiff - * @return + * @param idOrPath identifier or path denoting target node + * @param jsonDiff changes to be applied in JSON diff format. + * @return id of newly created revision * @throws MicroKernelException if an error occurs */ String /* revisionId */ commit(String idOrPath, String jsonDiff) @@ -201,31 +202,45 @@ public interface MicroKernel { //--------------------------------------------------< BLOB READ/WRITE ops > /** + * Returns the length of the specified blob. * - * @param dsId - * @return + * @todo encode length in id? + * + * @param blobId blob identifier + * @return length of the specified blob * @throws MicroKernelException if an error occurs */ - // @todo encode length in id? => yes - long getLength(String dsId) throws MicroKernelException; + long getLength(String blobId) throws MicroKernelException; /** + * Reads up to length bytes of data from the specified blob into + * the given array of bytes. An attempt is made to read as many as + * length bytes, but a smaller number may be read. + * The number of bytes actually read is returned as an integer. * - * @param dsId - * @param buf - * @param off - * @param size - * @return + * @param blobId blob identifier + * @param buf the buffer into which the data is read. + * @param off the start offset in array buff + * at which the data is written. + * @param length the maximum number of bytes to read + * @return the total number of bytes read into the buffer, or + * -1 if there is no more data because the end of + * the blob content has been reached. * @throws MicroKernelException if an error occurs */ - int /* count */ read(String dsId, byte[] buf, int off, int size) + int /* count */ read(String blobId, byte[] buf, int off, int length) throws MicroKernelException; /** - * - * @param in - * @return + * Stores the content of the given stream and returns an associated + * identifier for later retrieval. + *

    + * If identical stream content has been stored previously, then the existing + * identifier will be returned instead of storing a redundant copy. + + * @param in InputStream providing the blob content + * @return blob identifier associated with the given content * @throws MicroKernelException if an error occurs */ - String /* dsId */ write(InputStream in) throws MicroKernelException; + String /* blobId */ write(InputStream in) throws MicroKernelException; }