public class DataEvent extends com.streamscape.sdo.event.AbstractMutableEvent implements EventDatagram, PayloadEvent
Title: Structured Data Objects: Data Event
Description: A basic object that represents a Data Event.
A data event is a special type of Structured Data Object called an Event Datagram
, or simply
Eventgram. It implements the EventDatagram
interface and is the core object used for exchanging
events between Service Event Fabric components.
The datagram object is intended to be converted into a serialized data packet and sent over the network
using a messaging transport. The payload may be an arbitrary Java Object
or a Structured Data Object
that is set and retrieved by setData(java.lang.Object)
and getData()
methods respectably. Whatever the object that is
the payload of a data event, it must be registered as a known Semantic Type
by the runtime.
All Event Datagrams
provide a set of system header properties and allow users to add their own,
user defined properties. Additionally, users may export the data object's fields as datagram Annotations.
Annotations are auto-populated user-defined properties. Their content comes from the eventgram data object. The
annotation definitions are expressed as Structured Data Reference (SDR) Paths
that act as pointers to data elements.
Path syntax may be used in headers, or user-defined properties. When an event datagram is coalesced the properties
are populated with elements referenced by the path. Users are not required to perform any coding to populate the
property values when SDR paths are defined. The exchange
does all the work as it prepares an event to be
sent. The properties of an eventgram may be used by Event Selectors
to filter specific events that a
consumer subscribes to. Components that support event constraints, such as Event Tables
or Event Queues
as well as Event Triggers
can use such properties in their queries, allowing for event query and correlation
using SQL-like syntax. Annotations are typed according to the rules of the event property. They support defaults and do not
allows for null
values. Users may however check if a given property exists.
Annotations may work together with Event Prototypes
in order to assist in the creation of datagrams with
populated default values. A prototype is a template datagram that may be used to instantiate events that are pre-populated
with default values. Prototypes are persisted in the repository or the runtime cache and may be added to the configuration
using methods in the DatagramPrototypeFactory
.
A data event has the following system properties, some of which may be set by the user. Certain properties are set by the event dispatcher when the object is coalesced.
eventSource
- The fabric address of the component that generated the event. Set by the dispatcher.serialVersionUID
- The serial version unique identifier for this object. Hard-coded at object definition.eventId
- The event identifier (and Subject) that identifies this event type.eventKey
- A key that uniquely identifies this event instance.eventGroupId
- An identifier that may be used to group or sequence events.correlationId
- An identifier that may be used to correlate this event to another event or key.eventReplyTo
- An event identifier (and Subject) that may be used to raise a reply event.eventForwardTo
- An event identifier (and Subject) that may be used to forward an event.durable
- A flag that indicates whether the event is durable. Durable is a hint to persist or cache events.timeStamp
- The time stamp of when the event was raised to the dispatcher. Set by the dispatcher.principal
- The name of the user (principal) that was used to protect this event datagram.credential
- The credential (security key or password) that was used to protect this event datagram.AccessControl
- The access control object used to protect this event datagram. See AccessControl
Copyright: Copyright (c) 2011
Company: StreamScape Technologies
SEMANTIC_TYPE_NAME
DEFAULT_SERIAL_VERSION_ID
Modifier and Type | Method and Description |
---|---|
void |
checkPayloadClass(java.lang.Class payloadClass) |
boolean |
equals(java.lang.Object other) |
java.lang.Object |
getData()
Returns the event data.
|
java.lang.Class |
getPayloadClass()
Returns a class of the event payload.
|
boolean |
matchesPayloadClass(java.lang.Class dataClass,
java.lang.Class newDataClass) |
void |
setData(java.lang.Object newData)
Sets the specified data of this event.
|
addAnnotation, clearEventProperties, protect, removeAnnotation, removeEventProperty, resetReplyTo, setCorrelationId, setCorrelationIdAsBytes, setDurable, setEventBigDecimalProperty, setEventBigDecimalProperty, setEventBooleanProperty, setEventByteProperty, setEventDoubleProperty, setEventExpiration, setEventFloatProperty, setEventGroupId, setEventIntProperty, setEventKey, setEventLongProperty, setEventObjectProperty, setEventShortProperty, setEventStringProperty, setFinal, setForwardTo, setReplyTo, setSecurityAssertionToken, setSecurityAssertionTokenAsBytes, unprotect
canConvertEventProperty, clone, existsEventProperty, getAnnotatedProperties, getAnnotation, getCorrelationId, getCorrelationIdAsBytes, getDurable, getEventBigDecimalProperty, getEventBooleanProperty, getEventByteProperty, getEventDoubleProperty, getEventExpiration, getEventFloatProperty, getEventGroupId, getEventId, getEventIntProperty, getEventKey, getEventLongProperty, getEventObjectProperty, getEventPropertyNames, getEventPropertyType, getEventShortProperty, getEventSource, getEventStringProperty, getForwardTo, getPermissions, getReadAccess, getReplyTo, getSecurityAssertionToken, getSecurityAssertionTokenAsBytes, getTimestamp, getTransmitAccess, getWriteAccess, hasAnnotatedProperties, hasSuitableAnnotationType, isProtected
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAnnotation, canConvertEventProperty, clearEventProperties, existsEventProperty, getAnnotatedProperties, getAnnotation, getCorrelationId, getCorrelationIdAsBytes, getEventBigDecimalProperty, getEventBooleanProperty, getEventByteProperty, getEventDoubleProperty, getEventExpiration, getEventFloatProperty, getEventIntProperty, getEventLongProperty, getEventObjectProperty, getEventPropertyNames, getEventPropertyType, getEventShortProperty, getEventStringProperty, getForwardTo, getPermissions, getReadAccess, getReplyTo, getSecurityAssertionToken, getSecurityAssertionTokenAsBytes, getTransmitAccess, getWriteAccess, hasAnnotatedProperties, isProtected, protect, removeAnnotation, removeEventProperty, resetReplyTo, setCorrelationId, setCorrelationIdAsBytes, setDurable, setEventBigDecimalProperty, setEventBigDecimalProperty, setEventBooleanProperty, setEventByteProperty, setEventDoubleProperty, setEventExpiration, setEventFloatProperty, setEventGroupId, setEventIntProperty, setEventKey, setEventLongProperty, setEventObjectProperty, setEventShortProperty, setEventStringProperty, setFinal, setForwardTo, setReplyTo, setSecurityAssertionToken, setSecurityAssertionTokenAsBytes, unprotect
clone, getDurable, getEventGroupId, getEventId, getEventKey, getEventSource, getTimestamp
getSerialVersionUID
public void setData(java.lang.Object newData) throws SecurityViolationException, SDOException
newData
- the event data to be set.SDORuntimeException
- if the event is coalesced (locked for editing).SecurityViolationException
- if the event is protected from write access.SDOException
- if the specified newData
is null
or
if the specified data has wrong type.public void checkPayloadClass(java.lang.Class payloadClass) throws SDOException
SDOException
public java.lang.Class getPayloadClass()
getPayloadClass
in interface PayloadEvent
public java.lang.Object getData() throws SecurityViolationException, SDOException
For the event instance that is processed by an event listener, this method clones the data (for first time) before returning.
This is necessary to avoid changing the initial event instance (since there is no guarantee that user won't change a returned data).
In that case if the user wants to avoid overhead of data cloning he should inherit a data class from
CloneableDataObject
and override the method CloneableDataObject.clone()
if needed.
If the data class is not inherited from CloneableDataObject
the event data will be cloned
using 'serialization/deserialization' idiom.
SecurityViolationException
- if the event is protected from read access.SDOException
- if some internal error occurs.public boolean equals(java.lang.Object other)
equals
in class com.streamscape.sdo.IAbstractDataEvent
public boolean matchesPayloadClass(java.lang.Class dataClass, java.lang.Class newDataClass)
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.