com.neeve.sma
Class MessageBusDescriptor

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

public final class MessageBusDescriptor
extends SmaObject

A message bus descriptor.

This class contains information used to describe a message bus. It is intended for use by a user when establishing bus bindings. It also contains methods to persist and load descriptors to/from X Platform configuration repositories.

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

Field Summary
static String PROPNAME_ADDRESS
           
static String PROPNAME_PROVIDER_NAME
           
 
Method Summary
 MessageBusDescriptor addChannel(MessageChannelDescriptor channelDescriptor)
          Add a channel descriptor.
static MessageBusDescriptor create(String name)
          Create a default message bus descriptor.
 void delete()
          Delete a message bus descriptor from the default configuration repository.
 void delete(IConfigRepository repo)
          Delete a bus descriptor from the configuration repository.
static boolean exists(IConfigRepository repo, String busName)
          Checks if a message bus is configured in a configuration repository.
static boolean exists(String busName)
          Checks if a message bus is configured in the default configuration repository.
 MessageChannelDescriptor getChannel(String channelName)
          Get a channel descriptor.
 int getChannelCount()
          Get the number of channels in the bus.
 Set<MessageChannelDescriptor> getChannels()
          Get the set of channel descriptors.
 String getName()
          Get the name of the bus that this descriptor describes
 Properties getProviderConfig()
          Get the provider configuration configuration.
 com.neeve.util.UtlAddressDescriptor getProviderConfigAsAddressDescriptor()
          Get the provider configuration as an address descriptor string
static MessageBusDescriptor load(IConfigRepository repo, String name, String userName)
          Create a message bus descriptor from a configuration respository.
static MessageBusDescriptor load(String name)
          Create a bus descriptor from the default configuration respository.
static MessageBusDescriptor load(String name, String userName)
          Create a bus descriptor from the default configuration respository.
static Set<MessageBusDescriptor> loadAll()
          Create bus descriptors for all buses configured in the default configuration repository.
static Set<MessageBusDescriptor> loadAll(IConfigRepository repo, String userName)
          Create bus descriptors for all buses in a configuration repository.
static Set<MessageBusDescriptor> loadAll(String userName)
          Create bus descriptors for all buses configured in the default configuration repository.
 void removeChannel(String channelName)
          Remove a channel descriptor.
 void save()
          Save a message bus descriptor to the default configuration repository.
 void save(IConfigRepository repo, String userName)
          Save a bus descriptor to a configuration repository.
 Properties save(Properties props)
          Save a bus descriptor to a property table.
 void save(String userName)
          Save a message bus descriptor to the default configuration repository.
 MessageBusDescriptor setProviderConfig(Properties props)
          Set the configuration for the provider specific portion of the bus binding that this descriptor describes.
 MessageBusDescriptor setProviderConfig(String descriptorStr)
          Set a provider configuration from a descriptor string
 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
 

Field Detail

PROPNAME_PROVIDER_NAME

public static final String PROPNAME_PROVIDER_NAME
See Also:
Constant Field Values

PROPNAME_ADDRESS

public static final String PROPNAME_ADDRESS
See Also:
Constant Field Values
Method Detail

getName

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


setProviderConfig

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

Parameters:
props - The properties table that describes the provider configuration. This parameter cannot be null.
Returns:
Returns this bus descriptor for invocation chaining.

This method sets the configuration for the provider specific portion of a bus binding using a property table.


setProviderConfig

public final MessageBusDescriptor setProviderConfig(String descriptorStr)
                                             throws SmaException
Set a provider configuration from a descriptor string

Parameters:
descriptorStr - The provider configuration specified as an address descriptor string.
Returns:
Returns this bus descriptor for invocation chaining.
Throws:
SmaException

getProviderConfigAsAddressDescriptor

public final com.neeve.util.UtlAddressDescriptor getProviderConfigAsAddressDescriptor()
                                                                               throws SmaException
Get the provider configuration as an address descriptor string

Throws:
SmaException - Thrown in case the PROPNAME_PROVIDER_NAME and/or the PROPNAME_ADDRESS properties are missing from the provider config.

getProviderConfig

public final Properties getProviderConfig()
Get the provider configuration configuration.


addChannel

public final MessageBusDescriptor addChannel(MessageChannelDescriptor channelDescriptor)
Add a channel descriptor.

Parameters:
channelDescriptor - The channel descriptor to add.
Returns:
Returns the bus descriptor for invocation chaining.

This method added a channel descriptor to the set of channel descriptors maintained by the bus descriptor. The added descriptor will replace a descriptor of the same channel name if present.


getChannel

public final MessageChannelDescriptor getChannel(String channelName)
Get a channel descriptor.

Parameters:
channelName - The name of the channel whose descriptor to get.
Returns:
Returns null in case no descriptor of the supplied name is present in the bus descriptor.

getChannels

public final Set<MessageChannelDescriptor> getChannels()
Get the set of channel descriptors.


getChannelCount

public final int getChannelCount()
Get the number of channels in the bus.


removeChannel

public final void removeChannel(String channelName)
Remove a channel descriptor.

Parameters:
channelName - The name of the channel whose descriptor to remove.

save

public final Properties save(Properties props)
Save a bus descriptor to a property table.

Parameters:
props - The property table.
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.

save

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

Parameters:
repo - The root directory of the configuration respository.
userName - The name of the user on whose behalf this descriptor should be saved. This can be null in case no user specific information is to be written
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 bus descriptor to a configuration repository. The descriptor is saved in a format suitable for loading subsequently using any of the load methods offered by this class.


save

public final void save(String userName)
                throws SmaException
Save a message bus descriptor to the default configuration repository.

Parameters:
userName - The name of the user on whose behalf this descriptor should be saved. This can be null in case no user specific information is to be written
Throws:
SmaException
Threading:
This method is notsafe for concurrent access by multiple threads.

This method saves a message bus descriptor to the default configuration respository. The descriptor is saved in a format suitable for loading subsequently using any of the load methods offered in this class.


save

public final void save()
                throws SmaException
Save a message bus descriptor to the default configuration repository.

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

This method invokes save((String)null)


delete

public final void delete(IConfigRepository repo)
                  throws SmaException
Delete a bus 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 bus descriptor from a configuration repository.


delete

public final void delete()
                  throws SmaException
Delete a message bus descriptor from the default configuration repository.

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 permanently deletes a message bus descriptor from the default 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)
Checks if a message bus 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.
Threading:
This method is safe for concurrent access by multiple threads.

exists

public static boolean exists(String busName)
Checks if a message bus is configured in the default configuration repository.

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

create

public static MessageBusDescriptor create(String name)
Create a default message bus descriptor.

Parameters:
name - The name of the bus whose descriptor is to be prepared.
Threading:
This method is safe for concurrent access by multiple threads.

load

public static MessageBusDescriptor load(IConfigRepository repo,
                                        String name,
                                        String userName)
                                 throws SmaException
Create a message bus descriptor from a configuration respository.

Parameters:
repo - The configuration repository from where to load the descriptor.
name - The name of the bus whose descriptor is to be prepared.
userName - The user for whom to create the descriptor. This can be null in case user specific information is not to be loaded.
Throws:
SmaException
Threading:
This method is safe for concurrent access by multiple threads.

load

public static MessageBusDescriptor load(String name,
                                        String userName)
                                 throws SmaException
Create a bus descriptor from the default configuration respository.

Parameters:
name - The name of the bus whose descriptor is to be prepared.
userName - The user for whom to create the descriptor. A null value will result in no user specific information is to be loaded.
Throws:
SmaException
Threading:
This method is safe for concurrent access by multiple threads.

load

public static MessageBusDescriptor load(String name)
                                 throws SmaException
Create a bus descriptor from the default configuration respository.

Parameters:
name - The name of the bus whose descriptor is to be prepared.
Throws:
SmaException
Threading:
This method is safe for concurrent access by multiple threads.

This method invokes load(name, null)


loadAll

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

Parameters:
repo - The configuration respository from where to create the buses.
userName - The user for whom to create the descriptors. This can be null in case no user specific information is to be loaded.
Returns:
Returns the set of bus descriptors.

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

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

loadAll

public static Set<MessageBusDescriptor> loadAll(String userName)
                                         throws SmaException
Create bus descriptors for all buses configured in the default configuration repository.

Parameters:
userName - The user for whom to return the descriptors. This can be null in case no user specific information is to be loaded.
Returns:
Returns the set of bus descriptors.

This method creates and initializes buses descriptors for all the buses configured in the default configuration repository.

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

loadAll

public static Set<MessageBusDescriptor> loadAll()
                                         throws SmaException
Create bus descriptors for all buses configured in the default configuration repository.

Returns:
Returns the set of bus descriptors.

This method invokes loadAll(null)

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


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