org.apache.jackrabbit.mk.core
Class MicroKernelImpl

java.lang.Object
  extended by org.apache.jackrabbit.mk.core.MicroKernelImpl
All Implemented Interfaces:
org.apache.jackrabbit.mk.api.MicroKernel
Direct Known Subclasses:
MicroKernelService

public class MicroKernelImpl
extends Object
implements org.apache.jackrabbit.mk.api.MicroKernel


Field Summary
protected  Repository rep
           
 
Constructor Summary
MicroKernelImpl()
          Creates a new in-memory kernel instance that doesn't need to be explicitly closed, i.e.
MicroKernelImpl(Repository rep)
          Alternate constructor, used for testing.
MicroKernelImpl(String homeDir)
           
 
Method Summary
 String branch(String trunkRevisionId)
           
 String commit(String path, String jsonDiff, String revisionId, String message)
           
 String diff(String fromRevision, String toRevision, String path, int depth)
           
 void dispose()
           
 long getChildNodeCount(String path, String revisionId)
           
 String getHeadRevision()
           
 String getJournal(String fromRevision, String toRevision, String path)
           
 long getLength(String blobId)
           
 String getNodes(String path, String revisionId, int depth, long offset, int maxChildNodes, String filter)
           
 String getRevisionHistory(long since, int maxEntries, String path)
           
protected  void init(String homeDir)
           
 String merge(String branchRevisionId, String message)
           
 boolean nodeExists(String path, String revisionId)
           
 int read(String blobId, long pos, byte[] buff, int off, int length)
           
 String waitForCommit(String oldHeadRevisionId, long maxWaitMillis)
           
 String write(InputStream in)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rep

protected Repository rep
Constructor Detail

MicroKernelImpl

public MicroKernelImpl(String homeDir)
                throws org.apache.jackrabbit.mk.api.MicroKernelException
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

MicroKernelImpl

public MicroKernelImpl()
Creates a new in-memory kernel instance that doesn't need to be explicitly closed, i.e. standard Java garbage collection will take care of releasing any acquired resources when no longer needed. Useful especially for test cases and other similar scenarios.


MicroKernelImpl

public MicroKernelImpl(Repository rep)
Alternate constructor, used for testing.

Parameters:
rep - repository, already initialized
Method Detail

init

protected void init(String homeDir)
             throws org.apache.jackrabbit.mk.api.MicroKernelException
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

dispose

public void dispose()

getHeadRevision

public String getHeadRevision()
                       throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
getHeadRevision in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

getRevisionHistory

public String getRevisionHistory(long since,
                                 int maxEntries,
                                 String path)
                          throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
getRevisionHistory in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

waitForCommit

public String waitForCommit(String oldHeadRevisionId,
                            long maxWaitMillis)
                     throws org.apache.jackrabbit.mk.api.MicroKernelException,
                            InterruptedException
Specified by:
waitForCommit in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException
InterruptedException

getJournal

public String getJournal(String fromRevision,
                         String toRevision,
                         String path)
                  throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
getJournal in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

diff

public String diff(String fromRevision,
                   String toRevision,
                   String path,
                   int depth)
            throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
diff in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

nodeExists

public boolean nodeExists(String path,
                          String revisionId)
                   throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
nodeExists in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

getChildNodeCount

public long getChildNodeCount(String path,
                              String revisionId)
                       throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
getChildNodeCount in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

getNodes

public String getNodes(String path,
                       String revisionId,
                       int depth,
                       long offset,
                       int maxChildNodes,
                       String filter)
                throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
getNodes in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

commit

public String commit(String path,
                     String jsonDiff,
                     String revisionId,
                     String message)
              throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
commit in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

branch

public String branch(String trunkRevisionId)
              throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
branch in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

merge

public String merge(String branchRevisionId,
                    String message)
             throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
merge in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

getLength

public long getLength(String blobId)
               throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
getLength in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

read

public int read(String blobId,
                long pos,
                byte[] buff,
                int off,
                int length)
         throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
read in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException

write

public String write(InputStream in)
             throws org.apache.jackrabbit.mk.api.MicroKernelException
Specified by:
write in interface org.apache.jackrabbit.mk.api.MicroKernel
Throws:
org.apache.jackrabbit.mk.api.MicroKernelException


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.