Diffusion .NET Classic API - Core and Common  5.9.4
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition Class Reference

This encapsulates all or some of the details of a topic. More...

Public Member Functions

 TopicDefinition (TopicDataType type)
 Constructor for creating a topic definition of the specified type. More...
 
 TopicDefinition (TopicDataType type, Dictionary< TopicProperty, object > properties)
 Creates a topic definition of a specified type with properties. More...
 
 TopicDefinition (TopicDataType type, IMNode metadata)
 Creates a topic definition of a specified type with metadata. More...
 
 TopicDefinition (TopicDataType type, Dictionary< TopicProperty, object > properties, IMNode metadata)
 Creates a topic definition. More...
 
void SetProperty (TopicProperty property, object value)
 Set a topic property. More...
 
void SetProperty (TopicProperty property, List< string > list)
 Sets a list-type property. More...
 
void SetListProperty (TopicProperty property, params string[] list)
 Sets a list-type property. More...
 
object GetProperty (TopicProperty property)
 Returns the value of a topic property. More...
 
string GetStringProperty (TopicProperty property)
 Returns the value of a property as a string. More...
 
int GetIntegerProperty (TopicProperty property)
 Returns the value of an integer property. More...
 
long GetLongProperty (TopicProperty property)
 Returns the value of a long property. More...
 
byte GetByteProperty (TopicProperty property)
 Returns the value of a byte property. More...
 
bool GetBooleanProperty (TopicProperty property)
 Returns the value of a boolean property. More...
 
string[] GetListProperty (TopicProperty property)
 Returns the value of a string property split by list delimiters. More...
 
Dictionary< TopicProperty, object > GetProperties ()
 Returns a copy of the dictionary of the currently-set definition properties. More...
 
void SetProperties (Dictionary< TopicProperty, object > properties)
 Set properties from a specified dictionary of properties. More...
 
override string ToString ()
 Returns a string representation of this object. More...
 

Properties

TopicDataType Type [get]
 Returns the topic type. More...
 
IMNode Metadata [get, set]
 Get/set metadata for the topic. More...
 

Detailed Description

This encapsulates all or some of the details of a topic.

A topic definition comprises:

  1. A mandatory type that defines the type of topic data (if any) associated with the topic.
  2. A set of properties. Some are generic and some are dependent upon the type. The generic properties are all optional but some type-specific ones may be mandatory.
  3. A metadata definition which is mandatory for some types. The type of this metadata is also dependent on the type.

This class performs no validation of the settings. If a definition is used to create a topic and mandatory properties (or metadata) are not present, or one or more values are invalid, then topic creation would fail.

Each property has a documented type (e.g. string, integer, long etc.) and the property value may be set to an object of that type, or any other object that can be parsed to that type via its 'ToString' method. For example, to set an integer property you could specify an integer but you could also specify a string with a numeric integer representation within it. However, if a non-numeric value was assigned to an integer property, then a failure may occur when the property is used.

Constructor & Destructor Documentation

PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.TopicDefinition ( TopicDataType  type)

Constructor for creating a topic definition of the specified type.

For some topic types this may be sufficient, but for other types it may be necessary to set some properties or metadata after construction.

Parameters
typeThe topic type.
PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.TopicDefinition ( TopicDataType  type,
Dictionary< TopicProperty, object >  properties 
)

Creates a topic definition of a specified type with properties.

Additional properties can be set after construction if required, as can metadata for those types that need it.

Parameters
typeThe topic type.
propertiesAn initial set of properties.
PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.TopicDefinition ( TopicDataType  type,
IMNode  metadata 
)

Creates a topic definition of a specified type with metadata.

Properties may still be set after construction if required.

Parameters
typeThe topic type.
metadataTopic metadata. The actual type of metadata that is required (if any) would be determined by the topic type.
PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.TopicDefinition ( TopicDataType  type,
Dictionary< TopicProperty, object >  properties,
IMNode  metadata 
)

Creates a topic definition.

Parameters
typeThe topic type.
propertiesAn initial set of properties. Note that properties are optional, but some topic types do have mandatory properties. Additional properties may be set after construction if required. See TopicProperty for full details of available properties.
metadataTopic metadata. The actual type of metadata that is required (if any) would be determined by the topic type.

Member Function Documentation

bool PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetBooleanProperty ( TopicProperty  property)

Returns the value of a boolean property.

Note that this will return true only if the property was set to a boolean value, or to an object whose ToString() method returns a value of 'true' regardless of case.

Parameters
propertyThe property.
Returns
The property value, or null if the property does not exist.
byte PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetByteProperty ( TopicProperty  property)

Returns the value of a byte property.

Parameters
propertyThe property value, or null if not defined.
Returns
The property value, or null if the property does not exist.
int PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetIntegerProperty ( TopicProperty  property)

Returns the value of an integer property.

Parameters
propertyThe property value, or null if not defined.
Returns
The property value, or null if the property does not exist.
string [] PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetListProperty ( TopicProperty  property)

Returns the value of a string property split by list delimiters.

Parameters
propertyThe property.
Returns
A list of string values, or null if the property was not specifed.
long PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetLongProperty ( TopicProperty  property)

Returns the value of a long property.

Parameters
propertyThe property value, or null if not defined.
Returns
The property value, or null if the property does not exist.
Dictionary<TopicProperty, object> PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetProperties ( )

Returns a copy of the dictionary of the currently-set definition properties.

Changing the returned map will not change the definition.

Returns
object PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetProperty ( TopicProperty  property)

Returns the value of a topic property.

Parameters
propertyThe property.
Returns
The property value, or null if the property is not set.
string PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetStringProperty ( TopicProperty  property)

Returns the value of a property as a string.

Parameters
propertyThe property.
Returns
The property value, or null if the property does not exist.
void PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.SetListProperty ( TopicProperty  property,
params string[]  list 
)

Sets a list-type property.

This will set the value of the property as a string with each supplied element separated by a delimiter, suitable for retrieval using GetListProperty( TopicProperty ).

Parameters
propertyThe property.
listThe list of values.
void PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.SetProperties ( Dictionary< TopicProperty, object >  properties)

Set properties from a specified dictionary of properties.

Parameters
propertiesThe map of properties to use.
void PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.SetProperty ( TopicProperty  property,
object  value 
)

Set a topic property.

There are a number of optional properties that may be set for all topic types. Certain topic types have their own additional properties and some of these may be mandatory.

Note that no validation is done on property values and their settings by this method. If the definition is used to create a topic and one or more property values are invalid or missing (if mandatory), then the topic creation would fail.

Parameters
property
value
void PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.SetProperty ( TopicProperty  property,
List< string >  list 
)

Sets a list-type property.

This will set the value of the property as a string with each supplied element separated by a delimiter, suitable for retrieval using GetListProperty( TopicProperty ).

Parameters
propertyThe property.
listThe list of values.
override string PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.ToString ( )

Returns a string representation of this object.

Returns

Property Documentation

IMNode PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.Metadata
getset

Get/set metadata for the topic.

Only some types of topic require metadata. Some other types (with data of type TopicDataWithMetadata) can have optional metadata and for others it would be ignored.

The type of metadata would depend on the topic type as follows:

TopicDataType.SINGLE_VALUE requires metadata of type MField. TopicDataType.RECORD requires metadata of type MMessage. TopicDataType.PAGED_RECORD requires metadata of type MRecord.

And types with optional metadata can take any MNode.

TopicDataType PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.Type
get

Returns the topic type.