util/EmbeddedServer.h

Go to the documentation of this file.
00001 /*-----------------------------------------------------------------------------
00002 Name:      EmbeddedServer.h
00003 Project:   xmlBlaster.org
00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
00005 Comment:   Testing the Timeout Features
00006 -----------------------------------------------------------------------------*/
00007 
00008 #ifndef _UTIL_EMBEDDEDSERVER_H
00009 #define _UTIL_EMBEDDEDSERVER_H
00010 
00011 #include <util/xmlBlasterDef.h>
00012 #include <client/XmlBlasterAccess.h>
00013 #include <util/XmlBlasterException.h>
00014 #include <util/thread/ThreadImpl.h>
00015 
00022 namespace org { namespace xmlBlaster { namespace util {
00023 
00024 class EmbeddedServer;
00025 
00026 class EmbeddedServerRunner : public org::xmlBlaster::util::thread::Thread 
00027 {
00028 private:
00029    const std::string    ME;
00030    EmbeddedServer& owner_;
00031 public:
00032 
00033    EmbeddedServerRunner(EmbeddedServer& owner);
00034 
00039    void run();
00040 };
00041 
00042 class Dll_Export EmbeddedServer
00043 {
00044 friend class EmbeddedServerRunner;
00045 private:
00046    std::string                ME;
00047    org::xmlBlaster::util::Global&               global_;
00048    org::xmlBlaster::util::I_Log&                  log_;
00049    bool                  isRunning_;
00050    std::string                applArguments_;
00051    std::string                jvmArguments_;
00052    org::xmlBlaster::client::XmlBlasterAccess*     externalAccess_;
00053    EmbeddedServerRunner* runner_;
00054 public:
00073    EmbeddedServer(org::xmlBlaster::util::Global& glob, const std::string& jvmArguments = "", const std::string& applArguments="", org::xmlBlaster::client::XmlBlasterAccess* externalAccess=NULL);
00074 
00075    virtual ~EmbeddedServer();
00076 
00085    bool stop(bool shutdownExternal=false, bool warnIfNotRunning=true);
00086 
00091    bool start(bool blockUntilUp=true);
00092 
00096    bool isSomeServerResponding() const;
00097 };
00098 
00099 }}}
00100 
00101 
00102 #endif
00103