public abstract class AbstractEventCodec extends java.lang.Object implements EventCodec
In addition to implementing the abstract methods here and in the EventCodec interface, valid subclasses must provide a constructor with the same signature as the one provided here. Note that the IAF provides NO guarantees about what threads that will be used to call these functions, so to ensure correct operation care must be taken to use locking where required.
API_VERSION
Constructor and Description |
---|
AbstractEventCodec(java.lang.String name,
EventCodecProperty[] properties,
TimestampConfig timestampConfig)
Construct a new instance of AbstractEventCodec.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addEventTransport(java.lang.String name,
EventTransport transport)
Add a named event transport to the set of transports known to the
codec.
|
abstract void |
cleanup()
Frees any resources allocated by the codec (useful for resources
external to the JVM that were allocated in the constructor).
|
void |
flushDownstream()
Flush any pending codec events into the semantic mapper.
|
void |
flushUpstream()
Flush any pending codec events onto the transport.
|
abstract int |
getAPIVersion()
Return the codec API version that the codec was built against.
|
int |
getCapabilities()
Return the capabilities of the codec.
|
abstract CodecStatus |
getStatus()
Return a
CodecStatus or ExtendedCodecStatus
object containing up-to-date status information for the codec. |
abstract void |
removeEventTransport(java.lang.String name)
Remove a named event transport from the set of transports known to the
codec.
|
abstract void |
sendNormalisedEvent(NormalisedEvent event,
TimestampSet timestamps)
This is the method that the Semantic Mapper calls when it receives
a message that should be encoded and then sent upstream to an event transport.
|
abstract void |
sendTransportEvent(java.lang.Object event,
TimestampSet timestamps)
This is the method that a transport layer plug-in calls when it
receives a message that should be decoded and then sent downstream
towards the Apama correlator.
|
abstract void |
setSemanticMapper(SemanticMapper mapper)
Set the Semantic Mapper object to be used by the decoder.
|
java.lang.String |
toString() |
void |
updateProperties(EventCodecProperty[] properties,
TimestampConfig timestampConfig)
Update the configuration of the codec.
|
public AbstractEventCodec(java.lang.String name, EventCodecProperty[] properties, TimestampConfig timestampConfig) throws CodecException
The AbstractEventCodec implementation does nothing, but subclasses should make use of the arguments to initialize the codec.
name
- The codec name, as specified in the IAF config fileproperties
- The codec property set specified in the IAF
configuration filetimestampConfig
- Timestamp recording/logging settings from the
IAF configuration fileCodecException
public void updateProperties(EventCodecProperty[] properties, TimestampConfig timestampConfig) throws CodecException
properties
- The new codec property set specified in the IAF
configuration filetimestampConfig
- Timestamp recording/logging settingsCodecException
public abstract void addEventTransport(java.lang.String name, EventTransport transport) throws CodecException
name
- The name of the transport to be addedtransport
- The transport object instanceCodecException
public abstract void removeEventTransport(java.lang.String name) throws CodecException
name
- The transport to be removedCodecException
public abstract void setSemanticMapper(SemanticMapper mapper) throws CodecException
mapper
- The Semantic mapper object instanceCodecException
public void flushUpstream() throws CodecException
CodecException
public void flushDownstream() throws CodecException
CodecException
public abstract void cleanup() throws CodecException
CodecException
public abstract CodecStatus getStatus()
CodecStatus
or ExtendedCodecStatus
object containing up-to-date status information for the codec.
This method provides the statistics and status message displayed
by the IAF Watch tool. A typical plug-in will continuously keep
track of the number of messages sent upstream and downstream.
Then, when getStatus is called, these message counts can simply
be packaged up in a new CodecStatus object together with a String
describing the current status of the plug-in (maximum length
1024 characters), and returned.
For example:
public CodecStatus getStatus()
{ String status = "Status: OK";
return new TransportStatus(status, totalReceived, totalSent);
}
public abstract int getAPIVersion()
EventCodec.API_VERSION
.public int getCapabilities()
0
.public java.lang.String toString()
toString
in class java.lang.Object
public abstract void sendTransportEvent(java.lang.Object event, TimestampSet timestamps) throws CodecException, SemanticMapperException
sendTransportEvent
in interface EventDecoder
event
- An object representing the event to be decoded, in a format
shared by the decoder and transport.timestamps
- A TimestampSet representing the timestamps attached
to the event.CodecException
- Thrown by the decoder if the event provided
has an invalid format.SemanticMapperException
- Thrown if an error occurred during
processing of the message by the Semantic Mapper.public abstract void sendNormalisedEvent(NormalisedEvent event, TimestampSet timestamps) throws CodecException, TransportException
sendNormalisedEvent
in interface EventCodec
event
- A NormalisedEvent representing the event to be encoded.timestamps
- A TimestampSet representing the timestamps attached
to the event.CodecException
- Thrown by the codec if the event provided
has an invalid format.TransportException
- Thrown if an error occurred in the Transport
when sending the message.Submit a bug or feature
Copyright (c) 2013-2020 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.