[rhmessaging-commits] rhmessaging commits: r2789 - in mgmt/trunk: sesame and 5 other directories.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Wed Nov 12 17:20:42 EST 2008
Author: tedross
Date: 2008-11-12 17:20:42 -0500 (Wed, 12 Nov 2008)
New Revision: 2789
Added:
mgmt/trunk/sesame/
mgmt/trunk/sesame/cpp/
mgmt/trunk/sesame/cpp/COPYING
mgmt/trunk/sesame/cpp/Makefile.am
mgmt/trunk/sesame/cpp/README
mgmt/trunk/sesame/cpp/bootstrap
mgmt/trunk/sesame/cpp/build-aux/
mgmt/trunk/sesame/cpp/configure.ac
mgmt/trunk/sesame/cpp/etc/
mgmt/trunk/sesame/cpp/etc/sesame.conf
mgmt/trunk/sesame/cpp/m4/
mgmt/trunk/sesame/cpp/m4/clock_time.m4
mgmt/trunk/sesame/cpp/m4/compiler-flags.m4
mgmt/trunk/sesame/cpp/m4/cppunit.m4
mgmt/trunk/sesame/cpp/m4/extensions.m4
mgmt/trunk/sesame/cpp/src/
mgmt/trunk/sesame/cpp/src/Makefile.am
mgmt/trunk/sesame/cpp/src/SysAgent.cpp
mgmt/trunk/sesame/cpp/src/qmfgen/
mgmt/trunk/sesame/cpp/src/qmfgen/Makefile.am
mgmt/trunk/sesame/cpp/src/qmfgen/qmfgen.mk
mgmt/trunk/sesame/cpp/src/qmfgen/schema.xml
Log:
sesame - A System Agent module for the Qpid Management Framework
Added: mgmt/trunk/sesame/cpp/COPYING
===================================================================
--- mgmt/trunk/sesame/cpp/COPYING (rev 0)
+++ mgmt/trunk/sesame/cpp/COPYING 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,15 @@
+Copyright (C) 2007 Red Hat Inc.
+
+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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
Added: mgmt/trunk/sesame/cpp/Makefile.am
===================================================================
--- mgmt/trunk/sesame/cpp/Makefile.am (rev 0)
+++ mgmt/trunk/sesame/cpp/Makefile.am 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,14 @@
+AUTOMAKE_OPTIONS = 1.9.6 foreign
+ACLOCAL_AMFLAGS = -I m4
+
+
+EXTRA_DIST = README etc/sesame.conf
+
+sysconf_DATA = etc/sesame.conf
+
+SUBDIRS = src
+
+# Update libtool, if needed.
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
+
Added: mgmt/trunk/sesame/cpp/README
===================================================================
--- mgmt/trunk/sesame/cpp/README (rev 0)
+++ mgmt/trunk/sesame/cpp/README 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,16 @@
+sesame - A System agent for the Qpid Management Framework
+
+Pre-requisites:
+
+ Apache Qpid - You will need either the source tree for Qpid or and
+ installed copy of Qpid. The version must be M4 or later.
+
+ https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid
+
+ Alternatively, you can install the qmf-devel RPM and its dependencies.
+
+
+To use a checkout ./configure --with-qpid-checkout=<path_to_qpid>
+
+* 'make' will build the module
+
Added: mgmt/trunk/sesame/cpp/bootstrap
===================================================================
--- mgmt/trunk/sesame/cpp/bootstrap (rev 0)
+++ mgmt/trunk/sesame/cpp/bootstrap 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Copyright (C) 2007, 2008 Red Hat Inc.
+#
+# This file is part of Red Hat Messaging.
+#
+# Red Hat Messaging is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+# USA
+#
+# The GNU Lesser General Public License is available in the file COPYING.
+
+set -e
+aclocal -I m4
+autoheader
+libtoolize --automake
+
+# Create initial Makefile fragments that will force make to generate
+# the real ones.
+cat > src/qmfgen/qmfgen.mk <<EOF
+\$(top_srcdir)/src/qmfgen/qmfgen.mk: force
+ \$(qmfgen_cmd)
+EOF
+
+automake --add-missing
+autoconf
Property changes on: mgmt/trunk/sesame/cpp/bootstrap
___________________________________________________________________
Name: svn:executable
+ *
Added: mgmt/trunk/sesame/cpp/configure.ac
===================================================================
--- mgmt/trunk/sesame/cpp/configure.ac (rev 0)
+++ mgmt/trunk/sesame/cpp/configure.ac 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,189 @@
+dnl # Copyright (C) 2007, 2008 Red Hat Inc.
+dnl #
+dnl # This file is part of Red Hat Messaging.
+dnl #
+dnl # Red Hat Messaging is free software; you can redistribute it and/or
+dnl # modify it under the terms of the GNU Lesser General Public
+dnl # License as published by the Free Software Foundation; either
+dnl # version 2.1 of the License, or (at your option) any later version.
+dnl #
+dnl # This library is distributed in the hope that it will be useful,
+dnl # but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl # Lesser General Public License for more details.
+dnl #
+dnl # You should have received a copy of the GNU Lesser General Public
+dnl # License along with this library; if not, write to the Free Software
+dnl # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+dnl # USA
+dnl #
+dnl # The GNU Lesser General Public License is available in the file COPYING.
+dnl
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT([sesame], [0.1], [rhemrg-users-list at redhat.com])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE([dist-bzip2])
+
+# Minimum Autoconf version required.
+AC_PREREQ(2.59)
+
+AC_CONFIG_HEADERS([src/config.h])
+AC_CONFIG_SRCDIR([src/SysAgent.cpp])
+
+AC_PROG_CC_STDC
+AM_PROG_CC_C_O
+AC_PROG_CXX
+AC_USE_SYSTEM_EXTENSIONS
+AC_LANG([C++])
+
+AC_ARG_ENABLE(warnings,
+[ --enable-warnings turn on lots of compiler warnings (recommended)],
+[case "${enableval}" in
+ yes|no) ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for warnings option]) ;;
+ esac],
+ [enableval=yes])
+
+# Warnings: Enable as many as possible, keep the code clean. Please
+# do not disable warnings or remove -Werror without discussing on
+# rhm-users list.
+#
+# The following warnings are deliberately omitted, they warn on valid code.
+# -Wunreachable-code -Wpadded -Winline
+# -Wshadow - warns about boost headers.
+
+if test "${enableval}" = yes; then
+ gl_COMPILER_FLAGS(-Werror)
+ gl_COMPILER_FLAGS(-pedantic)
+ gl_COMPILER_FLAGS(-Wall)
+ gl_COMPILER_FLAGS(-Wextra)
+ gl_COMPILER_FLAGS(-Wno-shadow)
+ gl_COMPILER_FLAGS(-Wpointer-arith)
+ gl_COMPILER_FLAGS(-Wcast-qual)
+ gl_COMPILER_FLAGS(-Wcast-align)
+ gl_COMPILER_FLAGS(-Wno-long-long)
+ gl_COMPILER_FLAGS(-Wvolatile-register-var)
+ gl_COMPILER_FLAGS(-Winvalid-pch)
+ gl_COMPILER_FLAGS(-Wno-system-headers)
+ AC_SUBST([WARNING_CFLAGS], [$COMPILER_FLAGS])
+ AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
+ COMPILER_FLAGS=
+fi
+
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
+AC_SUBST([LIBTOOL_DEPS])
+
+# Select building against qpid checkout or install.
+AC_ARG_WITH([qpid-checkout],
+ [AS_HELP_STRING([--with-qpid-checkout],
+ [Location of qpid checkout to build against (by default use installed qpid)])])
+
+if test x$with_qpid_checkout != x; then
+ QPID_DIR=$with_qpid_checkout
+ QPID_SRC=$QPID_DIR/cpp/src
+ QMF_GEN=$QPID_DIR/cpp/managementgen/qmf-gen
+ test -f $QPID_SRC/qpid/agent/ManagementAgent.h || \
+ AC_MSG_ERROR([$QPID_DIR does not appear to be a valid qpid checkout.])
+ QPID_LIBS="$QPID_SRC/libqmfagent.la"
+ QPID_CXXFLAGS="-I$QPID_SRC -I${QPID_SRC}/gen"
+else
+ fail=0
+ AC_CHECK_PROG([QMF_GEN], [qmf-gen], [qmf-gen], [no])
+ test $QMF_GEN = no &&
+ AC_MSG_ERROR([Missing required qmf-gen. Install package qmf-devel or use --with-qpid-checkout])
+
+ AC_CHECK_HEADERS([qpid/agent/ManagementAgent.h], , [fail=1])
+ # Give any/all diagnostics before failing.
+ test $fail = 1 &&
+ AC_MSG_ERROR([Missing required qpid libraries/headers. Install package qmf-devel or use --with-qpid-checkout])
+ QPID_LIBS="-lqmfagent"
+fi
+AC_SUBST([QMF_GEN])
+AC_SUBST([QPID_DIR])
+AC_SUBST([QPID_LIBS])
+AC_SUBST([QPID_CXXFLAGS])
+
+# For libraries (libcommon) that use dlopen, dlerror, etc.,
+# test whether we need to link with -ldl.
+gl_saved_libs=$LIBS
+AC_SEARCH_LIBS(dlopen, [dl],
+ [test "$ac_cv_search_dlopen" = "none required" ||
+ LIB_DLOPEN=$ac_cv_search_dlopen])
+AC_SUBST([LIB_DLOPEN])
+LIBS=$gl_saved_libs
+
+# Require libdb_cxx (any version between 4.2 and 4.7), for the library, and for db_cxx.h.
+db4_devel_fail=0
+AC_CHECK_HEADER([db_cxx.h], ,[db4_devel_fail=1])
+test $db4_devel_fail == 1 && \
+ AC_MSG_ERROR([db4-devel package missing. Please ensure both db4 and db4-devel are installed. (hint: "yum install db4-devel" should do it...)])
+
+gl_saved_libs=$LIBS
+AC_SEARCH_LIBS([__db_open], [db_cxx-4.7 db_cxx-4.6 db_cxx-4.5 db_cxx-4.4 db_cxx-4.3 db_cxx-4.2],
+ [test "$ac_cv_search___db_open" = "none required" ||
+ LIB_BERKELEY_DB=$ac_cv_search___db_open],
+ AC_MSG_ERROR([Couldn't find required library in range db_cxx-4.2 through db_cxx-4.6]))
+AC_SUBST([LIB_BERKELEY_DB])
+LIBS=$gl_saved_libs
+
+# Determine how to include db_cxx.h:
+# Red Hat needs <db4/db_cxx.h>, Debian needs <db_cxx.h>.
+AC_CHECK_HEADER([db4/db_cxx.h],
+ [DB_CXX_HEADER_PREFIX=db4/])
+if test x$DB_CXX_HEADER_PREFIX = x; then
+ AC_CHECK_HEADER([db_cxx.h],
+ [DB_CXX_HEADER_PREFIX=])
+fi
+AC_SUBST(DB_CXX_HEADER_PREFIX)
+
+# Set the argument to be used in "libtool -version-info ARG".
+QPID_CURRENT=1
+QPID_REVISION=0
+QPID_AGE=1
+LIBTOOL_VERSION_INFO_ARG=$QPID_CURRENT:$QPID_REVISION:$QPID_AGE
+AC_SUBST(LIBTOOL_VERSION_INFO_ARG)
+
+gl_CLOCK_TIME
+
+AC_ARG_ENABLE([apr-platform],
+ [AS_HELP_STRING([--enable-apr-platform],
+ [use the Apache Portable Runtime library for platform (default no)])],
+ [case $enableval in
+ yes|no) enable_APR_PLATFORM=$enableval;;
+ *) AC_MSG_ERROR([Invalid value for --enable-apr-platform: $enableval]);;
+ esac],
+ [enable_APR_PLATFORM=no]
+)
+AM_CONDITIONAL([USE_APR_PLATFORM], [test x$enable_APR_PLATFORM = xyes])
+
+APR_MINIMUM_VERSION=1.2.2
+AC_SUBST(APR_MINIMUM_VERSION)
+AC_SUBST(APR_CXXFLAGS)
+AC_SUBST(USE_APR_PLATFORM)
+
+if test x$enable_APR_PLATFORM = xyes; then
+ PKG_CHECK_MODULES([APR], [apr-1 >= $APR_MINIMUM_VERSION])
+ APR_CXXFLAGS="$APR_CFLAGS -DUSE_APR_PLATFORM=1"
+ USE_APR_PLATFORM=1
+fi
+
+# We use valgrind for the tests. See if it's available.
+AC_CHECK_PROG([VALGRIND], [valgrind], [valgrind])
+
+# If rpmlint is available we'll run it when building RPMs.
+AC_CHECK_PROG([RPMLINT], [rpmlint], [rpmlint])
+AM_CONDITIONAL([HAS_RPMLINT], [test -n "$RPMLINT"])
+
+# Also doxygen for documentation...
+AC_CHECK_PROG([do_doxygen], [doxygen], [yes])
+AM_CONDITIONAL([DOXYGEN], [test x$do_doxygen = xyes])
+
+AC_CONFIG_FILES([
+ Makefile
+ src/Makefile
+ src/qmfgen/Makefile
+ ])
+
+AC_OUTPUT
Added: mgmt/trunk/sesame/cpp/etc/sesame.conf
===================================================================
--- mgmt/trunk/sesame/cpp/etc/sesame.conf (rev 0)
+++ mgmt/trunk/sesame/cpp/etc/sesame.conf 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,4 @@
+##
+## sesame configuration
+##
+broker_url=amqp://localhost
Added: mgmt/trunk/sesame/cpp/m4/clock_time.m4
===================================================================
--- mgmt/trunk/sesame/cpp/m4/clock_time.m4 (rev 0)
+++ mgmt/trunk/sesame/cpp/m4/clock_time.m4 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,30 @@
+# clock_time.m4 serial 8
+dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Check for clock_gettime and clock_settime, and set LIB_CLOCK_GETTIME.
+# For a program named, say foo, you should add a line like the following
+# in the corresponding Makefile.am file:
+# foo_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
+
+AC_DEFUN([gl_CLOCK_TIME],
+[
+ dnl Persuade glibc and Solaris <time.h> to declare these functions.
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
+ # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
+
+ # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
+ # programs in the package would end up linked with that potentially-shared
+ # library, inducing unnecessary run-time overhead.
+ gl_saved_libs=$LIBS
+ AC_SEARCH_LIBS(clock_gettime, [rt posix4],
+ [test "$ac_cv_search_clock_gettime" = "none required" ||
+ LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
+ AC_SUBST([LIB_CLOCK_GETTIME])
+ AC_CHECK_FUNCS(clock_gettime clock_settime)
+ LIBS=$gl_saved_libs
+])
Added: mgmt/trunk/sesame/cpp/m4/compiler-flags.m4
===================================================================
--- mgmt/trunk/sesame/cpp/m4/compiler-flags.m4 (rev 0)
+++ mgmt/trunk/sesame/cpp/m4/compiler-flags.m4 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,23 @@
+# serial 3
+# Find valid warning flags for the C Compiler. -*-Autoconf-*-
+dnl Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl Written by Jesse Thilo.
+
+AC_DEFUN([gl_COMPILER_FLAGS],
+ [AC_MSG_CHECKING(whether compiler accepts $1)
+ AC_SUBST(COMPILER_FLAGS)
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS $1"
+ AC_TRY_COMPILE(,
+ [int x;],
+ COMPILER_FLAGS="$COMPILER_FLAGS $1"
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no))
+ CFLAGS="$ac_save_CFLAGS"
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ ])
Added: mgmt/trunk/sesame/cpp/m4/cppunit.m4
===================================================================
--- mgmt/trunk/sesame/cpp/m4/cppunit.m4 (rev 0)
+++ mgmt/trunk/sesame/cpp/m4/cppunit.m4 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,89 @@
+dnl
+dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl
+AC_DEFUN([AM_PATH_CPPUNIT],
+[
+
+AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)],
+ cppunit_config_prefix="$withval", cppunit_config_prefix="")
+AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)],
+ cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
+
+ if test x$cppunit_config_exec_prefix != x ; then
+ cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
+ if test x${CPPUNIT_CONFIG+set} != xset ; then
+ CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
+ fi
+ fi
+ if test x$cppunit_config_prefix != x ; then
+ cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
+ if test x${CPPUNIT_CONFIG+set} != xset ; then
+ CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
+ fi
+ fi
+
+ AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
+ cppunit_version_min=$1
+
+ AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
+ no_cppunit=""
+ if test "$CPPUNIT_CONFIG" = "no" ; then
+ AC_MSG_RESULT(no)
+ no_cppunit=yes
+ else
+ CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
+ CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
+ cppunit_version=`$CPPUNIT_CONFIG --version`
+
+ cppunit_major_version=`echo $cppunit_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ cppunit_minor_version=`echo $cppunit_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ cppunit_micro_version=`echo $cppunit_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+
+ cppunit_major_min=`echo $cppunit_version_min | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ if test "x${cppunit_major_min}" = "x" ; then
+ cppunit_major_min=0
+ fi
+
+ cppunit_minor_min=`echo $cppunit_version_min | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ if test "x${cppunit_minor_min}" = "x" ; then
+ cppunit_minor_min=0
+ fi
+
+ cppunit_micro_min=`echo $cppunit_version_min | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x${cppunit_micro_min}" = "x" ; then
+ cppunit_micro_min=0
+ fi
+
+ cppunit_version_proper=`expr \
+ $cppunit_major_version \> $cppunit_major_min \| \
+ $cppunit_major_version \= $cppunit_major_min \& \
+ $cppunit_minor_version \> $cppunit_minor_min \| \
+ $cppunit_major_version \= $cppunit_major_min \& \
+ $cppunit_minor_version \= $cppunit_minor_min \& \
+ $cppunit_micro_version \>= $cppunit_micro_min `
+
+ if test "$cppunit_version_proper" = "1" ; then
+ AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
+ else
+ AC_MSG_RESULT(no)
+ no_cppunit=yes
+ fi
+ fi
+
+ if test "x$no_cppunit" = x ; then
+ ifelse([$2], , :, [$2])
+ else
+ CPPUNIT_CFLAGS=""
+ CPPUNIT_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+
+ AC_SUBST(CPPUNIT_CFLAGS)
+ AC_SUBST(CPPUNIT_LIBS)
+])
Added: mgmt/trunk/sesame/cpp/m4/extensions.m4
===================================================================
--- mgmt/trunk/sesame/cpp/m4/extensions.m4 (rev 0)
+++ mgmt/trunk/sesame/cpp/m4/extensions.m4 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,58 @@
+# serial 4 -*- Autoconf -*-
+# Enable extensions on systems that normally disable them.
+
+# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
+# Autoconf. Perhaps we can remove this once we can assume Autoconf
+# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly
+# enough in this area it's likely we'll need to redefine
+# AC_USE_SYSTEM_EXTENSIONS for quite some time.
+
+# AC_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+[
+ AC_BEFORE([$0], [AC_COMPILE_IFELSE])
+ AC_BEFORE([$0], [AC_RUN_IFELSE])
+
+ AC_REQUIRE([AC_GNU_SOURCE])
+ AC_REQUIRE([AC_AIX])
+ AC_REQUIRE([AC_MINIX])
+
+ AH_VERBATIM([__EXTENSIONS__],
+[/* Enable extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif])
+ AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+ [ac_cv_safe_to_define___extensions__],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+# define __EXTENSIONS__ 1
+ AC_INCLUDES_DEFAULT])],
+ [ac_cv_safe_to_define___extensions__=yes],
+ [ac_cv_safe_to_define___extensions__=no])])
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ AC_DEFINE([__EXTENSIONS__])
+ AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+ AC_DEFINE([_TANDEM_SOURCE])
+])
+
+# gl_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
+ [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
Added: mgmt/trunk/sesame/cpp/src/Makefile.am
===================================================================
--- mgmt/trunk/sesame/cpp/src/Makefile.am (rev 0)
+++ mgmt/trunk/sesame/cpp/src/Makefile.am 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,14 @@
+SUBDIRS = qmfgen
+AM_CXXFLAGS = -I$(QPID_DIR)/cpp/src -I$(QPID_DIR)/cpp/src/gen -Iqmfgen
+
+include qmfgen/qmfgen.mk
+
+bin_PROGRAMS = sesame
+sesame_SOURCES =\
+ $(qmfgen_sources) \
+ SysAgent.cpp
+
+
+sesame_LDADD = $(QPID_LIBS)
+
+
Added: mgmt/trunk/sesame/cpp/src/SysAgent.cpp
===================================================================
--- mgmt/trunk/sesame/cpp/src/SysAgent.cpp (rev 0)
+++ mgmt/trunk/sesame/cpp/src/SysAgent.cpp 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,196 @@
+
+#include <qpid/management/Manageable.h>
+#include <qpid/management/ManagementObject.h>
+#include <qpid/agent/ManagementAgent.h>
+#include <qpid/sys/Mutex.h>
+#include "qpid/sys/SystemInfo.h"
+#include "qpid/framing/Uuid.h"
+#include "qmf/com/redhat/sesame/Package.h"
+#include "qmf/com/redhat/sesame/SysImage.h"
+
+#include <signal.h>
+#include <unistd.h>
+#include <cstdlib>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+
+using namespace std;
+using qpid::management::ManagementAgent;
+using qpid::management::ManagementObject;
+using qpid::management::Manageable;
+using qpid::management::Args;
+using qpid::sys::Mutex;
+namespace _qmf = qmf::com::redhat::sesame;
+
+
+class SysAgent : public Manageable
+{
+ ManagementAgent* agent;
+ _qmf::SysImage* mgmtObject;
+ qpid::framing::Uuid sysId;
+
+public:
+
+ SysAgent(ManagementAgent* agent);
+ ~SysAgent() { mgmtObject->resourceDestroy(); }
+
+ ManagementObject* GetManagementObject(void) const
+ { return mgmtObject; }
+ void run();
+
+private:
+ struct LoadAverage {
+ float load1Min;
+ float load5Min;
+ float load10Min;
+ uint32_t procTotal;
+ uint32_t procRunning;
+ };
+
+ struct Mem {
+ uint32_t memTotal;
+ uint32_t memFree;
+ uint32_t swapTotal;
+ uint32_t swapFree;
+ };
+
+ void getLoadAverage(LoadAverage& la);
+ void getMem(Mem& mem);
+};
+
+SysAgent::SysAgent(ManagementAgent* _agent) : agent(_agent)
+{
+ std::string sysname, nodename, release, version, machine;
+
+ // obtain or establish the system-id
+ sysId.generate();
+ mgmtObject = new _qmf::SysImage(agent, this, sysId);
+ qpid::sys::SystemInfo::getSystemId (sysname,
+ nodename,
+ release,
+ version,
+ machine);
+ mgmtObject->set_osName (sysname);
+ mgmtObject->set_nodeName (nodename);
+ mgmtObject->set_release (release);
+ mgmtObject->set_version (version);
+ mgmtObject->set_machine (machine);
+
+ agent->addObject(mgmtObject, 1);
+}
+
+void SysAgent::getLoadAverage(LoadAverage& la)
+{
+ ifstream input("/proc/loadavg");
+ if (!input.good())
+ return;
+
+ input >> la.load1Min;
+ input >> la.load5Min;
+ input >> la.load10Min;
+
+ string procs;
+ input >> procs;
+ input.close();
+
+ la.procTotal = 0;
+ la.procRunning = 0;
+
+ size_t slashPos = procs.find('/');
+ if (slashPos == string::npos)
+ return;
+
+ la.procRunning = ::atoi(procs.substr(0, slashPos).c_str());
+ la.procTotal = ::atoi(procs.substr(slashPos + 1).c_str());
+}
+
+void SysAgent::getMem(Mem& mem)
+{
+ ifstream input("/proc/meminfo");
+ if (!input.good())
+ return;
+
+ while (!input.eof()) {
+ string key;
+ input >> key;
+ if (key == "MemTotal:")
+ input >> mem.memTotal;
+ else if (key == "MemFree:")
+ input >> mem.memFree;
+ else if (key == "SwapTotal:")
+ input >> mem.swapTotal;
+ else if (key == "SwapFree:")
+ input >> mem.swapFree;
+ }
+ input.close();
+}
+
+void SysAgent::run()
+{
+ LoadAverage la;
+ Mem mem;
+
+ getMem(mem);
+ mgmtObject->set_memTotal(mem.memTotal);
+ mgmtObject->set_swapTotal(mem.swapTotal);
+
+ for (;;) {
+ getLoadAverage(la);
+ getMem(mem);
+ mgmtObject->set_loadAverage1Min(la.load1Min);
+ mgmtObject->set_loadAverage5Min(la.load5Min);
+ mgmtObject->set_loadAverage10Min(la.load10Min);
+ mgmtObject->set_procTotal(la.procTotal);
+ mgmtObject->set_procRunning(la.procRunning);
+
+ mgmtObject->set_memFree(mem.memFree);
+ mgmtObject->set_swapFree(mem.swapFree);
+ ::sleep(5);
+ }
+}
+
+//==============================================================
+// Main program
+//==============================================================
+
+ManagementAgent::Singleton* singleton;
+
+void shutdown(int)
+{
+ delete singleton;
+ exit(0);
+}
+
+int main_int(int argc, char** argv)
+{
+ singleton = new ManagementAgent::Singleton();
+ const char* host = argc>1 ? argv[1] : "127.0.0.1";
+ int port = argc>2 ? atoi(argv[2]) : 5672;
+
+ signal(SIGINT, shutdown);
+
+ // Create the qmf management agent
+ ManagementAgent* agent = singleton->getInstance();
+
+ // Register the Qmf_example schema with the agent
+ _qmf::Package packageInit(agent);
+
+ // Start the agent. It will attempt to make a connection to the
+ // management broker
+ agent->init(string(host), port, 5, false, ".magentdata");
+
+ // Allocate core object
+ SysAgent core(agent);
+ core.run();
+}
+
+int main(int argc, char** argv)
+{
+ try {
+ return main_int(argc, argv);
+ } catch(std::exception& e) {
+ cout << "Top Level Exception: " << e.what() << endl;
+ }
+}
+
Added: mgmt/trunk/sesame/cpp/src/qmfgen/Makefile.am
===================================================================
--- mgmt/trunk/sesame/cpp/src/qmfgen/Makefile.am (rev 0)
+++ mgmt/trunk/sesame/cpp/src/qmfgen/Makefile.am 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,11 @@
+
+force:
+
+EXTRA_DIST = schema.xml
+
+qmfgen_cmd=$(QMF_GEN) -o $(srcdir)/qmf -m qmfgen.mk -p $$\(top_srcdir\)/src/qmfgen schema.xml
+
+include qmfgen.mk
+
+all : schema.xml
+ $(qmfgen_cmd)
Added: mgmt/trunk/sesame/cpp/src/qmfgen/qmfgen.mk
===================================================================
--- mgmt/trunk/sesame/cpp/src/qmfgen/qmfgen.mk (rev 0)
+++ mgmt/trunk/sesame/cpp/src/qmfgen/qmfgen.mk 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,28 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http:#www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# This source file was created by a code generator.
+# Please do not edit.
+
+
+qmfgen_sources=$(top_srcdir)/src/qmfgen/qmf/com/redhat/sesame/SysImage.h \
+ $(top_srcdir)/src/qmfgen/qmf/com/redhat/sesame/Package.h \
+ $(top_srcdir)/src/qmfgen/qmf/com/redhat/sesame/SysImage.cpp \
+ $(top_srcdir)/src/qmfgen/qmf/com/redhat/sesame/Package.cpp
+
Added: mgmt/trunk/sesame/cpp/src/qmfgen/schema.xml
===================================================================
--- mgmt/trunk/sesame/cpp/src/qmfgen/schema.xml (rev 0)
+++ mgmt/trunk/sesame/cpp/src/qmfgen/schema.xml 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,30 @@
+<schema package="com.redhat.sesame">
+
+ <class name="SysImage">
+ <property name="uuid" index="y" type="uuid" access="RC" desc="UUID of System Image"/>
+
+ <property name="osName" type="sstr" access="RO" desc="Operating System Name"/>
+ <property name="nodeName" type="sstr" access="RO" desc="Node Name"/>
+ <property name="release" type="sstr" access="RO"/>
+ <property name="version" type="sstr" access="RO"/>
+ <property name="machine" type="sstr" access="RO"/>
+
+ <property name="memTotal" type="uint32" access="RO" unit="kByte"/>
+ <property name="swapTotal" type="uint32" access="RO" unit="kByte"/>
+
+ The following statistics are gathered from /proc/meminfo
+
+ <statistic name="memFree" type="uint32" unit="kByte"/>
+ <statistic name="swapFree" type="uint32" unit="kByte"/>
+
+ The following statistics are gathered from /proc/loadavg
+
+ <statistic name="loadAverage1Min" type="float"/>
+ <statistic name="loadAverage5Min" type="float"/>
+ <statistic name="loadAverage10Min" type="float"/>
+ <statistic name="procTotal" type="uint32"/>
+ <statistic name="procRunning" type="uint32"/>
+ </class>
+
+</schema>
+
More information about the rhmessaging-commits
mailing list