Project

General

Profile

1
package eu.dnetlib.msro;
2

    
3
import org.apache.cxf.interceptor.LoggingInInterceptor;
4
import org.apache.cxf.interceptor.LoggingOutInterceptor;
5
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
6
import org.springframework.context.annotation.Bean;
7
import org.springframework.context.annotation.Configuration;
8
import org.springframework.context.annotation.ImportResource;
9
import org.springframework.context.annotation.PropertySource;
10
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
11
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
12

    
13
import eu.dnetlib.rmi.enabling.ISLookUpService;
14

    
15
@Configuration
16
@PropertySource("classpath:/eu/dnetlib/dnet-simple-aggregation-worker.properties")
17
@ImportResource("classpath*:/eu/dnetlib/**/applicationContext-*.xml")
18
public class WorkerConfiguration {
19

    
20
	@Bean
21
	public ISLookUpService isLookUpService() {
22
		final JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
23
		factory.getInInterceptors().add(new LoggingInInterceptor());
24
		factory.getOutInterceptors().add(new LoggingOutInterceptor());
25
		factory.setServiceClass(ISLookUpService.class);
26
		factory.setAddress("http://localhost:9000/helloWorld");
27
		return (ISLookUpService) factory.create();
28
	}
29

    
30
	@Bean
31
	public SpringBeanJobFactory jobSchedulerFactory() {
32
		return new SpringBeanJobFactory();
33
	}
34

    
35
	@Bean
36
	public SchedulerFactoryBean jobScheduler() {
37
		final SchedulerFactoryBean bean = new SchedulerFactoryBean();
38
		bean.setJobFactory(jobSchedulerFactory());
39
		return bean;
40
	}
41

    
42
}
(2-2/3)