]> granicus.if.org Git - icinga2/commitdiff
Merged configfile component into the icinga library.
authorGunnar Beutner <gunnar.beutner@netways.de>
Thu, 26 Jul 2012 10:41:57 +0000 (12:41 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Thu, 26 Jul 2012 10:41:57 +0000 (12:41 +0200)
components/Makefile.am
components/configfile/Makefile.am [deleted file]
components/configfile/configfile.vcxproj [deleted file]
components/configfile/configfile.vcxproj.filters [deleted file]
components/configfile/configfilecomponent.cpp [deleted file]
components/configfile/configfilecomponent.h [deleted file]
components/configfile/i2-configfile.h [deleted file]
icinga.sln
icinga/icingaapplication.cpp

index 422b8c10c8200f3fc6cdfa1577ee370e4d77413d..edf2f295266d5083b807873cca3b9c9b78737d9c 100644 (file)
@@ -5,7 +5,6 @@ SUBDIRS = \
        checker \
        cibsync \
        compat \
-       configfile \
        convenience \
        delegation \
        demo \
diff --git a/components/configfile/Makefile.am b/components/configfile/Makefile.am
deleted file mode 100644 (file)
index 7beee1d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-pkglib_LTLIBRARIES = \
-       configfile.la
-
-configfile_la_SOURCES = \
-       configfilecomponent.cpp \
-       configfilecomponent.h \
-       i2-configfile.h
-
-configfile_la_CPPFLAGS = \
-       $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/base \
-       -I${top_srcdir}/dyn
-
-configfile_la_LDFLAGS = \
-       $(BOOST_LDFLAGS) \
-       -module \
-       -no-undefined \
-       @RELEASE_INFO@ \
-       @VERSION_INFO@
-
-configfile_la_LIBADD = \
-       $(BOOST_SIGNALS_LIB) \
-       $(BOOST_THREAD_LIB) \
-       $(top_builddir)/base/libbase.la \
-       $(top_builddir)/dyn/libdyn.la
diff --git a/components/configfile/configfile.vcxproj b/components/configfile/configfile.vcxproj
deleted file mode 100644 (file)
index ec4f03c..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="configfilecomponent.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="configfilecomponent.h" />
-    <ClInclude Include="i2-configfile.h" />
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{E58F1DA7-B723-412B-B2B7-7FF58E2A944E}</ProjectGuid>
-    <Keyword>Win32Proj</Keyword>
-    <RootNamespace>icinga</RootNamespace>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <CharacterSet>MultiByte</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>MultiByte</CharacterSet>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <IncludePath>$(SolutionDir)\base;$(SolutionDir)\icinga;$(SolutionDir)\dyn;$(IncludePath)</IncludePath>
-    <LibraryPath>$(OutDir);$(LibraryPath)</LibraryPath>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <IncludePath>$(SolutionDir)\base;$(SolutionDir)\icinga;$(SolutionDir)\dyn;$(IncludePath)</IncludePath>
-    <LibraryPath>$(OutDir);$(LibraryPath)</LibraryPath>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <WarningLevel>Level3</WarningLevel>
-      <MinimalRebuild>false</MinimalRebuild>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>base.lib;dyn.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-    <Lib>
-      <AdditionalDependencies>
-      </AdditionalDependencies>
-    </Lib>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <WarningLevel>Level3</WarningLevel>
-      <MinimalRebuild>false</MinimalRebuild>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>base.lib;dyn.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-    <Lib>
-      <AdditionalDependencies>$(OutDir)\base.lib;$(OutDir)\jsonrpc.lib</AdditionalDependencies>
-    </Lib>
-  </ItemDefinitionGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
\ No newline at end of file
diff --git a/components/configfile/configfile.vcxproj.filters b/components/configfile/configfile.vcxproj.filters
deleted file mode 100644 (file)
index 8fbfd21..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <ClInclude Include="configfilecomponent.h">
-      <Filter>Headerdateien</Filter>
-    </ClInclude>
-    <ClInclude Include="i2-configfile.h">
-      <Filter>Headerdateien</Filter>
-    </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <Filter Include="Headerdateien">
-      <UniqueIdentifier>{4cead05d-6b4f-4201-8788-eae48becc992}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Quelldateien">
-      <UniqueIdentifier>{2bf43753-a887-4020-8f0c-57806031e919}</UniqueIdentifier>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="configfilecomponent.cpp">
-      <Filter>Quelldateien</Filter>
-    </ClCompile>
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/components/configfile/configfilecomponent.cpp b/components/configfile/configfilecomponent.cpp
deleted file mode 100644 (file)
index 8c935cf..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/******************************************************************************
- * Icinga 2                                                                   *
- * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/)        *
- *                                                                            *
- * This program is free software; you can redistribute it and/or              *
- * modify it under the terms of the GNU General Public License                *
- * as published by the Free Software Foundation; either version 2             *
- * of the License, or (at your option) any later version.                     *
- *                                                                            *
- * This program is distributed in the hope that it will be useful,            *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
- * GNU General Public License for more details.                               *
- *                                                                            *
- * You should have received a copy of the GNU General Public License          *
- * along with this program; if not, write to the Free Software Foundation     *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
- ******************************************************************************/
-
-#include "i2-configfile.h"
-
-using std::ifstream;
-
-using namespace icinga;
-
-string ConfigFileComponent::GetName(void) const
-{
-       return "configfilecomponent";
-}
-
-void ConfigFileComponent::Start(void)
-{
-       ifstream fp;
-
-       string filename;
-       if (!GetConfig()->GetProperty("configFilename", &filename))
-               throw_exception(logic_error("Missing 'configFilename' property"));
-
-       vector<ConfigItem::Ptr> configItems = ConfigCompiler::CompileFile(filename);
-
-       Logger::Write(LogInformation, "configfile", "Executing config items...");
-
-       BOOST_FOREACH(const ConfigItem::Ptr& item, configItems) {
-               item->Commit();
-       }
-}
-
-void ConfigFileComponent::Stop(void)
-{
-}
-
-EXPORT_COMPONENT(configfile, ConfigFileComponent);
diff --git a/components/configfile/configfilecomponent.h b/components/configfile/configfilecomponent.h
deleted file mode 100644 (file)
index 618450d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/******************************************************************************
- * Icinga 2                                                                   *
- * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/)        *
- *                                                                            *
- * This program is free software; you can redistribute it and/or              *
- * modify it under the terms of the GNU General Public License                *
- * as published by the Free Software Foundation; either version 2             *
- * of the License, or (at your option) any later version.                     *
- *                                                                            *
- * This program is distributed in the hope that it will be useful,            *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
- * GNU General Public License for more details.                               *
- *                                                                            *
- * You should have received a copy of the GNU General Public License          *
- * along with this program; if not, write to the Free Software Foundation     *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
- ******************************************************************************/
-
-#ifndef CONFIGFILECOMPONENT_H
-#define CONFIGFILECOMPONENT_H
-
-namespace icinga
-{
-
-/**
- * Thrown when a parser error occurs while reading a config file.
- *
- * @ingroup configfile
- */
-DEFINE_EXCEPTION_CLASS(ConfigParserException);
-
-/**
- * @ingroup configfile
- */
-class ConfigFileComponent : public Component
-{
-public:
-       typedef shared_ptr<ConfigFileComponent> Ptr;
-       typedef weak_ptr<ConfigFileComponent> WeakPtr;
-
-       virtual string GetName(void) const;
-       virtual void Start(void);
-       virtual void Stop(void);
-};
-
-}
-
-#endif /* CONFIGFILECOMPONENT_H */
diff --git a/components/configfile/i2-configfile.h b/components/configfile/i2-configfile.h
deleted file mode 100644 (file)
index 0c534de..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/******************************************************************************
- * Icinga 2                                                                   *
- * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/)        *
- *                                                                            *
- * This program is free software; you can redistribute it and/or              *
- * modify it under the terms of the GNU General Public License                *
- * as published by the Free Software Foundation; either version 2             *
- * of the License, or (at your option) any later version.                     *
- *                                                                            *
- * This program is distributed in the hope that it will be useful,            *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
- * GNU General Public License for more details.                               *
- *                                                                            *
- * You should have received a copy of the GNU General Public License          *
- * along with this program; if not, write to the Free Software Foundation     *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
- ******************************************************************************/
-
-#ifndef I2CONFIGFILECOMPONENT_H
-#define I2CONFIGFILECOMPONENT_H
-
-/**
- * @defgroup configfile ConfigFile component
- *
- * The ConfigFile component reads configuration objects from a configuration
- * file
- */
-
-#include <i2-base.h>
-#include <i2-dyn.h>
-
-#include "configfilecomponent.h"
-
-#endif /* I2CONFIGFILECOMPONENT_H */
index 0c71daecf8c4eb5c99255d8d6735853ae1cadfbb..cdbcdd5ba72ceef323ab4d774fe46e9f71444924 100644 (file)
@@ -24,17 +24,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icinga-app", "icinga-app\ic
                {EAD41628-BB96-4F99-9070-8A9676801295} = {EAD41628-BB96-4F99-9070-8A9676801295}
                {2E6C1133-730F-4875-A72C-B455B1DD4C5C} = {2E6C1133-730F-4875-A72C-B455B1DD4C5C}
                {17C93245-8C20-4316-9573-1AE41D918C10} = {17C93245-8C20-4316-9573-1AE41D918C10}
-               {E58F1DA7-B723-412B-B2B7-7FF58E2A944E} = {E58F1DA7-B723-412B-B2B7-7FF58E2A944E}
                {38CE81CC-2660-4EF0-A936-4A337591DA3E} = {38CE81CC-2660-4EF0-A936-4A337591DA3E}
                {C1FC77E1-04A4-481B-A78B-2F7AF489C2F8} = {C1FC77E1-04A4-481B-A78B-2F7AF489C2F8}
        EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "configfile", "components\configfile\configfile.vcxproj", "{E58F1DA7-B723-412B-B2B7-7FF58E2A944E}"
-       ProjectSection(ProjectDependencies) = postProject
-               {9C92DA90-FD53-43A9-A244-90F2E8AF9677} = {9C92DA90-FD53-43A9-A244-90F2E8AF9677}
-               {B26AFFA6-2BDF-42E6-A224-2591FFD9BFB7} = {B26AFFA6-2BDF-42E6-A224-2591FFD9BFB7}
-       EndProjectSection
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo", "components\demo\demo.vcxproj", "{2E6C1133-730F-4875-A72C-B455B1DD4C5C}"
        ProjectSection(ProjectDependencies) = postProject
                {C1FC77E1-04A4-481B-A78B-2F7AF489C2F8} = {C1FC77E1-04A4-481B-A78B-2F7AF489C2F8}
@@ -116,10 +109,6 @@ Global
                {BE412865-FEBA-4259-AD41-58950D1F5432}.Debug|Win32.Build.0 = Debug|Win32
                {BE412865-FEBA-4259-AD41-58950D1F5432}.Release|Win32.ActiveCfg = Release|Win32
                {BE412865-FEBA-4259-AD41-58950D1F5432}.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
                {2E6C1133-730F-4875-A72C-B455B1DD4C5C}.Debug|Win32.ActiveCfg = Debug|Win32
                {2E6C1133-730F-4875-A72C-B455B1DD4C5C}.Debug|Win32.Build.0 = Debug|Win32
                {2E6C1133-730F-4875-A72C-B455B1DD4C5C}.Release|Win32.ActiveCfg = Release|Win32
@@ -176,6 +165,5 @@ Global
                {704DDD8E-9E6D-4C22-80BD-6DE10F3A5E1C} = {4A1773FD-DDED-4952-8700-C898E890554A}
                {2BD1C70C-43DB-4F44-B66B-67CF5C7044AA} = {4A1773FD-DDED-4952-8700-C898E890554A}
                {D02A349B-BAF7-41FB-86FF-B05BA05FE578} = {4A1773FD-DDED-4952-8700-C898E890554A}
-               {E58F1DA7-B723-412B-B2B7-7FF58E2A944E} = {4A1773FD-DDED-4952-8700-C898E890554A}
        EndGlobalSection
 EndGlobal
index 6c1a28a36eb13853c56fe58edab6a8d2c69f64d2..356018eeceb61d44fac4cda2bc374cb0ffd15135 100644 (file)
@@ -165,12 +165,13 @@ int IcingaApplication::Main(const vector<string>& args)
        convenienceComponentConfig->Compile()->Commit();
 
        /* load config file */
-       ConfigItemBuilder::Ptr fileComponentConfig = boost::make_shared<ConfigItemBuilder>();
-       fileComponentConfig->SetType("component");
-       fileComponentConfig->SetName("configfile");
-       fileComponentConfig->SetLocal(true);
-       fileComponentConfig->AddExpression("configFilename", OperatorSet, configFile);
-       fileComponentConfig->Compile()->Commit();
+       vector<ConfigItem::Ptr> configItems = ConfigCompiler::CompileFile(configFile);
+
+       Logger::Write(LogInformation, "configfile", "Executing config items...");
+
+       BOOST_FOREACH(const ConfigItem::Ptr& item, configItems) {
+               item->Commit();
+       }
 
        ConfigObject::Ptr icingaConfig = ConfigObject::GetObject("application", "icinga");