Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.api.repository.cache
Class CachingRepositoryInstanceHandler

java.lang.Object
  extended by org.nuxeo.ecm.core.api.repository.RepositoryInstanceHandler
      extended by org.nuxeo.ecm.core.api.repository.cache.CachingRepositoryInstanceHandler
All Implemented Interfaces:
java.io.Serializable, java.lang.reflect.InvocationHandler, DocumentModelCache, RepositoryConnection

public class CachingRepositoryInstanceHandler
extends RepositoryInstanceHandler
implements DocumentModelCache

Cached children are not preserving order The order should be updated from notifications

Author:
Bogdan Stefanescu
See Also:
Serialized Form

Field Summary
static Log log
           
 
Fields inherited from class org.nuxeo.ecm.core.api.repository.RepositoryInstanceHandler
NULL
 
Constructor Summary
CachingRepositoryInstanceHandler(Repository repository)
           
CachingRepositoryInstanceHandler(Repository repository, RepositoryExceptionHandler exceptionHandler)
           
 
Method Summary
 void addListener(DocumentModelCacheListener listener)
           
 void cacheChild(DocumentRef parent, DocumentRef child)
           
 void cacheChildren(DocumentRef parent, DocumentModelList children)
          This will modify the given list and replace documents with the cached versions.
 DocumentModel cacheDocument(DocumentModel doc)
          The doc cache should be always updated first (before paths cache).
 DocumentModel createDocument(DocumentModel doc)
           
 DocumentModel[] createDocument(DocumentModel[] docs)
           
 DocumentModel createDocumentModel(java.lang.String type)
           
 DocumentModel createDocumentModel(java.lang.String type, java.util.Map<java.lang.String,java.lang.Object> options)
           
 DocumentModel createDocumentModel(java.lang.String parentPath, java.lang.String id, java.lang.String type)
           
 DocumentModel createProxy(DocumentRef parentRef, DocumentRef docRef, VersionModel version, boolean overwriteExistingProxy)
           
 DocumentModelList fetchAndCacheChildren(DocumentRef parent)
           
 DocumentModelList fetchChildren(DocumentRef parent)
           
 DocumentModel fetchDocument(DocumentRef ref)
           
 DocumentModelList filterByFacet(DocumentModelList docs, java.lang.String facet)
           
 DocumentModelList filterByType(DocumentModelList docs, java.lang.String type)
           
 DocumentModelList filterWithoutFacet(DocumentModelList docs, java.lang.String facet)
           
 void flushDocumentCache()
           
 DocumentModelList getCachedChildren(DocumentRef parent)
           
 DocumentModelList getCachedChildrenWithFacet(DocumentRef parent, java.lang.String facet)
           
 DocumentModelList getCachedChildrenWithoutFacet(DocumentRef parent, java.lang.String facet)
           
 DocumentModelList getCachedChildrenWithType(DocumentRef parent, java.lang.String type)
           
 DocumentModel getCachedDocument(DocumentRef ref)
           
 DocumentModel getChild(DocumentRef parent, java.lang.String name)
           
 DocumentModelList getChildren(DocumentRef parent)
           
 DocumentModelList getChildren(DocumentRef parent, java.lang.String type)
           
 DocumentModelIterator getChildrenIterator(DocumentRef parent)
           
 DocumentModel getDocument(DocumentRef ref)
           
 java.lang.String getDocumentId(DocumentRef docRef)
          Children Cache
 DocumentModelList getFiles(DocumentRef parent)
           
 DocumentModelList getFolders(DocumentRef parent)
           
 DocumentModel getParentDocument(DocumentRef ref)
           
 java.security.Principal getPrincipal()
           
 java.lang.Class<?>[] getProxyInterfaces()
           
 java.lang.String getRepositoryName()
           
 DocumentModel getRootDocument()
           
 java.lang.String getSessionId()
           
 void handleDirtyUpdateTag(java.lang.Object tag)
           
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
 DocumentModelList query(java.lang.String query)
           
 void removeListener(DocumentModelCacheListener listener)
           
 void save()
           
 void uncacheChild(DocumentRef parent, DocumentRef child)
           
 void uncacheChildren(DocumentRef parent)
           
 DocumentModel uncacheDocument(DocumentRef ref)
           
 
Methods inherited from class org.nuxeo.ecm.core.api.repository.RepositoryInstanceHandler
close, getExceptionHandler, getProxy, getRepository, getSession, writeReplace
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final Log log
Constructor Detail

CachingRepositoryInstanceHandler

public CachingRepositoryInstanceHandler(Repository repository)

CachingRepositoryInstanceHandler

public CachingRepositoryInstanceHandler(Repository repository,
                                        RepositoryExceptionHandler exceptionHandler)
Method Detail

getProxyInterfaces

public java.lang.Class<?>[] getProxyInterfaces()
Overrides:
getProxyInterfaces in class RepositoryInstanceHandler

getPrincipal

public java.security.Principal getPrincipal()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

getSessionId

public java.lang.String getSessionId()
                              throws java.lang.Exception
Throws:
java.lang.Exception

getRepositoryName

public java.lang.String getRepositoryName()

cacheDocument

public DocumentModel cacheDocument(DocumentModel doc)
The doc cache should be always updated first (before paths cache). It is not a blocking issue if we end up with garbage in the path cache (path mappings to IDs that doesn't exists anymore in the doc cache)

Specified by:
cacheDocument in interface DocumentModelCache

uncacheDocument

public DocumentModel uncacheDocument(DocumentRef ref)
Specified by:
uncacheDocument in interface DocumentModelCache

getCachedDocument

public DocumentModel getCachedDocument(DocumentRef ref)
Specified by:
getCachedDocument in interface DocumentModelCache

flushDocumentCache

public void flushDocumentCache()
Specified by:
flushDocumentCache in interface DocumentModelCache

fetchDocument

public DocumentModel fetchDocument(DocumentRef ref)
                            throws ClientException
Specified by:
fetchDocument in interface DocumentModelCache
Throws:
ClientException

getChild

public DocumentModel getChild(DocumentRef parent,
                              java.lang.String name)
                       throws ClientException
Throws:
ClientException

getRootDocument

public DocumentModel getRootDocument()
                              throws ClientException
Throws:
ClientException

getDocument

public DocumentModel getDocument(DocumentRef ref)
                          throws ClientException
Throws:
ClientException

getParentDocument

public DocumentModel getParentDocument(DocumentRef ref)
                                throws ClientException
Throws:
ClientException

getChildren

public DocumentModelList getChildren(DocumentRef parent)
                              throws ClientException
Throws:
ClientException

getChildrenIterator

public DocumentModelIterator getChildrenIterator(DocumentRef parent)
                                          throws ClientException
Throws:
ClientException

query

public DocumentModelList query(java.lang.String query)
                        throws ClientException
Throws:
ClientException

getFiles

public DocumentModelList getFiles(DocumentRef parent)
                           throws ClientException
Throws:
ClientException

getFolders

public DocumentModelList getFolders(DocumentRef parent)
                             throws ClientException
Throws:
ClientException

getChildren

public DocumentModelList getChildren(DocumentRef parent,
                                     java.lang.String type)
                              throws ClientException
Throws:
ClientException

createDocument

public DocumentModel createDocument(DocumentModel doc)
                             throws ClientException
Throws:
ClientException

createDocument

public DocumentModel[] createDocument(DocumentModel[] docs)
                               throws ClientException
Throws:
ClientException

createDocumentModel

public DocumentModel createDocumentModel(java.lang.String type)
                                  throws ClientException
Throws:
ClientException

createDocumentModel

public DocumentModel createDocumentModel(java.lang.String type,
                                         java.util.Map<java.lang.String,java.lang.Object> options)
                                  throws ClientException
Throws:
ClientException

createDocumentModel

public DocumentModel createDocumentModel(java.lang.String parentPath,
                                         java.lang.String id,
                                         java.lang.String type)
                                  throws ClientException
Throws:
ClientException

createProxy

public DocumentModel createProxy(DocumentRef parentRef,
                                 DocumentRef docRef,
                                 VersionModel version,
                                 boolean overwriteExistingProxy)
                          throws ClientException
Throws:
ClientException

getDocumentId

public java.lang.String getDocumentId(DocumentRef docRef)
Children Cache

Throws:
ClientException

cacheChildren

public void cacheChildren(DocumentRef parent,
                          DocumentModelList children)
This will modify the given list and replace documents with the cached versions.

Specified by:
cacheChildren in interface DocumentModelCache

uncacheChildren

public void uncacheChildren(DocumentRef parent)
Specified by:
uncacheChildren in interface DocumentModelCache

fetchChildren

public DocumentModelList fetchChildren(DocumentRef parent)
                                throws java.lang.Exception
Specified by:
fetchChildren in interface DocumentModelCache
Throws:
java.lang.Exception

filterByFacet

public DocumentModelList filterByFacet(DocumentModelList docs,
                                       java.lang.String facet)

filterWithoutFacet

public DocumentModelList filterWithoutFacet(DocumentModelList docs,
                                            java.lang.String facet)

filterByType

public DocumentModelList filterByType(DocumentModelList docs,
                                      java.lang.String type)

fetchAndCacheChildren

public DocumentModelList fetchAndCacheChildren(DocumentRef parent)
                                        throws ClientException
Specified by:
fetchAndCacheChildren in interface DocumentModelCache
Throws:
ClientException

getCachedChildren

public DocumentModelList getCachedChildren(DocumentRef parent)
                                    throws ClientException
Specified by:
getCachedChildren in interface DocumentModelCache
Throws:
ClientException

getCachedChildrenWithType

public DocumentModelList getCachedChildrenWithType(DocumentRef parent,
                                                   java.lang.String type)
                                            throws ClientException
Throws:
ClientException

getCachedChildrenWithFacet

public DocumentModelList getCachedChildrenWithFacet(DocumentRef parent,
                                                    java.lang.String facet)
                                             throws ClientException
Throws:
ClientException

getCachedChildrenWithoutFacet

public DocumentModelList getCachedChildrenWithoutFacet(DocumentRef parent,
                                                       java.lang.String facet)
                                                throws ClientException
Throws:
ClientException

cacheChild

public void cacheChild(DocumentRef parent,
                       DocumentRef child)
Specified by:
cacheChild in interface DocumentModelCache

uncacheChild

public void uncacheChild(DocumentRef parent,
                         DocumentRef child)
Specified by:
uncacheChild in interface DocumentModelCache

save

public void save()

handleDirtyUpdateTag

public void handleDirtyUpdateTag(java.lang.Object tag)
Specified by:
handleDirtyUpdateTag in interface DocumentModelCache

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Overrides:
invoke in class RepositoryInstanceHandler
Throws:
java.lang.Throwable

addListener

public void addListener(DocumentModelCacheListener listener)
Specified by:
addListener in interface DocumentModelCache

removeListener

public void removeListener(DocumentModelCacheListener listener)
Specified by:
removeListener in interface DocumentModelCache

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.