public class FSStorer extends Object implements Storer
Modifier and Type | Field and Description |
---|---|
protected ContextProperties |
config |
protected static org.slf4j.Logger |
log |
Constructor and Description |
---|
FSStorer() |
Modifier and Type | Method and Description |
---|---|
protected String |
computeRelativePath(long docId)
Computes the relative path of a document's folder inside the storage
root.
|
void |
delete(long docId)
Deletes all resources of a document from the storage.
|
void |
delete(long docId,
String resource)
Deletes a specific resource of a document from the storage.
|
boolean |
exists(long docId,
String resource)
Checks if the passed resource exists in the document's container
|
byte[] |
getBytes(long docId,
String resource)
Obtains the document's raw bytes for the specified version
|
ContextProperties |
getConfig() |
File |
getContainer(long docId)
Finds the container where all document's files are stored
|
String |
getResourceName(Document doc,
String fileVersion,
String suffix)
Computes the resource name inside the container
|
String |
getResourceName(long docId,
String fileVersion,
String suffix)
Computes the resource name inside the container
|
InputStream |
getStream(long docId,
String resource)
Obtains the document's content for the specified version
|
long |
getTotalSize()
Computes the total size of the documents repository(in bytes)
|
List<String> |
listResources(long docId,
String fileVersion)
Lists all resources in the document's container
|
void |
setConfig(ContextProperties config) |
long |
size(long docId,
String resource)
Computed the size of a specific resource.
|
long |
store(File file,
long docId,
String resource) |
long |
store(InputStream stream,
long docId,
String resource)
This method has to store a resource in the document's container.
|
void |
writeTo(long docId,
String resource,
File out)
Writes the specified resource in a file
|
protected static org.slf4j.Logger log
protected ContextProperties config
public ContextProperties getConfig()
public void setConfig(ContextProperties config)
public void delete(long docId)
Storer
public File getContainer(long docId)
docId
- The document identifierpublic long store(InputStream stream, long docId, String resource)
Storer
public long store(File file, long docId, String resource)
store
in interface Storer
Storer.store(InputStream stream, long docId, String resource)
public String getResourceName(Document doc, String fileVersion, String suffix)
Storer
getResourceName
in interface Storer
doc
- The document representationfileVersion
- The file version (use null for the latest version)suffix
- The file suffix (use null if you want the exact document
file)public String getResourceName(long docId, String fileVersion, String suffix)
Storer
getResourceName
in interface Storer
docId
- The document identifierfileVersion
- The file version (use null for the latest version)suffix
- The file suffix (use null if you want the exact document
file)public InputStream getStream(long docId, String resource)
Storer
public long getTotalSize()
Storer
getTotalSize
in interface Storer
public byte[] getBytes(long docId, String resource)
Storer
public void delete(long docId, String resource)
Storer
public List<String> listResources(long docId, String fileVersion)
Storer
listResources
in interface Storer
docId
- The document's identifierfileVersion
- If specified, lists the resources for that specific
file version onlypublic long size(long docId, String resource)
Storer
public boolean exists(long docId, String resource)
Storer
protected String computeRelativePath(long docId)
Copyright © 2008-2014 Logical Objects. All Rights Reserved.