com.neeve.sma
Class MessageChannelDescriptor

java.lang.Object
  extended by com.neeve.root.RootObject
      extended by com.neeve.sma.SmaObject
          extended by com.neeve.sma.MessageChannelDescriptor

public final class MessageChannelDescriptor
extends SmaObject

A message channel descriptor.

This class contains information used to describe a message channel. It is used by a bus descriptor to describe channels configured for the bus. It also offers methods to persist and load descriptors to/from X Platform configuration repositories.

Threading:
This class is safe for concurrent access by multiple threads.

Method Summary
static MessageChannelDescriptor create(String name, MessageBusDescriptor parent)
          Create a default message channel descriptor.
 void delete(IConfigRepository repo)
          Delete a channel descriptor from the configuration repository.
static boolean exists(IConfigRepository repo, String busName, String channelName)
          Checks if a channel is configured in a configuration repository
static boolean exists(String busName, String channelName)
          Checks if a channel descriptor is present in the default configuration repository
 String getChannelFilter()
          Get the filter for the channel that this descriptor describes.
 short getChannelId()
          Get a channel's id.
 String getChannelKey()
          Get the key for the channel that this descriptor describes.
 MessageChannel.Qos getChannelQos()
          Get the QOS for the channel that this descriptor describes.
 String getName()
          Get the name of the channel that this descriptor describes
 MessageBusDescriptor getParent()
          Get the parent (container) bus descriptor
 Properties getProviderConfig()
          Get the configuration for the provider specific portion of the channel that this descriptor describes.
static MessageChannelDescriptor load(IConfigRepository repo, MessageBusDescriptor busDescriptor, String channelName, String userName)
          Create a channel descriptor from a configuration respository.
static Set<MessageChannelDescriptor> loadAll(IConfigRepository repo, MessageBusDescriptor busDescriptor, String userName)
          Create channel descriptors for all channels for a bus in a configuration repository.
 void save(IConfigRepository repo, String userName)
          Save a channel descriptor to a configuration repository.
 MessageChannelDescriptor setChannelFilter(String filter)
          Set the filter for the channel that this descriptor describes.
 void setChannelId(short id)
          Set a channel's id.
 MessageChannelDescriptor setChannelKey(String key)
          Set the key for the channel that this descriptor describes.
 MessageChannelDescriptor setChannelQos(MessageChannel.Qos qos)
          Set the QOS for the channel that this descriptor describes.
 MessageChannelDescriptor setProviderConfig(Properties props)
          Set the configuration for the provider specific portion of the channel that this descriptor describes.
 String toString()
          Returns a string representation of this object
 
Methods inherited from class com.neeve.root.RootObject
getChecked, getThreaded, getTracer, setChecked, setTracer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getName

public final String getName()
Get the name of the channel that this descriptor describes


getParent

public final MessageBusDescriptor getParent()
Get the parent (container) bus descriptor


setProviderConfig

public final MessageChannelDescriptor setProviderConfig(Properties props)
Set the configuration for the provider specific portion of the channel that this descriptor describes.

Parameters:
props - The properties table that describes the provider configuration. This parameter can be null in which case default values will be used for the properties.
Returns:
Returns this object for invocation chaining.

This method sets the configuration for the provider specific portion of a bus channel using a property table. Other property names are provider defined.


getProviderConfig

public final Properties getProviderConfig()
Get the configuration for the provider specific portion of the channel that this descriptor describes.


setChannelId

public final void setChannelId(short id)
Set a channel's id.

Parameters:
id - The channel id.

The channel id is a numerical identifier of a channel uniquely identifying the channel in its bus.


getChannelId

public final short getChannelId()
Get a channel's id.


setChannelKey

public final MessageChannelDescriptor setChannelKey(String key)
Set the key for the channel that this descriptor describes.

Parameters:
key - The channel key to set. This parameter value can be null in which case the channel will not be associated with any key.
Returns:
Returns this object for invocation chaining.

getChannelKey

public final String getChannelKey()
Get the key for the channel that this descriptor describes.


setChannelFilter

public final MessageChannelDescriptor setChannelFilter(String filter)
Set the filter for the channel that this descriptor describes.

A channel filter filters variable parts of a channel key to filter what is received over the channel.

Unless otherwise specified by a particular channel implementation, a channel filter takes the following form:

var1=val1[|val2][;var2=val3]

For example: given a channel key of "ORDERS/${Region}/{Department}", one can specify a channel filter of "Region=NA|EMEA;Department=Clothing". This would join the channel on:

If a variable portion of the channel key is omitted in a filter, it will result in the subscription being joined in a wildcard fashion (assuming the underlying bus implementation supports wildcards). So given a channel key of "ORDERS/${Region}/${Department}" and a channel filter of "Region=NA|EMEA", it would result in the following subscriptions being issued during join:

Finally, if the channel filter is set to null for the channel key in the example above, then the resulting subscription would be:

Parameters:
filter - The channel filter to set. This parameter value can be null in which case the channel will not be associated with any filter.
Returns:
Returns this object for invocation chaining.

getChannelFilter

public final String getChannelFilter()
Get the filter for the channel that this descriptor describes.

Returns:
the channel filter for this channel or null if no filter is specified.
See Also:
setChannelFilter(String)

setChannelQos

public final MessageChannelDescriptor setChannelQos(MessageChannel.Qos qos)
Set the QOS for the channel that this descriptor describes.

Parameters:
qos - The channel QOS to set.
Returns:
Returns this object for invocation chaining.

getChannelQos

public final MessageChannel.Qos getChannelQos()
Get the QOS for the channel that this descriptor describes.


save

public final void save(IConfigRepository repo,
                       String userName)
                throws SmaException
Save a channel descriptor to a configuration repository.

Parameters:
repo - The configuration respository to save the descriptor to.
userName - The name of the user on whose behalf this descriptor should be saved.
Throws:
SmaException - Thrown in case an error in encountered during the saving of the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

This method saves a channel descriptor to the configuration repository.


delete

public final void delete(IConfigRepository repo)
                  throws SmaException
Delete a channel descriptor from the configuration repository.

Parameters:
repo - The configuration respository to delete the descriptor from.
Throws:
SmaException - Thrown in case an error in encountered during the deletion of the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

This method deletes a channel descriptor from a configuration repository.


toString

public final String toString()
Returns a string representation of this object

Overrides:
toString in class Object

exists

public static boolean exists(IConfigRepository repo,
                             String busName,
                             String channelName)
Checks if a channel is configured in a configuration repository

Parameters:
repo - The configuration respository to check in.
busName - The name of the bus in which to check for channel existence.
channelName - The name of the channel to check for.
Threading:
This method is safe for concurrent access by multiple threads.

exists

public static boolean exists(String busName,
                             String channelName)
Checks if a channel descriptor is present in the default configuration repository

Parameters:
busName - The name of the bus in which to check for channel existence.
channelName - The name of the channel to check for.
Threading:
This method is safe for concurrent access by multiple threads.

create

public static MessageChannelDescriptor create(String name,
                                              MessageBusDescriptor parent)
Create a default message channel descriptor.

Parameters:
name - The name of the channel whose descriptor is to be prepared.
parent - The descriptor of the bus to which this descriptor's channel belongs
Threading:
This method is safe for concurrent access by multiple threads.

load

public static MessageChannelDescriptor load(IConfigRepository repo,
                                            MessageBusDescriptor busDescriptor,
                                            String channelName,
                                            String userName)
                                     throws SmaException
Create a channel descriptor from a configuration respository.

Parameters:
repo - The configuration respository to create the channel from.
busDescriptor - The parent bus descriptor preparing this descriptor.
channelName - The name of the channel whose descriptor is to be prepared.
userName - The user for whom the descriptor is being prepared.
Throws:
SmaException - Thrown in case an error occurs during the preparation of the descriptor.
Threading:
This method is safe for concurrent access by multiple threads.

loadAll

public static Set<MessageChannelDescriptor> loadAll(IConfigRepository repo,
                                                    MessageBusDescriptor busDescriptor,
                                                    String userName)
                                             throws SmaException
Create channel descriptors for all channels for a bus in a configuration repository.

Parameters:
repo - The configuration respository from where to create the buses.
busDescriptor - The parent bus descriptor preparing this descriptor.
userName - The user for whom the descriptor is being prepared.
Returns:
Returns the set of channel descriptors.

This method creates and initializes channel descriptors for each of the channels configured for a bus in a configuration repository.

Throws:
SmaException
Threading:
This method is safe for concurrent access by multiple threads.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.