1
|
package gr.uoa.di.driver.util;
|
2
|
|
3
|
import eu.dnetlib.api.DriverService;
|
4
|
|
5
|
/**
|
6
|
* An implementation of the ServiceLocator that returns a predefined instance
|
7
|
* of a service.
|
8
|
*
|
9
|
* Can be used for debug purposes, FallBackLocator or when 2 services A and B
|
10
|
* are deployed in the same application (in this case, service A will get an
|
11
|
* instance of a StaticServiceLocator<B> in order to avoid calls to the IS and
|
12
|
* traversing the whole SOAP stack in order to communicate with B).
|
13
|
*
|
14
|
* @author <a href="mailto:antleb@di.uoa.gr">Antonis Lempesis</a>
|
15
|
*
|
16
|
* @param <S>
|
17
|
*/
|
18
|
public class StaticServiceLocator<S extends DriverService>
|
19
|
implements ServiceLocator<S> {
|
20
|
|
21
|
private S service = null;
|
22
|
|
23
|
public StaticServiceLocator() {
|
24
|
|
25
|
}
|
26
|
|
27
|
public StaticServiceLocator(S service) {
|
28
|
this.service = service;
|
29
|
}
|
30
|
|
31
|
@Override
|
32
|
public S getService() {
|
33
|
return service;
|
34
|
}
|
35
|
|
36
|
public void setService(S service) {
|
37
|
this.service = service;
|
38
|
}
|
39
|
}
|