Class PropertyConglomerate
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
- Column 0 is the UTF key,
- Column 1 is the data.
- Column 0 is the UTF key "derby.defaultPropertyName".
- 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
FieldsModifier and TypeFieldDescriptionprivate CacheLock
private Dictionary
<String, Object> private LockFactory
private PropertyFactory
protected long
protected Properties
-
Constructor Summary
ConstructorsConstructorDescriptionPropertyConglomerate
(TransactionController tc, boolean create, Properties serviceProperties, PropertyFactory pf) -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
bootPasswordChange
(TransactionController tc, String key, Serializable value) 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
(Object serviceModule, String factoryInterface) Privileged startup.private Dictionary
<String, Object> private Serializable
getCachedProperty
(TransactionController tc, String key) private Serializable
getCachedPropertyDefault
(TransactionController tc, String key, Dictionary dbProps) (package private) Properties
Fetch the set of properties as a Properties object.void
getProperties
(TransactionController tc, Dictionary<Object, Object> d, boolean stringsOnly, boolean defaultsOnly) (package private) Serializable
getProperty
(TransactionController tc, String key) Gets the de-serialized object associated with a property key.(package private) Serializable
Get the default for a property.private boolean
Return true if the caller holds the exclusive update lock on the property conglomerate.(package private) void
Lock the database properties for an update.private DataValueDescriptor[]
Create a new empty PropertyConglomerate row, to fetch values into.private DataValueDescriptor[]
makeNewTemplate
(String key, Serializable value) Create a new PropertyConglomerate row, with values in it.private Serializable
map
(String key, Serializable value, Dictionary set) Call the property set callbacks to map a proposed property value to a value to save.private ScanController
openScan
(TransactionController tc, String key, int open_mode) Open a scan on the properties conglomerate looking for "key".(package private) boolean
private Dictionary
<String, Object> Read the database properties and add in the service set.private Serializable
readProperty
(TransactionController tc, String key) (package private) void
(package private) void
saveProperty
(TransactionController tc, String key, Serializable value) (package private) void
savePropertyDefault
(TransactionController tc, String key, Serializable value) private boolean
saveServiceProperty
(String key, Serializable value) (package private) void
setProperty
(TransactionController tc, String key, Serializable value, boolean dbOnlyProperty) Sets the Serializable object associated with a property key.(package private) void
setPropertyDefault
(TransactionController tc, String key, Serializable value) Set the default for a property.private void
validate
(String key, Serializable value, Dictionary 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)
-
Field Details
-
propertiesConglomId
protected long propertiesConglomId -
serviceProperties
-
lf
-
cachedSet
-
cachedLock
-
pf
-
-
Constructor Details
-
PropertyConglomerate
PropertyConglomerate(TransactionController tc, boolean create, Properties serviceProperties, PropertyFactory pf) throws StandardException - Throws:
StandardException
-
-
Method Details
-
makeNewTemplate
Create a new PropertyConglomerate row, with values in it. -
makeNewTemplate
Create a new empty PropertyConglomerate row, to fetch values into. -
openScan
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
- The transaction to do the Conglomerate work under.key
- The "key" of the property that is being requested.open_mode
- Whether we are setting or getting the property.- Returns:
- an open ScanController on the PropertyConglomerate.
- Throws:
StandardException
- Standard exception policy.
-
setPropertyDefault
void setPropertyDefault(TransactionController tc, String key, Serializable value) throws StandardException Set the default for a property.- Throws:
StandardException
- Standard exception policy.
-
propertyDefaultIsVisible
- Throws:
StandardException
-
saveProperty
void saveProperty(TransactionController tc, String key, Serializable value) throws StandardException - Throws:
StandardException
-
saveServiceProperty
-
savePropertyDefault
void savePropertyDefault(TransactionController tc, String key, Serializable value) throws StandardException - Throws:
StandardException
-
validateApplyAndMap
private Serializable validateApplyAndMap(TransactionController tc, String key, Serializable value, boolean dbOnlyProperty) throws StandardException - Throws:
StandardException
-
map
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
- Throws:
StandardException
-
validate
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
- Throws:
StandardException
-
bootPasswordChange
private boolean bootPasswordChange(TransactionController tc, String key, Serializable value) throws StandardException - Throws:
StandardException
-
setProperty
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
- The transaction to do the Conglomerate work under.key
- The key used to lookup this property.value
- The value to be associated with this key. If null, delete the property from the properties list.- Throws:
StandardException
- Standard exception policy.
-
readProperty
- Throws:
StandardException
-
getCachedProperty
private Serializable getCachedProperty(TransactionController tc, String key) throws StandardException - Throws:
StandardException
-
getCachedPropertyDefault
private Serializable getCachedPropertyDefault(TransactionController tc, String key, Dictionary dbProps) throws StandardException - Throws:
StandardException
-
getProperty
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
- The transaction to do the Conglomerate work under.key
- The "key" of the property that is being requested.- Returns:
- object The object associated with property key. n ull means no such key-value pair.
- Throws:
StandardException
- Standard exception policy.
-
getPropertyDefault
Get the default for a property.- Throws:
StandardException
- Standard exception policy.
-
copyValues
private <K,V> Dictionary<? super K,? super V> copyValues(Dictionary<? super K, ? super V> to, Dictionary<K, V> from, boolean stringsOnly) -
getProperties
Fetch the set of properties as a Properties object. This means that only keys that have String values will be included.- Throws:
StandardException
-
getProperties
public void getProperties(TransactionController tc, Dictionary<Object, Object> d, boolean stringsOnly, boolean defaultsOnly) throws StandardException- Throws:
StandardException
-
resetCache
void resetCache() -
readDbProperties
private Dictionary<String,Object> readDbProperties(TransactionController tc) throws StandardException Read the database properties and add in the service set.- Throws:
StandardException
-
getCachedDbProperties
private Dictionary<String,Object> getCachedDbProperties(TransactionController tc) throws StandardException - Throws:
StandardException
-
lockProperties
Lock the database properties for an update.- Throws:
StandardException
-
iHoldTheUpdateLock
Return true if the caller holds the exclusive update lock on the property conglomerate.- Throws:
StandardException
-
findServiceModule
private static Object findServiceModule(Object serviceModule, String factoryInterface) throws StandardException Privileged startup. Must be private so that user code can't call this entry point.- Throws:
StandardException
-