Example: Generic Event Interface


This interface is used for processing generic audit events. Other interfaces can be defined which extend this interface to process specific audit event groupings, such as security events, transaction events, or other custom groupings. For WAS version 7.0, only security types of events are supported.

 

Generic Event Interface

Specific implementations might be developed to handle the data in a particular internal format. When the buildEvent() method is called, the implementation must then build the specified base event type using the internal information it has stored. After the information has been stored into a GenericEvent instance, the GenericEvent interface provides a generic way of handling the event.

public interface GenericEvent {

   /** * Property name used to specify the base event type to the 
  * {@link GenericEvent#buildEvent} method. 
  */  public static final String BASE_EVENT_TYPE = GenericEvent.class.getName() + ".baseEventType"; 

/** 
* Returns the eventType of the event. The eventType distinguishes between these 
* related events. 
* The eventType depends on the particular implementation 
* of the GenericEvent. For example, the Security Event implmentation has 
* eventTypes such as SECURITY_AUTHN and SECURITY_AUTHZ. 
* @return eventType - the eventType of the event 
*/ 
 public String getEventType(); 
/** 
* Returns the creationTime, the creation time of the event. 
* @return creationTime - the creation time of the event 
*/ public Date getCreationTime(); /** * Returns the version, the version of the event. 
* @return version - the version of the event 
*/ 
 public String getVersion (Properties props) throws GenericEventConfigurationException; 
/** 
* Returns the globalInstanceId, which is a globally unique instance 
* identifier for the event. 
* @return globalInstanceId - a globally unique instance identifier for the event 
*/
 public Long getGlobalInstanceId(); 
/** 
* Verifies whether the event is valid; which depends on the particular 
* implementation of the GenericEvent. If the event is not valid, an 
* GenericEventValidationException error occurs. 
*/
 public void validate() throws GenericEventValidationException;
 /** 
* Returns the internally wrapped base event instance after 
* completing and validating the current instance of the GenericEvent. 
* An GenericEvent implementation can maintain its information 
* in any undisclosed internal format. The buildEvent() 
* method that specifies that a specific base event type be built 
* using the internal information. This allows GenericEvent implementations 
* to support multiple base event formats. Thus the GenericEvent implmentation 
* provides a layer of abstraction higher than the base event type. 
* @param properties The value of the property BASE_EVENT_TYPE 
* defines the type of the base event * @return the internally wrapped base event instance 
* @throws GenericEventConfigurationException if the base event type is invalid 
* or the JAR files to support that event type are not available. 
* @throws GenericEventCompletionException if event completion has failed. 
* @throws GenericEventValidationException if the validation has failed. This is 
* validation as is performed by the validate() method. 
*/
 public Object buildEvent(Properties properties) 
    throws GenericEventConfigurationException, 
            GenericEventValidationException,             GenericEventCompletionException; 
/** 
* Returns the wrapped base event instance as a string after 
* completing and validating the current instance of the GenericEvent. 
* An GenericEvent implementation can maintain its information 
* in any undisclosed internal format. It is the buildEventString() 
* method that specifies that a specific base event type be built 
* using the internal information. This allows GenericEvent implementations 
* to support multiple base event formats. Thus the GenericEvent implmentation
* provides a layer of abstraction higher than the base event type. 
* @param properties The value of the property BASE_EVENT_TYPE 
* defines the type of the base event 
* @return the wrapped base event instance as a String 
* @throws GenericEventConfigurationException if the base event type is invalid 
* or the JAR files to support that event type are not available. 
* @throws GenericEventCompletionException if event completion has failed. 
* @throws GenericEventValidationException if the validation has failed. This is 
* validation as is performed by the validate() method. 
*/ 
 public String buildEventString(Properties properties) 
    throws GenericEventConfigurationException, 
            GenericEventValidationException, 
            GenericEventCompletionException; 
}




 

Related tasks


Create security auditing event type filters