--- nsdl/lib/perl/Apache/NSDL/ToTheGateway.pm 2002/05/30 17:07:38 1.5 +++ nsdl/lib/perl/Apache/NSDL/ToTheGateway.pm 2002/07/14 08:12:13 1.7 @@ -42,7 +42,8 @@ use Apache::GATEWAY::Common; use Apache::NSDL::FromTheGateway; # ============================================================ MODULE VARIABLES -my $VERSION = sprintf("%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/); +my $VERSION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/); +my $hostname='nsdl.lon-capa.org'; # ================================================================= SUBROUTINES @@ -52,29 +53,83 @@ sub handler { Apache::GATEWAY::Common::readCGI($r); my $output; if ($ENV{'form.verb'} eq 'GetRecord') { - $output= + # arguments: identifier, metadataPrefix + if(!defined($ENV{'form.identifier'})) { + my $responseDate=Apache::GATEWAY::Common::responseDate(); + my $requestURL=Apache::GATEWAY::Common::requestURL(); + $output=(< + + $responseDate + $requestURL + Missing identifier argument + +END + } + elsif(!defined($ENV{'form.metadataPrefix'})) { + my $responseDate=Apache::GATEWAY::Common::responseDate(); + my $requestURL=Apache::GATEWAY::Common::requestURL(); + $output=(< + + $responseDate + $requestURL + Missing metadataPrefix argument + +END + } + elsif ($ENV{'form.metadataPrefix'} ne 'oai_dc' and + $ENV{'form.metadataPrefix'} ne 'loncapa_ieeelom') { + my $responseDate=Apache::GATEWAY::Common::responseDate(); + my $requestURL=Apache::GATEWAY::Common::requestURL(); + $output=(< + + $responseDate + $requestURL + Cannot disseminate the requested +metadata format + +END + } + else { + my $status; + ($status,$output)= Apache::NSDL::FromTheGateway::view_LONCAPAgateway_metadata_record(\%ENV); + } } elsif ($ENV{'form.verb'} eq 'Identify') { + # arguments: none my $responseDate=Apache::GATEWAY::Common::responseDate(); + my $requestURL=Apache::GATEWAY::Common::requestURL(); $output=(< - + xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ + http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> $responseDate - http://nsdl.lon-capa.org/OAI-script?verb=Identify + $requestURL + The LearningOnline Network with CAPA - http://nsdl.lon-capa.org/OAI-script + http://$hostname/OAI-script 1.1 - mailto:korte@lite.msu.edu + mailto:korte\@lite.msu.edu - + xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai-identifier + http://www.openarchives.org/OAI/2.0/oai-identifier.xsd"> oai loncapa : @@ -82,67 +137,162 @@ sub handler { - + xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/eprints + http://www.openarchives.org/OAI/2.0/eprints.xsd"> - http://nsdl.lon-capa.org/info/content.htm + http://$hostname/info/content.html + Educational materials from the LearningOnline Network Metadata can be used by authorized users - http://nsdl.lon-capa.org/metadata_use.htm Full content, i.e. preprints may not be harvested by robots - http://nsdl.lon-capa.org/info/submission.htm + Submissions can be made by institutions with installed +LON-CAPA servers. + END } elsif ($ENV{'form.verb'} eq 'ListIdentifiers') { - $output='not yet implemented'; + # arguments: until, from, set, resumptionToken +# $output= +# Apache::NSDL::FromTheGateway::search_against_LONCAPAgateway(\%ENV); + # no full implementation scheme yet so... + my $responseDate=Apache::GATEWAY::Common::responseDate(); + my $requestURL=Apache::GATEWAY::Common::requestURL(); + $output=(< + + $responseDate + $requestURL + No set hierarchy available yet for this +gateway. + +END } elsif ($ENV{'form.verb'} eq 'ListMetadataFormats') { - $output='not yet implemented'; + # arguments: identifier + my $responseDate=Apache::GATEWAY::Common::responseDate(); + my $requestURL=Apache::GATEWAY::Common::requestURL(); + $output=(< + + $responseDate + $requestURL + + oai_dc + http://www.openarchives.org/OAI/1.1/dc.xsd + http://purl.org/dc/elements/1.1/ + + + loncapa_ieeelom + http://nsdl.lon-capa.org/lom/6.4/ieeelom.xsd + http://nsdl.lon-capa.org/lom/6.4/ + + +END } elsif ($ENV{'form.verb'} eq 'ListRecords') { - $output='not yet implemented'; + # arguments: until, from, set, resumptionToken +# $output= +# Apache::NSDL::FromTheGateway::search_against_LONCAPAgateway(\%ENV); + my $responseDate=Apache::GATEWAY::Common::responseDate(); + my $requestURL=Apache::GATEWAY::Common::requestURL(); + $output=(< + + $responseDate + $requestURL + No set hierarchy available yet for this +gateway. + +END } elsif ($ENV{'form.verb'} eq 'ListSets') { - $output='not yet implemented'; + # arguments: resumptionToken +# $output='not yet implemented'; + my $responseDate=Apache::GATEWAY::Common::responseDate(); + my $requestURL=Apache::GATEWAY::Common::requestURL(); + $output=(< + + $responseDate + $requestURL + No set hierarchy available yet for this +gateway. + +END } - $output=~s/\>/\>/g; - $output=~s/\ + + $responseDate + $requestURL + Illegal OAI verb + +END } - $r->content_type('text/html'); + $r->content_type('text/xml'); $r->send_http_header; return(OK) if $r->header_only; $r->print(< -Test Output - -

Apache::NSDL::ToTheGateway

-

Input

-
-$cgi
-
-

Output

-
 $output
-
- - END + +# $output=~s/\>/\>/g; +# $output=~s/\content_type('text/html'); +# $r->send_http_header; +# return(OK) if $r->header_only; +# $r->print(< +#Test Output +# +#

Apache::NSDL::ToTheGateway

+#

Input

+#
+#$cgi
+#
+#

Output

+#
+#$output
+#
+# +# +#END return(OK); } @@ -166,8 +316,8 @@ sub answer_metadata_record_request { # ----------------------------------------------- NSDL->answer_resource_request sub answer_resource_request { -# Not yet implemented -# Need to specifically characterize INPUT arguments and OUTPUT data + my ($eref)=@_; + return Apache::NSDL::FromTheGateway($eref); } 1;