org.obe.spi.event
Class ApplicationEvent

java.lang.Object
  extended byjava.util.EventObject
      extended byorg.obe.spi.event.ApplicationEvent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
WorkflowEvent

public class ApplicationEvent
extends java.util.EventObject

Delivers an external event from a third party application or source. This is OBE's primary asynchronous integration mechanism.

Author:
Adrian Price
See Also:
ApplicationEventBroker, ApplicationEventListener, Serialized Form

Field Summary
static java.lang.String ACTION
           
static java.lang.String CONTENT_TYPE
           
protected static java.io.Serializable[] EMPTY_KEYS
           
protected static java.util.Map EMPTY_MAP
           
static java.lang.String EXCEPTION_EVENT
           
static java.lang.String SCHEMA
           
static java.lang.String TIMEOUT_EVENT
           
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ApplicationEvent(java.lang.Object applicationContext, java.lang.Object source, java.lang.String eventType, java.io.Serializable[] keys, java.lang.String contentType, java.lang.String schema, java.util.Map properties, java.util.Date expiration)
          Constructs an application event object.
ApplicationEvent(java.lang.Object source, java.lang.String contentType, java.lang.String schema, java.util.Map properties)
          Constructs an application event object.
 
Method Summary
 java.lang.String getAction()
          Returns the name of the JAF command which raised this event.
 java.lang.Object getApplication()
          Returns the application context.
 java.lang.String getContentType()
          Returns the MIME content type of the event data.
 java.lang.String getEventType()
          Returns the business name for the application event.
 java.util.Date getExpiry()
          Returns the expiry date for the event.
 java.io.Serializable[] getKeys()
          Returns the key values for the payload.
 java.util.Map getProperties()
          Returns a map of all custom attributes associated with the payload.
 java.lang.Object getProperty(java.lang.String key)
          Returns a custom attribute associated with the payload.
 java.lang.String getSchema()
          The name of the abstract schema for the payload (the source object).
 void setApplication(java.lang.Object application)
          Sets the application context.
 void setEventType(java.lang.String eventType)
          Sets the event type.
 void setExpiry(java.util.Date expiry)
          Sets the expiry date for the event.
 void setKeys(java.io.Serializable[] keys)
          Sets the keys for the payload.
 java.lang.String toString()
           
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONTENT_TYPE

public static final java.lang.String CONTENT_TYPE
See Also:
Constant Field Values

SCHEMA

public static final java.lang.String SCHEMA
See Also:
Constant Field Values

ACTION

public static final java.lang.String ACTION
See Also:
Constant Field Values

TIMEOUT_EVENT

public static final java.lang.String TIMEOUT_EVENT
See Also:
Constant Field Values

EXCEPTION_EVENT

public static final java.lang.String EXCEPTION_EVENT
See Also:
Constant Field Values

EMPTY_MAP

protected static final java.util.Map EMPTY_MAP

EMPTY_KEYS

protected static final java.io.Serializable[] EMPTY_KEYS
Constructor Detail

ApplicationEvent

public ApplicationEvent(java.lang.Object source,
                        java.lang.String contentType,
                        java.lang.String schema,
                        java.util.Map properties)
Constructs an application event object.

Parameters:
source - The source object on which the event occurred.
contentType - The MIME content type of the source object. Cannot be null.
schema - The schema for the source object. Cannot be null.
properties - Additional properties describing the event. Optional.

ApplicationEvent

public ApplicationEvent(java.lang.Object applicationContext,
                        java.lang.Object source,
                        java.lang.String eventType,
                        java.io.Serializable[] keys,
                        java.lang.String contentType,
                        java.lang.String schema,
                        java.util.Map properties,
                        java.util.Date expiration)
Constructs an application event object.

Parameters:
applicationContext - An arbitrary application context.
source - The source object on which the event occurred.
eventType - The event type, as registered in the ApplicationEventBroker. Cannot be null.
keys - The key values, calculated from the source object according to the definition for id.
contentType - The MIME content type of the source object. Cannot be null.
schema - The schema for the source object. Cannot be null.
properties - Additional properties describing the event.
expiration - The date/time at which this event expires: the system will remove the event from storage at that time. If null,
Method Detail

getAction

public java.lang.String getAction()
Returns the name of the JAF command which raised this event.

Returns:
JAF command name, null indicates the default command.

getContentType

public java.lang.String getContentType()
Returns the MIME content type of the event data. The content type indicates the type of object in the payload. For example, an XML document would have a content type of text/xml; an MS-Word document would be application/msword, a Java object would use the extension type application/x-java-object, and so on.

Returns:
The MIME content type.
See Also:
getSchema()

getEventType

public java.lang.String getEventType()
Returns the business name for the application event. This must have been registered in the application event broker by a prior call to ApplicationEventBroker.createEventType(org.obe.client.api.repository.EventTypeMetaData).

Returns:
The event type.

setEventType

public void setEventType(java.lang.String eventType)
Sets the event type.

Parameters:
eventType - Event type. Must be a valid business event type as registered in the ApplicationEventBroker.
Throws:
java.lang.IllegalArgumentException - if eventType is null.

getSchema

public java.lang.String getSchema()
The name of the abstract schema for the payload (the source object). The interpretation depends on the content type. For example, the schema for a content type of text/xml would be the URI of the schema location or the Public or System ID of its DTD; if these are undefined, the tag name of the document element. The schema for a Java object is simply its fully qualified class name, or possibly the name of an interface that it implements.

Returns:
The abstract schema name.
See Also:
getContentType()

getKeys

public java.io.Serializable[] getKeys()
Returns the key values for the payload. The application event broker calculates the key values from the payload by evaluating the key value expressions in the event type definition.

Returns:
Key values for the payload.

setKeys

public void setKeys(java.io.Serializable[] keys)
Sets the keys for the payload.

Parameters:
keys - Event keys.

getProperty

public java.lang.Object getProperty(java.lang.String key)
Returns a custom attribute associated with the payload. Custom attributes provide additional metadata about the payload.

Parameters:
key - The attribute name.
Returns:
The attribute value, if defined.

getProperties

public java.util.Map getProperties()
Returns a map of all custom attributes associated with the payload.

Returns:
Attribute map, keyed on attribute name.
See Also:
getProperty(java.lang.String)

getApplication

public java.lang.Object getApplication()
Returns the application context. This object is accessible through the EngineContext.getApplication() method.

Returns:
Application context.

setApplication

public void setApplication(java.lang.Object application)
Sets the application context.

Parameters:
application - The application context.

getExpiry

public java.util.Date getExpiry()
Returns the expiry date for the event.

Returns:
The expiry date.

setExpiry

public void setExpiry(java.util.Date expiry)
Sets the expiry date for the event.

Parameters:
expiry - Expiry date or null if the event should not be stored for subsequent consumption.

toString

public java.lang.String toString()


SourceForge.net Logo OBE-1.0 Copyright (c) 2002-2006 Adrian Price. All Rights Reserved.