Package com.logicaldoc.core.store
Class AbstractStorer
- java.lang.Object
-
- com.logicaldoc.core.store.AbstractStorer
-
-
Constructor Summary
Constructors Constructor Description AbstractStorer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Storer o)
void
destroy()
Destroy methodboolean
equals(Object obj)
byte[]
getBytes(long docId, String resource)
Obtains the document's raw bytes for the specified resourceContextProperties
getConfig()
int
getId()
The unique identifierMap<String,String>
getParameters()
Returns the map of parametersString
getResourceName(long docId, String fileVersion, String suffix)
Computes the resource name inside the containerString
getResourceName(Document doc, String fileVersion, String suffix)
Computes the resource name inside the containerString
getString(long docId, String resource)
Obtains the document's content as string for the specified resourceint
hashCode()
void
init()
Initialization methodboolean
isEnabled()
Tests if the storer is enabledvoid
setConfig(ContextProperties config)
void
setId(int id)
Sets the unique identifiervoid
setManager(StorerManager manager)
void
store(File file, long docId, String resource)
Stores a fileboolean
test()
Tests if the storer can read and writeString
toString()
void
writeToFile(long docId, String resource, File out)
Writes the specified resource in a filevoid
writeToStream(long docId, String resource, OutputStream output)
Writes the specified resource in an output streamvoid
writeToStream(long docId, String resource, OutputStream output, long start, long length)
Writes the specified resource in an output stream-
Methods inherited from interface com.logicaldoc.core.store.Storer
delete, delete, exists, getBytes, getParameterNames, getStream, getTotalSize, listResources, size, store
-
-
-
-
Method Detail
-
getConfig
public ContextProperties getConfig()
-
setManager
public void setManager(StorerManager manager)
-
setConfig
public void setConfig(ContextProperties config)
-
getId
public int getId()
Description copied from interface:Storer
The unique identifier
-
setId
public void setId(int id)
Description copied from interface:Storer
Sets the unique identifier
-
compareTo
public int compareTo(Storer o)
- Specified by:
compareTo
in interfaceComparable<Storer>
-
store
public void store(File file, long docId, String resource)
Description copied from interface:Storer
Stores a file- Specified by:
store
in interfaceStorer
- Parameters:
file
- the file to storedocId
- identifier of the documentresource
- name of the resource- See Also:
Storer.store(java.io.InputStream,long,java.lang.String)
-
getBytes
public byte[] getBytes(long docId, String resource)
Description copied from interface:Storer
Obtains the document's raw bytes for the specified resource
-
writeToStream
public void writeToStream(long docId, String resource, OutputStream output, long start, long length) throws IOException
Description copied from interface:Storer
Writes the specified resource in an output stream- Specified by:
writeToStream
in interfaceStorer
- Parameters:
docId
- The document's identifierresource
- Name of the resourceoutput
- The output streamstart
- Index of the starting bytelength
- Total packet length- Throws:
IOException
- error writing the stream or reading the resource
-
writeToStream
public void writeToStream(long docId, String resource, OutputStream output) throws IOException
Description copied from interface:Storer
Writes the specified resource in an output stream- Specified by:
writeToStream
in interfaceStorer
- Parameters:
docId
- The document's identifierresource
- Name of the resourceoutput
- The output stream- Throws:
IOException
- error writing the stream or reading the resource
-
writeToFile
public void writeToFile(long docId, String resource, File out) throws IOException
Description copied from interface:Storer
Writes the specified resource in a file- Specified by:
writeToFile
in interfaceStorer
- Parameters:
docId
- The document identifierresource
- Name of the resourceout
- File that will receive the resource's content- Throws:
IOException
- error writing the file or reading the resource
-
getString
public String getString(long docId, String resource)
Description copied from interface:Storer
Obtains the document's content as string for the specified resource
-
getResourceName
public String getResourceName(Document doc, String fileVersion, String suffix)
Description copied from interface:Storer
Computes the resource name inside the container- Specified by:
getResourceName
in interfaceStorer
- Parameters:
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)- Returns:
- The document's resource name
-
getResourceName
public String getResourceName(long docId, String fileVersion, String suffix)
Description copied from interface:Storer
Computes the resource name inside the container- Specified by:
getResourceName
in interfaceStorer
- Parameters:
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)- Returns:
- The document's resource name
-
getParameters
public Map<String,String> getParameters()
Description copied from interface:Storer
Returns the map of parameters- Specified by:
getParameters
in interfaceStorer
- Returns:
- a map with settings setting_name - setting_value
-
test
public boolean test()
Description copied from interface:Storer
Tests if the storer can read and write
-
isEnabled
public boolean isEnabled()
Description copied from interface:Storer
Tests if the storer is enabled
-
init
public void init()
Description copied from interface:Storer
Initialization method
-
-