Project

General

Profile

1
package eu.dnetlib.clients;
2

    
3
import javax.annotation.PostConstruct;
4

    
5
import eu.dnetlib.enabling.annotations.DnetServiceClient;
6
import eu.dnetlib.enabling.annotations.DnetServiceType;
7
import eu.dnetlib.exceptions.DnetGenericException;
8
import eu.dnetlib.services.ServiceRunningInstance;
9

    
10
public abstract class BaseServiceClient {
11

    
12
	private DnetServiceType serviceType;
13

    
14
	private ServiceRunningInstance instance;
15

    
16
	@PostConstruct
17
	public void init() throws DnetGenericException {
18
		if (getClass().isAnnotationPresent(DnetServiceClient.class)) {
19
			setServiceType(getClass().getAnnotation(DnetServiceClient.class).value());
20
		} else {
21
			throw new DnetGenericException("A required annotation is missing (@DnetServiceClient) in class " + getClass());
22
		}
23
	}
24

    
25
	public DnetServiceType getServiceType() {
26
		return serviceType;
27
	}
28

    
29
	public void setServiceType(final DnetServiceType serviceType) {
30
		this.serviceType = serviceType;
31
	}
32

    
33
	public ServiceRunningInstance getInstance() {
34
		return instance;
35
	}
36

    
37
	public void setInstance(final ServiceRunningInstance instance) {
38
		this.instance = instance;
39
	}
40
}
(1-1/3)