Revision 50488
Added by Michele Artini about 6 years ago
DeleteMetaWfJobNode.java | ||
---|---|---|
3 | 3 |
import java.io.StringReader; |
4 | 4 |
import java.io.StringWriter; |
5 | 5 |
|
6 |
import javax.annotation.Resource; |
|
7 |
|
|
8 | 6 |
import org.apache.commons.logging.Log; |
9 | 7 |
import org.apache.commons.logging.LogFactory; |
10 | 8 |
import org.dom4j.Document; |
11 | 9 |
import org.dom4j.Node; |
12 | 10 |
import org.dom4j.io.SAXReader; |
11 |
import org.springframework.beans.factory.annotation.Autowired; |
|
13 | 12 |
|
14 | 13 |
import com.googlecode.sarasvati.Arc; |
15 | 14 |
import com.googlecode.sarasvati.NodeToken; |
16 | 15 |
|
16 |
import eu.dnetlib.enabling.datasources.common.Api; |
|
17 |
import eu.dnetlib.enabling.datasources.common.Datasource; |
|
18 |
import eu.dnetlib.enabling.datasources.common.LocalDatasourceManager; |
|
17 | 19 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
18 | 20 |
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService; |
19 | 21 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
... | ... | |
24 | 26 |
|
25 | 27 |
private String metaWfId; |
26 | 28 |
|
27 |
@Resource
|
|
29 |
@Autowired
|
|
28 | 30 |
private UniqueServiceLocator serviceLocator; |
29 | 31 |
|
32 |
@Autowired |
|
33 |
private LocalDatasourceManager<Datasource<?, ?>, Api<?>> dsManager; |
|
34 |
|
|
30 | 35 |
private static final Log log = LogFactory.getLog(DeleteMetaWfJobNode.class); |
31 | 36 |
|
32 | 37 |
@Override |
... | ... | |
47 | 52 |
|
48 | 53 |
final ISRegistryService registry = serviceLocator.getService(ISRegistryService.class); |
49 | 54 |
|
50 |
for (Object o : doc.selectNodes("//WORKFLOW")) { |
|
55 |
for (final Object o : doc.selectNodes("//WORKFLOW")) {
|
|
51 | 56 |
final String wfId = ((Node) o).valueOf("@id"); |
52 | 57 |
try { |
53 | 58 |
registry.deleteProfile(wfId); |
54 | 59 |
log.info(" - Deleted Workflow: " + wfId); |
55 |
} catch (Exception e) { |
|
60 |
} catch (final Exception e) {
|
|
56 | 61 |
log.error(" - (ERR) Error deleting profile " + wfId); |
57 | 62 |
} |
58 | 63 |
} |
... | ... | |
80 | 85 |
|
81 | 86 |
log.info(" - Updating iface, active status: " + active); |
82 | 87 |
|
83 |
updateIfaceActivationStatus(dsId, ifaceId, active);
|
|
88 |
setActivationStatus(dsId, ifaceId, active);
|
|
84 | 89 |
} |
85 | 90 |
|
86 |
protected void updateIfaceActivationStatus(final String dsId, final String ifaceId, final boolean active) throws Exception {
|
|
87 |
serviceLocator.getService(ISRegistryService.class).updateProfileNode(dsId, "//INTERFACE[@id = '" + ifaceId + "']/@active", "'" + active + "'");
|
|
91 |
protected void setActivationStatus(final String dsId, final String ifaceId, final boolean active) throws Exception {
|
|
92 |
dsManager.setActive(dsId, ifaceId, active);
|
|
88 | 93 |
} |
89 | 94 |
|
90 | 95 |
public String getMetaWfId() { |
Also available in: Unified diff
merged branch dsm into trunk