Changeset 6912
- Timestamp:
- 01/18/16 15:11:20 (8 years ago)
- Location:
- SRUClient/trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUAbstractRequest.java
r6903 r6912 417 417 break; 418 418 default: 419 throw new SRUClientException("unsupported version: " + 420 versionRequested); 419 throw new SRUClientException("internal error: " + 420 "unsupported value for version (" + 421 versionRequested + ")"); 421 422 } // switch 422 423 } else { … … 439 440 break; 440 441 default: 441 throw new SRUClientException("unsupported version: " + 442 versionRequested); 442 throw new SRUClientException("internal error: " + 443 "unsupported value for version (" + 444 versionRequested + ")"); 443 445 } 444 446 -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUClient.java
r5804 r6912 85 85 * the configuration to be used for this client. 86 86 * @throws NullPointerException 87 * if argument <code>config</code> is < node>null</code>87 * if argument <code>config</code> is <code>null</code> 88 88 * @throws IllegalArgumentException 89 89 * if an error occurred while registering record data parsers -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUExtraResponseDataParser.java
r5797 r6912 31 31 * Check, if the current element can be handled by this parser. 32 32 * 33 * @param name 34 * the name of the element to be examined 35 * 33 36 * @return <code>true</code> if the element can be handled by this parser; 34 37 * <code>false</code> otherwise -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUSearchRetrieveRequest.java
r6903 r6912 20 20 21 21 /** 22 * An object for performing a <em> explain</em> operation.22 * An object for performing a <em>searchRetrieve</em> operation. 23 23 * <p> 24 24 * The following argument arguments are mandatory: … … 26 26 * <ul> 27 27 * <li><em>query</em></li> 28 * <li><em>queryType</em>, if using query language other than CQL (only SRU 2.0)</li> 28 29 * </ul> 29 30 * … … 90 91 91 92 /** 92 * (SRU 2.0) Set the value of the <em>queryType</em> argument for this 93 * request. 93 * Get the value of the <em>query</em> argument for this request. 94 * 95 * @return the value for the <em>query</em> argument or <code>null</code> of 96 * none was set 97 */ 98 public String getQuery() { 99 return query; 100 } 101 102 103 /** 104 * Set the value of the <em>queryType</em> (SRU 2.0) and the <em>query</em> 105 * argument for this request. 106 * <p> 107 * For SRU 1.1 and SRU 1.2 requests use the following:</p> 108 * <pre> 109 * {@code 110 * String cql_query = ... 111 * SRUSearchRetrieveRequest req = 112 * new SRUSearchRetrieveRequest("http://endpoint.example.org"); 113 * req.setQuery(SRUClientConstants.QUERY_TYPE_CQL, cql_query); 114 * } 115 * </pre> 94 116 * 95 117 * @param queryType 96 118 * the value for the <em>queryType</em> argument 119 * @param query 120 * the value for the <em>query</em> argument 97 121 * @throws NullPointerException 98 122 * if any required argument is <code>null</code> 99 123 * @throws IllegalArgumentException 100 124 * if any argument is invalid 101 */ 102 public void setQueryType(String queryType) { 125 * @see SRUClientConstants#QUERY_TYPE_CQL 126 */ 127 public void setQuery(String queryType, String query) { 128 if (query == null) { 129 throw new NullPointerException("query == null"); 130 } 131 if (query.isEmpty()) { 132 throw new IllegalArgumentException("query is an empty string"); 133 } 103 134 if (queryType == null) { 104 135 throw new NullPointerException("queryType == null"); … … 117 148 } 118 149 } 150 119 151 this.queryType = queryType; 120 }121 122 123 /**124 * Get the value of the <em>query</em> argument for this request.125 *126 * @return the value for the <em>query</em> argument or <code>null</code> of127 * none was set128 */129 public String getQuery() {130 return query;131 }132 133 134 /**135 * Set the value of the <em>query</em> argument for this request.136 *137 * @param query138 * the value for the <em>query</em> argument139 * @throws NullPointerException140 * if any required argument is <code>null</code>141 * @throws IllegalArgumentException142 * if any argument is invalid143 */144 public void setQuery(String query) {145 if (query == null) {146 throw new NullPointerException("query == null");147 }148 if (query.isEmpty()) {149 throw new IllegalArgumentException("query is an empty string");150 }151 152 this.query = query; 152 153 } … … 275 276 * Set the <em>recordPacking</em> (SRU 2.0) parameter of this request. 276 277 * 277 * @param getRecordXmlEscaping278 * the requested record XML escaping278 * @param recordPacking 279 * the requested recordPacking mode 279 280 * @see SRURecordXmlEscaping 280 281 */ … … 423 424 break; 424 425 default: 425 throw new SRUClientException( 426 " unsupported record XML escpaing: " + recordXmlEscaping);426 throw new SRUClientException("internal error: invalid " + 427 "recordXmlEscaping (" + recordXmlEscaping + ")"); 427 428 } // switch 428 429 } … … 443 444 */ 444 445 if ((version == SRUVersion.VERSION_2_0) && (recordPacking != null)) { 445 String s = null;446 446 switch (recordPacking) { 447 447 case PACKED: 448 s = "packed";448 uriHelper.append(PARAM_RECORD_PACKING, RECORD_PACKING_PACKED); 449 449 break; 450 450 case UNPACKED: 451 s = "unpacked";451 uriHelper.append(PARAM_RECORD_PACKING, RECORD_PACKING_UNPACKED); 452 452 break; 453 } 454 uriHelper.append(PARAM_RECORD_PACKING, s); 453 default: 454 throw new SRUClientException("internal error: invalid value " + 455 "for recordPacking (" + recordPacking + ")"); 456 } 455 457 } 456 458 -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUSimpleClient.java
r6903 r6912 98 98 * the configuration to be used for this client. 99 99 * @throws NullPointerException 100 * if argument <code>config</code> is < node>null</code>100 * if argument <code>config</code> is <code>null</code> 101 101 * @throws IllegalArgumentException 102 102 * if an error occurred while registering record data parsers -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUThreadedClient.java
r5750 r6912 34 34 * <p> 35 35 * This client is reusable and thread-safe: the application may reuse a 36 * client object and may shared it between multiple threads. <br /> 36 * client object and may shared it between multiple threads. 37 * </p> 38 * <p> 37 39 * NB: The registered {@link SRURecordDataParser} need to be thread-safe 38 40 * </p> … … 53 55 * the configuration to be used for this client. 54 56 * @throws NullPointerException 55 * if argument <code>config</code> is < node>null</code>57 * if argument <code>config</code> is <code>null</code> 56 58 * @throws IllegalArgumentException 57 59 * if an error occurred while registering record data parsers -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/fcs/ClarinFCSClientBuilder.java
r5804 r6912 50 50 /** 51 51 * Constructor. 52 * 53 * @param unknownAsDom 54 * if <code>true</code> unknown data views are parsed into a DOM 55 * 52 56 */ 53 57 public ClarinFCSClientBuilder(boolean unknownAsDom) { -
SRUClient/trunk/src/test/java/eu/clarin/sru/client/TestUtils.java
r6903 r6912 62 62 } 63 63 SRUSearchRetrieveRequest request = new SRUSearchRetrieveRequest(baseURI); 64 request.setQuery( query);64 request.setQuery(SRUClientConstants.QUERY_TYPE_CQL, query); 65 65 // request.setRecordSchema(ClarinFCSRecordData.LEGACY_RECORD_SCHEMA); 66 66 request.setMaximumRecords(5);
Note: See TracChangeset
for help on using the changeset viewer.