org.apache.jackrabbit.mk.store
Class DefaultRevisionStore

java.lang.Object
  extended by org.apache.jackrabbit.mk.store.DefaultRevisionStore
All Implemented Interfaces:
Closeable, RevisionProvider, RevisionStore

public class DefaultRevisionStore
extends Object
implements RevisionStore, Closeable

Default revision store implementation, passing calls to a Persistence and a BlobStore, respectively and providing caching.


Field Summary
static String CACHE_SIZE
           
static int DEFAULT_CACHE_SIZE
           
 
Constructor Summary
DefaultRevisionStore(Persistence pm)
           
 
Method Summary
 void close()
           
protected  int determineInitialCacheSize()
           
 ChildNodeEntriesMap getCNEMap(Id id)
           
 StoredCommit getCommit(Id id)
           
 StoredCommit getHeadCommit()
           
 Id getHeadCommitId()
           
 Id getId(NodeState node)
          Adapts the given NodeState to the corresponding identifier.
 StoredNode getNode(Id id)
           
 NodeState getNodeState(StoredNode node)
          Adapts the given StoredNode to a corresponding NodeState instance.
 StoredNode getRootNode(Id commitId)
           
 void initialize()
           
 void lockHead()
          Lock the head.
 Id putCNEMap(ChildNodeEntriesMap map)
           
 Id putHeadCommit(MutableCommit commit)
          Put a new head commit.
 Id putNode(MutableNode node)
           
 void unlockHead()
          Unlock the head.
protected  void verifyInitialized()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHE_SIZE

public static final String CACHE_SIZE
See Also:
Constant Field Values

DEFAULT_CACHE_SIZE

public static final int DEFAULT_CACHE_SIZE
See Also:
Constant Field Values
Constructor Detail

DefaultRevisionStore

public DefaultRevisionStore(Persistence pm)
Method Detail

initialize

public void initialize()
                throws Exception
Throws:
Exception

close

public void close()
Specified by:
close in interface Closeable

verifyInitialized

protected void verifyInitialized()

determineInitialCacheSize

protected int determineInitialCacheSize()

putNode

public Id putNode(MutableNode node)
           throws Exception
Specified by:
putNode in interface RevisionStore
Throws:
Exception

putCNEMap

public Id putCNEMap(ChildNodeEntriesMap map)
             throws Exception
Specified by:
putCNEMap in interface RevisionStore
Throws:
Exception

lockHead

public void lockHead()
Description copied from interface: RevisionStore
Lock the head. Must be called prior to putting a new head commit.

Specified by:
lockHead in interface RevisionStore
See Also:
RevisionStore.putHeadCommit(MutableCommit)

putHeadCommit

public Id putHeadCommit(MutableCommit commit)
                 throws Exception
Description copied from interface: RevisionStore
Put a new head commit. Must be called while holding a lock on the head.

Specified by:
putHeadCommit in interface RevisionStore
Parameters:
commit - commit
Returns:
head commit id
Throws:
Exception - if an error occurs
See Also:
RevisionStore.lockHead()

unlockHead

public void unlockHead()
Description copied from interface: RevisionStore
Unlock the head.

Specified by:
unlockHead in interface RevisionStore

getNodeState

public NodeState getNodeState(StoredNode node)
Description copied from interface: RevisionProvider
Adapts the given StoredNode to a corresponding NodeState instance.

Specified by:
getNodeState in interface RevisionProvider
Parameters:
node - stored node instance
Returns:
node state adapter

getId

public Id getId(NodeState node)
Description copied from interface: RevisionProvider
Adapts the given NodeState to the corresponding identifier.

Specified by:
getId in interface RevisionProvider
Parameters:
node - node state
Returns:
node identifier

getNode

public StoredNode getNode(Id id)
                   throws NotFoundException,
                          Exception
Specified by:
getNode in interface RevisionProvider
Throws:
NotFoundException
Exception

getCNEMap

public ChildNodeEntriesMap getCNEMap(Id id)
                              throws NotFoundException,
                                     Exception
Specified by:
getCNEMap in interface RevisionProvider
Throws:
NotFoundException
Exception

getCommit

public StoredCommit getCommit(Id id)
                       throws NotFoundException,
                              Exception
Specified by:
getCommit in interface RevisionProvider
Throws:
NotFoundException
Exception

getRootNode

public StoredNode getRootNode(Id commitId)
                       throws NotFoundException,
                              Exception
Specified by:
getRootNode in interface RevisionProvider
Throws:
NotFoundException
Exception

getHeadCommit

public StoredCommit getHeadCommit()
                           throws Exception
Specified by:
getHeadCommit in interface RevisionProvider
Throws:
Exception

getHeadCommitId

public Id getHeadCommitId()
                   throws Exception
Specified by:
getHeadCommitId in interface RevisionProvider
Throws:
Exception


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