public final class TopicDataFactory extends Object
types
of topic
data
.
There are individual methods for each type or a
generic method
which can create any
type (except UniversalTopicData
) from a TopicDefinition
.
Use newUniversalData(java.lang.Class<V>)
to create UniversalTopicData
.
Constructor and Description |
---|
TopicDataFactory() |
Modifier and Type | Method and Description |
---|---|
static void |
bootstrap(com.pushtechnology.diffusion.container.ApplicationContainer applicationContainer,
com.pushtechnology.diffusion.data.InternalTopicDataFactory internalFactory) |
static ChildListTopicData |
newChildListData()
Deprecated.
since 5.9
This topic type will be removed in a future release |
static CustomTopicData |
newCustomData(CustomTopicDataHandler handler)
Deprecated.
since 5.9
This topic type will be removed in a future release |
static PagedRecordTopicData |
newPagedRecordData(MRecord metadata)
Deprecated.
since 5.9
This topic type will be removed in a future release |
static PagedRecordTopicData |
newPagedRecordData(MRecord metadata,
Comparator<Record> comparator)
Deprecated.
since 5.9
This topic type will be removed in a future release |
static PagedStringTopicData |
newPagedStringData()
Deprecated.
since 5.9
This topic type will be removed in a future release |
static PagedStringTopicData |
newPagedStringData(Comparator<String> comparator)
Deprecated.
since 5.9
This topic type will be removed in a future release |
static PBTopicData |
newPBData(String protoClassName,
String messageName)
Deprecated.
since 5.7.
Support for Google Protocol Buffers topics will be removed in
a future release as |
static RecordTopicData |
newRecordData(MMessage metadata)
Create new
Record Topic Data . |
static RoutingTopicData |
newRoutingData(RoutingTopicDataSubscriptionHandler handler)
Create new
Routing Topic Data . |
static ServiceTopicData |
newServiceData(String serviceType,
ServiceHandler serviceHandler)
Deprecated.
since 5.7
Messaging is a better alternative to service topics for sending point-to-point requests. |
static SingleValueTopicData |
newSingleValueCustomData(CustomFieldHandler handler)
Create new
Single Value Topic Data of type
MDataType.CUSTOM_STRING . |
static SingleValueTopicData |
newSingleValueData(MDataType type)
Create new
Single Value Topic Data . |
static SingleValueTopicData |
newSingleValueData(MField metadata)
Create new
Single Value Topic Data . |
static SingleValueTopicData |
newSingleValueDecimalData(int scale)
Create new
Single Value Topic Data of type
MDataType.DECIMAL_STRING with a scale other than the default. |
static SlaveTopicData |
newSlaveData(PublishingTopicData master)
Deprecated.
since 5.7.
This method does not cater for attaching
|
static SlaveTopicData |
newSlaveData(String masterTopicName)
Create a new
SlaveTopicData . |
static TopicData |
newTopicData(TopicDefinition definition)
Create new
TopicData from a TopicDefinition . |
static TopicNotifyTopicData |
newTopicNotifyData(boolean cacheMetadata)
Deprecated.
since 5.9
This topic type will be removed in a future release |
static <V> UniversalTopicData<V> |
newUniversalData(Class<V> valueType)
Create new
UniversalTopicData . |
static <V> UniversalTopicData<V> |
newUniversalData(Class<V> valueType,
Map<String,String> properties)
Create new
UniversalTopicData . |
public static void bootstrap(com.pushtechnology.diffusion.container.ApplicationContainer applicationContainer, com.pushtechnology.diffusion.data.InternalTopicDataFactory internalFactory)
@Deprecated public static CustomTopicData newCustomData(CustomTopicDataHandler handler) throws APIException
This topic type will be removed in a future release
Custom Topic Data
.
handler
- the custom data handler which will maintain the data stateAPIException
- if a failure occurspublic static RecordTopicData newRecordData(MMessage metadata) throws APIException
Record Topic Data
.
metadata
- the metadata that defines the record data layout. This
metadata must be of type TopicDataType.RECORD
.APIException
- if a failure occurs@Deprecated public static PBTopicData newPBData(String protoClassName, String messageName) throws APIException
Support for Google Protocol Buffers topics will be removed in
a future release as universal
topic data
of type BINARY
can be
used to distribute protocol buffer messages.
Protocol Buffer Topic Data
.
Such data will receive and output Message formatted as Google Protocol Buffers according to a specified message definition.
protoClassName
- the full name of the outer class containing the
required message definition. Such a class will have been generated
from a .proto file using the protoc compiler.messageName
- the name of the message within the specified class
that defines the topic data message.APIException
- if a failure occurspublic static SingleValueTopicData newSingleValueData(MField metadata) throws APIException
Single Value Topic Data
.
Such data maintains the simplest form of Topic data which is a single data item of a particular type (e.g. a String).
metadata
- the field metadata definition that describes the topic
data. This may be created using
MetadataFactory.newFieldMetadata(MDataType)
.APIException
- if unable to create single value data of the
specified typepublic static SingleValueTopicData newSingleValueData(MDataType type) throws APIException
Single Value Topic Data
.
The field metadata will be automatically generated with a unique name. Such data maintains the simplest form of Topic data which is a single data item of a particular type (e.g. a String).
Note that this can only be used to create simple default data. To create
Decimal single value data with a scale other than default then use
newSingleValueDecimalData(int)
. To create custom single value
data use newSingleValueCustomData(CustomFieldHandler)
.
type
- the data typeAPIException
- if unable to create single value data of the
specified typepublic static SingleValueTopicData newSingleValueDecimalData(int scale) throws APIException
Single Value Topic Data
of type
MDataType.DECIMAL_STRING
with a scale other than the default.
The field metadata will be automatically generated with a unique name
scale
- the scaleAPIException
- if the scale is invalidpublic static SingleValueTopicData newSingleValueCustomData(CustomFieldHandler handler) throws APIException
Single Value Topic Data
of type
MDataType.CUSTOM_STRING
.
The metadata will be automatically generated with a unique name.
handler
- the custom field handler which defines how the data is
accessedAPIException
- if no handler specified@Deprecated public static ChildListTopicData newChildListData()
This topic type will be removed in a future release
ChildListTopicData
.
@Deprecated public static SlaveTopicData newSlaveData(PublishingTopicData master) throws APIException
This method does not cater for attaching
SlaveTopicData
to topics with
UniversalTopicData
. Use newSlaveData(String)
instead. This method will be withdrawn at a future release.
SlaveTopicData
.
master
- topic dataAPIException
- since 5.5 this exception will not occurpublic static SlaveTopicData newSlaveData(String masterTopicName) throws APIException
SlaveTopicData
.masterTopicName
- specifies the name of the master topic. This must
be a topic that has either PublishingTopicData
or
UniversalTopicData
.APIException
- if the specified master topic does not exist or does
not have PublishingTopicData
or
UniversalTopicData
@Deprecated public static PagedStringTopicData newPagedStringData() throws APIException
This topic type will be removed in a future release
Paged String Topic Data
.
APIException
- if unable to create string value paged data@Deprecated public static PagedRecordTopicData newPagedRecordData(MRecord metadata) throws APIException
This topic type will be removed in a future release
Paged Record Topic Data
.
metadata
- metadata that describes each line of the paged data. If
this is supplied as null then no metadata will be applied to line
of the page.APIException
- if unable to create record value paged data@Deprecated public static PagedStringTopicData newPagedStringData(Comparator<String> comparator) throws APIException
This topic type will be removed in a future release
Paged String Topic Data
.
comparator
- specifies the comparator to use to impose ordering over
the list. If not specified then the data will not be ordered.APIException
- if unable to create string value paged data@Deprecated public static PagedRecordTopicData newPagedRecordData(MRecord metadata, Comparator<Record> comparator) throws APIException
This topic type will be removed in a future release
Paged Record Topic Data
.
metadata
- metadata that describes each line of the paged data. If
this is supplied as null then no metadata will be applied to line
of the page.comparator
- specified the comparator used to impose ordering over
the list. If not specified then the data will not be ordered.APIException
- if unable to create record value paged data@Deprecated public static ServiceTopicData newServiceData(String serviceType, ServiceHandler serviceHandler) throws APIException
Messaging is a better alternative to service topics for sending point-to-point requests.
Service Topic Data
.
serviceType
- the service type which is a user defined String which
helps the Client to identify the type of Service it has subscribed
to.serviceHandler
- the handler object to which service requests are
delegatedAPIException
- if unable to create the topic datapublic static RoutingTopicData newRoutingData(RoutingTopicDataSubscriptionHandler handler) throws APIException
Routing Topic Data
.
handler
- the handler that will be used to map the routing topic to
actual source topics on a client by client basis.APIException
- if unable to create the data@Deprecated public static TopicNotifyTopicData newTopicNotifyData(boolean cacheMetadata)
This topic type will be removed in a future release
TopicNotifyTopicData
.cacheMetadata
- indicates whether the topic is to support metadata
caching. Caching can significantly improve performance and reduce
bandwidth required for notifications from such a topic but it can
only be used if all instances of metadata
used by
topics that get notified (potentially all) have unique
names
. Using caching when names are not
unique can lead to incorrect metadata notifications.public static <V> UniversalTopicData<V> newUniversalData(Class<V> valueType) throws APIException
UniversalTopicData
.valueType
- the type of the topic value. So for a
TopicType.JSON
topic this would be JSON.class
.APIException
- if the specified type is not supportedpublic static <V> UniversalTopicData<V> newUniversalData(Class<V> valueType, Map<String,String> properties) throws APIException
UniversalTopicData
.valueType
- the type of the topic value. So for a
TopicType.JSON
topic this would be JSON.class
.properties
- optional topic properties. See
TopicSpecification
for details of properties that are
permitted.APIException
- if the specified type is not supported or properties
is nullpublic static TopicData newTopicData(TopicDefinition definition) throws APIException
definition
- the topic definition which contains the information
necessary to create the topic dataTopicDataType.NONE
.APIException
- if unable to create the topic data because the
information within the definition was either incomplete or
incorrectCopyright © 2016 Push Technology Ltd. All Rights Reserved.