]> granicus.if.org Git - icinga2/commitdiff
Implement "hello world" test app.
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 4 Nov 2013 14:57:46 +0000 (15:57 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 5 Nov 2013 07:34:34 +0000 (08:34 +0100)
Refs #4995

lib/CMakeLists.txt
lib/base/application.cpp
lib/base/application.h
lib/hello/CMakeLists.txt [new file with mode: 0644]
lib/hello/hello-type.conf [new file with mode: 0644]
lib/hello/hello.cpp [new file with mode: 0644]
lib/hello/hello.h [new file with mode: 0644]
lib/hello/hello.ti [new file with mode: 0644]

index 358be7d3bcf39bff8e8f128992e1e93fb23d60d4..f4706e600e03c6492f2dbe2e1f7aa579b2070937 100644 (file)
@@ -20,3 +20,4 @@ add_subdirectory(config)
 add_subdirectory(icinga)
 add_subdirectory(db_ido)
 add_subdirectory(methods)
+add_subdirectory(hello)
index b1996c4c958d79cf48dca80ffbfe2d38ef3da19e..5128a04457fa470d1068d162750f50e2936bf381 100644 (file)
@@ -159,6 +159,11 @@ void Application::RunEventLoop(void) const
 #endif /* _DEBUG */
 }
 
+void Application::OnShutdown(void)
+{
+       /* Nothing to do here. */
+}
+
 /**
  * Watches for changes to the system time. Adjusts timers if necessary.
  */
index 518105ce6e6e41c6ff3e35cffa9a5955b87ae30e..7f6c483a5733a1578956b233c62a96d9291a6568 100644 (file)
@@ -101,7 +101,7 @@ protected:
 
        void RunEventLoop(void) const;
 
-       virtual void OnShutdown(void) = 0;
+       virtual void OnShutdown(void);
 
 private:
        static Application *m_Instance; /**< The application instance. */
diff --git a/lib/hello/CMakeLists.txt b/lib/hello/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e1e6e6c
--- /dev/null
@@ -0,0 +1,40 @@
+# Icinga 2
+# Copyright (C) 2012-2013 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.
+
+mkclass_target(hello.ti hello.th)
+
+mkembedconfig_target(hello-type.conf hello-type.cpp)
+
+add_library(hello SHARED
+  hello.cpp hello.th hello-type.cpp
+)
+
+target_link_libraries(hello ${Boost_LIBRARIES} base)
+
+set_target_properties (
+  hello PROPERTIES
+  INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
+  FOLDER Lib
+)
+
+install(
+  TARGETS hello
+  RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2
+)
+
+
diff --git a/lib/hello/hello-type.conf b/lib/hello/hello-type.conf
new file mode 100644 (file)
index 0000000..b6c682d
--- /dev/null
@@ -0,0 +1,21 @@
+/******************************************************************************
+ * Icinga 2                                                                   *
+ * Copyright (C) 2012-2013 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.             *
+ ******************************************************************************/
+
+type Hello {
+}
diff --git a/lib/hello/hello.cpp b/lib/hello/hello.cpp
new file mode 100644 (file)
index 0000000..7b483e4
--- /dev/null
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * Icinga 2                                                                   *
+ * Copyright (C) 2012-2013 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 "hello/hello.h"
+#include "base/dynamictype.h"
+#include "base/logger_fwd.h"
+
+using namespace icinga;
+
+REGISTER_TYPE(Hello);
+
+/**
+ * The entry point for the Hello application.
+ *
+ * @returns An exit status.
+ */
+int Hello::Main(void)
+{
+       Log(LogInformation, "hello", "Hello World!");
+
+       return 0;
+}
diff --git a/lib/hello/hello.h b/lib/hello/hello.h
new file mode 100644 (file)
index 0000000..fa187c0
--- /dev/null
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * Icinga 2                                                                   *
+ * Copyright (C) 2012-2013 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 HELLO_H
+#define HELLO_H
+
+#include "hello/hello.th"
+
+namespace icinga
+{
+
+/**
+ * The Hello application.
+ *
+ * @ingroup hello
+ */
+class Hello : public ReflectionObjectImpl<Hello>
+{
+public:
+       DECLARE_PTR_TYPEDEFS(Hello);
+       DECLARE_TYPENAME(Hello);
+
+       int Main(void);
+};
+
+}
+
+#endif /* HELLO_H */
diff --git a/lib/hello/hello.ti b/lib/hello/hello.ti
new file mode 100644 (file)
index 0000000..f722655
--- /dev/null
@@ -0,0 +1,10 @@
+#include "base/application.h"
+
+namespace icinga
+{
+
+class Hello : Application
+{
+};
+
+}