Commit a851633d3abf5fcc791ce1ac2d5dc5c251f644bb
1 parent
137db606
Exists in
master
and in
84 other branches
xml generated
Showing
6 changed files
with
89 additions
and
12 deletions
Show diff stats
config/app/templates/app.properties.debug.in
... | ... | @@ -31,7 +31,9 @@ app.process.src=src |
31 | 31 | app.process.lib=lib |
32 | 32 | app.process.CXX_COMPILER=g++ |
33 | 33 | app.process.CMAKE_CXX_FLAGS=-g -std=c++0x -fPIC -Wall -ggdb -DLINUX -Dlinux -D_REENTRANT -malign-double -pthread |
34 | -app.process.INCLUDE=-I../src/InternLib -I../src/Common -I../src/Parameters -I../src/DD_Client_Lib -I../src/helpers -I../src/TimeTableCatalog -I@USERLOCAL_ROOT@/include -I@GCC_ROOT@/include -I@BOOST_ROOT@/include -I@USERLOCAL_ROOT@/include/log4cxx | |
34 | +app.process.INCLUDE=-I../src/InternLib -I../src/Common -I../src/Parameters -I../src/DD_Client_Lib -I../src/helpers -I../src/TimeTableCatalog -I@USERLOCAL_ROOT@/include -I@GCC_ROOT@/include -I@BOOST_ROOT@/include -I@USERLOCAL_ROOT@/include/log4cxx | |
35 | +app.process.DYNAMIC_LOADING=false | |
36 | +app.process.plugins.xml=../test/data/plugins.xml | |
35 | 37 | app.process.LIB=-L../build/Debug/lib/ -lParameters |
36 | 38 | # Plot default configuration |
37 | 39 | app.plot.configfile=../config/app/plotConfig.xml | ... | ... |
config/app/templates/app.properties.generate-paraminfo.in
... | ... | @@ -33,6 +33,8 @@ app.process.CXX_COMPILER=g++ |
33 | 33 | app.process.CMAKE_CXX_FLAGS=-g -std=c++0x -fPIC -Wall -ggdb -DLINUX -Dlinux -D_REENTRANT -malign-double -pthread |
34 | 34 | app.process.INCLUDE=-I../src/InternLib -I../src/Common -I../src/Parameters -I../src/DD_Client_Lib -I../src/helpers -I../src/TimeTableCatalog -I@USERLOCAL_ROOT@/include -I@GCC_ROOT@/include -I@BOOST_ROOT@/include -I@USERLOCAL_ROOT@/include/log4cxx |
35 | 35 | app.process.LIB=-L../build/Debug/lib/ -lParameters |
36 | +app.process.DYNAMIC_LOADING=false | |
37 | +app.process.plugins.xml=../test/data/plugins.xml | |
36 | 38 | # Plot default configuration |
37 | 39 | app.plot.configfile=../config/app/plotConfig.xml |
38 | 40 | # Default properties for parameters | ... | ... |
config/app/templates/app.properties.release.in
... | ... | @@ -33,6 +33,8 @@ app.process.CXX_COMPILER=g++ |
33 | 33 | app.process.CMAKE_CXX_FLAGS=-std=c++0x -Wall -fPIC -DLINUX -Dlinux -D_REENTRANT -malign-double -pthread -O3 -DNDEBUG |
34 | 34 | app.process.INCLUDE=-I../src/InternLib -I../src/Common -I../src/Parameters -I../src/DD_Client_Lib -I../src/helpers -I../src/TimeTableCatalog -I@USERLOCAL_ROOT@/include -I@GCC_ROOT@/include -I@BOOST_ROOT@/include -I@USERLOCAL_ROOT@/include/log4cxx |
35 | 35 | app.process.LIB=-L../build/Release/lib/ -lParameters |
36 | +app.process.DYNAMIC_LOADING=false | |
37 | +app.process.plugins.xml=../test/data/plugins.xml | |
36 | 38 | # Plot default configuration |
37 | 39 | app.plot.configfile=../config/app/plotConfig.xml |
38 | 40 | # Default properties for parameters | ... | ... |
src/Common/Application.cc
... | ... | @@ -100,12 +100,11 @@ namespace AMDA { |
100 | 100 | |
101 | 101 | std::string lPluginPath = lProperties["app.plugin"]; |
102 | 102 | if (!lPluginPath.empty() && !skipPluginLoad) { |
103 | - if (lProperties["app.dynamicPluging"] == "false") { | |
103 | + bool b; | |
104 | + istringstream(lProperties["app.process.DYNAMIC_LOADING"]) >> std::boolalpha >> b; | |
104 | 105 | AMDA::Plugins::PluginManager::getInstance()->loadPluginFromPath( |
105 | 106 | lPluginPath); |
106 | - } else { | |
107 | - // tbd | |
108 | - } | |
107 | + servicesServer->generatePluginsXml((lProperties["app.process.plugins.xml"]).c_str()); | |
109 | 108 | } |
110 | 109 | |
111 | 110 | LOG4CXX_INFO(logger, "Entering application."); | ... | ... |
src/Parameters/ServicesServer.cpp
... | ... | @@ -6,15 +6,85 @@ |
6 | 6 | */ |
7 | 7 | |
8 | 8 | #include "ServicesServer.hh" |
9 | +#include <libxml/xmlwriter.h> | |
9 | 10 | |
10 | 11 | namespace AMDA { |
11 | -namespace Parameters { | |
12 | + namespace Parameters { | |
12 | 13 | |
13 | -ServicesServer::ServicesServer() { | |
14 | -} | |
14 | + ServicesServer::ServicesServer() { | |
15 | + } | |
15 | 16 | |
16 | -ServicesServer::~ServicesServer() { | |
17 | -} | |
17 | + ServicesServer::~ServicesServer() { | |
18 | + } | |
18 | 19 | |
19 | -} /* namespace Parameters */ | |
20 | + bool ServicesServer::generatePluginsXml(const char* filePath) { | |
21 | + LIBXML_TEST_VERSION | |
22 | + | |
23 | + xmlTextWriterPtr writer = xmlNewTextWriterFilename(filePath, 0); | |
24 | + if (writer == NULL) { | |
25 | + return false; | |
26 | + } | |
27 | + | |
28 | + int rc; | |
29 | + rc = xmlTextWriterStartDocument(writer, "1.0", "UTF-8", NULL); | |
30 | + | |
31 | + if (rc < 0) { | |
32 | + xmlFreeTextWriter(writer); | |
33 | + return false; | |
34 | + } | |
35 | + | |
36 | + rc = xmlTextWriterStartElement(writer, BAD_CAST "plugins"); | |
37 | + if (rc < 0) { | |
38 | + xmlFreeTextWriter(writer); | |
39 | + return false; | |
40 | + } | |
41 | + | |
42 | + for (auto plugMap : _processPluginMaps) { | |
43 | + for (auto plug : plugMap.second) { | |
44 | + rc = xmlTextWriterStartElement(writer, BAD_CAST "process"); | |
45 | + if (rc < 0) { | |
46 | + xmlFreeTextWriter(writer); | |
47 | + return false; | |
48 | + } | |
49 | + | |
50 | + rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "name", BAD_CAST plug.first.c_str()); | |
51 | + if (rc < 0) { | |
52 | + xmlFreeTextWriter(writer); | |
53 | + return false; | |
54 | + } | |
55 | + rc = xmlTextWriterWriteElement(writer, BAD_CAST "plugin", BAD_CAST plug.second.c_str()); | |
56 | + if (rc < 0) { | |
57 | + xmlFreeTextWriter(writer); | |
58 | + return false; | |
59 | + } | |
60 | + | |
61 | + | |
62 | + // process node | |
63 | + rc = xmlTextWriterEndElement(writer); | |
64 | + if (rc < 0) { | |
65 | + xmlFreeTextWriter(writer); | |
66 | + return false; | |
67 | + } | |
68 | + } | |
69 | + } | |
70 | + | |
71 | + // close expressions node | |
72 | + rc = xmlTextWriterEndElement(writer); | |
73 | + if (rc < 0) { | |
74 | + xmlFreeTextWriter(writer); | |
75 | + return false; | |
76 | + } | |
77 | + | |
78 | + rc = xmlTextWriterEndDocument(writer); | |
79 | + if (rc < 0) { | |
80 | + xmlFreeTextWriter(writer); | |
81 | + return false; | |
82 | + } | |
83 | + | |
84 | + xmlFreeTextWriter(writer); | |
85 | + | |
86 | + return true; | |
87 | + } | |
88 | + | |
89 | + } /* namespace Parameters */ | |
20 | 90 | } /* namespace AMDA */ | ... | ... |
src/Plugins/PluginManager.cc
... | ... | @@ -79,10 +79,12 @@ void PluginManager::registerPlugin( const std::string &pluginName, const std::st |
79 | 79 | LOG4CXX_DEBUG(gLogger, "PluginManager::registerPlugin :: attempt to load: " << pluginPath << pluginName ); |
80 | 80 | |
81 | 81 | Plugin plugin( pluginPath+"/"+pluginName); |
82 | + | |
83 | + _currentPluginPath = pluginPath+"/"+pluginName; | |
82 | 84 | |
83 | 85 | _loadedPlugins.insert(PluginMap::value_type( pluginName, plugin)).first->second.registerPlugin(*this); |
84 | 86 | |
85 | - _currentPluginPath = pluginPath+"/"+pluginName; | |
87 | + | |
86 | 88 | |
87 | 89 | //PluginWatcher::getInstance()->addPluginToWatch(pluginPath); |
88 | 90 | ... | ... |