|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.store.raw.data.StreamFileContainer
public class StreamFileContainer
The format of this stream file is: (RH) (FH) (field data) (FH) (field data) ........ (FH) (field data) Record header is stored once at the beginning of the file for all the rows stored in this file. Record Header indicates how many fields are in each row. Then we just stored all the column from each row. Field header stored on this file is fixed size with fieldDataLength size set to LARGE_SLOT_SIZE (4) bytes. NOTE: No locks are used in this container. All transaction are not logged.
Constructor Summary | |
---|---|
StreamFileContainer(ContainerKey identity,
BaseDataFileFactory dataFactory)
Constructor. |
|
StreamFileContainer(ContainerKey identity,
BaseDataFileFactory dataFactory,
java.util.Properties prop)
Constructor when rowSource is passed to the constructor, it will be loaded into the container after the container has been created. |
Method Summary | |
---|---|
protected void |
close()
Close the stream file. |
boolean |
fetchNext(java.lang.Object[] row)
|
void |
getContainerProperties(java.util.Properties prop)
Request the system properties associated with a stream container. |
protected StorageFile |
getFileName(ContainerKey identity,
boolean forCreate,
boolean errorOK)
Return a file name for the identity. |
ContainerKey |
getIdentity()
Request the container key associated with the stream container. |
int |
getTypeFormatId()
Return my format identifier. |
void |
load(RowSource rowSource)
load data into this container. |
protected StreamFileContainer |
open(boolean forUpdate)
Open a stream file container. |
private boolean |
privDelete(StorageFile file)
|
private boolean |
privExists(StorageFile file)
|
private java.io.InputStream |
privGetInputStream(StorageFile file)
|
private java.io.OutputStream |
privGetOutputStream(StorageFile file)
|
private boolean |
privMkdirs(StorageFile file)
|
boolean |
removeContainer()
Close the stream file and remove the file. |
java.lang.Object |
run()
|
protected boolean |
use(StreamContainerHandle handle)
Can I use this container? |
private void |
writeColumn(java.lang.Object column)
|
private void |
writeToFile()
Write the buffer to the file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static int formatIdInteger
protected static final int LARGE_SLOT_SIZE
protected static final int MIN_BUFFER_SIZE
protected static final int FIELD_STATUS
protected static final int FIELD_HEADER_SIZE
protected ContainerKey identity
private BaseDataFileFactory dataFactory
private int bufferSize
private StorageFile file
private java.io.OutputStream fileOut
private DynamicByteArrayOutputStream out
private FormatIdOutputStream logicalDataOut
private java.io.InputStream fileIn
private java.io.BufferedInputStream bufferedIn
private DecryptInputStream decryptIn
private LimitInputStream limitIn
private FormatIdInputStream logicalDataIn
private StoredRecordHeader recordHeader
private byte[] ciphertext
private byte[] zeroBytes
private static final int STORAGE_FILE_EXISTS_ACTION
private static final int STORAGE_FILE_DELETE_ACTION
private static final int STORAGE_FILE_MKDIRS_ACTION
private static final int STORAGE_FILE_GET_OUTPUT_STREAM_ACTION
private static final int STORAGE_FILE_GET_INPUT_STREAM_ACTION
private int actionCode
private StorageFile actionStorageFile
Constructor Detail |
---|
StreamFileContainer(ContainerKey identity, BaseDataFileFactory dataFactory) throws StandardException
StandardException
- Standard exception policy.StreamFileContainer(ContainerKey identity, BaseDataFileFactory dataFactory, java.util.Properties prop) throws StandardException
when rowSource is passed to the constructor, it will be loaded into the container after the container has been created.
StandardException
- Standard exception policy.Method Detail |
---|
protected StreamFileContainer open(boolean forUpdate) throws StandardException
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 and return. If the file exists but we have trouble opening it then we throw some exception.
forUpdate
- Currently only accepts false, updating and existing
stream file container is not currently supported.
StandardException
- Standard exception policy.protected void close()
Close this stream file, and all streams associated with it.
StandardException
- Standard exception policy.public int getTypeFormatId()
getTypeFormatId
in interface TypedFormat
public void getContainerProperties(java.util.Properties prop) throws StandardException
Request the value of properties associated with a stream container. The following properties can be requested: derby.storage.streamFileBufferSize
To get the value of a particular property add it to the property list, and on return the value of the property will be set to it's current value. For example: get_prop(ConglomerateController cc) { Properties prop = new Properties(); prop.put("derby.storage.streamFileBufferSize", ""); cc.getContainerProperties(prop); System.out.println( "stream table's buffer size = " + prop.getProperty("derby.storage.streamFileBufferSize"); }
prop
- Property list to fill in.
StandardException
- Standard exception policy.public ContainerKey getIdentity()
protected boolean use(StreamContainerHandle handle) throws StandardException
This method always return true right now. In the future when there are different uses for this container, we may need to add qualifications for this.
StandardException
- Standard exception policy.public void load(RowSource rowSource) throws StandardException
populate the stream container with data in the rowSource
rowSource
- The row source to get rows to load into this container.
StandardException
- Standard exception policy.private void writeToFile() throws StandardException
If the database is encrypted, the dataFactory.getEncryptionBlockSize() - 1 reserved bytes will be used to pad the byte array to be dataFactory.getEncryptionBlockSize() aligned. Before the bytes are encrypted and written to the file stream, the actual length of the byte array is written out as a compressed integer. This number will be used when decrypting the data. If the database is not encrypted, then, we don't reserve the bytes upfront, and we simple just write the bytes out to the file stream.
StandardException
- Standard exception policy.private void writeColumn(java.lang.Object column) throws StandardException, java.io.IOException
StandardException
java.io.IOException
public boolean fetchNext(java.lang.Object[] row) throws StandardException
StandardException
public boolean removeContainer() throws StandardException
StandardException
- Segment directory cannot be createdprotected StorageFile getFileName(ContainerKey identity, boolean forCreate, boolean errorOK) throws StandardException
Return a valid file name for the identity, or null if the data directory for this segment cannot be created
StandardException
- Segment directory cannot be createdprivate boolean privExists(StorageFile file)
private boolean privMkdirs(StorageFile file)
private boolean privDelete(StorageFile file)
private java.io.OutputStream privGetOutputStream(StorageFile file) throws java.io.FileNotFoundException
java.io.FileNotFoundException
private java.io.InputStream privGetInputStream(StorageFile file) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public java.lang.Object run() throws java.io.FileNotFoundException
run
in interface java.security.PrivilegedExceptionAction
java.io.FileNotFoundException
|
Built on Thu 2012-03-29 21:53:33+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |