some work on dependency injection

git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1147 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2018-11-21 17:51:15 +00:00
parent a2ffc1e81c
commit 89d303f375
64 changed files with 1734 additions and 1161 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2018, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,9 +38,11 @@
#include "createthread.h"
#include "showthreads.h"
#include "core/log.h"
#include "core/plugin.h"
#include "pluginmsg.h"
#include "templates.h"
#include "functions/functions.h"
namespace Winix
{
@@ -124,7 +126,7 @@ void SetSortTab(PluginInfo & info)
{
if( !info.p1 )
{
log << log1 << "Thread: sort_tab pointer is not set" << logend;
info.log << log1 << "Thread: sort_tab pointer is not set" << logend;
return;
}
@@ -168,9 +170,9 @@ void Rescan(PluginInfo & info)
{
if( info.config->Bool(L"thread_rescan", false) == true )
{
log << log1 << "---------- rescanning thread db ------------- " << logend;
info.log << log1 << "---------- rescanning thread db ------------- " << logend;
thread_info.Repair();
log << log1 << "---------- thread db rescanning is finished ------------- " << logend;
info.log << log1 << "---------- thread db rescanning is finished ------------- " << logend;
}
}
@@ -185,27 +187,29 @@ void Init(PluginInfo & info)
{
using namespace Thread;
plugin.Assign(WINIX_CREATE_FUNCTIONS, AddFunctions);
plugin.Assign(WINIX_SELECT_DEFAULT_FUNCTION, SelectDefaultFunction);
plugin.Assign(WINIX_ADD_MOUNTS, AddMounts);
plugin.Assign(WINIX_FILE_REMOVED, RemoveThread);
plugin.Assign(WINIX_NOTIFY_ADD_TEMPLATE, AddNotifyTemplate);
plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
plugin.Assign(WINIX_END_REQUEST, EndRequest);
info.plugin->Assign(WINIX_CREATE_FUNCTIONS, AddFunctions);
info.plugin->Assign(WINIX_SELECT_DEFAULT_FUNCTION, SelectDefaultFunction);
info.plugin->Assign(WINIX_ADD_MOUNTS, AddMounts);
info.plugin->Assign(WINIX_FILE_REMOVED, RemoveThread);
info.plugin->Assign(WINIX_NOTIFY_ADD_TEMPLATE, AddNotifyTemplate);
info.plugin->Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
info.plugin->Assign(WINIX_END_REQUEST, EndRequest);
// for other plugins
plugin.Assign(WINIX_PL_THREAD_SET_SORTTAB, SetSortTab);
plugin.Assign(WINIX_PL_THREAD_READ_THREADS, ReadThreads);
plugin.Assign(WINIX_PL_THREAD_SET_SORTTAB_INDEX, SetSortTabIndex);
plugin.Assign(WINIX_PL_THREAD_PREPARE_THREAD, PrepareThread);
info.plugin->Assign(WINIX_PL_THREAD_SET_SORTTAB, SetSortTab);
info.plugin->Assign(WINIX_PL_THREAD_READ_THREADS, ReadThreads);
info.plugin->Assign(WINIX_PL_THREAD_SET_SORTTAB_INDEX, SetSortTabIndex);
info.plugin->Assign(WINIX_PL_THREAD_PREPARE_THREAD, PrepareThread);
// temporarily
plugin.Assign(WINIX_PLUGIN_INIT, Rescan);
info.plugin->Assign(WINIX_PLUGIN_INIT, Rescan);
tdb.SetConn(info.db->GetConn());
tdb.LogQueries(info.config->log_db_query);
// thread_info and fun_show_threads are used in 'ticket' plugins too
info.set_dependency_for(thread_info);
thread_info.SetDb(info.db);
thread_info.SetTDb(&tdb);
thread_info.SetSystem(info.system);