1
|
package eu.dnetlib.clients.enabling.islookup.ws;
|
2
|
|
3
|
import java.util.ArrayList;
|
4
|
import java.util.List;
|
5
|
|
6
|
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
7
|
|
8
|
import org.apache.log4j.Logger;
|
9
|
|
10
|
import eu.dnetlib.api.enabling.ISLookUpService;
|
11
|
import eu.dnetlib.api.enabling.ISLookUpServiceException;
|
12
|
import eu.dnetlib.domain.EPR;
|
13
|
import eu.dnetlib.domain.ServiceIdentity;
|
14
|
import eu.dnetlib.domain.enabling.Notification;
|
15
|
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
|
16
|
import eu.dnetlib.utils.EPRUtils;
|
17
|
|
18
|
public class ISLookUpClient implements ISLookUpService {
|
19
|
private static Logger logger = Logger.getLogger(ISLookUpClient.class);
|
20
|
|
21
|
private eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService isLookUp = null;
|
22
|
|
23
|
public void setIsLookUp(
|
24
|
eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService isLookUp) {
|
25
|
this.isLookUp = isLookUp;
|
26
|
}
|
27
|
|
28
|
public void setWebService(Object webService) {
|
29
|
this.isLookUp = (eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService) webService;
|
30
|
}
|
31
|
|
32
|
public List<String> quickSearchProfile(String XQuery)
|
33
|
throws ISLookUpServiceException {
|
34
|
try {
|
35
|
List<String> list = isLookUp.quickSearchProfile(XQuery);
|
36
|
|
37
|
if (list != null)
|
38
|
return list;
|
39
|
else
|
40
|
return new ArrayList<String>();
|
41
|
|
42
|
} catch (ISLookUpException e) {
|
43
|
throw new ISLookUpServiceException(e);
|
44
|
} catch (Exception e) {
|
45
|
logger.error(e);
|
46
|
|
47
|
throw new ISLookUpServiceException("Error performing quick search");
|
48
|
}
|
49
|
}
|
50
|
|
51
|
public String getResourceProfile(String profId)
|
52
|
throws ISLookUpServiceException {
|
53
|
try {
|
54
|
return isLookUp.getResourceProfile(profId);
|
55
|
} catch (ISLookUpException e) {
|
56
|
throw new ISLookUpServiceException(e);
|
57
|
} catch (Exception e) {
|
58
|
logger.error(e);
|
59
|
|
60
|
throw new ISLookUpServiceException("Error getting profile by id");
|
61
|
}
|
62
|
}
|
63
|
|
64
|
public String getResourceProfileByQuery(String XQuery)
|
65
|
throws ISLookUpServiceException {
|
66
|
try {
|
67
|
return isLookUp.getResourceProfileByQuery(XQuery);
|
68
|
} catch (ISLookUpException e) {
|
69
|
throw new ISLookUpServiceException(e);
|
70
|
} catch (Exception e) {
|
71
|
logger.error(e);
|
72
|
|
73
|
throw new ISLookUpServiceException("Error getting profile by query");
|
74
|
}
|
75
|
}
|
76
|
|
77
|
public String getResourceTypeSchema(String resourceType)
|
78
|
throws ISLookUpServiceException {
|
79
|
try {
|
80
|
return isLookUp.getResourceTypeSchema(resourceType);
|
81
|
} catch (ISLookUpException e) {
|
82
|
throw new ISLookUpServiceException(e);
|
83
|
} catch (Exception e) {
|
84
|
logger.error(e);
|
85
|
|
86
|
throw new ISLookUpServiceException("Error getting schema");
|
87
|
}
|
88
|
}
|
89
|
|
90
|
public List<String> listResourceTypes() throws ISLookUpServiceException {
|
91
|
try {
|
92
|
return isLookUp.listResourceTypes();
|
93
|
} catch (ISLookUpException e) {
|
94
|
throw new ISLookUpServiceException(e);
|
95
|
} catch (Exception e) {
|
96
|
logger.error(e);
|
97
|
|
98
|
throw new ISLookUpServiceException("Error getting resource types");
|
99
|
}
|
100
|
}
|
101
|
|
102
|
public ServiceIdentity identify() {
|
103
|
// TODO coooooodeee
|
104
|
return null;
|
105
|
// return isLookUp.identify();
|
106
|
}
|
107
|
|
108
|
@Override
|
109
|
public void notify(Notification notification) {
|
110
|
// TODO Auto-generated method stub
|
111
|
throw new UnsupportedOperationException();
|
112
|
}
|
113
|
}
|