1
|
package eu.dnetlib.dhp.wf.importer.facade;
|
2
|
|
3
|
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
4
|
|
5
|
import eu.dnetlib.data.objectstore.rmi.ObjectStoreService;
|
6
|
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
|
7
|
import eu.dnetlib.enabling.resultset.client.ResultSetClientFactory;
|
8
|
import eu.dnetlib.enabling.tools.JaxwsServiceResolverImpl;
|
9
|
|
10
|
/**
|
11
|
* WebService based ObjectStore facade.
|
12
|
*
|
13
|
* @author mhorst
|
14
|
*
|
15
|
*/
|
16
|
public class WebServiceObjectStoreFacade extends AbstractResultSetAwareWebServiceFacade<ObjectStoreService> implements ObjectStoreFacade {
|
17
|
|
18
|
|
19
|
//------------------------ CONSTRUCTORS -------------------
|
20
|
|
21
|
/**
|
22
|
* @param serviceLocation ObjectStore 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 WebServiceObjectStoreFacade(String serviceLocation,
|
30
|
long serviceReadTimeout, long serviceConnectionTimeout,
|
31
|
long resultSetReadTimeout, long resultSetConnectionTimeout, int resultSetPageSize) {
|
32
|
super(ObjectStoreService.class, serviceLocation,
|
33
|
serviceReadTimeout, serviceConnectionTimeout,
|
34
|
resultSetReadTimeout, resultSetConnectionTimeout, resultSetPageSize);
|
35
|
}
|
36
|
|
37
|
//------------------------ LOGIC --------------------------
|
38
|
|
39
|
@Override
|
40
|
public Iterable<String> deliverObjects(String objectStoreId, long from, long until) throws ServiceFacadeException {
|
41
|
try {
|
42
|
W3CEndpointReference eprResult = getService().deliverObjects(objectStoreId, from, until);
|
43
|
ResultSetClientFactory rsFactory = new ResultSetClientFactory(
|
44
|
getResultSetPageSize(), getResultSetReadTimeout(), getResultSetConnectionTimeout());
|
45
|
rsFactory.setServiceResolver(new JaxwsServiceResolverImpl());
|
46
|
return rsFactory.getClient(eprResult);
|
47
|
} catch (ObjectStoreServiceException e) {
|
48
|
throw new ServiceFacadeException("delivering records for object store " + objectStoreId + " failed!", e);
|
49
|
}
|
50
|
}
|
51
|
|
52
|
}
|