Project

General

Profile

« Previous | Next » 

Revision 36273

partial implementation of DatasourceManager

View differences:

modules/dnet-components/trunk/src/main/java/eu/dnetlib/enabling/utils/DnetAnnotationUtils.java
1
package eu.dnetlib.enabling.utils;
2

  
3
import java.lang.reflect.Field;
4
import java.util.List;
5
import java.util.Map;
6

  
7
import org.apache.commons.logging.Log;
8
import org.apache.commons.logging.LogFactory;
9

  
10
import com.google.common.collect.Lists;
11
import com.google.common.collect.Maps;
12

  
13
import eu.dnetlib.enabling.annotations.DnetResource;
14
import eu.dnetlib.enabling.annotations.IndexedField;
15
import eu.dnetlib.enabling.annotations.IndexedFieldsContainer;
16

  
17
public class DnetAnnotationUtils {
18

  
19
	private static final Log log = LogFactory.getLog(DnetAnnotationUtils.class);
20

  
21
	public static class IndexedFields {
22

  
23
		private String id;
24
		private String resource;
25
		private Object value;
26

  
27
		public IndexedFields() {}
28

  
29
		public IndexedFields(final String id, final String resource, final Object value) {
30
			this.id = id;
31
			this.resource = resource;
32
			this.value = value;
33
		}
34

  
35
		public String getId() {
36
			return id;
37
		}
38

  
39
		public void setId(final String id) {
40
			this.id = id;
41
		}
42

  
43
		public String getResource() {
44
			return resource;
45
		}
46

  
47
		public void setResource(final String resource) {
48
			this.resource = resource;
49
		}
50

  
51
		public Object getValue() {
52
			return value;
53
		}
54

  
55
		public void Object(final String value) {
56
			this.value = value;
57
		}
58
	}
59

  
60
	public static List<IndexedFields> getIndexedFields(final String resourceId, final Object o) {
61
		final List<IndexedFields> list = Lists.newArrayList();
62
		if (o.getClass().isAnnotationPresent(DnetResource.class)) {
63
			getIndexedFields(resourceId, o, list);
64
		}
65
		return list;
66
	}
67

  
68
	private static void getIndexedFields(final String resourceId, final Object o, final List<IndexedFields> list) {
69
		if (o instanceof Map<?, ?>) {
70
			for (Object o1 : ((Map<?, ?>) o).values()) {
71
				getIndexedFields(resourceId, o1, list);
72
			}
73
		} else if (o instanceof Iterable<?>) {
74
			for (Object o1 : (Iterable<?>) o) {
75
				getIndexedFields(resourceId, o1, list);
76
			}
77
		} else {
78
			for (Field f : o.getClass().getFields()) {
79
				if (f.isAnnotationPresent(IndexedField.class)) {
80
					try {
81
						f.setAccessible(true);
82
						final String id = f.getAnnotation(IndexedField.class).id();
83
						list.add(new IndexedFields(id, resourceId, f.get(o)));
84
					} catch (Exception e) {
85
						log.error(e);
86
					}
87
				} else if (f.isAnnotationPresent(IndexedFieldsContainer.class)) {
88
					try {
89
						f.setAccessible(true);
90
						getIndexedFields(resourceId, f.get(o), list);
91
					} catch (Exception e) {
92
						log.error(e);
93
					}
94
				}
95
			}
96
		}
97
	}
98

  
99
	public static Map<String, String> describeIndexedFields(final Class<?> clazz) {
100
		final Map<String, String> map = Maps.newLinkedHashMap();
101
		if (clazz.isAnnotationPresent(DnetResource.class)) {
102
			describeIndexedFields(clazz, map);
103
		}
104
		return map;
105
	}
106

  
107
	private static void describeIndexedFields(final Class<?> clazz, final Map<String, String> map) {
108
		for (Field f : clazz.getFields()) {
109
			if (f.isAnnotationPresent(IndexedField.class)) {
110
				try {
111
					final String id = f.getAnnotation(IndexedField.class).id();
112
					final String label = f.getAnnotation(IndexedField.class).label();
113
					map.put(id, label);
114
				} catch (Exception e) {
115
					log.error(e);
116
				}
117
			} else if (f.isAnnotationPresent(IndexedFieldsContainer.class)) {
118
				try {
119
					describeIndexedFields(f.getAnnotation(IndexedFieldsContainer.class).clazz(), map);
120
				} catch (Exception e) {
121
					log.error(e);
122
				}
123
			}
124
		}
125

  
126
	}
127
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/enabling/utils/DnetResourceFactory.java
1
package eu.dnetlib.enabling.utils;
2

  
3
import java.util.Date;
4

  
5
import org.apache.commons.lang.StringUtils;
6

  
7
import eu.dnetlib.enabling.annotations.DnetResource;
8
import eu.dnetlib.rmi.objects.is.DnetDataStructure;
9
import eu.dnetlib.rmi.soap.exceptions.InformationServiceException;
10

  
11
public class DnetResourceFactory {
12

  
13
	public static DnetDataStructure createDatastructure(final String code, final String name, final Object contentObj) throws InformationServiceException {
14
		if (contentObj == null) {
15
			throw new InformationServiceException("contentObj is null");
16
		} else if (contentObj.getClass().isAnnotationPresent(DnetResource.class)) {
17
			throw new InformationServiceException("Missing DnetResource annotation in class  " + contentObj.getClass());
18
		} else if (StringUtils.isBlank(code)) {
19
			throw new InformationServiceException("Code is empty for contentObj: " + contentObj);
20
		} else {
21
			final DnetDataStructure ds = new DnetDataStructure();
22
			ds.setCode(code);
23
			ds.setName(name);
24
			ds.setType(contentObj.getClass().getAnnotation(DnetResource.class).type());
25
			ds.setDate(new Date());
26
			ds.setContentFromObject(contentObj);
27
			return ds;
28
		}
29
	}
30
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/enabling/annotations/IndexedField.java
1
package eu.dnetlib.enabling.annotations;
2

  
3
import java.lang.annotation.ElementType;
4
import java.lang.annotation.Retention;
5
import java.lang.annotation.RetentionPolicy;
6
import java.lang.annotation.Target;
7

  
8
@Retention(RetentionPolicy.RUNTIME)
9
@Target(ElementType.FIELD)
10
public @interface IndexedField {
11

  
12
	String id();
13

  
14
	String label();
15

  
16
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/enabling/annotations/IndexedFieldsContainer.java
1
package eu.dnetlib.enabling.annotations;
2

  
3
import java.lang.annotation.ElementType;
4
import java.lang.annotation.Retention;
5
import java.lang.annotation.RetentionPolicy;
6
import java.lang.annotation.Target;
7

  
8
@Retention(RetentionPolicy.RUNTIME)
9
@Target(ElementType.FIELD)
10
public @interface IndexedFieldsContainer {
11

  
12
	Class<?> clazz();
13

  
14
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/enabling/datastructures/Datasource.java
1
package eu.dnetlib.enabling.datastructures;
2

  
3
import java.util.ArrayList;
4
import java.util.Date;
5
import java.util.List;
6

  
7
import javax.xml.bind.annotation.XmlRootElement;
8

  
9
import eu.dnetlib.enabling.annotations.DnetResource;
10
import eu.dnetlib.enabling.annotations.IndexedField;
11
import eu.dnetlib.enabling.annotations.IndexedFieldsContainer;
12
import eu.dnetlib.rmi.objects.dsmanager.DatasourceConstants;
13
import eu.dnetlib.rmi.objects.dsmanager.IfaceDesc;
14
import eu.dnetlib.rmi.objects.is.DnetResourceFormat;
15
import eu.dnetlib.rmi.objects.is.DnetResourceKind;
16

  
17
@XmlRootElement
18
@DnetResource(format = DnetResourceFormat.JSON, kind = DnetResourceKind.UNIT, type = DatasourceConstants.DATASOURCE_TYPE)
19
public class Datasource {
20

  
21
	private String id;
22
	private String officialName;
23
	private String englishName;
24
	private String websiteUrl;
25
	private String logoUrl;
26
	private String contactEmail;
27

  
28
	@IndexedField(id = "country", label = "Datasource countries")
29
	private String countryCode;
30

  
31
	private String countryName;
32
	private String organization;
33
	private Double latitude = 0.0;
34
	private Double longitude = 0.0;
35
	private Double timezone = 0.0;
36
	private String namespacePrefix;
37
	private String odNumberOfItems;
38
	private String odNumberOfItemsDate;
39
	private String odPolicies;
40
	private String odLanguages;
41
	private String odContentTypes;
42
	private String collectedFrom;
43
	private Boolean inferred = false;
44
	private Boolean deletedByInference = false;
45
	private Double trust = 0.9;
46
	private String inferenceProvenance;
47
	private Date dateOfValidation;
48
	private String registeredBy;
49
	private String datasourceClass;
50
	private String provenanceActionClass;
51
	private Date dateOfCollection;
52
	private String typology;
53
	private String activationId;
54
	private Boolean mergehomonyms = true;
55
	private String description;
56
	private Date releaseStartDate;
57
	private Date releaseEndDate;
58
	private String missionStatementUrl;
59
	private Boolean dataProvider = false;
60
	private Boolean serviceProvider = false;
61
	private String databaseAccessType;
62
	private String dataUploadType;
63
	private String databaseAccessRestriction;
64
	private String dataUploadRestriction;
65
	private Boolean versioning = false;
66
	private String citationGuidelineUrl;
67
	private String qualityManagementKind;
68
	private String pidSystems;
69
	private String certificates;
70
	private String aggregator;
71
	private String issn;
72
	private String eissn;
73
	private String lissn;
74

  
75
	@IndexedFieldsContainer(clazz = IfaceDesc.class)
76
	private List<IfaceDesc> interfaces = new ArrayList<IfaceDesc>();
77

  
78
	public String getId() {
79
		return id;
80
	}
81

  
82
	public void setId(final String id) {
83
		this.id = id;
84
	}
85

  
86
	public String getOfficialName() {
87
		return officialName;
88
	}
89

  
90
	public void setOfficialName(final String officialName) {
91
		this.officialName = officialName;
92
	}
93

  
94
	public String getEnglishName() {
95
		return englishName;
96
	}
97

  
98
	public void setEnglishName(final String englishName) {
99
		this.englishName = englishName;
100
	}
101

  
102
	public String getWebsiteUrl() {
103
		return websiteUrl;
104
	}
105

  
106
	public void setWebsiteUrl(final String websiteUrl) {
107
		this.websiteUrl = websiteUrl;
108
	}
109

  
110
	public String getLogoUrl() {
111
		return logoUrl;
112
	}
113

  
114
	public void setLogoUrl(final String logoUrl) {
115
		this.logoUrl = logoUrl;
116
	}
117

  
118
	public String getContactEmail() {
119
		return contactEmail;
120
	}
121

  
122
	public void setContactEmail(final String contactEmail) {
123
		this.contactEmail = contactEmail;
124
	}
125

  
126
	public String getCountryCode() {
127
		return countryCode;
128
	}
129

  
130
	public void setCountryCode(final String countryCode) {
131
		this.countryCode = countryCode;
132
	}
133

  
134
	public String getCountryName() {
135
		return countryName;
136
	}
137

  
138
	public void setCountryName(final String countryName) {
139
		this.countryName = countryName;
140
	}
141

  
142
	public String getOrganization() {
143
		return organization;
144
	}
145

  
146
	public void setOrganization(final String organization) {
147
		this.organization = organization;
148
	}
149

  
150
	public Double getLatitude() {
151
		return latitude;
152
	}
153

  
154
	public void setLatitude(final Double latitude) {
155
		this.latitude = latitude;
156
	}
157

  
158
	public Double getLongitude() {
159
		return longitude;
160
	}
161

  
162
	public void setLongitude(final Double longitude) {
163
		this.longitude = longitude;
164
	}
165

  
166
	public Double getTimezone() {
167
		return timezone;
168
	}
169

  
170
	public void setTimezone(final Double timezone) {
171
		this.timezone = timezone;
172
	}
173

  
174
	public String getNamespacePrefix() {
175
		return namespacePrefix;
176
	}
177

  
178
	public void setNamespacePrefix(final String namespacePrefix) {
179
		this.namespacePrefix = namespacePrefix;
180
	}
181

  
182
	public String getOdNumberOfItems() {
183
		return odNumberOfItems;
184
	}
185

  
186
	public void setOdNumberOfItems(final String odNumberOfItems) {
187
		this.odNumberOfItems = odNumberOfItems;
188
	}
189

  
190
	public String getOdNumberOfItemsDate() {
191
		return odNumberOfItemsDate;
192
	}
193

  
194
	public void setOdNumberOfItemsDate(final String odNumberOfItemsDate) {
195
		this.odNumberOfItemsDate = odNumberOfItemsDate;
196
	}
197

  
198
	public String getOdPolicies() {
199
		return odPolicies;
200
	}
201

  
202
	public void setOdPolicies(final String odPolicies) {
203
		this.odPolicies = odPolicies;
204
	}
205

  
206
	public String getOdLanguages() {
207
		return odLanguages;
208
	}
209

  
210
	public void setOdLanguages(final String odLanguages) {
211
		this.odLanguages = odLanguages;
212
	}
213

  
214
	public String getOdContentTypes() {
215
		return odContentTypes;
216
	}
217

  
218
	public void setOdContentTypes(final String odContentTypes) {
219
		this.odContentTypes = odContentTypes;
220
	}
221

  
222
	public String getCollectedFrom() {
223
		return collectedFrom;
224
	}
225

  
226
	public void setCollectedFrom(final String collectedFrom) {
227
		this.collectedFrom = collectedFrom;
228
	}
229

  
230
	public Boolean isInferred() {
231
		return inferred;
232
	}
233

  
234
	public void setInferred(final Boolean inferred) {
235
		this.inferred = inferred;
236
	}
237

  
238
	public Boolean isDeletedByInference() {
239
		return deletedByInference;
240
	}
241

  
242
	public void setDeletedByInference(final Boolean deletedByInference) {
243
		this.deletedByInference = deletedByInference;
244
	}
245

  
246
	public Double getTrust() {
247
		return trust;
248
	}
249

  
250
	public void setTrust(final Double trust) {
251
		this.trust = trust;
252
	}
253

  
254
	public String getInferenceProvenance() {
255
		return inferenceProvenance;
256
	}
257

  
258
	public void setInferenceProvenance(final String inferenceProvenance) {
259
		this.inferenceProvenance = inferenceProvenance;
260
	}
261

  
262
	public Date getDateOfValidation() {
263
		return dateOfValidation;
264
	}
265

  
266
	public void setDateOfValidation(final Date dateOfValidation) {
267
		this.dateOfValidation = dateOfValidation;
268
	}
269

  
270
	public String getDatasourceClass() {
271
		return datasourceClass;
272
	}
273

  
274
	public void setDatasourceClass(final String datasourceClass) {
275
		this.datasourceClass = datasourceClass;
276
	}
277

  
278
	public String getProvenanceActionClass() {
279
		return provenanceActionClass;
280
	}
281

  
282
	public void setProvenanceActionClass(final String provenanceActionClass) {
283
		this.provenanceActionClass = provenanceActionClass;
284
	}
285

  
286
	public Date getDateOfCollection() {
287
		return dateOfCollection;
288
	}
289

  
290
	public void setDateOfCollection(final Date dateOfCollection) {
291
		this.dateOfCollection = dateOfCollection;
292
	}
293

  
294
	public String getTypology() {
295
		return typology;
296
	}
297

  
298
	public void setTypology(final String typology) {
299
		this.typology = typology;
300
	}
301

  
302
	public String getActivationId() {
303
		return activationId;
304
	}
305

  
306
	public void setActivationId(final String activationId) {
307
		this.activationId = activationId;
308
	}
309

  
310
	public Boolean isMergehomonyms() {
311
		return mergehomonyms;
312
	}
313

  
314
	public void setMergehomonyms(final Boolean mergehomonyms) {
315
		this.mergehomonyms = mergehomonyms;
316
	}
317

  
318
	public String getDescription() {
319
		return description;
320
	}
321

  
322
	public void setDescription(final String description) {
323
		this.description = description;
324
	}
325

  
326
	public Date getReleaseStartDate() {
327
		return releaseStartDate;
328
	}
329

  
330
	public void setReleaseStartDate(final Date releaseStartDate) {
331
		this.releaseStartDate = releaseStartDate;
332
	}
333

  
334
	public Date getReleaseEndDate() {
335
		return releaseEndDate;
336
	}
337

  
338
	public void setReleaseEndDate(final Date releaseEndDate) {
339
		this.releaseEndDate = releaseEndDate;
340
	}
341

  
342
	public String getMissionStatementUrl() {
343
		return missionStatementUrl;
344
	}
345

  
346
	public void setMissionStatementUrl(final String missionStatementUrl) {
347
		this.missionStatementUrl = missionStatementUrl;
348
	}
349

  
350
	public Boolean isDataProvider() {
351
		return dataProvider;
352
	}
353

  
354
	public void setDataProvider(final Boolean dataProvider) {
355
		this.dataProvider = dataProvider;
356
	}
357

  
358
	public Boolean isServiceProvider() {
359
		return serviceProvider;
360
	}
361

  
362
	public void setServiceProvider(final Boolean serviceProvider) {
363
		this.serviceProvider = serviceProvider;
364
	}
365

  
366
	public String getDatabaseAccessType() {
367
		return databaseAccessType;
368
	}
369

  
370
	public void setDatabaseAccessType(final String databaseAccessType) {
371
		this.databaseAccessType = databaseAccessType;
372
	}
373

  
374
	public String getDataUploadType() {
375
		return dataUploadType;
376
	}
377

  
378
	public void setDataUploadType(final String dataUploadType) {
379
		this.dataUploadType = dataUploadType;
380
	}
381

  
382
	public String getDatabaseAccessRestriction() {
383
		return databaseAccessRestriction;
384
	}
385

  
386
	public void setDatabaseAccessRestriction(final String databaseAccessRestriction) {
387
		this.databaseAccessRestriction = databaseAccessRestriction;
388
	}
389

  
390
	public String getDataUploadRestriction() {
391
		return dataUploadRestriction;
392
	}
393

  
394
	public void setDataUploadRestriction(final String dataUploadRestriction) {
395
		this.dataUploadRestriction = dataUploadRestriction;
396
	}
397

  
398
	public Boolean isVersioning() {
399
		return versioning;
400
	}
401

  
402
	public void setVersioning(final Boolean versioning) {
403
		this.versioning = versioning;
404
	}
405

  
406
	public String getCitationGuidelineUrl() {
407
		return citationGuidelineUrl;
408
	}
409

  
410
	public void setCitationGuidelineUrl(final String citationGuidelineUrl) {
411
		this.citationGuidelineUrl = citationGuidelineUrl;
412
	}
413

  
414
	public String getQualityManagementKind() {
415
		return qualityManagementKind;
416
	}
417

  
418
	public void setQualityManagementKind(final String qualityManagementKind) {
419
		this.qualityManagementKind = qualityManagementKind;
420
	}
421

  
422
	public String getPidSystems() {
423
		return pidSystems;
424
	}
425

  
426
	public void setPidSystems(final String pidSystems) {
427
		this.pidSystems = pidSystems;
428
	}
429

  
430
	public String getCertificates() {
431
		return certificates;
432
	}
433

  
434
	public void setCertificates(final String certificates) {
435
		this.certificates = certificates;
436
	}
437

  
438
	public String getAggregator() {
439
		return aggregator;
440
	}
441

  
442
	public void setAggregator(final String aggregator) {
443
		this.aggregator = aggregator;
444
	}
445

  
446
	public String getIssn() {
447
		return issn;
448
	}
449

  
450
	public void setIssn(final String issn) {
451
		this.issn = issn;
452
	}
453

  
454
	public String getEissn() {
455
		return eissn;
456
	}
457

  
458
	public void setEissn(final String eissn) {
459
		this.eissn = eissn;
460
	}
461

  
462
	public String getLissn() {
463
		return lissn;
464
	}
465

  
466
	public void setLissn(final String lissn) {
467
		this.lissn = lissn;
468
	}
469

  
470
	public List<IfaceDesc> getInterfaces() {
471
		return interfaces;
472
	}
473

  
474
	public void setInterfaces(final List<IfaceDesc> interfaces) {
475
		this.interfaces = interfaces;
476
	}
477

  
478
	public String getRegisteredBy() {
479
		return registeredBy;
480
	}
481

  
482
	public void setRegisteredBy(final String registeredBy) {
483
		this.registeredBy = registeredBy;
484
	}
485

  
486
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/soap/exceptions/DatasourceManagerServiceException.java
1
package eu.dnetlib.rmi.soap.exceptions;
2

  
3
public class DatasourceManagerServiceException extends DnetSoapException {
4

  
5
	/**
6
	 * 
7
	 */
8
	private static final long serialVersionUID = -4976018444831853270L;
9

  
10
	public DatasourceManagerServiceException(final String string) {
11
		super(string);
12
	}
13

  
14
	public DatasourceManagerServiceException(final String string, final Throwable exception) {
15
		super(string, exception);
16
	}
17

  
18
	public DatasourceManagerServiceException(final Throwable exception) {
19
		super(exception);
20
	}
21

  
22
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/soap/DatasourceManagerService.java
1
package eu.dnetlib.rmi.soap;
2

  
3
import java.util.Date;
4
import java.util.List;
5
import java.util.Map;
6

  
7
import javax.jws.WebParam;
8
import javax.jws.WebService;
9

  
10
import eu.dnetlib.enabling.datastructures.Datasource;
11
import eu.dnetlib.rmi.objects.dsmanager.BrowsableField;
12
import eu.dnetlib.rmi.objects.dsmanager.BrowseTerm;
13
import eu.dnetlib.rmi.objects.dsmanager.IfaceDesc;
14
import eu.dnetlib.rmi.objects.dsmanager.RepositoryMapEntry;
15
import eu.dnetlib.rmi.objects.dsmanager.SearchInterfacesEntry;
16
import eu.dnetlib.rmi.objects.dsmanager.SimpleDatasourceDesc;
17
import eu.dnetlib.rmi.soap.exceptions.DatasourceManagerServiceException;
18

  
19
@WebService(targetNamespace = "http://services.dnetlib.eu/")
20
public interface DatasourceManagerService extends BaseService {
21

  
22
	/**
23
	 * Register a datasource.
24
	 * 
25
	 * @param ds
26
	 *            the new datasource
27
	 * @throws DatasourceManagerServiceException
28
	 */
29
	public boolean addDatasource(@WebParam(name = "ds") Datasource ds) throws DatasourceManagerServiceException;
30

  
31
	/**
32
	 * Delete a datasource.
33
	 * 
34
	 * @param dsId
35
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
36
	 * @throws DatasourceManagerServiceException
37
	 */
38
	public boolean deleteDatasource(@WebParam(name = "dsId") String dsId) throws DatasourceManagerServiceException;
39

  
40
	/**
41
	 * Returns a datasource.
42
	 * 
43
	 * @param dsId
44
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
45
	 * @throws DatasourceManagerServiceException
46
	 */
47
	public Datasource getDatasource(@WebParam(name = "dsId") String dsId) throws DatasourceManagerServiceException;
48

  
49
	/**
50
	 * Returns all the datasources.
51
	 * 
52
	 * @return a list of XML profiles
53
	 * @throws DatasourceManagerServiceException
54
	 */
55
	public List<Datasource> listAllDatasources() throws DatasourceManagerServiceException;
56

  
57
	/**
58
	 * Returns the datasources with some properties.
59
	 * 
60
	 * @param compliance
61
	 *            the level of compliance (or NULL to skip the test)
62
	 * @param fileManagementMode
63
	 *            the fileManagementMode property (or NULL to skip the test)
64
	 * @param contentDescription
65
	 *            the contentDescription property (or NULL to skip the test)
66
	 * @param iisProcessingWorkflow
67
	 *            the iisProcessingWorkflow property (or NULL to skip the test)
68
	 * @param collectedFrom
69
	 *            the collectedFrom property (or NULL to skip the test)
70
	 * @return a list of XML profiles
71
	 * @throws DatasourceManagerServiceException
72
	 */
73
	public List<Datasource> listDatasourcesUsingFilter(@WebParam(name = "compliance") String compliance,
74
			@WebParam(name = "contentDescription") String contentDescription,
75
			@WebParam(name = "iisProcessingWorkflow") String iisProcessingWorkflow,
76
			@WebParam(name = "collectedFrom") String collectedFrom) throws DatasourceManagerServiceException;
77

  
78
	/**
79
	 * updates the level of compliance of a api.
80
	 * 
81
	 * @param dsId
82
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
83
	 * @param ifaceId
84
	 *            the interface id
85
	 * @param level
86
	 *            the new level of compliance
87
	 * @return true if the operation ends successfully
88
	 * @throws DatasourceManagerServiceException
89
	 */
90
	public boolean updateLevelOfCompliance(@WebParam(name = "dsId") String dsId,
91
			@WebParam(name = "ifaceId") String ifaceId,
92
			@WebParam(name = "level") String level) throws DatasourceManagerServiceException;
93

  
94
	/**
95
	 * Override the level of compliance of a api.
96
	 * 
97
	 * @param dsId
98
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
99
	 * @param ifaceId
100
	 *            the interface id
101
	 * @param level
102
	 *            the new level of compliance
103
	 * @return true if the operation ends successfully
104
	 * @throws DatasourceManagerServiceException
105
	 */
106
	public boolean overrideCompliance(@WebParam(name = "dsId") String dsId,
107
			@WebParam(name = "ifaceId") String ifaceId,
108
			@WebParam(name = "level") String level) throws DatasourceManagerServiceException;
109

  
110
	/**
111
	 * update the baseUrl of an interface.
112
	 * 
113
	 * @param dsId
114
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
115
	 * @param ifaceId
116
	 *            the interface id
117
	 * @param baseUrl
118
	 *            the new value
119
	 * @return true if the operation ends successfully
120
	 * @throws DatasourceManagerServiceException
121
	 */
122
	public boolean updateBaseUrl(@WebParam(name = "dsId") String dsId, @WebParam(name = "ifaceId") String ifaceId, @WebParam(name = "baseUrl") String baseUrl)
123
			throws DatasourceManagerServiceException;
124

  
125
	/**
126
	 * update the activation status of an interface (true = there is a related wf).
127
	 * 
128
	 * @param dsId
129
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
130
	 * @param ifaceId
131
	 *            the interface id
132
	 * @param active
133
	 *            true if there is a related wf
134
	 * @return true if the operation ends successfully
135
	 * @throws DatasourceManagerServiceException
136
	 */
137
	public boolean updateActivationStatus(@WebParam(name = "dsId") String dsId,
138
			@WebParam(name = "ifaceId") String ifaceId,
139
			@WebParam(name = "active") boolean active) throws DatasourceManagerServiceException;
140

  
141
	/**
142
	 * update the "contentDescription" property of an interface.
143
	 * 
144
	 * @param dsId
145
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
146
	 * @param ifaceId
147
	 *            the interface id
148
	 * @param desc
149
	 *            the new value
150
	 * @return true if the operation ends successfully
151
	 * @throws DatasourceManagerServiceException
152
	 */
153
	public boolean updateContentDescription(@WebParam(name = "dsId") String dsId,
154
			@WebParam(name = "ifaceId") String ifaceId,
155
			@WebParam(name = "desc") String desc) throws DatasourceManagerServiceException;
156

  
157
	/**
158
	 * update the "iis_processing_workflow" property of an interface.
159
	 * 
160
	 * @param dsId
161
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
162
	 * @param ifaceId
163
	 *            the interface id
164
	 * @param wf
165
	 *            the new value
166
	 * @return true if the operation ends successfully
167
	 * @throws DatasourceManagerServiceException
168
	 */
169
	public boolean setIisProcessingWorkflow(@WebParam(name = "dsId") String dsId, @WebParam(name = "ifaceId") String ifaceId, @WebParam(name = "wf") String wf)
170
			throws DatasourceManagerServiceException;
171

  
172
	/**
173
	 * Set a generic extra field of an interface.
174
	 * 
175
	 * @param dsId
176
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
177
	 * @param ifaceId
178
	 *            the interface id
179
	 * @param field
180
	 *            the field name
181
	 * @param value
182
	 *            the new value (or null for removing it)
183
	 * @param preserveOriginal
184
	 *            preserve the original value in the DB (the value is stored in the "edited" column)
185
	 * @return true if the operation ends successfully
186
	 * @throws DatasourceManagerServiceException
187
	 */
188
	public boolean updateExtraField(@WebParam(name = "dsId") String dsId,
189
			@WebParam(name = "ifaceId") String ifaceId,
190
			@WebParam(name = "field") String field,
191
			@WebParam(name = "value") String value,
192
			@WebParam(name = "preserveOriginal") boolean preserveOriginal) throws DatasourceManagerServiceException;
193

  
194
	/**
195
	 * Update an access param of an interface.
196
	 * 
197
	 * @param dsId
198
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
199
	 * @param ifaceId
200
	 *            the interface id
201
	 * @param field
202
	 *            the field name
203
	 * @param value
204
	 *            the new value (or null for removing it)
205
	 * @param preserveOriginal
206
	 *            preserve the original value in the DB (the value is stored in the "edited" column)
207
	 * @return true if the operation ends successfully
208
	 * @throws DatasourceManagerServiceException
209
	 */
210
	public boolean updateAccessParam(@WebParam(name = "dsId") String dsId,
211
			@WebParam(name = "ifaceId") String ifaceId,
212
			@WebParam(name = "field") String field,
213
			@WebParam(name = "value") String value,
214
			@WebParam(name = "preserveOriginal") boolean preserveOriginal) throws DatasourceManagerServiceException;
215

  
216
	/**
217
	 * delete a generic extra field or an access param of an interface.
218
	 * 
219
	 * @param dsId
220
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
221
	 * @param ifaceId
222
	 *            the interface id
223
	 * @param field
224
	 *            the field name
225
	 * @return true if the operation ends successfully
226
	 * @throws DatasourceManagerServiceException
227
	 */
228
	public boolean deleteAccessParamOrExtraField(@WebParam(name = "dsId") String dsId,
229
			@WebParam(name = "ifaceId") String ifaceId,
230
			@WebParam(name = "field") String field) throws DatasourceManagerServiceException;
231

  
232
	/**
233
	 * Add an interface to a datasource.
234
	 * 
235
	 * @param dsId
236
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
237
	 * @param iface
238
	 *            the interface description
239
	 * @return true if the operation ends successfully
240
	 * @throws DatasourceManagerServiceException
241
	 */
242
	public boolean addInterface(@WebParam(name = "dsId") String dsId, @WebParam(name = "interface") IfaceDesc iface) throws DatasourceManagerServiceException;
243

  
244
	/**
245
	 * Delete the interface of a datasource.
246
	 * 
247
	 * @param dsId
248
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
249
	 * @param ifcId
250
	 *            the id of the interface
251
	 * @return true if the operation ends successfully
252
	 * @throws DatasourceManagerServiceException
253
	 */
254
	public boolean deleteInterface(@WebParam(name = "dsId") String dsId, @WebParam(name = "ifaceId") String ifaceId) throws DatasourceManagerServiceException;
255

  
256
	/**
257
	 * Perform a generic SQL update on a datasource.
258
	 * 
259
	 * @param dsId
260
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
261
	 * @param sql
262
	 *            the sql query to insert/update/delete the datasource
263
	 * @param delete
264
	 *            true if the profile must be deleted
265
	 * @return true if the operation ends successfully
266
	 * @throws DatasourceManagerServiceException
267
	 */
268
	public boolean updateSQL(@WebParam(name = "dsId") String dsId, @WebParam(name = "sql") String sql, @WebParam(name = "delete") boolean delete)
269
			throws DatasourceManagerServiceException;
270

  
271
	/**
272
	 * Calculate the next execution date of a related metaworkflow
273
	 * 
274
	 * @param dsId
275
	 *            the OpenAireDataSourceId (example: opendoar____::2101)
276
	 * @param ifcId
277
	 *            the id of the interface
278
	 * @return the date of the next scheduled execution (or null)
279
	 * @throws DatasourceManagerServiceException
280
	 */
281
	public Date findNextScheduledExecution(@WebParam(name = "dsId") String dsId, @WebParam(name = "ifaceId") String ifaceId)
282
			throws DatasourceManagerServiceException;
283

  
284
	public boolean bulkUpdateApiExtraFields(@WebParam(name = "dsId") String dsId,
285
			@WebParam(name = "ifaceId") String ifaceId,
286
			@WebParam(name = "fields") Map<String, String> fields) throws DatasourceManagerServiceException;
287

  
288
	public boolean bulkUpdateApiAccessParams(@WebParam(name = "dsId") String dsId,
289
			@WebParam(name = "ifaceId") String ifaceId,
290
			@WebParam(name = "params") Map<String, String> params) throws DatasourceManagerServiceException;
291

  
292
	public List<BrowsableField> listBrowsableFields() throws DatasourceManagerServiceException;
293

  
294
	public List<BrowseTerm> browseField(@WebParam(name = "field") final String field) throws DatasourceManagerServiceException;
295

  
296
	public List<SearchInterfacesEntry> searchInterface(@WebParam(name = "field") final String field, @WebParam(name = "value") final String value)
297
			throws DatasourceManagerServiceException;
298

  
299
	public List<RepositoryMapEntry> getRepositoryMap() throws DatasourceManagerServiceException;
300

  
301
	public List<SimpleDatasourceDesc> simpleListDatasourcesByType(@WebParam(name = "type") String type) throws DatasourceManagerServiceException;
302

  
303
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/objects/dsmanager/RepositoryMapEntry.java
1
package eu.dnetlib.rmi.objects.dsmanager;
2

  
3
import javax.xml.bind.annotation.XmlRootElement;
4

  
5
@XmlRootElement
6
public class RepositoryMapEntry {
7

  
8
	private String id;
9
	private String name;
10
	private float lat;
11
	private float lng;
12

  
13
	public RepositoryMapEntry() {}
14

  
15
	public RepositoryMapEntry(final String id, final String name, final float lat, final float lng) {
16
		this.id = id;
17
		this.name = name;
18
		this.lat = lat;
19
		this.lng = lng;
20
	}
21

  
22
	public String getId() {
23
		return id;
24
	}
25

  
26
	public void setId(final String id) {
27
		this.id = id;
28
	}
29

  
30
	public String getName() {
31
		return name;
32
	}
33

  
34
	public void setName(final String name) {
35
		this.name = name;
36
	}
37

  
38
	public float getLat() {
39
		return lat;
40
	}
41

  
42
	public void setLat(final float lat) {
43
		this.lat = lat;
44
	}
45

  
46
	public float getLng() {
47
		return lng;
48
	}
49

  
50
	public void setLng(final float lng) {
51
		this.lng = lng;
52
	}
53

  
54
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/objects/dsmanager/SimpleDatasourceDesc.java
1
package eu.dnetlib.rmi.objects.dsmanager;
2

  
3
import java.util.HashSet;
4
import java.util.Set;
5

  
6
import javax.xml.bind.annotation.XmlRootElement;
7

  
8
@XmlRootElement
9
public class SimpleDatasourceDesc implements Comparable<SimpleDatasourceDesc> {
10

  
11
	private String id;
12
	private String name;
13
	private String typology;
14
	private String origId;
15
	private Set<String> apis = new HashSet<String>();
16
	private boolean valid;
17

  
18
	public String getId() {
19
		return id;
20
	}
21

  
22
	public void setId(final String id) {
23
		this.id = id;
24
	}
25

  
26
	public String getName() {
27
		return name;
28
	}
29

  
30
	public void setName(final String name) {
31
		this.name = name;
32
	}
33

  
34
	public boolean isValid() {
35
		return valid;
36
	}
37

  
38
	public void setValid(final boolean valid) {
39
		this.valid = valid;
40
	}
41

  
42
	public String getTypology() {
43
		return typology;
44
	}
45

  
46
	public void setTypology(final String typology) {
47
		this.typology = typology;
48
	}
49

  
50
	public String getOrigId() {
51
		return origId;
52
	}
53

  
54
	public void setOrigId(final String origId) {
55
		this.origId = origId;
56
	}
57

  
58
	public Set<String> getApis() {
59
		return apis;
60
	}
61

  
62
	public void setApis(final Set<String> apis) {
63
		this.apis = apis;
64
	}
65

  
66
	@Override
67
	public int compareTo(final SimpleDatasourceDesc e) {
68
		return getName().compareTo(e.getName());
69
	}
70

  
71
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/objects/dsmanager/BrowsableField.java
1
package eu.dnetlib.rmi.objects.dsmanager;
2

  
3
import javax.xml.bind.annotation.XmlRootElement;
4

  
5
@XmlRootElement
6
public class BrowsableField {
7

  
8
	private String id;
9
	private String label;
10

  
11
	public BrowsableField() {}
12

  
13
	public BrowsableField(final String id, final String label) {
14
		this.id = id;
15
		this.label = label;
16
	}
17

  
18
	public String getId() {
19
		return id;
20
	}
21

  
22
	public void setId(final String id) {
23
		this.id = id;
24
	}
25

  
26
	public String getLabel() {
27
		return label;
28
	}
29

  
30
	public void setLabel(final String label) {
31
		this.label = label;
32
	}
33
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/objects/dsmanager/IfaceDesc.java
1
package eu.dnetlib.rmi.objects.dsmanager;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
import javax.xml.bind.annotation.XmlRootElement;
7

  
8
import eu.dnetlib.enabling.annotations.IndexedField;
9

  
10
@XmlRootElement
11
public class IfaceDesc {
12

  
13
	private String id;
14
	private String contentDescription;
15
	private String baseUrl;
16
	private boolean active = false;
17
	private boolean removable = false;
18

  
19
	@IndexedField(id = "type", label = "API typologies")
20
	private String typology;
21
	@IndexedField(id = "compliance", label = "API compatibility levels")
22
	private String compliance;
23
	@IndexedField(id = "protocol", label = "API protocols")
24
	private String accessProtocol;
25

  
26
	private Map<String, String> accessParams = new HashMap<String, String>();
27
	private Map<String, String> extraFields = new HashMap<String, String>();
28

  
29
	public IfaceDesc() {}
30

  
31
	public String getId() {
32
		return id;
33
	}
34

  
35
	public void setId(final String id) {
36
		this.id = id;
37
	}
38

  
39
	public String getTypology() {
40
		return typology;
41
	}
42

  
43
	public void setTypology(final String typology) {
44
		this.typology = typology;
45
	}
46

  
47
	public String getCompliance() {
48
		return compliance;
49
	}
50

  
51
	public void setCompliance(final String compliance) {
52
		this.compliance = compliance;
53
	}
54

  
55
	public String getContentDescription() {
56
		return contentDescription;
57
	}
58

  
59
	public void setContentDescription(final String contentDescription) {
60
		this.contentDescription = contentDescription;
61
	}
62

  
63
	public String getAccessProtocol() {
64
		return accessProtocol;
65
	}
66

  
67
	public void setAccessProtocol(final String accessProtocol) {
68
		this.accessProtocol = accessProtocol;
69
	}
70

  
71
	public String getBaseUrl() {
72
		return baseUrl;
73
	}
74

  
75
	public void setBaseUrl(final String baseUrl) {
76
		this.baseUrl = baseUrl;
77
	}
78

  
79
	public Map<String, String> getAccessParams() {
80
		return accessParams;
81
	}
82

  
83
	public void setAccessParams(final Map<String, String> accessParams) {
84
		this.accessParams = accessParams;
85
	}
86

  
87
	public Map<String, String> getExtraFields() {
88
		return extraFields;
89
	}
90

  
91
	public void setExtraFields(final Map<String, String> extraFields) {
92
		this.extraFields = extraFields;
93
	}
94

  
95
	public boolean getActive() {
96
		return active;
97
	}
98

  
99
	public void setActive(final boolean active) {
100
		this.active = active;
101
	}
102

  
103
	public boolean getRemovable() {
104
		return removable;
105
	}
106

  
107
	public void setRemovable(final boolean removable) {
108
		this.removable = removable;
109
	}
110

  
111
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/objects/dsmanager/DatasourceConstants.java
1
package eu.dnetlib.rmi.objects.dsmanager;
2

  
3
public class DatasourceConstants {
4

  
5
	public static final String DATASOURCE_TYPE = "Datasource";
6

  
7
	public static final String OVERRIDING_COMPLIANCE_FIELD = "overriding_compliance";
8
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/objects/dsmanager/BrowseTerm.java
1
package eu.dnetlib.rmi.objects.dsmanager;
2

  
3
import javax.xml.bind.annotation.XmlRootElement;
4

  
5
@XmlRootElement
6
public class BrowseTerm implements Comparable<BrowseTerm> {
7

  
8
	private String id;
9
	private String name;
10
	private int value;
11

  
12
	public BrowseTerm() {}
13

  
14
	public BrowseTerm(final String id, final String name, final int value) {
15
		this.id = id;
16
		this.name = name;
17
		this.value = value;
18
	}
19

  
20
	public String getId() {
21
		return id;
22
	}
23

  
24
	public void setId(final String id) {
25
		this.id = id;
26
	}
27

  
28
	public int getValue() {
29
		return value;
30
	}
31

  
32
	public void setValue(final int value) {
33
		this.value = value;
34
	}
35

  
36
	public String getName() {
37
		return name;
38
	}
39

  
40
	public void setName(final String name) {
41
		this.name = name;
42
	}
43

  
44
	@Override
45
	public int compareTo(final BrowseTerm o) {
46
		return Integer.compare(value, o.getValue());
47
	}
48
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/objects/dsmanager/SearchInterfacesEntry.java
1
package eu.dnetlib.rmi.objects.dsmanager;
2

  
3
import javax.xml.bind.annotation.XmlRootElement;
4

  
5
@XmlRootElement
6
public class SearchInterfacesEntry implements Comparable<SearchInterfacesEntry> {
7

  
8
	private String id;
9
	private String compliance;
10
	private String protocol;
11
	private boolean active;
12
	private String repoId = "unknown";
13
	private String repoName = "unknown";
14
	private String repoCountry = "-";
15
	private String repoPrefix = "";
16
	private String aggrDate = "";
17
	private int aggrTotal = 0;
18

  
19
	public SearchInterfacesEntry() {}
20

  
21
	public SearchInterfacesEntry(final String id, final String compliance, final String protocol, final boolean active, final String repoId,
22
			final String repoName, final String repoCountry,
23
			final String repoPrefix, final String aggrDate, final int aggrTotal) {
24
		this.id = id;
25
		this.compliance = compliance;
26
		this.protocol = protocol;
27
		this.active = active;
28
		this.repoId = repoId;
29
		this.repoName = repoName;
30
		this.repoCountry = repoCountry;
31
		this.repoPrefix = repoPrefix;
32
		this.aggrDate = aggrDate;
33
		this.aggrTotal = aggrTotal;
34
	}
35

  
36
	public String getId() {
37
		return id;
38
	}
39

  
40
	public void setId(final String id) {
41
		this.id = id;
42
	}
43

  
44
	public String getCompliance() {
45
		return compliance;
46
	}
47

  
48
	public void setCompliance(final String compliance) {
49
		this.compliance = compliance;
50
	}
51

  
52
	public boolean isActive() {
53
		return active;
54
	}
55

  
56
	public void setActive(final boolean active) {
57
		this.active = active;
58
	}
59

  
60
	public String getRepoId() {
61
		return repoId;
62
	}
63

  
64
	public void setRepoId(final String repoId) {
65
		this.repoId = repoId;
66
	}
67

  
68
	public String getRepoName() {
69
		return repoName;
70
	}
71

  
72
	public void setRepoName(final String repoName) {
73
		this.repoName = repoName;
74
	}
75

  
76
	public String getRepoCountry() {
77
		return repoCountry;
78
	}
79

  
80
	public void setRepoCountry(final String repoCountry) {
81
		this.repoCountry = repoCountry;
82
	}
83

  
84
	public String getRepoPrefix() {
85
		return repoPrefix;
86
	}
87

  
88
	public void setRepoPrefix(final String repoPrefix) {
89
		this.repoPrefix = repoPrefix;
90
	}
91

  
92
	@Override
93
	public int compareTo(final SearchInterfacesEntry e) {
94
		return compliance.compareTo(e.getCompliance());
95
	}
96

  
97
	public String getAggrDate() {
98
		return aggrDate;
99
	}
100

  
101
	public void setAggrDate(final String aggrDate) {
102
		this.aggrDate = aggrDate;
103
	}
104

  
105
	public int getAggrTotal() {
106
		return aggrTotal;
107
	}
108

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff