1
|
package eu.dnetlib.index;
|
2
|
|
3
|
import java.util.List;
|
4
|
|
5
|
import eu.dnetlib.clients.index.utils.ServiceTools;
|
6
|
import eu.dnetlib.enabling.tools.AbstractBaseService;
|
7
|
import eu.dnetlib.enabling.tools.blackboard.NotificationHandler;
|
8
|
import eu.dnetlib.rmi.provision.IndexService;
|
9
|
import eu.dnetlib.rmi.provision.IndexServiceException;
|
10
|
import org.apache.commons.logging.Log;
|
11
|
import org.apache.commons.logging.LogFactory;
|
12
|
import org.springframework.beans.factory.annotation.Autowired;
|
13
|
import org.springframework.beans.factory.annotation.Required;
|
14
|
|
15
|
/**
|
16
|
* The Class IndexModularService.
|
17
|
*/
|
18
|
public class IndexModularService extends AbstractBaseService implements IndexService {
|
19
|
|
20
|
/**
|
21
|
* The Constant log.
|
22
|
*/
|
23
|
private static final Log log = LogFactory.getLog(IndexService.class);
|
24
|
|
25
|
/**
|
26
|
* The notification handler.
|
27
|
*/
|
28
|
private NotificationHandler notificationHandler;
|
29
|
|
30
|
/**
|
31
|
* The service tools.
|
32
|
*/
|
33
|
@Autowired
|
34
|
private ServiceTools serviceTools;
|
35
|
|
36
|
/**
|
37
|
* {@inheritDoc}
|
38
|
*/
|
39
|
@Override
|
40
|
public void notify(final String subscriptionId, final String topic, final String isId, final String message) {
|
41
|
log.debug("Notify method is called");
|
42
|
getNotificationHandler().notified(subscriptionId, topic, isId, message);
|
43
|
|
44
|
}
|
45
|
|
46
|
/**
|
47
|
* {@inheritDoc}
|
48
|
*/
|
49
|
@Override
|
50
|
public String identify() {
|
51
|
log.debug("Identify method is called");
|
52
|
return this.getClass().toString();
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* {@inheritDoc}
|
57
|
*
|
58
|
* @throws IndexServiceException
|
59
|
*/
|
60
|
@Override
|
61
|
public List<String> getListOfIndices() throws IndexServiceException {
|
62
|
|
63
|
return serviceTools.listDsIds();
|
64
|
}
|
65
|
|
66
|
/**
|
67
|
* Gets the notification handler.
|
68
|
*
|
69
|
* @return the notificationHandler
|
70
|
*/
|
71
|
public NotificationHandler getNotificationHandler() {
|
72
|
return notificationHandler;
|
73
|
}
|
74
|
|
75
|
/**
|
76
|
* Sets the notification handler.
|
77
|
*
|
78
|
* @param notificationHandler the notificationHandler to set
|
79
|
*/
|
80
|
@Required
|
81
|
public void setNotificationHandler(final NotificationHandler notificationHandler) {
|
82
|
this.notificationHandler = notificationHandler;
|
83
|
}
|
84
|
|
85
|
}
|