|
|
#ifndef PLUGIN_H #define PLUGIN_H #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <qstring.h> #include <qlist.h> #include "kdb.h" #include "object.h" namespace KDB { class Connection; class Capability; /** * A Plugin handles all connections related to a DBMS (Postgres, MySQL, and so on). * * This class allows traversal of the list of available connections, and can * be queryed about general informations and implemented capabilities trough @ref provides * * The Plugin is also responsible of creating "capability objects", that is * objects that can implement a specific capabilities. * * Actually whe have found the following capabilities: * @li Transactions (does not have a "capability object") * @li Reorganization, that is the ability of 'compressing' database objects after * a big number of deletes (does not have a "capability object") * @li Stored procedures * @li Administration * @li Users and Groups (ACL) * @li Views * @li Sequences * @li User defined functions * * @short Access point to a specific DBMS. */ class Plugin: public Object { Q_OBJECT public: typedef QListIterator<Connection> iterator; struct PluginInfo { QString name; QString description; QString version; QString author; QString e_mail; QString copyright; }; public: Plugin(const char * name = 0); virtual ~Plugin(); /** * returns the information about the plugin */ virtual PluginInfo info() = 0; /** * Create a connection, append it to the connection list, * open the connection and return it. */ Connection * openConnection (const QString &host, int port = 0, const QString &user = QString::null, const QString &password = QString::null); /** * same as connect, but does not perform the connection */ virtual Connection * addConnection (const QString &host, int port = 0, const QString &user = QString::null, const QString &password = QString::null); /** * removes a connection from the list of connections. * This will delete the connection, so make sure to not have * dangling reference to the connection */ void remove(Connection *); /** * return a connection to the specified host, or OL if no connection * to that host exists */ Connection * find(const QString &host); /** * returns an iterator that points to the first Connection * object */ iterator begin(); /** * returns true if the plugin can handle a given capability */ virtual bool provides(capability cap) = 0; /** * create an object that will handle the specific capability * if the plugin does not support a capability, an exception is thrown */ virtual Capability * createObject(capability cap) = 0; protected: // these member functions must be overridden by implementations virtual Connection *createConnection(const QString& host, int port) = 0; QList<Connection> m_connections; }; }; #endif
Generated by: pradu@server.rete.casa on Fri Jul 28 15:15:55 2000, using kdoc 2.0a36. |