Revision 42184
Added by Michele Artini about 8 years ago
OAIStoreServiceImpl.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.oai; |
2 | 2 |
|
3 | 3 |
import javax.annotation.Resource; |
4 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
|
5 | 4 |
|
6 |
import eu.dnetlib.data.information.oai.publisher.info.MDFInfo; |
|
7 |
import eu.dnetlib.data.oai.store.conf.OAISetHelper; |
|
8 |
import eu.dnetlib.data.oai.store.conf.OAISetsCounter; |
|
9 |
import eu.dnetlib.data.oai.store.mongo.MongoPublisherStore; |
|
10 |
import eu.dnetlib.data.oai.store.mongo.MongoPublisherStoreDAO; |
|
11 |
import eu.dnetlib.data.oai.store.sync.OAIStoreSynchronizer; |
|
12 |
import eu.dnetlib.enabling.resultset.client.IterableResultSetClient; |
|
13 |
import eu.dnetlib.enabling.resultset.client.ResultSetClientFactory; |
|
14 |
import eu.dnetlib.enabling.tools.AbstractBaseService; |
|
15 |
import eu.dnetlib.enabling.tools.blackboard.NotificationHandler; |
|
16 | 5 |
import org.springframework.beans.factory.annotation.Autowired; |
17 | 6 |
import org.springframework.beans.factory.annotation.Required; |
18 | 7 |
|
8 |
import eu.dnetlib.enabling.resultset.client.ResultSetClient; |
|
9 |
import eu.dnetlib.enabling.tools.AbstractBaseService; |
|
10 |
import eu.dnetlib.enabling.tools.blackboard.NotificationHandler; |
|
11 |
import eu.dnetlib.oai.conf.OAISetHelper; |
|
12 |
import eu.dnetlib.oai.conf.OAISetsCounter; |
|
13 |
import eu.dnetlib.oai.mongo.MongoPublisherStore; |
|
14 |
import eu.dnetlib.oai.mongo.MongoPublisherStoreDAO; |
|
15 |
import eu.dnetlib.oai.sync.OAIStoreSynchronizer; |
|
16 |
import eu.dnetlib.rmi.common.ResultSet; |
|
17 |
import eu.dnetlib.rmi.provision.MDFInfo; |
|
18 |
import eu.dnetlib.rmi.provision.OAIStoreService; |
|
19 |
|
|
19 | 20 |
public class OAIStoreServiceImpl extends AbstractBaseService implements OAIStoreService { |
20 | 21 |
|
21 | 22 |
/** |
... | ... | |
31 | 32 |
private OAISetsCounter setsCounter; |
32 | 33 |
@Autowired |
33 | 34 |
private OAISetHelper oaiSetHelper; |
35 |
@Autowired |
|
36 |
private ResultSetClient resultSetClient; |
|
34 | 37 |
|
35 |
@Resource |
|
36 |
private ResultSetClientFactory resultSetClientFactory; |
|
37 |
|
|
38 | 38 |
@Override |
39 |
public void feed(final W3CEndpointReference recordsEpr, final MDFInfo mdfInfo, final String dbName) {
|
|
39 |
public void feed(final ResultSet<String> recordsEpr, final MDFInfo mdfInfo, final String dbName) {
|
|
40 | 40 |
this.feed(recordsEpr, mdfInfo, "", dbName); |
41 | 41 |
} |
42 | 42 |
|
43 | 43 |
@Override |
44 |
public void feed(final W3CEndpointReference recordsEpr, final MDFInfo mdfInfo, final String recordSource, final String dbName) {
|
|
45 |
IterableResultSetClient rsClient = resultSetClientFactory.getClient(recordsEpr);
|
|
46 |
this.synchronizer.synchronize(rsClient, mdfInfo, recordSource, dbName, false, null, null);
|
|
44 |
public void feed(final ResultSet<String> recordsEpr, final MDFInfo mdfInfo, final String recordSource, final String dbName) {
|
|
45 |
final Iterable<String> iter = this.resultSetClient.iter(recordsEpr, String.class);
|
|
46 |
this.synchronizer.synchronize(iter, mdfInfo, recordSource, dbName, false, null, null);
|
|
47 | 47 |
} |
48 | 48 |
|
49 | 49 |
@Override |
... | ... | |
58 | 58 |
|
59 | 59 |
@Override |
60 | 60 |
public void refreshConfiguration(final String dbName) { |
61 |
oaiSetHelper.loadConfiguration(dbName); |
|
61 |
this.oaiSetHelper.loadConfiguration(dbName);
|
|
62 | 62 |
} |
63 | 63 |
|
64 | 64 |
@Override |
... | ... | |
68 | 68 |
|
69 | 69 |
@Override |
70 | 70 |
public void ensureIndexes(final MDFInfo mdfInfo, final String dbName) { |
71 |
MongoPublisherStore s = this.mongoPublisherStoreDAO.getStore(mdfInfo.getSourceFormatName(), mdfInfo.getSourceFormatInterpretation(), |
|
71 |
final MongoPublisherStore s = this.mongoPublisherStoreDAO.getStore(mdfInfo.getSourceFormatName(), mdfInfo.getSourceFormatInterpretation(),
|
|
72 | 72 |
mdfInfo.getSourceFormatLayout(), dbName); |
73 | 73 |
s.ensureIndices(); |
74 | 74 |
} |
... | ... | |
79 | 79 |
} |
80 | 80 |
|
81 | 81 |
public NotificationHandler getNotificationHandler() { |
82 |
return notificationHandler; |
|
82 |
return this.notificationHandler;
|
|
83 | 83 |
} |
84 | 84 |
|
85 | 85 |
@Required |
... | ... | |
88 | 88 |
} |
89 | 89 |
|
90 | 90 |
public OAIStoreSynchronizer getSynchronizer() { |
91 |
return synchronizer; |
|
91 |
return this.synchronizer;
|
|
92 | 92 |
} |
93 | 93 |
|
94 | 94 |
public void setSynchronizer(final OAIStoreSynchronizer synchronizer) { |
... | ... | |
96 | 96 |
} |
97 | 97 |
|
98 | 98 |
public OAISetsCounter getSetsCounter() { |
99 |
return setsCounter; |
|
99 |
return this.setsCounter;
|
|
100 | 100 |
} |
101 | 101 |
|
102 | 102 |
public void setSetsCounter(final OAISetsCounter setsCounter) { |
... | ... | |
104 | 104 |
} |
105 | 105 |
|
106 | 106 |
public OAISetHelper getOaiSetHelper() { |
107 |
return oaiSetHelper; |
|
107 |
return this.oaiSetHelper;
|
|
108 | 108 |
} |
109 | 109 |
|
110 | 110 |
public void setOaiSetHelper(final OAISetHelper oaiSetHelper) { |
... | ... | |
112 | 112 |
} |
113 | 113 |
|
114 | 114 |
public MongoPublisherStoreDAO getMongoPublisherStoreDAO() { |
115 |
return mongoPublisherStoreDAO; |
|
115 |
return this.mongoPublisherStoreDAO;
|
|
116 | 116 |
} |
117 | 117 |
|
118 | 118 |
public void setMongoPublisherStoreDAO(final MongoPublisherStoreDAO mongoPublisherStoreDAO) { |
119 | 119 |
this.mongoPublisherStoreDAO = mongoPublisherStoreDAO; |
120 | 120 |
} |
121 | 121 |
|
122 |
public ResultSetClientFactory getResultSetClientFactory() { |
|
123 |
return resultSetClientFactory; |
|
124 |
} |
|
125 |
|
|
126 |
public void setResultSetClientFactory(final ResultSetClientFactory resultSetClientFactory) { |
|
127 |
this.resultSetClientFactory = resultSetClientFactory; |
|
128 |
} |
|
129 |
|
|
130 | 122 |
} |
Also available in: Unified diff
oai import