From 4098c62eb681fa81eedfe9ac9154645c28d137ed Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 26 Apr 2007 02:12:45 +0000 Subject: [PATCH] completely untested and possibly broken settings extention to retrieve defaults when host specific fails git-svn-id: svn://svn.open-ils.org/ILS/trunk@7173 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- OpenSRF/src/perlmods/OpenSRF/Application/Settings.pm | 7 +++++++ OpenSRF/src/perlmods/OpenSRF/Utils/SettingsClient.pm | 12 ++++++++++++ OpenSRF/src/perlmods/OpenSRF/Utils/SettingsParser.pm | 6 ++++++ 3 files changed, 25 insertions(+) diff --git a/OpenSRF/src/perlmods/OpenSRF/Application/Settings.pm b/OpenSRF/src/perlmods/OpenSRF/Application/Settings.pm index 561b1d8a1a..66d9f32478 100644 --- a/OpenSRF/src/perlmods/OpenSRF/Application/Settings.pm +++ b/OpenSRF/src/perlmods/OpenSRF/Application/Settings.pm @@ -16,6 +16,13 @@ sub get_host_config { return $parser->get_server_config($host); } +__PACKAGE__->register_method( method => 'get_default_config', api_name => 'opensrf.settings.default_config.get' ); +sub get_default_config { + my( $self, $client ) = @_; + my $parser = OpenSRF::Utils::SettingsParser->new(); + return $parser->get_default_config(); +} + diff --git a/OpenSRF/src/perlmods/OpenSRF/Utils/SettingsClient.pm b/OpenSRF/src/perlmods/OpenSRF/Utils/SettingsClient.pm index d91b9e5ea3..ab936f32ec 100755 --- a/OpenSRF/src/perlmods/OpenSRF/Utils/SettingsClient.pm +++ b/OpenSRF/src/perlmods/OpenSRF/Utils/SettingsClient.pm @@ -85,9 +85,21 @@ sub grab_host_config { } catch OpenSRF::EX with { + if( ! ($session->connect()) ) {die "Settings Connect timed out\n";} + $req = $session->request( "opensrf.settings.default_config.get" ); + $resp = $req->recv( timeout => 10 ); + + } catch Error with { + my $e = shift; warn "Connection to Settings Failed $e : $@ ***\n"; die $e; + + } otherwise { + + my $e = shift; + warn "Settings Retrieval Failed $e : $@ ***\n"; + die $e; }; if(!$resp) { diff --git a/OpenSRF/src/perlmods/OpenSRF/Utils/SettingsParser.pm b/OpenSRF/src/perlmods/OpenSRF/Utils/SettingsParser.pm index 9777626af1..5e280e025b 100755 --- a/OpenSRF/src/perlmods/OpenSRF/Utils/SettingsParser.pm +++ b/OpenSRF/src/perlmods/OpenSRF/Utils/SettingsParser.pm @@ -133,6 +133,12 @@ sub get_server_config { return $self->_get( $xpath ); } +sub get_default_config { + my( $self, $server ) = @_; + my $xpath = "/opensrf/default"; + return $self->_get( $xpath ); +} + sub get_bootstrap_config { my( $self ) = @_; my $xpath = "/opensrf/bootstrap"; -- 2.11.0