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 SummaryModifier and TypeMethodDescriptionintvoiddestroy()Destroy methodbooleanbyte[]Obtains the document's raw bytes for the specified resourceintgetId()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 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 identifiervoidStores a filebooleantest()Tests if the store can read and writetoString()voidwriteToFile(long docId, String resource, File out) Writes the specified resource in a filevoidwriteToStream(long docId, String resource, OutputStream output) Writes the specified resource in an output streamvoidwriteToStream(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.Storedelete, delete, exists, getBytes, getParameterNames, getStream, getTotalSize, listResources, moveResourcesToStore, size, store
- 
Method Details- 
getConfig
- 
setConfig
- 
getIdpublic int getId()Description copied from interface:StoreThe unique identifier
- 
setIdpublic void setId(int id) Description copied from interface:StoreSets the unique identifier
- 
compareTo- Specified by:
- compareToin interface- Comparable<Store>
 
- 
hashCodepublic int hashCode()
- 
equals
- 
storeDescription copied from interface:StoreStores a file- Specified by:
- storein interface- Store
- Parameters:
- file- the file to store
- docId- identifier of the document
- resource- name of the resource
- Throws:
- IOException- the content cannot be stored
- See Also:
 
- 
getBytesDescription copied from interface:StoreObtains the document's raw bytes for the specified resource- Specified by:
- getBytesin interface- Store
- Parameters:
- docId- The document's identifier
- resource- Name of the resource
- Returns:
- The document file's bytes
- Throws:
- IOException- cannot open the resource to get the bytes
 
- 
writeToStreampublic void writeToStream(long docId, String resource, OutputStream output, long start, long length) throws IOException Description copied from interface:StoreWrites the specified resource in an output stream- Specified by:
- writeToStreamin interface- Store
- Parameters:
- docId- The document's identifier
- resource- Name of the resource
- output- The output stream
- start- Index of the starting byte
- length- Total packet length
- Throws:
- IOException- error writing the stream or reading the resource
 
- 
writeToStreamDescription copied from interface:StoreWrites the specified resource in an output stream- Specified by:
- writeToStreamin interface- Store
- Parameters:
- docId- The document's identifier
- resource- Name of the resource
- output- The output stream
- Throws:
- IOException- error writing the stream or reading the resource
 
- 
writeToFileDescription copied from interface:StoreWrites the specified resource in a file- Specified by:
- writeToFilein interface- Store
- Parameters:
- docId- The document identifier
- resource- Name of the resource
- out- File that will receive the resource's content
- Throws:
- IOException- error writing the file or reading the resource
 
- 
getStringDescription copied from interface:StoreObtains the document's content as string for the specified resource
- 
getResourceNameDescription copied from interface:StoreComputes the resource name inside the container- Specified by:
- getResourceNamein interface- Store
- Parameters:
- doc- The document representation
- fileVersion- 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
 
- 
getResourceNameDescription copied from interface:StoreComputes the resource name inside the container- Specified by:
- getResourceNamein interface- Store
- Parameters:
- docId- The document identifier
- fileVersion- 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
 
- 
getParametersDescription copied from interface:StoreReturns the map of parameters- Specified by:
- getParametersin interface- Store
- Returns:
- a map with settings setting_name - setting_value
 
- 
testpublic boolean test()Description copied from interface:StoreTests if the store can read and write
- 
isEnabledpublic 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
- 
newStoreInstantiate a new store and fully configures it.+
- 
getStoreDefinitionsDescription copied from interface:StoreRetrieves the stores definitions grouped by type- Specified by:
- getStoreDefinitionsin interface- Store
- Returns:
- a map with definitions type - store prototype
 
 
-