1
|
package eu.dnetlib.dhp.wf.importer.facade;
|
2
|
|
3
|
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
4
|
|
5
|
import eu.dnetlib.data.mdstore.MDStoreService;
|
6
|
import eu.dnetlib.data.mdstore.MDStoreServiceException;
|
7
|
import eu.dnetlib.enabling.resultset.client.ResultSetClientFactory;
|
8
|
import eu.dnetlib.enabling.tools.JaxwsServiceResolverImpl;
|
9
|
|
10
|
/**
|
11
|
* WebService based MDStore facade.
|
12
|
*
|
13
|
* @author mhorst
|
14
|
*
|
15
|
*/
|
16
|
public class WebServiceMDStoreFacade extends AbstractResultSetAwareWebServiceFacade<MDStoreService> implements MDStoreFacade {
|
17
|
|
18
|
|
19
|
//------------------------ CONSTRUCTORS -------------------
|
20
|
|
21
|
/**
|
22
|
* @param serviceLocation MDStore webservice location
|
23
|
* @param serviceReadTimeout service read timeout
|
24
|
* @param serviceConnectionTimeout service connection timeout
|
25
|
* @param resultSetReadTimeout resultset read timeout
|
26
|
* @param resultSetConnectionTimeout result set connection timeout
|
27
|
* @param resultSetPageSize resultset page size
|
28
|
*/
|
29
|
public WebServiceMDStoreFacade(String serviceLocation,
|
30
|
long serviceReadTimeout, long serviceConnectionTimeout,
|
31
|
long resultSetReadTimeout, long resultSetConnectionTimeout, int resultSetPageSize) {
|
32
|
super(MDStoreService.class, serviceLocation,
|
33
|
serviceReadTimeout, serviceConnectionTimeout,
|
34
|
resultSetReadTimeout, resultSetConnectionTimeout, resultSetPageSize);
|
35
|
}
|
36
|
|
37
|
//------------------------ LOGIC --------------------------
|
38
|
|
39
|
@Override
|
40
|
public Iterable<String> deliverMDRecords(String mdStoreId) throws ServiceFacadeException {
|
41
|
try {
|
42
|
W3CEndpointReference eprResult = getService().deliverMDRecords(mdStoreId, null, null, null);
|
43
|
ResultSetClientFactory rsFactory = new ResultSetClientFactory(
|
44
|
getResultSetPageSize(), getResultSetReadTimeout(), getResultSetConnectionTimeout());
|
45
|
rsFactory.setServiceResolver(new JaxwsServiceResolverImpl());
|
46
|
return rsFactory.getClient(eprResult);
|
47
|
} catch (MDStoreServiceException e) {
|
48
|
throw new ServiceFacadeException("delivering records for md store " + mdStoreId + " failed!", e);
|
49
|
}
|
50
|
}
|
51
|
|
52
|
}
|