Changeset 1890
- Timestamp:
- 04/17/12 19:30:27 (12 years ago)
- Location:
- SRUServer/trunk/src/main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUServer/trunk/src/main/java/eu/clarin/sru/server/SRUServerConfig.java
r1889 r1890 636 636 List<SchemaInfo> schemaInfo = buildSchemaInfo(xpath, doc); 637 637 638 639 638 String transport = params.get(SRU_TRANSPORT); 640 639 if ((transport == null) || transport.isEmpty()) { … … 755 754 String identifier = e.getAttribute("identifier"); 756 755 String name = e.getAttribute("name"); 756 if (identifier.isEmpty()) { 757 throw new SRUConfigException("attribute 'identifier' may "+ 758 "on element '/indexInfo/set' may not be empty"); 759 } 760 if (name.isEmpty()) { 761 throw new SRUConfigException("attribute 'name' may on " + 762 "element '/indexInfo/set' may not be empty"); 763 } 757 764 List<LocalizedString> title = 758 765 fromNodeList(e.getElementsByTagName("title")); … … 788 795 foundPrimary = true; 789 796 } 790 String set = e2.getAttribute("set"); 791 String name = e2.getTextContent(); 797 String set = null; 798 String name = null; 799 NodeList result3 = e2.getElementsByTagName("name"); 800 if ((result3 != null) && (result3.getLength() > 0)) { 801 Element e3 = (Element) result3.item(0); 802 set = e3.getAttribute("set"); 803 name = e3.getTextContent(); 804 if (set.isEmpty()) { 805 throw new SRUConfigException("attribute 'set'" + 806 " on element '/indexInfo/index/map/" + 807 "name' may not be empty"); 808 } 809 if ((name == null) || name.isEmpty()) { 810 throw new SRUConfigException("element " + 811 "'/indexInfo/index/map/name' may not " + 812 "be empty"); 813 } 814 } 792 815 maps.add(new IndexInfo.Index.Map(primary, set, name)); 793 816 } 794 817 } 795 indexes.add(new IndexInfo.Index(title, can_search, can_scan, can_sort, maps)); 818 indexes.add(new IndexInfo.Index(title, can_search, can_scan, 819 can_sort, maps)); 796 820 } // for 821 822 // sanity check (/index/map/name/@set exists in any set/@name) 823 if (sets != null) { 824 for (IndexInfo.Index index : indexes) { 825 if (index.getMaps() != null) { 826 for (IndexInfo.Index.Map maps : index.getMaps()) { 827 if (findSetByName(sets, maps.getSet()) == null) { 828 throw new SRUConfigException("/index/map/" + 829 "name refers to nonexitsing set (" + 830 maps.getSet() + ")"); 831 } 832 } 833 } 834 } 835 } 797 836 } // if 798 837 return new IndexInfo(sets, indexes); … … 828 867 829 868 869 private static IndexInfo.Set findSetByName(List<IndexInfo.Set> sets, 870 String name) { 871 for (IndexInfo.Set set : sets) { 872 if (set.getName().equals(name)) { 873 return set; 874 } 875 } 876 return null; 877 } 878 879 830 880 private static List<LocalizedString> buildList(XPath xpath, Document doc, 831 881 String expression) throws SRUConfigException, -
SRUServer/trunk/src/main/resources/META-INF/sru-server-config.xsd
r1889 r1890 74 74 <xsd:simpleContent> 75 75 <xsd:extension base="xsd:string"> 76 <xsd:attribute name="set" type="xsd:string" />76 <xsd:attribute name="set" type="xsd:string" use="required" /> 77 77 </xsd:extension> 78 78 </xsd:simpleContent>
Note: See TracChangeset
for help on using the changeset viewer.