1 /*-----------------------------------------------------------------------------
 2 Name:      QueueFactory.h
 3 Project:   xmlBlaster.org
 4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
 5 Comment:   Factory to create different queue implementations
 6 -----------------------------------------------------------------------------*/
 7 
 8 #ifndef _UTIL_PARSER_PARSERFACTORY_H
 9 #define _UTIL_PARSER_PARSERFACTORY_H
10 
11 #include <util/xmlBlasterDef.h>
12 #include <util/queue/I_Queue.h>
13 #include <util/qos/storage/QueuePropertyBase.h>
14 #include <util/Global.h>
15 
16 namespace org { namespace xmlBlaster { namespace util { namespace queue {
17     
18 /**
19  * Abstraction for the queue implementations. 
20  * <p />
21  * You may use this as the interface to implement your own persistent, RAM or cache based queues.
22  * <p />
23  * It is a singleton class and has for
24  * that reason private constructors, destructor and assignment operator. 
25  * To get a reference to the singleton instance you must invoke getFactory(...).
26  */
27 class Dll_Export QueueFactory {
28    friend class org::xmlBlaster::util::Global; // g++ 2.95.3 warning: `class org::xmlBlaster::util::queue::QueueFactory' only defines private constructors and has no friends
29 
30    private:
31    const std::string ME;
32    static QueueFactory* factory_;
33    
34    QueueFactory();
35    QueueFactory(const QueueFactory& factory);
36    QueueFactory& operator =(const QueueFactory& factory);
37 
38    public:
39    ~QueueFactory();
40 
41    /**
42     * Static access to the factory. 
43     * @exception XmlBlasterException
44     */
45    static QueueFactory& getFactory();
46 
47    /**
48     * Creates a queue implementation. It is the responsibility of the user to delete the I_Queue
49     * object once it is not needed anymore by calling <code>releasePlugin()</code>. 
50     * @param property The configuration settings
51     * @param type The queue type, for example "RAM", "SQLite", if empty the setting from argument 'property' is used
52     * @param version The queue version, defaults to "1.0", if empty the setting from argument 'property' is used
53     * @throws XmlBlasterException: "resource.configuration.pluginFailed" if plugin is not known or other errorCodes if it can't be initialized. 
54     */
55    I_Queue& getPlugin(org::xmlBlaster::util::Global& global, const org::xmlBlaster::util::qos::storage::QueuePropertyBase& property,
56                       const std::string& type="", const std::string& version="");
57 
58    /**
59     * After calling this the <code>queue</code> argument in not usable anymore. 
60     */
61    void releasePlugin(I_Queue *queueP); /*const std::string& type="RAM", const std::string& version="1.0");*/
62 };
63 
64 }}}} // namespace
65 
66 #endif


syntax highlighted by Code2HTML, v. 0.9.1