Added: #1440 List process plugins

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent dd2e2b2e5b
commit 9417b09f51

@ -52,17 +52,17 @@ CProcessInterfaceInfo::~CProcessInterfaceInfo()
void CProcessInterfaceInfo::getDependentDirectoriesRecursive(std::vector<std::string> &result)
{
}
void CProcessInterfaceInfo::getDependentDirectories(std::vector<std::string> &result)
{
}
void CProcessInterfaceInfo::getDependentFiles(std::vector<std::string> &result)
{
}
} /* namespace PIPELINE */

@ -67,7 +67,7 @@ public:
std::string Process;
std::string Message;
void serial(NLMISC::IStream &stream);
void serial(NLMISC::IStream &stream) throw (NLMISC::EStream);
};
/// Errors set by a process when the file causes a build failure.
@ -82,7 +82,7 @@ public:
uint32 LastUpdate; // The start time when the CRC32 was calculated.
uint32 CRC32;
void serial(NLMISC::IStream &stream);
void serial(NLMISC::IStream &stream) throw (NLMISC::EStream);
};
typedef CCallback<void, const std::string &/*filePath*/, const CFileStatus &/*fileStatus*/, bool /*success*/> TFileStatusCallback;

@ -51,6 +51,8 @@
#include "pipeline_workspace.h"
#include "database_status.h"
#include "pipeline_interface_impl.h"
#include "pipeline_process_impl.h"
// using namespace std;
using namespace NLMISC;
@ -63,6 +65,9 @@ std::string g_DatabaseDirectory;
std::string g_PipelineDirectory;
bool g_IsExiting = false;
NLGEORGES::UFormLoader *g_FormLoader = NULL;
CPipelineWorkspace *g_PipelineWorkspace;
std::string unMacroPath(const std::string &path)
{
std::string result = path;
@ -102,11 +107,10 @@ enum EState
};
/// Data
UFormLoader *s_FormLoader = NULL;
CPipelineWorkspace *s_PipelineWorkspace = NULL;
CTaskManager *s_TaskManager = NULL;
CDatabaseStatus *s_DatabaseStatus = NULL;
CPipelineInterfaceImpl *s_PipelineInterfaceImpl = NULL;
CPipelineProcessImpl *s_PipelineProcessImpl = NULL;
EState s_State = STATE_IDLE;
std::string s_StateRunnableTaskName = "";
@ -195,18 +199,18 @@ void initSheets()
nlinfo("Adding 'LeveldesignPipelineDirectory' to search path (%s)", leveldesignPipelineDirectory.c_str());
CPath::addSearchPath(leveldesignPipelineDirectory, true, false);
s_FormLoader = UFormLoader::createLoader();
g_FormLoader = UFormLoader::createLoader();
s_PipelineWorkspace = new CPipelineWorkspace(s_FormLoader, IService::getInstance()->ConfigFile.getVar("WorkspaceSheet").asString());
g_PipelineWorkspace = new CPipelineWorkspace(g_FormLoader, IService::getInstance()->ConfigFile.getVar("WorkspaceSheet").asString());
}
void releaseSheets()
{
delete s_PipelineWorkspace;
s_PipelineWorkspace = NULL;
delete g_PipelineWorkspace;
g_PipelineWorkspace = NULL;
UFormLoader::releaseLoader(s_FormLoader);
s_FormLoader = NULL;
UFormLoader::releaseLoader(g_FormLoader);
g_FormLoader = NULL;
CPath::releaseInstance();
}
@ -307,6 +311,7 @@ public:
s_DatabaseStatus = new CDatabaseStatus();
s_PipelineInterfaceImpl = new CPipelineInterfaceImpl();
s_PipelineProcessImpl = new CPipelineProcessImpl();
// Load libraries
const CConfigFile::CVar &usedPlugins = ConfigFile.getVar("UsedPlugins");
@ -346,6 +351,9 @@ public:
}
s_LoadedLibraries.clear();
delete s_PipelineProcessImpl;
s_PipelineProcessImpl = NULL;
delete s_PipelineInterfaceImpl;
s_PipelineInterfaceImpl = NULL;
@ -438,6 +446,42 @@ NLMISC_COMMAND(dumpAsyncFileManager, "Dumps the async file manager.", "")
return true;
}
NLMISC_COMMAND(listProcessPlugins, "List process plugins.", "<processName>")
{
if(args.size() != 1) return false;
std::vector<PIPELINE::CProcessPluginInfo> result;
PIPELINE::g_PipelineWorkspace->getProcessPlugins(result, args[0]);
for (std::vector<PIPELINE::CProcessPluginInfo>::iterator it = result.begin(), end = result.end(); it != end; ++it)
{
std::string statusHandler;
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())
statusHandler = "AVAILABLE";
else
statusHandler = "NOT FOUND";
break;
default:
statusHandler = "UNKNOWN";
break;
}
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())
statusInfo = "AVAILABLE";
else
statusInfo = "NOT FOUND";
break;
default:
statusInfo = "UNKNOWN";
break;
}
log.displayNL("LISTPP '%s': '%s' (%s), '%s' (%s)", args[0].c_str(), it->Handler.c_str(), statusHandler.c_str(), it->Info.c_str(), statusInfo.c_str());
}
}
NLNET_SERVICE_MAIN(PIPELINE::CPipelineService, PIPELINE_SHORT_SERVICE_NAME, PIPELINE_LONG_SERVICE_NAME, 0, PIPELINE::s_ShardCallbacks, PIPELINE_SERVICE_DIRECTORY, PIPELINE_SERVICE_DIRECTORY)
/* end of file */

@ -40,7 +40,13 @@ namespace NLMISC {
class IRunnable;
}
namespace NLGEORGES {
class UFormLoader;
}
namespace PIPELINE {
class CPipelineWorkspace;
/*
#if defined(PIPELINE_MASTER)
# if defined(PIPELINE_SLAVE)
@ -54,6 +60,8 @@ namespace PIPELINE {
#define PIPELINE_MASTER
extern bool g_IsExiting;
extern std::string g_DatabaseDirectory;
extern std::string g_PipelineDirectory;
@ -71,7 +79,8 @@ std::string macroPath(const std::string &path);
bool tryRunnableTask(std::string stateName, NLMISC::IRunnable *task);
void endedRunnableTask();
extern bool g_IsExiting;
extern NLGEORGES::UFormLoader *g_FormLoader;
extern CPipelineWorkspace *g_PipelineWorkspace;
} /* namespace PIPELINE */

@ -48,6 +48,56 @@ CPipelineWorkspace::CPipelineWorkspace(NLGEORGES::UFormLoader *formLoader, const
std::string description;
m_Form->getRootNode().getValueByName(description, "Description");
nlinfo("Loading pipeline workspace: '%s'", description.c_str());
{
UFormElm *plugins;
if (m_Form->getRootNode().getNodeByName(&plugins, "Plugins"))
{
uint nb;
plugins->getArraySize(nb);
for (uint i = 0; i < nb; ++i)
{
std::string pluginSheet;
if (plugins->getArrayValue(pluginSheet, i))
{
m_Plugins.push_back(formLoader->loadForm(pluginSheet.c_str()));
}
else
{
nlwarning("Array error in '%s'", m_Form->getFilename().c_str());
}
}
}
else
{
nlwarning("Missing 'Plugins' in '%s'", m_Form->getFilename().c_str());
}
}
{
UFormElm *projects;
if (m_Form->getRootNode().getNodeByName(&projects, "Projects"))
{
uint nb;
projects->getArraySize(nb);
for (uint i = 0; i < nb; ++i)
{
std::string projectSheet;
if (projects->getArrayValue(projectSheet, i))
{
m_Projects.push_back(formLoader->loadForm(projectSheet.c_str()));
}
else
{
nlwarning("Array error in '%s'", m_Form->getFilename().c_str());
}
}
}
else
{
nlwarning("Missing 'Projects' in '%s'", m_Form->getFilename().c_str());
}
}
}
CPipelineWorkspace::~CPipelineWorkspace()
@ -55,6 +105,63 @@ CPipelineWorkspace::~CPipelineWorkspace()
}
void CPipelineWorkspace::getProcessPlugins(std::vector<CProcessPluginInfo> &result, const std::string &process)
{
for (std::vector<NLMISC::CRefPtr<NLGEORGES::UForm> >::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"))
{
if (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;
result.push_back(processPlugin);
nldebug("Found '%s': '%s', '%s'", process.c_str(), processPlugin.Handler.c_str(), processPlugin.Info.c_str());
}
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());
}
}
}
} /* namespace PIPELINE */
/* end of file */

@ -41,6 +41,20 @@
namespace PIPELINE {
enum TPluginType
{
PLUGIN_REGISTERED_CLASS,
PLUGIN_LUA_SCRIPT,
};
struct CProcessPluginInfo
{
TPluginType HandlerType;
std::string Handler;
TPluginType InfoType;
std::string Info;
};
/**
* \brief CPipelineWorkspace
* \date 2012-02-18 17:23GMT
@ -50,15 +64,17 @@ namespace PIPELINE {
class CPipelineWorkspace
{
protected:
// pointers
NLGEORGES::UFormLoader *m_FormLoader;
NLMISC::CRefPtr<NLGEORGES::UForm> m_Form;
// instances
// ...
std::vector<NLMISC::CRefPtr<NLGEORGES::UForm> > m_Projects;
std::vector<NLMISC::CRefPtr<NLGEORGES::UForm> > m_Plugins;
public:
CPipelineWorkspace(NLGEORGES::UFormLoader *formLoader, const std::string &sheetName);
virtual ~CPipelineWorkspace();
void getProcessPlugins(std::vector<CProcessPluginInfo> &result, const std::string &process);
}; /* class CPipelineWorkspace */
} /* namespace PIPELINE */

@ -1,6 +1,7 @@
<?xml version="1.0"?>
<FORM Revision="$Revision$" State="modified">
<STRUCT>
<ATOM Name="Description" Value="Common Interface"/>
<ARRAY Name="Processes">
<ATOM Value="CProcessInterface"/>
</ARRAY>
@ -70,5 +71,5 @@
<STRUCT/>
<STRUCT/>
<STRUCT/>
<LOG></LOG>
<LOG>Sat Mar 03 12:10:45 2012 (Kaetemi) .Description = Common Interface</LOG>
</FORM>

@ -1,6 +1,7 @@
<?xml version="1.0"?>
<FORM Revision="$Revision$" State="modified">
<STRUCT>
<ATOM Name="Description" Value="Pipeline Plugin Max"/>
<ARRAY Name="ProcessHandlers">
<STRUCT>
<ATOM Name="Process" Value="ExportShape"/>
@ -18,5 +19,6 @@
Sat Mar 03 10:55:24 2012 (Kaetemi) .ProcessHandlers[0].HandlerType = RegisteredClass
Sat Mar 03 10:55:24 2012 (Kaetemi) .ProcessHandlers[0].Process = ExportShape
Sat Mar 03 10:55:24 2012 (Kaetemi) formName Resized = 1
Sat Mar 03 11:07:09 2012 (Kaetemi) .ProcessHandlers[0].Info = CProcessMaxShapeInfo</LOG>
Sat Mar 03 11:07:09 2012 (Kaetemi) .ProcessHandlers[0].Info = CProcessMaxShapeInfo
Sat Mar 03 12:10:36 2012 (Kaetemi) .Description = Pipeline Plugin Max</LOG>
</FORM>

@ -1,6 +1,7 @@
<?xml version="1.0"?>
<FORM Revision="$Revision$" State="modified">
<STRUCT>
<ATOM Name="Description" Value="Pipeline Plugin NeL"/>
<ARRAY Name="ProcessHandlers">
<STRUCT>
<ATOM Name="Process" Value="Interface"/>
@ -20,5 +21,6 @@ Sat Mar 03 10:55:24 2012 (Kaetemi) .ProcessHandlers[0].Process = ExportShape
Sat Mar 03 10:55:24 2012 (Kaetemi) formName Resized = 1
Sat Mar 03 10:56:08 2012 (Kaetemi) .ProcessHandlers[0].Handler = CProcessInterface
Sat Mar 03 10:56:08 2012 (Kaetemi) .ProcessHandlers[0].Process = Interface
Sat Mar 03 11:13:55 2012 (Kaetemi) .ProcessHandlers[0].Info = CProcessInterfaceInfo</LOG>
Sat Mar 03 11:13:55 2012 (Kaetemi) .ProcessHandlers[0].Info = CProcessInterfaceInfo
Sat Mar 03 12:10:28 2012 (Kaetemi) .Description = Pipeline Plugin NeL</LOG>
</FORM>

Loading…
Cancel
Save