Package com.logicaldoc.core.store
Class FSStore
java.lang.Object
com.logicaldoc.core.store.AbstractStore
com.logicaldoc.core.store.FSStore
- All Implemented Interfaces:
- Store,- Comparable<Store>
- Direct Known Subclasses:
- MockStore
This class is an implementation of the Store interface to persist documents
 in the filesystem. From the root of the documents store, this implementation
 saves all document's files into a defined directory using the following
 logic. The document's id is tokenized by three chars tokens, than the doc/
 dir is appended, so if the docId=12345, the document's path will
 be:123/45/doc.
- Since:
- 4.5
- Author:
- Marco Meschieri - LogicalDOC
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoiddelete(long docId) Deletes all resources of a document from the store.voidDeletes a specific resource of a document from the store.booleanChecks if the passed resource exists in the document's containerbyte[]Obtains the document's raw bytes for the specified resourcegetContainer(long docId) Finds the container where all document's files are storedImplementations should return the list of the required parameters.getRoot()Obtains the document's content for the specified resourcelongComputes the total size of the documents repository(in bytes)listResources(long docId, String fileVersion) Lists all resources in the document's containerintmoveResourcesToStore(long docId, int targetStoreId) Moves all the resources of a document from it's original location to a different storelongComputed the size of a specific resource.voidStores a filevoidstore(InputStream stream, long docId, String resource) This method has to store a resource in the document's container.voidwriteToFile(long docId, String resource, File out) Writes the specified resource in a fileMethods inherited from class com.logicaldoc.core.store.AbstractStorecompareTo, destroy, equals, getBytes, getConfig, getId, getParameters, getResourceName, getResourceName, getStoreDefinitions, getString, hashCode, init, isEnabled, newStore, setConfig, setId, test, toString, writeToStream, writeToStream
- 
Constructor Details- 
FSStorepublic FSStore()
 
- 
- 
Method Details- 
deletepublic void delete(long docId) Description copied from interface:StoreDeletes all resources of a document from the store.- Parameters:
- docId- The document identifier
 
- 
deleteDescription copied from interface:StoreDeletes a specific resource of a document from the store.- Parameters:
- docId- The document identifier
- resource- Name of the resource to be deleted
 
- 
getContainerFinds the container where all document's files are stored- Parameters:
- docId- The document identifier
- Returns:
- The document's container
 
- 
getRoot
- 
storeDescription copied from interface:StoreStores a file- Specified by:
- storein interface- Store
- Overrides:
- storein class- AbstractStore
- 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:
 
- 
storeDescription copied from interface:StoreThis method has to store a resource in the document's container. The location where (DBMS, Filesystem, other) the document should be stored is defined by the concrete implementation. It is possible to store a new document or a new version of an existing document.- Parameters:
- stream- Document as InputStream
- docId- The document identifier
- resource- Name of the resource to be stored
- Throws:
- IOException- the content cannot be stored
 
- 
writeToFileDescription copied from interface:StoreWrites the specified resource in a file- Specified by:
- writeToFilein interface- Store
- Overrides:
- writeToFilein class- AbstractStore
- 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
 
- 
getStreamDescription copied from interface:StoreObtains the document's content for the specified resource- Parameters:
- docId- The document's identifier
- resource- Name of the resource
- Returns:
- The document file's content
- Throws:
- IOException- cannot open the stream
 
- 
getTotalSizepublic long getTotalSize()Description copied from interface:StoreComputes the total size of the documents repository(in bytes)- Returns:
- sum of the sizes of all the documents expressed in bytes
 
- 
getBytesDescription copied from interface:StoreObtains the document's raw bytes for the specified resource- Parameters:
- docId- The document's identifier
- resource- Name of the resource
- start- Index of the starting byte
- length- Total packet length
- Returns:
- The document file's bytes
- Throws:
- IOException- cannot open the resource to get the bytes
 
- 
listResourcesDescription copied from interface:StoreLists all resources in the document's container- Parameters:
- docId- The document's identifier
- fileVersion- If specified, lists the resources for that specific file version only
- Returns:
- list of resource names
 
- 
sizeDescription copied from interface:StoreComputed the size of a specific resource.- Parameters:
- docId- The document's identifier
- resource- The resource
- Returns:
- the size in bytes
 
- 
existsDescription copied from interface:StoreChecks if the passed resource exists in the document's container- Parameters:
- docId- ID of the document
- resource- Name of the resource
- Returns:
- true only if the resource already exists
 
- 
getParameterNamesDescription copied from interface:StoreImplementations should return the list of the required parameters. A parameter is stored in the context as store.id.parameter = value- Returns:
- list of parameter names
 
- 
moveResourcesToStoreDescription copied from interface:StoreMoves all the resources of a document from it's original location to a different store- Parameters:
- docId- identifier of the document to process
- targetStoreId- identifier of the store that will receive the files
- Returns:
- number of moved resources
- Throws:
- IOException- In case of error during the process
 
 
-