ClassificationPolicy
The ClassificationPolicy is used to translate a String AccountingProperty into a reference to a separate database table (a classification table). This is most useful for data like:
- Queue names
- User names
- Group names
That come from a finite set of values. Storing these as references to a separate table of values reduces the size of the database. More importantly additional fields can be added to these classification tables to allow additional information to be inferred. For example if a classification table is used to store username data then an additional field can be added to identify the department the user comes from.
This policy is implemented by the uk.ac.ed.epcc.safe.accounting.policy.ClassificationPolicy class.
The policy will map a string property to a table reference where a Java property of the form classification.[table-name].[string-property-name]=[remote-table-name] is defined.
This will generate a new ReferenceProperty named after the remote table. The handler class for the remote table needs to be a sub-class of ClassificationFactory. Normally this should be the AccountingClassificationFactory class as this also supports evaluation of PropExpressions. This handler can selected by setting the following Java property:
class.[remote-table-name]=uk.ac.ed.epcc.safe.accounting.db.AccountingClassificationFactory
If the underlying database table contains a field matching the original string property then the string property will be mapped to that field. Otherwise a derived property will be used to generate the value on demand from the classification table.
The handler classes for the Person and Machine tables implement ClassificationFactory so this policy can be used to link to these tables if appropriate.