line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Catmandu::FedoraCommons::Model::describeRepository - Perl model for the Fedora 'describe' method call |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Catmandu::FedoraCommons; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $fedora = Catmandu::FedoraCommons->new('http://localhost:8080/fedora','fedoraAdmin','fedoraAdmin'); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $obj = $fedora->describeRepository()->parse_content; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
{ |
14
|
|
|
|
|
|
|
"sampleOAI-URL" : "http://localhost:8080/fedora/oai?verb=Identify", |
15
|
|
|
|
|
|
|
"repositoryName" : "Fedora Repository", |
16
|
|
|
|
|
|
|
"repositoryOAI-identifier" : { |
17
|
|
|
|
|
|
|
"OAI-delimiter" : ":", |
18
|
|
|
|
|
|
|
"OAI-namespaceIdentifier" : "localhost", |
19
|
|
|
|
|
|
|
"OAI-sample" : "oai:localhost:islandora:100" |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
"repositoryBaseURL" : "http://localhost:8080/fedora", |
22
|
|
|
|
|
|
|
"sampleAccess-URL" : "http://localhost:8080/fedora/objects/demo:5", |
23
|
|
|
|
|
|
|
"adminEmail" : "libservice@ugent.be", |
24
|
|
|
|
|
|
|
"repositoryVersion" : "3.7.1", |
25
|
|
|
|
|
|
|
"repositoryPID" : { |
26
|
|
|
|
|
|
|
"PID-sample" : "islandora:100", |
27
|
|
|
|
|
|
|
"PID-delimiter" : ":", |
28
|
|
|
|
|
|
|
"PID-namespaceIdentifier" : "islandora", |
29
|
|
|
|
|
|
|
"retainPID" : "*" |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
"sampleSearch-URL" : "http://localhost:8080/fedora/objects" |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SEE ALSO |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
L<Catmandu::FedoraCommons> |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
package Catmandu::FedoraCommons::Model::describeRepository; |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
|
111563
|
use XML::LibXML; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub parse { |
44
|
|
|
|
|
|
|
my ($class,$xml) = @_; |
45
|
|
|
|
|
|
|
my $dom = XML::LibXML->load_xml(string => $xml); |
46
|
|
|
|
|
|
|
$dom->getDocumentElement()->setNamespace('http://www.fedora.info/definitions/1/0/access/','a'); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my @nodes = $dom->findnodes("/a:fedoraRepository/*"); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $result = {}; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
for my $node (@nodes) { |
53
|
|
|
|
|
|
|
my $name = $node->nodeName; |
54
|
|
|
|
|
|
|
my $value = $node->textContent; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
if ($name eq 'repositoryPID' || $name eq 'repositoryOAI-identifier') { |
57
|
|
|
|
|
|
|
$result->{$name} ||= {}; |
58
|
|
|
|
|
|
|
for my $model ($node->findnodes("./*")) { |
59
|
|
|
|
|
|
|
my $n = $model->nodeName; |
60
|
|
|
|
|
|
|
my $v = $model->textContent; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$result->{$name}->{$n} = $v; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
else { |
66
|
|
|
|
|
|
|
$result->{$name} = $value; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
return $result; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |