Top Description Fields Constructors Methods
org.apache.derby.impl.store.raw.data

public Class BaseDataFileFactory

extends Object
implements DataFactory, CacheableFactory, ModuleControl, ModuleSupportable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.monitor.ModuleSupportable, org.apache.derby.iapi.services.monitor.ModuleControl, org.apache.derby.iapi.services.cache.CacheableFactory, org.apache.derby.iapi.store.raw.data.DataFactory, org.apache.derby.iapi.store.raw.Corruptable
Known Direct Subclasses
org.apache.derby.impl.store.raw.data.BaseDataFileFactoryJ4
Imports
org.apache.derby.shared.common.reference.MessageId, .Attribute, .Property, .SQLState, org.apache.derby.iapi.security.SecurityUtil, org.apache.derby.shared.common.info.ProductVersionHolder, org.apache.derby.database.Database, org.apache.derby.iapi.services.cache.CacheFactory, .CacheManager, .Cacheable, .CacheableFactory, org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.iapi.services.daemon.DaemonService, .Serviceable, org.apache.derby.iapi.services.monitor.ModuleControl, .ModuleFactory, .ModuleSupportable, .Monitor, .PersistentService, org.apache.derby.iapi.services.diag.Performance, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.stream.HeaderPrintWriter, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.i18n.MessageService, org.apache.derby.iapi.store.access.AccessFactoryGlobals, .FileResource, .TransactionController, .RowSource, org.apache.derby.iapi.store.raw.data.DataFactory, .RawContainerHandle, org.apache.derby.iapi.store.raw.log.LogFactory, .LogInstant, org.apache.derby.iapi.store.raw.ContainerHandle, .ContainerKey, .LockingPolicy, .Page, .PageKey, .RawStoreFactory, .StreamContainerHandle, .Transaction, .UndoHandler, org.apache.derby.iapi.store.raw.xact.RawTransaction, org.apache.derby.io.StorageFactory, .WritableStorageFactory, .StorageFile, .StorageRandomAccessFile, org.apache.derby.iapi.services.uuid.UUIDFactory, org.apache.derby.catalog.UUID, org.apache.derby.iapi.util.ByteArray, .InterruptStatus, org.apache.derby.iapi.services.io.FileUtil, org.apache.derby.iapi.services.property.PropertyUtil, java.util.Date, .Properties, .Hashtable, .Enumeration, java.io.File, .IOException, java.net.URL, java.security.CodeSource

Provides the abstract class with most of the implementation of DataFactory and ModuleControl shared by all the different filesystem implementations.

RESOLVE (mikem - 2/19/98) - Currently only getContainerClass() is abstract, there are probably more routines which should be abstract. Also the other implementations should probably inherit from the abstract class, rather than from the DataFileFactory class. Also there probably should be a generic directory and the rest of the filesystem implementations parallel to it. I wanted to limit the changes going into the branch and then fix inheritance stuff in main.

The code in this class was moved over from DataFileFactory.java and then that file was made to inherit from this one.

Field Summary

Modifier and TypeField and Description
private int
private StorageFile
private File
private String[]
private static final int
private CacheManager
private ContainerKey
private String
private boolean
private String
pack-priv boolean
pack-priv boolean
private static final int
private Hashtable<LogInstant, Object[]>
private StorageFile
private FileResource
private StorageRandomAccessFile
private static final int
private final Object
private static final int
private static final int
private static final int
private static final int
private static final int
private UUID
private boolean
private boolean
private boolean
private HeaderPrintWriter
private String
private ProductVersionHolder
private String
private static final String
private LogFactory
private AllocationActions
private PageActions
private UUID
private long
private String
private CacheManager
private static final int
private Hashtable<String, StorageFile>
private RawStoreFactory
private boolean
private static final int
private static final int
private static final int
private boolean
private static final int
pack-priv StorageFactory
private boolean
private boolean
private boolean
private UndoHandler
private UUIDFactory
pack-priv WritableStorageFactory
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public long
addAndLoadStreamContainer(RawTransaction
the transaction that is creating the container
t
,
long
the segment where the container is to go
segmentId
,
Properties
properties of the container that is persistently stored throughout the lifetime of the container
tableProperties
,
RowSource
the data to load the container with
rowSource
)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.addAndLoadStreamContainer.

Add and load a stream container

public long
addContainer(RawTransaction
the transaction that is creating the container
t
,
long
the segment where the container is to go
segmentId
,
long input_containerid, int
whether or not to LOGGED or not. The effect of this mode is only for this addContainer call, not persisently stored throughout the lifetime of the container
mode
,
Properties
properties of the container that is persistently stored throughout the lifetime of the container
tableProperties
,
int temporaryFlag)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.addContainer.

Add a container with a specified page size to a segment.

public void
backupDataFiles(Transaction rt, File backupDir)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.backupDataFiles.

Back up the data segment of the database.

public void
boot(boolean
True if the database should be created
create
,
Properties
Configuration properties
startParams
)

Implements org.apache.derby.iapi.services.monitor.ModuleControl.boot.

Boot this module with the given properties.

private void
bootLogFactory(boolean create, Properties startParams)

private static Object
bootServiceModule(final boolean create, final Object serviceModule, final String factoryInterface, final Properties properties)

Must be private so that user code can't call this entry point.

private static String

Returns:

the Java system property value from the JVM or a string capturing a security exception.
buildJvmVersion
()

Return values of system properties that identify the JVM.

private static String

Returns:

the Java system property value for the OS or a string capturing a security exception.
buildOSinfo
()

Return values of system properties that identify the OS.

public boolean
canSupport(Properties startParams)

Implements org.apache.derby.iapi.services.monitor.ModuleSupportable.canSupport.

See if this implementation can support any attributes that are listed in properties.

public void
checkpoint()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.checkpoint.

Implement checkpoint operation, write/sync all pages in cache.

public void
public final boolean
databaseEncrypted()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.databaseEncrypted.

Returns if data base is in encrypted mode.

public int
decrypt(byte[] ciphertext, int offset, int length, byte[] cleartext, int outputOffset)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.decrypt.

Decrypt cleartext from ciphertext.

public void
decryptAllContainers(RawTransaction
the transaction that is decrypting the container
t
)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.decryptAllContainers.

Decrypts all the containers in the data segment.

public void
public void
dropStreamContainer(RawTransaction t, long segmentId, long containerId)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.dropStreamContainer.

Drop a stream container.

public int
encrypt(byte[] cleartext, int offset, int length, byte[] ciphertext, int outputOffset, boolean newEngine)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.encrypt.

Encrypt cleartext into ciphertext.

public void
encryptAllContainers(RawTransaction
the transaction that is encrypting the containers.
t
)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.encryptAllContainers.

Encrypt all the containers in the data segment.

pack-priv void
fileToRemove(StorageFile file, boolean remove)

Add a file to the list of files to be removed post recovery.

private synchronized long

Returns:

The largest containerid in seg0.
findMaxContainerId
()

Find the largest containerid is seg 0.

pack-priv void
flush(LogInstant instant)

Ask the log factory to flush up to this log instant.

public void
freezePersistentStore()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.freezePersistentStore.

Backup restore - stop writing dirty pages or container to disk

public StorageFile
getAlternateContainerPath(ContainerKey
The container being opened/created
containerId
,
boolean
True if the file name for the stub is requested, otherwise the file name for the data file
stub
)

Return an alternate path to container file relative to the root directory.

pack-priv CacheManager
pack-priv synchronized String[]

Returns:

An array of all the file names in seg0.
getContainerNames
()

get all the names of the files in seg 0.

public StorageFile

Returns:

The StorageFile representing path to container relative to root.
getContainerPath
(ContainerKey
The container being opened/created
containerId
,
boolean
True if the file name for the stub is requested, otherwise the file name for the data file
stub
)

Return the path to a container file.

private synchronized StorageFile
getContainerPath(ContainerKey containerId, boolean stub, int code)

public int
getEncryptionBlockSize()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.getEncryptionBlockSize.

Returns the encryption block size used by the algorithm at time of creation of an encrypted database

public FileResource
getFileHandler()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.getFileHandler.

Get an object to handle non-transactional files.

public UUID
public int
getIntParameter(String parameterName, Properties properties, int defaultValue, int minimumValue, int maximumValue)

private void
getJBMSLockOnDB(UUID myUUID, UUIDFactory uuidFactory, String databaseDirectory)

check to see if we are the only JBMS opened against this database.

pack-priv LogFactory
private AllocationActions

Returns:

the PageActions
getLoggableAllocationActions
()

Get the loggable allocation action associated with this implementation

private PageActions
public long

Returns:

The an id which can be used to create a container.
getMaxContainerId
()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.getMaxContainerId.

Return an id which can be used to create a container.

private static ModuleFactory
getMonitor()

Must be private so that user code can't call this entry point.

pack-priv synchronized long
pack-priv CacheManager
pack-priv RawStoreFactory
public String
getRootDirectory()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.getRootDirectory.

Get the root directory of the data storage area.

public StorageFactory

Returns:

The StorageFactory used by this dataFactory
getStorageFactory
()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.getStorageFactory.

public String
getVersionedName(String name, long generationId)

private boolean
handleServiceType(String type)

Does this factory support this service type.

public void
protected void
insertUndoNotify(RawTransaction
raw transaction of the aborted insert.
rxact
,
PageKey
page key of the aborted insert.
page_key
)

Notify through set handler that an undo of an insert has happened.

public boolean
private static String

Returns:

the ClassPath of a jar file
jarClassPath
(final Class<T>
the Class to ask to print the class name of an object
cls
)

Return a jar file by asking the class's class loader for the location where the class was loaded from.

private void
public boolean
luceneLoaded()

Return true if the Lucene plugin is loaded

public StandardException
markCorrupt(StandardException originalError)

Implements org.apache.derby.iapi.store.raw.Corruptable.markCorrupt.

Really this is just a convience routine for callers that might not have access to a log factory.

public Cacheable
pack-priv Cacheable

Returns:

A new file container object.
newContainerObject
()

Produces new container objects.

protected Cacheable
newRAFContainer(BaseDataFileFactory factory)

Creates a RAFContainer object.

public ContainerHandle
openContainer(RawTransaction
the raw transaction that is opening the container
t
,
ContainerKey
the container's identity
containerId
,
LockingPolicy
the locking policy
locking
,
int
see the different mode in @see ContainerHandle then will return a null handle if the container is dropped.
mode
)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.openContainer.

Open a container that is not droped.

private RawContainerHandle
openContainer(RawTransaction t, ContainerKey identity, LockingPolicy locking, int mode, boolean droppedOK)

public RawContainerHandle
openDroppedContainer(RawTransaction t, ContainerKey containerId, LockingPolicy locking, int mode)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.openDroppedContainer.

Open a container that may have been dropped.

public StreamContainerHandle
openStreamContainer(RawTransaction t, long segmentId, long containerId, boolean hold)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.openStreamContainer.

open an exsisting streamContainer

public void
postRecovery()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.postRecovery.

Called after recovery is performed.

private void
private void
private void
pack-priv int
random()

return a secure random number

public int
reclaimSpace(Serviceable work, ContextManager contextMgr)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.reclaimSpace.

Reclaim space used by this factory.

public void
reCreateContainerForRedoRecovery(RawTransaction t, long segmentId, long containerId, ByteArray containerInfo)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.reCreateContainerForRedoRecovery.

re-Create a container during redo recovery.

private void
public void
removeDroppedContainerFileStubs(LogInstant redoLWM)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.removeDroppedContainerFileStubs.

Delete the stub files that are not required for recovery.

public void
removeOldVersionOfContainers()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.removeOldVersionOfContainers.

Removes old versions of the containers after a cryptographic operation on the database.

private synchronized void
removeStubs()

Remove stubs in this database.

public void
removeStubsOK()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.removeStubsOK.

Tell the data factory it is OK to remove committed deleted containers when the data factory shuts down.

private synchronized void
private void
restoreDataDirectory(String backupPath)

removes the data directory(seg*) from database home directory and restores it from backup location.

public final Object
run()

public void
setDatabaseEncrypted(boolean
true if the database is encrypted, false otherwise
isEncrypted
)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.setDatabaseEncrypted.

Sets whether the database is encrypted.

public void
setRawStoreFactory(RawStoreFactory rsf, boolean create, Properties startParams)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.setRawStoreFactory.

make data factory aware of which raw store factory it belongs to Also need to boot the LogFactory

public void
setUndoInsertEventHandler(UndoHandler
Class to use to notify callers of an undo of an insert.
input_undo_handle
)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.setUndoInsertEventHandler.

Register a handler class for insert undo events.

public void
setupCacheCleaner(DaemonService
daemon service to use for background cleaning
daemon
)

Implements org.apache.derby.iapi.store.raw.data.DataFactory.setupCacheCleaner.

Set up the cache cleaner for the container cache and the page cache.

private static Object
startSystemModule(final String factoryInterface)

Must be private so that user code can't call this entry point.

public void
public void
stubFileToRemoveAfterCheckPoint(StorageFile file, LogInstant logInstant, Object identity)

keeps track of information about the stub files of the committed deleted containers.

public void
unfreezePersistentStore()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.unfreezePersistentStore.

Backup restore - start writing dirty pages or container to disk

public void
writeFinished()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.writeFinished.

Backup restore - write finished, if this is the last writer, allow the persistent store to proceed.

public void
writeInProgress()

Implements org.apache.derby.iapi.store.raw.data.DataFactory.writeInProgress.

Backup restore - don't allow the persistent store to be frozen - or if it is already frozen, block.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait