From: miker Date: Thu, 26 Apr 2007 02:12:45 +0000 (+0000) Subject: completely untested and possibly broken settings extention to retrieve defaults when... X-Git-Tag: osrf_rel_2_0_1~1038 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9714f4082176edf3075c0cae1065afe660811f9e;p=OpenSRF.git completely untested and possibly broken settings extention to retrieve defaults when host specific fails git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@863 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/perlmods/OpenSRF/Application/Settings.pm b/src/perlmods/OpenSRF/Application/Settings.pm index 561b1d8..66d9f32 100644 --- a/src/perlmods/OpenSRF/Application/Settings.pm +++ b/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/src/perlmods/OpenSRF/Utils/SettingsClient.pm b/src/perlmods/OpenSRF/Utils/SettingsClient.pm index d91b9e5..ab936f3 100755 --- a/src/perlmods/OpenSRF/Utils/SettingsClient.pm +++ b/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/src/perlmods/OpenSRF/Utils/SettingsParser.pm b/src/perlmods/OpenSRF/Utils/SettingsParser.pm index 9777626..5e280e0 100755 --- a/src/perlmods/OpenSRF/Utils/SettingsParser.pm +++ b/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";