[rhmessaging-commits] rhmessaging commits: r2183 - store/trunk/cpp/lib.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Jul 8 15:04:26 EDT 2008


Author: aconway
Date: 2008-07-08 15:04:25 -0400 (Tue, 08 Jul 2008)
New Revision: 2183

Modified:
   store/trunk/cpp/lib/StorePlugin.cpp
Log:
Revert un-necessary Plugin complications. Better solution for plugin extension points coming up...

Modified: store/trunk/cpp/lib/StorePlugin.cpp
===================================================================
--- store/trunk/cpp/lib/StorePlugin.cpp	2008-07-08 18:21:48 UTC (rev 2182)
+++ store/trunk/cpp/lib/StorePlugin.cpp	2008-07-08 19:04:25 UTC (rev 2183)
@@ -32,42 +32,46 @@
 namespace broker {
 
 using namespace std;
-using rhm::bdbstore::BdbMessageStore;
-struct StorePlugin : public PluginT<Broker> {
-    BdbMessageStore* store;
 
-    StorePlugin(BdbMessageStore* s) : store(s) {}
+struct StorePlugin : public Plugin {
 
-    void initializeT(Broker& broker) {
-        store->initManagement(&broker);
-    }
-};
-
-struct StorePluginFactory : public Plugin::FactoryT<Broker> {
     rhm::bdbstore::BdbMessageStore::Options options;
+    MessageStore *store;
 
     Options* getOptions() { return &options; }
 
-    boost::shared_ptr<Plugin> createT(Broker& broker) {
-        std::auto_ptr<BdbMessageStore> store(new BdbMessageStore());
-        if (options.storeDir.empty ()) {
-            DataDir& dataDir = broker.getDataDir ();
+    void earlyInitialize (Plugin::Target& target)
+    {
+        Broker* broker = dynamic_cast<Broker*>(&target);
+        store = new rhm::bdbstore::BdbMessageStore ();
+        DataDir& dataDir = broker->getDataDir ();
+
+        if (options.storeDir.empty ())
+        {
             if (!dataDir.isEnabled ())
                 throw Exception ("If --data-dir is blank or --no-data-dir is specified, "
                                  "--store-directory must be present.");
+
             options.storeDir = dataDir.getPath ();
         }
-        if (!store->init (&options)) {
+
+        if (!store->init (&options))
+        {
             throw Exception("Existing journal found in different bdb/async mode. "
                             "Move or delete existing data files before changing modes, or use "
                             "'--store-force yes' to discard existing data.");
         }
-        BdbMessageStore* storep=store.release();
-        broker.setStore(storep);
-        return make_shared_ptr(new StorePlugin(storep));
+
+        broker->setStore (store);
     }
+
+    void initialize(Plugin::Target& target)
+    {
+        Broker* broker = dynamic_cast<Broker*>(&target);
+        ((rhm::bdbstore::BdbMessageStore*) store)->initManagement (broker);
+    }
 };
 
-static StorePluginFactory instance; // Static initialization.
+static StorePlugin instance; // Static initialization.
     
 }} // namespace qpid::broker




More information about the rhmessaging-commits mailing list