File: | blib/lib/OpenSRF/Application/Settings.pm |
Coverage: | 47.1% |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package OpenSRF::Application::Settings; | ||||||
2 | 1 1 1 | 6 4 6 | use OpenSRF::Application; | ||||
3 | 1 1 1 | 7 4 10 | use OpenSRF::Utils::SettingsParser; | ||||
4 | 1 1 1 | 7 4 9 | use OpenSRF::Utils::Logger qw/$logger/; | ||||
5 | 1 1 1 | 7 4 10 | use base 'OpenSRF::Application'; | ||||
6 | |||||||
7 | sub child_exit { | ||||||
8 | 0 | 0 | $logger->debug("settings server child exiting...$$"); | ||||
9 | } | ||||||
10 | |||||||
11 | |||||||
12 | __PACKAGE__->register_method( method => 'get_host_config', api_name => 'opensrf.settings.host_config.get' ); | ||||||
13 | sub get_host_config { | ||||||
14 | 0 | 0 | my( $self, $client, $host ) = @_; | ||||
15 | 0 | my $parser = OpenSRF::Utils::SettingsParser->new(); | |||||
16 | 0 | return $parser->get_server_config($host); | |||||
17 | } | ||||||
18 | |||||||
19 | __PACKAGE__->register_method( method => 'get_default_config', api_name => 'opensrf.settings.default_config.get' ); | ||||||
20 | sub get_default_config { | ||||||
21 | 0 | 0 | my( $self, $client ) = @_; | ||||
22 | 0 | my $parser = OpenSRF::Utils::SettingsParser->new(); | |||||
23 | 0 | return $parser->get_default_config(); | |||||
24 | } | ||||||
25 | |||||||
26 | |||||||
27 | |||||||
28 | |||||||
29 | __PACKAGE__->register_method( method => 'xpath_get', api_name => 'opensrf.settings.xpath.get' ); | ||||||
30 | |||||||
31 | __PACKAGE__->register_method( | ||||||
32 | method => 'xpath_get', | ||||||
33 | api_name => 'opensrf.settings.xpath.get.raw' ); | ||||||
34 | |||||||
35 | sub xpath_get { | ||||||
36 | 0 | 0 | my($self, $client, $xpath) = @_; | ||||
37 | 0 | warn "*************** Received XPATH $xpath\n"; | |||||
38 | 0 | return OpenSRF::Utils::SettingsParser->new()->_get_all( $xpath ); | |||||
39 | } | ||||||
40 | |||||||
41 | |||||||
42 | 1; |