Annotation of nsdl/lib/perl/Apache/LONCAPA/ToTheGateway.pm, revision 1.3
1.1 harris41 1: # Apache::LONCAPA::ToTheGateway
2: #
3: # ToTheGateway.pm
4: # API for passing information from LONCAPA to the Gateway Server
5: #
6: # For more documentation, read the POD documentation
7: # of this module with the perldoc command:
8: #
9: # perldoc ./ToTheGateway.pm
10: #
11: # Brief description
12: # =================
13: #
14: # This module contains functionality for
15: # transferring information from LON-CAPA to the Gateway Server.
16: #
17: # In terms of the overall data flow, the
18: # '=====>' below indicates the role of this
19: # module.
20: #
21: # NSDL ---------> Gateway --------> LON-CAPA
22: # LON-CAPA =====> Gateway --------> NSDL
23: #
24: # SUBROUTINES:
25: # LONCAPA->answer_search_request
26: # LONCAPA->answer_metadata_record_request
27: # LONCAPA->answer_resource_request
28:
29: # Year 2002
30: # Scott Harrison
31: # February-May
32: #
33: ###
34:
35: package Apache::LONCAPA::ToTheGateway;
36:
37: # ================================================================ DEPENDENCIES
38: use strict; # enforce handling of variables, references and subroutines
1.3 ! harris41 39: use Apache::Constants qw(:common);
! 40: use Apache::LONCAPA::FromTheGateway;
1.1 harris41 41:
42: # ============================================================ MODULE VARIABLES
1.3 ! harris41 43: my $VERSION = sprintf("%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/);
1.1 harris41 44:
45: # ================================================================= SUBROUTINES
46:
1.3 ! harris41 47: # ----------------------------- Handling routine called via Apache and mod_perl
! 48: sub handler {
! 49: my $r = shift;
! 50: Apache::GATEWAY::Common::readCGI($r);
! 51: my $output;
! 52: if ($ENV{'form.verb'} eq 'search') {
! 53: # NSDL->answer_metadata_record_request
! 54: $output=
! 55: Apache::LONCAPA::FromTheGateway::search_or_browse_against_NSDLgateway(\%ENV);
! 56: }
! 57: my $cgi;
! 58: foreach my $key (keys %ENV) {
! 59: if ($key=~/^form\./) {
! 60: $cgi.="$key: $ENV{$key}\n";
! 61: }
! 62: }
! 63: $r->content_type('text/html');
! 64: $r->send_http_header;
! 65: return(OK) if $r->header_only;
! 66: $r->print(<<END);
! 67: <html>
! 68: <head><title>Test Output</title></head>
! 69: <body>
! 70: <h1>Apache::LONCAPA::ToTheGateway</h1>
! 71: <h2>Input</h2>
! 72: <pre>
! 73: $cgi
! 74: </pre>
! 75: <h2>Output</h2>
! 76: <pre>
! 77: $output
! 78: </pre>
! 79: </body>
! 80: </html>
! 81: END
! 82: return(OK);
! 83: }
! 84:
1.1 harris41 85: # ---------------------------------------------- LONCAPA->answer_search_request
86: sub answer_search_request {
87: # Not yet implemented
88: # Need to specifically characterize INPUT arguments and OUTPUT data
89: }
90:
91: # ------------------------------------- LONCAPA->answer_metadata_record_request
92: sub answer_metadata_record_request {
1.3 ! harris41 93: my ($url)=@_;
! 94: return "will have multiplexed this and returned from LON-CAPA network\n";
1.1 harris41 95: }
96:
97: # -------------------------------------------- LONCAPA->answer_resource_request
98: sub answer_resource_request {
99: # Not yet implemented
100: # Need to specifically characterize INPUT arguments and OUTPUT data
101: }
102:
103: 1;
104:
105: __END__
106:
107: =pod
108:
109: =head1 NAME
110:
111: B<Apache::LONCAPA::ToTheGateway> - API for passing information from LONCAPA to the Gateway Server
112:
113: =head1 SYNOPSIS
114:
115: use Apache::LONCAPA::ToTheGateway;
116:
117: my $arrayref=
118: Apache::LONCAPA::ToTheGateway::answer_search_request
119: ($search_request);
120:
121: =head1 DESCRIPTION
122:
123: This module contains functionality for
124: transferring information to LON-CAPA from the Gateway Server.
125:
126: In terms of the overall data flow, the
127: '=====>' below indicates the role of this
128: module.
129:
1.2 harris41 130: NSDL ---------E<gt> Gateway --------E<gt> LON-CAPA
1.1 harris41 131:
1.2 harris41 132: B<LON-CAPA =====E<gt> Gateway> --------E<gt> NSDL
1.1 harris41 133:
134: =head2 EXIT CODES
135:
136: The subroutines of this module all output an exit code which
137: describes the status of function completion. The exit code
138: may be followed by a more descriptive message such as:
139:
140: FORMATERROR:Sun May 5 20:15:16 GMT 2002:missing 'protocol://' pattern
141:
142: =over 4
143:
144: =item *
145:
146: B<'SUCCESS'>, information was found and is being returned
147:
148: =item *
149:
150: B<'EMPTY'>, everything functioned properly, but no information was present
151:
152: =item *
153:
154: B<'BADEMPTY'>, everything appeared to function properly, but no information
155: was present (which defies expectation); this is useful for detecting phantom
156: cases of connectivity when verifying test cases of vertical software partitions
157:
158: =item *
159:
160: B<'TIMEOUT'>, the request is taking WAY too long
161:
162: =item *
163:
164: B<'FORMATERROR'>, the input argument is not formatted correctly in a way that
165: can be processed by the NSDL server
166:
167: =item *
168:
169: B<'CONNECTIONFAILURE'>, the NSDL server cannot be contacted
170:
171: =back
172:
173: =head2 SUBROUTINES
174:
175: Note that the subroutines all output an exit code which
176: describes the status of function completion.
177:
178: In the case of failed function completion, the other
179: output argument(s) will typically only be 'NULL' values.
180:
181: =over 4
182:
183: =item B<Apache::LONCAPA::answer_search_request>
184:
185: =over 4
186:
187: =item B<Input> - Scalar string
188:
189: Memory location of Gateway Server results.
190:
191: =item B<Output> - Scalar string, Scalar string reference
192:
193: An exit code is returned as a scalar string.
194:
195: View the Gateway Server results.
196:
197: =item B<Description>
198:
199: This facilitates the passing of LON-CAPA search results
200: B<This relates to information that has passed
201: from LON-CAPA I<to the> GATEWAY>.
202:
203: =item B<Status of Implementation>
204:
205: n/a
206:
207: =back
208:
209: =item B<Apache::LONCAPA::answer_metadata_record_request>
210:
211: =over 4
212:
213: =item B<Input> - Scalar string
214:
215: Identifier for a specific LON-CAPA metadata record.
216:
217: =item B<Output> - Scalar string, Scalar string reference
218:
219: An exit code is returned as a scalar string.
220:
221: A pointer to the metadata.
222:
223: =item B<Description>
224:
225: This provides the metadata of the resource matching a given identifier.
226: B<The information has passed from LONCAPA I<to the> GATEWAY>.
227:
228: =item B<Status of Implementation>
229:
230: n/a
231:
232: =back
233:
234: =item B<Apache::LONCAPA::answer_resource_request>
235:
236: =over 4
237:
238: =item B<Input> - Scalar string
239:
240: Identifier for LON-CAPA resource.
241:
242: =item B<Output> - Scalar string, Scalar string reference.
243:
244: An exit code is returned as a scalar string.
245:
246: Pointer to information about accessing LON-CAPA resource.
247:
248: =item B<Description>
249:
250: This gives access to a LON-CAPA resource.
251: B<The information has passed from LON-CAPA I<to the> GATEWAY>.
252:
253: =item B<Status of Implementation>
254:
255: n/a
256:
257: =back
258:
259: =back
260:
261: =head1 README
262:
263: B<Apache::LONCAPA::ToTheGateway>
264: is part of the NSDL-LONCAPA Gateway Server system.
265: Please see http://nsdl.lon-capa.org/ for more information.
266:
267: =head1 AUTHOR
268:
269: Scott Harrison, 2002
270:
271: =head1 PREREQUISITES
272:
273: This module requires the C<strict> module.
274:
275: =head1 COREQUISITES
276:
277: Apache::NSDL::FromTheGateway
278: Apache::NSDL::ToTheGateway
279: Apache::GATEWAY::ToNSDL
280: Apache::GATEWAY::FromNSDL
281: Apache::GATEWAY::ToLONCAPA
282: Apache::GATEWAY::FromLONCAPA
283: Apache::LONCAPA::FromTheGateway
284:
285: =head1 SEE ALSO
286:
287: http://www.lon-capa.org/
288:
289: http://www.smete.org/
290:
291: Also visit the other Apache::NSDL::*, Apache::LONCAPA::*,
292: and Apache::GATEWAY::* manpages.
293:
294: =head1 OSNAMES
295:
296: linux
297:
298: =cut
299:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>