adiwg-mdtranslator 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -7
  3. data/Rakefile +1 -2
  4. data/adiwg-mdtranslator.gemspec +23 -23
  5. data/bin/mdtranslator +187 -155
  6. data/lib/adiwg/mdtranslator.rb +63 -38
  7. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +123 -5
  8. data/lib/adiwg/mdtranslator/internal/module_coordinates.rb +55 -0
  9. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +98 -70
  10. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +13 -11
  11. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_additionalDocumentation.rb +13 -3
  12. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_address.rb +3 -1
  13. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_associatedResource.rb +22 -4
  14. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_boundingBox.rb +3 -1
  15. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_browseGraphic.rb +11 -1
  16. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_citation.rb +28 -9
  17. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_classedData.rb +49 -0
  18. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_classedDataItem.rb +53 -0
  19. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_contacts.rb +14 -12
  20. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_coverageInfo.rb +83 -0
  21. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_coverageItem.rb +136 -0
  22. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_dataDictionary.rb +9 -7
  23. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_dataQuality.rb +17 -3
  24. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_dateTime.rb +3 -1
  25. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_descriptiveKeyword.rb +22 -5
  26. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_dictionaryInfo.rb +18 -3
  27. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_digitalTransferOption.rb +80 -0
  28. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_dimension.rb +81 -0
  29. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_distributionInfo.rb +89 -0
  30. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_distributionOrder.rb +62 -0
  31. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_domain.rb +24 -5
  32. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_domainItem.rb +23 -4
  33. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_entity.rb +26 -7
  34. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_entityAttribute.rb +24 -1
  35. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_entityForeignKey.rb +20 -1
  36. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_entityIndex.rb +20 -1
  37. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_extent.rb +9 -7
  38. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_geoCoordSystem.rb +3 -1
  39. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_geoProperties.rb +9 -7
  40. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_geographicElement.rb +20 -18
  41. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_gridInfo.rb +67 -0
  42. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_imageInfo.rb +119 -0
  43. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_legalConstraint.rb +7 -1
  44. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_lineString.rb +5 -4
  45. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_lineage.rb +11 -5
  46. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb +57 -0
  47. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_mdJson.rb +10 -9
  48. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_medium.rb +73 -0
  49. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_metadata.rb +14 -12
  50. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_metadataExtension.rb +3 -1
  51. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_metadataInfo.rb +35 -15
  52. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_onlineResource.rb +7 -1
  53. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_phone.rb +3 -1
  54. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_point.rb +5 -4
  55. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_polygon.rb +5 -4
  56. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_processStep.rb +19 -6
  57. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_resolution.rb +7 -1
  58. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_resourceFormat.rb +12 -1
  59. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_resourceIdentifier.rb +30 -5
  60. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_resourceInfo.rb +70 -33
  61. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_resourceMaintenance.rb +5 -3
  62. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_resourceSpecificUsage.rb +5 -3
  63. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_responsibleParty.rb +10 -8
  64. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_securityConstraint.rb +3 -1
  65. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_sensorInfo.rb +69 -0
  66. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_source.rb +11 -5
  67. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_spatialReference.rb +3 -1
  68. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_taxonClass.rb +3 -1
  69. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_taxonomy.rb +11 -9
  70. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_temporalElement.rb +9 -7
  71. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_timeInstant.rb +5 -3
  72. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_timePeriod.rb +6 -4
  73. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_verticalElement.rb +3 -1
  74. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_voucher.rb +5 -3
  75. data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/version.rb +19 -0
  76. data/lib/adiwg/mdtranslator/readers/mdReaders.rb +21 -18
  77. data/lib/adiwg/mdtranslator/version.rb +15 -1
  78. data/lib/adiwg/mdtranslator/writers/html/html_writer.rb +11 -8
  79. data/lib/adiwg/mdtranslator/writers/html/md_html_writer.rb +21 -18
  80. data/lib/adiwg/mdtranslator/writers/html/sections/html_additionalDocumentation.rb +48 -0
  81. data/lib/adiwg/mdtranslator/writers/html/sections/html_associatedResource.rb +73 -0
  82. data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +84 -135
  83. data/lib/adiwg/mdtranslator/writers/html/sections/html_citation.rb +18 -8
  84. data/lib/adiwg/mdtranslator/writers/html/sections/html_classedData.rb +50 -0
  85. data/lib/adiwg/mdtranslator/writers/html/sections/html_classedDataItem.rb +50 -0
  86. data/lib/adiwg/mdtranslator/writers/html/sections/html_contact.rb +5 -9
  87. data/lib/adiwg/mdtranslator/writers/html/sections/html_coverageInfo.rb +88 -0
  88. data/lib/adiwg/mdtranslator/writers/html/sections/html_coverageItem.rb +139 -0
  89. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataDictionary.rb +13 -12
  90. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataLineage.rb +5 -4
  91. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataSource.rb +5 -4
  92. data/lib/adiwg/mdtranslator/writers/html/sections/html_dimension.rb +71 -0
  93. data/lib/adiwg/mdtranslator/writers/html/sections/html_distributor.rb +62 -0
  94. data/lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb +3 -2
  95. data/lib/adiwg/mdtranslator/writers/html/sections/html_entity.rb +5 -4
  96. data/lib/adiwg/mdtranslator/writers/html/sections/html_extent.rb +7 -6
  97. data/lib/adiwg/mdtranslator/writers/html/sections/html_format.rb +7 -1
  98. data/lib/adiwg/mdtranslator/writers/html/sections/html_geographicElement.rb +7 -7
  99. data/lib/adiwg/mdtranslator/writers/html/sections/html_gridInfo.rb +65 -0
  100. data/lib/adiwg/mdtranslator/writers/html/sections/html_head.rb +18 -3
  101. data/lib/adiwg/mdtranslator/writers/html/sections/html_imageInfo.rb +120 -0
  102. data/lib/adiwg/mdtranslator/writers/html/sections/html_inlineCss.css +13 -20
  103. data/lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb +3 -2
  104. data/lib/adiwg/mdtranslator/writers/html/sections/html_medium.rb +19 -2
  105. data/lib/adiwg/mdtranslator/writers/html/sections/html_metadataInfo.rb +22 -9
  106. data/lib/adiwg/mdtranslator/writers/html/sections/html_orderProcess.rb +3 -2
  107. data/lib/adiwg/mdtranslator/writers/html/sections/html_processStep.rb +5 -4
  108. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceContact.rb +3 -2
  109. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceGeneral.rb +25 -14
  110. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceId.rb +30 -3
  111. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +194 -129
  112. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceMaint.rb +3 -2
  113. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceOther.rb +7 -6
  114. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceUsage.rb +3 -2
  115. data/lib/adiwg/mdtranslator/writers/html/sections/html_responsibleParty.rb +3 -2
  116. data/lib/adiwg/mdtranslator/writers/html/sections/html_sensorInfo.rb +66 -0
  117. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +7 -6
  118. data/lib/adiwg/mdtranslator/writers/html/sections/html_temporalElement.rb +7 -6
  119. data/lib/adiwg/mdtranslator/writers/html/sections/html_timeInstant.rb +3 -2
  120. data/lib/adiwg/mdtranslator/writers/html/sections/html_timePeriod.rb +3 -2
  121. data/lib/adiwg/mdtranslator/writers/html/sections/html_transferOption.rb +29 -4
  122. data/lib/adiwg/mdtranslator/writers/html/version.rb +17 -0
  123. data/lib/adiwg/mdtranslator/writers/iso19110/class_FCfeatureCatalogue.rb +17 -16
  124. data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_address.rb +12 -8
  125. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_baseUnit.rb +42 -0
  126. data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_codelist.rb +8 -3
  127. data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_contact.rb +16 -25
  128. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_conventionalUnit.rb +68 -0
  129. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_definitionUnit.rb +39 -0
  130. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_derivedUnit.rb +46 -0
  131. data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_featureAttribute.rb +17 -14
  132. data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_featureConstraint.rb +6 -2
  133. data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_featureType.rb +16 -12
  134. data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_listedValue.rb +9 -18
  135. data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_multiplicity.rb +8 -4
  136. data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_onlineResource.rb +13 -9
  137. data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_responsibleParty.rb +16 -12
  138. data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_telephone.rb +9 -5
  139. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_unitsOfMeasure.rb +262 -0
  140. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +36 -16
  141. data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +14 -0
  142. data/lib/adiwg/mdtranslator/writers/iso19115_2/class_MImetadata.rb +73 -37
  143. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_address.rb +116 -0
  144. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_aggregateInformation.rb +13 -9
  145. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_band.rb +165 -0
  146. data/lib/adiwg/mdtranslator/writers/{iso/units → iso19115_2/classes}/class_baseUnit.rb +6 -6
  147. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_boundingPolygon.rb +14 -10
  148. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_browseGraphic.rb +9 -5
  149. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_citation.rb +31 -16
  150. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_codelist.rb +56 -0
  151. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contact.rb +87 -0
  152. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contentInfo.rb +111 -0
  153. data/lib/adiwg/mdtranslator/writers/{iso/units → iso19115_2/classes}/class_conventionalUnit.rb +6 -6
  154. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_dataIdentification.rb +106 -59
  155. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_dataQuality.rb +11 -7
  156. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_date.rb +8 -5
  157. data/lib/adiwg/mdtranslator/writers/{iso/units → iso19115_2/classes}/class_definitionUnit.rb +7 -7
  158. data/lib/adiwg/mdtranslator/writers/{iso/units → iso19115_2/classes}/class_derivedUnit.rb +6 -6
  159. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_digitalTransferOptions.rb +92 -0
  160. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dimension.rb +68 -0
  161. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_distribution.rb +8 -4
  162. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_distributor.rb +44 -22
  163. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_enumerationList.rb +7 -2
  164. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_extent.rb +18 -14
  165. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_format.rb +18 -2
  166. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_geographicBoundingBox.rb +6 -2
  167. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_geographicDescription.rb +8 -4
  168. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_geographicElement.rb +10 -6
  169. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gridInfo.rb +80 -0
  170. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_identifier.rb +10 -6
  171. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_imageDescription.rb +157 -0
  172. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_keyword.rb +12 -8
  173. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_legalConstraints.rb +12 -8
  174. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_lineString.rb +13 -10
  175. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_lineage.rb +14 -10
  176. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_locale.rb +67 -0
  177. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_maintenanceInformation.rb +12 -8
  178. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_medium.rb +30 -9
  179. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_metadataExtension.rb +19 -15
  180. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_multiGeometry.rb +22 -17
  181. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_onlineResource.rb +94 -0
  182. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_point.rb +12 -9
  183. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_polygon.rb +14 -11
  184. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_processStep.rb +12 -9
  185. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rangeElementDescription.rb +88 -0
  186. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +52 -0
  187. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_resolution.rb +6 -2
  188. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resourceIdentifier.rb +94 -0
  189. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +106 -0
  190. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_securityConstraints.rb +12 -8
  191. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_source.rb +12 -8
  192. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_standardOrderProcess.rb +11 -9
  193. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_taxonClassification.rb +8 -4
  194. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_taxonSystem.rb +18 -14
  195. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_telephone.rb +92 -0
  196. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_temporalExtent.rb +10 -6
  197. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_timeInstant.rb +9 -8
  198. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_timePeriod.rb +10 -8
  199. data/lib/adiwg/mdtranslator/writers/{iso/units → iso19115_2/classes}/class_unitsOfMeasure.rb +48 -25
  200. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_usage.rb +11 -7
  201. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_useConstraints.rb +6 -2
  202. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_verticalExtent.rb +6 -2
  203. data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_vouchers.rb +8 -4
  204. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +32 -19
  205. data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +17 -0
  206. data/lib/adiwg/mdtranslator/writers/mdWriters.rb +21 -24
  207. data/test/readers/mdJson/v1/tc_reader_mdjson_additionalDocumentation.rb +116 -0
  208. data/test/readers/mdJson/v1/tc_reader_mdjson_address.rb +111 -0
  209. data/test/readers/mdJson/v1/tc_reader_mdjson_associatedResource.rb +157 -0
  210. data/test/readers/mdJson/v1/tc_reader_mdjson_browseGraphic.rb +119 -0
  211. data/test/readers/mdJson/v1/tc_reader_mdjson_citation.rb +143 -0
  212. data/test/readers/mdJson/v1/tc_reader_mdjson_contact.rb +138 -0
  213. data/test/readers/mdJson/v1/tc_reader_mdjson_dataQuality.rb +111 -0
  214. data/test/readers/mdJson/v1/tc_reader_mdjson_dateTime.rb +159 -0
  215. data/test/readers/mdJson/v1/tc_reader_mdjson_descriptiveKeyword.rb +115 -0
  216. data/test/readers/mdJson/v1/tc_reader_mdjson_dictionaryInfo.rb +121 -0
  217. data/test/readers/mdJson/v1/tc_reader_mdjson_digitalTransferOption.rb +94 -0
  218. data/test/readers/mdJson/v1/tc_reader_mdjson_distributionOrder.rb +103 -0
  219. data/test/readers/mdJson/v1/tc_reader_mdjson_domain.rb +130 -0
  220. data/test/readers/mdJson/v1/tc_reader_mdjson_domainItem.rb +98 -0
  221. data/test/readers/mdJson/v1/tc_reader_mdjson_entity.rb +134 -0
  222. data/test/readers/mdJson/v1/tc_reader_mdjson_entityAttribute.rb +154 -0
  223. data/test/readers/mdJson/v1/tc_reader_mdjson_entityForeignKey.rb +100 -0
  224. data/test/readers/mdJson/v1/tc_reader_mdjson_entityIndex.rb +99 -0
  225. data/test/readers/mdJson/v1/tc_reader_mdjson_legalConstraint.rb +104 -0
  226. data/test/readers/mdJson/v1/tc_reader_mdjson_lineage.rb +117 -0
  227. data/test/readers/mdJson/v1/tc_reader_mdjson_medium.rb +98 -0
  228. data/test/readers/mdJson/v1/tc_reader_mdjson_metadataInfo.rb +141 -0
  229. data/test/readers/mdJson/v1/tc_reader_mdjson_onlineResource.rb +110 -0
  230. data/test/readers/mdJson/v1/tc_reader_mdjson_phone.rb +112 -0
  231. data/test/readers/mdJson/v1/tc_reader_mdjson_processStep.rb +118 -0
  232. data/test/readers/mdJson/v1/tc_reader_mdjson_resolution.rb +77 -0
  233. data/test/readers/mdJson/v1/tc_reader_mdjson_source.rb +117 -0
  234. data/test/readers/mdJson/v1/tc_translation_19110.rb +57 -0
  235. data/test/readers/mdJson/{v1_0/tc_translation.rb → v1/tc_translation_19115_2.rb} +16 -31
  236. data/test/writers/iso19115_2/tc_writer_iso19115_2_address.rb +22 -15
  237. metadata +219 -140
  238. data/lib/adiwg/mdtranslator/readers/mdJson/modules_1.0/module_coordinates.rb +0 -63
  239. data/lib/adiwg/mdtranslator/readers/mdJson/modules_1.0/module_distributionInfo.rb +0 -161
  240. data/lib/adiwg/mdtranslator/writers/html/sections/logo150.txt +0 -25
  241. data/lib/adiwg/mdtranslator/writers/iso/classes/class_digitalTransferOptions.rb +0 -62
  242. data/lib/adiwg/mdtranslator/writers/iso/classes/class_genericMetaData.rb +0 -74
  243. data/lib/adiwg/mdtranslator/writers/iso/classes/class_referenceIdentifier.rb +0 -53
  244. data/lib/adiwg/mdtranslator/writers/iso/classes/class_referenceSystem.rb +0 -40
  245. data/test/readers/mdJson/v1_0/tc_reader_mdjson_additionalDocumentation.rb +0 -85
  246. data/test/readers/mdJson/v1_0/tc_reader_mdjson_address.rb +0 -100
  247. data/test/readers/mdJson/v1_0/tc_reader_mdjson_associatedResource.rb +0 -101
  248. data/test/readers/mdJson/v1_0/tc_reader_mdjson_browseGraphic.rb +0 -86
  249. data/test/readers/mdJson/v1_0/tc_reader_mdjson_citation.rb +0 -116
  250. data/test/readers/mdJson/v1_0/tc_reader_mdjson_contact.rb +0 -138
  251. data/test/readers/mdJson/v1_0/tc_reader_mdjson_dictionaryInfo.rb +0 -95
  252. data/test/readers/mdJson/v1_0/tc_reader_mdjson_domain.rb +0 -99
  253. data/test/readers/mdJson/v1_0/tc_reader_mdjson_onlineResource.rb +0 -92
  254. data/test/readers/mdJson/v1_0/tc_reader_mdjson_phone.rb +0 -110
@@ -1,6 +1,4 @@
1
1
  # MdTranslator - ADIwg MdTranslator RubyGem entry point
2
- # ... pass input file to appropriate reader and writer;
3
- # ... assign module path names for require statements
4
2
 
5
3
  # History:
6
4
  # Stan Smith 2014-07-02 original script
@@ -18,28 +16,30 @@
18
16
  # Stan Smith 2014-12-11 refactored to handle namespacing readers and writers
19
17
  # Stan Smith 2015-01-15 changed translate() to keyword parameter list
20
18
  # Stan Smith 2015-03-04 moved addFinalMessages into this module from rails app
19
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
20
+ # ... created as an instance of class ResponseHash
21
+ # Stan Smith 2015-07-14 deleted readerFound
22
+ # Stan Smith 2015-07-14 renamed readerVersionFound to readerVersionRequested
23
+ # Stan Smith 2015-07-16 moved module_coordinates from mdJson reader to internal
24
+ # Stan Smith 2015-07-17 added support for user supplied CSS for html writer
21
25
 
22
- # add main directories to load_path
23
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'mdtranslator/internal'))
24
-
26
+ # required by readers and writers
25
27
  require 'adiwg/mdtranslator/version'
26
-
27
- # additional require statements to support rails
28
- # ... these modules contain methods called by rails endpoints
29
- # ... by default rails does not resolve namespaces beyond this point
30
28
  require 'adiwg/mdtranslator/readers/mdReaders'
31
29
  require 'adiwg/mdtranslator/writers/mdWriters'
30
+ require 'adiwg/mdtranslator/internal/internal_metadata_obj'
31
+ require 'adiwg/mdtranslator/internal/module_dateTimeFun'
32
+ require 'adiwg/mdtranslator/internal/module_geoFormat'
33
+ require 'adiwg/mdtranslator/internal/module_coordinates'
32
34
 
33
35
  module ADIWG
34
36
  module Mdtranslator
35
37
 
36
- def self.translate(file:, reader:, validate: 'normal', writer: nil, showAllTags: false)
37
-
38
- $showAllTags = showAllTags
38
+ def self.translate(file:, reader:, validate: 'normal', writer: nil, showAllTags: false, css: nil, cssLink: nil)
39
39
 
40
40
  # the reader and writer specified in the translate parameter string should load and
41
41
  # return this hash ...
42
- # ---------------------------
42
+ # ------------------------------------------------------------------------------------
43
43
  # readerFormat: the anticipated format of the input file, parsing by the reader will
44
44
  # proceed assuming this format, set by reader
45
45
  # readerStructurePass: 'true' if input file structure is determined to be valid.
@@ -49,9 +49,7 @@ module ADIWG
49
49
  # problems. Set by reader.
50
50
  # readerRequested: name of the reader requested by the user, set from the translate
51
51
  # parameter list
52
- # readerFound: name of the reader used by the reader, set by reader. Will be same as
53
- # readerRequested if readerRequested name is valid
54
- # readerVersionFound: version of the reader requested by the input file, set by reader
52
+ # readerVersionRequested: version of the reader requested by the input file, set by reader
55
53
  # readerVersionUsed: version of the reader the reader method decided to use in processing
56
54
  # the input file. Set by the reader. Default 'normal'.
57
55
  # readerValidationLevel: validation level requested to be applied to the input file, set
@@ -76,54 +74,81 @@ module ADIWG
76
74
  # writerMessages: an array of quoted string messages. If writerPass is 'false', set one
77
75
  # or more messages to assist user in fixing file data problems. Set by writer.
78
76
  # writerOutput: output file returned from the writer, set by writer
77
+ # writerShowTags: include tags in XML output for empty elements
78
+ # writerMissingIdCount: counter for creating unique elements IDs for ISO elements that did not
79
+ # provide IDs in the input metadata file
80
+ # translatorVersion: current version of the mdTranslator
79
81
 
80
- $response = {
82
+ responseObj = {
81
83
  readerFormat: nil,
82
84
  readerStructurePass: nil,
83
85
  readerStructureMessages: [],
84
- readerRequested: reader,
85
- readerFound: nil,
86
- readerVersionFound: nil,
86
+ readerRequested: nil,
87
+ readerVersionRequested: nil,
87
88
  readerVersionUsed: nil,
88
- readerValidationLevel: validate,
89
+ readerValidationLevel: nil,
89
90
  readerValidationPass: nil,
90
91
  readerValidationMessages: [],
91
92
  readerExecutionPass: nil,
92
93
  readerExecutionMessages: [],
93
- writerName: writer,
94
+ writerName: nil,
94
95
  writerVersion: nil,
95
96
  writerFormat: nil,
96
97
  writerPass: nil,
97
98
  writerMessages: [],
98
- writerOutput: nil
99
+ writerOutput: nil,
100
+ writerShowTags: false,
101
+ writerMissingIdCount: '_000',
102
+ translatorVersion: nil
99
103
  }
100
104
 
105
+ paramsObj = {
106
+ cssLink: cssLink,
107
+ css: css
108
+ }
109
+
110
+ # add the passed in parameters to the response hash
111
+ responseObj[:readerRequested] = reader
112
+ responseObj[:readerValidationLevel] = validate
113
+ responseObj[:writerName] = writer
114
+ responseObj[:writerShowTags] = showAllTags
115
+
116
+ # add mdTranslator version to response hash
117
+ responseObj[:translatorVersion] = ADIWG::Mdtranslator::VERSION
118
+
101
119
  # handle readers
102
120
  if reader.nil? || reader == ''
103
- $response[:readerExecutionPass] = false
104
- $response[:readerExecutionMessages] << 'Reader name was not provided'
105
- return $response
121
+ responseObj[:readerExecutionPass] = false
122
+ responseObj[:readerExecutionMessages] << 'Reader name was not provided'
123
+ return responseObj
124
+
106
125
  else
107
- require File.join(File.dirname(__FILE__), 'mdtranslator/readers/mdReaders')
108
- intObj = ADIWG::Mdtranslator::Readers.handleReader(file)
109
-
110
- # if readerExecutionPass is nil no error messages were set during exection
111
- # and the execution is assumed to have been successful
112
- if $response[:readerExecutionPass].nil?
113
- $response[:readerExecutionPass] = true
114
- elsif !$response[:readerExecutionPass]
115
- return $response
126
+ intObj = ADIWG::Mdtranslator::Readers.handleReader(file, responseObj)
127
+
128
+ # if readerValidation failed - exit
129
+ if !responseObj[:readerValidationPass]
130
+ return responseObj
131
+ end
132
+
133
+ # if readerExecutionPass is nil no error messages were set while
134
+ # reading the input file into the internal object.
135
+ # the read operation is assumed to have been successful and pass is set to true.
136
+ if responseObj[:readerExecutionPass].nil?
137
+ responseObj[:readerExecutionPass] = true
138
+ elsif !responseObj[:readerExecutionPass]
139
+ return responseObj
116
140
  end
117
141
  end
118
142
 
119
143
  # handle writers
120
144
  if writer.nil? || writer == ''
121
- $response[:writerMessages] << 'Writer name was not provided.'
145
+ responseObj[:writerMessages] << 'Writer name was not provided.'
122
146
  else
123
147
  require File.join(File.dirname(__FILE__), 'mdtranslator/writers/mdWriters')
124
- ADIWG::Mdtranslator::Writers.handleWriter(intObj)
148
+ ADIWG::Mdtranslator::Writers.handleWriter(intObj, responseObj, paramsObj)
125
149
  end
126
- return $response
150
+
151
+ return responseObj
127
152
 
128
153
  end
129
154
 
@@ -48,6 +48,11 @@
48
48
  # Stan Smith 2014-12-01 added data dictionary
49
49
  # Stan Smith 2015-02-17 add entity and attribute alias
50
50
  # Stan Smith 2015-02-17 added support for multiple data dictionaries
51
+ # Stan Smith 2015-07-23 added gridInfo, gridDimension for 1.3.0
52
+ # Stan Smith 2015-07-28 added locale for 1.3.0
53
+ # Stan Smith 2015-08-19 added coverageInfo, imageInfo, sensorInfo, coverageItem,
54
+ # ... classifiedData, and classedDataItem for 1.3.0
55
+ # Stan Smith 2015-09-18 extended distributionInfo sections for 1.3.0
51
56
 
52
57
  class InternalMetadata
53
58
 
@@ -128,6 +133,7 @@ class InternalMetadata
128
133
  metadataCreateDate: {},
129
134
  metadataUpdateDate: {},
130
135
  metadataCharacterSet: nil,
136
+ metadataLocales: [],
131
137
  metadataURI: nil,
132
138
  metadataStatus: nil,
133
139
  maintInfo: {},
@@ -170,6 +176,7 @@ class InternalMetadata
170
176
  resourceFormats: [],
171
177
  resourceLanguages: [],
172
178
  resourceCharacterSets: [],
179
+ resourceLocales: [],
173
180
  descriptiveKeywords: [],
174
181
  resourceUses: [],
175
182
  useConstraints: [],
@@ -182,6 +189,8 @@ class InternalMetadata
182
189
  topicCategories: [],
183
190
  environmentDescription: nil,
184
191
  extents: [],
192
+ gridInfo: [],
193
+ coverageInfo: [],
185
194
  dataQualityInfo: [],
186
195
  supplementalInfo: nil
187
196
  }
@@ -190,6 +199,7 @@ class InternalMetadata
190
199
  def newCitation
191
200
  intObj = {
192
201
  citTitle: nil,
202
+ citAltTitle: nil,
193
203
  citDate: [],
194
204
  citEdition: nil,
195
205
  citResourceIds: [],
@@ -200,9 +210,13 @@ class InternalMetadata
200
210
  end
201
211
 
202
212
  def newResourceId
213
+ # handles both MD_Identifier and RS_Identifier
203
214
  intObj = {
204
215
  identifier: nil,
205
216
  identifierType: nil,
217
+ identifierNamespace: nil,
218
+ identifierVersion: nil,
219
+ identifierDescription: nil,
206
220
  identifierCitation: {}
207
221
  }
208
222
  end
@@ -210,7 +224,8 @@ class InternalMetadata
210
224
  def newResourceFormat
211
225
  intObj = {
212
226
  formatName: nil,
213
- formatVersion: nil
227
+ formatVersion: nil,
228
+ compressionMethod: nil
214
229
  }
215
230
  end
216
231
 
@@ -250,9 +265,9 @@ class InternalMetadata
250
265
  def newDistributor
251
266
  intObj = {
252
267
  distContact: {},
253
- distOrderProc: [],
254
- distFormat: [],
255
- distTransOption: []
268
+ distOrderProcs: [],
269
+ distFormats: [],
270
+ distTransOptions: []
256
271
  }
257
272
  end
258
273
 
@@ -267,6 +282,9 @@ class InternalMetadata
267
282
 
268
283
  def newDigitalTransOption
269
284
  intObj = {
285
+ distFormats: [],
286
+ transferSize: nil,
287
+ transferSizeUnits: nil,
270
288
  online: [],
271
289
  offline: {}
272
290
  }
@@ -274,7 +292,9 @@ class InternalMetadata
274
292
 
275
293
  def newMedium
276
294
  intObj = {
277
- mediumName: nil,
295
+ mediumType: nil,
296
+ mediumCapacity: nil,
297
+ mediumCapacityUnits: nil,
278
298
  mediumFormat: nil,
279
299
  mediumNote: nil
280
300
  }
@@ -577,4 +597,102 @@ class InternalMetadata
577
597
  }
578
598
  end
579
599
 
600
+ def newGridInfo
601
+ intObj = {
602
+ dimensions: nil,
603
+ dimensionInfo: [],
604
+ dimensionGeometry: nil,
605
+ dimensionTransformParams: false
606
+ }
607
+ end
608
+
609
+ def newDimensionInfo
610
+ intObj = {
611
+ dimensionType: nil,
612
+ dimensionTitle: nil,
613
+ dimensionDescription: nil,
614
+ dimensionSize: nil,
615
+ resolution: nil,
616
+ resolutionUnits: nil
617
+ }
618
+ end
619
+
620
+ def newCoverageInfo
621
+ intObj = {
622
+ coverageType: nil,
623
+ coverageName: nil,
624
+ coverageDescription: nil,
625
+ processingLevel: {},
626
+ coverageItems: [],
627
+ imageInfo: {}
628
+ }
629
+ end
630
+
631
+ def newCoverageItem
632
+ intObj = {
633
+ itemName: nil,
634
+ itemType: nil,
635
+ itemDescription: nil,
636
+ minValue: nil,
637
+ maxValue: nil,
638
+ units: nil,
639
+ scaleFactor: nil,
640
+ offset: nil,
641
+ meanValue: nil,
642
+ standardDeviation: nil,
643
+ bitsPerValue: nil,
644
+ classedData: {},
645
+ sensorInfo: {}
646
+ }
647
+ end
648
+
649
+ def newClassedData
650
+ intObj = {
651
+ numberOfClasses: nil,
652
+ classedDataItems: []
653
+ }
654
+ end
655
+
656
+ def newClassedDataItem
657
+ intObj = {
658
+ className: nil,
659
+ classDescription: nil,
660
+ classValue: nil
661
+ }
662
+ end
663
+
664
+ def newImageInfo
665
+ intObj = {
666
+ illuminationElevationAngle: nil,
667
+ illuminationAzimuthAngle: nil,
668
+ imageCondition: nil,
669
+ imageQuality: {},
670
+ cloudCoverPercent: nil,
671
+ compressionQuantity: nil,
672
+ triangulationInfo: false,
673
+ radiometricCalibrationInfo: false,
674
+ cameraCalibrationInfo: false,
675
+ filmDistortionInfo: false,
676
+ lensDistortionInfo: false
677
+ }
678
+ end
679
+
680
+ def newSensorInfo
681
+ intObj = {
682
+ toneGradations: nil,
683
+ sensorMin: nil,
684
+ sensorMax: nil,
685
+ sensorUnits: nil,
686
+ sensorPeakResponse: nil
687
+ }
688
+ end
689
+
690
+ def newLocale
691
+ intObj = {
692
+ languageCode: nil,
693
+ countryCode: nil,
694
+ characterEncoding: nil
695
+ }
696
+ end
697
+
580
698
  end
@@ -0,0 +1,55 @@
1
+ # repack coordinates
2
+
3
+ # History:
4
+ # Stan Smith 2013-11-07 original script
5
+ # Stan Smith 2013-11-13 added getDimension
6
+ # Stan Smith 2014-05-23 added getLevels
7
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
8
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
9
+ # Stan Smith 2015-07-14 refactored to remove global namespace constants
10
+ # Stan Smith 2015-07-16 moved module_coordinates from mdJson reader to internal
11
+
12
+ module AdiwgCoordinates
13
+
14
+ # repack coordinate array into single string for ISO
15
+ def self.unpack(aCoords, responseObj)
16
+ s = ''
17
+ i = 0
18
+ coordCount = aCoords.length
19
+ aCoords.each do |coord|
20
+ if coord.kind_of?(Array)
21
+ s = s + unpack(coord, responseObj)
22
+ else
23
+ i += 1
24
+ s = s + coord.to_s
25
+ if i < coordCount
26
+ s = s + ','
27
+ end
28
+ s = s + ' '
29
+ end
30
+ end
31
+
32
+ return s
33
+ end
34
+
35
+ # get the number of dimensions in a coordinate array
36
+ def self.getDimension(aCoords)
37
+ if aCoords[0].kind_of?(Array)
38
+ coordDim = getDimension(aCoords[0])
39
+ else
40
+ coordDim = aCoords.length
41
+ end
42
+
43
+ return coordDim
44
+ end
45
+
46
+ # get the number of levels in the coordinate array
47
+ def self.getLevels(aCoords)
48
+ i = 1
49
+ if aCoords[0].kind_of?(Array)
50
+ i = i + getLevels(aCoords[0])
51
+ end
52
+ return i
53
+ end
54
+
55
+ end
@@ -13,40 +13,47 @@
13
13
  # Stan Smith 2014-12-03 changed class name to MdJsonReader from AdiwgJsonReader
14
14
  # Stan Smith 2014-12-11 refactored to handle namespacing readers and writers
15
15
  # Stan Smith 2015-06-12 added method to lookup contact in contact array
16
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
17
+ # Stan Smith 2015-07-14 refactored to remove global namespace constants
18
+ # Stan Smith 2015-07-14 added support for mdJson version numbers
16
19
 
17
20
  require 'json'
21
+ require_relative 'mdJson_validator'
18
22
 
19
23
  module ADIWG
20
24
  module Mdtranslator
21
25
  module Readers
22
26
  module MdJson
23
27
 
24
- def self.readFile(file)
25
- # set anticipated format of file in $response
26
- $response[:readerFormat] = 'json'
28
+ def self.readFile(file, responseObj)
29
+
30
+ # set reference to responseObj for use throughout this module
31
+ @responseObj = responseObj
27
32
 
28
33
  # receive json file into ruby hash
29
34
  parseJson(file)
30
- if !$response[:readerStructurePass]
35
+ if !@responseObj[:readerStructurePass]
31
36
  return false
32
37
  end
33
38
 
39
+ # set format of file in $response
40
+ @responseObj[:readerFormat] = 'json'
41
+
34
42
  # check mdJson version name
35
43
  checkVersionName
36
- if !$response[:readerStructurePass]
44
+ if !@responseObj[:readerStructurePass]
37
45
  return false
38
46
  end
39
47
 
40
48
  # check mdJson version number
41
49
  checkVersionNumber
42
- if !$response[:readerStructurePass]
50
+ if !@responseObj[:readerStructurePass]
43
51
  return false
44
52
  end
45
53
 
46
54
  # validate file against mdJson schema definition
47
- require 'adiwg/mdtranslator/readers/mdJson/mdJson_validator'
48
- $ReaderNS.validate(file)
49
- if !$response[:readerValidationPass]
55
+ validate(file, @responseObj)
56
+ if !@responseObj[:readerValidationPass]
50
57
  return false
51
58
  end
52
59
 
@@ -57,7 +64,9 @@ module ADIWG
57
64
 
58
65
  # create new internal metadata container for the reader
59
66
  @intObj = intMetadataClass.newBase
60
- $ReaderNS.unpack(@intObj, @hMdJson)
67
+
68
+ #
69
+ ADIWG::Mdtranslator::Readers::MdJson.unpack(@intObj, @hMdJson, @responseObj)
61
70
  return @intObj
62
71
 
63
72
  end
@@ -67,11 +76,11 @@ module ADIWG
67
76
  # test for valid json syntax by attempting to parse the file
68
77
  begin
69
78
  @hMdJson = JSON.parse(file)
70
- $response[:readerStructurePass] = true
79
+ @responseObj[:readerStructurePass] = true
71
80
  rescue JSON::JSONError => err
72
- $response[:readerStructurePass] = false
73
- $response[:readerStructureMessages] << 'JSON Parsing Failed - see following message(s):\n'
74
- $response[:readerStructureMessages] << err.to_s.slice(0,300)
81
+ @responseObj[:readerStructurePass] = false
82
+ @responseObj[:readerStructureMessages] << 'JSON Parsing Failed - see following message(s):\n'
83
+ @responseObj[:readerStructureMessages] << err.to_s.slice(0,300)
75
84
  end
76
85
  end
77
86
 
@@ -80,36 +89,34 @@ module ADIWG
80
89
  if @hMdJson.has_key?('version')
81
90
  hVersion = @hMdJson['version']
82
91
  else
83
- $response[:readerStructurePass] = false
84
- $response[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
85
- $response[:readerStructureMessages] << 'The input file is missing the version:{} block.'
92
+ @responseObj[:readerStructurePass] = false
93
+ @responseObj[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
94
+ @responseObj[:readerStructureMessages] << 'The input file is missing the version:{} block.'
86
95
  return
87
96
  end
88
97
 
89
98
  # check the version name
90
99
  if hVersion.has_key?('name')
91
100
  s = hVersion['name']
92
- if !s.nil?
93
- $response[:readerFound] = s
94
- else
95
- $response[:readerStructurePass] = false
96
- $response[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
97
- $response[:readerStructureMessages] << 'The input file version: => name: is missing.'
101
+ if s.nil?
102
+ @responseObj[:readerStructurePass] = false
103
+ @responseObj[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
104
+ @responseObj[:readerStructureMessages] << 'The input file version: => name: is missing.'
98
105
  return
99
106
  end
100
107
  else
101
- $response[:readerStructurePass] = false
102
- $response[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
103
- $response[:readerStructureMessages] << "The input file version:{} block is missing the 'name:' attribute."
108
+ @responseObj[:readerStructurePass] = false
109
+ @responseObj[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
110
+ @responseObj[:readerStructureMessages] << "The input file version:{} block is missing the 'name:' attribute."
104
111
  return
105
112
  end
106
113
 
107
114
  # check the version name is 'mdJson'
108
115
  if s != 'mdJson'
109
- $response[:readerStructurePass] = false
110
- $response[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
111
- $response[:readerStructureMessages] << "The mdTranslator reader expected the input file version: name: to be 'mdJson'."
112
- $response[:readerStructureMessages] << "Version name found was: '#{s}'."
116
+ @responseObj[:readerStructurePass] = false
117
+ @responseObj[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
118
+ @responseObj[:readerStructureMessages] << "The mdTranslator reader expected the input file version: name: to be 'mdJson'."
119
+ @responseObj[:readerStructureMessages] << "Version name found was: '#{s}'."
113
120
  end
114
121
  end
115
122
 
@@ -119,55 +126,55 @@ module ADIWG
119
126
  if hVersion.has_key?('version')
120
127
  s = hVersion['version']
121
128
  if !s.nil?
122
- $response[:readerVersionFound] = s
129
+ @responseObj[:readerVersionRequested] = s
123
130
  end
124
131
  else
125
- $response[:readerStructurePass] = false
126
- $response[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
127
- $response[:readerStructureMessages] << "The input file version:{} block is missing the 'version:' number attribute."
132
+ @responseObj[:readerStructurePass] = false
133
+ @responseObj[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
134
+ @responseObj[:readerStructureMessages] << "The input file version:{} block is missing the 'version:' number attribute."
128
135
  return
129
136
  end
130
137
 
131
- # test the reader version requested is supported
132
- # remove maintenance release number first
133
- # ... then look for a module folder name ending with the requested version
134
- # ... example: 'modules_1.2'
135
- aVersionParts = s.split('.')
136
- if aVersionParts.length >= 2
137
- readerVersion = aVersionParts[0] +'.' + aVersionParts[1]
138
- dir = File.join(File.dirname(__FILE__), 'modules_' + readerVersion)
139
- if !File.directory?(dir)
140
- $response[:readerStructurePass] = false
141
- $response[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
142
- $response[:readerStructureMessages] << 'The input file version is not supported.'
143
- $response[:readerStructureMessages] << "mdJson version requested was '#{s}'"
144
- return
145
- end
146
- $response[:readerVersionUsed] = readerVersion
147
- else
148
- $response[:readerStructurePass] = false
149
- $response[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
150
- $response[:readerStructureMessages] << 'The input file version number must be in the form MAJOR.MINOR.PATCH, e.g. 1.2.3'
151
- $response[:readerStructureMessages] << 'Note the PATCH number is optional.'
152
- end
153
- end
138
+ # split the version number into its parts
139
+ aReqVersion = s.split('.')
154
140
 
155
- # require modules for the requested version
156
- def self.readerModule(moduleName)
157
- dir = File.join(File.dirname(__FILE__), 'modules_' + $response[:readerVersionUsed])
158
- file = File.join(dir, moduleName)
141
+ reqMajor = 0
142
+ if !aReqVersion[0].nil?
143
+ reqMajor = aReqVersion[0]
144
+ end
159
145
 
160
- # test for the existance of the module in the current mdJson version directory
161
- if !File.exist?(File.join(dir, moduleName + '.rb'))
162
- # file not found
163
- # ... look for module in previous version directory
164
- # ... note: no previous version directories exist yet
146
+ # test if the requested reader major version is supported
147
+ # look for a folder with modules for the major version number
148
+ dirName = File.join(File.dirname(__FILE__), 'modules_v' + reqMajor)
149
+ if !File.directory?(dirName)
150
+ @responseObj[:readerStructurePass] = false
151
+ @responseObj[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
152
+ @responseObj[:readerStructureMessages] << 'A reader for the requested version is not supported.'
153
+ @responseObj[:readerStructureMessages] << "mdJson version requested was '#{s}'"
154
+ return false
155
+ end
165
156
 
166
- # no prior version directory found
167
- # ... file not found
168
- return nil
157
+ # the requested major version is supported
158
+ # get the full version number for this major version of mdJson
159
+ require File.join(dirName, 'version')
160
+ curVersion = ADIWG::Mdtranslator::Readers::MdJson::VERSION
161
+ @responseObj[:readerVersionUsed] = curVersion
162
+ aCurVersion = curVersion.split('.')
163
+ curMinor = aCurVersion[1]
164
+
165
+ # test that minor version number is not exceeded
166
+ reqMinor = 0
167
+ if !aReqVersion[1].nil?
168
+ reqMinor = aReqVersion[1]
169
+ if curMinor < reqMinor
170
+ @responseObj[:readerStructurePass] = false
171
+ @responseObj[:readerStructureMessages] << 'Invalid input file schema declaration - see following message(s):\n'
172
+ @responseObj[:readerStructureMessages] << 'The requested reader minor version is not supported.'
173
+ @responseObj[:readerStructureMessages] << "mdJson version requested was '#{s}'"
174
+ return false
175
+ end
169
176
  end
170
- return file
177
+
171
178
  end
172
179
 
173
180
  # find the array pointer for a contact
@@ -180,9 +187,30 @@ module ADIWG
180
187
  end
181
188
  i += 1
182
189
  end
190
+
183
191
  return pointer
184
192
  end
185
193
 
194
+ # require modules for the requested version
195
+ def self.readerModule(moduleName)
196
+ majVersion = @responseObj[:readerVersionUsed].split('.')[0]
197
+ dirName = File.join(File.dirname(__FILE__), 'modules_v' + majVersion.to_s)
198
+ fileName = File.join(dirName, moduleName)
199
+
200
+ # test for the existance of the module in the current mdJson version directory
201
+ if !File.exist?(File.join(dirName, moduleName + '.rb'))
202
+ # file not found
203
+ # ... look for module in previous version directory
204
+ # ... note: no previous version directories exist yet
205
+
206
+ # no prior version directory found
207
+ # ... file not found
208
+ return nil
209
+ end
210
+
211
+ return fileName
212
+ end
213
+
186
214
  end
187
215
  end
188
216
  end