00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 #include <string>
00025 #include <vector>
00026 #include <map>
00027
00028 #include <drizzled/visibility.h>
00029 #include <drizzled/common_fwd.h>
00030
00031 namespace drizzled {
00032 namespace plugin {
00033
00034 class DRIZZLED_API Plugin : boost::noncopyable
00035 {
00036 private:
00037 const std::string _name;
00038 bool _is_active;
00039 module::Module *_module;
00040 const std::string _type_name;
00041
00042 public:
00043 typedef std::pair<const std::string, const std::string> map_key;
00044 typedef std::map<const map_key, plugin::Plugin *> map;
00045 typedef std::vector<Plugin *> vector;
00046
00047 explicit Plugin(const std::string &name, const std::string &type_name);
00048 virtual ~Plugin() {}
00049
00050
00051
00052
00053
00054
00055 virtual void shutdownPlugin()
00056 {
00057 }
00058
00059
00060 virtual void prime()
00061 {
00062 }
00063
00064 virtual void startup(drizzled::Session &)
00065 {
00066 }
00067
00068 void activate()
00069 {
00070 _is_active= true;
00071 }
00072
00073 void deactivate()
00074 {
00075 _is_active= false;
00076 }
00077
00078 bool isActive() const
00079 {
00080 return _is_active;
00081 }
00082
00083 const std::string &getName() const
00084 {
00085 return _name;
00086 }
00087
00088 void setModule(module::Module *module)
00089 {
00090 _module= module;
00091 }
00092
00093 const std::string& getTypeName() const
00094 {
00095 return _type_name;
00096 }
00097
00098 virtual bool removeLast() const
00099 {
00100 return false;
00101 }
00102
00103 const std::string& getModuleName() const;
00104 };
00105 }
00106 }
00107