1
|
package eu.dnetlib.data.objectstore.modular;
|
2
|
|
3
|
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryException;
|
4
|
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
|
5
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
6
|
import eu.dnetlib.soap.EndpointReferenceBuilder;
|
7
|
import org.antlr.stringtemplate.StringTemplate;
|
8
|
import org.springframework.beans.factory.annotation.Required;
|
9
|
|
10
|
import javax.xml.ws.Endpoint;
|
11
|
|
12
|
// TODO: Auto-generated Javadoc
|
13
|
|
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
|
* objectstore 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 the interpretation
|
43
|
* @return the string
|
44
|
* @throws ISRegistryException the IS registry exception
|
45
|
*/
|
46
|
public String registerProfile(final String interpretation)
|
47
|
throws ISRegistryException {
|
48
|
// XXX: mini hack
|
49
|
StringTemplate template = new StringTemplate(
|
50
|
objectstoreDsTemplate.getTemplate());
|
51
|
template.setAttribute("serviceUri", eprBuilder.getAddress(endpoint));
|
52
|
template.setAttribute("interpretation", interpretation);
|
53
|
|
54
|
return serviceLocator.getService(ISRegistryService.class, true).registerProfile(template.toString());
|
55
|
}
|
56
|
|
57
|
public void deleteProfile(final String profileId) throws ISRegistryException {
|
58
|
serviceLocator.getService(ISRegistryService.class).deleteProfile(profileId);
|
59
|
}
|
60
|
|
61
|
/**
|
62
|
* Gets the endpoint.
|
63
|
*
|
64
|
* @return the endpoint
|
65
|
*/
|
66
|
public Endpoint getEndpoint() {
|
67
|
return endpoint;
|
68
|
}
|
69
|
|
70
|
/**
|
71
|
* Sets the endpoint.
|
72
|
*
|
73
|
* @param endpoint the new endpoint
|
74
|
*/
|
75
|
@Required
|
76
|
public void setEndpoint(final Endpoint endpoint) {
|
77
|
this.endpoint = endpoint;
|
78
|
}
|
79
|
|
80
|
/**
|
81
|
* Gets the epr builder.
|
82
|
*
|
83
|
* @return the epr builder
|
84
|
*/
|
85
|
public EndpointReferenceBuilder<Endpoint> getEprBuilder() {
|
86
|
return eprBuilder;
|
87
|
}
|
88
|
|
89
|
/**
|
90
|
* Sets the epr builder.
|
91
|
*
|
92
|
* @param eprBuilder 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 the new objectstore ds template
|
112
|
*/
|
113
|
@Required
|
114
|
public void setObjectstoreDsTemplate(final StringTemplate objectstoreDsTemplate) {
|
115
|
this.objectstoreDsTemplate = objectstoreDsTemplate;
|
116
|
}
|
117
|
|
118
|
public UniqueServiceLocator getServiceLocator() {
|
119
|
return serviceLocator;
|
120
|
}
|
121
|
|
122
|
@Required
|
123
|
public void setServiceLocator(final UniqueServiceLocator serviceLocator) {
|
124
|
this.serviceLocator = serviceLocator;
|
125
|
}
|
126
|
|
127
|
}
|