pho 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +5 -0
- data/Rakefile +1 -1
- data/lib/pho/snapshot.rb +6 -1
- data/lib/pho/sparql.rb +4 -1
- data/tests/tc_snapshots.rb +14 -1
- data/tests/tc_sparql_helper.rb +23 -0
- metadata +60 -160
- data/doc/rdoc/classes/Pho/Analyzers.html +0 -310
- data/doc/rdoc/classes/Pho/CommandLine.html +0 -770
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +0 -241
- data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +0 -410
- data/doc/rdoc/classes/Pho/Enrichment.html +0 -119
- data/doc/rdoc/classes/Pho/Etags.html +0 -310
- data/doc/rdoc/classes/Pho/Facet/Results.html +0 -299
- data/doc/rdoc/classes/Pho/Facet/Term.html +0 -177
- data/doc/rdoc/classes/Pho/Facet.html +0 -119
- data/doc/rdoc/classes/Pho/FieldPredicateMap.html +0 -668
- data/doc/rdoc/classes/Pho/FieldWeighting.html +0 -230
- data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +0 -478
- data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +0 -264
- data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +0 -259
- data/doc/rdoc/classes/Pho/FileManagement.html +0 -121
- data/doc/rdoc/classes/Pho/Job.html +0 -627
- data/doc/rdoc/classes/Pho/JobUpdate.html +0 -141
- data/doc/rdoc/classes/Pho/Jobs.html +0 -538
- data/doc/rdoc/classes/Pho/Namespaces.html +0 -164
- data/doc/rdoc/classes/Pho/OAI/Record.html +0 -165
- data/doc/rdoc/classes/Pho/OAI/Records.html +0 -331
- data/doc/rdoc/classes/Pho/OAI.html +0 -118
- data/doc/rdoc/classes/Pho/QueryProfile.html +0 -497
- data/doc/rdoc/classes/Pho/RDF/Parser.html +0 -279
- data/doc/rdoc/classes/Pho/RDF.html +0 -120
- data/doc/rdoc/classes/Pho/RDFCollection.html +0 -119
- data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +0 -325
- data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +0 -241
- data/doc/rdoc/classes/Pho/ResourceHash.html +0 -123
- data/doc/rdoc/classes/Pho/Snapshot.html +0 -397
- data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +0 -594
- data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +0 -692
- data/doc/rdoc/classes/Pho/Sparql.html +0 -187
- data/doc/rdoc/classes/Pho/Status.html +0 -296
- data/doc/rdoc/classes/Pho/Store.html +0 -1560
- data/doc/rdoc/classes/Pho/StoreSparqlClient.html +0 -183
- data/doc/rdoc/classes/Pho/Update/Changeset.html +0 -521
- data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +0 -330
- data/doc/rdoc/classes/Pho/Update/ChangesetHelper.html +0 -159
- data/doc/rdoc/classes/Pho/Update/Changesets.html +0 -205
- data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +0 -257
- data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +0 -237
- data/doc/rdoc/classes/Pho/Update/Statement.html +0 -303
- data/doc/rdoc/classes/Pho/Update.html +0 -128
- data/doc/rdoc/classes/Pho.html +0 -283
- data/doc/rdoc/classes/String.html +0 -146
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/CHANGES.html +0 -351
- data/doc/rdoc/files/README.html +0 -191
- data/doc/rdoc/files/lib/pho/changeset_builder_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/changeset_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/command_line_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/converter_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/enrichment_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/etags_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/facet_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/file_management_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/file_manager_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/job_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/oai_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/query_profile_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/rdf_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/resource_hash_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/snapshot_rb.html +0 -109
- data/doc/rdoc/files/lib/pho/sparql_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/status_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/store_rb.html +0 -108
- data/doc/rdoc/files/lib/pho_rb.html +0 -133
- data/doc/rdoc/fr_class_index.html +0 -72
- data/doc/rdoc/fr_file_index.html +0 -49
- data/doc/rdoc/fr_method_index.html +0 -237
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
-
<head>
|
|
8
|
-
<title>Module: Pho::ResourceHash</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
-
<script type="text/javascript">
|
|
13
|
-
// <![CDATA[
|
|
14
|
-
|
|
15
|
-
function popupCode( url ) {
|
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function toggleCode( id ) {
|
|
20
|
-
if ( document.getElementById )
|
|
21
|
-
elem = document.getElementById( id );
|
|
22
|
-
else if ( document.all )
|
|
23
|
-
elem = eval( "document.all." + id );
|
|
24
|
-
else
|
|
25
|
-
return false;
|
|
26
|
-
|
|
27
|
-
elemStyle = elem.style;
|
|
28
|
-
|
|
29
|
-
if ( elemStyle.display != "block" ) {
|
|
30
|
-
elemStyle.display = "block"
|
|
31
|
-
} else {
|
|
32
|
-
elemStyle.display = "none"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Make codeblocks hidden by default
|
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
-
|
|
41
|
-
// ]]>
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
</head>
|
|
45
|
-
<body>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<div id="classHeader">
|
|
50
|
-
<table class="header-table">
|
|
51
|
-
<tr class="top-aligned-row">
|
|
52
|
-
<td><strong>Module</strong></td>
|
|
53
|
-
<td class="class-name-in-header">Pho::ResourceHash</td>
|
|
54
|
-
</tr>
|
|
55
|
-
<tr class="top-aligned-row">
|
|
56
|
-
<td><strong>In:</strong></td>
|
|
57
|
-
<td>
|
|
58
|
-
<a href="../../files/lib/pho/converter_rb.html">
|
|
59
|
-
lib/pho/converter.rb
|
|
60
|
-
</a>
|
|
61
|
-
<br />
|
|
62
|
-
<a href="../../files/lib/pho/resource_hash_rb.html">
|
|
63
|
-
lib/pho/resource_hash.rb
|
|
64
|
-
</a>
|
|
65
|
-
<br />
|
|
66
|
-
</td>
|
|
67
|
-
</tr>
|
|
68
|
-
|
|
69
|
-
</table>
|
|
70
|
-
</div>
|
|
71
|
-
<!-- banner header -->
|
|
72
|
-
|
|
73
|
-
<div id="bodyContent">
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<div id="contextContent">
|
|
78
|
-
|
|
79
|
-
<div id="description">
|
|
80
|
-
<p>
|
|
81
|
-
Module providing code for manipulating resource hashes structured according
|
|
82
|
-
to the <a href="RDF.html">RDF</a> in JSON spec
|
|
83
|
-
</p>
|
|
84
|
-
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
</div>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
</div>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<!-- if includes -->
|
|
95
|
-
|
|
96
|
-
<div id="section">
|
|
97
|
-
|
|
98
|
-
<div id="class-list">
|
|
99
|
-
<h3 class="section-bar">Classes and Modules</h3>
|
|
100
|
-
|
|
101
|
-
Class <a href="ResourceHash/Converter.html" class="link">Pho::ResourceHash::Converter</a><br />
|
|
102
|
-
Class <a href="ResourceHash/SetAlgebra.html" class="link">Pho::ResourceHash::SetAlgebra</a><br />
|
|
103
|
-
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<!-- if method_list -->
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
</div>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<div id="validator-badges">
|
|
119
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
120
|
-
</div>
|
|
121
|
-
|
|
122
|
-
</body>
|
|
123
|
-
</html>
|
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
-
<head>
|
|
8
|
-
<title>Class: Pho::Snapshot</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
-
<script type="text/javascript">
|
|
13
|
-
// <![CDATA[
|
|
14
|
-
|
|
15
|
-
function popupCode( url ) {
|
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function toggleCode( id ) {
|
|
20
|
-
if ( document.getElementById )
|
|
21
|
-
elem = document.getElementById( id );
|
|
22
|
-
else if ( document.all )
|
|
23
|
-
elem = eval( "document.all." + id );
|
|
24
|
-
else
|
|
25
|
-
return false;
|
|
26
|
-
|
|
27
|
-
elemStyle = elem.style;
|
|
28
|
-
|
|
29
|
-
if ( elemStyle.display != "block" ) {
|
|
30
|
-
elemStyle.display = "block"
|
|
31
|
-
} else {
|
|
32
|
-
elemStyle.display = "none"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Make codeblocks hidden by default
|
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
-
|
|
41
|
-
// ]]>
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
</head>
|
|
45
|
-
<body>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<div id="classHeader">
|
|
50
|
-
<table class="header-table">
|
|
51
|
-
<tr class="top-aligned-row">
|
|
52
|
-
<td><strong>Class</strong></td>
|
|
53
|
-
<td class="class-name-in-header">Pho::Snapshot</td>
|
|
54
|
-
</tr>
|
|
55
|
-
<tr class="top-aligned-row">
|
|
56
|
-
<td><strong>In:</strong></td>
|
|
57
|
-
<td>
|
|
58
|
-
<a href="../../files/lib/pho/snapshot_rb.html">
|
|
59
|
-
lib/pho/snapshot.rb
|
|
60
|
-
</a>
|
|
61
|
-
<br />
|
|
62
|
-
</td>
|
|
63
|
-
</tr>
|
|
64
|
-
|
|
65
|
-
<tr class="top-aligned-row">
|
|
66
|
-
<td><strong>Parent:</strong></td>
|
|
67
|
-
<td>
|
|
68
|
-
Object
|
|
69
|
-
</td>
|
|
70
|
-
</tr>
|
|
71
|
-
</table>
|
|
72
|
-
</div>
|
|
73
|
-
<!-- banner header -->
|
|
74
|
-
|
|
75
|
-
<div id="bodyContent">
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<div id="contextContent">
|
|
80
|
-
|
|
81
|
-
<div id="description">
|
|
82
|
-
<p>
|
|
83
|
-
In the Talis Platform a "snapshot" is an <a
|
|
84
|
-
href="Snapshot.html#M000193">backup</a> of the contents of a <a
|
|
85
|
-
href="Store.html">Store</a>
|
|
86
|
-
</p>
|
|
87
|
-
<p>
|
|
88
|
-
A snapshot consists of a tar file that contains all data (contentbox and
|
|
89
|
-
metabox) in the store. The snapshot also contains the store configuration
|
|
90
|
-
but this is encrypted and not intended for reuse.
|
|
91
|
-
</p>
|
|
92
|
-
<p>
|
|
93
|
-
A snapshot can be generated (or scheduled) using the Store.snapshot method.
|
|
94
|
-
</p>
|
|
95
|
-
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
<div id="method-list">
|
|
102
|
-
<h3 class="section-bar">Methods</h3>
|
|
103
|
-
|
|
104
|
-
<div class="name-list">
|
|
105
|
-
<a href="#M000193">backup</a>
|
|
106
|
-
<a href="#M000191">new</a>
|
|
107
|
-
<a href="#M000190">parse</a>
|
|
108
|
-
<a href="#M000189">read_from_store</a>
|
|
109
|
-
<a href="#M000192">read_md5</a>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
|
|
113
|
-
</div>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
<!-- if includes -->
|
|
117
|
-
|
|
118
|
-
<div id="section">
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<div id="attribute-list">
|
|
125
|
-
<h3 class="section-bar">Attributes</h3>
|
|
126
|
-
|
|
127
|
-
<div class="name-list">
|
|
128
|
-
<table>
|
|
129
|
-
<tr class="top-aligned-row context-row">
|
|
130
|
-
<td class="context-item-name">date</td>
|
|
131
|
-
<td class="context-item-value"> [R] </td>
|
|
132
|
-
<td class="context-item-desc">
|
|
133
|
-
Date when snapshot was taken
|
|
134
|
-
|
|
135
|
-
</td>
|
|
136
|
-
</tr>
|
|
137
|
-
<tr class="top-aligned-row context-row">
|
|
138
|
-
<td class="context-item-name">md5_url</td>
|
|
139
|
-
<td class="context-item-value"> [R] </td>
|
|
140
|
-
<td class="context-item-desc">
|
|
141
|
-
The URL from which the MD5 for the snapshot can be retrieved
|
|
142
|
-
|
|
143
|
-
</td>
|
|
144
|
-
</tr>
|
|
145
|
-
<tr class="top-aligned-row context-row">
|
|
146
|
-
<td class="context-item-name">size</td>
|
|
147
|
-
<td class="context-item-value"> [R] </td>
|
|
148
|
-
<td class="context-item-desc">
|
|
149
|
-
Size of the snapshot
|
|
150
|
-
|
|
151
|
-
</td>
|
|
152
|
-
</tr>
|
|
153
|
-
<tr class="top-aligned-row context-row">
|
|
154
|
-
<td class="context-item-name">units</td>
|
|
155
|
-
<td class="context-item-value"> [R] </td>
|
|
156
|
-
<td class="context-item-desc">
|
|
157
|
-
Units for Size, e.g. KB
|
|
158
|
-
|
|
159
|
-
</td>
|
|
160
|
-
</tr>
|
|
161
|
-
<tr class="top-aligned-row context-row">
|
|
162
|
-
<td class="context-item-name">url</td>
|
|
163
|
-
<td class="context-item-value"> [R] </td>
|
|
164
|
-
<td class="context-item-desc">
|
|
165
|
-
The URL from which the snapshot can be retrieved
|
|
166
|
-
|
|
167
|
-
</td>
|
|
168
|
-
</tr>
|
|
169
|
-
</table>
|
|
170
|
-
</div>
|
|
171
|
-
</div>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<!-- if method_list -->
|
|
176
|
-
<div id="methods">
|
|
177
|
-
<h3 class="section-bar">Public Class methods</h3>
|
|
178
|
-
|
|
179
|
-
<div id="method-M000191" class="method-detail">
|
|
180
|
-
<a name="M000191"></a>
|
|
181
|
-
|
|
182
|
-
<div class="method-heading">
|
|
183
|
-
<a href="#M000191" class="method-signature">
|
|
184
|
-
<span class="method-name">new</span><span class="method-args">(url, md5_url, size, units, date)</span>
|
|
185
|
-
</a>
|
|
186
|
-
</div>
|
|
187
|
-
|
|
188
|
-
<div class="method-description">
|
|
189
|
-
<p><a class="source-toggle" href="#"
|
|
190
|
-
onclick="toggleCode('M000191-source');return false;">[Source]</a></p>
|
|
191
|
-
<div class="method-source-code" id="M000191-source">
|
|
192
|
-
<pre>
|
|
193
|
-
<span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 76</span>
|
|
194
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">md5_url</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">units</span>, <span class="ruby-identifier">date</span>)
|
|
195
|
-
<span class="ruby-ivar">@url</span> = <span class="ruby-identifier">url</span>
|
|
196
|
-
<span class="ruby-ivar">@md5_url</span> = <span class="ruby-identifier">md5_url</span>
|
|
197
|
-
<span class="ruby-ivar">@size</span> = <span class="ruby-identifier">size</span>
|
|
198
|
-
<span class="ruby-ivar">@units</span> = <span class="ruby-identifier">units</span>
|
|
199
|
-
<span class="ruby-ivar">@date</span> = <span class="ruby-identifier">date</span>
|
|
200
|
-
<span class="ruby-keyword kw">end</span>
|
|
201
|
-
</pre>
|
|
202
|
-
</div>
|
|
203
|
-
</div>
|
|
204
|
-
</div>
|
|
205
|
-
|
|
206
|
-
<div id="method-M000190" class="method-detail">
|
|
207
|
-
<a name="M000190"></a>
|
|
208
|
-
|
|
209
|
-
<div class="method-heading">
|
|
210
|
-
<a href="#M000190" class="method-signature">
|
|
211
|
-
<span class="method-name">parse</span><span class="method-args">(storeuri, content)</span>
|
|
212
|
-
</a>
|
|
213
|
-
</div>
|
|
214
|
-
|
|
215
|
-
<div class="method-description">
|
|
216
|
-
<p>
|
|
217
|
-
Class method to <a href="Snapshot.html#M000190">parse</a> the <a
|
|
218
|
-
href="RDF.html">RDF</a> response from the API, e.g. as produced by the <a
|
|
219
|
-
href="Store.html#M000183">Store.get_snapshots</a> method and create a <a
|
|
220
|
-
href="Snapshot.html#M000191">new</a> <a href="Snapshot.html">Snapshot</a>
|
|
221
|
-
object. At the moment the Platform only supports single snapshot.
|
|
222
|
-
</p>
|
|
223
|
-
<p>
|
|
224
|
-
If the response was an error, then an exception will be thrown
|
|
225
|
-
</p>
|
|
226
|
-
<pre>
|
|
227
|
-
storeuri:: URI of the store
|
|
228
|
-
content:: response from the API
|
|
229
|
-
</pre>
|
|
230
|
-
<p><a class="source-toggle" href="#"
|
|
231
|
-
onclick="toggleCode('M000190-source');return false;">[Source]</a></p>
|
|
232
|
-
<div class="method-source-code" id="M000190-source">
|
|
233
|
-
<pre>
|
|
234
|
-
<span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 52</span>
|
|
235
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Snapshot</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">storeuri</span>, <span class="ruby-identifier">content</span>)
|
|
236
|
-
|
|
237
|
-
<span class="ruby-identifier">doc</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">content</span>)
|
|
238
|
-
<span class="ruby-identifier">root</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">root</span>
|
|
239
|
-
|
|
240
|
-
<span class="ruby-identifier">store</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">root</span>, <span class="ruby-node">"//*[@rdf:about='#{storeuri}']"</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span> )
|
|
241
|
-
<span class="ruby-identifier">snapshot</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">store</span>, <span class="ruby-value str">"bf:snapshot"</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span>)
|
|
242
|
-
<span class="ruby-identifier">snapshot_url</span> = <span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"rdf:resource"</span>]
|
|
243
|
-
<span class="ruby-identifier">snapshot_el</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">root</span>, <span class="ruby-node">"//*[@rdf:about='#{snapshot_url}']"</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span> )
|
|
244
|
-
|
|
245
|
-
<span class="ruby-identifier">el</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">snapshot_el</span>, <span class="ruby-value str">"bf:md5"</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span>)
|
|
246
|
-
<span class="ruby-identifier">snapshot_md5_url</span> = <span class="ruby-identifier">el</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"rdf:resource"</span>]
|
|
247
|
-
|
|
248
|
-
<span class="ruby-identifier">el</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">snapshot_el</span>, <span class="ruby-value str">"bf:filesize"</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span>)
|
|
249
|
-
<span class="ruby-identifier">snapshot_size</span> = <span class="ruby-identifier">el</span>.<span class="ruby-identifier">text</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">" "</span>)[<span class="ruby-value">0</span>]
|
|
250
|
-
<span class="ruby-identifier">snapshot_units</span> = <span class="ruby-identifier">el</span>.<span class="ruby-identifier">text</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">" "</span>)[<span class="ruby-value">1</span>]
|
|
251
|
-
|
|
252
|
-
<span class="ruby-identifier">el</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">snapshot_el</span>, <span class="ruby-value str">"dc:date"</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span>)
|
|
253
|
-
<span class="ruby-identifier">snapshot_date</span> = <span class="ruby-identifier">el</span>.<span class="ruby-identifier">text</span>
|
|
254
|
-
|
|
255
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">Snapshot</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">snapshot_url</span>, <span class="ruby-identifier">snapshot_md5_url</span>, <span class="ruby-identifier">snapshot_size</span>, <span class="ruby-identifier">snapshot_units</span>, <span class="ruby-identifier">snapshot_date</span>)
|
|
256
|
-
|
|
257
|
-
<span class="ruby-keyword kw">end</span>
|
|
258
|
-
</pre>
|
|
259
|
-
</div>
|
|
260
|
-
</div>
|
|
261
|
-
</div>
|
|
262
|
-
|
|
263
|
-
<div id="method-M000189" class="method-detail">
|
|
264
|
-
<a name="M000189"></a>
|
|
265
|
-
|
|
266
|
-
<div class="method-heading">
|
|
267
|
-
<a href="#M000189" class="method-signature">
|
|
268
|
-
<span class="method-name">read_from_store</span><span class="method-args">(store)</span>
|
|
269
|
-
</a>
|
|
270
|
-
</div>
|
|
271
|
-
|
|
272
|
-
<div class="method-description">
|
|
273
|
-
<p>
|
|
274
|
-
Read snapshot data from the given store
|
|
275
|
-
</p>
|
|
276
|
-
<table>
|
|
277
|
-
<tr><td valign="top">store:</td><td>reference to a <a href="Store.html">Store</a> object
|
|
278
|
-
|
|
279
|
-
</td></tr>
|
|
280
|
-
</table>
|
|
281
|
-
<p><a class="source-toggle" href="#"
|
|
282
|
-
onclick="toggleCode('M000189-source');return false;">[Source]</a></p>
|
|
283
|
-
<div class="method-source-code" id="M000189-source">
|
|
284
|
-
<pre>
|
|
285
|
-
<span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 34</span>
|
|
286
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Snapshot</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-identifier">store</span>)
|
|
287
|
-
<span class="ruby-identifier">resp</span> = <span class="ruby-identifier">store</span>.<span class="ruby-identifier">get_snapshots</span>()
|
|
288
|
-
|
|
289
|
-
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">></span> <span class="ruby-value">200</span>)
|
|
290
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Response was not successful. Status code was: #{resp.status}"</span>
|
|
291
|
-
<span class="ruby-keyword kw">end</span>
|
|
292
|
-
<span class="ruby-identifier">content</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">content</span>
|
|
293
|
-
|
|
294
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">store</span>.<span class="ruby-identifier">storeuri</span>, <span class="ruby-identifier">content</span>)
|
|
295
|
-
<span class="ruby-keyword kw">end</span>
|
|
296
|
-
</pre>
|
|
297
|
-
</div>
|
|
298
|
-
</div>
|
|
299
|
-
</div>
|
|
300
|
-
|
|
301
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
|
302
|
-
|
|
303
|
-
<div id="method-M000193" class="method-detail">
|
|
304
|
-
<a name="M000193"></a>
|
|
305
|
-
|
|
306
|
-
<div class="method-heading">
|
|
307
|
-
<a href="#M000193" class="method-signature">
|
|
308
|
-
<span class="method-name">backup</span><span class="method-args">(store, dir=Dir.tmpdir)</span>
|
|
309
|
-
</a>
|
|
310
|
-
</div>
|
|
311
|
-
|
|
312
|
-
<div class="method-description">
|
|
313
|
-
<p>
|
|
314
|
-
Download this snapshot to the specified directory. Will automatically
|
|
315
|
-
calculate an MD5 checksum for the download and compare it against the
|
|
316
|
-
published value. If they don‘t match then a RuntimeError will be
|
|
317
|
-
raised
|
|
318
|
-
</p>
|
|
319
|
-
<table>
|
|
320
|
-
<tr><td valign="top">store:</td><td>the store to <a href="Snapshot.html#M000193">backup</a>
|
|
321
|
-
|
|
322
|
-
</td></tr>
|
|
323
|
-
<tr><td valign="top">dir:</td><td>directory in which snapshot will be stored
|
|
324
|
-
|
|
325
|
-
</td></tr>
|
|
326
|
-
</table>
|
|
327
|
-
<p><a class="source-toggle" href="#"
|
|
328
|
-
onclick="toggleCode('M000193-source');return false;">[Source]</a></p>
|
|
329
|
-
<div class="method-source-code" id="M000193-source">
|
|
330
|
-
<pre>
|
|
331
|
-
<span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 96</span>
|
|
332
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backup</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">dir</span>=<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">tmpdir</span>)
|
|
333
|
-
|
|
334
|
-
<span class="ruby-identifier">published_md5</span> = <span class="ruby-identifier">read_md5</span>(<span class="ruby-identifier">store</span>.<span class="ruby-identifier">client</span>)
|
|
335
|
-
|
|
336
|
-
<span class="ruby-identifier">digest</span> = <span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">MD5</span>.<span class="ruby-identifier">new</span>()
|
|
337
|
-
|
|
338
|
-
<span class="ruby-identifier">filename</span> = <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">"/"</span>).<span class="ruby-identifier">last</span>
|
|
339
|
-
<span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">filename</span>), <span class="ruby-value str">"w"</span> ) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
|
340
|
-
|
|
341
|
-
<span class="ruby-comment cmt">#FIXME: this is not efficient as the snapshot may be very large and this</span>
|
|
342
|
-
<span class="ruby-comment cmt">#will just read all of the data into memory</span>
|
|
343
|
-
<span class="ruby-identifier">content</span> = <span class="ruby-identifier">store</span>.<span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_content</span>(<span class="ruby-ivar">@url</span>)
|
|
344
|
-
<span class="ruby-identifier">file</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">content</span>)
|
|
345
|
-
<span class="ruby-identifier">digest</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">content</span>
|
|
346
|
-
|
|
347
|
-
<span class="ruby-keyword kw">end</span>
|
|
348
|
-
|
|
349
|
-
<span class="ruby-identifier">calc_md5</span> = <span class="ruby-identifier">digest</span>.<span class="ruby-identifier">hexdigest</span>
|
|
350
|
-
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">calc_md5</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">published_md5</span>)
|
|
351
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Calculated digest of #{calc_md5} but does not match published md5 #{published_md5}"</span>
|
|
352
|
-
<span class="ruby-keyword kw">end</span>
|
|
353
|
-
<span class="ruby-keyword kw">end</span>
|
|
354
|
-
</pre>
|
|
355
|
-
</div>
|
|
356
|
-
</div>
|
|
357
|
-
</div>
|
|
358
|
-
|
|
359
|
-
<div id="method-M000192" class="method-detail">
|
|
360
|
-
<a name="M000192"></a>
|
|
361
|
-
|
|
362
|
-
<div class="method-heading">
|
|
363
|
-
<a href="#M000192" class="method-signature">
|
|
364
|
-
<span class="method-name">read_md5</span><span class="method-args">(client=HttpClient.new())</span>
|
|
365
|
-
</a>
|
|
366
|
-
</div>
|
|
367
|
-
|
|
368
|
-
<div class="method-description">
|
|
369
|
-
<p>
|
|
370
|
-
Read the published MD5 value
|
|
371
|
-
</p>
|
|
372
|
-
<p><a class="source-toggle" href="#"
|
|
373
|
-
onclick="toggleCode('M000192-source');return false;">[Source]</a></p>
|
|
374
|
-
<div class="method-source-code" id="M000192-source">
|
|
375
|
-
<pre>
|
|
376
|
-
<span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 86</span>
|
|
377
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_md5</span>(<span class="ruby-identifier">client</span>=<span class="ruby-constant">HttpClient</span>.<span class="ruby-identifier">new</span>())
|
|
378
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_content</span>(<span class="ruby-ivar">@md5_url</span>)
|
|
379
|
-
<span class="ruby-keyword kw">end</span>
|
|
380
|
-
</pre>
|
|
381
|
-
</div>
|
|
382
|
-
</div>
|
|
383
|
-
</div>
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
</div>
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
</div>
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
<div id="validator-badges">
|
|
393
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
394
|
-
</div>
|
|
395
|
-
|
|
396
|
-
</body>
|
|
397
|
-
</html>
|