Changeset 7279
- Timestamp:
- 01/10/22 12:04:49 (3 years ago)
- Location:
- FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/AdvancedDataViewWriter.java
r7273 r7279 49 49 "http://clarin.eu/fcs/dataview/hits"; 50 50 private final Unit unit; 51 private final List<Segment> segments = new ArrayList< Segment>();52 private final Map<URI, List<Span>> layers = new HashMap< URI, List<Span>>();51 private final List<Segment> segments = new ArrayList<>(); 52 private final Map<URI, List<Span>> layers = new HashMap<>(); 53 53 private long nextSegmentId = INITIAL_SEGMENT_ID; 54 54 … … 189 189 List<Span> layer = layers.get(layerId); 190 190 if (layer == null) { 191 layer = new ArrayList< Span>();191 layer = new ArrayList<>(); 192 192 layers.put(layerId, layer); 193 193 } -
FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/EndpointDescription.java
r7273 r7279 40 40 */ 41 41 public static final int VERSION_2 = 2; 42 42 43 43 /** 44 44 * Constant for a (synthetic) persistent identifier identifying the top-most … … 59 59 * Get the version number of this endpoint description. <br> 60 60 * Valid version are 1 for FCS 1.0 and 2 fpr FCS 2.0. 61 * 61 * 62 62 * @return the version number for this endpoint description 63 63 */ … … 67 67 /** 68 68 * Check if this endpoint description is in a certain version. 69 * 69 * 70 70 * @param version 71 71 * the version to check for 72 * 72 * 73 73 * @return <code>true</code>, if version number matches 74 74 */ 75 75 public boolean isVersion(int version); 76 76 77 77 78 78 /** 79 79 * Get the list of capabilities supported by this endpoint. The list -
FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/SimpleEndpointSearchEngineBase.java
r7273 r7279 140 140 if (enableAuthentication != null) { 141 141 if (parseBoolean(enableAuthentication)) { 142 logger.debug("enabling authentication"); 142 logger.debug("enabling authentication"); 143 143 AuthenticationProvider.Builder builder = 144 144 AuthenticationProvider.Builder.create(); 145 145 146 146 String audience = params.get(FCS_AUTHENTICATION_AUDIENCE_PARAM); 147 147 if (audience != null) { … … 157 157 } 158 158 } 159 159 160 160 boolean ignoreIssuedAt = parseBoolean( 161 161 params.get(FCS_AUTHENTICATION_IGNORE_ISSUEDAT_PARAM)); … … 177 177 builder.withExpiresAt(expiresAtLeeway); 178 178 } 179 179 180 180 long notBeforeLeeway = parseLong( 181 181 params.get(FCS_AUTHENTICATION_ACCEPT_NOTBEFORE_PARAM), -1); … … 368 368 return defaultValue; 369 369 } 370 371 370 371 372 372 private void writeEndpointDescription(XMLStreamWriter writer) 373 373 throws XMLStreamException { -
FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/XMLStreamWriterHelper.java
r7273 r7279 446 446 } 447 447 if (hits == null) { 448 throw new NullPointerException(" text== null");448 throw new NullPointerException("hits == null"); 449 449 } 450 450 if ((hits.length == 0) || ((hits.length % 2) != 0)) { -
FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/parser/QueryParser.java
r7278 r7279 41 41 import eu.clarin.sru.fcs.qlparser.FCSLexer; 42 42 import eu.clarin.sru.fcs.qlparser.FCSParser; 43 import eu.clarin.sru.fcs.qlparser.FCSParserBaseVisitor;44 43 import eu.clarin.sru.fcs.qlparser.FCSParser.AttributeContext; 45 44 import eu.clarin.sru.fcs.qlparser.FCSParser.Expression_andContext; … … 64 63 import eu.clarin.sru.fcs.qlparser.FCSParser.Within_partContext; 65 64 import eu.clarin.sru.fcs.qlparser.FCSParser.Within_part_simpleContext; 65 import eu.clarin.sru.fcs.qlparser.FCSParserBaseVisitor; 66 66 67 67 … … 209 209 throw new IllegalArgumentException("initStackSize < 1"); 210 210 } 211 this.stack = new ArrayDeque< Object>(initStackSize);211 this.stack = new ArrayDeque<>(initStackSize); 212 212 } 213 213 … … 226 226 if (w_ctx != null) { 227 227 QueryNode within = (QueryNode) stack.pop(); 228 QueryNode query = (QueryNode) stack.pop(); ;228 QueryNode query = (QueryNode) stack.pop(); 229 229 stack.push(new QueryWithWithin(query, within)); 230 230 } … … 263 263 super.visitQuery_disjunction(ctx); 264 264 if (stack.size() > pos) { 265 List<QueryNode> items = new ArrayList< QueryNode>();265 List<QueryNode> items = new ArrayList<>(); 266 266 while (stack.size() > pos) { 267 267 items.add(0, (QueryNode) stack.pop()); … … 291 291 super.visitQuery_sequence(ctx); 292 292 if (stack.size() > pos) { 293 List<QueryNode> items = new ArrayList< QueryNode>();293 List<QueryNode> items = new ArrayList<>(); 294 294 while (stack.size() > pos) { 295 295 items.add(0, (QueryNode) stack.pop()); … … 518 518 super.visitExpression_or(ctx); 519 519 if (stack.size() > pos) { 520 final List<QueryNode> children = new ArrayList< QueryNode>();520 final List<QueryNode> children = new ArrayList<>(); 521 521 while (stack.size() > pos) { 522 522 children.add(0, (QueryNode) stack.pop()); … … 545 545 super.visitExpression_and(ctx); 546 546 if (stack.size() > pos) { 547 final List<QueryNode> children = new ArrayList< QueryNode>();547 final List<QueryNode> children = new ArrayList<>(); 548 548 while (stack.size() > pos) { 549 549 children.add(0, (QueryNode) stack.pop()); … … 615 615 final String s = f_ctx.getText(); 616 616 617 Set<RegexFlag> flags = new HashSet< RegexFlag>();617 Set<RegexFlag> flags = new HashSet<>(); 618 618 for (int i = 0; i < s.length(); i++) { 619 619 switch (s.charAt(i)) { … … 990 990 String msg, RecognitionException e) { 991 991 if (errors == null) { 992 errors = new ArrayList< String>();992 errors = new ArrayList<>(); 993 993 } 994 994 -
FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/utils/SimpleEndpointDescriptionParser.java
r7273 r7279 185 185 186 186 // capabilities 187 List<URI> capabilities = new ArrayList< URI>();187 List<URI> capabilities = new ArrayList<>(); 188 188 exp = xpath.compile("//ed:Capabilities/ed:Capability"); 189 189 NodeList list = … … 225 225 226 226 // used to check for uniqueness of id attribute 227 final Set<String> xml_ids = new HashSet< String>();227 final Set<String> xml_ids = new HashSet<>(); 228 228 229 229 // supported data views 230 List<DataView> supportedDataViews = new ArrayList< DataView>();230 List<DataView> supportedDataViews = new ArrayList<>(); 231 231 exp = xpath.compile("//ed:SupportedDataViews/ed:SupportedDataView"); 232 232 list = (NodeList) exp.evaluate(doc, XPathConstants.NODESET); … … 406 406 407 407 if (supportedLayers == null) { 408 supportedLayers = new ArrayList< Layer>(list.getLength());408 supportedLayers = new ArrayList<>(list.getLength()); 409 409 } 410 410 supportedLayers.add(new Layer(id, resultId, type, encoding, … … 426 426 exp = xpath.compile("/ed:EndpointDescription/ed:Resources/ed:Resource"); 427 427 list = (NodeList) exp.evaluate(doc, XPathConstants.NODESET); 428 final Set<String> pids = new HashSet< String>();428 final Set<String> pids = new HashSet<>(); 429 429 List<ResourceInfo> resources = parseResources(xpath, list, pids, 430 430 supportedDataViews, supportedLayers, version, hasAdvView); … … 511 511 512 512 if (titles == null) { 513 titles = new HashMap< String, String>();513 titles = new HashMap<>(); 514 514 } 515 515 if (titles.containsKey(lang)) { … … 542 542 543 543 if (descrs == null) { 544 descrs = new HashMap< String, String>();544 descrs = new HashMap<>(); 545 545 } 546 546 … … 592 592 593 593 if (langs == null) { 594 langs = new ArrayList< String>();594 langs = new ArrayList<>(); 595 595 } 596 596 langs.add(s); … … 614 614 } 615 615 616 for ( int i = 0; i < refs.length; i++) {616 for (String ref2 : refs) { 617 617 DataView dataview = null; 618 618 for (DataView dv : supportedDataViews) { 619 if (ref s[i].equals(dv.getIdentifier())) {619 if (ref2.equals(dv.getIdentifier())) { 620 620 dataview = dv; 621 621 break; … … 624 624 if (dataview != null) { 625 625 if (availableDataViews == null) { 626 availableDataViews = new ArrayList< DataView>();626 availableDataViews = new ArrayList<>(); 627 627 } 628 628 availableDataViews.add(dataview); 629 629 } else { 630 630 throw new SRUConfigException( 631 "A data view with " + "identifier '" + ref s[i]+631 "A data view with " + "identifier '" + ref2 + 632 632 "' was not defined " + 633 633 "in <SupportedDataViews>"); … … 658 658 } 659 659 660 for ( int i = 0; i < refs.length; i++) {660 for (String ref2 : refs) { 661 661 Layer layer = null; 662 662 for (Layer l : supportedLayers) { 663 if (ref s[i].equals(l.getId())) {663 if (ref2.equals(l.getId())) { 664 664 layer = l; 665 665 break; … … 668 668 if (layer != null) { 669 669 if (availableLayers == null) { 670 availableLayers = new ArrayList< Layer>();670 availableLayers = new ArrayList<>(); 671 671 } 672 672 availableLayers.add(layer); 673 673 } else { 674 674 throw new SRUConfigException("A layer with " + 675 "identifier '" + ref s[i]+675 "identifier '" + ref2 + 676 676 "' was not defined " + "in <SupportedLayers>"); 677 677 } … … 692 692 693 693 if (ris == null) { 694 ris = new ArrayList< ResourceInfo>();694 ris = new ArrayList<>(); 695 695 } 696 696 if ((availableLayers != null) && (version < 1)) {
Note: See TracChangeset
for help on using the changeset viewer.