Author: aconway
Date: Mon Jan 14 06:55:08 2008
New Revision: 611822

URL: http://svn.apache.org/viewvc?rev=611822&view=rev
Log:
Apply patch from QPID-732 by Ted Ross.

 The attached patch provides support for plugin modules in the C++ broker.

  - Plugins are supported (--load <lib>, --load-dir <dir> options provided)
  - Command options may be extended by plugins.
  - A workaround was added to make config-file parsing tolerant of unregistered 
options.
  - Store-specific options were removed so they can be supplied by a plugin
  - A pre-log facility was introduced so log messages can be generated prior to 
the initialization of the logging module.

File-by-file details:

M cpp/src/qpidd.cpp

    Added support for loadable plugin modules. This involves a
    two-phased handling of command line/config options. Phase-1
    determines which modules to load and phase-2 is based on all of
    the command-line options supplied by qpidd and the loaded
    plugins.

M cpp/src/Makefile.am

    Added dependency for boost_filesystem library.

M cpp/src/qpid/Plugin.h

    Added 'earlyInitialize' method. Plugins are now initialized at
    two points: earlyInitialize is called prior to broker
    initialization and initialize is called at the end of broker
    init. This allows modules like the store to be hooked in early
    and other modules to be able to assume that the broker target is
    fully functional.

M cpp/src/qpid/cluster/ClusterPlugin.cpp

    Added stub for the new pure-virtual earlyInitialize method.

M cpp/src/qpid/Options.h
M cpp/src/qpid/Options.cpp

    Added 'allowUnknown' option in the parse method. This is needed
    in phase-1 command processing when there are options for
    not-yet-loaded plugin modules.

    Because the stable version of boost does not permit 'allowUnknown'
    for config files, a workaround has been implemented in this module
    to pre-filter the config file text removing lines that represent
    unknown options.

M cpp/src/qpid/broker/Broker.h
M cpp/src/qpid/broker/Broker.cpp

    Removed all store-specific command options. Updated logic to
    allow the store to be a plugin module.

M cpp/src/qpid/broker/DtxManager.h
M cpp/src/qpid/broker/DtxManager.cpp
M cpp/src/qpid/broker/QueueRegistry.h
M cpp/src/qpid/broker/QueueRegistry.cpp

    Changed API to these classes such that the store is no longer
    supplied in the constructor but is supplied later, before any
    operations are called for.

M cpp/src/qpid/broker/MessageStoreModule.h
M cpp/src/qpid/broker/MessageStoreModule.cpp

    This module is still needed to provide "exception transfer"
    service. It was changed to not load the store module but rather
    use the already-loaded plugin store.

Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h?rev=611822&r1=611821&r2=611822&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h Mon Jan 14 06:55:08 
2008
@@ -59,6 +59,7 @@
 class Broker : public sys::Runnable, public Plugin::Target, public 
management::Manageable
 {
   public:
+
     struct Options : public qpid::Options {
         Options(const std::string& name="Broker Options");
         
@@ -66,13 +67,7 @@
         int workerThreads;
         int maxConnections;
         int connectionBacklog;
-        std::string store;      
-        long stagingThreshold;
-        string storeDir;
-        bool storeAsync;
-        bool storeForce;
-        u_int16_t numJrnlFiles;
-        u_int32_t jrnlFsizePgs;
+        uint64_t stagingThreshold;
         bool enableMgmt;
         uint16_t mgmtPubInterval;
         uint32_t ack;
@@ -109,7 +104,8 @@
     
     /** Apply all handler updaters to a handler chain pair. */
     void update(framing::ChannelId, framing::FrameHandler::Chains&); 
-    
+
+    void setStore (MessageStore*);
     MessageStore& getStore() { return *store; }
     QueueRegistry& getQueues() { return queues; }
     ExchangeRegistry& getExchanges() { return exchanges; }
@@ -128,7 +124,7 @@
 
     Options config;
     sys::Acceptor::shared_ptr acceptor;
-    const std::auto_ptr<MessageStore> store;
+    MessageStore* store;
     typedef std::vector<shared_ptr<framing::HandlerUpdater> > HandlerUpdaters;
 
     QueueRegistry queues;
@@ -141,7 +137,6 @@
     management::Broker::shared_ptr mgmtObject;
     Vhost::shared_ptr              vhostObject;
 
-    static MessageStore* createStore(const Options& config);
     void declareStandardExchange(const std::string& name, const std::string& 
type);
 };
 


Reply via email to