|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bea.security.NamedObject | +--com.bea.security.AuditRecord | +--com.bea.security.ContextAuditRecord
This class allows applications to log events to the audit provider extracting name elements from the event's application context. The naming authority used with these events
must be based upon the AUDITBASE
naming format. The AUDITBASE
naming convention is defined as "TYPE/SEVERITY/MESSAGE"
The simplest way to use this class is to add a MULTI_VALUE_PREFIX attribute referencing the "AUDITBASE" naming authority as the first attribute in your own name. For example:
<AuthorityDefinition name="CUSTOMRECORD" delimiters=":"> <Attribute name="auditbase" type="MULTI_VALUE_PREFIX" authority="AUDITBASE" /> <Attribute name="sessionid" type="SINGLE_VALUE_PREFIX" /> <Attribute name="location" type="SINGLE_VALUE_TERMINAL" /> </AuthorityDefinition>
In addition to providing naming services to the audit message, this class uses the application context to populate the message with values according to the formats associated with
java.text.MessageFormat
. Simply include the field numbers in your message remembering that field {0} will always be the auditbase containing type, severity, and message
In the above example, passing in a message of Session failed for session {1} in {2}
with a severity of FAILURE
and an authority of CUSTOMRECORD
and a
context that contains
the elements sessionid
and location
would result in an audit record
that contains
the following name/value pairs: type=CUSTOMRECORD, severity=FAILURE,
message=Session Failed for session #124524 in Boston, sessionid=#124524, location=Boston
.
Calling toString()
on this audit record will produce a string of:
CUSTOMRECORD/FAILURE/Session Failed for session #124524 in Boston
.
Field Summary | |
protected java.lang.String |
computedMessage
The computed message associated with this audit record. |
protected java.util.Vector |
myKeys
A reference to the vector of key names for this audit record. |
protected java.util.Vector |
myValues
A reference to the vector of values for this audit record. |
protected boolean |
requiresCalc
Indicates if this object needs to recalculate the message format |
Fields inherited from class com.bea.security.AuditRecord |
AUDIT_FAILURE,
ERROR,
eventCtx,
evtMessage,
FAILURE,
identityMap,
INFORMATIONAL,
msgExc,
REQUESTOR_ALIAS,
severityCode,
SUCCESS,
WARNING |
Fields inherited from class com.bea.security.NamedObject |
deep,
nameAuth,
shallow |
Constructor Summary | |
ContextAuditRecord(java.lang.String authorityname,
int severity,
java.lang.Exception exc,
AppContext ctx)
Constructs an audit record with a message contained in an exception and with reference to an application context. |
|
ContextAuditRecord(java.lang.String authorityname,
int severity,
java.lang.String message,
AppContext ctx)
Constructs an audit record with a string message as a pattern and with reference to an application context. |
Method Summary | |
protected void |
reCalc()
Calculates the name/value pairs for this audit message if it requires recalculatoin. |
void |
setContext(AppContext context)
Adds an application context to this record. |
void |
setException(java.lang.Exception exc)
Sets an Exception object from which the audit message will be derived. |
void |
setSeverity(int severity)
Sets the severity level value associated with the ContextAuditRecord , from
which the Auditing provider can make the decision whether or not to audit. |
java.lang.String |
toString()
Returns this audit record as a string. |
Methods inherited from class com.bea.security.AuditRecord |
getContext,
getException,
getIdentity,
getIdentityAliases,
getMessage,
getSeverity,
setIdentity,
setMessage,
severityCodeToName,
severityNameToCode |
Methods inherited from class com.bea.security.NamedObject |
chop,
getAuthorityName,
getDeepEnumeration,
getEnumeration,
getID,
getNamingAuthority |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected boolean requiresCalc
protected java.util.Vector myKeys
protected java.util.Vector myValues
protected java.lang.String computedMessage
Constructor Detail |
public ContextAuditRecord(java.lang.String authorityname, int severity, java.lang.String message, AppContext ctx)
authorityname
- the name of the naming authority for this event record.severity
- the code for the severity of this record.ctx
- an application context to associate with this audit record.public ContextAuditRecord(java.lang.String authorityname, int severity, java.lang.Exception exc, AppContext ctx)
authorityname
- the name of the naming authority for this event record.severity
- the code for the severity of this record.ctx
- an application context to associate with this audit record.Method Detail |
public void setException(java.lang.Exception exc)
Exception
object from which the audit message will be derived.
exc
- an Exception
object containing additonal
information.public void setSeverity(int severity)
ContextAuditRecord
, from
which the Auditing provider can make the decision whether or not to audit.
severity
- a severity code as an int
public void setContext(AppContext context)
The audit record object will attempt to populate itself with key values from the context as determined by its naming authority's list of attributes.
context
- an AppContext
object containing application context for this record.public java.lang.String toString()
String
.protected void reCalc()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |