1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#include "consoleAppEngine.h"
#include "consoleEnvironment.h"
#include "../iterate.h"
#include <stdexcept>
#include <libxml/xinclude.h>
ConsoleApplicationEngine::ConsoleApplicationEngine(const ConsoleEnvironment * env, const boost::filesystem::path & f) :
ApplicationEngine(),
_env(env)
{
xmlpp::DomParser request(f.string());
while (xmlXIncludeProcessFlags(request.get_document()->cobj(), XML_PARSE_NOXINCNODE) > 0);
xmlpp::Element * requestRoot = request.get_document()->get_root_node();
LoaderBase loader;
loader.supportedStorers.insert(Storer::into(&this->datasources));
loader.supportedStorers.insert(Storer::into(¶meterChecks));
loader.supportedStorers.insert(Storer::into(&tasks));
loader.collectAll("project2", requestRoot, true, true);
}
ConsoleApplicationEngine::~ConsoleApplicationEngine()
{
}
void
ConsoleApplicationEngine::process() const
{
BOOST_FOREACH(OrderedParamCheckers::value_type pc, parameterChecks) {
if (!pc.second->performCheck()) {
throw std::runtime_error("Check failed");
}
}
try {
BOOST_FOREACH(NoOutputExecutes::value_type t, tasks) {
t.second->execute();
}
// Commit data source transactions (without invoking a connection)
BOOST_FOREACH(DataSources::value_type ds, this->datasources) {
ds.second->commit();
}
}
catch (...) {
// Do something about the error
BOOST_FOREACH(DataSources::value_type ds, this->datasources) {
ds.second->rollback();
}
throw;
}
}
const Environment *
ConsoleApplicationEngine::env() const
{
return _env;
}
SessionPtr
ConsoleApplicationEngine::session() const
{
return SessionPtr();
}
PresenterPtr
ConsoleApplicationEngine::getPresenter(const std::string & group, const std::string & id) const
{
return PresenterPtr(new ConsolePresenter(this, group, id));
}
ConsoleApplicationEngine::ConsolePresenter::ConsolePresenter(const ConsoleApplicationEngine *,
const std::string & group, const std::string & id) :
Presenter(group, id)
{
}
ConsoleApplicationEngine::ConsolePresenter::~ConsolePresenter()
{
}
Presenter::XmlDocumentPtr
ConsoleApplicationEngine::ConsolePresenter::getDataDocument() const
{
return Presenter::getDataDocument();
}
|