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 TypeMethodDescriptionintvoiddestroy()Destroy methodbooleanbyte[]getBytes(StoreResource resource) Obtains the document's raw bytes for the specified resourceintgetId()The unique identifierReturns the map of parametersRetrieves the stores definitions grouped by typegetString(StoreResource resource) Obtains the resource's content as string for the specified resourceinthashCode()voidinit()Initialization methodbooleanTests if the store is enablednewStore(int id) Instantiate a new store and fully configures it.+voidsetConfig(ContextProperties config) voidsetId(int id) Sets the unique identifiervoidstore(File file, StoreResource resource) Stores a filebooleantest()Tests if the store can read and writetoString()voidwriteToFile(StoreResource resource, File out) Writes the specified resource in a filevoidwriteToStream(StoreResource resource, OutputStream output) Writes the specified resource in an output streamvoidwriteToStream(StoreResource 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:StoreThe unique identifier -
setId
public void setId(int id) Description copied from interface:StoreSets the unique identifier -
compareTo
- Specified by:
compareToin interfaceComparable<Store>
-
hashCode
public int hashCode() -
equals
-
store
Description copied from interface:StoreStores a file- Specified by:
storein interfaceStore- Parameters:
file- the file to storeresource- Resource to be stored, make sure to provide the right document's ID- Throws:
IOException- the content cannot be stored
-
getBytes
Description copied from interface:StoreObtains the document's raw bytes for the specified resource- Specified by:
getBytesin interfaceStore- Parameters:
resource- The resource- Returns:
- The document file's bytes
- Throws:
IOException- cannot open the resource to get the bytes
-
writeToStream
public void writeToStream(StoreResource resource, OutputStream output, long start, long length) throws IOException Description copied from interface:StoreWrites the specified resource in an output stream- Specified by:
writeToStreamin interfaceStore- Parameters:
resource- 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:StoreWrites the specified resource in an output stream- Specified by:
writeToStreamin interfaceStore- Parameters:
resource- The resourceoutput- The output stream- Throws:
IOException- error writing the stream or reading the resource
-
writeToFile
Description copied from interface:StoreWrites the specified resource in a file- Specified by:
writeToFilein interfaceStore- Parameters:
resource- 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:StoreObtains the resource's content as string for the specified resource -
getParameters
Description copied from interface:StoreReturns the map of parameters- Specified by:
getParametersin interfaceStore- Returns:
- a map with settings setting_name - setting_value
-
test
public boolean test()Description copied from interface:StoreTests if the store can read and write -
isEnabled
public boolean isEnabled()Description copied from interface:StoreTests if the store is enabled -
toString
-
init
@PostConstruct public void init()Description copied from interface:StoreInitialization method -
destroy
@PreDestroy public void destroy()Description copied from interface:StoreDestroy method -
newStore
Instantiate a new store and fully configures it.+ -
getStoreDefinitions
Description copied from interface:StoreRetrieves the stores definitions grouped by type- Specified by:
getStoreDefinitionsin interfaceStore- Returns:
- a map with definitions type - store prototype
-