您的位置:首页 > 其它

(四)SDN 控制器 NOX 源码分析之—— DSO-deployer

2015-06-15 13:43 127 查看
DSO_component_context
组件的上下文类,保存组件的运行状态及组件的实例
构造函数:
DSO_component_context::DSO_component_context(const Component_name& name, const std::string& config_path)
构造函数初始化组件的状态与状态对应触发的事件句柄;并将依赖组件列表初始化到【dependencies】成员变量中

接口:
void DSO_component_context::load()
用途是得到组件句柄,句柄保存在变量DSO_component_context::handle中
DSO_component_context::instantiate_factory()
这一句与组件实现时必须在最后加REGISTER_COMPONENT(Simple_component_factory<组件名>, 组件名)有关系,通过这个调用可以得到生成组件实例的工厂方法;
void DSO_component_context::instantiate()
为当前组件上下文对象生成组件实例
void DSO_component_context::configure()
配置当前组件上下文对象中已经包含的组件实例
void DSO_component_context::install()
启动组件上下文中的组件实例
DSO_component_context::component_factory_function* DSO_component_context::find_factory_function(const char* name) const
被DSO_component_context::instantiate_factory()所调用,作用是从动态加载的组件中找到“name”对应的函数名句柄
成员变量:

DSO_deployer
动态部署器是用来管理动态加载的组件的。当它被构造时就会对动态组件目录进行遍历,将所有的组件都添加到管理成员中

构造函数:
DSO_deployer::DSO_deployer(const Component_context* ctxt, const list<string>& lib_dirs)
1.将lib_dirs下所有应用程序目录(含meta.json)扫一遍;
2.把所有扫到的组件生成DSO_component_context实例,保存到【uninstalled_contexts】成员变量中;
3.将此deployer保存到kernel的部署器列表中;

接口:
Component* DSO_deployer :: instantiate(const Component_context* ctxt, const Path_list& lib_search_paths)

得到DSO_Deployer实例;这个方法必须配合Static_component_context类使用才

(转载请注明出处:/article/8588338.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: