diff options
Diffstat (limited to 'os-plugins/OpenSLX/OSPlugin/Roster.pm')
-rw-r--r-- | os-plugins/OpenSLX/OSPlugin/Roster.pm | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Roster.pm b/os-plugins/OpenSLX/OSPlugin/Roster.pm new file mode 100644 index 00000000..776907e4 --- /dev/null +++ b/os-plugins/OpenSLX/OSPlugin/Roster.pm @@ -0,0 +1,56 @@ +# Copyright (c) 2006, 2007 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# OSPlugin::Roster.pm +# - provides information about all available plugins +# ----------------------------------------------------------------------------- +package OpenSLX::OSPlugin::Roster; + +use strict; +use warnings; + +use OpenSLX::Basics; + +=item C<addAllDefaultAttributesToHash()> + +Fetches attribute info from all available plugins and adds it to the given +hash-ref. + +=over + +=item Return Value + +1 + +=back + +=cut + +sub addAllDefaultAttributesToHash +{ + my $class = shift; + my $attrInfo = shift; + + my $pluginPath = "$openslxConfig{'base-path'}/lib/plugins"; + foreach my $modulePath (glob("$pluginPath/*")) { + next if $modulePath !~ m{/([^/]+)$}; + my $pluginName = $1; + my $class = "OpenSLX::OSPlugin::$pluginName"; + vlog(2, "loading plugin $class from path '$modulePath'"); + my $plugin = instantiateClass($class, { pathToClass => $modulePath }); + my $pluginAttrInfo = $plugin->getAttrInfo(); + foreach my $attr (keys %$pluginAttrInfo) { + $attrInfo->{$attr} = $pluginAttrInfo->{$attr}; + } + } + return 1; +} + +1; |