Changeset 7005 for FCSSimpleEndpoint
- Timestamp:
- 03/16/16 13:24:28 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/utils/SimpleEndpointDescriptionParser.java
r6935 r7005 75 75 private static final URI CAP_ADVANCED_SEARCH = 76 76 URI.create("http://clarin.eu/fcs/capability/advanced-search"); 77 private static final String MI NETYPE_HITS = "application/x-clarin-fcs-hits+xml";78 private static final String MI NETYPE_ADV = "application/x-clarin-fcs-adv+xml";77 private static final String MIMETYPE_HITS = "application/x-clarin-fcs-hits+xml"; 78 private static final String MIMETYPE_ADV = "application/x-clarin-fcs-adv+xml"; 79 79 private static final String LANG_EN = "en"; 80 80 private static final String POLICY_SEND_DEFAULT = "send-by-default"; … … 181 181 } catch (URISyntaxException e) { 182 182 throw new SRUConfigException("capability is not encoded " + 183 "as proper URI: " + s);183 "as a proper URI: " + s); 184 184 } 185 185 } … … 190 190 if (!capabilities.contains(CAP_BASIC_SEARCH)) { 191 191 logger.warn("capability '{}' was not defined in endpoint " + 192 "description; added it to meetspecification. Please " +192 "description; it was added to meet the specification. Please " + 193 193 "update your endpoint description!", CAP_BASIC_SEARCH); 194 194 capabilities.add(CAP_BASIC_SEARCH); … … 210 210 if (id == null) { 211 211 throw new SRUConfigException("Element <SupportedDataView> " 212 + "must carrya proper 'id' attribute");212 + "must have a proper 'id' attribute"); 213 213 } 214 214 … … 222 222 if (p == null) { 223 223 throw new SRUConfigException("Element <SupportedDataView> " 224 + "must carrya 'delivery-policy' attribute");224 + "must have a 'delivery-policy' attribute"); 225 225 } 226 226 DeliveryPolicy policy = null; … … 275 275 276 276 for (DataView dataView : supportedDataViews) { 277 if (dataView.getMimeType().equals(MI NETYPE_HITS)) {277 if (dataView.getMimeType().equals(MIMETYPE_HITS)) { 278 278 hasHitsView = true; 279 } else if (dataView.getMimeType().equals(MI NETYPE_ADV)) {279 } else if (dataView.getMimeType().equals(MIMETYPE_ADV)) { 280 280 hasAdvView = true; 281 281 } … … 283 283 if (!hasHitsView) { 284 284 throw new SRUConfigException("Generic Hits Data View (" + 285 MI NETYPE_HITS + ") was not declared in <SupportedDataViews>");285 MIMETYPE_HITS + ") was not declared in <SupportedDataViews>"); 286 286 } 287 287 if (capabilities.contains(CAP_ADVANCED_SEARCH) && !hasAdvView) { 288 288 throw new SRUConfigException("Endpoint claimes to support " + 289 289 "Advanced FCS but does not declare Advanced Data View (" + 290 MI NETYPE_ADV + ") in <SupportedDataViews>");290 MIMETYPE_ADV + ") in <SupportedDataViews>"); 291 291 292 292 } … … 304 304 if (id == null) { 305 305 throw new SRUConfigException("Element <SupportedLayer> " 306 + "must carrya proper 'id' attribute");306 + "must have a proper 'id' attribute"); 307 307 } 308 308 … … 316 316 if (s == null) { 317 317 throw new SRUConfigException("Element <SupportedLayer> " 318 + "must carrya proper 'result-id' attribute");318 + "must have a proper 'result-id' attribute"); 319 319 } 320 320 URI resultId = null; … … 400 400 list = (NodeList) exp.evaluate(doc, XPathConstants.NODESET); 401 401 final Set<String> pids = new HashSet<String>(); 402 List<ResourceInfo> resources = parseRes sources(xpath, list, pids,402 List<ResourceInfo> resources = parseResources(xpath, list, pids, 403 403 supportedDataViews, supportedLayers, hasAdvView); 404 404 if ((resources == null) || resources.isEmpty()) { … … 415 415 416 416 417 private static List<ResourceInfo> parseRes sources(XPath xpath,417 private static List<ResourceInfo> parseResources(XPath xpath, 418 418 NodeList nodes, Set<String> pids, List<DataView> supportedDataViews, 419 419 List<Layer> supportedLayers, boolean hasAdv) … … 434 434 if (pid == null) { 435 435 throw new SRUConfigException("Element <ResourceInfo> " + 436 "must carrya proper 'pid' attribute");436 "must have a proper 'pid' attribute"); 437 437 } 438 438 if (pids.contains(pid)) { … … 450 450 final String lang = getLangAttribute(n); 451 451 if (lang == null) { 452 throw new SRUConfigException("Element <Title> must" +453 " carrya proper 'xml:lang' attribute");452 throw new SRUConfigException("Element <Title> " + 453 "must have a proper 'xml:lang' attribute"); 454 454 } 455 455 456 456 final String title = cleanString(n.getTextContent()); 457 457 if (title == null) { 458 throw new SRUConfigException("Element <Title> must" +459 " carrya non-empty 'xml:lang' attribute");458 throw new SRUConfigException("Element <Title> " + 459 "must have a non-empty 'xml:lang' attribute"); 460 460 } 461 461 … … 486 486 if (lang == null) { 487 487 throw new SRUConfigException("Element <Description> " + 488 "must carrya proper 'xml:lang' attribute");488 "must have a proper 'xml:lang' attribute"); 489 489 490 490 } … … 537 537 if ((s == null) || (s.length() != 3)) { 538 538 throw new SRUConfigException("Element <Language> " + 539 "must use ISO-63 2-3 three letter " +539 "must use ISO-639-3 three letter " + 540 540 "language codes"); 541 541 } … … 554 554 if (ref == null) { 555 555 throw new SRUConfigException("Element <AvailableDataViews> " + 556 "must carrya 'ref' attribute");556 "must have a 'ref' attribute"); 557 557 } 558 558 String[] refs = ref.split("\\s+"); … … 598 598 if (ref == null) { 599 599 throw new SRUConfigException("Element <AvailableLayers> " + 600 "must carrya 'ref' attribute");600 "must have a 'ref' attribute"); 601 601 } 602 602 String[] refs = ref.split("\\s+"); … … 636 636 list = (NodeList) exp.evaluate(node, XPathConstants.NODESET); 637 637 if ((list != null) && (list.getLength() > 0)) { 638 sub = parseRes sources(xpath, list, pids,638 sub = parseResources(xpath, list, pids, 639 639 supportedDataViews, supportedLayers, hasAdv); 640 640 }
Note: See TracChangeset
for help on using the changeset viewer.