CMP Managed Audit FieldsCMP has the ability to automatically update certain columns in the database when create or update operations are performed. These can be used to implement a basic auditing strategy (but should not be considered a full-function auditing mechanism). The column updated may be exposed as cmp-fields to the EJB but do not need to be. CMP can automatically generate values for:
Which of these fields are used is defined in jbosscmp-jdbc.xml using an User who Created a RecordWhen CMP creates a record in the database, it can be configured to automatically populate a column with the name of the Principal who called ejbCreate. This requires that a valid identity is associated with the call, which requires that the EJB is associated with a security-domain. The value inserted into the database is the same as the name of the Principal returned by EJBContext.getCallerPrincipal().
The field-name element is optional and defaults to "audit_created_by". If the field-name matches a defined cmp-field's name, then the accessors for that field can be used to read and write the audit value; to disable write access and have the field only updated by CMP, designate it as read-only. If no cmp-field is defined in ejb-jar.xml with the same name then a hidden field is created. The column-name element is optional and defaults to the field-name. Time a Record was createdWhen CMP creates a record in the database, it can be configured to automatically populate a column with the current date and time (as returned by System.currentTimeMillis()).
The field-name element is optional and defaults to "audit_created_time". If the field-name matches a defined cmp-field's name, then the accessors for that field can be used to read and write the audit value; to disable write access and have the field only updated by CMP, designate it as read-only. If no cmp-field is defined in ejb-jar.xml with the same name then a hidden field is created. The column-name element is optional and defaults to the field-name. User who Last Updated a RecordWhen CMP updates a record in the database, it can be configured to automatically populate a column with the name of the Principal who last invoked an operation on the EJB. This requires that a valid identity is associated with the call, which requires that the EJB is associated with a security-domain. The value inserted into the database is the same as the name of the Principal returned by EJBContext.getCallerPrincipal(). If multiple users invoked business methods (for example, through re-authentication or run-as configuation) the last one will be used.
The field-name element is optional and defaults to "audit_updated_by". If the field-name matches a defined cmp-field's name, then the accessors for that field can be used to read and write the audit value; to disable write access and have the field only updated by CMP, designate it as read-only. If no cmp-field is defined in ejb-jar.xml with the same name then a hidden field is created. The column-name element is optional and defaults to the field-name. Time a Record was Last UpdatedWhen CMP updates a record in the database, it can be configured to automatically populate a column with the current date and time (as returned by System.currentTimeMillis()). This will be at the time the record is stored to the database, not the time at which a business method actually modified the data.
The field-name element is optional and defaults to "audit_created_time". If the field-name matches a defined cmp-field's name, then the accessors for that field can be used to read and write the audit value; to disable write access and have the field only updated by CMP, designate it as read-only. If no cmp-field is defined in ejb-jar.xml with the same name then a hidden field is created. The column-name element is optional and defaults to the field-name.
|
|
|||||
© 2003 Core Developers Network Ltd "Core Developers Network", the stylized apple logo and "Core Associates" are trademarks of Core Developers Network Ltd. All other trademarks are held by their respective owners. Core Developers Network Ltd is not affiliated with any of the respective trademark owners. |