00001 /*------------------------------------------------------------------------------ 00002 Name: FileWriterApp.cpp 00003 Project: xmlBlaster.org 00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file 00005 ------------------------------------------------------------------------------*/ 00006 00007 #include <contrib/FileWriter.h> 00008 #include <util/Global.h> 00009 #include <util/Timestamp.h> 00010 #include <util/thread/ThreadImpl.h> 00011 00012 using namespace std; 00013 using namespace org::xmlBlaster::client; 00014 using namespace org::xmlBlaster::util; 00015 00016 int main(int args, char* argv[]) 00017 { 00018 // Init the XML platform 00019 try 00020 { 00021 Global& glob = Global::getInstance(); 00022 glob.initialize(args, argv); 00023 std::string name("writer"); 00024 org::xmlBlaster::contrib::FileWriter writer(glob, name); 00025 writer.init(); 00026 00027 // wait indefinitely 00028 org::xmlBlaster::util::thread::Condition condition; 00029 org::xmlBlaster::util::thread::Mutex mutex; 00030 org::xmlBlaster::util::thread::Lock lock(mutex); 00031 condition.wait(lock, -1); 00032 00033 writer.shutdown(); // is probably never executed 00034 } 00035 catch (XmlBlasterException &ex) { 00036 std::cout << ex.toXml() << std::endl; 00037 // std::cout << ex.getRawMessage() << std::endl; 00038 } 00039 return 0; 00040 } 00041