abstract class CorruptBaseStorageFactory
extends java.lang.Object
implements org.apache.derby.io.WritableStorageFactory
CorruptibleIo
,
WritableStorageFactory
Modifier and Type | Field and Description |
---|---|
protected org.apache.derby.io.WritableStorageFactory |
realStorageFactory |
Constructor and Description |
---|
CorruptBaseStorageFactory()
Most of the initialization is done in the init method.
|
Modifier and Type | Method and Description |
---|---|
org.apache.derby.io.StorageFile |
createTemporaryFile(java.lang.String prefix,
java.lang.String suffix)
Create and returns a temporary file in temporary file system of database.
|
java.lang.String |
getCanonicalName()
Get the canonical name of the database.
|
(package private) abstract org.apache.derby.io.WritableStorageFactory |
getRealStorageFactory()
get the real storage factory
|
char |
getSeparator()
Get the pathname separator character used by the StorageFile
implementation.
|
int |
getStorageFactoryVersion() |
org.apache.derby.io.StorageFile |
getTempDir()
Get the abstract name of the directory that holds temporary files.
|
void |
init(java.lang.String home,
java.lang.String databaseName,
java.lang.String tempDirName,
java.lang.String uniqueName)
Classes implementing the StorageFactory interface must have a null
constructor.
|
boolean |
isFast()
This method is used to determine whether the storage is fast
(RAM based) or slow (disk based).
|
boolean |
isReadOnlyDatabase() |
org.apache.derby.io.StorageFile |
newStorageFile(org.apache.derby.io.StorageFile directoryName,
java.lang.String fileName)
Construct a StorageFile from a directory and file name.
|
org.apache.derby.io.StorageFile |
newStorageFile(java.lang.String path)
Construct a StorageFile from a path name.
|
org.apache.derby.io.StorageFile |
newStorageFile(java.lang.String directoryName,
java.lang.String fileName)
Construct a StorageFile from a directory and file name.
|
void |
setCanonicalName(java.lang.String name)
Set the canonicalName.
|
void |
shutdown() |
boolean |
supportsRandomAccess()
Determine whether the storage supports random access.
|
boolean |
supportsWriteSync()
This method tests whether the "rws" and "rwd" modes are implemented.
|
void |
sync(java.io.OutputStream stream,
boolean metaData)
Force the data of an output stream out to the underlying storage.
|
protected org.apache.derby.io.WritableStorageFactory realStorageFactory
CorruptBaseStorageFactory()
public void init(java.lang.String home, java.lang.String databaseName, java.lang.String tempDirName, java.lang.String uniqueName) throws java.io.IOException
init
in interface org.apache.derby.io.StorageFactory
home
- The name of the directory containing the database.
It comes from the system.home system property.
It may be null. A storage factory may decide to
ignore this parameter. (For instance the classpath
storage factory ignores it.)databaseName
- The name of the database (directory).
All relative pathnames are relative to this
directory.
If null then the storage factory will only be used
to deal with the directory containing the databases.tempDirName
- The name of the temporary file directory set in
properties. If null then a default directory should
be used. Each database should get a separate
temporary file directory within this one to avoid
collisions.uniqueName
- A unique name that can be used to create the
temporary file directory for this database.java.io.IOException
- on an error (unexpected).public void shutdown()
shutdown
in interface org.apache.derby.io.StorageFactory
public java.lang.String getCanonicalName() throws java.io.IOException
getCanonicalName
in interface org.apache.derby.io.StorageFactory
java.io.IOException
- if an IO error occurred during the construction
of the name.public void setCanonicalName(java.lang.String name)
setCanonicalName
in interface org.apache.derby.io.StorageFactory
name
- uniquely identifiable name for this databasepublic org.apache.derby.io.StorageFile newStorageFile(java.lang.String path)
newStorageFile
in interface org.apache.derby.io.StorageFactory
path
- The path name of the filepublic org.apache.derby.io.StorageFile newStorageFile(java.lang.String directoryName, java.lang.String fileName)
newStorageFile
in interface org.apache.derby.io.StorageFactory
directoryName
- The directory part of the path name.fileName
- The name of the file within the directory.public org.apache.derby.io.StorageFile newStorageFile(org.apache.derby.io.StorageFile directoryName, java.lang.String fileName)
newStorageFile
in interface org.apache.derby.io.StorageFactory
directoryName
- The directory part of the path name.fileName
- The name of the file within the directory.public char getSeparator()
getSeparator
in interface org.apache.derby.io.StorageFactory
public org.apache.derby.io.StorageFile getTempDir()
getTempDir
in interface org.apache.derby.io.StorageFactory
public boolean isFast()
isFast
in interface org.apache.derby.io.StorageFactory
public boolean isReadOnlyDatabase()
isReadOnlyDatabase
in interface org.apache.derby.io.StorageFactory
public boolean supportsRandomAccess()
supportsRandomAccess
in interface org.apache.derby.io.StorageFactory
public int getStorageFactoryVersion()
getStorageFactoryVersion
in interface org.apache.derby.io.StorageFactory
public void sync(java.io.OutputStream stream, boolean metaData) throws java.io.IOException, java.io.SyncFailedException
sync
in interface org.apache.derby.io.WritableStorageFactory
stream
- The stream to be synchronized.metaData
- If true then this method must force both changes to the
file's contents and metadata to be written to storage;
if false, it need only force file content changes to be
written. The implementation is allowed to ignore this
parameter and always force out metadata changes.java.io.IOException
- if an I/O error occurs.java.io.SyncFailedException
- Thrown when the buffers cannot be flushed,
or because the system cannot guarantee that all the buffers
have been synchronized with physical media.public boolean supportsWriteSync()
supportsWriteSync
in interface org.apache.derby.io.WritableStorageFactory
abstract org.apache.derby.io.WritableStorageFactory getRealStorageFactory()
public org.apache.derby.io.StorageFile createTemporaryFile(java.lang.String prefix, java.lang.String suffix) throws java.io.IOException
createTemporaryFile
in interface org.apache.derby.io.StorageFactory
prefix
- String to prefix the random name generator. It can be nullsuffix
- String to suffix the random name generator. ".tmp" will be
used if null.java.io.IOException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.