| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
############################################################################# |
|
3
|
|
|
|
|
|
|
## $Id: CallDispatcher.pm 6783 2006-08-11 17:43:28Z spadkins $ |
|
4
|
|
|
|
|
|
|
############################################################################# |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package App::CallDispatcher; |
|
7
|
|
|
|
|
|
|
$VERSION = (q$Revision: 6783 $ =~ /(\d[\d\.]*)/)[0]; # VERSION numbers generated by svn |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use App; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
21
|
|
|
10
|
1
|
|
|
1
|
|
410
|
use App::Service; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
47
|
|
|
11
|
|
|
|
|
|
|
@ISA = ( "App::Service" ); |
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
159
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
App::CallDispatcher - synchronous (potentially remote) call_dispatcher invocation |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use App; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$context = App->context(); |
|
24
|
|
|
|
|
|
|
$call_dispatcher = $context->service("CallDispatcher"); # or ... |
|
25
|
|
|
|
|
|
|
$call_dispatcher = $context->call_dispatcher(); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$call_dispatcher->call($request, $response); |
|
28
|
|
|
|
|
|
|
$response = $call_dispatcher->call($request); |
|
29
|
|
|
|
|
|
|
$response = $call_dispatcher->call(%named); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
A CallDispatcher service is a means by which a function call (perhaps remote) |
|
34
|
|
|
|
|
|
|
may be made synchronously. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
############################################################################# |
|
39
|
|
|
|
|
|
|
# CLASS GROUP |
|
40
|
|
|
|
|
|
|
############################################################################# |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 Class Group: CallDispatcher |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
The following classes might be a part of the CallDispatcher Class Group. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=over |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item * Class: App::CallDispatcher |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item * Class: App::CallDispatcher::HTTPSimple |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item * Class: App::CallDispatcher::SOAP |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item * Class: App::CallDispatcher::pRPC |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item * Class: App::CallDispatcher::PlRPC |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item * Class: App::CallDispatcher::Messaging |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=back |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
############################################################################# |
|
65
|
|
|
|
|
|
|
# CLASS |
|
66
|
|
|
|
|
|
|
############################################################################# |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 Class: App::CallDispatcher |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
A CallDispatcher service is a means by which a function call (perhaps remote) |
|
71
|
|
|
|
|
|
|
may be made synchronously or asynchronously. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
* Throws: App::Exception::CallDispatcher |
|
74
|
|
|
|
|
|
|
* Since: 0.01 |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 Class Design |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
... |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
############################################################################# |
|
83
|
|
|
|
|
|
|
# CONSTRUCTOR METHODS |
|
84
|
|
|
|
|
|
|
############################################################################# |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 Constructor Methods: |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
############################################################################# |
|
91
|
|
|
|
|
|
|
# new() |
|
92
|
|
|
|
|
|
|
############################################################################# |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 new() |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
The constructor is inherited from |
|
97
|
|
|
|
|
|
|
L|App::Service/"new()">. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
############################################################################# |
|
102
|
|
|
|
|
|
|
# PUBLIC METHODS |
|
103
|
|
|
|
|
|
|
############################################################################# |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 Public Methods: |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
############################################################################# |
|
110
|
|
|
|
|
|
|
# call() |
|
111
|
|
|
|
|
|
|
############################################################################# |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 call() |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
* Signature: @returnvals = $call_dispatcher->call($service, $name, $method, $args); |
|
116
|
|
|
|
|
|
|
* Param: $service string [in] |
|
117
|
|
|
|
|
|
|
* Param: $name string [in] |
|
118
|
|
|
|
|
|
|
* Param: $method string [in] |
|
119
|
|
|
|
|
|
|
* Param: $args ARRAY [in] |
|
120
|
|
|
|
|
|
|
* Return: @returnvals any |
|
121
|
|
|
|
|
|
|
* Throws: App::Exception::CallDispatcher |
|
122
|
|
|
|
|
|
|
* Since: 0.01 |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Sample Usage: |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
@returnvals = $call_dispatcher->call("Repository","db", |
|
127
|
|
|
|
|
|
|
"get_rows",["city",{city_cd=>"LAX"},["city_cd","state","country"]]); |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
The default call dispatcher is a local call dispatcher. |
|
130
|
|
|
|
|
|
|
It simply passes the call() on to the local context for execution. |
|
131
|
|
|
|
|
|
|
It results in an in-process method call rather than a remote method call. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub call { |
|
136
|
0
|
|
|
0
|
1
|
|
my ($self, $service, $name, $method, $args) = @_; |
|
137
|
0
|
|
|
|
|
|
my $context = $self->{context}; |
|
138
|
0
|
|
|
|
|
|
my @returnvals = $context->call($service, $name, $method, $args); |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
############################################################################# |
|
142
|
|
|
|
|
|
|
# PROTECTED METHODS |
|
143
|
|
|
|
|
|
|
############################################################################# |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 Protected Methods: |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
############################################################################# |
|
150
|
|
|
|
|
|
|
# Method: service_type() |
|
151
|
|
|
|
|
|
|
############################################################################# |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 service_type() |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Returns 'CallDispatcher'; |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
* Signature: $service_type = App::CallDispatcher->service_type(); |
|
158
|
|
|
|
|
|
|
* Param: void |
|
159
|
|
|
|
|
|
|
* Return: $service_type string |
|
160
|
|
|
|
|
|
|
* Since: 0.01 |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
$service_type = $cdisp->service_type(); |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub service_type () { 'CallDispatcher'; } |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
* Author: Stephen Adkins |
|
171
|
|
|
|
|
|
|
* License: This is free software. It is licensed under the same terms as Perl itself. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
L|App::Context>, |
|
176
|
|
|
|
|
|
|
L|App::Service> |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=cut |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
1; |
|
181
|
|
|
|
|
|
|
|