Project

General

Profile

« Previous | Next » 

Revision 40903

[maven-release-plugin] copy for tag dnet-modular-objectstore-service-4.0.3-TAG

View differences:

modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/deploy.info
1
{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-modular-objectstore-service/trunk/", "deploy_repository": "dnet4-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet4-snapshots", "name": "dnet-modular-objectstore-service"}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/FeedCompleteObjectAction.java
1
package eu.dnetlib.data.objectstore.modular;
2

  
3
import org.springframework.beans.factory.annotation.Required;
4

  
5
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
6
import eu.dnetlib.enabling.tools.blackboard.BlackboardServerAction;
7
import eu.dnetlib.enabling.tools.blackboard.BlackboardServerHandler;
8

  
9
// TODO: Auto-generated Javadoc
10
/**
11
 * The Class FeedCompleteObjectAction is responsible to execute the blacboard action of type FEED OBJECT which is Metadata created for WOS case of openaire.
12
 */
13
public class FeedCompleteObjectAction extends AbstractObjectStoreAction implements BlackboardServerAction<ObjectStoreActions> {
14

  
15
	/** The store feeder. */
16
	private ModularObjectStoreFeeder storeFeeder;
17

  
18
	/* (non-Javadoc)
19
	 * @see eu.dnetlib.enabling.tools.blackboard.BlackboardServerAction#execute(eu.dnetlib.enabling.tools.blackboard.BlackboardServerHandler, eu.dnetlib.enabling.tools.blackboard.BlackboardJob)
20
	 */
21
	@Override
22
	public void execute(final BlackboardServerHandler handler, final BlackboardJob job) throws Exception {
23
		final String objStoreID = job.getParameters().get("obsID");
24
		final String eprRs = job.getParameters().get("epr");
25
		final String mime = job.getParameters().get("mime");
26
		storeFeeder.feedMetadataObjectRecord(objStoreID, eprRs, mime);
27
		handler.done(job);
28
	}
29

  
30
	/**
31
	 * Gets the store feeder.
32
	 *
33
	 * @return the store feeder
34
	 */
35
	public ModularObjectStoreFeeder getStoreFeeder() {
36
		return storeFeeder;
37
	}
38

  
39
	/**
40
	 * Sets the store feeder.
41
	 *
42
	 * @param storeFeeder the new store feeder
43
	 */
44
	@Required
45
	public void setStoreFeeder(final ModularObjectStoreFeeder storeFeeder) {
46
		this.storeFeeder = storeFeeder;
47
	}
48

  
49
}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/ModularObjectStoreDeliver.java
1
package eu.dnetlib.data.objectstore.modular;
2

  
3
import java.io.InputStream;
4

  
5
import javax.annotation.Resource;
6
import javax.xml.ws.wsaddressing.W3CEndpointReference;
7

  
8
import org.springframework.beans.factory.annotation.Required;
9

  
10
import eu.dnetlib.data.objectstore.modular.connector.ObjectStoreDao;
11
import eu.dnetlib.data.objectstore.rmi.ObjectStoreFile;
12
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
13
import eu.dnetlib.enabling.resultset.ResultSetFactory;
14
import eu.dnetlib.enabling.resultset.client.ResultSetClientFactory;
15

  
16
/**
17
 * The Class ModularObjectStoreDeliver is responsible of delivering data from the object Store.
18
 */
19
public class ModularObjectStoreDeliver {
20

  
21
	/** The dao. */
22
	private ObjectStoreDao dao;
23

  
24
	/** The result set factory. */
25
	@Resource
26
	private ResultSetFactory resultSetFactory;
27

  
28
	/** The result set client factory. */
29
	private ResultSetClientFactory resultSetClientFactory;
30

  
31
	/**
32
	 * Gets the dao.
33
	 *
34
	 * @return the dao
35
	 */
36
	public ObjectStoreDao getDao() {
37
		return dao;
38
	}
39

  
40
	/**
41
	 * Sets the dao.
42
	 *
43
	 * @param dao
44
	 *            the new dao
45
	 */
46
	@Required
47
	public void setDao(final ObjectStoreDao dao) {
48
		this.dao = dao;
49
	}
50

  
51
	/**
52
	 * Deliver.
53
	 *
54
	 * @param objectStoreID
55
	 *            the object store id
56
	 * @param from
57
	 *            the from
58
	 * @param until
59
	 *            the until
60
	 * @return the w3 c endpoint reference
61
	 * @throws ObjectStoreServiceException
62
	 */
63
	public W3CEndpointReference deliver(final String objectStoreID, final Long from, final Long until) throws ObjectStoreServiceException {
64
		return resultSetFactory.createResultSet(dao.getObjectStore(objectStoreID).deliver(from, until));
65
	}
66

  
67
	/**
68
	 * Deliver records by tags.
69
	 *
70
	 * @param obsId
71
	 *            the obs id
72
	 * @param tags
73
	 *            the tags
74
	 * @return the string
75
	 */
76
	public W3CEndpointReference deliverRecordsByTags(final String obsId, final Iterable<String> tags) {
77
		return resultSetFactory.createResultSet(dao.getObjectStore(obsId).deliverRecordsByTag(tags));
78
	}
79

  
80
	/**
81
	 * Deliver ids.
82
	 *
83
	 * @param objectStoreID
84
	 *            the object store id
85
	 * @param eprId
86
	 *            the epr id
87
	 * @return the w3 c endpoint reference
88
	 * @throws ObjectStoreServiceException
89
	 */
90
	public W3CEndpointReference deliverIds(final String objectStoreID, final W3CEndpointReference eprId) throws ObjectStoreServiceException {
91

  
92
		Iterable<String> ids = resultSetClientFactory.getClient(eprId);
93
		return resultSetFactory.createResultSet(dao.getObjectStore(objectStoreID).deliverIds(ids));
94
	}
95

  
96
	/**
97
	 * Exist id starts with.
98
	 *
99
	 * @param obsId
100
	 *            the obs id
101
	 * @param startId
102
	 *            the start id
103
	 * @return true, if successful
104
	 * @throws ObjectStoreServiceException
105
	 */
106
	public boolean existIDStartsWith(final String obsId, final String startId) throws ObjectStoreServiceException {
107
		return dao.getObjectStore(obsId).existIDStartsWith(startId);
108
	}
109

  
110
	/**
111
	 * Deliver object.
112
	 *
113
	 * @param objectStoreID
114
	 *            the object store id
115
	 * @param objectId
116
	 *            the object id
117
	 * @return the object store file
118
	 * @throws ObjectStoreServiceException
119
	 */
120
	public ObjectStoreFile deliverObject(final String objectStoreID, final String objectId) throws ObjectStoreServiceException {
121
		return dao.getObjectStore(objectStoreID).deliverObject(objectId);
122
	}
123

  
124
	/**
125
	 * Deliver stream.
126
	 *
127
	 * @param objectStoreID
128
	 *            the object store id
129
	 * @param objectId
130
	 *            the object id
131
	 * @return the input stream
132
	 * @throws ObjectStoreServiceException
133
	 */
134
	public InputStream deliverStream(final String objectStoreID, final String objectId) throws ObjectStoreServiceException {
135
		return dao.getObjectStore(objectStoreID).deliverStream(objectId);
136
	}
137

  
138
	/**
139
	 * Gets the result set client factory.
140
	 *
141
	 * @return the result set client factory
142
	 */
143
	public ResultSetClientFactory getResultSetClientFactory() {
144
		return resultSetClientFactory;
145
	}
146

  
147
	/**
148
	 * Sets the result set client factory.
149
	 *
150
	 * @param resultSetClientFactory
151
	 *            the new result set client factory
152
	 */
153
	@Required
154
	public void setResultSetClientFactory(final ResultSetClientFactory resultSetClientFactory) {
155
		this.resultSetClientFactory = resultSetClientFactory;
156
	}
157

  
158
}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/ModularObjectStoreFeeder.java
1
package eu.dnetlib.data.objectstore.modular;
2

  
3
import java.util.List;
4

  
5
import javax.xml.ws.wsaddressing.W3CEndpointReference;
6

  
7
import org.apache.commons.logging.Log;
8
import org.apache.commons.logging.LogFactory;
9
import org.springframework.beans.factory.annotation.Required;
10

  
11
import com.google.common.base.Function;
12
import com.google.common.collect.Iterables;
13
import com.google.common.collect.Lists;
14

  
15
import eu.dnetlib.data.objectstore.modular.connector.ObjectStore;
16
import eu.dnetlib.data.objectstore.modular.connector.ObjectStoreDao;
17
import eu.dnetlib.data.objectstore.rmi.MetadataObjectRecord;
18
import eu.dnetlib.data.objectstore.rmi.ObjectStoreFile;
19
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
20
import eu.dnetlib.data.objectstore.rmi.Protocols;
21
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
22
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
23
import eu.dnetlib.enabling.resultset.client.ResultSetClientFactory;
24
import eu.dnetlib.miscutils.datetime.DateUtils;
25

  
26
/**
27
 * The Class ModularObjectStoreFeeder, responsible to feed data into the object Store.
28
 */
29
public class ModularObjectStoreFeeder {
30

  
31
	/** The Constant log. */
32
	private static final Log log = LogFactory.getLog(ModularObjectStoreFeeder.class);
33

  
34
	/** The dao of the objectStore. */
35
	private ObjectStoreDao dao;
36

  
37
	/** The result set client factory. */
38
	private ResultSetClientFactory resultSetClientFactory;
39

  
40
	/** The service locator. */
41
	private UniqueServiceLocator serviceLocator;
42

  
43
	/**
44
	 * Gets the dao.
45
	 *
46
	 * @return the dao
47
	 */
48
	public ObjectStoreDao getDao() {
49
		return dao;
50
	}
51

  
52
	/**
53
	 * Sets the dao.
54
	 *
55
	 * @param dao
56
	 *            the new dao
57
	 */
58
	@Required
59
	public void setDao(final ObjectStoreDao dao) {
60
		this.dao = dao;
61
	}
62

  
63
	/**
64
	 * Gets the result set client factory.
65
	 *
66
	 * @return the result set client factory
67
	 */
68
	public ResultSetClientFactory getResultSetClientFactory() {
69
		return resultSetClientFactory;
70
	}
71

  
72
	/**
73
	 * Sets the result set client factory.
74
	 *
75
	 * @param resultSetClientFactory
76
	 *            the new result set client factory
77
	 */
78

  
79
	@Required
80
	public void setResultSetClientFactory(final ResultSetClientFactory resultSetClientFactory) {
81
		this.resultSetClientFactory = resultSetClientFactory;
82
	}
83

  
84
	/**
85
	 * Feed metadata object record.
86
	 *
87
	 * @param objectStoreID
88
	 *            the object store id
89
	 * @param rsEpr
90
	 *            the rs epr
91
	 * @param mime
92
	 *            the mime
93
	 * @throws ObjectStoreServiceException
94
	 *             the object store service exception
95
	 */
96
	public void feedMetadataObjectRecord(final String objectStoreID, final String rsEpr, final String mime) throws ObjectStoreServiceException {
97

  
98
		final Iterable<String> records = resultSetClientFactory.getClient(rsEpr);
99
		Iterable<MetadataObjectRecord> toIngest = Iterables.transform(records, new Function<String, MetadataObjectRecord>() {
100

  
101
			@Override
102
			public MetadataObjectRecord apply(final String input) {
103
				MetadataObjectRecord record = MetadataObjectRecord.initFromJson(input);
104
				if (record != null) {
105
					record.setMime(mime);
106
				} else {
107
					log.error("An input record is null :" + input);
108
				}
109
				return record;
110
			}
111
		});
112
		ObjectStore store = dao.getObjectStore(objectStoreID);
113
		int size = store.feedMetadataRecord(toIngest, true);
114
		touch(objectStoreID, size);
115
	}
116

  
117
	/**
118
	 * Feed object in the object store starting from an EPR of objectMetadata.
119
	 *
120
	 * @param obsId
121
	 *            the objectStore id
122
	 * @param rsEpr
123
	 *            the result set Endpoint-reference
124
	 * @param protocol
125
	 *            the protocol
126
	 * @param login
127
	 *            the login
128
	 * @param password
129
	 *            the password
130
	 * @param mime
131
	 *            the mime type
132
	 * @throws ObjectStoreServiceException
133
	 *             the object store service exception
134
	 */
135
	public void feed(final String obsId, final String rsEpr, final Protocols protocol, final String login, final String password, final String mime)
136
			throws ObjectStoreServiceException {
137
		final Iterable<String> records = resultSetClientFactory.getClient(rsEpr);
138
		ObjectBroker objectBroker = new ObjectBroker(protocol, login, password, mime);
139
		Iterable<ObjectStoreRecord> toIngest = Iterables.transform(records, objectBroker);
140
		ObjectStore store = dao.getObjectStore(obsId);
141
		int size = store.feed(toIngest, true);
142
		touch(obsId, size);
143
	}
144

  
145
	/**
146
	 * Feed a single object in the object Stroe.
147
	 *
148
	 * @param objectStoreID
149
	 *            the object store id
150
	 * @param objectID
151
	 *            the object id
152
	 * @param URIObject
153
	 *            the URI of object
154
	 * @param protocol
155
	 *            the protocol
156
	 * @param login
157
	 *            the login
158
	 * @param password
159
	 *            the password
160
	 * @param mime
161
	 *            the mime type
162
	 * @throws ObjectStoreServiceException
163
	 *             the object store service exception
164
	 */
165
	public void feedObject(final String objectStoreID,
166
			final String objectID,
167
			final String URIObject,
168
			final Protocols protocol,
169
			final String login,
170
			final String password,
171
			final String mime) throws ObjectStoreServiceException {
172
		ObjectStoreFile inputFile = new ObjectStoreFile();
173
		inputFile.setURI(URIObject);
174
		inputFile.setObjectID(objectID);
175
		ObjectBroker objectBroker = new ObjectBroker(protocol, login, password, mime);
176
		Iterable<ObjectStoreRecord> toIngest = Iterables.transform(Lists.newArrayList(inputFile.toJSON()), objectBroker);
177
		ObjectStore store = dao.getObjectStore(objectStoreID);
178
		int size = store.feed(toIngest, true);
179
		touch(objectStoreID, size);
180
	}
181

  
182
	/**
183
	 * Feed object record.
184
	 *
185
	 * @param objectStoreID
186
	 *            the object store id
187
	 * @param record
188
	 *            the record
189
	 * @return the string
190
	 * @throws ObjectStoreServiceException
191
	 *             the object store service exception
192
	 */
193
	public String feedObjectRecord(final String objectStoreID, final ObjectStoreRecord record) throws ObjectStoreServiceException {
194
		ObjectStore store = dao.getObjectStore(objectStoreID);
195
		return store.feedObjectRecord(record);
196
	}
197

  
198
	/**
199
	 * Tag ids.
200
	 *
201
	 * @param objectStoreId
202
	 *            the object store id
203
	 * @param eprId
204
	 *            the epr id
205
	 * @param tag
206
	 *            the tag
207
	 * @return the int
208
	 */
209
	public int tagIds(final String objectStoreId, final W3CEndpointReference eprId, final String tag) {
210
		final Iterable<String> records = resultSetClientFactory.getClient(eprId);
211
		return this.dao.getObjectStore(objectStoreId).tagIds(records, tag);
212
	}
213

  
214
	/**
215
	 * Untag ids.
216
	 *
217
	 * @param objectStoreId
218
	 *            the object store id
219
	 * @param eprId
220
	 *            the epr id
221
	 * @param tag
222
	 *            the tag
223
	 * @return the int
224
	 */
225
	public int untagIds(final String objectStoreId, final W3CEndpointReference eprId, final String tag) {
226
		final Iterable<String> records = resultSetClientFactory.getClient(eprId);
227
		return this.dao.getObjectStore(objectStoreId).untagIds(records, tag);
228
	}
229

  
230
	/**
231
	 * Tag object store.
232
	 *
233
	 * @param objectStoreId
234
	 *            the object store id
235
	 * @param tag
236
	 *            the tag
237
	 * @return the int
238
	 */
239
	public int tagObjectStore(final String objectStoreId, final String tag) {
240
		return this.dao.getObjectStore(objectStoreId).tagObjectstore(tag);
241
	}
242

  
243
	/**
244
	 * Untag object store.
245
	 *
246
	 * @param objectStoreId
247
	 *            the object store id
248
	 * @param tag
249
	 *            the tag
250
	 * @return the int
251
	 */
252
	public int untagObjectStore(final String objectStoreId, final String tag) {
253
		return this.dao.getObjectStore(objectStoreId).untagObjectstore(tag);
254
	}
255

  
256
	/**
257
	 * Sets the last modified date in the profile.
258
	 *
259
	 * @param obsId
260
	 *            the obs id
261
	 * @param size
262
	 *            the size
263
	 */
264
	public void touch(final String obsId, final int size) {
265
		try {
266
			final String now = DateUtils.now_ISO8601();
267

  
268
			final String mdstoreXUpdate = "for $x in //RESOURCE_PROFILE[.//RESOURCE_IDENTIFIER/@value = '" + obsId + "']"
269
					+ "return update value $x//LAST_STORAGE_DATE with '" + now + "'";
270

  
271
			serviceLocator.getService(ISRegistryService.class, true).executeXUpdate(mdstoreXUpdate);
272

  
273
			touchSize(obsId, size);
274
		} catch (final Exception e) {
275
			throw new IllegalStateException(e);
276
		}
277
	}
278

  
279
	/**
280
	 * Touch size.
281
	 *
282
	 * @param obsId
283
	 *            the obs id
284
	 * @param size
285
	 *            the size
286
	 */
287
	public void touchSize(final String obsId, final int size) {
288
		try {
289
			final String mdstoreNumberXUpdate = "for $x in //RESOURCE_PROFILE[.//RESOURCE_IDENTIFIER/@value = '" + obsId + "']"
290
					+ "return update value $x//COUNT_STORE with '" + size + "'";
291

  
292
			serviceLocator.getService(ISRegistryService.class, true).executeXUpdate(mdstoreNumberXUpdate);
293
		} catch (final Exception e) {
294
			throw new IllegalStateException(e);
295
		}
296
	}
297

  
298
	/**
299
	 * Gets the service locator.
300
	 *
301
	 * @return the service locator
302
	 */
303
	public UniqueServiceLocator getServiceLocator() {
304
		return serviceLocator;
305
	}
306

  
307
	/**
308
	 * Sets the service locator.
309
	 *
310
	 * @param serviceLocator
311
	 *            the new service locator
312
	 */
313
	@Required
314
	public void setServiceLocator(final UniqueServiceLocator serviceLocator) {
315
		this.serviceLocator = serviceLocator;
316
	}
317

  
318
	public int tagObjectStorebyIds(final String objectStoreId, final List<String> ids, final String tag) {
319
		return this.dao.getObjectStore(objectStoreId).tagIds(ids, tag);
320
	}
321

  
322
	public int untagObjectStorebyIds(final String objectStoreId, final List<String> ids, final String tag) {
323
		return this.dao.getObjectStore(objectStoreId).untagIds(ids, tag);
324
	}
325

  
326
}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/ObjectStoreRecord.java
1
package eu.dnetlib.data.objectstore.modular;
2

  
3
import java.io.InputStream;
4

  
5
import eu.dnetlib.data.objectstore.rmi.ObjectStoreFile;
6

  
7
/**
8
 * The Class ObjectStoreRecord is a serialization of the object to be ingested in the objectStore metadata + inputstream of the data.
9
 */
10
public class ObjectStoreRecord {
11

  
12
	/** The file metadata. */
13
	private ObjectStoreFile fileMetadata;
14

  
15
	/** The input stream. */
16
	private InputStream inputStream;
17

  
18
	/**
19
	 * Gets the input stream.
20
	 *
21
	 * @return the input stream
22
	 */
23
	public InputStream getInputStream() {
24
		return inputStream;
25
	}
26

  
27
	/**
28
	 * Sets the input stream.
29
	 *
30
	 * @param inputStream
31
	 *            the new input stream
32
	 */
33
	public void setInputStream(final InputStream inputStream) {
34
		this.inputStream = inputStream;
35
	}
36

  
37
	/**
38
	 * Gets the file metadata.
39
	 *
40
	 * @return the file metadata
41
	 */
42
	public ObjectStoreFile getFileMetadata() {
43
		return fileMetadata;
44
	}
45

  
46
	/**
47
	 * Sets the file metadata.
48
	 *
49
	 * @param fileMetadata
50
	 *            the new file metadata
51
	 */
52
	public void setFileMetadata(final ObjectStoreFile fileMetadata) {
53
		this.fileMetadata = fileMetadata;
54
	}
55

  
56
}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/DeleteObjectStoreAction.java
1
package eu.dnetlib.data.objectstore.modular;
2

  
3
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
4
import eu.dnetlib.enabling.tools.blackboard.BlackboardServerAction;
5
import eu.dnetlib.enabling.tools.blackboard.BlackboardServerHandler;
6

  
7
/**
8
 * The Class DeleteObjectStoreAction is responsible to execute the blacboard action of type DELETE.
9
 */
10
public class DeleteObjectStoreAction extends AbstractObjectStoreAction
11
		implements BlackboardServerAction<ObjectStoreActions> {
12

  
13
	/** The profile creator. */
14
	private ObjectStoreProfileCreator profileCreator;
15

  
16
	/* (non-Javadoc)
17
	 * @see eu.dnetlib.enabling.tools.blackboard.BlackboardServerAction#execute(eu.dnetlib.enabling.tools.blackboard.BlackboardServerHandler, eu.dnetlib.enabling.tools.blackboard.BlackboardJob)
18
	 */
19
	@Override
20
	public void execute(BlackboardServerHandler handler, BlackboardJob job)
21
			throws Exception {
22

  
23
		final String objID = job.getParameters().get("obsID");
24

  
25
		getDao().deleteObjectStore(objID);
26
		handler.done(job);
27

  
28
	}
29

  
30
	/**
31
	 * Gets the profile creator.
32
	 *
33
	 * @return the profile creator
34
	 */
35
	public ObjectStoreProfileCreator getProfileCreator() {
36
		return profileCreator;
37
	}
38

  
39
	/**
40
	 * Sets the profile creator.
41
	 *
42
	 * @param profileCreator the new profile creator
43
	 */
44
	public void setProfileCreator(ObjectStoreProfileCreator profileCreator) {
45
		this.profileCreator = profileCreator;
46
	}
47

  
48
}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/ObjectStoreActions.java
1
package eu.dnetlib.data.objectstore.modular;
2

  
3
/**
4
 * The Enumeration of the blacboard action of the  ObjectStore.
5
 */
6
public enum ObjectStoreActions {
7
	
8
	/** The create. */
9
	CREATE, 
10
 /** The delete. */
11
 DELETE, 
12
 /** The feed. */
13
 FEED, 
14
 /** The feedobject. */
15
 FEEDOBJECT
16

  
17
}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/ObjectStoreProfileCreator.java
1
package eu.dnetlib.data.objectstore.modular;
2

  
3
import javax.xml.ws.Endpoint;
4

  
5
import org.antlr.stringtemplate.StringTemplate;
6
import org.springframework.beans.factory.annotation.Required;
7

  
8
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryException;
9
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
10
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
11
import eu.dnetlib.soap.EndpointReferenceBuilder;
12

  
13
// TODO: Auto-generated Javadoc
14
/**
15
 * The Class ObjectStoreProfileCreator is responsible of creating profile of the ObjectStore
16
 */
17
public class ObjectStoreProfileCreator {
18

  
19
	/**
20
	 * service locator.
21
	 */
22
	private UniqueServiceLocator serviceLocator;
23

  
24
	/**
25
	 * mdstore ds template.
26
	 */
27
	private StringTemplate objectstoreDsTemplate;
28

  
29
	/**
30
	 * service endpoint.
31
	 */
32
	private Endpoint endpoint;
33

  
34
	/**
35
	 * endpoint builder.
36
	 */
37
	private EndpointReferenceBuilder<Endpoint> eprBuilder;
38

  
39
	/**
40
	 * Register profile.
41
	 * 
42
	 * @param interpretation
43
	 *            the interpretation
44
	 * @return the string
45
	 * @throws ISRegistryException
46
	 *             the IS registry exception
47
	 */
48
	public String registerProfile(final String interpretation)
49
			throws ISRegistryException {
50
		// XXX: mini hack
51
		StringTemplate template = new StringTemplate(
52
				objectstoreDsTemplate.getTemplate());
53
		template.setAttribute("serviceUri", eprBuilder.getAddress(endpoint));
54
		template.setAttribute("interpretation", interpretation);
55

  
56
		return serviceLocator.getService(ISRegistryService.class, true).registerProfile(template.toString());
57
	}
58

  
59
	/**
60
	 * Gets the endpoint.
61
	 * 
62
	 * @return the endpoint
63
	 */
64
	public Endpoint getEndpoint() {
65
		return endpoint;
66
	}
67

  
68
	/**
69
	 * Sets the endpoint.
70
	 * 
71
	 * @param endpoint
72
	 *            the new endpoint
73
	 */
74
	@Required
75
	public void setEndpoint(final Endpoint endpoint) {
76
		this.endpoint = endpoint;
77
	}
78

  
79
	/**
80
	 * Gets the epr builder.
81
	 * 
82
	 * @return the epr builder
83
	 */
84
	public EndpointReferenceBuilder<Endpoint> getEprBuilder() {
85
		return eprBuilder;
86
	}
87

  
88
	/**
89
	 * Sets the epr builder.
90
	 * 
91
	 * @param eprBuilder
92
	 *            the new epr builder
93
	 */
94
	@Required
95
	public void setEprBuilder(final EndpointReferenceBuilder<Endpoint> eprBuilder) {
96
		this.eprBuilder = eprBuilder;
97
	}
98

  
99
	/**
100
	 * Gets the objectstore ds template.
101
	 * 
102
	 * @return the objectstore ds template
103
	 */
104
	public StringTemplate getObjectstoreDsTemplate() {
105
		return objectstoreDsTemplate;
106
	}
107

  
108
	/**
109
	 * Sets the objectstore ds template.
110
	 * 
111
	 * @param objectstoreDsTemplate
112
	 *            the new objectstore ds template
113
	 */
114
	@Required
115
	public void setObjectstoreDsTemplate(final StringTemplate objectstoreDsTemplate) {
116
		this.objectstoreDsTemplate = objectstoreDsTemplate;
117
	}
118

  
119
	public UniqueServiceLocator getServiceLocator() {
120
		return serviceLocator;
121
	}
122

  
123
	@Required
124
	public void setServiceLocator(final UniqueServiceLocator serviceLocator) {
125
		this.serviceLocator = serviceLocator;
126
	}
127

  
128
}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/AbstractObjectStoreAction.java
1
package eu.dnetlib.data.objectstore.modular;
2

  
3
import eu.dnetlib.data.objectstore.modular.connector.ObjectStoreDao;
4

  
5
/**
6
 * The Class AbstractObjectStoreAction.
7
 */
8
public class AbstractObjectStoreAction {
9

  
10
	/** The object store dao. */
11
	private ObjectStoreDao dao;
12

  
13
	/**
14
	 * Gets the dao.
15
	 *
16
	 * @return the dao
17
	 */
18
	public ObjectStoreDao getDao() {
19
		return dao;
20
	}
21

  
22
	/**
23
	 * Sets the dao.
24
	 *
25
	 * @param dao the new dao
26
	 */
27
	public void setDao(ObjectStoreDao dao) {
28
		this.dao = dao;
29
	}
30

  
31
}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/CreateObjectStoreAction.java
1
package eu.dnetlib.data.objectstore.modular;
2

  
3
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
4
import eu.dnetlib.enabling.tools.blackboard.BlackboardServerAction;
5
import eu.dnetlib.enabling.tools.blackboard.BlackboardServerHandler;
6

  
7
/**
8
 * The Class CreateObjectStoreAction is responsible to execute the blacboard action of type CREATE.
9
 */
10
public class CreateObjectStoreAction extends AbstractObjectStoreAction
11
		implements BlackboardServerAction<ObjectStoreActions> {
12

  
13
	/** The profile creator. */
14
	private ObjectStoreProfileCreator profileCreator;
15

  
16
	/* (non-Javadoc)
17
	 * @see eu.dnetlib.enabling.tools.blackboard.BlackboardServerAction#execute(eu.dnetlib.enabling.tools.blackboard.BlackboardServerHandler, eu.dnetlib.enabling.tools.blackboard.BlackboardJob)
18
	 */
19
	@Override
20
	public void execute(BlackboardServerHandler handler, BlackboardJob job)
21
			throws Exception {
22

  
23
		final String interpretation = job.getParameters().get("interpretation");
24

  
25
		final String objID = profileCreator.registerProfile(interpretation);
26

  
27
		getDao().createObjectStore(objID, interpretation);
28

  
29
		job.getParameters().put("objectStoreId", objID);
30

  
31
		handler.done(job);
32

  
33
	}
34

  
35
	/**
36
	 * Gets the profile creator.
37
	 *
38
	 * @return the profile creator
39
	 */
40
	public ObjectStoreProfileCreator getProfileCreator() {
41
		return profileCreator;
42
	}
43

  
44
	/**
45
	 * Sets the profile creator.
46
	 *
47
	 * @param profileCreator the new profile creator
48
	 */
49
	public void setProfileCreator(ObjectStoreProfileCreator profileCreator) {
50
		this.profileCreator = profileCreator;
51
	}
52

  
53
}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/FeedObjectStoreAction.java
1
package eu.dnetlib.data.objectstore.modular;
2

  
3
import org.springframework.beans.factory.annotation.Required;
4

  
5
import eu.dnetlib.data.objectstore.rmi.Protocols;
6
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
7
import eu.dnetlib.enabling.tools.blackboard.BlackboardServerAction;
8
import eu.dnetlib.enabling.tools.blackboard.BlackboardServerHandler;
9

  
10

  
11
/**
12
 * The Class FeedObjectStoreAction to execute the blacboard action of type FEED.
13
 */
14
public class FeedObjectStoreAction extends AbstractObjectStoreAction implements
15
		BlackboardServerAction<ObjectStoreActions> {
16

  
17
	/** The profile creator. */
18
	private ObjectStoreProfileCreator profileCreator;
19

  
20
	/** The store feeder. */
21
	private ModularObjectStoreFeeder storeFeeder;
22

  
23
	/* (non-Javadoc)
24
	 * @see eu.dnetlib.enabling.tools.blackboard.BlackboardServerAction#execute(eu.dnetlib.enabling.tools.blackboard.BlackboardServerHandler, eu.dnetlib.enabling.tools.blackboard.BlackboardJob)
25
	 */
26
	@Override
27
	public void execute(BlackboardServerHandler handler, BlackboardJob job)
28
			throws Exception {
29

  
30
		final String objStoreID = job.getParameters().get("obsID");
31
		final String objID = job.getParameters().get("objID");
32
		final String URI = job.getParameters().get("URI");
33
		final String eprRs = job.getParameters().get("epr");
34
		final String protocolString = job.getParameters().get("protocol");
35

  
36
		final Protocols protocol;
37
		if (protocolString == null)
38
			protocol = Protocols.None;
39
		else
40
			protocol = Protocols.valueOf(job.getParameters().get("protocol"));
41
		final String mime = job.getParameters().get("mime");
42
		final String login = job.getParameters().get("login");
43
		final String password = job.getParameters().get("password");
44

  
45
		if (URI != null && URI.length() > 0) {
46
			storeFeeder.feedObject(objStoreID, objID, URI, protocol, login,
47
					password, mime);
48
		} else if (eprRs != null && eprRs.length() > 0) {
49
			storeFeeder
50
					.feed(objStoreID, eprRs, protocol, login, password, mime);
51
		}
52

  
53
		handler.done(job);
54

  
55
	}
56

  
57
	/**
58
	 * Gets the profile creator.
59
	 *
60
	 * @return the profile creator
61
	 */
62
	public ObjectStoreProfileCreator getProfileCreator() {
63
		return profileCreator;
64
	}
65

  
66
	/**
67
	 * Sets the profile creator.
68
	 *
69
	 * @param profileCreator the new profile creator
70
	 */
71
	@Required
72
	public void setProfileCreator(ObjectStoreProfileCreator profileCreator) {
73
		this.profileCreator = profileCreator;
74
	}
75

  
76
	/**
77
	 * Gets the store feeder.
78
	 *
79
	 * @return the store feeder
80
	 */
81
	public ModularObjectStoreFeeder getStoreFeeder() {
82
		return storeFeeder;
83
	}
84

  
85
	/**
86
	 * Sets the store feeder.
87
	 *
88
	 * @param storeFeeder the new store feeder
89
	 */
90
	@Required
91
	public void setStoreFeeder(ModularObjectStoreFeeder storeFeeder) {
92
		this.storeFeeder = storeFeeder;
93
	}
94

  
95
}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/ModularObjectStoreRESTService.java
1
package eu.dnetlib.data.objectstore.modular;
2

  
3
import java.io.IOException;
4
import java.io.InputStream;
5

  
6
import javax.annotation.Resource;
7
import javax.servlet.ServletOutputStream;
8
import javax.servlet.http.HttpServletResponse;
9

  
10
import org.apache.commons.io.IOUtils;
11
import org.apache.commons.logging.Log;
12
import org.apache.commons.logging.LogFactory;
13
import org.springframework.stereotype.Controller;
14
import org.springframework.web.bind.annotation.RequestMapping;
15
import org.springframework.web.bind.annotation.RequestParam;
16

  
17
import eu.dnetlib.data.objectstore.rmi.ObjectStoreFile;
18
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
19
import eu.dnetlib.miscutils.datetime.HumanTime;
20

  
21
// TODO: Auto-generated Javadoc
22
/**
23
 * The Class ModularObjectStoreRESTService implement the controller REST of the object Store.
24
 */
25
@Controller
26
public class ModularObjectStoreRESTService {
27

  
28
    /** The object store deliver. */
29
    @Resource
30
    ModularObjectStoreDeliver objectStoreDeliver;
31

  
32
    private static final Log log = LogFactory.getLog(ModularObjectStoreRESTService.class); // NOPMD by marko on 11/24/08 5:02 PM
33

  
34
    /**
35
     * Retrieve.
36
     *
37
     * @param res
38
     *            the res
39
     * @param objectStoreId
40
     *            the object store id
41
     * @param objectId
42
     *            the object id
43
     * @throws IOException
44
     *             Signals that an I/O exception has occurred.
45
     * @throws ObjectStoreServiceException
46
     */
47
    @RequestMapping(value = "/**/objectStore/retrieve.do")
48
    public void retrieve(final HttpServletResponse res,
49
			 @RequestParam(value = "objectStore", required = true) final String objectStoreId,
50
			 @RequestParam(value = "objectId", required = true) final String objectId) throws IOException, ObjectStoreServiceException {
51

  
52
	final long start = System.currentTimeMillis();
53
	final ObjectStoreFile file = objectStoreDeliver.deliverObject(objectStoreId, objectId);
54

  
55
	log.debug(String.format("deliverObject completed in %s, objId: %s", HumanTime.exactly(System.currentTimeMillis() - start), objectId));
56

  
57
	if (file == null) throw new RuntimeException("The file with id " + objectId + " doesn't exist");
58

  
59
	// res.setContentType(file.getMimeType());
60

  
61
	InputStream is = objectStoreDeliver.deliverStream(objectStoreId, objectId);
62

  
63
	ServletOutputStream outputStream = res.getOutputStream();
64

  
65
	IOUtils.copy(is, outputStream);
66

  
67
	try {
68
	    is.close();
69
	    if (log.isDebugEnabled()) {
70
		log.debug(String.format("retrive.do completed in %s, objId: %s", HumanTime.exactly(System.currentTimeMillis() - start), objectId));
71
	    }
72
	} catch (Throwable e) {
73
	    log.error("unable to close input Stream", e);
74
	}
75

  
76
	/*
77
	 * while (true) { int readSize = is.read(buffer); if (readSize == -1) { break; } outputStream.write(buffer, 0, readSize); }
78
	 */
79
    }
80
}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/inspector/ObjectStoreInspector.java
1
package eu.dnetlib.data.objectstore.modular.inspector;
2

  
3
import static eu.dnetlib.miscutils.collections.MappedCollection.listMap;
4

  
5
import java.util.List;
6

  
7
import javax.annotation.Resource;
8

  
9
import org.springframework.stereotype.Controller;
10
import org.springframework.ui.Model;
11
import org.springframework.web.bind.annotation.RequestMapping;
12
import org.springframework.web.bind.annotation.RequestMethod;
13
import org.springframework.web.bind.annotation.RequestParam;
14

  
15
import com.google.gson.Gson;
16

  
17
import eu.dnetlib.data.objectstore.modular.connector.ObjectStore;
18
import eu.dnetlib.data.objectstore.modular.connector.ObjectStoreDao;
19
import eu.dnetlib.data.objectstore.rmi.ObjectStoreFile;
20
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
21
import eu.dnetlib.enabling.inspector.AbstractInspectorController;
22
import eu.dnetlib.enabling.resultset.ResultSetListener;
23
import eu.dnetlib.miscutils.collections.MappedCollection;
24
import eu.dnetlib.miscutils.functional.UnaryFunction;
25

  
26
/**
27
 * The Class ObjectStoreInspector is the inspector controller of the objectStore.
28
 */
29
@Controller
30
public class ObjectStoreInspector extends AbstractInspectorController {
31

  
32
	// private static final Log log = LogFactory.getLog(ObjectStoreInspector.class);
33

  
34
	/** The object store dao. */
35
	@Resource(name = "gridFSObjectstoreDao")
36
	private ObjectStoreDao objectStoreDao;
37

  
38
	/**
39
	 * The Class ObjectStoreDescription.
40
	 */
41
	class ObjectStoreDescription {
42

  
43
		/** The id. */
44
		private String id;
45

  
46
		/** The size. */
47
		private int size;
48

  
49
		/**
50
		 * Instantiates a new object store description.
51
		 *
52
		 * @param id
53
		 *            the id
54
		 * @param size
55
		 *            the size
56
		 */
57
		public ObjectStoreDescription(final String id, final int size) {
58

  
59
			this.id = id;
60
			this.size = size;
61
		}
62

  
63
		/**
64
		 * Gets the interpretation.
65
		 *
66
		 * @return the interpretation
67
		 */
68
		public String getInterpretation() {
69

  
70
			ObjectStore objectStore = objectStoreDao.getObjectStore(id);
71
			return objectStore.getInterpretation();
72
		}
73

  
74
		/**
75
		 * Gets the id.
76
		 *
77
		 * @return the id
78
		 */
79
		public String getId() {
80
			return id;
81
		}
82

  
83
		/**
84
		 * Sets the id.
85
		 *
86
		 * @param id
87
		 *            the new id
88
		 */
89
		public void setId(final String id) {
90
			this.id = id;
91
		}
92

  
93
		/**
94
		 * Gets the size.
95
		 *
96
		 * @return the size
97
		 */
98
		public int getSize() {
99
			return size;
100
		}
101

  
102
		/**
103
		 * Sets the size.
104
		 *
105
		 * @param size
106
		 *            the new size
107
		 */
108
		public void setSize(final int size) {
109
			this.size = size;
110
		}
111
	}
112

  
113
	/**
114
	 * Object stores.
115
	 *
116
	 * @param model
117
	 *            the model
118
	 */
119
	@RequestMapping(value = "/inspector/objectstores.do")
120
	public void objectStores(final Model model) {
121
		List<String> objectStores = objectStoreDao.listObjectStores();
122
		model.addAttribute("objectstores", MappedCollection.listMap(objectStores, new UnaryFunction<ObjectStoreDescription, String>() {
123

  
124
			@Override
125
			public ObjectStoreDescription evaluate(final String id) {
126
				ObjectStore objStore = objectStoreDao.getObjectStore(id);
127
				try {
128
					return new ObjectStoreDescription(id, objStore.getSize());
129
				} catch (ObjectStoreServiceException e) {
130
					return null;
131
				}
132
			}
133
		}));
134
	}
135

  
136
	/**
137
	 * Object store.
138
	 *
139
	 * @param model
140
	 *            the model
141
	 * @param id
142
	 *            the id
143
	 * @param startParam
144
	 *            the start param
145
	 * @param regex
146
	 *            the regex
147
	 * @throws ObjectStoreServiceException
148
	 */
149
	@RequestMapping(value = "/inspector/objectstore.do", method = RequestMethod.GET)
150
	public void objectStore(final Model model,
151
			@RequestParam("id") final String id,
152
			@RequestParam(value = "start", required = false) final Integer startParam,
153
			@RequestParam(value = "regex", required = false) final String regex) throws ObjectStoreServiceException {
154
		int pageSize = 10;
155
		int start = 0;
156

  
157
		if (startParam != null) {
158
			start = startParam;
159
		}
160
		ObjectStore objctStore = objectStoreDao.getObjectStore(id);
161
		ResultSetListener rs = objctStore.deliver((long) 0, System.currentTimeMillis());
162
		List<String> page = rs.getResult((1 + start), (start + pageSize));
163
		final Gson g = new Gson();
164
		model.addAttribute("id", id);
165
		model.addAttribute("start", start);
166
		model.addAttribute("regex", regex);
167
		model.addAttribute("nextPage", start + pageSize);
168
		model.addAttribute("prevPage", Math.max(0, start - pageSize));
169
		model.addAttribute("size", rs.getSize());
170
		model.addAttribute("page", listMap(page, new UnaryFunction<ObjectStoreFile, String>() {
171

  
172
			@Override
173
			public ObjectStoreFile evaluate(final String json) {
174
				return g.fromJson(json, ObjectStoreFile.class);
175
			}
176
		}));
177

  
178
	}
179

  
180
	/**
181
	 * Gets the object store dao.
182
	 *
183
	 * @return the object store dao
184
	 */
185
	public ObjectStoreDao getObjectStoreDao() {
186
		return objectStoreDao;
187
	}
188

  
189
	/**
190
	 * Sets the object store dao.
191
	 *
192
	 * @param objectStoreDao
193
	 *            the new object store dao
194
	 */
195
	public void setObjectStoreDao(final ObjectStoreDao objectStoreDao) {
196
		this.objectStoreDao = objectStoreDao;
197
	}
198

  
199
}
modules/dnet-modular-objectstore-service/tags/dnet-modular-objectstore-service-4.0.3-TAG/src/main/java/eu/dnetlib/data/objectstore/modular/ModularObjectStoreService.java
1
package eu.dnetlib.data.objectstore.modular;
2

  
3
import java.util.List;
4

  
5
import javax.xml.ws.wsaddressing.W3CEndpointReference;
6

  
7
import org.springframework.beans.factory.annotation.Required;
8

  
9
import com.google.gson.Gson;
10

  
11
import eu.dnetlib.data.objectstore.rmi.ObjectStoreFile;
12
import eu.dnetlib.data.objectstore.rmi.ObjectStoreService;
13
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
14
import eu.dnetlib.enabling.tools.AbstractBaseService;
15
import eu.dnetlib.enabling.tools.blackboard.NotificationHandler;
16

  
17
/**
18
 * The Class ModularObjectStoreService is the implementation of the ObjectStoreService interface.
19
 */
20
public class ModularObjectStoreService extends AbstractBaseService implements ObjectStoreService {
21

  
22
	/** The feeder. */
23
	private ModularObjectStoreFeeder feeder;
24

  
25
	/** The object store deliver. */
26
	private ModularObjectStoreDeliver objectStoreDeliver;
27

  
28
	/** The notification handler. */
29
	private NotificationHandler notificationHandler;
30

  
31
	/*
32
	 * (non-Javadoc)
33
	 *
34
	 * @see eu.dnetlib.data.objectstore.rmi.ObjectStoreService#deliverObjects(java.lang.String, java.lang.Double, java.lang.Double)
35
	 */
36
	/**
37
	 * Deliver objects.
38
	 *
39
	 * @param obsId
40
	 *            the obs id
41
	 * @param from
42
	 *            the from
43
	 * @param until
44
	 *            the until
45
	 * @return the w3 c endpoint reference
46
	 * @throws ObjectStoreServiceException
47
	 *             the object store service exception
48
	 */
49
	@Override
50
	public W3CEndpointReference deliverObjects(final String obsId, final Long from, final Long until) throws ObjectStoreServiceException {
51

  
52
		return objectStoreDeliver.deliver(obsId, from, until);
53
	}
54

  
55
	/*
56
	 * (non-Javadoc)
57
	 *
58
	 * @see eu.dnetlib.data.objectstore.rmi.ObjectStoreService#deliverObjectsByIds(java.lang.String,
59
	 * javax.xml.ws.wsaddressing.W3CEndpointReference)
60
	 */
61
	/**
62
	 * Deliver objects by ids.
63
	 *
64
	 * @param obsId
65
	 *            the obs id
66
	 * @param eprId
67
	 *            the epr id
68
	 * @return the w3 c endpoint reference
69
	 * @throws ObjectStoreServiceException
70
	 *             the object store service exception
71
	 */
72
	@Override
73
	public W3CEndpointReference deliverObjectsByIds(final String obsId, final W3CEndpointReference eprId) throws ObjectStoreServiceException {
74
		return objectStoreDeliver.deliverIds(obsId, eprId);
75
	}
76

  
77
	/*
78
	 * (non-Javadoc)
79
	 *
80
	 * @see eu.dnetlib.data.objectstore.rmi.ObjectStoreService#deliverRecord(java.lang.String, java.lang.String)
81
	 */
82
	/**
83
	 * Deliver record.
84
	 *
85
	 * @param obsId
86
	 *            the obs id
87
	 * @param objectId
88
	 *            the object id
89
	 * @return the string
90
	 * @throws ObjectStoreServiceException
91
	 *             the object store service exception
92
	 */
93
	@Override
94
	public String deliverRecord(final String obsId, final String objectId) throws ObjectStoreServiceException {
95
		return objectStoreDeliver.deliverObject(obsId, objectId).toJSON();
96
	}
97

  
98
	/*
99
	 * (non-Javadoc)
100
	 *
101
	 * @see eu.dnetlib.data.objectstore.rmi.ObjectStoreService#getListOfObjectStores()
102
	 */
103
	/**
104
	 * Gets the list of object stores.
105
	 *
106
	 * @return the list of object stores
107
	 */
108
	@Override
109
	public List<String> getListOfObjectStores() {
110
		return objectStoreDeliver.getDao().listObjectStores();
111
	}
112

  
113
	/**
114
	 * Gets the feeder.
115
	 *
116
	 * @return the feeder
117
	 */
118
	public ModularObjectStoreFeeder getFeeder() {
119
		return feeder;
120
	}
121

  
122
	/**
123
	 * Sets the feeder.
124
	 *
125
	 * @param feeder
126
	 *            the new feeder
127
	 */
128
	@Required
129
	public void setFeeder(final ModularObjectStoreFeeder feeder) {
130
		this.feeder = feeder;
131
	}
132

  
133
	/**
134
	 * Gets the notification handler.
135
	 *
136
	 * @return the notification handler
137
	 */
138
	public NotificationHandler getNotificationHandler() {
139
		return notificationHandler;
140
	}
141

  
142
	/**
143
	 * Sets the notification handler.
144
	 *
145
	 * @param notificationHandler
146
	 *            the new notification handler
147
	 */
148
	@Required
149
	public void setNotificationHandler(final NotificationHandler notificationHandler) {
150
		this.notificationHandler = notificationHandler;
151
	}
152

  
153
	/**
154
	 * {@inheritDoc}
155
	 *
156
	 * @see eu.dnetlib.enabling.tools.AbstractBaseService#notify(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
157
	 */
158
	@Override
159
	public void notify(final String subscriptionId, final String topic, final String isId, final String message) {
160
		getNotificationHandler().notified(subscriptionId, topic, isId, message);
161
	}
162

  
163
	/**
164
	 * Gets the object store deliver.
165
	 *
166
	 * @return the object store deliver
167
	 */
168
	public ModularObjectStoreDeliver getObjectStoreDeliver() {
169
		return objectStoreDeliver;
170
	}
171

  
172
	/**
173
	 * Sets the object store deliver.
174
	 *
175
	 * @param objectStoreDeliver
176
	 *            the new object store deliver
177
	 */
178
	@Required
179
	public void setObjectStoreDeliver(final ModularObjectStoreDeliver objectStoreDeliver) {
180
		this.objectStoreDeliver = objectStoreDeliver;
181
	}
182

  
183
	/*
184
	 * (non-Javadoc)
185
	 *
186
	 * @see eu.dnetlib.data.objectstore.rmi.ObjectStoreService#feedObject(java.lang.String, java.lang.String)
187
	 */
188
	/**
189
	 * Feed object.
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff