You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2011/03/11 16:28:16 UTC

svn commit: r1080606 - /jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernel.java

Author: stefan
Date: Fri Mar 11 15:28:16 2011
New Revision: 1080606

URL: http://svn.apache.org/viewvc?rev=1080606&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=1080606&r1=1080605&r2=1080606&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 Fri Mar 11 15:28:16 2011
@@ -20,12 +20,16 @@ package org.apache.jackrabbit.mk;
  * TBD:
  *
  * - workspaces are just top-level nodes (e.g. /default. /system)
- *   => no need for inter-workspace operations, simplified versioning implenentation
+ *   => no need for inter-workspace operations, simplified versioning implementation
  *
  * - nodeId is unique per repository and system-generated (e.g. sha1 or similar)
+ *   is the concept of a nodeId really required? if yes, how should the nodeId
+ *   be exposed? as a system-generated synthetic property? should every node
+ *   have a nodeId? if not, what governs the assignment of a nodeId?
  *
  * - jcr:uuid is a regular property, decorated on top of rmk, will require an external
- *   uuid2nodeId index
+ *   uuid2nodeId index; alternatively jcr:uuid 'is' the nodeId -> no separate
+ *   index required
  *
  * - all properties are multi-valued strings or byte[] (simplifies api)
  *
@@ -45,44 +49,55 @@ public interface MicroKernel {
      */
     String /* revisionId */ getHeadRevision();
     // history entry: revisionId, timestamp
-    String /* jsonObject */ getHistory(String idOrPath, long since) throws MicroKernelException;
+    // todo: is the idOrPath parameter required if we're using a DAG model (as opposed to delta-based)
+    String /* jsonObject */ getHistory(String idOrPath, long fromTS, long toTS) throws MicroKernelException;
+    String /* jsonDiff */ diff(String revisionId1, String revisionId2) throws MicroKernelException;
 
 
     /**
      * READ ops
      */
     /* @todo are the following methods needed? */
-    String /* nodeId */ getNodeId(String path, String revision) throws MicroKernelException;
-    String /* path */ getNodePath(String id, String revision) throws MicroKernelException;
-
-    boolean nodeExists(String idOrPath, String revision) throws MicroKernelException;
-    boolean propertyExists(String idOrPath, String revision) throws MicroKernelException;
-
-    String[] /* propNames */ getProperties(String idOrPath, String revision) throws MicroKernelException;
-    String[] /* propValue */ getProperty(String idOrPath, String revision) throws MicroKernelException;
-    byte[] /* propValue */ getBinaryProperty(String idOrPath, String revision) throws MicroKernelException;
-    int /* propType */ getPropertyType(String idOrPath, String revision) throws MicroKernelException;
+    // id<->path mapping
+    String /* nodeId */ getNodeId(String path, String revisionId) throws MicroKernelException;
+    String /* path */ getNodePath(String id, String revisionId) throws MicroKernelException;
+
+    boolean nodeExists(String idOrPath, String revisionId) throws MicroKernelException;
+    boolean propertyExists(String idOrPath, String revisionId) throws MicroKernelException;
+
+    String[] /* propNames */ getProperties(String idOrPath, String revisionId) throws MicroKernelException;
+    String[] /* propValue */ getProperty(String idOrPath, String revisionId) throws MicroKernelException;
+    byte[] /* propValue */ getBinaryProperty(String idOrPath, String revisionId) throws MicroKernelException;
+    int /* propType */ getPropertyType(String idOrPath, String revisionId) throws MicroKernelException;
 
     /* @todo return all properties in json format instead? */
-    //String /* jsonObject */ getProperties(String idOrPath, String revision) throws RMKException;
+    //String /* jsonObject */ getProperties(String idOrPath, String revisionId) throws RMKException;
 
     /* @todo blobs (-> DataStore api?) */
 
+    long getLength(String dsId) throws MicroKernelException;
+    int /* count */ read(String dsId, byte[] buf, int off, int size) throws MicroKernelException;
+    String /* dsId */ write(byte[] data, int length) throws MicroKernelException;
+    String /* dsId */ join(String[] dsIds, boolean dispose) throws MicroKernelException;
+
+
+
     /* @todo how should nodeId be exposed? */
-    String[] /* nodeNames */ getChildNodes(String idOrPath, String revision) throws MicroKernelException;
-    String[] /* nodeNames */ getChildNodes(String idOrPath, long offset, long count, String revision) throws MicroKernelException;
-    long getChildNodeCount(String idOrPath, String revision) throws MicroKernelException;
 
-    /* @todo return entire subtree in json format? */
-    String /* jsonTree */ getNodeTree(String idOrPath, int depth, String revision) throws MicroKernelException;
+    // specialized methods for reading flat hierarchies
+    String[] /* nodeNames */ getChildNodes(String idOrPath, String revisionId) throws MicroKernelException;
+    String[] /* nodeNames */ getChildNodes(String idOrPath, long offset, long count, String revisionId) throws MicroKernelException;
+    long getChildNodeCount(String idOrPath, String revisionId) throws MicroKernelException;
+
+    /* @todo return entire subtree in json format? how should flat hierarchies be handled/represented? */
+    String /* jsonTree */ getNodeTree(String idOrPath, int depth, String revisionId) throws MicroKernelException;
 
-    String /* jsonDiff */ diff(String revision1, String revision2) throws MicroKernelException;
 
     /**
      * WRITE ops
      */
     /* @todo JSOP diff format doesn't specify a 'copy' op */
     /* @todo JSOP format doesn't provide property type information */
-    String /* revision */ commit(String idOrPath, String jsonDiff) throws MicroKernelException;
+    String /* revisionId */ commit(String idOrPath, String jsonDiff) throws MicroKernelException;
 }