Package gnu.cajo.utils.extra
Class AuditorItem
java.lang.Object
gnu.cajo.utils.extra.AuditorItem
- All Implemented Interfaces:
Invoke
,Serializable
,Remote
This class is used to transparently pre and post-pend audit functionality
to any given object reference. It is typically used to check the integrity
of the invocation arguments, or the authenticity of the invoking object.
Likewise, it can review the invocation results, to augment, or delete
certain components. The wrapped object is unaware, and need not be
changed, to assist in this functionality. It can be used on local objects,
for which the code is available, as easily as on remote object references,
for which no code is available. It is ideal for use in debug, and
development activities, as well as for security, in production
environments. The technique is essentially an implementation of the
Decorator design pattern.
- Version:
- 1.0, 19-Sep-04 Initial release
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAuditorItem
(Object item, Object auditor) This creates the object, to audit the target object's use. -
Method Summary
-
Field Details
-
auditor
The auditor object. This object's preprocess method will be invoked with the arguments to be provided to the audited object. It has the three options:- Change the arguments
- Approve the arguments, as is
- Reject the invocation, by throwing an Exception.
-
item
This is the object to be audited. Since it has no knowlege of the audit it's structure need not be changed in any way to accomodate it. It is declared as public to allow the reference of the AuditorItem, and its wrapped object, from a single instance of AuditorItem.
-
-
Constructor Details
-
AuditorItem
This creates the object, to audit the target object's use. The class in not declared final, to allow no-arg auditing items to be easily created.- Parameters:
item
- The object to receive the client invocation. It can be local, remote, or even a proxy.auditor
- The object to receive the calls prior to, and following the audited item's operation. It can be local, remote, or even a proxy.
-
-
Method Details
-
invoke
This method audits the incoming calls. If the auditor approves, or change the supplied arguments, they will be passed into the audited item for processing. The auditor will again review the returned data, or exception, and will likewise approve or change it. Note: this method can be called reentrantly. Also, if the audited item invocation results in an exception, and the auditor approves, it can simply return the exception, and the wrapper will throw it automatically.
-