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

pack-priv final Class InputStreamContainer

extends FileContainer
Class Inheritance
Imports
org.apache.derby.impl.store.raw.data.FileContainer, .BaseDataFileFactory, org.apache.derby.iapi.store.raw.ContainerKey, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.store.raw.log.LogInstant, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.io.InputStreamUtil, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.io.StorageFile, java.io.InputStream, .IOException, .DataInputStream

A class that uses a ZipEntry to be a single container file, but read-only.

Field Summary

Modifier and TypeField and Description
private StorageFile
Inherited from org.apache.derby.impl.store.raw.data.FileContainer:
allocCachecanUpdateCHECKSUM_SIZECONTAINER_INFO_SIZEcontainerCachecontainerInfocontainerVersiondataFactoryestimatedRowCountFIRST_ALLOC_PAGE_NUMBERFIRST_ALLOC_PAGE_OFFSETfirstAllocPageNumberfirstAllocPageOffsetformatIdIntegerinitialPagesisDirtylastLogInstantminimumRecordSizepageCachepageSizepreDirtySPACE_TRACEspareSpace

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected void
backupContainer(BaseContainerHandle
the container handle.
handle
,
String
location of the backup container.
backupLocation
)

Implements abstract org.apache.derby.impl.store.raw.data.FileContainer.backupContainer.

Backup the container.

public final void
clean(boolean
True if the object will be removed
forRemove
)

Implements org.apache.derby.iapi.services.cache.Cacheable.clean.

Write out the header information for this container.

pack-priv void
pack-priv void
createContainer(ContainerKey newIdentity)

Implements abstract org.apache.derby.impl.store.raw.data.FileContainer.createContainer.

Create a new container, all references to identity must be through the passed in identity, this object will no identity until after this method returns.

protected void
encryptOrDecryptContainer(BaseContainerHandle
the container handle
handle
,
String
file to store the new version of the container
newFilePath
,
boolean
tells whether to encrypt or decrypt
doEncrypt
)

Implements abstract org.apache.derby.impl.store.raw.data.BaseContainer.encryptOrDecryptContainer.

Encrypts or decrypts the container.

protected final void
flushAll()

Implements abstract org.apache.derby.impl.store.raw.data.BaseContainer.flushAll.

Flush all outstanding changes in this container to persistent storage.

protected InputStream
getInputStream()

Get an input stream positioned at the beginning of the file

pack-priv final boolean
protected final int
preAllocate(long
the last preallocated page number as known by the allocation page
lastPreallocPagenum
,
int
try to preallocate this page number of pages. Since only the container knows how many pages are actually on disk, it may determine that certain number of pages that the allocation page thinks need to be preallocated is already allocated, in those case, act as if the preallocation is successful.
preAllocSize
)

Implements abstract org.apache.derby.impl.store.raw.data.FileContainer.preAllocate.

Preallocate page.

protected final void
readPage(long pageNumber, byte[] pageData)

Implements abstract org.apache.derby.impl.store.raw.data.FileContainer.readPage.

Read a page into the supplied array.

protected void
readPositionedPage(long pageOffset, byte[] pageData)

Read the page at the positioned offset.

protected final void
removeContainer(LogInstant instant, boolean
if true, leave a stub. If false, remove everything
leaveStub
)

Implements abstract org.apache.derby.impl.store.raw.data.BaseContainer.removeContainer.

Remove the container.

protected void
protected final void
writePage(long pageNumber, byte[] pageData, boolean syncPage)

Implements abstract org.apache.derby.impl.store.raw.data.FileContainer.writePage.

Write a page from the supplied array.

Inherited from org.apache.derby.impl.store.raw.data.FileContainer:
bumpContainerVersioncanUpdateclearIdentityclearPreallocThresholdcompressContainercreateIdentcreateIdentitydeallocatePagedecryptPagedoPreAllocatePagesdropContainerencryptPagegetAllocPagegetAnyPagegetContainerPropertiesgetContainerVersiongetContextServicegetEmbryonicPagegetEmbryonicPagegetEncryptionBuffergetEstimatedPageCountgetEstimatedRowCountgetFirstHeadPagegetHeadPagegetLastPageNumbergetLatchedPagegetMinimumRecordSizegetNextHeadPagegetPagegetPageForCompressgetPageForInsertgetPageSizegetReusableRecordIdSequenceNumbergetSpaceInfogetSpareSpacegetTypeFormatIdincrementReusableRecordIdSequenceNumberinitPageisDirtylatchPageletGologCreateContainerInfonewPagepreDirtyprepareForBulkLoadreadHeaderreCreatePageForRedoRecoverysetDirtysetEstimatedRowCountsetIdentsetIdentitytrackUnfilledPageupdateEstimatedRowCountwriteAtOffsetwriteHeaderwriteHeader

Field Detail

containerPathback to summary
private StorageFile containerPath

Constructor Detail

InputStreamContainerback to summary
pack-priv InputStreamContainer(BaseDataFileFactory factory)

Method Detail

backupContainerback to summary
protected void backupContainer(BaseContainerHandle handle, String backupLocation) throws StandardException

Implements abstract org.apache.derby.impl.store.raw.data.FileContainer.backupContainer.

Backup the container. There is no support to backup this type of containers. It may not be any real use for users because users can simply make copies of the read only database in Zip files easily using OS utilities.

Parameters
handle:BaseContainerHandle

Doc from org.apache.derby.impl.store.raw.data.FileContainer.backupContainer.

the container handle.

backupLocation:String

Doc from org.apache.derby.impl.store.raw.data.FileContainer.backupContainer.

location of the backup container.

Exceptions
StandardException:
Standard Derby error policy
cleanback to summary
public final void clean(boolean forRemove) throws StandardException

Implements org.apache.derby.iapi.services.cache.Cacheable.clean.

Write out the header information for this container. If an i/o exception occurs then ...

Parameters
forRemove:boolean

Doc from org.apache.derby.iapi.services.cache.Cacheable.clean.

True if the object will be removed

Exceptions
StandardException:
Standard Derby error policy
See Also
org.apache.derby.iapi.services.cache.Cacheable#clean
closeContainerback to summary
pack-priv void closeContainer()

Implements abstract org.apache.derby.impl.store.raw.data.FileContainer.closeContainer.

createContainerback to summary
pack-priv void createContainer(ContainerKey newIdentity) throws StandardException

Implements abstract org.apache.derby.impl.store.raw.data.FileContainer.createContainer.

Create a new container, all references to identity must be through the passed in identity, this object will no identity until after this method returns.

Exceptions
StandardException:

Doc from org.apache.derby.impl.store.raw.data.FileContainer.createContainer.

Derby Standard error policy

encryptOrDecryptContainerback to summary
protected void encryptOrDecryptContainer(BaseContainerHandle handle, String newFilePath, boolean doEncrypt) throws StandardException

Implements abstract org.apache.derby.impl.store.raw.data.BaseContainer.encryptOrDecryptContainer.

Encrypts or decrypts the container.

These operations are unsupported for this type of container.

Parameters
handle:BaseContainerHandle

Doc from org.apache.derby.impl.store.raw.data.BaseContainer.encryptOrDecryptContainer.

the container handle

newFilePath:String

Doc from org.apache.derby.impl.store.raw.data.BaseContainer.encryptOrDecryptContainer.

file to store the new version of the container

doEncrypt:boolean

Doc from org.apache.derby.impl.store.raw.data.BaseContainer.encryptOrDecryptContainer.

tells whether to encrypt or decrypt

Exceptions
StandardException:
STORE_FEATURE_NOT_IMPLEMENTED
flushAllback to summary
protected final void flushAll()

Implements abstract org.apache.derby.impl.store.raw.data.BaseContainer.flushAll.

Doc from org.apache.derby.impl.store.raw.data.BaseContainer.flushAll.

Flush all outstanding changes in this container to persistent storage.

getInputStreamback to summary
protected InputStream getInputStream() throws IOException

Get an input stream positioned at the beginning of the file

openContainerback to summary
pack-priv final boolean openContainer(ContainerKey newIdentity) throws StandardException

Implements abstract org.apache.derby.impl.store.raw.data.FileContainer.openContainer.

Doc from org.apache.derby.impl.store.raw.data.FileContainer.openContainer.

Open a container.

Longer descrption of routine.

Open a container. Open the file that maps to this container, if the file does not exist then we assume the container was never created. If the file exists but we have trouble opening it then we throw some exception.
MT - single thread required - Enforced by cache manager.

Exceptions
StandardException:
Standard exception policy.
preAllocateback to summary
protected final int preAllocate(long lastPreallocPagenum, int preAllocSize)

Implements abstract org.apache.derby.impl.store.raw.data.FileContainer.preAllocate.

Preallocate page.

Parameters
lastPreallocPagenum:long

Doc from org.apache.derby.impl.store.raw.data.FileContainer.preAllocate.

the last preallocated page number as known by the allocation page

preAllocSize:int

Doc from org.apache.derby.impl.store.raw.data.FileContainer.preAllocate.

try to preallocate this page number of pages. Since only the container knows how many pages are actually on disk, it may determine that certain number of pages that the allocation page thinks need to be preallocated is already allocated, in those case, act as if the preallocation is successful.

Returns:int

Doc from org.apache.derby.impl.store.raw.data.FileContainer.preAllocate.

number of successfully preallocated page, or 0 if no page has been preallocated

readPageback to summary
protected final void readPage(long pageNumber, byte[] pageData) throws IOException, StandardException

Implements abstract org.apache.derby.impl.store.raw.data.FileContainer.readPage.

Read a page into the supplied array.
MT - thread safe

Exceptions
IOException:

Doc from org.apache.derby.impl.store.raw.data.FileContainer.readPage.

error reading page

StandardException:

Doc from org.apache.derby.impl.store.raw.data.FileContainer.readPage.

standard Derby error message

readPositionedPageback to summary
protected void readPositionedPage(long pageOffset, byte[] pageData) throws IOException

Read the page at the positioned offset. This default implementation, opens the stream and skips to the offset and then reads the data into pageData.

removeContainerback to summary
protected final void removeContainer(LogInstant instant, boolean leaveStub) throws StandardException

Implements abstract org.apache.derby.impl.store.raw.data.BaseContainer.removeContainer.

Remove the container.

Parameters
leaveStub:boolean

Doc from org.apache.derby.impl.store.raw.data.BaseContainer.removeContainer.

if true, leave a stub. If false, remove everything

Exceptions
StandardException:

Doc from org.apache.derby.impl.store.raw.data.BaseContainer.removeContainer.

Standard Derby error policy

truncatePagesback to summary
protected void truncatePages(long lastValidPagenum)

Implements abstract org.apache.derby.impl.store.raw.data.BaseContainer.truncatePages.

writePageback to summary
protected final void writePage(long pageNumber, byte[] pageData, boolean syncPage) throws IOException, StandardException

Implements abstract org.apache.derby.impl.store.raw.data.FileContainer.writePage.

Write a page from the supplied array.
MT - thread safe

Exceptions
IOException:

Doc from org.apache.derby.impl.store.raw.data.FileContainer.writePage.

error writing page

StandardException:

Doc from org.apache.derby.impl.store.raw.data.FileContainer.writePage.

Standard Derby error policy