Project

General

Profile

1
package eu.dnetlib.msro.workflows.nodes.blackboard;
2

    
3
import javax.annotation.Resource;
4
import javax.xml.ws.Endpoint;
5
import javax.xml.ws.wsaddressing.W3CEndpointReference;
6

    
7
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
8
import eu.dnetlib.rmi.enabling.ISSNException;
9
import eu.dnetlib.rmi.enabling.ISSNService;
10
import eu.dnetlib.soap.EndpointReferenceBuilder;
11
import org.apache.commons.logging.Log;
12
import org.apache.commons.logging.LogFactory;
13
import org.springframework.beans.factory.annotation.Autowired;
14
import org.springframework.beans.factory.annotation.Required;
15

    
16
public class BlackboardSubscriber {
17

    
18
	/**
19
	 * Logger.
20
	 */
21
	private static final Log log = LogFactory.getLog(BlackboardSubscriber.class); // NOPMD by marko on 11/24/08 5:02 PM
22

    
23
	/**
24
	 * service locator.
25
	 */
26
	@Autowired
27
	private UniqueServiceLocator serviceLocator;
28

    
29
	/**
30
	 * injected EPR builder.
31
	 */
32
	@Resource(name = "jaxwsEndpointReferenceBuilder")
33
	private EndpointReferenceBuilder<Endpoint> eprBuilder;
34

    
35
	/**
36
	 * notification endpoint (normally the msro service).
37
	 */
38
	private Endpoint endpoint;
39

    
40
	/**
41
	 * performs the subscription.
42
	 *
43
	 * @throws ISSNException
44
	 *             could happen
45
	 */
46
	public void subscribeAll() throws ISSNException {
47
		log.info("Subscribing msro service");
48

    
49
		final W3CEndpointReference endpointReference = this.eprBuilder.getEndpointReference(getEndpoint());
50
		this.serviceLocator.getService(ISSNService.class).subscribe(endpointReference, "UPDATE/*/*/RESOURCE_PROFILE/BODY/BLACKBOARD/LAST_RESPONSE", 0);
51
	}
52

    
53
	public Endpoint getEndpoint() {
54
		return this.endpoint;
55
	}
56

    
57
	@Required
58
	public void setEndpoint(final Endpoint endpoint) {
59
		this.endpoint = endpoint;
60
	}
61
}
(1-1/2)