diff --git a/code/nel/tools/pipeline/service/module_pipeline_master.cpp b/code/nel/tools/pipeline/service/module_pipeline_master.cpp index 123155549..35005a484 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_master.cpp +++ b/code/nel/tools/pipeline/service/module_pipeline_master.cpp @@ -73,6 +73,7 @@ class CModulePipelineMaster : std::vector Vector; uint32 ActiveTaskId; bool SheetsOk; + std::vector PluginsAvailable; ~CSlave() { @@ -203,6 +204,12 @@ public: g_DatabaseStatus->updateDatabaseStatus(CCallback(slave, &CSlave::cbUpdateDatabaseStatus), slave->Vector, false, false); slave->Vector.clear(); } + + void setAvailablePlugins(NLNET::IModuleProxy *sender, const std::vector &pluginsAvailable) + { + CSlave *slave = m_Slaves[sender]; + slave->PluginsAvailable = pluginsAvailable; + } protected: NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CModulePipelineMaster, CModuleBase) @@ -221,6 +228,7 @@ protected: { CSlave *slave = it->second; slave->SheetsOk = false; + slave->PluginsAvailable.clear(); slave->Proxy.reloadSheets(this); CInfoFlags::getInstance()->addFlag(PIPELINE_INFO_MASTER_RELOAD_SHEETS); } diff --git a/code/nel/tools/pipeline/service/module_pipeline_master_itf.cpp b/code/nel/tools/pipeline/service/module_pipeline_master_itf.cpp index b0ebfc06b..3de223215 100644 Binary files a/code/nel/tools/pipeline/service/module_pipeline_master_itf.cpp and b/code/nel/tools/pipeline/service/module_pipeline_master_itf.cpp differ diff --git a/code/nel/tools/pipeline/service/module_pipeline_master_itf.h b/code/nel/tools/pipeline/service/module_pipeline_master_itf.h index b3d159e5f..7dd4bd265 100644 Binary files a/code/nel/tools/pipeline/service/module_pipeline_master_itf.h and b/code/nel/tools/pipeline/service/module_pipeline_master_itf.h differ diff --git a/code/nel/tools/pipeline/service/module_pipeline_master_itf.xml b/code/nel/tools/pipeline/service/module_pipeline_master_itf.xml index 2ce5c5d78..7b3fe75e6 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_master_itf.xml +++ b/code/nel/tools/pipeline/service/module_pipeline_master_itf.xml @@ -31,6 +31,12 @@ + + + + + + diff --git a/code/nel/tools/pipeline/service/module_pipeline_slave.cpp b/code/nel/tools/pipeline/service/module_pipeline_slave.cpp index 620f69ea0..2afd180a5 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_slave.cpp +++ b/code/nel/tools/pipeline/service/module_pipeline_slave.cpp @@ -96,10 +96,11 @@ public: nlinfo("Master UP (%s)", moduleProxy->getModuleName().c_str()); nlassert(m_Master == NULL); - - // TODO: SAY HELLO m_Master = new CModulePipelineMasterProxy(moduleProxy); + + // TODO: AUTHENTICATE OR GATEWAY SECURITY? + sendMasterAvailablePlugins(); } } @@ -132,6 +133,7 @@ public: if (PIPELINE::isServiceStateIdle()) { m_ReloadSheetsState = REQUEST_NONE; + sendMasterAvailablePlugins(); m_Master->slaveReloadedSheets(this); CInfoFlags::getInstance()->removeFlag(PIPELINE_INFO_SLAVE_RELOAD_SHEETS); } @@ -163,6 +165,13 @@ public: if (PIPELINE::reloadSheets()) m_ReloadSheetsState = REQUEST_WORKING; else m_ReloadSheetsState = REQUEST_MADE; } + + void sendMasterAvailablePlugins() + { + std::vector availablePlugins; + g_PipelineWorkspace->listAvailablePlugins(availablePlugins); + m_Master->setAvailablePlugins(this, availablePlugins); + } protected: NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CModulePipelineSlave, CModuleBase) diff --git a/code/nel/tools/pipeline/service/pipeline_service.cpp b/code/nel/tools/pipeline/service/pipeline_service.cpp index abf4d459e..3370b59ed 100644 --- a/code/nel/tools/pipeline/service/pipeline_service.cpp +++ b/code/nel/tools/pipeline/service/pipeline_service.cpp @@ -72,6 +72,7 @@ bool g_IsMaster = false; NLGEORGES::UFormLoader *g_FormLoader = NULL; CPipelineWorkspace *g_PipelineWorkspace = NULL; CDatabaseStatus *g_DatabaseStatus = NULL; +CPipelineInterfaceImpl *g_PipelineInterfaceImpl = NULL; std::string unMacroPath(const std::string &path) { @@ -119,7 +120,6 @@ enum EState /// Data CInfoFlags *s_InfoFlags = NULL; CTaskManager *s_TaskManager = NULL; -CPipelineInterfaceImpl *s_PipelineInterfaceImpl = NULL; CPipelineProcessImpl *s_PipelineProcessImpl = NULL; EState s_State = STATE_IDLE; @@ -390,7 +390,7 @@ public: g_DatabaseStatus = new CDatabaseStatus(); - s_PipelineInterfaceImpl = new CPipelineInterfaceImpl(); + g_PipelineInterfaceImpl = new CPipelineInterfaceImpl(); s_PipelineProcessImpl = new CPipelineProcessImpl(NULL); // Create a singleton impl for global usage without running project for test purposes. // Load libraries @@ -442,8 +442,8 @@ public: delete s_PipelineProcessImpl; s_PipelineProcessImpl = NULL; - delete s_PipelineInterfaceImpl; - s_PipelineInterfaceImpl = NULL; + delete g_PipelineInterfaceImpl; + g_PipelineInterfaceImpl = NULL; delete g_DatabaseStatus; g_DatabaseStatus = NULL; @@ -567,7 +567,7 @@ NLMISC_COMMAND(listProcessPlugins, "List process plugins.", "") switch (it->HandlerType) { case PIPELINE::PLUGIN_REGISTERED_CLASS: - if (std::find(PIPELINE::s_PipelineInterfaceImpl->RegisteredClasses.begin(), PIPELINE::s_PipelineInterfaceImpl->RegisteredClasses.end(), it->Handler) != PIPELINE::s_PipelineInterfaceImpl->RegisteredClasses.end()) + if (std::find(PIPELINE::g_PipelineInterfaceImpl->RegisteredClasses.begin(), PIPELINE::g_PipelineInterfaceImpl->RegisteredClasses.end(), it->Handler) != PIPELINE::g_PipelineInterfaceImpl->RegisteredClasses.end()) statusHandler = "AVAILABLE"; else statusHandler = "NOT FOUND"; @@ -579,7 +579,7 @@ NLMISC_COMMAND(listProcessPlugins, "List process plugins.", "") std::string statusInfo; switch (it->InfoType) { - case PIPELINE::PLUGIN_REGISTERED_CLASS:if (std::find(PIPELINE::s_PipelineInterfaceImpl->RegisteredClasses.begin(), PIPELINE::s_PipelineInterfaceImpl->RegisteredClasses.end(), it->Info) != PIPELINE::s_PipelineInterfaceImpl->RegisteredClasses.end()) + case PIPELINE::PLUGIN_REGISTERED_CLASS:if (std::find(PIPELINE::g_PipelineInterfaceImpl->RegisteredClasses.begin(), PIPELINE::g_PipelineInterfaceImpl->RegisteredClasses.end(), it->Info) != PIPELINE::g_PipelineInterfaceImpl->RegisteredClasses.end()) statusInfo = "AVAILABLE"; else statusInfo = "NOT FOUND"; diff --git a/code/nel/tools/pipeline/service/pipeline_service.h b/code/nel/tools/pipeline/service/pipeline_service.h index 3915d6a65..145749d65 100644 --- a/code/nel/tools/pipeline/service/pipeline_service.h +++ b/code/nel/tools/pipeline/service/pipeline_service.h @@ -47,6 +47,7 @@ namespace NLGEORGES { namespace PIPELINE { class CPipelineWorkspace; class CDatabaseStatus; + class CPipelineInterfaceImpl; #define PIPELINE_MASTER @@ -81,6 +82,7 @@ bool reloadSheets(); extern NLGEORGES::UFormLoader *g_FormLoader; extern CPipelineWorkspace *g_PipelineWorkspace; extern CDatabaseStatus *g_DatabaseStatus; +extern CPipelineInterfaceImpl *g_PipelineInterfaceImpl; } /* namespace PIPELINE */ diff --git a/code/nel/tools/pipeline/service/pipeline_workspace.cpp b/code/nel/tools/pipeline/service/pipeline_workspace.cpp index efd1b7131..b85172615 100644 --- a/code/nel/tools/pipeline/service/pipeline_workspace.cpp +++ b/code/nel/tools/pipeline/service/pipeline_workspace.cpp @@ -37,6 +37,8 @@ // Project includes #include "pipeline_project.h" +#include "pipeline_service.h" +#include "pipeline_interface_impl.h" using namespace std; // using namespace NLMISC; @@ -113,7 +115,7 @@ CPipelineWorkspace::~CPipelineWorkspace() m_Projects.clear(); } -void CPipelineWorkspace::getProcessPlugins(std::vector &result, const std::string &process) +void CPipelineWorkspace::getProcessPlugins(std::vector &resultAppend, const std::string &process) { uint16 pluginId = 0; for (std::vector >::iterator it = m_Plugins.begin(), end = m_Plugins.end(); it != end; ++it) @@ -145,7 +147,7 @@ void CPipelineWorkspace::getProcessPlugins(std::vector &resu processPlugin.InfoType = (TPluginType)infoType; processPlugin.Id.Sub.Plugin = pluginId; processPlugin.Id.Sub.Handler = i; - result.push_back(processPlugin); + resultAppend.push_back(processPlugin); nldebug("Found '%s': '%s', '%s'", process.c_str(), processPlugin.Handler.c_str(), processPlugin.Info.c_str()); } @@ -203,6 +205,93 @@ bool CPipelineWorkspace::getProcessPlugin(CProcessPluginInfo &result, uint32 glo else return false; } +void CPipelineWorkspace::listAvailablePlugins(std::vector &result) +{ + result.clear(); + uint16 pluginId = 0; + for (std::vector >::iterator it = m_Plugins.begin(), end = m_Plugins.end(); it != end; ++it) + { + UFormElm *processHandlers; + if ((*it)->getRootNode().getNodeByName(&processHandlers, "ProcessHandlers")) + { + uint nb; + processHandlers->getArraySize(nb); + for (uint i = 0; i < nb; ++i) + { + UFormElm *handler; + if (processHandlers->getArrayNode(&handler, i)) + { + std::string handlerProcess; + if (handler->getValueByName(handlerProcess, "Process")) + { + CProcessPluginInfo processPlugin; + uint32 handlerType; + uint32 infoType; + if (handler->getValueByName(handlerType, "HandlerType") + && handler->getValueByName(processPlugin.Handler, "Handler") + && handler->getValueByName(infoType, "InfoType") + && handler->getValueByName(processPlugin.Info, "Info")) + { + processPlugin.HandlerType = (TPluginType)handlerType; + processPlugin.InfoType = (TPluginType)infoType; + processPlugin.Id.Sub.Plugin = pluginId; + processPlugin.Id.Sub.Handler = i; + + bool handlerAvailable = false; + switch (processPlugin.HandlerType) + { + case PLUGIN_REGISTERED_CLASS: + handlerAvailable = (find(g_PipelineInterfaceImpl->RegisteredClasses.begin(), g_PipelineInterfaceImpl->RegisteredClasses.end(), processPlugin.Handler) != g_PipelineInterfaceImpl->RegisteredClasses.end()); + break; + default: + nlwarning("Not implemented"); + break; + } + + if (handlerAvailable) + { + bool infoAvailable = false; + switch (processPlugin.InfoType) + { + case PLUGIN_REGISTERED_CLASS: + infoAvailable = (find(g_PipelineInterfaceImpl->RegisteredClasses.begin(), g_PipelineInterfaceImpl->RegisteredClasses.end(), processPlugin.Info) != g_PipelineInterfaceImpl->RegisteredClasses.end()); + break; + default: + nlwarning("Not implemented"); + break; + } + if (infoAvailable) + { + nldebug("Available '%s', '%s'", processPlugin.Handler.c_str(), processPlugin.Info.c_str()); + result.push_back(processPlugin.Id.Global); + } + } + + } + else + { + nlwarning("Missing value in '%s' at 'ProcessHandlers' at '%i'", (*it)->getFilename().c_str(), i); + } + } + else + { + nlwarning("Missing 'Process' in '%s' at 'ProcessHandlers' at '%i'", (*it)->getFilename().c_str(), i); + } + } + else + { + nlwarning("Array error in '%s'", (*it)->getFilename().c_str()); + } + } + } + else + { + nlwarning("Missing 'ProcessHandlers' in '%s'", (*it)->getFilename().c_str()); + } + ++pluginId; + } +} + CPipelineProject *CPipelineWorkspace::getProject(const std::string &project) { std::map::const_iterator it = m_Projects.find(project); diff --git a/code/nel/tools/pipeline/service/pipeline_workspace.h b/code/nel/tools/pipeline/service/pipeline_workspace.h index 7e48f04bd..96b2d5c9f 100644 --- a/code/nel/tools/pipeline/service/pipeline_workspace.h +++ b/code/nel/tools/pipeline/service/pipeline_workspace.h @@ -90,10 +90,13 @@ public: CPipelineWorkspace(NLGEORGES::UFormLoader *formLoader, const std::string &sheetName); virtual ~CPipelineWorkspace(); - void getProcessPlugins(std::vector &result, const std::string &process); + void getProcessPlugins(std::vector &resultAppend, const std::string &process); CPipelineProject *getProject(const std::string &project); bool getProcessPlugin(CProcessPluginInfo &result, uint32 globalId); + /// Makes a list of the global id of all available plugins to this service + void listAvailablePlugins(std::vector &result); + }; /* class CPipelineWorkspace */ } /* namespace PIPELINE */