Revision 43444
Added by Sandro La Bruzzo over 7 years ago
ISClient.java | ||
---|---|---|
10 | 10 |
import com.google.common.collect.Iterables; |
11 | 11 |
import com.google.common.collect.Lists; |
12 | 12 |
import com.google.common.collect.Sets; |
13 |
|
|
14 | 13 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
15 | 14 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
16 | 15 |
import eu.dnetlib.rmi.data.hadoop.actionmanager.ActionManagerException; |
... | ... | |
21 | 20 |
import eu.dnetlib.rmi.enabling.ISLookUpService; |
22 | 21 |
import eu.dnetlib.rmi.enabling.ISRegistryException; |
23 | 22 |
import eu.dnetlib.rmi.enabling.ISRegistryService; |
24 |
import eu.dnetlib.soap.EndpointReferenceBuilder; |
|
25 | 23 |
import org.antlr.stringtemplate.StringTemplate; |
26 | 24 |
import org.apache.commons.logging.Log; |
27 | 25 |
import org.apache.commons.logging.LogFactory; |
... | ... | |
34 | 32 |
public class ISClient { |
35 | 33 |
|
36 | 34 |
private static final Log log = LogFactory.getLog(ISClient.class); // NOPMD by marko on 11/24/08 5:02 PM |
35 |
/** |
|
36 |
* endpoint builder. |
|
37 |
*/ |
|
38 |
private static final String ENDPOINT_TEMPLATE = "http://%s:%s/%s/services/actionManager"; |
|
37 | 39 |
@Resource |
38 | 40 |
private UniqueServiceLocator serviceLocator; |
39 | 41 |
/** |
... | ... | |
44 | 46 |
* service endpoint. |
45 | 47 |
*/ |
46 | 48 |
private Endpoint endpoint; |
47 |
/** |
|
48 |
* endpoint builder. |
|
49 |
*/ |
|
50 |
private EndpointReferenceBuilder<Endpoint> eprBuilder; |
|
49 |
private String hostname; |
|
50 |
private String port; |
|
51 |
private String context; |
|
51 | 52 |
|
52 | 53 |
public String registerSetProfile(final ActionManagerSet set) throws ActionManagerException { |
53 | 54 |
if (existsSet(set.getId())) { throw new ActionManagerException("Set " + set.getId() + " already registered"); } |
54 | 55 |
try { |
55 | 56 |
StringTemplate template = new StringTemplate(actionManagerSetDsTemplate.getTemplate()); |
56 |
template.setAttribute("serviceUri", eprBuilder.getAddress(endpoint));
|
|
57 |
template.setAttribute("serviceUri", String.format(ENDPOINT_TEMPLATE, hostname, port, context));
|
|
57 | 58 |
template.setAttribute("set", set); |
58 | 59 |
template.setAttribute("latest", RawSet.newInstance()); |
59 | 60 |
return serviceLocator.getService(ISRegistryService.class).registerProfile(template.toString()); |
... | ... | |
284 | 285 |
this.endpoint = endpoint; |
285 | 286 |
} |
286 | 287 |
|
287 |
public EndpointReferenceBuilder<Endpoint> getEprBuilder() {
|
|
288 |
return eprBuilder;
|
|
288 |
public String getHostname() {
|
|
289 |
return hostname;
|
|
289 | 290 |
} |
290 | 291 |
|
291 | 292 |
@Required |
292 |
public void setEprBuilder(final EndpointReferenceBuilder<Endpoint> eprBuilder) {
|
|
293 |
this.eprBuilder = eprBuilder;
|
|
293 |
public void setHostname(final String hostname) {
|
|
294 |
this.hostname = hostname;
|
|
294 | 295 |
} |
295 | 296 |
|
297 |
public String getPort() { |
|
298 |
return port; |
|
299 |
} |
|
300 |
|
|
301 |
@Required |
|
302 |
public void setPort(final String port) { |
|
303 |
this.port = port; |
|
304 |
} |
|
305 |
|
|
306 |
public String getContext() { |
|
307 |
return context; |
|
308 |
} |
|
309 |
|
|
310 |
@Required |
|
311 |
public void setContext(final String context) { |
|
312 |
this.context = context; |
|
313 |
} |
|
296 | 314 |
} |
Also available in: Unified diff
Added workflows for entity registy