1 |
26600
|
sandro.lab
|
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 |
32541
|
michele.ar
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
6 |
26600
|
sandro.lab
|
import eu.dnetlib.soap.EndpointReferenceBuilder;
|
7 |
39421
|
sandro.lab
|
import org.antlr.stringtemplate.StringTemplate;
|
8 |
|
|
import org.springframework.beans.factory.annotation.Required;
|
9 |
26600
|
sandro.lab
|
|
10 |
39421
|
sandro.lab
|
import javax.xml.ws.Endpoint;
|
11 |
|
|
|
12 |
26600
|
sandro.lab
|
// TODO: Auto-generated Javadoc
|
13 |
39421
|
sandro.lab
|
|
14 |
26600
|
sandro.lab
|
/**
|
15 |
|
|
* The Class ObjectStoreProfileCreator is responsible of creating profile of the ObjectStore
|
16 |
|
|
*/
|
17 |
|
|
public class ObjectStoreProfileCreator {
|
18 |
|
|
|
19 |
40045
|
sandro.lab
|
/**
|
20 |
|
|
* service locator.
|
21 |
|
|
*/
|
22 |
|
|
private UniqueServiceLocator serviceLocator;
|
23 |
26600
|
sandro.lab
|
|
24 |
40045
|
sandro.lab
|
/**
|
25 |
|
|
* objectstore ds template.
|
26 |
|
|
*/
|
27 |
|
|
private StringTemplate objectstoreDsTemplate;
|
28 |
26600
|
sandro.lab
|
|
29 |
40045
|
sandro.lab
|
/**
|
30 |
|
|
* service endpoint.
|
31 |
|
|
*/
|
32 |
|
|
private Endpoint endpoint;
|
33 |
26600
|
sandro.lab
|
|
34 |
40045
|
sandro.lab
|
/**
|
35 |
|
|
* endpoint builder.
|
36 |
|
|
*/
|
37 |
|
|
private EndpointReferenceBuilder<Endpoint> eprBuilder;
|
38 |
26600
|
sandro.lab
|
|
39 |
40045
|
sandro.lab
|
/**
|
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 |
26600
|
sandro.lab
|
|
54 |
40045
|
sandro.lab
|
return serviceLocator.getService(ISRegistryService.class, true).registerProfile(template.toString());
|
55 |
|
|
}
|
56 |
26600
|
sandro.lab
|
|
57 |
42551
|
claudio.at
|
public void deleteProfile(final String profileId) throws ISRegistryException {
|
58 |
|
|
serviceLocator.getService(ISRegistryService.class).deleteProfile(profileId);
|
59 |
|
|
}
|
60 |
|
|
|
61 |
40045
|
sandro.lab
|
/**
|
62 |
|
|
* Gets the endpoint.
|
63 |
|
|
*
|
64 |
|
|
* @return the endpoint
|
65 |
|
|
*/
|
66 |
|
|
public Endpoint getEndpoint() {
|
67 |
|
|
return endpoint;
|
68 |
|
|
}
|
69 |
26600
|
sandro.lab
|
|
70 |
40045
|
sandro.lab
|
/**
|
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 |
26600
|
sandro.lab
|
|
80 |
40045
|
sandro.lab
|
/**
|
81 |
|
|
* Gets the epr builder.
|
82 |
|
|
*
|
83 |
|
|
* @return the epr builder
|
84 |
|
|
*/
|
85 |
|
|
public EndpointReferenceBuilder<Endpoint> getEprBuilder() {
|
86 |
|
|
return eprBuilder;
|
87 |
|
|
}
|
88 |
26600
|
sandro.lab
|
|
89 |
40045
|
sandro.lab
|
/**
|
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 |
26600
|
sandro.lab
|
|
99 |
40045
|
sandro.lab
|
/**
|
100 |
|
|
* Gets the objectstore ds template.
|
101 |
|
|
*
|
102 |
|
|
* @return the objectstore ds template
|
103 |
|
|
*/
|
104 |
|
|
public StringTemplate getObjectstoreDsTemplate() {
|
105 |
|
|
return objectstoreDsTemplate;
|
106 |
|
|
}
|
107 |
26600
|
sandro.lab
|
|
108 |
40045
|
sandro.lab
|
/**
|
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 |
26600
|
sandro.lab
|
|
118 |
40045
|
sandro.lab
|
public UniqueServiceLocator getServiceLocator() {
|
119 |
|
|
return serviceLocator;
|
120 |
|
|
}
|
121 |
32541
|
michele.ar
|
|
122 |
40045
|
sandro.lab
|
@Required
|
123 |
|
|
public void setServiceLocator(final UniqueServiceLocator serviceLocator) {
|
124 |
|
|
this.serviceLocator = serviceLocator;
|
125 |
|
|
}
|
126 |
32541
|
michele.ar
|
|
127 |
26600
|
sandro.lab
|
}
|