diff options
| author | Alan Conway <aconway@apache.org> | 2007-07-19 21:52:24 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2007-07-19 21:52:24 +0000 |
| commit | cb566519d58ded6704507fa5530bf901e620edf6 (patch) | |
| tree | ab4b29ddd0ad2b5e9015647e379bede84163b13e /cpp/src/qpid/Plugin.h | |
| parent | 3f900af77d5f781431dc25e307974e0fc27aa561 (diff) | |
| download | qpid-python-cb566519d58ded6704507fa5530bf901e620edf6.tar.gz | |
* Summary:
- Connect cluster handlers into broker handler chains.
- Progress on wiring replication.
* src/tests/cluster.mk: Temporarily disabled Cluster test.
* src/tests/Cluster.h, cpp, Cluster_child.cpp: Updated to use UUIDs.
* src/qpidd.cpp:
- Load optional libs (cluster)
- Include plugin config in options.parse.
* src/qpid/cluster/SessionManager.h:
- Create sessions, update handler chains (as HandlerUpdater)
- Handle frames from cluster.
* src/qpid/cluster/ClusterPlugin.h, .cpp:
- renamed from ClusterPluginProvider
- Create and connect Cluster and SessionManager.
- Register SessionManager as HandlerUpdater.
* src/qpid/cluster/Cluster.h, .cpp: Refactor as SessionFrameHandler.
* src/qpid/broker/Connection.cpp: Apply HandlerUpdaters.
* src/qpid/broker/Broker.h, .cpp:
- Initialize plugins
- Apply HandlerUpdaters
* src/qpid/Plugin.h, .cpp: Simplified plugin framework.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@557788 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/Plugin.h')
| -rw-r--r-- | cpp/src/qpid/Plugin.h | 66 |
1 files changed, 26 insertions, 40 deletions
diff --git a/cpp/src/qpid/Plugin.h b/cpp/src/qpid/Plugin.h index f50e97eb00..e684d238a3 100644 --- a/cpp/src/qpid/Plugin.h +++ b/cpp/src/qpid/Plugin.h @@ -32,70 +32,56 @@ namespace qpid { class Options; -/** Generic base class to allow dynamic casting of generic Plugin objects - * to concrete types. - */ -struct Plugin : private boost::noncopyable { - virtual ~Plugin() {} -}; - -/** Generic interface for anything that uses plug-ins. */ -struct PluginUser : boost::noncopyable { - virtual ~PluginUser() {} - /** - * Called by a PluginProvider to provide a plugin. - * - * A concrete PluginUser will dynamic_pointer_cast plugin to a - * class it knows how to use. A PluginUser should ignore plugins - * it does not recognize. - * - * The user will release its shared_ptr when it is finished using - * plugin. - */ - virtual void use(const shared_ptr<Plugin>& plugin) = 0; -}; - /** - * Base for classes that provide plug-ins. + * Plug-in base class. */ -class PluginProvider : boost::noncopyable +class Plugin : boost::noncopyable { public: /** - * Register the provider to appear in getProviders() + * Base interface for targets that receive plug-ins. + * + * The Broker is a plug-in target, there might be others + * in future. + */ + struct Target { virtual ~Target() {} }; + + typedef std::vector<Plugin*> Plugins; + + /** + * Construct registers the plug-in to appear in getPlugins(). * - * A concrete PluginProvider is instantiated as a global or static + * A concrete Plugin is instantiated as a global or static * member variable in a library so it is registered during static * initialization when the library is loaded. */ - PluginProvider(); + Plugin(); - virtual ~PluginProvider(); + virtual ~Plugin(); /** - * Returns configuration options for the plugin. + * Configuration options for the plugin. * Then will be updated during option parsing by the host program. * * @return An options group or 0 for no options. Default returns 0. - * PluginProvider retains ownership of return value. + * Plugin retains ownership of return value. */ virtual Options* getOptions(); - /** Provide plugins to a PluginUser. + /** + * Initialize Plugin functionality on a Target. * - * The provider can dynamic_cast the user if it only provides - * plugins to certain types of user. Providers should ignore - * users they don't recognize. + * Plugins should ignore targets they don't recognize. */ - virtual void provide(PluginUser& user) = 0; + virtual void initialize(Target&) = 0; - /** Get the list of pointers to the registered providers. - * Caller must not delete the pointers. + /** List of registered Plugin objects. + * Caller must not delete plugin pointers. */ - static const std::vector<PluginProvider*>& getProviders(); + static const Plugins& getPlugins(); private: - static std::vector<PluginProvider*> providers; + static Plugins plugins; }; } // namespace qpid |
