示例:通用事件接口
此接口用于处理通用审计事件。可以定义对此接口进行扩展的其他接口,以处理特定审计事件组,如安全性事件、事务事件或其他定制组。对于 WebSphere® Application Server V7.0,仅支持安全性类型的事件。
通用事件接口
可能会开发特定实现来处理特定内部格式的数据。调用 buildEvent() 方法时,该实现必须使用它已存储的内部信息构建指定的基本事件类型。信息存储到 GenericEvent 实例中之后,GenericEvent 接口将提供处理事件的通用方式。
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;
}