Changeset 7005 for FCSSimpleEndpoint


Ignore:
Timestamp:
03/16/16 13:24:28 (8 years ago)
Author:
Leif-Jöran
Message:

Proofed some strings and method names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/utils/SimpleEndpointDescriptionParser.java

    r6935 r7005  
    7575    private static final URI CAP_ADVANCED_SEARCH =
    7676            URI.create("http://clarin.eu/fcs/capability/advanced-search");
    77     private static final String MINETYPE_HITS = "application/x-clarin-fcs-hits+xml";
    78     private static final String MINETYPE_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";
    7979    private static final String LANG_EN = "en";
    8080    private static final String POLICY_SEND_DEFAULT = "send-by-default";
     
    181181                } catch (URISyntaxException e) {
    182182                    throw new SRUConfigException("capability is not encoded " +
    183                             "as proper URI: " + s);
     183                            "as a proper URI: " + s);
    184184                }
    185185            }
     
    190190        if (!capabilities.contains(CAP_BASIC_SEARCH)) {
    191191            logger.warn("capability '{}' was not defined in endpoint " +
    192                     "description; added it to meet specification. Please " +
     192                    "description; it was added to meet the specification. Please " +
    193193                    "update your endpoint description!", CAP_BASIC_SEARCH);
    194194            capabilities.add(CAP_BASIC_SEARCH);
     
    210210                if (id == null) {
    211211                    throw new SRUConfigException("Element <SupportedDataView> "
    212                             + "must carry a proper 'id' attribute");
     212                            + "must have a proper 'id' attribute");
    213213                }
    214214
     
    222222                if (p == null) {
    223223                    throw new SRUConfigException("Element <SupportedDataView> "
    224                             + "must carry a 'delivery-policy' attribute");
     224                            + "must have a 'delivery-policy' attribute");
    225225                }
    226226                DeliveryPolicy policy = null;
     
    275275
    276276        for (DataView dataView : supportedDataViews) {
    277             if (dataView.getMimeType().equals(MINETYPE_HITS)) {
     277            if (dataView.getMimeType().equals(MIMETYPE_HITS)) {
    278278                hasHitsView = true;
    279             } else if (dataView.getMimeType().equals(MINETYPE_ADV)) {
     279            } else if (dataView.getMimeType().equals(MIMETYPE_ADV)) {
    280280                hasAdvView = true;
    281281            }
     
    283283        if (!hasHitsView) {
    284284            throw new SRUConfigException("Generic Hits Data View (" +
    285                     MINETYPE_HITS + ") was not declared in <SupportedDataViews>");
     285                    MIMETYPE_HITS + ") was not declared in <SupportedDataViews>");
    286286        }
    287287        if (capabilities.contains(CAP_ADVANCED_SEARCH) && !hasAdvView) {
    288288            throw new SRUConfigException("Endpoint claimes to support " +
    289289                    "Advanced FCS but does not declare Advanced Data View (" +
    290                     MINETYPE_ADV + ") in <SupportedDataViews>");
     290                    MIMETYPE_ADV + ") in <SupportedDataViews>");
    291291
    292292        }
     
    304304                if (id == null) {
    305305                    throw new SRUConfigException("Element <SupportedLayer> "
    306                             + "must carry a proper 'id' attribute");
     306                            + "must have a proper 'id' attribute");
    307307                }
    308308
     
    316316                if (s == null) {
    317317                    throw new SRUConfigException("Element <SupportedLayer> "
    318                             + "must carry a proper 'result-id' attribute");
     318                            + "must have a proper 'result-id' attribute");
    319319                }
    320320                URI resultId = null;
     
    400400        list = (NodeList) exp.evaluate(doc, XPathConstants.NODESET);
    401401        final Set<String> pids = new HashSet<String>();
    402         List<ResourceInfo> resources = parseRessources(xpath, list, pids,
     402        List<ResourceInfo> resources = parseResources(xpath, list, pids,
    403403                supportedDataViews, supportedLayers, hasAdvView);
    404404        if ((resources == null) || resources.isEmpty()) {
     
    415415
    416416
    417     private static List<ResourceInfo> parseRessources(XPath xpath,
     417    private static List<ResourceInfo> parseResources(XPath xpath,
    418418            NodeList nodes, Set<String> pids, List<DataView> supportedDataViews,
    419419            List<Layer> supportedLayers, boolean hasAdv)
     
    434434          if (pid == null) {
    435435              throw new SRUConfigException("Element <ResourceInfo> " +
    436                       "must carry a proper 'pid' attribute");
     436                      "must have a proper 'pid' attribute");
    437437          }
    438438          if (pids.contains(pid)) {
     
    450450                  final String lang = getLangAttribute(n);
    451451                  if (lang == null) {
    452                       throw new SRUConfigException("Element <Title> must " +
    453                               "carry a proper 'xml:lang' attribute");
     452                      throw new SRUConfigException("Element <Title> " +
     453                              "must have a proper 'xml:lang' attribute");
    454454                  }
    455455
    456456                  final String title = cleanString(n.getTextContent());
    457457                  if (title == null) {
    458                       throw new SRUConfigException("Element <Title> must " +
    459                               "carry a non-empty 'xml:lang' attribute");
     458                      throw new SRUConfigException("Element <Title> " +
     459                              "must have a non-empty 'xml:lang' attribute");
    460460                  }
    461461
     
    486486                  if (lang == null) {
    487487                      throw new SRUConfigException("Element <Description> " +
    488                               "must carry a proper 'xml:lang' attribute");
     488                              "must have a proper 'xml:lang' attribute");
    489489
    490490                  }
     
    537537                  if ((s == null) || (s.length() != 3)) {
    538538                      throw new SRUConfigException("Element <Language> " +
    539                               "must use ISO-632-3 three letter " +
     539                              "must use ISO-639-3 three letter " +
    540540                              "language codes");
    541541                  }
     
    554554              if (ref == null) {
    555555                  throw new SRUConfigException("Element <AvailableDataViews> " +
    556                           "must carry a 'ref' attribute");
     556                          "must have a 'ref' attribute");
    557557              }
    558558              String[] refs = ref.split("\\s+");
     
    598598              if (ref == null) {
    599599                  throw new SRUConfigException("Element <AvailableLayers> " +
    600                           "must carry a 'ref' attribute");
     600                          "must have a 'ref' attribute");
    601601              }
    602602              String[] refs = ref.split("\\s+");
     
    636636          list = (NodeList) exp.evaluate(node, XPathConstants.NODESET);
    637637          if ((list != null) && (list.getLength() > 0)) {
    638               sub = parseRessources(xpath, list, pids,
     638              sub = parseResources(xpath, list, pids,
    639639                      supportedDataViews, supportedLayers, hasAdv);
    640640          }
Note: See TracChangeset for help on using the changeset viewer.