summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/Plugin.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-07-08 22:58:37 +0000
committerAlan Conway <aconway@apache.org>2008-07-08 22:58:37 +0000
commit8c3baf496f9424249e2a666d79f0e3b38ba8d8fc (patch)
tree5fd950f023cacb47cf3cc9dc11aed91c94f380f8 /cpp/src/qpid/Plugin.h
parent391608a73f18a1797ab0c358f0a94364dc888eb2 (diff)
downloadqpid-python-8c3baf496f9424249e2a666d79f0e3b38ba8d8fc.tar.gz
HandlerChain: plug-in handler chain extension points. Replaces Handler<T>::Chain.
Updated Sessoin & Connection handler chains and Cluster. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@675017 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/Plugin.h')
-rw-r--r--cpp/src/qpid/Plugin.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/cpp/src/qpid/Plugin.h b/cpp/src/qpid/Plugin.h
index 3ead770129..a53d4e5d18 100644
--- a/cpp/src/qpid/Plugin.h
+++ b/cpp/src/qpid/Plugin.h
@@ -40,11 +40,17 @@ class Plugin : boost::noncopyable
public:
/**
* Base interface for targets that receive plug-ins.
- *
- * The Broker is a plug-in target, there might be others
- * in future.
+ * Plug-ins can register clean-up functions to execute when
+ * the target is destroyed.
*/
- struct Target { virtual ~Target() {} };
+ struct Target {
+ public:
+ virtual ~Target();
+ void addCleanup(const boost::function<void()>& cleanupFunction);
+
+ private:
+ std::vector<boost::function<void()> > cleanup;
+ };
typedef std::vector<Plugin*> Plugins;
@@ -69,7 +75,9 @@ class Plugin : boost::noncopyable
virtual Options* getOptions();
/**
- * Initialize Plugin functionality on a Target.
+ * Initialize Plugin functionality on a Target, called before
+ * initializing the target.
+ *
* Plugins should ignore targets they don't recognize.
*
* Called before the target itself is initialized.
@@ -77,7 +85,9 @@ class Plugin : boost::noncopyable
virtual void earlyInitialize(Target&) = 0;
/**
- * Initialize Plugin functionality on a Target.
+ * Initialize Plugin functionality on a Target. Called after
+ * initializing the target.
+ *
* Plugins should ignore targets they don't recognize.
*
* Called after the target is fully initialized.
@@ -89,6 +99,12 @@ class Plugin : boost::noncopyable
*/
static const Plugins& getPlugins();
+ /** Call earlyInitialize() on all registered plugins */
+ static void earlyInitAll(Target&);
+
+ /** Call initialize() on all registered plugins */
+ static void initAll(Target&);
+
/** For each registered plugin, add plugin.getOptions() to opts. */
static void addOptions(Options& opts);
};