Interface FileResource
- All Known Implementing Classes:
RFResource
A file resource is identified by the pair (name,generationId). Name is an arbitrary String supplied by the caller. GenerationId is a non-repeating sequence number constructed by the database. Within a database a (name,generationId) pair uniquely identifies a version of a file resource for all time. Newer generation numbers reflect newer versions of the file.
A database supports the concept of a designated current version of a fileResource. The management of the current version is transactional. The following rules apply
- Adding a FileResource makes the added version the current version
- Removing a FileResource removes the current version of the resource. After this operation the database holds no current version of the FileResoure.
- Replacing a FileResource removes the current version of the resource.
For the benefit of replication, a database optionally retains historic versions of stored files. These old versions are useful when processing old transactions in the stage.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionlong
add
(String name, InputStream source) Add a file resource, copying from the input stream.Get the StorageFile for a file resource.char
void
Remove the current generation of a file resource from the database.void
During hard upgrade to <= 10.9, remove a jar directory (at post-commit time) from the database.long
replace
(String name, long currentGenerationId, InputStream source) Replace a file resource with a new version.
-
Field Details
-
JAR_DIRECTORY_NAME
The name of the jar directory- See Also:
-
-
Method Details
-
add
Add a file resource, copying from the input stream. The InputStream will be closed by this method.- Parameters:
name
- the name of the file resource.source
- an input stream for reading the content of the file resource.- Returns:
- the generationId for the file resource. This quantity increases when you replace the file resource.
- Throws:
StandardException
- some error occured.
-
remove
Remove the current generation of a file resource from the database.- Parameters:
name
- the name of the fileResource to remove.- Throws:
StandardException
- some error occured.
-
removeJarDir
During hard upgrade to <= 10.9, remove a jar directory (at post-commit time) from the database.- Parameters:
f
-- Throws:
StandardException
- if an error occurs
-
replace
Replace a file resource with a new version.The InputStream will be closed by this method.
- Parameters:
name
- the name of the file resource.source
- an input stream for reading the content of the file resource.- Returns:
- the generationId for the new 'current' version of the file resource.
- Throws:
StandardException
- some error occured.
-
getAsFile
Get the StorageFile for a file resource.- Parameters:
name
- The name of the fileResourcegenerationId
- the generationId of the fileResource- Returns:
- A StorageFile object representing the file.
-
getSeparatorChar
char getSeparatorChar()- Returns:
- the separator character to be used in file names.
-