- Timestamp:
- 11/12/14 14:33:09 (10 years ago)
- Location:
- SRUClient/trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUAbstractRequest.java
r5750 r5804 392 392 /** 393 393 * <em>Note: this method is not a part of public API.</em> 394 * @return a constant for this394 * @return a operation constant for this request 395 395 */ 396 396 abstract SRUOperation getOperation(); … … 400 400 throws SRUClientException; 401 401 402 } // class AbstractSRURequest402 } // class SRUAbstractRequest -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUClient.java
r5797 r5804 434 434 */ 435 435 throw new SRUClientException( 436 "internal error; 'records' arenull or empty");436 "internal error; 'records' is null or empty"); 437 437 } 438 438 } … … 451 451 SRUClient.this.timeParsing = millisProcessing; 452 452 } 453 454 453 } // inner class Handler 455 454 -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUGenericExtraResponseData.java
r5797 r5804 32 32 33 33 34 /** 35 * Constructor. 36 * 37 * @param name 38 * the root element of this extra response data fragment 39 * @param fragment 40 * the extra response data fragment as {@link DocumentFragment} 41 */ 34 42 SRUGenericExtraResponseData(QName name, DocumentFragment fragment) { 35 43 if (name == null) { -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/fcs/ClarinFCSClientBuilder.java
r5798 r5804 235 235 236 236 /** 237 * Register a Data Viewparser.237 * Register an extra response data parser. 238 238 * 239 239 * @param parser … … 241 241 * @return this {@link ClarinFCSClientBuilder} instance 242 242 * @throws IllegalArgumentException 243 * if an error occurred while registering the data view parser 243 * if an error occurred while registering the extra response 244 * data parser 244 245 * @see SRUExtraResponseDataParser 245 246 */ 246 public ClarinFCSClientBuilder registerExtraResponseDatar(SRUExtraResponseDataParser parser) { 247 public ClarinFCSClientBuilder registerExtraResponseDataParser( 248 SRUExtraResponseDataParser parser) { 247 249 if (parser == null) { 248 250 throw new NullPointerException("parser == null"); -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/fcs/ClarinFCSEndpointDescription.java
r5798 r5804 52 52 53 53 54 /** 55 * Get the version of this endpoint description. 56 * 57 * @return the version of the endpoint description 58 */ 54 59 public int getVersion() { 55 60 return version; … … 57 62 58 63 64 /** 65 * Get the list of capabilities supported by this endpoint. The list 66 * contains the appropriate URIs defined by the CLARIN-FCS specification to 67 * indicate support for certain capabilities. 68 * 69 * @return the list of capabilities supported by this endpoint 70 */ 59 71 public List<URI> getCapabilities() { 60 72 return capabilites; … … 62 74 63 75 76 /** 77 * Get the list of data views supported by this endpoint. 78 * 79 * @return the list of data views supported by this endpoint 80 */ 64 81 public List<DataView> getSupportedDataViews() { 65 82 return supportedDataViews; … … 67 84 68 85 86 /** 87 * Get the list of top-level resources of this endpoint. 88 * 89 * @return the list of top-level resources of this endpoint 90 */ 69 91 public List<ResourceInfo> getResources() { 70 92 return resources; … … 72 94 73 95 74 public static class DataView implements Serializable { 96 /** 97 * This class implements a description of a data view supported by the endpoint. 98 */ 99 public static final class DataView implements Serializable { 75 100 private static final long serialVersionUID = -5628565233032672627L; 76 101 … … 94 119 95 120 121 /** 122 * Constructor. <em>Internal use only!</em> 123 */ 96 124 DataView(String identifier, String mimeType, 97 125 DeliveryPolicy deliveryPolicy) { … … 164 192 165 193 166 public static class ResourceInfo implements Serializable { 194 /** 195 * This class implements a description of a resource available at an 196 * endpoint. 197 */ 198 public static final class ResourceInfo implements Serializable { 167 199 private static final long serialVersionUID = 1046130188435071544L; 168 200 private final String pid; … … 175 207 176 208 209 /** 210 * Constructor. <em>Internal use only!</em> 211 */ 177 212 ResourceInfo(String pid, Map<String, String> title, 178 213 Map<String, String> description, String landingPageURI, … … 311 346 312 347 /** 348 * Check, if this resource supports a certain language. 349 * 350 * @param language 351 * a language encoded as a ISO-632-3 three letter language 352 * code 353 * @return <code>true</code> if the language is supported by this 354 * resource, <code>false</code> otherwise 355 */ 356 public boolean supportsLanguage(String language) { 357 if (language == null) { 358 throw new NullPointerException("language == null"); 359 } 360 for (String l : languages) { 361 if (language.equals(l)) { 362 return true; 363 } 364 } 365 return false; 366 } 367 368 369 /** 313 370 * Get the direct sub-ordinate resources of this resource. 314 371 * 315 * @return a list of resources or <code>null</code> if this resource has no316 * sub-ordinate resources372 * @return a list of resources or <code>null</code> if this resource has 373 * no sub-ordinate resources 317 374 */ 318 375 public List<ResourceInfo> getSubResources() { -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/fcs/ClarinFCSEndpointDescriptionParser.java
r5798 r5804 46 46 public class ClarinFCSEndpointDescriptionParser implements 47 47 SRUExtraResponseDataParser { 48 /** 49 * constant for infinite resource enumeration parsing depth 50 */ 48 51 public static final int INFINITE_MAX_DEPTH = -1; 52 /** 53 * constant for default parsing resource enumeration parsing depth 54 */ 49 55 public static final int DEFAULT_MAX_DEPTH = INFINITE_MAX_DEPTH; 50 56 private static final Logger logger = … … 64 70 65 71 72 /** 73 * Constructor. By default, the parser will parse the endpoint resource 74 * enumeration to an infinite depth. 75 */ 66 76 public ClarinFCSEndpointDescriptionParser() { 67 77 this(DEFAULT_MAX_DEPTH); … … 69 79 70 80 81 /** 82 * Constructor. 83 * 84 * @param maxDepth 85 * maximum depth for parsing the endpoint resource enumeration. 86 * @throws IllegalArgumentException 87 * if an argument is illegal 88 */ 71 89 public ClarinFCSEndpointDescriptionParser(int maxDepth) { 72 90 if (maxDepth < -1) { … … 187 205 // Resources 188 206 final List<ResourceInfo> resources = 189 parseResources(reader, 0, supportedDataViews);207 parseResources(reader, 0, maxDepth, supportedDataViews); 190 208 191 209 // skip over extensions … … 208 226 209 227 210 private List<ResourceInfo> parseResources(XMLStreamReader reader, int depth, 211 List<DataView> supportedDataviews) throws XMLStreamException { 228 /** 229 * Get the maximum resource enumeration parsing depth. The first level is 230 * indicate by the value <code>0</code>. 231 * 232 * @return the default resource parsing depth or <code>-1</code> for 233 * infinite. 234 */ 235 public int getMaximumResourcePArsingDepth() { 236 return maxDepth; 237 } 238 239 240 private static List<ResourceInfo> parseResources(XMLStreamReader reader, 241 int depth, int maxDepth, List<DataView> supportedDataviews) 242 throws XMLStreamException { 212 243 List<ResourceInfo> resources = null; 213 244 … … 285 316 286 317 List<ResourceInfo> subResources = null; 287 if (XmlStreamReaderUtils.peekStart(reader, ED_NS_URI, "Resources")) { 318 if (XmlStreamReaderUtils.peekStart(reader, 319 ED_NS_URI, "Resources")) { 288 320 final int nextDepth = depth + 1; 289 if ((maxDepth == INFINITE_MAX_DEPTH) || (nextDepth < maxDepth)) { 321 if ((maxDepth == INFINITE_MAX_DEPTH) || 322 (nextDepth < maxDepth)) { 290 323 subResources = parseResources(reader, nextDepth, 291 supportedDataviews);324 maxDepth, supportedDataviews); 292 325 } else { 293 326 XmlStreamReaderUtils.skipTag(reader, ED_NS_URI, -
SRUClient/trunk/src/test/java/eu/clarin/sru/client/TestClient.java
r5799 r5804 37 37 .unknownDataViewAsString() 38 38 .enableLegacySupport() 39 .registerExtraResponseData r(39 .registerExtraResponseDataParser( 40 40 new ClarinFCSEndpointDescriptionParser()) 41 41 .buildClient(); -
SRUClient/trunk/src/test/java/eu/clarin/sru/client/TestThreadedClient.java
r5750 r5804 24 24 25 25 import eu.clarin.sru.client.fcs.ClarinFCSClientBuilder; 26 import eu.clarin.sru.client.fcs.ClarinFCSEndpointDescriptionParser; 26 27 27 28 @Deprecated … … 36 37 SRUThreadedClient client = new ClarinFCSClientBuilder() 37 38 .addDefaultDataViewParsers() 39 .unknownDataViewAsString() 40 .enableLegacySupport() 41 .registerExtraResponseDataParser( 42 new ClarinFCSEndpointDescriptionParser()) 38 43 .buildThreadedClient(); 39 44 -
SRUClient/trunk/src/test/java/eu/clarin/sru/client/TestThreadedClientCallback.java
r5750 r5804 23 23 24 24 import eu.clarin.sru.client.fcs.ClarinFCSClientBuilder; 25 import eu.clarin.sru.client.fcs.ClarinFCSEndpointDescriptionParser; 25 26 26 27 … … 35 36 SRUThreadedClient client = new ClarinFCSClientBuilder() 36 37 .addDefaultDataViewParsers() 38 .unknownDataViewAsString() 39 .enableLegacySupport() 40 .registerExtraResponseDataParser( 41 new ClarinFCSEndpointDescriptionParser()) 37 42 .buildThreadedClient(); 38 43
Note: See TracChangeset
for help on using the changeset viewer.