From: Gunnar Beutner Date: Sat, 31 Mar 2012 14:29:53 +0000 (+0200) Subject: Implemented component loader app. X-Git-Tag: v0.0.1~680 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b291bf3cfc60e8145f63b985359f9311ee57e82d;p=icinga2 Implemented component loader app. --- diff --git a/icinga/i2-icinga.h b/icinga/i2-icinga.h new file mode 100644 index 000000000..ca653f31a --- /dev/null +++ b/icinga/i2-icinga.h @@ -0,0 +1,9 @@ +#ifndef I2_ICINGA_H +#define I2_ICINGA_H + +#include +#include + +#include "icingaapplication.h" + +#endif /* I2_ICINGA_H */ diff --git a/icinga/icinga.vcxproj b/icinga/icinga.vcxproj new file mode 100644 index 000000000..e1b775aa5 --- /dev/null +++ b/icinga/icinga.vcxproj @@ -0,0 +1,93 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C1FC77E1-04A4-481B-A78B-2F7AF489C2F8} + Win32Proj + icinga + icinga + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + true + $(ProjectDir)\..\base;$(ProjectDir)\..\jsonrpc;$(ProjectDir)\..\config;$(IncludePath) + $(OutDir);$(LibraryPath) + + + false + $(ProjectDir)\..\base;$(ProjectDir)\..\jsonrpc;$(ProjectDir)\..\config;$(IncludePath) + $(OutDir);$(LibraryPath) + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + base.lib;jsonrpc.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + base.lib;jsonrpc.lib;%(AdditionalDependencies) + + + + + + + + + + + + + \ No newline at end of file diff --git a/icinga/icingaapplication.cpp b/icinga/icingaapplication.cpp new file mode 100644 index 000000000..d5e4b839f --- /dev/null +++ b/icinga/icingaapplication.cpp @@ -0,0 +1,37 @@ +#include +#include +#include "i2-icinga.h" + +using namespace icinga; + +using std::cout; +using std::endl; + +IcingaApplication::IcingaApplication(void) +{ + m_ConnectionManager = new_object(); +} + +int IcingaApplication::Main(const vector& args) +{ + ConfigObject::RefType fileComponentConfig = new_object(); + fileComponentConfig->SetName("configfilecomponent"); + fileComponentConfig->SetType("component"); + fileComponentConfig->SetProperty("filename", "icinga.conf"); + GetConfigHive()->AddObject(fileComponentConfig); + + LoadComponent("configfilecomponent"); + + LoadComponent("configrpccomponent"); + + RunEventLoop(); + + return 0; +} + +ConnectionManager::RefType IcingaApplication::GetConnectionManager(void) +{ + return m_ConnectionManager; +} + +SET_START_CLASS(icinga::IcingaApplication); diff --git a/icinga/icingaapplication.h b/icinga/icingaapplication.h new file mode 100644 index 000000000..0bc0092d1 --- /dev/null +++ b/icinga/icingaapplication.h @@ -0,0 +1,25 @@ +#ifndef I2_ICINGAAPPLICATION_H +#define I2_ICINGAAPPLICATION_H + +namespace icinga +{ + +class IcingaApplication : public Application +{ +private: + ConnectionManager::RefType m_ConnectionManager; + +public: + typedef shared_ptr RefType; + typedef weak_ptr WeakRefType; + + IcingaApplication(void); + + virtual int Main(const vector& args); + + virtual ConnectionManager::RefType GetConnectionManager(void); +}; + +} + +#endif /* I2_ICINGAAPPLICATION_H */ diff --git a/icinga2.sln b/icinga2.sln index 5d6be82aa..b44359255 100644 --- a/icinga2.sln +++ b/icinga2.sln @@ -14,6 +14,23 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsonrpc", "jsonrpc\jsonrpc. {9C92DA90-FD53-43A9-A244-90F2E8AF9677} = {9C92DA90-FD53-43A9-A244-90F2E8AF9677} EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3F525944-70CB-4F7A-BA18-3E87CA79488D}" + ProjectSection(SolutionItems) = preProject + TODO.txt = TODO.txt + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icinga", "icinga\icinga.vcxproj", "{C1FC77E1-04A4-481B-A78B-2F7AF489C2F8}" + ProjectSection(ProjectDependencies) = postProject + {697C6D7E-3109-484C-A7AF-384D28711610} = {697C6D7E-3109-484C-A7AF-384D28711610} + {9C92DA90-FD53-43A9-A244-90F2E8AF9677} = {9C92DA90-FD53-43A9-A244-90F2E8AF9677} + {E58F1DA7-B723-412B-B2B7-7FF58E2A944E} = {E58F1DA7-B723-412B-B2B7-7FF58E2A944E} + {8DD52FAC-ECEE-48C2-B266-E7C47ED485F8} = {8DD52FAC-ECEE-48C2-B266-E7C47ED485F8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "configfilecomponent", "configfilecomponent\configfilecomponent.vcxproj", "{E58F1DA7-B723-412B-B2B7-7FF58E2A944E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "configrpccomponent", "configrpccomponent\configrpccomponent.vcxproj", "{697C6D7E-3109-484C-A7AF-384D28711610}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -32,6 +49,18 @@ Global {8DD52FAC-ECEE-48C2-B266-E7C47ED485F8}.Debug|Win32.Build.0 = Debug|Win32 {8DD52FAC-ECEE-48C2-B266-E7C47ED485F8}.Release|Win32.ActiveCfg = Release|Win32 {8DD52FAC-ECEE-48C2-B266-E7C47ED485F8}.Release|Win32.Build.0 = Release|Win32 + {C1FC77E1-04A4-481B-A78B-2F7AF489C2F8}.Debug|Win32.ActiveCfg = Debug|Win32 + {C1FC77E1-04A4-481B-A78B-2F7AF489C2F8}.Debug|Win32.Build.0 = Debug|Win32 + {C1FC77E1-04A4-481B-A78B-2F7AF489C2F8}.Release|Win32.ActiveCfg = Release|Win32 + {C1FC77E1-04A4-481B-A78B-2F7AF489C2F8}.Release|Win32.Build.0 = Release|Win32 + {E58F1DA7-B723-412B-B2B7-7FF58E2A944E}.Debug|Win32.ActiveCfg = Debug|Win32 + {E58F1DA7-B723-412B-B2B7-7FF58E2A944E}.Debug|Win32.Build.0 = Debug|Win32 + {E58F1DA7-B723-412B-B2B7-7FF58E2A944E}.Release|Win32.ActiveCfg = Release|Win32 + {E58F1DA7-B723-412B-B2B7-7FF58E2A944E}.Release|Win32.Build.0 = Release|Win32 + {697C6D7E-3109-484C-A7AF-384D28711610}.Debug|Win32.ActiveCfg = Debug|Win32 + {697C6D7E-3109-484C-A7AF-384D28711610}.Debug|Win32.Build.0 = Debug|Win32 + {697C6D7E-3109-484C-A7AF-384D28711610}.Release|Win32.ActiveCfg = Release|Win32 + {697C6D7E-3109-484C-A7AF-384D28711610}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE