public interface DatagramFactory extends StructuredDataObject
Title: Structured Data Objects
Description: This is the generic interface used by all event datagram factories.
This factory interface provides facilities for creating event datagram objects. Its descendants are factories that are specific to the event hierarchy:
EventDatagramFactory
- Used for working with application events.AdvisoryDatagramFactory
- Used for working with advisory events.ExceptionDatagramFactory
- Used for working with exception events.OpaqueDatagramFactory
- Used for working with lightweight opaque events.Management Framework
Interface
as a top-level manager factory for all factory types: DatagramFactoryManager
.
The factory manager allows users to lookup factories and access existing prototype definitions as well as perform registrations from
a central API. This factory works together with the DatagramPrototypeFactory
object
to provide a complete management framework for defining eventgram prototypes and instantiating event objects.
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
DEFAULT_SERIAL_VERSION_ID
Modifier and Type | Method and Description |
---|---|
ImmutableEventDatagram |
createEvent(Prototype prototype)
Create and returns an event datagram object of a specific type based on the
Prototype . |
ImmutableEventDatagram |
createEvent(java.lang.String eventId)
Creates an event datagram object using the specified Event Id.
|
boolean |
existsPrototype(java.lang.String eventId)
Checks if an event prototype associated with the specified event id exists in the factory.
|
java.lang.String |
getAncestorType()
Returns the name of the ancestor
Semantic Type used by event datagrams
that are created by the particular factory. |
EventDatagramCipherSuite |
getCipherSuite()
Returns the cipher suite implemented by this datagram factory.
|
java.lang.String |
getName()
Returns the name of the factory.
|
java.lang.String |
getPrototypeNamespace()
Returns the
Namespace that indicates where the prototype objects are
stored in the entity repository. |
SemanticType |
getSemanticType()
Returns the
Semantic Type of the factory. |
java.util.List |
getSupportedTypes()
Returns a list of
Semantic Type definitions that are supported by the factory. |
java.util.List |
listEventIds()
Returns a list of event ids of all event prototypes in the factory.
|
java.util.List |
listPrototypeModels()
Returns a list of prototype models managed by the factory.
|
ImmutableEventDatagram |
newEventInstance(SemanticType type)
Creates and returns an instance of an event datagram of this factory's type
based on the semantic type.
|
ImmutableEventDatagram |
newEventInstance(java.lang.String semanticType)
Creates an event instance based on the specified semantic type.
|
ImmutableEventDatagram |
newEventInstanceFrom(ImmutableEventDatagram event)
Creates an event instance using the specified event.
|
ImmutableEventDatagram |
newEventInstanceFrom(java.lang.String eventId)
Creates an event instance using the specified Event Id.
|
boolean |
supportsModel(java.lang.String model)
Checks if the specified event model is supported by this factory.
|
getSerialVersionUID
clone
java.lang.String getName()
Reference
Context
namespace used to store factory prototypes.SemanticType getSemanticType()
Semantic Type
of the factory.java.lang.String getAncestorType()
Semantic Type
used by event datagrams
that are created by the particular factory.
Reference Context
namespace used to store prototypes.java.lang.String getPrototypeNamespace()
Namespace
that indicates where the prototype objects are
stored in the entity repository.java.util.List listPrototypeModels()
java.util.List getSupportedTypes()
Semantic Type
definitions that are supported by the factory.
boolean supportsModel(java.lang.String model)
model
- the model to be checked.true
if the specified mode is supported by the factory, false
otherwise.boolean existsPrototype(java.lang.String eventId)
eventId
- the event id of the prototype to be checked.true
if the specified prototype exists, false
otherwise.java.util.List listEventIds()
ImmutableEventDatagram newEventInstance(SemanticType type) throws DatagramFactoryException
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
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.
type
- the semantic type that the created event is based on.DatagramFactoryException
- if some error occurs.ImmutableEventDatagram newEventInstance(java.lang.String semanticType) throws DatagramFactoryException
newEventInstance(com.streamscape.repository.types.SemanticType)
for further information.semanticType
- the semantic type that the created event is based on.DatagramFactoryException
- if some error occurs.ImmutableEventDatagram newEventInstanceFrom(java.lang.String eventId) throws DatagramFactoryException
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.DatagramFactoryException
- if some error occurs.ImmutableEventDatagram newEventInstanceFrom(ImmutableEventDatagram event) throws DatagramFactoryException
null
event id.
Then this event instance can be used for a creation of new event prototypes, but cannot be raised.DatagramFactoryException
- if some error occurs.ImmutableEventDatagram createEvent(Prototype prototype) throws DatagramFactoryException
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 newEventInstance(com.streamscape.repository.types.SemanticType)
documentation for a comparison of these methods.
prototype
- the Prototype
object associated with the event.DatagramFactoryException
- if some error occurs.ImmutableEventDatagram createEvent(java.lang.String eventId) throws DatagramFactoryException
createEvent(com.streamscape.repository.types.Prototype)
for further information.eventId
- the unique identifier of the event.DatagramFactoryException
- if some error occurs.EventDatagramCipherSuite getCipherSuite() throws DatagramFactoryException
DatagramFactoryException
- if some error occurs.Copyright © 2015-2024 StreamScape Technologies. All rights reserved.