1 |
26600
|
sandro.lab
|
package eu.dnetlib.msro.workflows.metawf;
|
2 |
|
|
|
3 |
|
|
import java.io.IOException;
|
4 |
|
|
import java.io.StringWriter;
|
5 |
|
|
import java.util.Map;
|
6 |
|
|
|
7 |
|
|
import org.springframework.beans.factory.annotation.Required;
|
8 |
|
|
import org.springframework.core.io.Resource;
|
9 |
|
|
|
10 |
|
|
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryException;
|
11 |
|
|
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
|
12 |
32639
|
michele.ar
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
13 |
26600
|
sandro.lab
|
|
14 |
|
|
public class DatasourceMetaWorkflow {
|
15 |
|
|
|
16 |
|
|
private WorkflowTree tree;
|
17 |
|
|
|
18 |
|
|
private Resource destroyWorkflowTemplate;
|
19 |
|
|
|
20 |
32639
|
michele.ar
|
@javax.annotation.Resource
|
21 |
|
|
private UniqueServiceLocator serviceLocator;
|
22 |
26600
|
sandro.lab
|
|
23 |
|
|
public int registerAllWorkflows(final Map<String, String> params) throws ISRegistryException, IOException {
|
24 |
|
|
return tree.registerAllWorkflows(params);
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
public String registerDestroyWorkflow(final Map<String, String> params) throws ISRegistryException, IOException {
|
28 |
|
|
final String profile = WorkflowProfileCreator.generateProfile("Repo BYE", "REPO_BYE", params, destroyWorkflowTemplate);
|
29 |
32639
|
michele.ar
|
return serviceLocator.getService(ISRegistryService.class).registerProfile(profile);
|
30 |
26600
|
sandro.lab
|
}
|
31 |
|
|
|
32 |
|
|
public String asXML() {
|
33 |
|
|
final StringWriter sw = new StringWriter();
|
34 |
|
|
tree.populateMetaWfXml(sw);
|
35 |
|
|
return sw.toString();
|
36 |
|
|
}
|
37 |
|
|
|
38 |
|
|
public WorkflowTree getTree() {
|
39 |
|
|
return tree;
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
@Required
|
43 |
|
|
public void setTree(final WorkflowTree tree) {
|
44 |
|
|
this.tree = tree;
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
public Resource getDestroyWorkflowTemplate() {
|
48 |
|
|
return destroyWorkflowTemplate;
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
@Required
|
52 |
|
|
public void setDestroyWorkflowTemplate(final Resource destroyWorkflowTemplate) {
|
53 |
|
|
this.destroyWorkflowTemplate = destroyWorkflowTemplate;
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
}
|