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