public class DerbyPersistenceManager extends BundleDbPersistenceManager
BundleDbPersistenceManager
by derby specific code.
Configuration:
bundleCacheSize
" value="8"/>
consistencyCheck
" value="false"/>
minBlobSize
" value="16384"/>
driver
" value="org.apache.derby.jdbc.EmbeddedDriver"/>
url
" value="jdbc:derby:${wsp.home}/db/itemState;create=true"/>
user
" value=""/>
password
" value=""/>
schema
" value="derby"/>
schemaObjectPrefix
" value=""/>
errorHandling
" value=""/>
derbyStorageInitialPages
" value="16"/>
derbyStorageMinimumRecordSize
" value="256"/>
derbyStoragePageCacheSize
" value="1024"/>
derbyStoragePageReservedSpace
" value="20"/>
derbyStoragePageSize
" value="16384"/>
BundleDbPersistenceManager.CloseableBLOBStore, BundleDbPersistenceManager.DbBlobStore, BundleDbPersistenceManager.FSBlobStore
Modifier and Type | Field and Description |
---|---|
static String |
DERBY_EMBEDDED_DRIVER
name of the embedded driver
|
binding, blobStore, blockOnConnectionLoss, bundleDeleteSQL, bundleInsertSQL, bundleSelectAllBundlesFromSQL, bundleSelectAllBundlesSQL, bundleSelectAllIdsFromSQL, bundleSelectAllIdsSQL, bundleSelectSQL, bundleUpdateSQL, conHelper, consistencyCheck, consistencyFix, databaseType, dataSourceName, driver, errorHandling, externalBLOBs, INITIAL_BUFFER_SIZE, initialized, nodeReferenceDeleteSQL, nodeReferenceInsertSQL, nodeReferenceSelectSQL, nodeReferenceUpdateSQL, password, schemaObjectPrefix, SM_BINARY_KEYS, SM_LONGLONG_KEYS, url, user
context, NODEFILENAME, NODEREFSFILENAME, RES_NAME_INDEX, RES_NS_INDEX
ACCESS_INTERVAL
Constructor and Description |
---|
DerbyPersistenceManager() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the given connection by shutting down the embedded Derby
database.
|
protected ConnectionHelper |
createConnectionHelper(DataSource dataSrc)
This method is called from the
BundleDbPersistenceManager.init(PMContext) method of this class and returns a
ConnectionHelper instance which is assigned to the conHelper field. |
String |
getDerbyStorageInitialPages() |
String |
getDerbyStorageMinimumRecordSize() |
String |
getDerbyStoragePageCacheSize() |
String |
getDerbyStoragePageReservedSpace() |
String |
getDerbyStoragePageSize() |
int |
getStorageModel()
returns the storage model
|
void |
init(PMContext context)
Initializes the persistence manager.
|
void |
setDerbyStorageInitialPages(String derbyStorageInitialPages)
The on-disk size of a Derby table grows by one page at a time until eight
pages of user data (or nine pages of total disk use, one is used for
overhead) have been allocated.
|
void |
setDerbyStorageMinimumRecordSize(String derbyStorageMinimumRecordSize)
Indicates the minimum user row size in bytes for on-disk database pages
for tables when you are creating a table.
|
void |
setDerbyStoragePageCacheSize(String derbyStoragePageCacheSize)
Defines the size, in number of pages, of the database's data page cache
(data pages kept in memory).
|
void |
setDerbyStoragePageReservedSpace(String derbyStoragePageReservedSpace)
Defines the percentage of space reserved for updates on an on-disk
database page for tables only (not indexes); indicates the percentage of
space to keep free on a page when inserting.
|
void |
setDerbyStoragePageSize(String derbyStoragePageSize)
Defines the page size, in bytes, for on-disk database pages for tables or
indexes used during table or index creation.
|
buildSQLStatements, createBlobStore, createCheckSchemaOperation, createDBBlobStore, createDbNameIndex, createLocalFSBlobStore, createParams, destroy, destroyBundle, existsReferencesTo, getAllNodeIds, getAllNodeInfos, getBlobStore, getBlockOnConnectionLoss, getConsistencyCheck, getConsistencyFix, getDatabaseType, getDataSourceName, getDriver, getErrorHandling, getKey, getMinBlobSize, getNameIndex, getPassword, getSchema, getSchemaObjectPrefix, getUrl, getUser, isExternalBLOBs, isSchemaCheckEnabled, loadBundle, loadReferencesTo, setBlockOnConnectionLoss, setConnectionFactory, setConsistencyCheck, setConsistencyFix, setDatabaseType, setDataSourceName, setDriver, setErrorHandling, setExternalBLOBs, setMinBlobSize, setPassword, setSchema, setSchemaCheckEnabled, setSchemaObjectPrefix, setUrl, setUser, store, store, storeBundle, toString, useDbBlobStore, useLocalFsBlobStore
buildBlobFilePath, buildNodeFilePath, buildNodeFolderPath, buildNodeReferencesFilePath, buildPropFilePath, cacheAccessed, check, checkConsistency, createNew, createNew, disposeCache, evictBundle, exists, exists, getBundleCacheSize, getNsIndex, load, load, onExternalUpdate, setBundleCacheSize, setEventChannel
public static final String DERBY_EMBEDDED_DRIVER
public String getDerbyStorageInitialPages()
setDerbyStorageInitialPages(java.lang.String)
public void setDerbyStorageInitialPages(String derbyStorageInitialPages)
A Derby table or index can be created with a number of pages already pre-allocated. To do so, specify the property prior to the CREATE TABLE or CREATE INDEX statement.
Define the number of user pages the table or index is to be created with. The purpose of this property is to preallocate a table or index of reasonable size if the user expects that a large amount of data will be inserted into the table or index. A table or index that has the pre-allocated pages will enjoy a small performance improvement over a table or index that has no pre-allocated pages when the data are loaded.
The total desired size of the table or index should be
(1+derby.storage.initialPages) * derby.storage.pageSize bytes.
When you create a table or an index after setting this property, Derby attempts to preallocate the requested number of user pages. However, the operations do not fail even if they are unable to preallocate the requested number of pages, as long as they allocate at least one page.
Default is 16
derbyStorageInitialPages
- the number of initial pagespublic String getDerbyStorageMinimumRecordSize()
setDerbyStorageMinimumRecordSize(java.lang.String)
public void setDerbyStorageMinimumRecordSize(String derbyStorageMinimumRecordSize)
Default is 256
derbyStorageMinimumRecordSize
- the minimum record sizepublic String getDerbyStoragePageCacheSize()
setDerbyStoragePageCacheSize(java.lang.String)
public void setDerbyStoragePageCacheSize(String derbyStoragePageCacheSize)
setDerbyStoragePageCacheSize(java.lang.String)
)
setDerbyStoragePageSize(java.lang.String)
)
The minimum value is 40 pages. If you specify a lower value, Derby uses the default value.
Default is 1024
(which gives about 16mb memory usage given
the default of 16384 as page size).
derbyStoragePageCacheSize
- the page cache sizepublic String getDerbyStoragePageReservedSpace()
setDerbyStoragePageReservedSpace(java.lang.String)
public void setDerbyStoragePageReservedSpace(String derbyStoragePageReservedSpace)
Regardless of the value of derby.storage.pageReservedSpace, an empty page always accepts at least one row.
Default is 20%
derbyStoragePageReservedSpace
- the page reserved spacepublic String getDerbyStoragePageSize()
setDerbyStoragePageSize(java.lang.String)
public void setDerbyStoragePageSize(String derbyStoragePageSize)
Default is 16384
derbyStoragePageSize
- the storage page sizepublic void init(PMContext context) throws Exception
An appropriate exception is thrown if the persistence manager initialization fails for whatever reason. In this case the state of the persistence manager is undefined and the instance should be discarded. Initializes the internal structures of this abstract persistence manager.
init
in interface PersistenceManager
init
in class BundleDbPersistenceManager
context
- persistence manager contextException
- if the persistence manager initialization failedprotected ConnectionHelper createConnectionHelper(DataSource dataSrc)
BundleDbPersistenceManager.init(PMContext)
method of this class and returns a
ConnectionHelper
instance which is assigned to the conHelper
field. Subclasses may
override it to return a specialized connection helper.createConnectionHelper
in class BundleDbPersistenceManager
dataSrc
- the DataSource
of this persistence managerConnectionHelper
public int getStorageModel()
getStorageModel
in class BundleDbPersistenceManager
BundleDbPersistenceManager.SM_LONGLONG_KEYS
public void close() throws Exception
close
in interface PersistenceManager
close
in class BundleDbPersistenceManager
SQLException
- if an error occursException
- if the persistence manager failed to close properlyCopyright © 2004–2021 The Apache Software Foundation. All rights reserved.