1 /*------------------------------------------------------------------------------
2 Name: FileWriterApp.cpp
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 ------------------------------------------------------------------------------*/
6
7 #include <contrib/FileWriter.h>
8 #include <util/Global.h>
9 #include <util/Timestamp.h>
10 #include <util/thread/ThreadImpl.h>
11
12 using namespace std;
13 using namespace org::xmlBlaster::client;
14 using namespace org::xmlBlaster::util;
15
16 int main(int args, char* argv[])
17 {
18 // Init the XML platform
19 try
20 {
21 Global& glob = Global::getInstance();
22 glob.initialize(args, argv);
23 std::string name("writer");
24 org::xmlBlaster::contrib::FileWriter writer(glob, name);
25 writer.init();
26
27 // wait indefinitely
28 org::xmlBlaster::util::thread::Condition condition;
29 org::xmlBlaster::util::thread::Mutex mutex;
30 org::xmlBlaster::util::thread::Lock lock(mutex);
31 condition.wait(lock, -1);
32
33 writer.shutdown(); // is probably never executed
34 }
35 catch (XmlBlasterException &ex) {
36 std::cout << ex.toXml() << std::endl;
37 // std::cout << ex.getRawMessage() << std::endl;
38 }
39 return 0;
40 }
syntax highlighted by Code2HTML, v. 0.9.1