Top Description Fields Constructors Methods
org.apache.derby.impl.store.access

pack-priv Class PropertyConglomerate

Additional top-level class in compilation unit: CacheLock.

extends Object
Class Inheritance
Imports
org.apache.derby.shared.common.reference.Attribute, .Property, .SQLState, org.apache.derby.iapi.types.UserType, .DataValueDescriptor, org.apache.derby.iapi.services.io.FormatableBitSet, .FormatableHashtable, .Formatable, org.apache.derby.iapi.services.locks.CompatibilitySpace, .ShExLockable, .ShExQual, .C_LockFactory, .Latch, .LockFactory, org.apache.derby.iapi.services.property.PropertyUtil, .PropertyFactory, org.apache.derby.iapi.services.monitor.Monitor, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.sql.dictionary.DataDictionary, org.apache.derby.iapi.store.access.conglomerate.TransactionManager, org.apache.derby.iapi.store.access.AccessFactory, .AccessFactoryGlobals, .ConglomerateController, .Qualifier, .ScanController, .TransactionController, org.apache.derby.iapi.store.raw.RawStoreFactory, java.io.Serializable, java.util.Dictionary, .Enumeration, .Hashtable, .Properties

Stores properties in a congolmerate with complete transactional support.

The PropertyConglomerate contains one row with 2 columns per property. Column 0 is the UTF key, and column 1 is the data.

The property conglomerate manages the storage of database properties and thier defaults. Each property is stored as a row in the PropertyConglomerate

  1. Column 0 is the UTF key,
  2. Column 1 is the data.
All the property defaults are stored in a single row of the Property Conglomerate:
  1. Column 0 is the UTF key "derby.defaultPropertyName".
  2. Column 1 is a FormatableProperties object with one row per default property.

In general a propery default defines it value if the property itself is not defined.

Because the properties conglomerate is stored in a conglomerate the information it contains is not available before the raw store runs recovery. To make a small number of properties (listed in servicePropertyList) available during early boot, this copies them to services.properties.

Field Summary

Modifier and TypeField and Description
private CacheLock
private Dictionary<String, Object>
private LockFactory
private PropertyFactory
protected long
protected Properties

Constructor Summary

AccessConstructor and Description
pack-priv
PropertyConglomerate(TransactionController tc, boolean create, Properties serviceProperties, PropertyFactory pf)

Method Summary

Modifier and TypeMethod and Description
private boolean
private <K, V> Dictionary<? super K, ? super V>
copyValues(Dictionary<? super K, ? super V> to, Dictionary<K, V> from, boolean stringsOnly)

private static Object
findServiceModule(final Object serviceModule, final String factoryInterface)

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

private Dictionary<String, Object>
private Serializable
private Serializable
pack-priv Properties
getProperties(TransactionController tc)

Fetch the set of properties as a Properties object.

public void
getProperties(TransactionController tc, Dictionary<Object, Object> d, boolean stringsOnly, boolean defaultsOnly)

pack-priv Serializable

Returns:

object The object associated with property key. n ull means no such key-value pair.
getProperty
(TransactionController
The transaction to do the Conglomerate work under.
tc
,
String
The "key" of the property that is being requested.
key
)

Gets the de-serialized object associated with a property key.

pack-priv Serializable
getPropertyDefault(TransactionController tc, String key)

Get the default for a property.

private boolean
iHoldTheUpdateLock(TransactionController tc)

Return true if the caller holds the exclusive update lock on the property conglomerate.

pack-priv void
lockProperties(TransactionController tc)

Lock the database properties for an update.

private DataValueDescriptor[]
makeNewTemplate(String key, Serializable value)

Create a new PropertyConglomerate row, with values in it.

private DataValueDescriptor[]
makeNewTemplate()

Create a new empty PropertyConglomerate row, to fetch values into.

private Serializable
map(String key, Serializable value, Dictionary<K, V> set)

Call the property set callbacks to map a proposed property value to a value to save.

private ScanController

Returns:

an open ScanController on the PropertyConglomerate.
openScan
(TransactionController
The transaction to do the Conglomerate work under.
tc
,
String
The "key" of the property that is being requested.
key
,
int
Whether we are setting or getting the property.
open_mode
)

Open a scan on the properties conglomerate looking for "key".

pack-priv boolean
private Dictionary<String, Object>
readDbProperties(TransactionController tc)

Read the database properties and add in the service set.

private Serializable
pack-priv void
pack-priv void
pack-priv void
private boolean
pack-priv void
setProperty(TransactionController
The transaction to do the Conglomerate work under.
tc
,
String
The key used to lookup this property.
key
,
Serializable
The value to be associated with this key. If null, delete the property from the properties list.
value
,
boolean dbOnlyProperty)

Sets the Serializable object associated with a property key.

pack-priv void
setPropertyDefault(TransactionController tc, String key, Serializable value)

Set the default for a property.

private void
validate(String key, Serializable value, Dictionary<K, V> set)

Call the property set callbacks to validate a property change against the property set provided.

private Serializable
validateApplyAndMap(TransactionController tc, String key, Serializable value, boolean dbOnlyProperty)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cachedLockback to summary
private CacheLock cachedLock
cachedSetback to summary
private Dictionary<String, Object> cachedSet
lfback to summary
private LockFactory lf
pfback to summary
private PropertyFactory pf
propertiesConglomIdback to summary
protected long propertiesConglomId
servicePropertiesback to summary
protected Properties serviceProperties

Constructor Detail

PropertyConglomerateback to summary
pack-priv PropertyConglomerate(TransactionController tc, boolean create, Properties serviceProperties, PropertyFactory pf) throws StandardException

Method Detail

bootPasswordChangeback to summary
private boolean bootPasswordChange(TransactionController tc, String key, Serializable value) throws StandardException
copyValuesback to summary
private <K, V> Dictionary<? super K, ? super V> copyValues(Dictionary<? super K, ? super V> to, Dictionary<K, V> from, boolean stringsOnly)
findServiceModuleback to summary
private static Object findServiceModule(final Object serviceModule, final String factoryInterface) throws StandardException

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

getCachedDbPropertiesback to summary
private Dictionary<String, Object> getCachedDbProperties(TransactionController tc) throws StandardException
getCachedPropertyback to summary
private Serializable getCachedProperty(TransactionController tc, String key) throws StandardException
getCachedPropertyDefaultback to summary
private Serializable getCachedPropertyDefault(TransactionController tc, String key, Dictionary<K, V> dbProps) throws StandardException
getPropertiesback to summary
pack-priv Properties getProperties(TransactionController tc) throws StandardException

Fetch the set of properties as a Properties object. This means that only keys that have String values will be included.

getPropertiesback to summary
public void getProperties(TransactionController tc, Dictionary<Object, Object> d, boolean stringsOnly, boolean defaultsOnly) throws StandardException
getPropertyback to summary
pack-priv Serializable getProperty(TransactionController tc, String key) throws StandardException

Gets the de-serialized object associated with a property key.

The Store provides a transaction protected list of database properties. Higher levels of the system can store and retrieve these properties once Recovery has finished. Each property is a serializable object and is stored/retrieved using a String key.

In this implementation a lookup is done on the PropertyConglomerate conglomerate, using a scan with "key" as the qualifier.

Parameters
tc:TransactionController

The transaction to do the Conglomerate work under.

key:String

The "key" of the property that is being requested.

Returns:Serializable

object The object associated with property key. n ull means no such key-value pair.

Exceptions
StandardException:
Standard exception policy.
getPropertyDefaultback to summary
pack-priv Serializable getPropertyDefault(TransactionController tc, String key) throws StandardException

Get the default for a property.

Exceptions
StandardException:
Standard exception policy.
iHoldTheUpdateLockback to summary
private boolean iHoldTheUpdateLock(TransactionController tc) throws StandardException

Return true if the caller holds the exclusive update lock on the property conglomerate.

lockPropertiesback to summary
pack-priv void lockProperties(TransactionController tc) throws StandardException

Lock the database properties for an update.

makeNewTemplateback to summary
private DataValueDescriptor[] makeNewTemplate(String key, Serializable value)

Create a new PropertyConglomerate row, with values in it.

makeNewTemplateback to summary
private DataValueDescriptor[] makeNewTemplate()

Create a new empty PropertyConglomerate row, to fetch values into.

mapback to summary
private Serializable map(String key, Serializable value, Dictionary<K, V> set) throws StandardException

Call the property set callbacks to map a proposed property value to a value to save.

The caller must run this in a block synchronized on this to serialize validations with changes to the set of property callbacks

openScanback to summary
private ScanController openScan(TransactionController tc, String key, int open_mode) throws StandardException

Open a scan on the properties conglomerate looking for "key".

Open a scan on the properties conglomerate qualified to find the row with value key in column 0. Both column 0 and column 1 are included in the scan list.

Parameters
tc:TransactionController

The transaction to do the Conglomerate work under.

key:String

The "key" of the property that is being requested.

open_mode:int

Whether we are setting or getting the property.

Returns:ScanController

an open ScanController on the PropertyConglomerate.

Exceptions
StandardException:
Standard exception policy.
propertyDefaultIsVisibleback to summary
pack-priv boolean propertyDefaultIsVisible(TransactionController tc, String key) throws StandardException
readDbPropertiesback to summary
private Dictionary<String, Object> readDbProperties(TransactionController tc) throws StandardException

Read the database properties and add in the service set.

readPropertyback to summary
private Serializable readProperty(TransactionController tc, String key) throws StandardException
resetCacheback to summary
pack-priv void resetCache()
savePropertyback to summary
pack-priv void saveProperty(TransactionController tc, String key, Serializable value) throws StandardException
savePropertyDefaultback to summary
pack-priv void savePropertyDefault(TransactionController tc, String key, Serializable value) throws StandardException
saveServicePropertyback to summary
private boolean saveServiceProperty(String key, Serializable value)
setPropertyback to summary
pack-priv void setProperty(TransactionController tc, String key, Serializable value, boolean dbOnlyProperty) throws StandardException

Sets the Serializable object associated with a property key.

This implementation turns the setProperty into an insert into the PropertyConglomerate conglomerate.

See the discussion of getProperty().

The value stored may be a Formatable object or a Serializable object whose class name starts with java.*. This stops arbitary objects being stored in the database by class name, which will cause problems in obfuscated/non-obfuscated systems.

Parameters
tc:TransactionController

The transaction to do the Conglomerate work under.

key:String

The key used to lookup this property.

value:Serializable

The value to be associated with this key. If null, delete the property from the properties list.

Exceptions
StandardException:
Standard exception policy.
setPropertyDefaultback to summary
pack-priv void setPropertyDefault(TransactionController tc, String key, Serializable value) throws StandardException

Set the default for a property.

Exceptions
StandardException:
Standard exception policy.
validateback to summary
private void validate(String key, Serializable value, Dictionary<K, V> set) throws StandardException

Call the property set callbacks to validate a property change against the property set provided.

The caller must run this in a block synchronized on this to serialize validations with changes to the set of property callbacks

validateApplyAndMapback to summary
private Serializable validateApplyAndMap(TransactionController tc, String key, Serializable value, boolean dbOnlyProperty) throws StandardException