| org.apache.derby.iapi.store.access.FileResource
All known Subclasses: org.apache.derby.impl.store.raw.data.RFResource,
FileResource | public interface FileResource (Code) | | Management of file resources within a database. Suitable for jar
files, images etc.
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.
|
Method Summary | |
public long | add(String name, InputStream source) 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. Parameters: source - an input stream for reading the content ofthe file resource. | public StorageFile | getAsFile(String name, long generationId) Get the File handle to a file resource. | public InputStream | getAsStream(String name, long generationId) Get the file resource as a stream. | public char | getSeparatorChar() | public void | remove(String name, long currentGenerationId, boolean purgeOnCommit) Remove the current generation of a file resource from
the database.
Parameters: name - the name of the fileResource to remove. Parameters: purgeOnCommit - true means purge the fileResource when the current transaction commits. | public long | replace(String name, long currentGenerationId, InputStream source, boolean purgeOnCommit) Replace a file resource with a new version.
The InputStream will be closed by this method.
Parameters: name - the name of the file resource. Parameters: source - an input stream for reading the content ofthe file resource. Parameters: purgeOnCommit - true means purge the existing version offileResource when the current transaction commits. |
JAR_DIRECTORY_NAME | final public static String JAR_DIRECTORY_NAME(Code) | | The name of the jar directory
|
add | public long add(String name, InputStream source) throws StandardException(Code) | | 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. Parameters: source - an input stream for reading the content ofthe file resource. the generationId for the file resource. Thisquantity increases when you replace the file resource. exception: StandardException - some error occured. |
getAsFile | public StorageFile getAsFile(String name, long generationId)(Code) | | Get the File handle to a file resource. In some situations
higher level code can make optimisations if it can access
a file as a File, rather than an output stream. If this call
returns null then the resouce is not accessable as a file
(e.g. the database is in a zip file).
Parameters: name - The name of the fileResource Parameters: generationId - the generationId of the fileResource A File object representing the file, or null ifthe resource is not accessable as a file. |
getSeparatorChar | public char getSeparatorChar()(Code) | | the separator character to be used in file names. |
remove | public void remove(String name, long currentGenerationId, boolean purgeOnCommit) throws StandardException(Code) | | Remove the current generation of a file resource from
the database.
Parameters: name - the name of the fileResource to remove. Parameters: purgeOnCommit - true means purge the fileResource when the current transaction commits. false means retainthe file resource for use by replication. exception: StandardException - some error occured. |
replace | public long replace(String name, long currentGenerationId, InputStream source, boolean purgeOnCommit) throws StandardException(Code) | | Replace a file resource with a new version.
The InputStream will be closed by this method.
Parameters: name - the name of the file resource. Parameters: source - an input stream for reading the content ofthe file resource. Parameters: purgeOnCommit - true means purge the existing version offileResource when the current transaction commits. false means retain the existing version for use by replication. the generationId for the new 'current' version of thefile resource. exception: StandardException - some error occured. |
|
|