diff options
author | Oliver Tappe | 2008-01-27 15:51:47 +0100 |
---|---|---|
committer | Oliver Tappe | 2008-01-27 15:51:47 +0100 |
commit | fde7d8f091d03b8d2c0c14e3f56eab700082beba (patch) | |
tree | d940abafc4d6b261805cd0cb7b381246ef85b732 /os-plugins/OpenSLX/OSPlugin | |
parent | * fixed bug that left orphaned installed_plugins when removing a vendor-OS (diff) | |
download | core-fde7d8f091d03b8d2c0c14e3f56eab700082beba.tar.gz core-fde7d8f091d03b8d2c0c14e3f56eab700082beba.tar.xz core-fde7d8f091d03b8d2c0c14e3f56eab700082beba.zip |
Hopefully finished the adjustments of the tools with respect to theme
naming and other recent discussions of user interface.
* adjusted and simplified code to the fact that plugins are now named
in all lowercase
* slxos-plugin --verbose list now shows description for each plugin and
a list of supported attributes
* fixed some outstanding issues with respect to lowercasing of plugin names
* Separated theme::name into theme::splash, theme::displaymanager and
theme::desktop, leading to DB-schema 0.24.
Please note that although these attributes exist, currently only
theme::splash is being used (the new ones will be used by the reimplemented
mkdxsinitrd)
* moved some information gathering from OSPlugin::Engine into OSPlugin::Roster,
where it belongs
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1500 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/OpenSLX/OSPlugin')
-rw-r--r-- | os-plugins/OpenSLX/OSPlugin/Engine.pm | 10 | ||||
-rw-r--r-- | os-plugins/OpenSLX/OSPlugin/Roster.pm | 63 |
2 files changed, 58 insertions, 15 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm index bdf259f4..fe2bf1ac 100644 --- a/os-plugins/OpenSLX/OSPlugin/Engine.pm +++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm @@ -36,16 +36,6 @@ sub new return bless $self, $class; } -sub getAvailablePlugins -{ # Class-method! - my $class = shift; - - return - map { basename($_); } - sort - glob("$openslxConfig{'base-path'}/lib/plugins/*"); -} - sub initialize { my $self = shift; diff --git a/os-plugins/OpenSLX/OSPlugin/Roster.pm b/os-plugins/OpenSLX/OSPlugin/Roster.pm index 776907e4..832b0bb3 100644 --- a/os-plugins/OpenSLX/OSPlugin/Roster.pm +++ b/os-plugins/OpenSLX/OSPlugin/Roster.pm @@ -18,6 +18,46 @@ use warnings; use OpenSLX::Basics; +my %plugins; + +=item C<getAvailablePlugins()> + +Returns a hash that keys the names of available plugins to their info hash. + +=cut + +sub getAvailablePlugins +{ + my $class = shift; + + $class->_init() if !%plugins; + + my %pluginInfo; + foreach my $pluginName (keys %plugins) { + $pluginInfo{$pluginName} = $plugins{$pluginName}->getInfo(); + } + return \%pluginInfo; +} + +=item C<getPluginAttrInfo()> + +Returns a hash that contains info about the attributes support by the +given plugin + +=cut + +sub getPluginAttrInfo +{ + my $class = shift; + my $pluginName = shift; + + $class->_init() if !%plugins; + + return if !$plugins{$pluginName}; + + return $plugins{$pluginName}->getAttrInfo(); +} + =item C<addAllDefaultAttributesToHash()> Fetches attribute info from all available plugins and adds it to the given @@ -38,6 +78,22 @@ sub addAllDefaultAttributesToHash my $class = shift; my $attrInfo = shift; + $class->_init() if !%plugins; + + foreach my $plugin (values %plugins) { + my $pluginAttrInfo = $plugin->getAttrInfo(); + foreach my $attr (keys %$pluginAttrInfo) { + $attrInfo->{$attr} = $pluginAttrInfo->{$attr}; + } + } + return 1; +} + +sub _init +{ + my $class = shift; + + %plugins = (); my $pluginPath = "$openslxConfig{'base-path'}/lib/plugins"; foreach my $modulePath (glob("$pluginPath/*")) { next if $modulePath !~ m{/([^/]+)$}; @@ -45,12 +101,9 @@ sub addAllDefaultAttributesToHash 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}; - } + $plugins{$pluginName} = $plugin; } - return 1; + return; } 1; |