Package com.logicaldoc.enterprise.storer
Class MultiStorer
- java.lang.Object
-
- com.logicaldoc.core.store.AbstractStorer
-
- com.logicaldoc.enterprise.storer.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 Summary
Constructors Constructor Description MultiStorer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(com.logicaldoc.core.store.Storer o)
void
delete(long docId)
void
delete(long docId, String resource)
long
encryptAll()
Encrypts all documents in whatever file-system based storage with encrypted flag activeboolean
exists(long docId, String resource)
byte[]
getBytes(long docId, String resource)
byte[]
getBytes(long docId, String resource, long start, long length)
com.logicaldoc.util.config.ContextProperties
getConfig()
int
getId()
List<String>
getParameterNames()
Map<String,String>
getParameters()
List<com.logicaldoc.core.store.Storer>
getStorers()
InputStream
getStream(long docId, String resource)
String
getString(long docId, String resource)
long
getTotalSize()
void
init()
Initializes the storers listList<String>
listResources(long docId, String fileVersion)
int
moveResourcesToStore(long docId, int targetStorageId)
void
setConfig(com.logicaldoc.util.config.ContextProperties config)
void
setId(int id)
long
size(long docId, String resource)
void
store(File file, long docId, String resource)
void
store(InputStream stream, long docId, String resource)
boolean
test()
void
writeToFile(long docId, String resource, File out)
void
writeToStream(long docId, String resource, OutputStream output)
void
writeToStream(long docId, String resource, OutputStream output, long start, long length)
-
-
-
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 interfacecom.logicaldoc.core.store.Storer
- Overrides:
store
in classcom.logicaldoc.core.store.AbstractStorer
- Throws:
IOException
-
store
public void store(InputStream stream, long docId, String resource) throws IOException
- 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)
-
getStream
public InputStream getStream(long docId, String resource) throws IOException
- Throws:
IOException
-
getBytes
public byte[] getBytes(long docId, String resource, long start, long length) throws IOException
- Throws:
IOException
-
getBytes
public byte[] getBytes(long docId, String resource) throws IOException
- Specified by:
getBytes
in interfacecom.logicaldoc.core.store.Storer
- Overrides:
getBytes
in classcom.logicaldoc.core.store.AbstractStorer
- Throws:
IOException
-
writeToFile
public void writeToFile(long docId, String resource, File out) throws IOException
- Specified by:
writeToFile
in interfacecom.logicaldoc.core.store.Storer
- Overrides:
writeToFile
in classcom.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 interfacecom.logicaldoc.core.store.Storer
- Overrides:
writeToStream
in classcom.logicaldoc.core.store.AbstractStorer
- Throws:
IOException
-
writeToStream
public void writeToStream(long docId, String resource, OutputStream output) throws IOException
- Specified by:
writeToStream
in interfacecom.logicaldoc.core.store.Storer
- Overrides:
writeToStream
in classcom.logicaldoc.core.store.AbstractStorer
- Throws:
IOException
-
getString
public String getString(long docId, String resource)
- Specified by:
getString
in interfacecom.logicaldoc.core.store.Storer
- Overrides:
getString
in classcom.logicaldoc.core.store.AbstractStorer
-
delete
public void delete(long docId)
-
getConfig
public com.logicaldoc.util.config.ContextProperties getConfig()
- Overrides:
getConfig
in classcom.logicaldoc.core.store.AbstractStorer
-
setConfig
public void setConfig(com.logicaldoc.util.config.ContextProperties config)
- Overrides:
setConfig
in classcom.logicaldoc.core.store.AbstractStorer
-
compareTo
public int compareTo(com.logicaldoc.core.store.Storer o)
- Specified by:
compareTo
in interfaceComparable<com.logicaldoc.core.store.Storer>
- Overrides:
compareTo
in classcom.logicaldoc.core.store.AbstractStorer
-
getId
public int getId()
- Specified by:
getId
in interfacecom.logicaldoc.core.store.Storer
- Overrides:
getId
in classcom.logicaldoc.core.store.AbstractStorer
-
setId
public void setId(int id)
- Specified by:
setId
in interfacecom.logicaldoc.core.store.Storer
- Overrides:
setId
in classcom.logicaldoc.core.store.AbstractStorer
-
getParameters
public Map<String,String> getParameters()
- Specified by:
getParameters
in interfacecom.logicaldoc.core.store.Storer
- Overrides:
getParameters
in classcom.logicaldoc.core.store.AbstractStorer
-
test
public boolean test()
- Specified by:
test
in interfacecom.logicaldoc.core.store.Storer
- Overrides:
test
in classcom.logicaldoc.core.store.AbstractStorer
-
init
public void init()
Initializes the storers list- Specified by:
init
in interfacecom.logicaldoc.core.store.Storer
- Overrides:
init
in classcom.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()
-
-