version 1.4, 2002/05/29 01:17:55
|
version 1.7, 2002/07/14 08:12:13
|
Line 43 use Apache::NSDL::FromTheGateway;
|
Line 43 use Apache::NSDL::FromTheGateway;
|
|
|
# ============================================================ MODULE VARIABLES |
# ============================================================ MODULE VARIABLES |
my $VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/); |
my $VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/); |
|
my $hostname='nsdl.lon-capa.org'; |
|
|
# ================================================================= SUBROUTINES |
# ================================================================= SUBROUTINES |
|
|
Line 52 sub handler {
|
Line 53 sub handler {
|
Apache::GATEWAY::Common::readCGI($r); |
Apache::GATEWAY::Common::readCGI($r); |
my $output; |
my $output; |
if ($ENV{'form.verb'} eq 'GetRecord') { |
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=(<<END); |
|
<?xml version="1.0" encoding="UTF-8"?> |
|
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" |
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ |
|
http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> |
|
<responseDate>$responseDate</responseDate> |
|
<request>$requestURL</request> |
|
<error code="badArgument">Missing identifier argument</error> |
|
</OAI-PMH> |
|
END |
|
} |
|
elsif(!defined($ENV{'form.metadataPrefix'})) { |
|
my $responseDate=Apache::GATEWAY::Common::responseDate(); |
|
my $requestURL=Apache::GATEWAY::Common::requestURL(); |
|
$output=(<<END); |
|
<?xml version="1.0" encoding="UTF-8"?> |
|
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" |
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ |
|
http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> |
|
<responseDate>$responseDate</responseDate> |
|
<request>$requestURL</request> |
|
<error code="badArgument">Missing metadataPrefix argument</error> |
|
</OAI-PMH> |
|
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=(<<END); |
|
<?xml version="1.0" encoding="UTF-8"?> |
|
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" |
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ |
|
http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> |
|
<responseDate>$responseDate</responseDate> |
|
<request>$requestURL</request> |
|
<error code="cannotDisseminateFormat">Cannot disseminate the requested |
|
metadata format</error> |
|
</OAI-PMH> |
|
END |
|
} |
|
else { |
|
my $status; |
|
($status,$output)= |
Apache::NSDL::FromTheGateway::view_LONCAPAgateway_metadata_record(\%ENV); |
Apache::NSDL::FromTheGateway::view_LONCAPAgateway_metadata_record(\%ENV); |
|
} |
} |
} |
elsif ($ENV{'form.verb'} eq 'Identify') { |
elsif ($ENV{'form.verb'} eq 'Identify') { |
|
# arguments: none |
|
my $responseDate=Apache::GATEWAY::Common::responseDate(); |
|
my $requestURL=Apache::GATEWAY::Common::requestURL(); |
$output=(<<END); |
$output=(<<END); |
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
<Identify |
<OAI-PMH |
xmlns="http://www.openarchives.org/OAI/1.1/OAI_Identify" |
xmlns="http://www.openarchives.org/OAI/2.0/" |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xsi:schemaLocation="http://www.openarchives.org/OAI/1.1/OAI_Identify |
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ |
http://www.openarchives.org/OAI/1.1/OAI_Identify.xsd"> |
http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> |
<responseDate>2001-06-01T19:20:30-04:00</responseDate> |
<responseDate>$responseDate</responseDate> |
<requestURL>http://nsdl.lon-capa.org/OAI-script?verb=Identify</requestURL> |
<requestURL>$requestURL</requestURL> |
|
<Identify > |
<repositoryName>The LearningOnline Network with CAPA</repositoryName> |
<repositoryName>The LearningOnline Network with CAPA</repositoryName> |
<baseURL>http://nsdl.lon-capa.org/OAI-script</baseURL> |
<baseURL>http://$hostname/OAI-script</baseURL> |
<protocolVersion>1.1</protocolVersion> |
<protocolVersion>1.1</protocolVersion> |
<adminEmail>mailto:korte@lite.msu.edu</adminEmail> |
<adminEmail>mailto:korte\@lite.msu.edu</adminEmail> |
<description> |
<description> |
<oai-identifier xmlns="http://www.openarchives.org/OAI/1.1/oai-identifier" |
<oai-identifier xmlns="http://www.openarchives.org/OAI/2.0/oai-identifier" |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xsi:schemaLocation="http://www.openarchives.org/OAI/1.1/oai-identifier |
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai-identifier |
http://www.openarchives.org/OAI/1.1/oai-identifier.xsd"> |
http://www.openarchives.org/OAI/2.0/oai-identifier.xsd"> |
<scheme>oai</scheme> |
<scheme>oai</scheme> |
<repositoryIdentifier>loncapa</repositoryIdentifier> |
<repositoryIdentifier>loncapa</repositoryIdentifier> |
<delimiter>:</delimiter> |
<delimiter>:</delimiter> |
Line 81 sub handler {
|
Line 137 sub handler {
|
</oai-identifier> |
</oai-identifier> |
</description> |
</description> |
<description> |
<description> |
<eprints xmlns="http://www.openarchives.org/OAI/1.1/eprints" |
<eprints xmlns="http://www.openarchives.org/OAI/2.0/eprints" |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xsi:schemaLocation="http://www.openarchives.org/OAI/1.1/eprints |
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/eprints |
http://www.openarchives.org/OAI/1.1/eprints.xsd"> |
http://www.openarchives.org/OAI/2.0/eprints.xsd"> |
<content> |
<content> |
<URL>http://nsdl.lon-capa.org/info/content.htm</URL> |
<URL>http://$hostname/info/content.html</URL> |
|
<text>Educational materials from the LearningOnline Network</text> |
</content> |
</content> |
<metadataPolicy> |
<metadataPolicy> |
<text>Metadata can be used by authorized users</text> |
<text>Metadata can be used by authorized users</text> |
<URL>http://nsdl.lon-capa.org/metadata_use.htm</URL> |
|
</metadataPolicy> |
</metadataPolicy> |
<dataPolicy> |
<dataPolicy> |
<text>Full content, i.e. preprints may not be harvested by robots</text> |
<text>Full content, i.e. preprints may not be harvested by robots</text> |
</dataPolicy> |
</dataPolicy> |
<submissionPolicy> |
<submissionPolicy> |
<URL>http://nsdl.lon-capa.org/info/submission.htm</URL> |
<text>Submissions can be made by institutions with installed |
|
LON-CAPA servers.</text> |
</submissionPolicy> |
</submissionPolicy> |
</eprints> |
</eprints> |
</description> |
</description> |
</Identify> |
</Identify> |
|
</OAI-PMH> |
END |
END |
$output=~s/\>/\>/g; |
|
$output=~s/\</\</g; |
|
} |
} |
my $cgi; |
elsif ($ENV{'form.verb'} eq 'ListIdentifiers') { |
foreach my $key (keys %ENV) { |
# arguments: until, from, set, resumptionToken |
if ($key=~/^form\./) { |
# $output= |
$cgi.="$key: $ENV{$key}\n"; |
# 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=(<<END); |
|
<?xml version="1.0" encoding="UTF-8"?> |
|
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" |
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ |
|
http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> |
|
<responseDate>$responseDate</responseDate> |
|
<request>$requestURL</request> |
|
<error code="noSetHierarchy">No set hierarchy available yet for this |
|
gateway.</error> |
|
</OAI-PMH> |
|
END |
} |
} |
$r->content_type('text/html'); |
elsif ($ENV{'form.verb'} eq 'ListMetadataFormats') { |
|
# arguments: identifier |
|
my $responseDate=Apache::GATEWAY::Common::responseDate(); |
|
my $requestURL=Apache::GATEWAY::Common::requestURL(); |
|
$output=(<<END); |
|
<?xml version="1.0" encoding="UTF-8"?> |
|
<ListMetadataFormats |
|
xmlns="http://www.openarchives.org/OAI/1.1/OAI_ListMetadataFormats" |
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
xsi:schemaLocation="http://www.openarchives.org/OAI/1.1/OAI_ListMetadataFormats |
|
http://www.openarchives.org/OAI/1.1/OAI_ListMetadataFormats.xsd"> |
|
<responseDate>$responseDate</responseDate> |
|
<requestURL>$requestURL</requestURL> |
|
<metadataFormat> |
|
<metadataPrefix>oai_dc</metadataPrefix> |
|
<schema>http://www.openarchives.org/OAI/1.1/dc.xsd</schema> |
|
<metadataNamespace>http://purl.org/dc/elements/1.1/</metadataNamespace> |
|
</metadataFormat> |
|
<metadataFormat> |
|
<metadataPrefix>loncapa_ieeelom</metadataPrefix> |
|
<schema>http://nsdl.lon-capa.org/lom/6.4/ieeelom.xsd</schema> |
|
<metadataNamespace>http://nsdl.lon-capa.org/lom/6.4/</metadataNamespace> |
|
</metadataFormat> |
|
</ListMetadataFormats> |
|
END |
|
} |
|
elsif ($ENV{'form.verb'} eq 'ListRecords') { |
|
# 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=(<<END); |
|
<?xml version="1.0" encoding="UTF-8"?> |
|
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" |
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ |
|
http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> |
|
<responseDate>$responseDate</responseDate> |
|
<request>$requestURL</request> |
|
<error code="noSetHierarchy">No set hierarchy available yet for this |
|
gateway.</error> |
|
</OAI-PMH> |
|
END |
|
} |
|
elsif ($ENV{'form.verb'} eq 'ListSets') { |
|
# arguments: resumptionToken |
|
# $output='not yet implemented'; |
|
my $responseDate=Apache::GATEWAY::Common::responseDate(); |
|
my $requestURL=Apache::GATEWAY::Common::requestURL(); |
|
$output=(<<END); |
|
<?xml version="1.0" encoding="UTF-8"?> |
|
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" |
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ |
|
http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> |
|
<responseDate>$responseDate</responseDate> |
|
<request>$requestURL</request> |
|
<error code="noSetHierarchy">No set hierarchy available yet for this |
|
gateway.</error> |
|
</OAI-PMH> |
|
END |
|
} |
|
else { |
|
my $responseDate=Apache::GATEWAY::Common::responseDate(); |
|
my $requestURL=Apache::GATEWAY::Common::requestURL(); |
|
$output=(<<END); |
|
<?xml version="1.0" encoding="UTF-8"?> |
|
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" |
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ |
|
http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> |
|
<responseDate>$responseDate</responseDate> |
|
<request>$requestURL</request> |
|
<error code="badVerb">Illegal OAI verb</error> |
|
</OAI-PMH> |
|
END |
|
} |
|
$r->content_type('text/xml'); |
$r->send_http_header; |
$r->send_http_header; |
return(OK) if $r->header_only; |
return(OK) if $r->header_only; |
$r->print(<<END); |
$r->print(<<END); |
<html> |
|
<head><title>Test Output</title></head> |
|
<body> |
|
<h1>Apache::NSDL::ToTheGateway</h1> |
|
<h2>Input</h2> |
|
<pre> |
|
$cgi |
|
</pre> |
|
<h2>Output</h2> |
|
<pre> |
|
$output |
$output |
</pre> |
|
</body> |
|
</html> |
|
END |
END |
|
|
|
# $output=~s/\>/\>/g; |
|
# $output=~s/\</\</g; |
|
# my $cgi; |
|
# foreach my $key (keys %ENV) { |
|
# if ($key=~/^form\./) { |
|
# $cgi.="$key: $ENV{$key}\n"; |
|
# } |
|
# } |
|
# $r->content_type('text/html'); |
|
# $r->send_http_header; |
|
# return(OK) if $r->header_only; |
|
# $r->print(<<END); |
|
#<html> |
|
#<head><title>Test Output</title></head> |
|
#<body> |
|
#<h1>Apache::NSDL::ToTheGateway</h1> |
|
#<h2>Input</h2> |
|
#<pre> |
|
#$cgi |
|
#</pre> |
|
#<h2>Output</h2> |
|
#<pre> |
|
#$output |
|
#</pre> |
|
#</body> |
|
#</html> |
|
#END |
return(OK); |
return(OK); |
} |
} |
|
|
Line 153 sub answer_metadata_record_request {
|
Line 316 sub answer_metadata_record_request {
|
|
|
# ----------------------------------------------- NSDL->answer_resource_request |
# ----------------------------------------------- NSDL->answer_resource_request |
sub answer_resource_request { |
sub answer_resource_request { |
# Not yet implemented |
my ($eref)=@_; |
# Need to specifically characterize INPUT arguments and OUTPUT data |
return Apache::NSDL::FromTheGateway($eref); |
} |
} |
|
|
1; |
1; |