Top Description Fields Constructors Methods
org.apache.derby.impl.io

public Class DirStorageFactory

extends BaseStorageFactory
implements WritableStorageFactory
Class Inheritance
All Implemented Interfaces
org.apache.derby.io.WritableStorageFactory, org.apache.derby.io.StorageFactory
Imports
org.apache.derby.io.WritableStorageFactory, .StorageFile, java.io.File, .FileOutputStream, .OutputStream, .IOException, .SyncFailedException

This class provides a disk based implementation of the StorageFactory interface. It is used by the database engine to access persistent data and transaction logs under the directory (default) subsubprotocol.

Field Summary

Inherited from org.apache.derby.impl.io.BaseStorageFactory:
canonicalNamedataDirectoryhomeseparatedDataDirectorytempDirtempDirPathuniqueName

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv void
public boolean
pack-priv StorageFile

Returns:

A corresponding StorageFile object
newPersistentFile
(String
The path name of the file. Guaranteed not to be in the temporary file directory. If null then the database directory should be returned.
path
)

Implements abstract org.apache.derby.impl.io.BaseStorageFactory.newPersistentFile.

Construct a persistent StorageFile from a path name.

pack-priv StorageFile

Returns:

A corresponding StorageFile object
newPersistentFile
(String
The path name of the directory. Guaranteed not to be in the temporary file directory. Guaranteed not to be null
directoryName
,
String
The name of the file within the directory. Guaranteed not to be null.
fileName
)

Implements abstract org.apache.derby.impl.io.BaseStorageFactory.newPersistentFile.

Construct a persistent StorageFile from a directory and path name.

pack-priv StorageFile

Returns:

A corresponding StorageFile object
newPersistentFile
(StorageFile
The path name of the directory. Guaranteed not to be to be null. Guaranteed to be created by a call to one of the newPersistentFile methods.
directoryName
,
String
The name of the file within the directory. Guaranteed not to be null.
fileName
)

Implements abstract org.apache.derby.impl.io.BaseStorageFactory.newPersistentFile.

Construct a persistent StorageFile from a directory and path name.

public final StorageFile

Returns:

A corresponding StorageFile object
newStorageFile
(String
The path name of the file
path
)

Overrides org.apache.derby.impl.io.BaseStorageFactory.newStorageFile.

Implements org.apache.derby.io.StorageFactory.newStorageFile.

Construct a StorageFile from a path name.

public final StorageFile

Returns:

A corresponding StorageFile object
newStorageFile
(String
The directory part of the path name.
directoryName
,
String
The name of the file within the directory.
fileName
)

Overrides org.apache.derby.impl.io.BaseStorageFactory.newStorageFile.

Implements org.apache.derby.io.StorageFactory.newStorageFile.

Construct a StorageFile from a directory and file name.

public final StorageFile

Returns:

A corresponding StorageFile object
newStorageFile
(StorageFile
The directory part of the path name.
directoryName
,
String
The name of the file within the directory.
fileName
)

Overrides org.apache.derby.impl.io.BaseStorageFactory.newStorageFile.

Implements org.apache.derby.io.StorageFactory.newStorageFile.

Construct a StorageFile from a directory and file name.

public boolean

Returns:

true if the storage supports random access, false if it is writable.
supportsRandomAccess
()

Overrides org.apache.derby.impl.io.BaseStorageFactory.supportsRandomAccess.

Implements org.apache.derby.io.StorageFactory.supportsRandomAccess.

Determine whether the storage supports random access.

public boolean

Returns:

true if an StIRandomAccess file opened with "rws" or "rwd" modes immediately writes data to the underlying storage, false if not.
supportsWriteSync
()

Implements org.apache.derby.io.WritableStorageFactory.supportsWriteSync.

This method tests whether the "rws" and "rwd" modes are implemented.

public void
sync(OutputStream
The stream to be synchronized.
stream
,
boolean
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.
metaData
)

Implements org.apache.derby.io.WritableStorageFactory.sync.

Force the data of an output stream out to the underlying storage.

Inherited from org.apache.derby.impl.io.BaseStorageFactory:
createTempDircreateTemporaryFilegetCanonicalNamegetSeparatorgetStorageFactoryVersiongetTempDirinitisFastsetCanonicalNameshutdown

Constructor Detail

DirStorageFactoryback to summary
public DirStorageFactory()

Method Detail

doInitback to summary
pack-priv void doInit() throws IOException

Implements abstract org.apache.derby.impl.io.BaseStorageFactory.doInit.

isReadOnlyDatabaseback to summary
public boolean isReadOnlyDatabase()

Overrides org.apache.derby.impl.io.BaseStorageFactory.isReadOnlyDatabase.

Implements org.apache.derby.io.StorageFactory.isReadOnlyDatabase.

Doc from org.apache.derby.io.StorageFactory.isReadOnlyDatabase.

Determine whether the database is read only. The database engine supports read-only databases, even in file systems that are writable.

Returns:boolean

true if the storage is read only, false if it is writable.

newPersistentFileback to summary
pack-priv StorageFile newPersistentFile(String path)

Implements abstract org.apache.derby.impl.io.BaseStorageFactory.newPersistentFile.

Construct a persistent StorageFile from a path name.

Parameters
path:String

The path name of the file. Guaranteed not to be in the temporary file directory. If null then the database directory should be returned.

Returns:StorageFile

A corresponding StorageFile object

newPersistentFileback to summary
pack-priv StorageFile newPersistentFile(String directoryName, String fileName)

Implements abstract org.apache.derby.impl.io.BaseStorageFactory.newPersistentFile.

Construct a persistent StorageFile from a directory and path name.

Parameters
directoryName:String

The path name of the directory. Guaranteed not to be in the temporary file directory. Guaranteed not to be null

fileName:String

The name of the file within the directory. Guaranteed not to be null.

Returns:StorageFile

A corresponding StorageFile object

newPersistentFileback to summary
pack-priv StorageFile newPersistentFile(StorageFile directoryName, String fileName)

Implements abstract org.apache.derby.impl.io.BaseStorageFactory.newPersistentFile.

Construct a persistent StorageFile from a directory and path name.

Parameters
directoryName:StorageFile

The path name of the directory. Guaranteed not to be to be null. Guaranteed to be created by a call to one of the newPersistentFile methods.

fileName:String

The name of the file within the directory. Guaranteed not to be null.

Returns:StorageFile

A corresponding StorageFile object

newStorageFileback to summary
public final StorageFile newStorageFile(String path)

Overrides org.apache.derby.impl.io.BaseStorageFactory.newStorageFile.

Implements org.apache.derby.io.StorageFactory.newStorageFile.

Construct a StorageFile from a path name.

Parameters
path:String

The path name of the file

Returns:StorageFile

A corresponding StorageFile object

newStorageFileback to summary
public final StorageFile newStorageFile(String directoryName, String fileName)

Overrides org.apache.derby.impl.io.BaseStorageFactory.newStorageFile.

Implements org.apache.derby.io.StorageFactory.newStorageFile.

Construct a StorageFile from a directory and file name.

Parameters
directoryName:String

The directory part of the path name.

fileName:String

The name of the file within the directory.

Returns:StorageFile

A corresponding StorageFile object

newStorageFileback to summary
public final StorageFile newStorageFile(StorageFile directoryName, String fileName)

Overrides org.apache.derby.impl.io.BaseStorageFactory.newStorageFile.

Implements org.apache.derby.io.StorageFactory.newStorageFile.

Construct a StorageFile from a directory and file name.

Parameters
directoryName:StorageFile

The directory part of the path name.

fileName:String

The name of the file within the directory.

Returns:StorageFile

A corresponding StorageFile object

supportsRandomAccessback to summary
public boolean supportsRandomAccess()

Overrides org.apache.derby.impl.io.BaseStorageFactory.supportsRandomAccess.

Implements org.apache.derby.io.StorageFactory.supportsRandomAccess.

Determine whether the storage supports random access. If random access is not supported then it will only be accessed using InputStreams and OutputStreams (if the database is writable).

Returns:boolean

true if the storage supports random access, false if it is writable.

supportsWriteSyncback to summary
public boolean supportsWriteSync()

Implements org.apache.derby.io.WritableStorageFactory.supportsWriteSync.

This method tests whether the "rws" and "rwd" modes are implemented. If the "rws" and "rwd" modes are supported then the database engine will conclude that the write methods of "rws"/"rwd" mode StorageRandomAccessFiles are slow but the sync method is fast and optimize accordingly.

Returns:boolean

true if an StIRandomAccess file opened with "rws" or "rwd" modes immediately writes data to the underlying storage, false if not.

syncback to summary
public void sync(OutputStream stream, boolean metaData) throws IOException, SyncFailedException

Implements org.apache.derby.io.WritableStorageFactory.sync.

Force the data of an output stream out to the underlying storage. That is, ensure that it has been made persistent. If the database is to be transient, that is, if the database does not survive a restart, then the sync method implementation need not do anything.

Parameters
stream:OutputStream

The stream to be synchronized.

metaData:boolean

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.

Exceptions
IOException:
if an I/O error occurs.
SyncFailedException:
Thrown when the buffers cannot be flushed, or because the system cannot guarantee that all the buffers have been synchronized with physical media.