summaryrefslogtreecommitdiffstats
path: root/os-plugins/OpenSLX
diff options
context:
space:
mode:
authorOliver Tappe2008-06-03 00:30:19 +0200
committerOliver Tappe2008-06-03 00:30:19 +0200
commit9bdcb088ebddb422cd8e9a27e688e9718cf50013 (patch)
treeb739b9ea762bc0aade42bd52f4d47db9b20ab9da /os-plugins/OpenSLX
parent* separated synchronization of attributes from removal of stale references, (diff)
downloadcore-9bdcb088ebddb422cd8e9a27e688e9718cf50013.tar.gz
core-9bdcb088ebddb422cd8e9a27e688e9718cf50013.tar.xz
core-9bdcb088ebddb422cd8e9a27e688e9718cf50013.zip
Implemented a better algorithm for keeping the plugins and the references
to them (and their attributes) in the DB in sync: * The DB now keeps a hash-value for the list of known plugins and their attributes and checks this value against the current one on every connect. If the values do not match, the DB is brought up-to-date automatically (i.e. the attributes are synchronized with the systems, clients and groups). git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1837 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/OpenSLX')
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Roster.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Roster.pm b/os-plugins/OpenSLX/OSPlugin/Roster.pm
index 7bfed044..93887ec7 100644
--- a/os-plugins/OpenSLX/OSPlugin/Roster.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Roster.pm
@@ -18,6 +18,7 @@ use warnings;
use OpenSLX::Basics;
use Clone qw(clone);
+use Digest::MD5 qw(md5_hex);
my %plugins;
@@ -40,6 +41,28 @@ sub getAvailablePlugins
return \%pluginInfo;
}
+=item C<computeMD5HashOverAvailablePlugins()>
+
+Returns a MD5 hash representing the list of available plugins and all their
+attributes.
+
+=cut
+
+sub computeMD5HashOverAvailablePlugins
+{
+ my $class = shift;
+
+ $class->_init() if !%plugins;
+
+ my $pluginInfoString = '';
+ foreach my $pluginName (sort keys %plugins) {
+ my $attrInfo = $plugins{$pluginName}->getAttrInfo();
+ my $attrList = join ',', sort keys %$attrInfo;
+ $pluginInfoString .= $pluginName . '(' . $attrList . ')';
+ }
+ return md5_hex($pluginInfoString);
+}
+
=item C<getPlugin()>
Returns an instance of the plugin with the given name