1 //******************************************************************
3 // Copyright 2014 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
26 #ifndef __PLUGINMANAGERIMPL_H__
27 #define __PLUGINMANAGERIMPL_H__
30 #include "CpluffAdapter.h"
33 #include "FelixAdapter.h"
38 class PluginManagerImpl
43 * Constructor for PluginManagerImpl.
44 * During construction time, all plugins under the root plugin path will be loaded.
47 PluginManagerImpl(void* args);
52 virtual ~PluginManagerImpl(void);
56 * A function to register pluins in the path.
57 * This function will load plugins in plugin manager table.
59 * @param path plugin file path to be registered.
60 * @return int, 1 is success, 0 is fail.
65 int registerPlugin(std::string path);
70 * A function to register pluins in the path.
71 * This function will load plugins in plugin manager table.
73 * @param path plugin file path to be registered.
74 * recursive load plugins sub folders recursively.
75 * @return int, 1 is success, 0 is fail.
80 int registerAllPlugin(std::string path);
85 * @param plugin plugin object to be unregistered.
86 * @return int, 1 is success, 0 is fail.
88 int unregisterPlugin(std::string path);
91 * Unregister All plugin.
93 * @return int, 1 is success, 0 is fail.
95 int unregisterAllPlugin(void);
98 * find plugins which have the key and value
100 * @return vector of currently registered plugins
102 std::vector<Plugin> *findPlugins(const std::string key, const std::string value);
105 * Get plugin which has the id
107 * @param pluginID plugin id to find
108 * @return Plugin instance
110 Plugin *getPlugin(const std::string pluginID);
113 * Check whether the plugin started or not
115 * @param Plugin to identify the Starting.
116 * @return true if started, false is stop.
119 bool isStarted(Plugin *plugin);
125 * @return Plugin state.
127 virtual std::string getState(const std::string plugID);
130 * Start plugins by resource type
132 * @param type resouce type string to be started.
135 virtual int startPlugins(const std::string key, const std::string value);
138 * Stop plugins by resource type
140 * @param type resouce type string to be started.
143 virtual int stopPlugins(const std::string key, const std::string value);
147 * This function will load dynamic plugin library on memory and call start function of plugin to be initialized.
150 * @return int, 1 is success, 0 is fail.
152 int startPlugins(Plugin *const plugin);
157 * This function will call stop function of plugin and unload dynamic plugin library from memory.
160 * @return int, 1 is success, 0 is fail.
162 int stopPlugins(Plugin *const plugin);
166 * This function will call rescan function of plugins in the configuration folder
169 * @return int, 1 is success, 0 is fail.
171 virtual int rescanPlugin();
174 * get all plugins which currently registered.
176 * @return vector of currently registered plugins
179 virtual std::vector<Plugin> &getAllPlugins(void);
181 static PluginManagerImpl *Getinstance(void *arg)
183 if (NULL == s_pinstance)
185 s_pinstance = new PluginManagerImpl(arg);
195 FelixAdapter *javappm;
198 std::vector<Plugin> m_plugins;
199 static PluginManagerImpl *s_pinstance;
201 static void deleteinstance()
203 if (NULL != s_pinstance)
211 * refresh All Plugin information.
213 * @return vector<Plugin> is all Plugin.
215 std::vector<Plugin> refreshPluginInfo();
218 * Start plugin by platform.
219 * This function will load dynamic plugin library on memory and call start function of plugin to be initialized.
222 * @param Platform pointer.
223 * @return int, 1 is success, 0 is fail.
225 int startbyPlatform(Plugin *const plugin, void *const arg);
228 * Stop Plugin by platform.
229 * This function will call stop function of plugin and unload dynamic plugin library from memory.
232 * @return int, 1 is success, 0 is fail.
234 int stopbyPlatform(Plugin *const plugin);
238 #endif //__PLUGINMANAGERIMPL_H__