Revision c5e6fc74
Added by Andreas Kohlbecker over 8 years ago
src/main/java/org/bgbm/biovel/drf/checklist/Species2000ColClient.java | ||
---|---|---|
8 | 8 |
import java.net.URI; |
9 | 9 |
import java.util.EnumSet; |
10 | 10 |
import java.util.HashMap; |
11 |
import java.util.List; |
|
12 | 11 |
import java.util.Map; |
13 | 12 |
|
14 | 13 |
import javax.xml.bind.JAXBException; |
... | ... | |
27 | 26 |
import javax.xml.xpath.XPathFactory; |
28 | 27 |
|
29 | 28 |
import org.apache.http.HttpHost; |
30 |
import org.bgbm.biovel.drf.rest.ServiceProviderInfo;
|
|
31 |
import org.bgbm.biovel.drf.tnr.msg.TnrMsg;
|
|
29 |
import org.bgbm.biovel.drf.client.ServiceProviderInfo;
|
|
30 |
import org.bgbm.biovel.drf.query.RestClient;
|
|
32 | 31 |
import org.bgbm.biovel.drf.tnr.msg.Query; |
33 | 32 |
import org.bgbm.biovel.drf.tnr.msg.Response; |
33 |
import org.bgbm.biovel.drf.tnr.msg.TnrMsg; |
|
34 | 34 |
import org.bgbm.biovel.drf.utils.BiovelUtils; |
35 | 35 |
import org.bgbm.biovel.drf.utils.IdentifierUtils; |
36 | 36 |
import org.bgbm.biovel.drf.utils.TnrMsgUtils; |
... | ... | |
40 | 40 |
import org.xml.sax.SAXException; |
41 | 41 |
|
42 | 42 |
|
43 |
public class Species2000ColClient extends BaseChecklistClient { |
|
43 |
public class Species2000ColClient extends BaseChecklistClient<RestClient> {
|
|
44 | 44 |
|
45 |
/** |
|
46 |
* |
|
47 |
*/ |
|
48 |
private static final HttpHost HTTP_HOST = new HttpHost("www.catalogueoflife.org",80); |
|
45 | 49 |
public static final String ID = "species2000col"; |
46 | 50 |
public static final String LABEL = "Species2000 - Catalogue Of Life"; |
47 | 51 |
public static final String URL = "http://www.catalogueoflife.org"; |
... | ... | |
52 | 56 |
|
53 | 57 |
public Species2000ColClient() { |
54 | 58 |
super(); |
55 |
|
|
56 | 59 |
} |
57 | 60 |
|
61 |
/** |
|
62 |
* {@inheritDoc} |
|
63 |
*/ |
|
58 | 64 |
@Override |
59 |
public HttpHost getHost() { |
|
60 |
// TODO Auto-generated method stub |
|
61 |
return new HttpHost("www.catalogueoflife.org",80); |
|
62 |
} |
|
65 |
public void initQueryClient() { |
|
66 |
queryClient = new RestClient(HTTP_HOST); |
|
63 | 67 |
|
68 |
} |
|
64 | 69 |
|
65 | 70 |
@Override |
66 | 71 |
public ServiceProviderInfo buildServiceProviderInfo() { |
... | ... | |
81 | 86 |
|
82 | 87 |
paramMap.put("response", "full"); |
83 | 88 |
|
84 |
URI taxonUri = buildUriFromQuery(query, |
|
89 |
URI taxonUri = queryClient.buildUriFromQuery(query,
|
|
85 | 90 |
"/col/webservice", |
86 | 91 |
"name", |
87 | 92 |
paramMap); |
88 | 93 |
|
89 |
String responseBody = processRESTService(taxonUri); |
|
94 |
String responseBody = queryClient.processRESTService(taxonUri);
|
|
90 | 95 |
|
91 | 96 |
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
92 | 97 |
DocumentBuilder parser; |
... | ... | |
106 | 111 |
if(synTaxonIdNode != null) { |
107 | 112 |
String synTaxonId = synTaxonIdNode.getTextContent(); |
108 | 113 |
//http://www.catalogueoflife.org/col/webservice?response=full&id={sciId} |
109 |
taxonUri = buildUriFromQueryString(synTaxonId, |
|
114 |
taxonUri = queryClient.buildUriFromQueryString(synTaxonId,
|
|
110 | 115 |
"/col/webservice", |
111 | 116 |
"id", |
112 | 117 |
paramMap); |
113 | 118 |
|
114 |
responseBody = processRESTService(taxonUri); |
|
119 |
responseBody = queryClient.processRESTService(taxonUri);
|
|
115 | 120 |
} else { |
116 | 121 |
responseBody = null; |
117 | 122 |
} |
... | ... | |
221 | 226 |
} |
222 | 227 |
|
223 | 228 |
|
224 |
|
|
225 | 229 |
} |
226 | 230 |
|
227 | 231 |
|
Also available in: Unified diff
separating query protocol implementation from checklist clients