active-fedora 3.2.2 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. data/Gemfile +2 -2
  2. data/Gemfile.lock +33 -57
  3. data/History.txt +9 -0
  4. data/active-fedora.gemspec +5 -5
  5. data/lib/active_fedora.rb +37 -10
  6. data/lib/active_fedora/base.rb +0 -18
  7. data/lib/active_fedora/datastream.rb +10 -5
  8. data/lib/active_fedora/datastreams.rb +33 -7
  9. data/lib/active_fedora/dcrdf_datastream.rb +11 -0
  10. data/lib/active_fedora/delegating.rb +2 -2
  11. data/lib/active_fedora/metadata_datastream.rb +3 -2
  12. data/lib/active_fedora/nested_attributes.rb +0 -1
  13. data/lib/active_fedora/ntriples_rdf_datastream.rb +19 -0
  14. data/lib/active_fedora/predicates.rb +4 -0
  15. data/lib/active_fedora/rdf_datastream.rb +108 -0
  16. data/lib/active_fedora/rdf_xml_writer.rb +53 -41
  17. data/lib/active_fedora/relationship_graph.rb +15 -71
  18. data/lib/active_fedora/rels_ext_datastream.rb +1 -4
  19. data/lib/active_fedora/rubydora_connection.rb +2 -9
  20. data/lib/active_fedora/unsaved_digital_object.rb +1 -0
  21. data/lib/active_fedora/version.rb +1 -1
  22. data/lib/tasks/active_fedora_dev.rake +1 -1
  23. data/spec/fixtures/dublin_core_rdf_descMetadata.nt +13 -0
  24. data/spec/fixtures/rails_root/config/fedora.yml +1 -15
  25. data/spec/integration/base_loader_spec.rb +0 -1
  26. data/spec/integration/dc_rdf_datastream_spec.rb +24 -0
  27. data/spec/integration/full_featured_model_spec.rb +1 -1
  28. data/spec/integration/model_spec.rb +0 -1
  29. data/spec/unit/active_fedora_spec.rb +22 -14
  30. data/spec/unit/base_spec.rb +9 -184
  31. data/spec/unit/datastream_collections_spec.rb +2 -2
  32. data/spec/unit/datastream_spec.rb +36 -6
  33. data/spec/unit/datastreams_spec.rb +251 -0
  34. data/spec/unit/dc_rdf_datastream_spec.rb +50 -0
  35. data/spec/unit/metadata_datastream_spec.rb +1 -1
  36. data/spec/unit/nokogiri_datastream_spec.rb +2 -2
  37. data/spec/unit/{rdf_xml_writer.rb → rdf_xml_writer_spec.rb} +8 -8
  38. data/spec/unit/relationship_graph_spec.rb +14 -0
  39. data/spec/unit/rels_ext_datastream_spec.rb +29 -2
  40. data/spec/unit/rubydora_connection_spec.rb +2 -4
  41. data/spec/unit/unsaved_digital_object_spec.rb +22 -9
  42. metadata +106 -258
  43. data/.hg/00changelog.i +0 -0
  44. data/.hg/branch +0 -1
  45. data/.hg/branch.cache +0 -2
  46. data/.hg/dirstate +0 -0
  47. data/.hg/hgrc +0 -2
  48. data/.hg/requires +0 -2
  49. data/.hg/store/00changelog.i +0 -0
  50. data/.hg/store/00manifest.i +0 -0
  51. data/.hg/store/data/.hgignore.i +0 -0
  52. data/.hg/store/data/.hgtags.i +0 -0
  53. data/.hg/store/data/_c_o_p_y_i_n_g.txt.i +0 -0
  54. data/.hg/store/data/_c_o_y_i_n_g._l_e_s_s_e_r.txt.i +0 -0
  55. data/.hg/store/data/_history.txt.i +0 -0
  56. data/.hg/store/data/_license.txt.i +0 -0
  57. data/.hg/store/data/_manifest.txt.i +0 -0
  58. data/.hg/store/data/_post_install.txt.i +0 -0
  59. data/.hg/store/data/_r_e_a_d_m_e.rdoc.i +0 -0
  60. data/.hg/store/data/_r_e_a_d_m_e.txt.i +0 -0
  61. data/.hg/store/data/_rakefile.i +0 -0
  62. data/.hg/store/data/_v_e_r_s_i_o_n.i +0 -0
  63. data/.hg/store/data/active-fedora.gemspec.i +0 -0
  64. data/.hg/store/data/active__fedora/_history.txt.i +0 -0
  65. data/.hg/store/data/active__fedora/_manifest.txt.i +0 -0
  66. data/.hg/store/data/active__fedora/_post_install.txt.i +0 -0
  67. data/.hg/store/data/active__fedora/_r_e_a_d_m_e.rdoc.i +0 -0
  68. data/.hg/store/data/active__fedora/_rakefile.i +0 -0
  69. data/.hg/store/data/active__fedora/lib/active__fedora.rb.i +0 -0
  70. data/.hg/store/data/active__fedora/script/console.i +0 -0
  71. data/.hg/store/data/active__fedora/script/destroy.i +0 -0
  72. data/.hg/store/data/active__fedora/script/generate.i +0 -0
  73. data/.hg/store/data/active__fedora/spec/active__fedora__spec.rb.i +0 -0
  74. data/.hg/store/data/active__fedora/spec/spec__helper.rb.i +0 -0
  75. data/.hg/store/data/config/fedora.yml.i +0 -0
  76. data/.hg/store/data/config/solr__mappings.yml.i +0 -0
  77. data/.hg/store/data/config/solr__mappings__af__0.1.yml.i +0 -0
  78. data/.hg/store/data/config/solr__mappings__bl__2.4.yml.i +0 -0
  79. data/.hg/store/data/lib/active-fedora.rb.i +0 -0
  80. data/.hg/store/data/lib/active__fedora.rb.i +0 -0
  81. data/.hg/store/data/lib/active__fedora/base.rb.i +0 -0
  82. data/.hg/store/data/lib/active__fedora/content__model.rb.i +0 -0
  83. data/.hg/store/data/lib/active__fedora/datastream.rb.i +0 -0
  84. data/.hg/store/data/lib/active__fedora/fedora__object.rb.i +0 -0
  85. data/.hg/store/data/lib/active__fedora/metadata__datastream.rb.i +0 -0
  86. data/.hg/store/data/lib/active__fedora/model.rb.i +0 -0
  87. data/.hg/store/data/lib/active__fedora/property.rb.i +0 -0
  88. data/.hg/store/data/lib/active__fedora/qualified__dublin__core__datastream.rb.i +0 -0
  89. data/.hg/store/data/lib/active__fedora/relationship.rb.i +0 -0
  90. data/.hg/store/data/lib/active__fedora/rels__ext__datastream.rb.i +0 -0
  91. data/.hg/store/data/lib/active__fedora/semantic__node.rb.i +0 -0
  92. data/.hg/store/data/lib/active__fedora/solr__mapper.rb.i +0 -0
  93. data/.hg/store/data/lib/active__fedora/solr__service.rb.i +0 -0
  94. data/.hg/store/data/lib/fedora/base.rb.i +0 -0
  95. data/.hg/store/data/lib/fedora/connection.rb.i +0 -0
  96. data/.hg/store/data/lib/fedora/datastream.rb.i +0 -0
  97. data/.hg/store/data/lib/fedora/fedora__object.rb.i +0 -0
  98. data/.hg/store/data/lib/fedora/formats.rb.i +0 -0
  99. data/.hg/store/data/lib/fedora/generic__search.rb.i +0 -0
  100. data/.hg/store/data/lib/fedora/repository.rb.i +0 -0
  101. data/.hg/store/data/lib/ruby-fedora.rb.i +0 -0
  102. data/.hg/store/data/lib/util/class__level__inheritable__attributes.rb.i +0 -0
  103. data/.hg/store/data/script/console.i +0 -0
  104. data/.hg/store/data/script/destroy.i +0 -0
  105. data/.hg/store/data/script/generate.i +0 -0
  106. data/.hg/store/data/solr/config/schema-1.5.xml.i +0 -0
  107. data/.hg/store/data/solr/config/schema.xml.i +0 -0
  108. data/.hg/store/data/solr/config/solrconfig-1.5.xml.i +0 -0
  109. data/.hg/store/data/spec/fixtures/changeme155.xml.i +0 -0
  110. data/.hg/store/data/spec/fixtures/dino.jpg.i +0 -0
  111. data/.hg/store/data/spec/fixtures/minivan.jpg.d +0 -0
  112. data/.hg/store/data/spec/fixtures/minivan.jpg.i +0 -0
  113. data/.hg/store/data/spec/fixtures/test__12.foxml.xml.i +0 -0
  114. data/.hg/store/data/spec/integration/active__fedora/base__spec.rb.i +0 -0
  115. data/.hg/store/data/spec/integration/active__fedora/datastream__spec.rb.i +0 -0
  116. data/.hg/store/data/spec/integration/active__fedora/fedora__object__spec.rb.i +0 -0
  117. data/.hg/store/data/spec/integration/active__fedora/full__featured__model__spec.rb.i +0 -0
  118. data/.hg/store/data/spec/integration/active__fedora/model__spec.rb.i +0 -0
  119. data/.hg/store/data/spec/integration/active__fedora/rels__ext__datastream__spec.rb.i +0 -0
  120. data/.hg/store/data/spec/integration/active__fedora/semantic__node__spec.rb.i +0 -0
  121. data/.hg/store/data/spec/integration/base__file__management__spec.rb.i +0 -0
  122. data/.hg/store/data/spec/integration/base__spec.rb.i +0 -0
  123. data/.hg/store/data/spec/integration/bug__spec.rb.i +0 -0
  124. data/.hg/store/data/spec/integration/datastream__spec.rb.i +0 -0
  125. data/.hg/store/data/spec/integration/datastreams__crud__spec.rb.i +0 -0
  126. data/.hg/store/data/spec/integration/fedora__object__spec.rb.i +0 -0
  127. data/.hg/store/data/spec/integration/full__featured__model__spec.rb.i +0 -0
  128. data/.hg/store/data/spec/integration/model__spec.rb.i +0 -0
  129. data/.hg/store/data/spec/integration/rels__ext__datastream__spec.rb.i +0 -0
  130. data/.hg/store/data/spec/integration/repository__spec.rb.i +0 -0
  131. data/.hg/store/data/spec/integration/rf__fedora__object__spec.rb.i +0 -0
  132. data/.hg/store/data/spec/integration/semantic__node__spec.rb.i +0 -0
  133. data/.hg/store/data/spec/integration/solr__service__spec.rb.i +0 -0
  134. data/.hg/store/data/spec/samples/models/audio__record.rb.i +0 -0
  135. data/.hg/store/data/spec/samples/models/image.rb.i +0 -0
  136. data/.hg/store/data/spec/samples/models/oral__history.rb.i +0 -0
  137. data/.hg/store/data/spec/samples/models/seminar.rb.i +0 -0
  138. data/.hg/store/data/spec/samples/models/seminar__audio__file.rb.i +0 -0
  139. data/.hg/store/data/spec/samples/oh__qdc.xml.i +0 -0
  140. data/.hg/store/data/spec/samples/oral__history.rb.i +0 -0
  141. data/.hg/store/data/spec/samples/oral__history__sample.xml.i +0 -0
  142. data/.hg/store/data/spec/samples/oral__history__sample__model.rb.i +0 -0
  143. data/.hg/store/data/spec/samples/oral__history__xml.xml.i +0 -0
  144. data/.hg/store/data/spec/spec.opts.i +0 -0
  145. data/.hg/store/data/spec/spec__helper.rb.i +0 -0
  146. data/.hg/store/data/spec/unit/active__fedora/base__cma__spec.rb.i +0 -0
  147. data/.hg/store/data/spec/unit/active__fedora/base__extra__spec.rb.i +0 -0
  148. data/.hg/store/data/spec/unit/active__fedora/base__spec.rb.i +0 -0
  149. data/.hg/store/data/spec/unit/active__fedora/content__model__spec.rb.i +0 -0
  150. data/.hg/store/data/spec/unit/active__fedora/datastream__spec.rb.i +0 -0
  151. data/.hg/store/data/spec/unit/active__fedora/inheritance__spec.rb.i +0 -0
  152. data/.hg/store/data/spec/unit/active__fedora/metadata__datastream__spec.rb.i +0 -0
  153. data/.hg/store/data/spec/unit/active__fedora/model__spec.rb.i +0 -0
  154. data/.hg/store/data/spec/unit/active__fedora/property__spec.rb.i +0 -0
  155. data/.hg/store/data/spec/unit/active__fedora/qualified__dublin__core__datastream__spec.rb.i +0 -0
  156. data/.hg/store/data/spec/unit/active__fedora/relationship__spec.rb.i +0 -0
  157. data/.hg/store/data/spec/unit/active__fedora/rels__ext__datastream__spec.rb.i +0 -0
  158. data/.hg/store/data/spec/unit/active__fedora/semantic__node__spec.rb.i +0 -0
  159. data/.hg/store/data/spec/unit/active__fedora/solr__service__spec.rb.i +0 -0
  160. data/.hg/store/data/spec/unit/active__fedora__spec.rb.i +0 -0
  161. data/.hg/store/data/spec/unit/base__cma__spec.rb.i +0 -0
  162. data/.hg/store/data/spec/unit/base__datastream__management__spec.rb.i +0 -0
  163. data/.hg/store/data/spec/unit/base__extra__spec.rb.i +0 -0
  164. data/.hg/store/data/spec/unit/base__file__management__spec.rb.i +0 -0
  165. data/.hg/store/data/spec/unit/base__loader__spec.rb.i +0 -0
  166. data/.hg/store/data/spec/unit/base__spec.rb.i +0 -0
  167. data/.hg/store/data/spec/unit/connection__spec.rb.i +0 -0
  168. data/.hg/store/data/spec/unit/content__model__spec.rb.i +0 -0
  169. data/.hg/store/data/spec/unit/datastream__concurrency__spec.rb.i +0 -0
  170. data/.hg/store/data/spec/unit/datastream__spec.rb.i +0 -0
  171. data/.hg/store/data/spec/unit/fedora__object__spec.rb.i +0 -0
  172. data/.hg/store/data/spec/unit/inheritance__spec.rb.i +0 -0
  173. data/.hg/store/data/spec/unit/metadata__datastream__spec.rb.i +0 -0
  174. data/.hg/store/data/spec/unit/model__spec.rb.i +0 -0
  175. data/.hg/store/data/spec/unit/property__spec.rb.i +0 -0
  176. data/.hg/store/data/spec/unit/qualified__dublin__core__datastream__spec.rb.i +0 -0
  177. data/.hg/store/data/spec/unit/relationship__spec.rb.i +0 -0
  178. data/.hg/store/data/spec/unit/rels__ext__datastream__spec.rb.i +0 -0
  179. data/.hg/store/data/spec/unit/repository__spec.rb.i +0 -0
  180. data/.hg/store/data/spec/unit/rf__datastream__spec.rb.i +0 -0
  181. data/.hg/store/data/spec/unit/semantic__node__spec.rb.i +0 -0
  182. data/.hg/store/data/spec/unit/solr__config__options__spec.rb.i +0 -0
  183. data/.hg/store/data/spec/unit/solr__mapper__spec.rb.i +0 -0
  184. data/.hg/store/data/spec/unit/solr__service__spec.rb.i +0 -0
  185. data/.hg/store/data/tasks/rspec.rake.i +0 -0
  186. data/.hg/store/undo +0 -0
  187. data/.hg/undo.branch +0 -1
  188. data/.hg/undo.dirstate +0 -0
  189. data/.hgignore +0 -7
  190. data/.hgtags +0 -14
data/Gemfile CHANGED
@@ -4,5 +4,5 @@ source "http://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'ruby-debug', :platform => :ruby_18
8
- gem 'ruby-debug19', :platform => :ruby_19
7
+ # gem 'ruby-debug', :platform => :ruby_18
8
+ # gem 'ruby-debug19', :platform => :ruby_19
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active-fedora (3.2.2)
4
+ active-fedora (3.3.0)
5
5
  activeresource (>= 3.0.0)
6
6
  activesupport (>= 3.0.0)
7
7
  equivalent-xml
@@ -10,38 +10,36 @@ PATH
10
10
  mime-types (>= 1.16)
11
11
  multipart-post (= 1.1.2)
12
12
  nokogiri
13
- om (>= 1.4.4)
13
+ om (>= 1.5.1)
14
14
  rdf
15
15
  rdf-rdfxml
16
- rubydora (~> 0.4.1)
16
+ rubydora (~> 0.5.1)
17
17
  solr-ruby (>= 0.0.6)
18
- solrizer (> 1.0.0)
18
+ solrizer (~> 1.2.0)
19
19
  xml-simple (>= 1.0.12)
20
20
 
21
21
  GEM
22
22
  remote: http://rubygems.org/
23
23
  specs:
24
24
  RedCloth (4.2.9)
25
- activemodel (3.1.3)
26
- activesupport (= 3.1.3)
25
+ activemodel (3.2.1)
26
+ activesupport (= 3.2.1)
27
27
  builder (~> 3.0.0)
28
+ activeresource (3.2.1)
29
+ activemodel (= 3.2.1)
30
+ activesupport (= 3.2.1)
31
+ activesupport (3.2.1)
28
32
  i18n (~> 0.6)
29
- activeresource (3.1.3)
30
- activemodel (= 3.1.3)
31
- activesupport (= 3.1.3)
32
- activesupport (3.1.3)
33
33
  multi_json (~> 1.0)
34
34
  addressable (2.2.6)
35
35
  akami (1.0.0)
36
36
  gyoku (>= 0.4.0)
37
- archive-tar-minitar (0.5.2)
38
37
  builder (3.0.0)
39
- childprocess (0.2.3)
38
+ childprocess (0.3.0)
40
39
  ffi (~> 1.0.6)
41
- columnize (0.3.6)
42
- daemons (1.1.5)
40
+ daemons (1.1.6)
43
41
  diff-lcs (1.1.3)
44
- equivalent-xml (0.2.8)
42
+ equivalent-xml (0.2.9)
45
43
  nokogiri (>= 1.4.3)
46
44
  facets (2.9.3)
47
45
  fastercsv (1.5.4)
@@ -51,33 +49,27 @@ GEM
51
49
  httpi (0.9.5)
52
50
  rack
53
51
  i18n (0.6.0)
54
- jettywrapper (1.2.0)
52
+ jettywrapper (1.2.1)
55
53
  activesupport (>= 3.0.0)
56
54
  childprocess
57
55
  i18n
58
56
  logger
59
57
  mediashelf-loggable
60
- linecache (0.46)
61
- rbx-require-relative (> 0.0.4)
62
- linecache19 (0.5.12)
63
- ruby_core_source (>= 0.1.4)
64
58
  logger (1.2.8)
65
59
  mediashelf-loggable (0.4.9)
66
60
  metaclass (0.0.1)
67
61
  mime-types (1.17.2)
68
- mocha (0.10.0)
62
+ mocha (0.10.3)
69
63
  metaclass (~> 0.0.1)
70
64
  multi_json (1.0.4)
71
65
  multipart-post (1.1.2)
72
66
  nokogiri (1.5.0)
73
67
  nori (1.0.2)
74
- om (1.4.4)
68
+ om (1.5.1)
75
69
  mediashelf-loggable
76
70
  nokogiri (>= 1.4.2)
77
- rack (1.4.0)
71
+ rack (1.4.1)
78
72
  rake (0.9.2.2)
79
- rbx-require-relative (0.0.5)
80
- rcov (0.9.11)
81
73
  rdf (0.3.4.1)
82
74
  addressable (>= 2.2.6)
83
75
  rdf-rdfxml (0.3.5)
@@ -87,30 +79,15 @@ GEM
87
79
  mime-types (>= 1.16)
88
80
  rsolr (1.0.6)
89
81
  builder (>= 2.1.2)
90
- rspec (2.7.0)
91
- rspec-core (~> 2.7.0)
92
- rspec-expectations (~> 2.7.0)
93
- rspec-mocks (~> 2.7.0)
94
- rspec-core (2.7.1)
95
- rspec-expectations (2.7.0)
82
+ rspec (2.8.0)
83
+ rspec-core (~> 2.8.0)
84
+ rspec-expectations (~> 2.8.0)
85
+ rspec-mocks (~> 2.8.0)
86
+ rspec-core (2.8.0)
87
+ rspec-expectations (2.8.0)
96
88
  diff-lcs (~> 1.1.2)
97
- rspec-mocks (2.7.0)
98
- ruby-debug (0.10.4)
99
- columnize (>= 0.1)
100
- ruby-debug-base (~> 0.10.4.0)
101
- ruby-debug-base (0.10.4)
102
- linecache (>= 0.3)
103
- ruby-debug-base19 (0.11.25)
104
- columnize (>= 0.3.1)
105
- linecache19 (>= 0.5.11)
106
- ruby_core_source (>= 0.1.4)
107
- ruby-debug19 (0.11.6)
108
- columnize (>= 0.3.1)
109
- linecache19 (>= 0.5.11)
110
- ruby-debug-base19 (>= 0.11.19)
111
- ruby_core_source (0.1.5)
112
- archive-tar-minitar (>= 0.5.2)
113
- rubydora (0.4.1)
89
+ rspec-mocks (2.8.0)
90
+ rubydora (0.5.1)
114
91
  activemodel
115
92
  activesupport
116
93
  fastercsv
@@ -127,16 +104,18 @@ GEM
127
104
  nori (~> 1.0)
128
105
  wasabi (~> 2.0)
129
106
  solr-ruby (0.0.8)
130
- solrizer (1.1.2)
107
+ solrizer (1.2.0)
131
108
  daemons
132
- mediashelf-loggable
109
+ mediashelf-loggable (~> 0.4.7)
133
110
  nokogiri
134
- om (>= 1.4.0)
111
+ om (>= 1.5.0)
135
112
  stomp
136
113
  xml-simple
137
- solrizer-fedora (1.1.3)
138
- active-fedora (>= 2.3.0)
114
+ solrizer-fedora (1.2.3)
115
+ active-fedora (>= 3.1.0)
116
+ activesupport
139
117
  fastercsv
118
+ jettywrapper (>= 1.1.0)
140
119
  rsolr
141
120
  solr-ruby (>= 0.0.6)
142
121
  solrizer (>= 1.0.0)
@@ -155,9 +134,6 @@ DEPENDENCIES
155
134
  jettywrapper (>= 1.2.0)
156
135
  mocha (>= 0.9.8)
157
136
  rake
158
- rcov
159
137
  rspec (~> 2.0)
160
- ruby-debug
161
- ruby-debug19
162
- solrizer-fedora (>= 1.1.3)
138
+ solrizer-fedora (~> 1.2.3)
163
139
  yard
@@ -1,3 +1,12 @@
1
+ 3.3.0
2
+ A label set on an unsaved datastream should be saved in the repository
3
+ Should be able to add checksumType parameter when creating a datastream
4
+ Upgrade rubydora to 0.5.1 so we can do checksum verification
5
+ Pass checksumVerification parameter to rubydora
6
+ Allow you to override the class of file datastream that gets created by using ActiveFedora::Base.has_file_datastream
7
+ Allow `predicate_mappings.yml` to specify explicit namespace prefixes to use instead of ns0, ns1, ..., nsN when serializing a `RelsExtDatastream`.
8
+ HYDRA-737 fixes for tests failing under ree 1.8.7-2011.12
9
+
1
10
  3.2.2
2
11
  Rubydora 0.4.1
3
12
  Fixed bugs where updating datastream properties would overwrite content.
@@ -20,21 +20,21 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency('mime-types', '>= 1.16')
21
21
  s.add_dependency('multipart-post', "= 1.1.2")
22
22
  s.add_dependency('nokogiri')
23
- s.add_dependency('om', '>= 1.4.4')
24
- s.add_dependency('solrizer', '>1.0.0')
23
+ s.add_dependency('om', '>= 1.5.1')
24
+ s.add_dependency('solrizer', '~>1.2.0')
25
25
  s.add_dependency("activeresource", '>= 3.0.0')
26
26
  s.add_dependency("activesupport", '>= 3.0.0')
27
27
  s.add_dependency("mediashelf-loggable")
28
28
  s.add_dependency("equivalent-xml")
29
29
  s.add_dependency("facets")
30
- s.add_dependency("rubydora", '~>0.4.1')
30
+ s.add_dependency("rubydora", '~>0.5.1')
31
31
  s.add_dependency("rdf")
32
32
  s.add_dependency("rdf-rdfxml")
33
33
  s.add_development_dependency("yard")
34
34
  s.add_development_dependency("RedCloth") # for RDoc formatting
35
35
  s.add_development_dependency("rake")
36
- s.add_development_dependency("rcov")
37
- s.add_development_dependency("solrizer-fedora", ">=1.1.3") # used by the fixtures rake tasks
36
+ # s.add_development_dependency("rcov") # not ruby 1.9 compatible
37
+ s.add_development_dependency("solrizer-fedora", "~>1.2.3") # used by the fixtures rake tasks
38
38
  s.add_development_dependency("jettywrapper", ">=1.2.0")
39
39
  s.add_development_dependency("rspec", "~> 2.0")
40
40
  s.add_development_dependency("mocha", ">= 0.9.8")
@@ -4,6 +4,7 @@ require 'active_fedora/solr_service'
4
4
  require 'active_fedora/rubydora_connection'
5
5
  require 'active_support/core_ext/class/attribute'
6
6
  require 'active_support/core_ext/object'
7
+ require 'active_support/core_ext/hash/indifferent_access'
7
8
 
8
9
  SOLR_DOCUMENT_ID = ActiveFedora::SolrService.id_field unless defined?(SOLR_DOCUMENT_ID)
9
10
  ENABLE_SOLR_UPDATES = true unless defined?(ENABLE_SOLR_UPDATES)
@@ -22,6 +23,7 @@ module ActiveFedora #:nodoc:
22
23
  autoload :FileManagement
23
24
  autoload :RelationshipGraph
24
25
  autoload :Datastream
26
+ autoload :DCRDFDatastream
25
27
  autoload :Datastreams
26
28
  autoload :Delegating
27
29
  autoload :DigitalObject
@@ -31,9 +33,11 @@ module ActiveFedora #:nodoc:
31
33
  autoload :MetadataDatastream
32
34
  autoload :MetadataDatastreamHelper
33
35
  autoload :NokogiriDatastream
36
+ autoload :NtriplesRDFDatastream
34
37
  autoload :Property
35
38
  autoload :Persistence
36
39
  autoload :QualifiedDublinCoreDatastream
40
+ autoload :RDFDatastream
37
41
  autoload :RelsExtDatastream
38
42
  autoload :ServiceDefinitions
39
43
  autoload :SemanticNode
@@ -84,6 +88,14 @@ module ActiveFedora #:nodoc:
84
88
  # 1. look in config_options[:fedora_config_path]. If it finds a solr.yml there, it will use it.
85
89
  # 2. If it does not find a solr.yml and the fedora.yml contains a solr url, it will raise an configuration error
86
90
  # 3. If it does not find a solr.yml and the fedora.yml does not contain a solr url, it will look in: +Rails.root+/config, +current working directory+/config, then the solr.yml shipped with gem
91
+
92
+ # Options allowed in fedora.yml
93
+ # first level is the environment (e.g. development, test, production and any custom environments you may have)
94
+ # the second level has these keys:
95
+ # 1. url: url including protocol, user/pass, host, port and path (e.g. http://fedoraAdmin:fedoraAdmin@127.0.0.1:8983/fedora)
96
+ # 2. validateChecksum: indicates to the fedora server whether you want to validate checksums when the datastreams are queried.
97
+
98
+
87
99
  def self.init( options={} )
88
100
  # Make config_options into a Hash if nil is passed in as the value
89
101
  options = {} if options.nil?
@@ -128,8 +140,8 @@ module ActiveFedora #:nodoc:
128
140
  config_path = self.send("#{config_type}_config_path".to_sym)
129
141
 
130
142
  logger.info("#{config_type.upcase}: loading ActiveFedora.#{config_type}_config from #{File.expand_path(config_path)}")
131
- config = YAML::load(File.open(config_path))
132
- raise "The #{@config_env.to_s} environment settings were not found in the #{config_type}.yml config. If you already have a #{config_type}.yml file defined, make sure it defines settings for the #{@config_env} environment" unless config[@config_env]
143
+ config = YAML.load(File.open(config_path)).symbolize_keys
144
+ raise "The #{@config_env.to_sym} environment settings were not found in the #{config_type}.yml config. If you already have a #{config_type}.yml file defined, make sure it defines settings for the #{@config_env} environment" unless config[@config_env.to_sym]
133
145
 
134
146
  config[:url] = determine_url(config_type,config)
135
147
 
@@ -137,30 +149,45 @@ module ActiveFedora #:nodoc:
137
149
  config
138
150
  end
139
151
 
152
+ def self.config_for_environment
153
+ fedora_config[@config_env.to_sym].symbolize_keys
154
+ end
155
+
140
156
  # Determines and sets the fedora_config[:url] or solr_config[:url]
141
157
  # @param [String] config_type Either 'fedora' or 'solr'
142
158
  # @param [Hash] config The config hash
143
159
  # @return [String] the solr or fedora url
144
160
  def self.determine_url(config_type,config)
161
+ c = config[environment.to_sym]
162
+ c.symbolize_keys!
145
163
  if config_type == "fedora"
146
164
  # support old-style config
147
- if config[environment].fetch("fedora",nil)
148
- return config[environment]["fedora"]["url"] if config[environment].fetch("fedora",nil)
165
+ url = if c.fetch(:fedora,nil)
166
+ ActiveSupport::Deprecation.warn("Using \"fedora\" in the fedora.yml file is no longer supported")
167
+ c[:fedora]["url"] if config[environment.to_sym].fetch(:fedora,nil)
149
168
  else
150
- return config[environment]["url"]
169
+ c[:url]
170
+ end
171
+ if url && !c[:user]
172
+ u = URI.parse url
173
+ c[:user] = u.user
174
+ c[:password] = u.password
175
+ c[:url] = "#{u.scheme}://#{u.host}:#{u.port}#{u.path}"
176
+ url = c[:url]
151
177
  end
178
+ return url
152
179
  else
153
- return get_solr_url(config[environment]) if config_type == "solr"
180
+ return get_solr_url(c) if config_type == "solr"
154
181
  end
155
182
  end
156
183
 
157
184
  # Given the solr_config that's been loaded for this environment,
158
185
  # determine which solr url to use
159
186
  def self.get_solr_url(solr_config)
160
- if @index_full_text == true && solr_config.has_key?('fulltext') && solr_config['fulltext'].has_key?('url')
161
- return solr_config['fulltext']['url']
162
- elsif solr_config.has_key?('default') && solr_config['default'].has_key?('url')
163
- return solr_config['default']['url']
187
+ if @index_full_text == true && solr_config.has_key?(:fulltext) && solr_config[:fulltext].has_key?('url')
188
+ return solr_config[:fulltext]['url']
189
+ elsif solr_config.has_key?(:default) && solr_config[:default].has_key?('url')
190
+ return solr_config[:default]['url']
164
191
  elsif solr_config.has_key?('url')
165
192
  return solr_config['url']
166
193
  elsif solr_config.has_key?(:url)
@@ -66,16 +66,6 @@ module ActiveFedora
66
66
  end
67
67
 
68
68
 
69
- # class_attribute :ds_specs
70
- #
71
- # def self.inherited(p)
72
- # # each subclass should get a copy of the parent's datastream definitions, it should not add to the parent's definition table.
73
- # p.ds_specs = p.ds_specs.dup
74
- # super
75
- # end
76
- #
77
- # self.ds_specs = {'RELS-EXT'=> {:type=> ActiveFedora::RelsExtDatastream, :label=>"", :label=>"Fedora Object-to-Object Relationship Metadata", :control_group=>'X', :block=>nil}}
78
-
79
69
  # Has this object been saved?
80
70
  def new_object?
81
71
  inner_object.new?
@@ -147,14 +137,6 @@ module ActiveFedora
147
137
  ds_specs[dsid] ? ds_specs[dsid][:type] : ActiveFedora::Datastream
148
138
  end
149
139
 
150
- #This method is used to specify the details of a datastream.
151
- #args must include :name. Note that this method doesn't actually
152
- #execute the block, but stores it at the class level, to be executed
153
- #by any future instantiations.
154
- def self.has_metadata(args, &block)
155
- ds_specs[args[:name]]= {:type => args[:type], :label => args.fetch(:label,""), :control_group => args.fetch(:control_group,"X"), :disseminator => args.fetch(:disseminator,""), :url => args.fetch(:url,""),:block => block}
156
- end
157
-
158
140
  def self.create(args = {})
159
141
  obj = self.new(args)
160
142
  obj.save
@@ -7,9 +7,10 @@ module ActiveFedora
7
7
  attr_accessor :dirty, :last_modified, :fields
8
8
  before_create :add_mime_type, :add_ds_location
9
9
 
10
- def initialize(digital_object, dsid)
11
- @fields={}
12
- @dirty = false
10
+ def initialize(digital_object, dsid, options={})
11
+ ## When you use the versions feature of rubydora (0.5.x), you need to have a 3 argument constructor
12
+ self.fields={}
13
+ self.dirty = false
13
14
  super
14
15
  end
15
16
 
@@ -26,6 +27,10 @@ module ActiveFedora
26
27
  end
27
28
  end
28
29
 
30
+ def inspect
31
+ "#<#{self.class}:#{self.hash} @pid=\"#{pid}\" @dsid=\"#{dsid}\" @controlGroup=\"#{controlGroup}\" @dirty=\"#{dirty}\" @mimeType=\"#{mimeType}\" >"
32
+ end
33
+
29
34
  #compatibility method for rails' url generators. This method will
30
35
  #urlescape escape dots, which are apparently
31
36
  #invalid characters in a dsid.
@@ -35,7 +40,7 @@ module ActiveFedora
35
40
 
36
41
  # Test whether this datastream been modified since it was last saved
37
42
  def dirty?
38
- @dirty || changed?
43
+ dirty || changed?
39
44
  end
40
45
 
41
46
  def new_object?
@@ -71,7 +76,7 @@ module ActiveFedora
71
76
  # @param [Nokogiri::XML::Node] node the "foxml:datastream" node from a FOXML file
72
77
  def self.from_xml(tmpl, node)
73
78
  tmpl.instance_variable_set(:@dirty, false)
74
- tmpl.control_group= node['CONTROL_GROUP']
79
+ tmpl.controlGroup= node['CONTROL_GROUP']
75
80
  tmpl
76
81
  end
77
82
 
@@ -30,7 +30,7 @@ module ActiveFedora
30
30
  self.class.ds_specs.each do |name,ds_config|
31
31
  ds = datastreams[name]
32
32
  if ds && ds.controlGroup == 'E' && ds_config[:disseminator].present?
33
- ds.dsLocation= "#{RubydoraConnection.instance.options[:url]}/objects/#{pid}/methods/#{ds_config[:disseminator]}"
33
+ ds.dsLocation= "#{ActiveFedora.config_for_environment[:url]}/objects/#{pid}/methods/#{ds_config[:disseminator]}"
34
34
  end
35
35
  end
36
36
  true
@@ -180,7 +180,7 @@ module ActiveFedora
180
180
  # Add the given file as a datastream in the object
181
181
  #
182
182
  # @param [File] file the file to add
183
- # @param [Hash] opts options: :dsid, :label, :mimeType, :prefix
183
+ # @param [Hash] opts options: :dsid, :label, :mimeType, :prefix, :checksumType
184
184
  def add_file_datastream(file, opts={})
185
185
  label = opts.has_key?(:label) ? opts[:label] : ""
186
186
  attrs = {:dsLabel => label, :controlGroup => 'M', :blob => file, :prefix=>opts[:prefix]}
@@ -191,7 +191,8 @@ module ActiveFedora
191
191
  elsif opts.has_key?(:content_type)
192
192
  attrs.merge!({:mimeType=>opts[:content_type]})
193
193
  end
194
- ds = create_datastream(ActiveFedora::Datastream, opts[:dsid], attrs)
194
+ attrs[:checksumType] = opts[:checksumType] if opts[:checksumType]
195
+ ds = create_datastream(self.class.datastream_class_for_name(opts[:dsid]), opts[:dsid], attrs)
195
196
  add_datastream(ds)
196
197
  end
197
198
 
@@ -201,10 +202,9 @@ module ActiveFedora
201
202
  klass = type.kind_of?(Class) ? type : type.constantize
202
203
  raise ArgumentError, "Argument dsid must be of type string" unless dsid.kind_of?(String) || dsid.kind_of?(NilClass)
203
204
  ds = klass.new(inner_object, dsid)
204
- ds.mimeType = opts[:mimeType]
205
- ds.controlGroup = opts[:controlGroup]
206
- ds.dsLabel = opts[:dsLabel]
207
- ds.dsLocation = opts[:dsLocation] if opts[:dsLocation]
205
+ [:mimeType, :controlGroup, :dsLabel, :dsLocation, :checksumType].each do |key|
206
+ ds.send("#{key}=".to_sym, opts[key]) if opts[key]
207
+ end
208
208
  blob = opts[:blob]
209
209
  if blob
210
210
  if !ds.mimeType.present?
@@ -236,5 +236,31 @@ module ActiveFedora
236
236
  end
237
237
  end
238
238
 
239
+
240
+ module ClassMethods
241
+ #This method is used to specify the details of a datastream.
242
+ #args must include :name. Note that this method doesn't actually
243
+ #execute the block, but stores it at the class level, to be executed
244
+ #by any future instantiations.
245
+ def has_metadata(args, &block)
246
+ ds_specs[args[:name]]= {:type => args[:type], :label => args.fetch(:label,""), :control_group => args.fetch(:control_group,"X"), :disseminator => args.fetch(:disseminator,""), :url => args.fetch(:url,""),:block => block}
247
+ end
248
+
249
+ # Specify the attributes of a file bearing datastream
250
+ #
251
+ # === Options
252
+ # [:name]
253
+ # The dsid of the datastream
254
+ # [:type]
255
+ # The class the datastream should have
256
+ # [:label]
257
+ # The default value to put in the dsLabel field
258
+ # [:control_group]
259
+ # The type of controlGroup to store the datastream as. Defaults to M
260
+ def has_file_datastream(args)
261
+ ds_specs[args.fetch(:name, "content")]= {:type => args[:type], :label => args.fetch(:label,"File Datastream"), :control_group => args.fetch(:control_group,"M")}
262
+ end
263
+ end
264
+
239
265
  end
240
266
  end