Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.impl.store.access
Class PropertyConglomerate  view PropertyConglomerate download PropertyConglomerate.java

java.lang.Object
  extended byorg.apache.derby.impl.store.access.PropertyConglomerate

class PropertyConglomerate
extends java.lang.Object

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
private  CacheLock cachedLock
           
private  java.util.Dictionary cachedSet
           
private  org.apache.derby.iapi.services.locks.LockFactory lf
           
private  org.apache.derby.iapi.services.property.PropertyFactory pf
           
protected  long propertiesConglomId
           
protected  java.util.Properties serviceProperties
           
 
Constructor Summary
(package private) PropertyConglomerate(org.apache.derby.iapi.store.access.TransactionController tc, boolean create, java.util.Properties serviceProperties, org.apache.derby.iapi.services.property.PropertyFactory pf)
           
 
Method Summary
private  boolean bootPasswordChange(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key, java.io.Serializable value)
           
private  java.util.Dictionary copyValues(java.util.Dictionary to, java.util.Dictionary from, boolean stringsOnly)
           
private  java.util.Dictionary getCachedDbProperties(org.apache.derby.iapi.store.access.TransactionController tc)
           
private  java.io.Serializable getCachedProperty(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key)
           
private  java.io.Serializable getCachedPropertyDefault(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key, java.util.Dictionary dbProps)
           
(package private)  java.util.Properties getProperties(org.apache.derby.iapi.store.access.TransactionController tc)
          Fetch the set of properties as a Properties object.
 void getProperties(org.apache.derby.iapi.store.access.TransactionController tc, java.util.Dictionary d, boolean stringsOnly, boolean defaultsOnly)
           
(package private)  java.io.Serializable getProperty(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key)
          Gets the de-serialized object associated with a property key.
(package private)  java.io.Serializable getPropertyDefault(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key)
          Get the default for a property.
private  boolean iHoldTheUpdateLock(org.apache.derby.iapi.store.access.TransactionController tc)
          Return true if the caller holds the exclusive update lock on the property conglomerate.
(package private)  void lockProperties(org.apache.derby.iapi.store.access.TransactionController tc)
          Lock the database properties for an update.
private  org.apache.derby.iapi.types.DataValueDescriptor[] makeNewTemplate()
          Create a new empty PropertyConglomerate row, to fetch values into.
private  org.apache.derby.iapi.types.DataValueDescriptor[] makeNewTemplate(java.lang.String key, java.io.Serializable value)
          Create a new PropertyConglomerate row, with values in it.
private  java.io.Serializable map(java.lang.String key, java.io.Serializable value, java.util.Dictionary set)
          Call the property set callbacks to map a proposed property value to a value to save.
private  org.apache.derby.iapi.store.access.ScanController openScan(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key, int open_mode)
          Open a scan on the properties conglomerate looking for "key".
(package private)  boolean propertyDefaultIsVisible(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key)
           
private  java.util.Dictionary readDbProperties(org.apache.derby.iapi.store.access.TransactionController tc)
          Read the database properties and add in the service set.
private  java.io.Serializable readProperty(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key)
           
(package private)  void resetCache()
           
(package private)  void saveProperty(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key, java.io.Serializable value)
           
(package private)  void savePropertyDefault(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key, java.io.Serializable value)
           
private  boolean saveServiceProperty(java.lang.String key, java.io.Serializable value)
           
(package private)  void setProperty(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key, java.io.Serializable value, boolean dbOnlyProperty)
          Sets the Serializable object associated with a property key.
(package private)  void setPropertyDefault(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key, java.io.Serializable value)
          Set the default for a property.
private  void validate(java.lang.String key, java.io.Serializable value, java.util.Dictionary set)
          Call the property set callbacks to validate a property change against the property set provided.
private  java.io.Serializable validateApplyAndMap(org.apache.derby.iapi.store.access.TransactionController tc, java.lang.String key, java.io.Serializable value, boolean dbOnlyProperty)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertiesConglomId

protected long propertiesConglomId

serviceProperties

protected java.util.Properties serviceProperties

lf

private org.apache.derby.iapi.services.locks.LockFactory lf

cachedSet

private java.util.Dictionary cachedSet

cachedLock

private CacheLock cachedLock

pf

private org.apache.derby.iapi.services.property.PropertyFactory pf
Constructor Detail

PropertyConglomerate

PropertyConglomerate(org.apache.derby.iapi.store.access.TransactionController tc,
                     boolean create,
                     java.util.Properties serviceProperties,
                     org.apache.derby.iapi.services.property.PropertyFactory pf)
               throws org.apache.derby.iapi.error.StandardException
Method Detail

makeNewTemplate

private org.apache.derby.iapi.types.DataValueDescriptor[] makeNewTemplate(java.lang.String key,
                                                                          java.io.Serializable value)
Create a new PropertyConglomerate row, with values in it.


makeNewTemplate

private org.apache.derby.iapi.types.DataValueDescriptor[] makeNewTemplate()
Create a new empty PropertyConglomerate row, to fetch values into.


openScan

private org.apache.derby.iapi.store.access.ScanController openScan(org.apache.derby.iapi.store.access.TransactionController tc,
                                                                   java.lang.String key,
                                                                   int open_mode)
                                                            throws org.apache.derby.iapi.error.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.


setPropertyDefault

void setPropertyDefault(org.apache.derby.iapi.store.access.TransactionController tc,
                        java.lang.String key,
                        java.io.Serializable value)
                  throws org.apache.derby.iapi.error.StandardException
Set the default for a property.


propertyDefaultIsVisible

boolean propertyDefaultIsVisible(org.apache.derby.iapi.store.access.TransactionController tc,
                                 java.lang.String key)
                           throws org.apache.derby.iapi.error.StandardException

saveProperty

void saveProperty(org.apache.derby.iapi.store.access.TransactionController tc,
                  java.lang.String key,
                  java.io.Serializable value)
            throws org.apache.derby.iapi.error.StandardException

saveServiceProperty

private boolean saveServiceProperty(java.lang.String key,
                                    java.io.Serializable value)

savePropertyDefault

void savePropertyDefault(org.apache.derby.iapi.store.access.TransactionController tc,
                         java.lang.String key,
                         java.io.Serializable value)
                   throws org.apache.derby.iapi.error.StandardException

validateApplyAndMap

private java.io.Serializable validateApplyAndMap(org.apache.derby.iapi.store.access.TransactionController tc,
                                                 java.lang.String key,
                                                 java.io.Serializable value,
                                                 boolean dbOnlyProperty)
                                          throws org.apache.derby.iapi.error.StandardException

map

private java.io.Serializable map(java.lang.String key,
                                 java.io.Serializable value,
                                 java.util.Dictionary set)
                          throws org.apache.derby.iapi.error.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


validate

private void validate(java.lang.String key,
                      java.io.Serializable value,
                      java.util.Dictionary set)
               throws org.apache.derby.iapi.error.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


bootPasswordChange

private boolean bootPasswordChange(org.apache.derby.iapi.store.access.TransactionController tc,
                                   java.lang.String key,
                                   java.io.Serializable value)
                            throws org.apache.derby.iapi.error.StandardException

setProperty

void setProperty(org.apache.derby.iapi.store.access.TransactionController tc,
                 java.lang.String key,
                 java.io.Serializable value,
                 boolean dbOnlyProperty)
           throws org.apache.derby.iapi.error.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.


readProperty

private java.io.Serializable readProperty(org.apache.derby.iapi.store.access.TransactionController tc,
                                          java.lang.String key)
                                   throws org.apache.derby.iapi.error.StandardException

getCachedProperty

private java.io.Serializable getCachedProperty(org.apache.derby.iapi.store.access.TransactionController tc,
                                               java.lang.String key)
                                        throws org.apache.derby.iapi.error.StandardException

getCachedPropertyDefault

private java.io.Serializable getCachedPropertyDefault(org.apache.derby.iapi.store.access.TransactionController tc,
                                                      java.lang.String key,
                                                      java.util.Dictionary dbProps)
                                               throws org.apache.derby.iapi.error.StandardException

getProperty

java.io.Serializable getProperty(org.apache.derby.iapi.store.access.TransactionController tc,
                                 java.lang.String key)
                           throws org.apache.derby.iapi.error.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.


getPropertyDefault

java.io.Serializable getPropertyDefault(org.apache.derby.iapi.store.access.TransactionController tc,
                                        java.lang.String key)
                                  throws org.apache.derby.iapi.error.StandardException
Get the default for a property.


copyValues

private java.util.Dictionary copyValues(java.util.Dictionary to,
                                        java.util.Dictionary from,
                                        boolean stringsOnly)

getProperties

java.util.Properties getProperties(org.apache.derby.iapi.store.access.TransactionController tc)
                             throws org.apache.derby.iapi.error.StandardException
Fetch the set of properties as a Properties object. This means that only keys that have String values will be included.


getProperties

public void getProperties(org.apache.derby.iapi.store.access.TransactionController tc,
                          java.util.Dictionary d,
                          boolean stringsOnly,
                          boolean defaultsOnly)
                   throws org.apache.derby.iapi.error.StandardException

resetCache

void resetCache()

readDbProperties

private java.util.Dictionary readDbProperties(org.apache.derby.iapi.store.access.TransactionController tc)
                                       throws org.apache.derby.iapi.error.StandardException
Read the database properties and add in the service set.


getCachedDbProperties

private java.util.Dictionary getCachedDbProperties(org.apache.derby.iapi.store.access.TransactionController tc)
                                            throws org.apache.derby.iapi.error.StandardException

lockProperties

void lockProperties(org.apache.derby.iapi.store.access.TransactionController tc)
              throws org.apache.derby.iapi.error.StandardException
Lock the database properties for an update.


iHoldTheUpdateLock

private boolean iHoldTheUpdateLock(org.apache.derby.iapi.store.access.TransactionController tc)
                            throws org.apache.derby.iapi.error.StandardException
Return true if the caller holds the exclusive update lock on the property conglomerate.