Project

General

Profile

1
package eu.dnetlib.enabling.hcm.sn;
2

    
3
import java.util.List;
4
import javax.annotation.PostConstruct;
5

    
6
import eu.dnetlib.enabling.actions.SubscriptionAction;
7
import eu.dnetlib.enabling.hcm.HostingContextManagerServiceImpl;
8
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
9
import org.apache.commons.logging.Log;
10
import org.apache.commons.logging.LogFactory;
11
import org.springframework.beans.factory.annotation.Autowired;
12
import org.springframework.beans.factory.annotation.Required;
13

    
14
/**
15
 * This component takes care of subscribing the SubscriptionAction(s) to interesting events.
16
 *
17
 * @author claudio
18
 *
19
 */
20
public class HCMSubscriberImpl implements HCMSubscriber {
21

    
22
	/**
23
	 * logger.
24
	 */
25
	private static final Log log = LogFactory.getLog(HCMSubscriberImpl.class);
26

    
27
	/**
28
	 * service locator.
29
	 */
30
	@Autowired
31
	private UniqueServiceLocator serviceLocator;
32

    
33
	/**
34
	 * hcm
35
	 */
36
	private HostingContextManagerServiceImpl hcm;
37

    
38
	/**
39
	 * subscription actions.
40
	 */
41
	@Autowired(required = false)
42
	private List<SubscriptionAction> actions;
43

    
44
	@PostConstruct
45
	public void printList() {
46
		log.info(getActions());
47
	}
48

    
49
	@Override
50
	public void subscribeAll() throws SubscriptionException {
51
		// final String profileId = this.hcm.getProfileId();
52
		// if (getActions() != null) {
53
		// for (final SubscriptionAction action : getActions()) {
54
		// log.info("dynamically subscribing to " + action.getTopicExpression());
55
		// this.serviceLocator.getService(ISSNService.class).subscribe(profileId, action.getTopicExpression(), 0);
56
		// }
57
		// }
58
	}
59

    
60
	public List<SubscriptionAction> getActions() {
61
		return this.actions;
62
	}
63

    
64
	public void setActions(final List<SubscriptionAction> actions) {
65
		this.actions = actions;
66
	}
67

    
68
	public HostingContextManagerServiceImpl getHcm() {
69
		return this.hcm;
70
	}
71

    
72
	@Required
73
	public void setHcm(final HostingContextManagerServiceImpl hcm) {
74
		this.hcm = hcm;
75
	}
76

    
77
	public UniqueServiceLocator getServiceLocator() {
78
		return this.serviceLocator;
79
	}
80

    
81
	public void setServiceLocator(final UniqueServiceLocator serviceLocator) {
82
		this.serviceLocator = serviceLocator;
83
	}
84

    
85
}
(2-2/3)