1
|
package eu.dnetlib.index.actors;
|
2
|
|
3
|
import javax.annotation.Resource;
|
4
|
|
5
|
import akka.actor.ActorSystem;
|
6
|
import akka.actor.TypedActor;
|
7
|
import akka.actor.TypedProps;
|
8
|
import akka.japi.Creator;
|
9
|
import eu.dnetlib.clients.index.utils.ServiceTools;
|
10
|
import eu.dnetlib.index.IndexServerDAOMap;
|
11
|
import eu.dnetlib.index.cql.CqlTranslator;
|
12
|
import eu.dnetlib.miscutils.factory.Factory;
|
13
|
import org.springframework.beans.factory.annotation.Required;
|
14
|
|
15
|
// TODO: Auto-generated Javadoc
|
16
|
// TODO springify actor parameter with a prototype bean
|
17
|
|
18
|
/**
|
19
|
* A factory for creating IndexFeedActor objects.
|
20
|
*/
|
21
|
public class IndexFeedActorFactory implements Factory<IndexFeedActor> {
|
22
|
|
23
|
/**
|
24
|
* The index server dao map.
|
25
|
*/
|
26
|
private IndexServerDAOMap indexServerDAOMap;
|
27
|
|
28
|
/**
|
29
|
* The service tools.
|
30
|
*/
|
31
|
private ServiceTools serviceTools;
|
32
|
|
33
|
/**
|
34
|
* The actor system.
|
35
|
*/
|
36
|
private ActorSystem actorSystem;
|
37
|
|
38
|
/**
|
39
|
* CqlTranslator.
|
40
|
*/
|
41
|
@Resource
|
42
|
private CqlTranslator translator;
|
43
|
|
44
|
/**
|
45
|
* {@inheritDoc}
|
46
|
*
|
47
|
* @see Factory#newInstance()
|
48
|
*/
|
49
|
@Override
|
50
|
public IndexFeedActor newInstance() {
|
51
|
return TypedActor.get(getActorSystem()).typedActorOf(new TypedProps<>(IndexFeedActor.class, (Creator<IndexFeedActorImpl>) () ->
|
52
|
new IndexFeedActorImpl(getIndexServerDAOMap(), getServiceTools(), translator)));
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* Gets the service tools.
|
57
|
*
|
58
|
* @return the service tools
|
59
|
*/
|
60
|
public ServiceTools getServiceTools() {
|
61
|
return serviceTools;
|
62
|
}
|
63
|
|
64
|
/**
|
65
|
* Sets the service tools.
|
66
|
*
|
67
|
* @param serviceTools the new service tools
|
68
|
*/
|
69
|
@Required
|
70
|
public void setServiceTools(final ServiceTools serviceTools) {
|
71
|
this.serviceTools = serviceTools;
|
72
|
}
|
73
|
|
74
|
/**
|
75
|
* Gets the actor system.
|
76
|
*
|
77
|
* @return the actor system
|
78
|
*/
|
79
|
public ActorSystem getActorSystem() {
|
80
|
return actorSystem;
|
81
|
}
|
82
|
|
83
|
/**
|
84
|
* Sets the actor system.
|
85
|
*
|
86
|
* @param actorSystem the new actor system
|
87
|
*/
|
88
|
@Required
|
89
|
public void setActorSystem(final ActorSystem actorSystem) {
|
90
|
this.actorSystem = actorSystem;
|
91
|
}
|
92
|
|
93
|
/**
|
94
|
* Gets the index server dao map.
|
95
|
*
|
96
|
* @return the indexServerDAOMap
|
97
|
*/
|
98
|
public IndexServerDAOMap getIndexServerDAOMap() {
|
99
|
return indexServerDAOMap;
|
100
|
}
|
101
|
|
102
|
/**
|
103
|
* Sets the index server dao map.
|
104
|
*
|
105
|
* @param indexServerDAOMap the indexServerDAOMap to set
|
106
|
*/
|
107
|
@Required
|
108
|
public void setIndexServerDAOMap(final IndexServerDAOMap indexServerDAOMap) {
|
109
|
this.indexServerDAOMap = indexServerDAOMap;
|
110
|
}
|
111
|
|
112
|
}
|