Cumulus4j API
(1.0.0)

org.cumulus4j.store.crypto.keymanager.messagebroker
Class MessageBrokerRegistry

java.lang.Object
  extended by org.cumulus4j.store.crypto.keymanager.messagebroker.MessageBrokerRegistry

public class MessageBrokerRegistry
extends Object

JVM-singleton to access the active message-broker. It handles the registration and instantiation of MessageBroker implementations.

Author:
Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de

Field Summary
static String SYSTEM_PROPERTY_ACTIVE_MESSAGE_BROKER
          The system property configuring which message-broker-implementation is to be used.
 
Constructor Summary
MessageBrokerRegistry()
           
 
Method Summary
 MessageBroker getActiveMessageBroker()
          Get the active MessageBroker.
 void setActiveMessageBroker(MessageBroker messageBroker)
          Set the active MessageBroker.
static MessageBrokerRegistry sharedInstance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSTEM_PROPERTY_ACTIVE_MESSAGE_BROKER

public static final String SYSTEM_PROPERTY_ACTIVE_MESSAGE_BROKER
The system property configuring which message-broker-implementation is to be used. If it is not specified, a list of known implementations is tried out and the first one which could be instantiated successfully is used.

See Also:
Constant Field Values
Constructor Detail

MessageBrokerRegistry

public MessageBrokerRegistry()
Method Detail

sharedInstance

public static MessageBrokerRegistry sharedInstance()

getActiveMessageBroker

public MessageBroker getActiveMessageBroker()
Get the active MessageBroker. All Messages are transmitted over this active instance. If there is no active MessageBroker, yet, this method will check the system property "cumulus4j.MessageBrokerRegistry.activeMessageBroker" and either instantiate the class configured there or iterate a list of known MessageBroker-implementation-classes.

Returns:
the active MessageBroker; never null. If no active message-broker is set and none can be instantiated, an exception is thrown.

setActiveMessageBroker

public void setActiveMessageBroker(MessageBroker messageBroker)
Set the active MessageBroker. Whatever is passed here will be returned by getActiveMessageBroker() except for null. Setting null will cause getActiveMessageBroker() to perform a re-initialisation (i.e. instantiate a MessageBroker as needed).

Parameters:
messageBroker - the MessageBroker instance to be set or null to clear the current one.

Cumulus4j API
(1.0.0)

Copyright © 2012 NightLabs Consulting GmbH. All Rights Reserved.