public class ExceptionDatagramFactory
extends com.streamscape.sdo.IAbstractDatagramFactory
Title: Structured Data Objects
Description: A datagram factory for ExceptionEventDatagram
objects.
Exception event objects are special types of events that are based on the Java Exception
class.
The event fabric allows components to raise exceptions and process them is a global fashion. Exception eventgrams
may be treated like regular Throwable
entities as they inherit from Exception
and
may wrap other Throwable
entities.
Exceptions may be raised by components and processed by Exception Handler Callbacks
that can catch exceptions
from any component in the event fabric. Event selectors
may further be used to filter and query
exceptions by their content allowing participants to perform distributed system debugging and analysis.
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
DEFAULT_SERIAL_VERSION_ID
Modifier and Type | Method and Description |
---|---|
ExceptionEventDatagram |
createEvent(Prototype prototype)
Create and returns an event datagram object of a specific type based on the
Prototype . |
ExceptionEventDatagram |
createEvent(java.lang.String eventId)
Creates an event datagram object using the specified Event Id.
|
ExceptionEventDatagram |
createEvent(java.lang.String eventId,
ImmutableEventDatagram sourceEvent)
Creates an exception datagram object using the specified Event Id.
|
static ExceptionDatagramFactory |
getInstance() |
void |
initSerializer(SerializerFactory factory,
java.lang.String serializerName)
Allows for initialization of a user-defined serializer (and factory) with this datagram's
semantic types and aliases.
|
ExceptionEventDatagram |
newEventInstance(SemanticType type)
Creates and returns an instance of an event datagram of this factory's type
based on the semantic type.
|
ExceptionEventDatagram |
newEventInstance(java.lang.String semanticType)
Creates an event instance based on the specified semantic type.
|
ExceptionEventDatagram |
newEventInstanceFrom(ImmutableEventDatagram event)
Creates an event instance using the specified event.
|
ExceptionEventDatagram |
newEventInstanceFrom(java.lang.String eventId)
Creates an event instance using the specified Event Id.
|
existsPrototype, getAncestorType, getCipherSuite, getName, getPrototypeNamespace, getSemanticType, getSerialVersionUID, getSupportedTypes, listEventIds, listPrototypeModels, setCipherSuiteName, supportsModel
getContext, getContextType, hasContext
clone
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clone
public void initSerializer(SerializerFactory factory, java.lang.String serializerName) throws com.streamscape.omf.SerializerSupportException
factory
- SerializerFactoryserializerName
- Stringcom.streamscape.omf.SerializerSupportException
public static ExceptionDatagramFactory getInstance()
public ExceptionEventDatagram createEvent(Prototype prototype) throws DatagramFactoryException
DatagramFactory
Prototype
.
Exact behavior of this method is implementation specific. This method throws an exception
if the prototype does not exist in the prototype cache.
Prototypes allow users to create pre-populated datagrams that may hold default values. This
is particularly useful in situations where a data event may have a specific, user
defined payload as it's data element. Such data elements may be pre-populated and
annotations on such elements may be pre-defined in the prototype. The resulting prototype,
while considered an instance of a data event would act as a discrete type and have
a discrete Event Id
.
In general it is expected that creating an event from a prototype results in partial
or full cloning of the prototype object. It should be noted that general cloning of simple
prototypes (shell objects) may be comparable in performance to normal instantiation.
The framework will attempt a general optimization which may not be sufficient for complex
types. For this reason, given the possible performance impact of cloning, developers may
optimize this method by implementing partial cloning or other optimizations.
See the DatagramFactory.newEventInstance(com.streamscape.repository.types.SemanticType)
documentation for a comparison of these methods.
createEvent
in interface DatagramFactory
createEvent
in class com.streamscape.sdo.IAbstractDatagramFactory
prototype
- the Prototype
object associated with the event.DatagramFactoryException
- if some error occurs.public ExceptionEventDatagram createEvent(java.lang.String eventId) throws DatagramFactoryException
DatagramFactory
DatagramFactory.createEvent(com.streamscape.repository.types.Prototype)
for further information.createEvent
in interface DatagramFactory
createEvent
in class com.streamscape.sdo.IAbstractDatagramFactory
eventId
- the unique identifier of the event.DatagramFactoryException
- if some error occurs.public ExceptionEventDatagram createEvent(java.lang.String eventId, ImmutableEventDatagram sourceEvent) throws DatagramFactoryException
ImmutableEventDatagram.getEventSource()
)
will be set to an event sink of the created datagram (see ExceptionEventDatagram.getEventSink()
).
See createEvent(String)
for further information.
eventId
- the unique identifier of the created event.sourceEvent
- the source event for the created event.DatagramFactoryException
- if some error occurs during this operation execution.public ExceptionEventDatagram newEventInstance(SemanticType type) throws DatagramFactoryException
DatagramFactory
null
Event Id, intending for users to
assign the identifier by registering the datagram as a prototype.
EventDatagram
types are the following:
AcknowledgementEvent
AuditEvent
BytesEvent
DataEvent
DeltaEvent
ExceptionEvent
FileEvent
MailEvent
MapEvent
RowArrayEvent
RowChangeEvent
RowEvent
RowSetEvent
StreamEvent
StreamStateEvent
TextEvent
XMLEvent
MapEvent
OpaqueDatagram
types are the following:
OpaqueEvent
AdvisoryEventDatagram
types are the following:
AdvisoryEvent
IAbstractDataEvent
which is the core datagram implementation. This allows for creation of other model (level 1)
event types. Each model type is registered as a unique Semantic Type and the
method will directly instantiate such a type, which is typically faster than using the
DatagramFactory.createEvent(com.streamscape.repository.types.Prototype)
method. That method uses prototype cloning to create a new datagram
instance, however it generates pre-populated instances.
Optimization: In general it is expected that directly creating an instance and populating
it's values will be faster then creating an instance from a prototype. However, in case of
the DataEvent
some optimization is possible. Data events mandate that all encapsulated
objects (data elements) are known Semantic Types. The data event therefore uses
optimized object creation. Datagram header properties, annotations and user-defined fields
are copied from the prototype, however the payload (data elements) may be instantiated directly
resulting in faster object creation. This technique may be used by developers designing their
own datagram factories in order to employ a mixed mode instantiation. By creating a discrete
payload with specific defaults registered as a Semantic Type event object
instantiation may be optimized.
As with any advanced performance tuning careful profiling should be performed so that a developer not engage in so called 'premature optimization'. Prototype cloning is an extremely fast way to instantiate objects and in most cases, direct instance creation may not be necessary.
newEventInstance
in interface DatagramFactory
newEventInstance
in class com.streamscape.sdo.IAbstractDatagramFactory
type
- the semantic type that the created event is based on.DatagramFactoryException
- if some error occurs.public ExceptionEventDatagram newEventInstance(java.lang.String semanticType) throws DatagramFactoryException
DatagramFactory
DatagramFactory.newEventInstance(com.streamscape.repository.types.SemanticType)
for further information.newEventInstance
in interface DatagramFactory
newEventInstance
in class com.streamscape.sdo.IAbstractDatagramFactory
semanticType
- the semantic type that the created event is based on.DatagramFactoryException
- if some error occurs.public ExceptionEventDatagram newEventInstanceFrom(java.lang.String eventId) throws DatagramFactoryException
DatagramFactory
DatagramFactory.createEvent(String)
method,
but the created event will have a null
event id.
Then this event instance can be used for a creation of new event prototypes, but cannot be raised.newEventInstanceFrom
in interface DatagramFactory
newEventInstanceFrom
in class com.streamscape.sdo.IAbstractDatagramFactory
DatagramFactoryException
- if some error occurs.public ExceptionEventDatagram newEventInstanceFrom(ImmutableEventDatagram event) throws DatagramFactoryException
DatagramFactory
null
event id.
Then this event instance can be used for a creation of new event prototypes, but cannot be raised.newEventInstanceFrom
in interface DatagramFactory
newEventInstanceFrom
in class com.streamscape.sdo.IAbstractDatagramFactory
DatagramFactoryException
- if some error occurs.Copyright © 2015-2024 StreamScape Technologies. All rights reserved.