Class DerbyPersistenceManager
- java.lang.Object
- 
- org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager
- 
- org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManager
- 
- org.apache.jackrabbit.core.persistence.pool.DerbyPersistenceManager
 
 
 
- 
- All Implemented Interfaces:
- CacheAccessListener,- CachingPersistenceManager,- ConsistencyChecker,- IterablePersistenceManager,- PersistenceManager,- DatabaseAware
 
 public class DerbyPersistenceManager extends BundleDbPersistenceManager Extends theBundleDbPersistenceManagerby derby specific code.Configuration: 
 - <param name="bundleCacheSize" value="8"/>
- <param name="consistencyCheck" value="false"/>
- <param name="minBlobSize" value="16384"/>
- <param name="driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
- <param name="url" value="jdbc:derby:${wsp.home}/db/itemState;create=true"/>
- <param name="user" value=""/>
- <param name="password" value=""/>
- <param name="schema" value="derby"/>
- <param name="schemaObjectPrefix" value=""/>
- <param name="errorHandling" value=""/>
- <param name="derbyStorageInitialPages" value="16"/>
- <param name="derbyStorageMinimumRecordSize" value="256"/>
- <param name="derbyStoragePageCacheSize" value="1024"/>
- <param name="derbyStoragePageReservedSpace" value="20"/>
- <param name="derbyStoragePageSize" value="16384"/>
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManagerBundleDbPersistenceManager.CloseableBLOBStore, BundleDbPersistenceManager.DbBlobStore, BundleDbPersistenceManager.FSBlobStore
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static StringDERBY_EMBEDDED_DRIVERname of the embedded driver- 
Fields inherited from class org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManagerbinding, 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
 - 
Fields inherited from class org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManagercontext, NODEFILENAME, NODEREFSFILENAME, RES_NAME_INDEX, RES_NS_INDEX
 - 
Fields inherited from interface org.apache.jackrabbit.core.cache.CacheAccessListenerACCESS_INTERVAL
 
- 
 - 
Constructor SummaryConstructors Constructor Description DerbyPersistenceManager()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the given connection by shutting down the embedded Derby database.protected ConnectionHelpercreateConnectionHelper(DataSource dataSrc)This method is called from theBundleDbPersistenceManager.init(PMContext)method of this class and returns aConnectionHelperinstance which is assigned to theconHelperfield.StringgetDerbyStorageInitialPages()StringgetDerbyStorageMinimumRecordSize()StringgetDerbyStoragePageCacheSize()StringgetDerbyStoragePageReservedSpace()StringgetDerbyStoragePageSize()intgetStorageModel()returns the storage modelvoidinit(PMContext context)Initializes the persistence manager.voidsetDerbyStorageInitialPages(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.voidsetDerbyStorageMinimumRecordSize(String derbyStorageMinimumRecordSize)Indicates the minimum user row size in bytes for on-disk database pages for tables when you are creating a table.voidsetDerbyStoragePageCacheSize(String derbyStoragePageCacheSize)Defines the size, in number of pages, of the database's data page cache (data pages kept in memory).voidsetDerbyStoragePageReservedSpace(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.voidsetDerbyStoragePageSize(String derbyStoragePageSize)Defines the page size, in bytes, for on-disk database pages for tables or indexes used during table or index creation.- 
Methods inherited from class org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManagerbuildSQLStatements, 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
 - 
Methods inherited from class org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManagerbuildBlobFilePath, buildNodeFilePath, buildNodeFolderPath, buildNodeReferencesFilePath, buildPropFilePath, cacheAccessed, check, checkConsistency, createNew, createNew, disposeCache, evictBundle, exists, exists, getBundleCacheSize, getNsIndex, load, load, onExternalUpdate, setBundleCacheSize, setEventChannel
 
- 
 
- 
- 
- 
Field Detail- 
DERBY_EMBEDDED_DRIVERpublic static final String DERBY_EMBEDDED_DRIVER name of the embedded driver- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getDerbyStorageInitialPagespublic String getDerbyStorageInitialPages() - Returns:
- the initial pages property
- See Also:
- setDerbyStorageInitialPages(java.lang.String)
 
 - 
setDerbyStorageInitialPagespublic 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. Then it will grow by eight pages at a time if possible.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- Parameters:
- derbyStorageInitialPages- the number of initial pages
 
 - 
getDerbyStorageMinimumRecordSizepublic String getDerbyStorageMinimumRecordSize() - Returns:
- the minimum record size
- See Also:
- setDerbyStorageMinimumRecordSize(java.lang.String)
 
 - 
setDerbyStorageMinimumRecordSizepublic 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. This property ensures that there is enough room for a row to grow on a page when updated without having to overflow. This is generally most useful for VARCHAR and VARCHAR FOR BIT DATA data types and for tables that are updated a lot, in which the rows start small and grow due to updates. Reserving the space at the time of insertion minimizes row overflow due to updates, but it can result in wasted space. Set the property prior to issuing the CREATE TABLE statement.Default is 256- Parameters:
- derbyStorageMinimumRecordSize- the minimum record size
 
 - 
getDerbyStoragePageCacheSizepublic String getDerbyStoragePageCacheSize() - Returns:
- the page cache size
- See Also:
- setDerbyStoragePageCacheSize(java.lang.String)
 
 - 
setDerbyStoragePageCacheSizepublic void setDerbyStoragePageCacheSize(String derbyStoragePageCacheSize) Defines the size, in number of pages, of the database's data page cache (data pages kept in memory). The actual amount of memory the page cache will use depends on the following:-  the size of the cache (configured with setDerbyStoragePageCacheSize(java.lang.String))
-  the size of the pages (configured with setDerbyStoragePageSize(java.lang.String))
- overhead (varies with JVMs)
 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).- Parameters:
- derbyStoragePageCacheSize- the page cache size
 
-  the size of the cache (configured with 
 - 
getDerbyStoragePageReservedSpacepublic String getDerbyStoragePageReservedSpace() - Returns:
- the page reserved space
- See Also:
- setDerbyStoragePageReservedSpace(java.lang.String)
 
 - 
setDerbyStoragePageReservedSpacepublic 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. Leaving reserved space on a page can minimize row overflow (and the associated performance hit) during updates. Once a page has been filled up to the reserved-space threshold, no new rows are allowed on the page. This reserved space is used only for rows that increase in size when updated, not for new inserts. Set this property prior to issuing the CREATE TABLE statement.Regardless of the value of derby.storage.pageReservedSpace, an empty page always accepts at least one row. Default is 20%- Parameters:
- derbyStoragePageReservedSpace- the page reserved space
 
 - 
getDerbyStoragePageSizepublic String getDerbyStoragePageSize() - Returns:
- the page size
- See Also:
- setDerbyStoragePageSize(java.lang.String)
 
 - 
setDerbyStoragePageSizepublic 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. Page size can only be one the following values: 4096, 8192, 16384, or 32768. Set this property prior to issuing the CREATE TABLE or CREATE INDEX statement. This value will be used for the lifetime of the newly created conglomerates.Default is 16384- Parameters:
- derbyStoragePageSize- the storage page size
 
 - 
initpublic void init(PMContext context) throws Exception Initializes the persistence manager. The persistence manager is permanently bound to the given context, and any required external resources are acquired.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. - Specified by:
- initin interface- PersistenceManager
- Overrides:
- initin class- BundleDbPersistenceManager
- Parameters:
- context- persistence manager context
- Throws:
- Exception- if the persistence manager initialization failed
 
 - 
createConnectionHelperprotected ConnectionHelper createConnectionHelper(DataSource dataSrc) This method is called from theBundleDbPersistenceManager.init(PMContext)method of this class and returns aConnectionHelperinstance which is assigned to theconHelperfield. Subclasses may override it to return a specialized connection helper.- Overrides:
- createConnectionHelperin class- BundleDbPersistenceManager
- Parameters:
- dataSrc- the- DataSourceof this persistence manager
- Returns:
- a ConnectionHelper
 
 - 
getStorageModelpublic int getStorageModel() returns the storage model Since Derby cannot handle binary indexes, we use long-long keys.- Overrides:
- getStorageModelin class- BundleDbPersistenceManager
- Returns:
- BundleDbPersistenceManager.SM_LONGLONG_KEYS
 
 - 
closepublic void close() throws ExceptionCloses the given connection by shutting down the embedded Derby database.- Specified by:
- closein interface- PersistenceManager
- Overrides:
- closein class- BundleDbPersistenceManager
- Throws:
- SQLException- if an error occurs
- Exception- if the persistence manager failed to close properly
 
 
- 
 
-