Class AbstractRoutingContentStore

  • All Implemented Interfaces:
    org.alfresco.repo.content.ContentStore
    Direct Known Subclasses:
    AbstractTenantRoutingContentStore

    public abstract class AbstractRoutingContentStore
    extends java.lang.Object
    implements org.alfresco.repo.content.ContentStore
    A store providing support for content store implementations that provide routing of content read and write requests based on context.
    Since:
    2.1
    Author:
    Derek Hulley
    See Also:
    ContentContext
    • Field Summary

      • Fields inherited from interface org.alfresco.repo.content.ContentStore

        NEW_CONTENT_CONTEXT, PROTOCOL_DELIMITER
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean delete​(java.lang.String contentUrl)
      This operation has to be performed on all the stores in order to maintain the ContentStore.exists(String) contract.
      boolean exists​(java.lang.String contentUrl)  
      protected abstract java.util.List<org.alfresco.repo.content.ContentStore> getAllStores()  
      org.alfresco.service.cmr.repository.ContentReader getReader​(java.lang.String contentUrl)  
      java.lang.String getRootLocation()  
      long getSpaceFree()  
      long getSpaceTotal()  
      org.alfresco.service.cmr.repository.ContentWriter getWriter​(org.alfresco.repo.content.ContentContext context)
      Selects a store for the given context and caches store that was used.
      org.alfresco.service.cmr.repository.ContentWriter getWriter​(org.alfresco.service.cmr.repository.ContentReader existingContentReader, java.lang.String newContentUrl)  
      boolean isContentUrlSupported​(java.lang.String contentUrl)  
      boolean isWriteSupported()  
      protected abstract org.alfresco.repo.content.ContentStore selectWriteStore​(org.alfresco.repo.content.ContentContext ctx)
      Get a content store based on the context provided.
      void setStoresCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.util.Pair<java.lang.String,​java.lang.String>,​org.alfresco.repo.content.ContentStore> storesCache)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractRoutingContentStore

        protected AbstractRoutingContentStore()
    • Method Detail

      • setStoresCache

        public void setStoresCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.util.Pair<java.lang.String,​java.lang.String>,​org.alfresco.repo.content.ContentStore> storesCache)
        Parameters:
        storesCache - cache of stores used to access URLs
      • getAllStores

        protected abstract java.util.List<org.alfresco.repo.content.ContentStore> getAllStores()
        Returns:
        Returns a list of all possible stores available for reading or writing
      • selectWriteStore

        protected abstract org.alfresco.repo.content.ContentStore selectWriteStore​(org.alfresco.repo.content.ContentContext ctx)
        Get a content store based on the context provided. The applicability of the context and even the types of context allowed are up to the implementation, but normally there should be a fallback case for when the parameters are not adequate to make a decision.
        Parameters:
        ctx - the context to use to make the choice
        Returns:
        Returns the store most appropriate for the given context and never null
      • isContentUrlSupported

        public boolean isContentUrlSupported​(java.lang.String contentUrl)
        Specified by:
        isContentUrlSupported in interface org.alfresco.repo.content.ContentStore
        Returns:
        Returns true if the URL is supported by any of the stores.
      • isWriteSupported

        public boolean isWriteSupported()
        Specified by:
        isWriteSupported in interface org.alfresco.repo.content.ContentStore
        Returns:
        Returns true if write is supported by any of the stores.
      • getRootLocation

        public java.lang.String getRootLocation()
        Specified by:
        getRootLocation in interface org.alfresco.repo.content.ContentStore
        Returns:
        Returns . always
      • getSpaceFree

        public long getSpaceFree()
        Specified by:
        getSpaceFree in interface org.alfresco.repo.content.ContentStore
        Returns:
        Returns -1 always
      • getSpaceTotal

        public long getSpaceTotal()
        Specified by:
        getSpaceTotal in interface org.alfresco.repo.content.ContentStore
        Returns:
        Returns -1 always
      • exists

        public boolean exists​(java.lang.String contentUrl)
                       throws org.alfresco.service.cmr.repository.ContentIOException
        Specified by:
        exists in interface org.alfresco.repo.content.ContentStore
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException
        See Also:
        selectReadStore(String)
      • getReader

        public org.alfresco.service.cmr.repository.ContentReader getReader​(java.lang.String contentUrl)
                                                                    throws org.alfresco.service.cmr.repository.ContentIOException
        Specified by:
        getReader in interface org.alfresco.repo.content.ContentStore
        Returns:
        Returns a valid reader from one of the stores otherwise a EmptyContentReader is returned.
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException
      • getWriter

        public org.alfresco.service.cmr.repository.ContentWriter getWriter​(org.alfresco.repo.content.ContentContext context)
                                                                    throws org.alfresco.service.cmr.repository.ContentIOException
        Selects a store for the given context and caches store that was used.
        Specified by:
        getWriter in interface org.alfresco.repo.content.ContentStore
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException
        See Also:
        selectWriteStore(ContentContext)
      • getWriter

        public org.alfresco.service.cmr.repository.ContentWriter getWriter​(org.alfresco.service.cmr.repository.ContentReader existingContentReader,
                                                                           java.lang.String newContentUrl)
                                                                    throws org.alfresco.service.cmr.repository.ContentIOException
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException
      • delete

        public boolean delete​(java.lang.String contentUrl)
                       throws org.alfresco.service.cmr.repository.ContentIOException
        This operation has to be performed on all the stores in order to maintain the ContentStore.exists(String) contract.
        Specified by:
        delete in interface org.alfresco.repo.content.ContentStore
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException