Class MultiStorer

  • All Implemented Interfaces:
    com.logicaldoc.core.store.Storer, Comparable<com.logicaldoc.core.store.Storer>

    public class MultiStorer
    extends com.logicaldoc.core.store.AbstractStorer
    This is a specialization of the Storer able to span the repository among multiple storages. In a given time only one store is the write one and allow for the store of newly created documents.
    Since:
    6.1
    Author:
    Marco Meschieri - LogicalDOC
    • Constructor Detail

      • MultiStorer

        public MultiStorer()
    • Method Detail

      • encryptAll

        public long encryptAll()
        Encrypts all documents in whatever file-system based storage with encrypted flag active
        Returns:
        number of encrypted files
      • getTotalSize

        public long getTotalSize()
      • store

        public void store​(File file,
                          long docId,
                          String resource)
                   throws IOException
        Specified by:
        store in interface com.logicaldoc.core.store.Storer
        Overrides:
        store in class com.logicaldoc.core.store.AbstractStorer
        Throws:
        IOException
      • delete

        public void delete​(long docId,
                           String resource)
      • size

        public long size​(long docId,
                         String resource)
      • exists

        public boolean exists​(long docId,
                              String resource)
      • getBytes

        public byte[] getBytes​(long docId,
                               String resource)
                        throws IOException
        Specified by:
        getBytes in interface com.logicaldoc.core.store.Storer
        Overrides:
        getBytes in class com.logicaldoc.core.store.AbstractStorer
        Throws:
        IOException
      • writeToFile

        public void writeToFile​(long docId,
                                String resource,
                                File out)
                         throws IOException
        Specified by:
        writeToFile in interface com.logicaldoc.core.store.Storer
        Overrides:
        writeToFile in class com.logicaldoc.core.store.AbstractStorer
        Throws:
        IOException
      • writeToStream

        public void writeToStream​(long docId,
                                  String resource,
                                  OutputStream output,
                                  long start,
                                  long length)
                           throws IOException
        Specified by:
        writeToStream in interface com.logicaldoc.core.store.Storer
        Overrides:
        writeToStream in class com.logicaldoc.core.store.AbstractStorer
        Throws:
        IOException
      • writeToStream

        public void writeToStream​(long docId,
                                  String resource,
                                  OutputStream output)
                           throws IOException
        Specified by:
        writeToStream in interface com.logicaldoc.core.store.Storer
        Overrides:
        writeToStream in class com.logicaldoc.core.store.AbstractStorer
        Throws:
        IOException
      • getString

        public String getString​(long docId,
                                String resource)
        Specified by:
        getString in interface com.logicaldoc.core.store.Storer
        Overrides:
        getString in class com.logicaldoc.core.store.AbstractStorer
      • delete

        public void delete​(long docId)
      • listResources

        public List<String> listResources​(long docId,
                                          String fileVersion)
      • getParameterNames

        public List<String> getParameterNames()
      • getConfig

        public com.logicaldoc.util.config.ContextProperties getConfig()
        Overrides:
        getConfig in class com.logicaldoc.core.store.AbstractStorer
      • setConfig

        public void setConfig​(com.logicaldoc.util.config.ContextProperties config)
        Overrides:
        setConfig in class com.logicaldoc.core.store.AbstractStorer
      • compareTo

        public int compareTo​(com.logicaldoc.core.store.Storer o)
        Specified by:
        compareTo in interface Comparable<com.logicaldoc.core.store.Storer>
        Overrides:
        compareTo in class com.logicaldoc.core.store.AbstractStorer
      • getId

        public int getId()
        Specified by:
        getId in interface com.logicaldoc.core.store.Storer
        Overrides:
        getId in class com.logicaldoc.core.store.AbstractStorer
      • setId

        public void setId​(int id)
        Specified by:
        setId in interface com.logicaldoc.core.store.Storer
        Overrides:
        setId in class com.logicaldoc.core.store.AbstractStorer
      • getParameters

        public Map<String,​String> getParameters()
        Specified by:
        getParameters in interface com.logicaldoc.core.store.Storer
        Overrides:
        getParameters in class com.logicaldoc.core.store.AbstractStorer
      • test

        public boolean test()
        Specified by:
        test in interface com.logicaldoc.core.store.Storer
        Overrides:
        test in class com.logicaldoc.core.store.AbstractStorer
      • init

        public void init()
        Initializes the storers list
        Specified by:
        init in interface com.logicaldoc.core.store.Storer
        Overrides:
        init in class com.logicaldoc.core.store.AbstractStorer
      • moveResourcesToStore

        public int moveResourcesToStore​(long docId,
                                        int targetStorageId)
                                 throws IOException
        Throws:
        IOException
      • getStorers

        public List<com.logicaldoc.core.store.Storer> getStorers()