Package com.logicaldoc.core.store
Class AbstractStore
java.lang.Object
com.logicaldoc.core.store.AbstractStore
- All Implemented Interfaces:
Store
,Comparable<Store>
- Direct Known Subclasses:
FSStore
Common methods for all the Store implementations.
- Since:
- 7.6.4
- Author:
- Marco Meschieri - LogicalDOC
-
Method Summary
Modifier and TypeMethodDescriptionint
void
destroy()
Destroy methodboolean
byte[]
Obtains the document's raw bytes for the specified resourceint
getId()
The unique identifierReturns the map of parametersgetResourceName
(long docId, String fileVersion, String suffix) Computes the resource name inside the containergetResourceName
(Document doc, String fileVersion, String suffix) Computes the resource name inside the containerRetrieves the stores definitions grouped by typeObtains the document's content as string for the specified resourceint
hashCode()
void
init()
Initialization methodboolean
Tests if the store is enablednewStore
(int id) Instantiate a new store and fully configures it.+void
setConfig
(ContextProperties config) void
setId
(int id) Sets the unique identifiervoid
Stores a fileboolean
test()
Tests if the store can read and writetoString()
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 streamMethods inherited from interface com.logicaldoc.core.store.Store
delete, delete, exists, getBytes, getParameterNames, getStream, getTotalSize, listResources, moveResourcesToStore, size, store
-
Method Details
-
getConfig
-
setConfig
-
getId
public int getId()Description copied from interface:Store
The unique identifier -
setId
public void setId(int id) Description copied from interface:Store
Sets the unique identifier -
compareTo
- Specified by:
compareTo
in interfaceComparable<Store>
-
hashCode
public int hashCode() -
equals
-
store
Description copied from interface:Store
Stores a file- Specified by:
store
in interfaceStore
- Parameters:
file
- the file to storedocId
- identifier of the documentresource
- name of the resource- Throws:
IOException
- the content cannot be stored- See Also:
-
getBytes
Description copied from interface:Store
Obtains the document's raw bytes for the specified resource- Specified by:
getBytes
in interfaceStore
- Parameters:
docId
- The document's identifierresource
- Name of the resource- Returns:
- The document file's bytes
- Throws:
IOException
- cannot open the resource to get the bytes
-
writeToStream
public void writeToStream(long docId, String resource, OutputStream output, long start, long length) throws IOException Description copied from interface:Store
Writes the specified resource in an output stream- Specified by:
writeToStream
in interfaceStore
- 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
Description copied from interface:Store
Writes the specified resource in an output stream- Specified by:
writeToStream
in interfaceStore
- Parameters:
docId
- The document's identifierresource
- Name of the resourceoutput
- The output stream- Throws:
IOException
- error writing the stream or reading the resource
-
writeToFile
Description copied from interface:Store
Writes the specified resource in a file- Specified by:
writeToFile
in interfaceStore
- 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
Description copied from interface:Store
Obtains the document's content as string for the specified resource -
getResourceName
Description copied from interface:Store
Computes the resource name inside the container- Specified by:
getResourceName
in interfaceStore
- 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
Description copied from interface:Store
Computes the resource name inside the container- Specified by:
getResourceName
in interfaceStore
- 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
Description copied from interface:Store
Returns the map of parameters- Specified by:
getParameters
in interfaceStore
- Returns:
- a map with settings setting_name - setting_value
-
test
public boolean test()Description copied from interface:Store
Tests if the store can read and write -
isEnabled
public boolean isEnabled()Description copied from interface:Store
Tests if the store is enabled -
toString
-
init
@PostConstruct public void init()Description copied from interface:Store
Initialization method -
destroy
@PreDestroy public void destroy()Description copied from interface:Store
Destroy method -
newStore
Instantiate a new store and fully configures it.+ -
getStoreDefinitions
Description copied from interface:Store
Retrieves the stores definitions grouped by type- Specified by:
getStoreDefinitions
in interfaceStore
- Returns:
- a map with definitions type - store prototype
-