summaryrefslogtreecommitdiff
path: root/project2/commonObjects.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-02-18 11:01:26 +0000
committerrandomdan <randomdan@localhost>2011-02-18 11:01:26 +0000
commit4efd293d8de0834eadc018304986a6e1a3395c79 (patch)
tree1029ce741c7c048b4dce240ffbbff340b6c0f999 /project2/commonObjects.cpp
parentAdd a Null variable type and support for it, this is now the default (diff)
downloadproject2-4efd293d8de0834eadc018304986a6e1a3395c79.tar.bz2
project2-4efd293d8de0834eadc018304986a6e1a3395c79.tar.xz
project2-4efd293d8de0834eadc018304986a6e1a3395c79.zip
Don't require the (probably repeated) inclusion of datasource definitions, have CommonObjects load them once on demand
Fix rdbmsDataSource closing transactions it didn't open Change XML to match the above changes
Diffstat (limited to 'project2/commonObjects.cpp')
-rw-r--r--project2/commonObjects.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/project2/commonObjects.cpp b/project2/commonObjects.cpp
index 31f81a9..2ca4846 100644
--- a/project2/commonObjects.cpp
+++ b/project2/commonObjects.cpp
@@ -1,4 +1,6 @@
#include "commonObjects.h"
+#include <libxml++/parsers/domparser.h>
+#include <libxml/xinclude.h>
RowSetPtr
CommonObjects::getSource(const std::string & name) const
@@ -10,4 +12,20 @@ CommonObjects::getSource(const std::string & name) const
throw CommonObjects::DataSourceNotFound(name);
}
+DataSources::index<bySOName>::type::const_iterator
+CommonObjects::loadDataSource(const std::string & name) const
+{
+ xmlpp::DomParser xml("datasources/" + name + ".xml");
+ while (xmlXIncludeProcessFlags(xml.get_document()->cobj(), XML_PARSE_NOXINCNODE) > 0);
+
+ LoaderBase loader("http://project2.randomdan.homeip.net", true);
+ loader.supportedStorers.insert(Storer::into(&datasources));
+ loader.collectAll(xml.get_document()->get_root_node(), false);
+
+ DataSources::index<bySOName>::type::const_iterator i = datasources.get<bySOName>().find(name);
+ if (i == datasources.get<bySOName>().end()) {
+ throw DataSourceNotFound(name);
+ }
+ return i;
+}