1 package OpenILS::Application;
2 use OpenSRF::Application;
3 use UNIVERSAL::require;
4 use base qw/OpenSRF::Application/;
7 # version format is "x-y-z-p", for example "1-2-1-0" for Evergreen 1.2.1.0
11 __PACKAGE__->register_method(
12 api_name => 'opensrf.open-ils.system.ils_version',
14 method => 'ils_version',
17 __PACKAGE__->register_method(
18 api_name => 'opensrf.open-ils.fetch_idl.file',
20 method => 'get_idl_file',
23 use OpenSRF::Utils::SettingsClient;
24 return OpenSRF::Utils::SettingsClient->new->config_value('IDL');
32 $class = ref($class) || $class;
34 $args{package} ||= $class;
35 __PACKAGE__->SUPER::register_method( %args );
37 if (exists($dup_args{authoritative}) and $dup_args{authoritative}) {
38 (my $name = $dup_args{api_name}) =~ s/$/.authoritative/o;
39 if ($name ne $dup_args{api_name}) {
40 $dup_args{real_api_name} = $dup_args{api_name};
41 $dup_args{method} = 'authoritative_wrapper';
42 $dup_args{api_name} = $name;
43 $dup_args{package} = __PACKAGE__;
44 __PACKAGE__->SUPER::register_method( %dup_args );
49 sub authoritative_wrapper {
51 if (!$OpenILS::Utils::CStoreEditor::_loaded) {
52 die "Couldn't load OpenILS::Utils::CStoreEditor!" unless 'OpenILS::Utils::CStoreEditor'->use;
59 my $method = $self->method_lookup($self->{real_api_name});
62 local $OpenILS::Utils::CStoreEditor::always_xact = 1;
64 $client->respond( $_ ) for ( $method->run(@args) );
66 OpenILS::Utils::CStoreEditor->flush_forced_xacts();