Interface TransformerAccessor
-
public interface TransformerAccessor
Allows a Transformer module access to the main interfaces it requires to interact with the Transformer core.
-
-
Field Summary
Fields Modifier and Type Field Description static int
F_DEFAULT
Default Subscriber flag.static int
F_LISTENER_ACCESSORY
Setting this flag on subscribe will cause the subscriber to behave as an accessory listener.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TransformerActiveSub
createActiveJsonSubscription(String subject, SubjectConsumer<T> listener, Class<T> jsonDeserializationType)
Creates an active subscription to an individual subject that returns Java objects from their serialized JSON form.<T> TransformerActiveSub
createActiveJsonSubscription(String subject, SubjectConsumer<T> listener, Class<T> jsonDeserializationType, int subscriptionFlags)
Creates an active subscription to an individual subject that returns Java objects from their serialized JSON form.TransformerPublisher
createActivePublisher(Namespace namespace, DataProvider dataProvider)
Creates anTransformerPublisher
for the specified namespace.TransformerPublisher
createActivePublisher(String subject, DataProvider dataProvider)
Creates anTransformerPublisher
for the specified subject.TransformerActiveSub
createActiveSubscription(String subject, SubscriptionListener subscriptionListener)
Creates an active subscription to an individual subject.TransformerActiveSub
createActiveSubscription(String subject, SubscriptionListener subscriptionListener, int subscriptionFlags)
Creates an active subscription to an individual subject.<T> TransformerBroadcastSub
createBroadcastJsonSubscription(Namespace namespace, SubjectConsumer<T> listener, Class<T> jsonDeserializationType)
Creates a subscription to many subjects that return Java objects from their serialized JSON form.<T> TransformerBroadcastSub
createBroadcastJsonSubscription(Namespace namespace, SubjectConsumer<T> listener, Class<T> jsonDeserializationType, int subscriptionFlags)
Creates a subscription to many subjects that return Java objects from their serialized JSON form.TransformerBroadcastSub
createBroadcastSubscription(Namespace namespace, SubscriptionListener subscriptionListener)
Creates a subscription to many subjects.TransformerBroadcastSub
createBroadcastSubscription(Namespace namespace, SubscriptionListener subscriptionListener, int subscriptionFlags)
Creates a subscription to many subjects.TransformerCachingPublisher
createCachingPublisher(Namespace namespace, CachingDataProvider dataProvider)
Creates anCachingPublisher
for the specified namespace.String
expandFilename(String filename)
Returns a fully qualified filename based on % substitution fields.DataCache
getDataCache()
Returns an object that allows the Transformer module to access the data cached within the Transformer's core.FieldManager
getFieldManager()
Gets the datasource field managerTransformerPublisher
getGlobalPublisher()
Gets the global Publisher.String
getLogDirectory()
Gets the logging directory configured for the TransformerLogger
getLogger()
Returns theLogger
that should be used with this modulePersistence
getPersistence()
PipelineRegistrar
getPipelineRegistrar()
Returns an object that allows the Transformer module to register methods for availability in pipelinesUDPAccessor
getUDPAccessor()
Returns an object that allows the Transformer module to access the Transformer core's UDP command interface.void
setJsonHandler(JsonHandler handler)
Sets the JsonHandler that Parses, Formats and serializes Objects to JSON.
-
-
-
Field Detail
-
F_DEFAULT
static final int F_DEFAULT
Default Subscriber flag.- See Also:
- Constant Field Values
-
F_LISTENER_ACCESSORY
static final int F_LISTENER_ACCESSORY
Setting this flag on subscribe will cause the subscriber to behave as an accessory listener. Accessory listeners will not necessarily result in objects being requested by the Transformer. Instead, the 'accessory listener' listens to subscriptions made by other subscribing clients.
Objects which are 'listened to' by an accessory listener can be discarded and dropped from the Transformer cache. This can occur when there are no other subscribing clients.- See Also:
- Constant Field Values
-
-
Method Detail
-
getDataCache
DataCache getDataCache()
Returns an object that allows the Transformer module to access the data cached within the Transformer's core.
- Returns:
- The
DataCache
object.
-
getPipelineRegistrar
PipelineRegistrar getPipelineRegistrar()
Returns an object that allows the Transformer module to register methods for availability in pipelines
- Returns:
- The
PipelineRegistrar
object.
-
getUDPAccessor
UDPAccessor getUDPAccessor()
Returns an object that allows the Transformer module to access the Transformer core's UDP command interface. The module will be able to register and deregister listeners for UDP commands, and send its own UDP commands.
- Returns:
- The
UDPAccessor
object.
-
getLogDirectory
String getLogDirectory()
Gets the logging directory configured for the Transformer- Returns:
- The directory where log files are stored
-
getLogger
Logger getLogger()
Returns the
Logger
that should be used with this module- Returns:
- The Logger for this module
-
expandFilename
String expandFilename(String filename)
Returns a fully qualified filename based on % substitution fields.
The possible substitution fields are:
- %a - the application name.
- %n - the application name.
- %r - the application root.
- Parameters:
filename
- The filename, including % substitution fields, to expand.- Returns:
- The expanded filename.
- Throws:
NullPointerException
- If the filename is null.
-
getPersistence
Persistence getPersistence()
- Returns:
- An object providing access to the Transformer persistence service.
-
createActivePublisher
TransformerPublisher createActivePublisher(Namespace namespace, DataProvider dataProvider)
Creates an
TransformerPublisher
for the specified namespace.A
TransformerPublisher
publishes updates that are for subjects within the specifiedNamespace
, to all peers that have subscribed to those subjects.- Parameters:
namespace
- TheNamespace
associated with this publisher.dataProvider
- TheDataProvider
that can publish data via this publisher.- Returns:
- An
TransformerPublisher
for the suppliedNamespace
.
-
createActivePublisher
TransformerPublisher createActivePublisher(String subject, DataProvider dataProvider)
Creates an
TransformerPublisher
for the specified subject.A
TransformerPublisher
publishes updates for subjects matched by the input subject parameter.- Parameters:
subject
- The subject to register the provider on. Wildcards may be used if they have been enabled.dataProvider
- TheDataProvider
that can publish data via this publisher.- Returns:
- An
TransformerPublisher
for the supplied subject.
-
createCachingPublisher
TransformerCachingPublisher createCachingPublisher(Namespace namespace, CachingDataProvider dataProvider)
Creates an
CachingPublisher
for the specified namespace.An
CachingPublisher
publishes updates that are for subjects within the specifiedNamespace
, to all peers that have subscribed to those subjects.- Parameters:
namespace
- TheNamespace
associated with this publisher.dataProvider
- TheCachingDataProvider
that can publish data via this publisher.- Returns:
- An
TransformerCachingPublisher
for the suppliedNamespace
.
-
createActiveSubscription
TransformerActiveSub createActiveSubscription(String subject, SubscriptionListener subscriptionListener)
Creates an active subscription to an individual subject.
If a data service has been configured that matches the given subject and active peers within that data service are connected, a request will be made to those peers for the specified subject.
All events whose subjects match the method's subject parameter are passed to the given
To initialise the subscription, it is necessary to callSubscriptionListener
.TransformerActiveSub.subscribe()
on the returnedTransformerActiveSub
object.- Parameters:
subject
- The subject to subscribe to.subscriptionListener
- A listener to receive events raised for theActiveSubscription
.- Returns:
- An
TransformerActiveSub
.
-
createActiveSubscription
TransformerActiveSub createActiveSubscription(String subject, SubscriptionListener subscriptionListener, int subscriptionFlags)
Creates an active subscription to an individual subject.
If a data service has been configured that matches the given subject and active peers within that data service are connected, a request will be made to those peers for the specified subject.
All events whose subjects match the method's subject parameter are passed to the given
To initialise the subscription, it is necessary to callSubscriptionListener
.TransformerActiveSub.subscribe()
on the returnedTransformerActiveSub
object.- Parameters:
subject
- The subject to subscribe to.subscriptionListener
- A listener to receive events raised for theActiveSubscription
.subscriptionFlags
- Flags to set on the active subscription. Flags can beF_LISTENER_ACCESSORY
andF_DEFAULT
- Returns:
- An
TransformerActiveSub
.
-
createActiveJsonSubscription
<T> TransformerActiveSub createActiveJsonSubscription(String subject, SubjectConsumer<T> listener, Class<T> jsonDeserializationType)
Creates an active subscription to an individual subject that returns Java objects from their serialized JSON form.
To deserialize the JSON data a
JsonHandler
must have been installed- Type Parameters:
T
- the Generic type of the object to deserialize the JSON to.- Parameters:
subject
- The subject to subscribe to.listener
- A listener to receive events raised for this subscription.jsonDeserializationType
- the type of the object to deserialize the JSON to.- Returns:
- An
TransformerActiveSub
.
-
createActiveJsonSubscription
<T> TransformerActiveSub createActiveJsonSubscription(String subject, SubjectConsumer<T> listener, Class<T> jsonDeserializationType, int subscriptionFlags)
Creates an active subscription to an individual subject that returns Java objects from their serialized JSON form.
To deserialize the JSON data a
JsonHandler
must have been installed- Type Parameters:
T
- the Generic type of the object to deserialize the JSON to.- Parameters:
subject
- The subject to subscribe to.listener
- A listener to receive events raised for this subscription.jsonDeserializationType
- the type of the object to deserialize the JSON to.subscriptionFlags
- Flags to set on the active subscription. Flags can beF_LISTENER_ACCESSORY
andF_DEFAULT
- Returns:
- An
TransformerActiveSub
.
-
createBroadcastSubscription
TransformerBroadcastSub createBroadcastSubscription(Namespace namespace, SubscriptionListener subscriptionListener)
Creates a subscription to many subjects. The scope of the subscription is defined by a
To initialise the subscription, it is necessary to callNamespace
; all events whose subjects match the givenNamespace
are passed to the givenSubscriptionListener
.TransformerBroadcastSub.subscribe()
on the returnedTransformerBroadcastSub
object.- Parameters:
namespace
- TheNamespace
defining the subjects to subscribe to.subscriptionListener
- A listener to receive events raised for theTransformerBroadcastSub
.- Returns:
- A
TransformerBroadcastSub
.
-
createBroadcastSubscription
TransformerBroadcastSub createBroadcastSubscription(Namespace namespace, SubscriptionListener subscriptionListener, int subscriptionFlags)
Creates a subscription to many subjects. The scope of the subscription is defined by a
To initialise the subscription, it is necessary to callNamespace
; all events whose subjects match the givenNamespace
are passed to the givenSubscriptionListener
.TransformerBroadcastSub.subscribe()
on the returnedTransformerBroadcastSub
object.- Parameters:
namespace
- TheNamespace
defining the subjects to subscribe to.subscriptionListener
- A listener to receive events raised for theTransformerBroadcastSub
.subscriptionFlags
- Flags to set on the active subscription. Flags can beF_LISTENER_ACCESSORY
andF_DEFAULT
- Returns:
- A
TransformerBroadcastSub
.
-
createBroadcastJsonSubscription
<T> TransformerBroadcastSub createBroadcastJsonSubscription(Namespace namespace, SubjectConsumer<T> listener, Class<T> jsonDeserializationType)
Creates a subscription to many subjects that return Java objects from their serialized JSON form. The scope of the subscription is defined by a
Namespace
; all events whose subjects match the givenNamespace
are passed to the givenSubscriptionListener
.To deserialize the JSON data a
JsonHandler
must have been installed- Type Parameters:
T
- the Generic type of the object to deserialize the JSON to.- Parameters:
namespace
- TheNamespace
defining the subjects to subscribe to.listener
- A listener to receive events raised for this subscription.jsonDeserializationType
- the type of the object to deserialize the JSON to.- Returns:
- An
BroadcastSubscription
.
-
createBroadcastJsonSubscription
<T> TransformerBroadcastSub createBroadcastJsonSubscription(Namespace namespace, SubjectConsumer<T> listener, Class<T> jsonDeserializationType, int subscriptionFlags)
Creates a subscription to many subjects that return Java objects from their serialized JSON form. The scope of the subscription is defined by a
Namespace
; all events whose subjects match the givenNamespace
are passed to the givenSubscriptionListener
.To deserialize the JSON data a
JsonHandler
must have been installed- Type Parameters:
T
- the Generic type of the object to deserialize the JSON to.- Parameters:
namespace
- TheNamespace
defining the subjects to subscribe to.listener
- A listener to receive events raised for this subscription.jsonDeserializationType
- the type of the object to deserialize the JSON to.subscriptionFlags
- Flags to set on the active subscription. Flags can beF_LISTENER_ACCESSORY
andF_DEFAULT
- Returns:
- An
BroadcastSubscription
.
-
getFieldManager
FieldManager getFieldManager()
Gets the datasource field manager- Returns:
- FieldManager
-
getGlobalPublisher
TransformerPublisher getGlobalPublisher()
Gets the global Publisher. This publisher enables messages to be published by the Transformer without registering as an active publisher. Useful if this module needs to publish updates to a subject when a provider has been registered by another module.- Returns:
- The global publisher
-
setJsonHandler
void setJsonHandler(JsonHandler handler)
Sets the JsonHandler that Parses, Formats and serializes Objects to JSON.- Parameters:
handler
- the JsonHandler to install.
-
-