Revision 36564
Added by Michele Artini over 9 years ago
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/repohi/CreateObjectStoreJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.worker.nodes.repohi; |
|
2 |
|
|
3 |
import java.util.Map; |
|
4 |
|
|
5 |
import org.apache.commons.logging.Log; |
|
6 |
import org.apache.commons.logging.LogFactory; |
|
7 |
|
|
8 |
import com.googlecode.sarasvati.Engine; |
|
9 |
import com.googlecode.sarasvati.NodeToken; |
|
10 |
import com.googlecode.sarasvati.env.Env; |
|
11 |
|
|
12 |
import eu.dnetlib.data.objectstore.rmi.ObjectStoreService; |
|
13 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
14 |
import eu.dnetlib.msro.worker.nodes.BlackboardJobNode; |
|
15 |
import eu.dnetlib.msro.worker.nodes.blackboard.BlackboardWorkflowJobListener; |
|
16 |
|
|
17 |
public class CreateObjectStoreJobNode extends BlackboardJobNode { |
|
18 |
|
|
19 |
private static final Log log = LogFactory.getLog(CreateObjectStoreJobNode.class); |
|
20 |
|
|
21 |
private String interpretation; |
|
22 |
private String outputPrefix = "objectStore_"; |
|
23 |
|
|
24 |
@Override |
|
25 |
protected String obtainServiceId(final NodeToken token) { |
|
26 |
return getServiceLocator().getServiceId(ObjectStoreService.class); |
|
27 |
} |
|
28 |
|
|
29 |
@Override |
|
30 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) { |
|
31 |
log.info("preparing blackboard job for the creation of the objectStore "); |
|
32 |
job.setAction("CREATE"); |
|
33 |
job.getParameters().put("interpretation", interpretation); |
|
34 |
} |
|
35 |
|
|
36 |
public String getInterpretation() { |
|
37 |
return interpretation; |
|
38 |
} |
|
39 |
|
|
40 |
public void setInterpretation(final String interpretation) { |
|
41 |
this.interpretation = interpretation; |
|
42 |
} |
|
43 |
|
|
44 |
public String getOutputPrefix() { |
|
45 |
return outputPrefix; |
|
46 |
} |
|
47 |
|
|
48 |
public void setOutputPrefix(final String outputPrefix) { |
|
49 |
this.outputPrefix = outputPrefix; |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
protected BlackboardWorkflowJobListener generateBlackboardListener(final Engine engine, final NodeToken token) { |
|
54 |
return new BlackboardWorkflowJobListener(engine, token) { |
|
55 |
|
|
56 |
@Override |
|
57 |
protected void populateEnv(final Env env, final Map<String, String> responseParams) { |
|
58 |
; |
|
59 |
env.setAttribute(getOutputPrefix() + "interpretation", interpretation); |
|
60 |
env.setAttribute(getOutputPrefix() + "id", responseParams.get("objectStoreId")); |
|
61 |
} |
|
62 |
}; |
|
63 |
} |
|
64 |
|
|
65 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/repohi/CreateMDStoreJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.worker.nodes.repohi; |
|
2 |
|
|
3 |
import java.util.Map; |
|
4 |
|
|
5 |
import org.apache.commons.logging.Log; |
|
6 |
import org.apache.commons.logging.LogFactory; |
|
7 |
|
|
8 |
import com.googlecode.sarasvati.Engine; |
|
9 |
import com.googlecode.sarasvati.NodeToken; |
|
10 |
import com.googlecode.sarasvati.env.Env; |
|
11 |
|
|
12 |
import eu.dnetlib.data.mdstore.MDStoreService; |
|
13 |
import eu.dnetlib.enabling.locators.comparators.HandledDatastructuresComparator; |
|
14 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
15 |
import eu.dnetlib.msro.worker.nodes.BlackboardJobNode; |
|
16 |
import eu.dnetlib.msro.worker.nodes.blackboard.BlackboardWorkflowJobListener; |
|
17 |
|
|
18 |
public class CreateMDStoreJobNode extends BlackboardJobNode { |
|
19 |
|
|
20 |
private static final Log log = LogFactory.getLog(CreateMDStoreJobNode.class); |
|
21 |
|
|
22 |
private String format; |
|
23 |
private String layout; |
|
24 |
private String interpretation; |
|
25 |
private String outputPrefix = "mdstore"; |
|
26 |
|
|
27 |
@Override |
|
28 |
protected String obtainServiceId(final NodeToken token) { |
|
29 |
return getServiceLocator().getServiceId(MDStoreService.class, new HandledDatastructuresComparator()); |
|
30 |
} |
|
31 |
|
|
32 |
@Override |
|
33 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) { |
|
34 |
log.info("preparing blackboard job: " + getFormat()); |
|
35 |
|
|
36 |
job.setAction("CREATE"); |
|
37 |
job.getParameters().put("format", getFormat()); |
|
38 |
job.getParameters().put("interpretation", getInterpretation()); |
|
39 |
job.getParameters().put("layout", getLayout()); |
|
40 |
} |
|
41 |
|
|
42 |
public String getFormat() { |
|
43 |
return format; |
|
44 |
} |
|
45 |
|
|
46 |
public void setFormat(final String format) { |
|
47 |
this.format = format; |
|
48 |
} |
|
49 |
|
|
50 |
public String getInterpretation() { |
|
51 |
return interpretation; |
|
52 |
} |
|
53 |
|
|
54 |
public void setInterpretation(final String interpretation) { |
|
55 |
this.interpretation = interpretation; |
|
56 |
} |
|
57 |
|
|
58 |
public String getLayout() { |
|
59 |
return layout; |
|
60 |
} |
|
61 |
|
|
62 |
public void setLayout(final String layout) { |
|
63 |
this.layout = layout; |
|
64 |
} |
|
65 |
|
|
66 |
public String getOutputPrefix() { |
|
67 |
return outputPrefix; |
|
68 |
} |
|
69 |
|
|
70 |
public void setOutputPrefix(final String outputPrefix) { |
|
71 |
this.outputPrefix = outputPrefix; |
|
72 |
} |
|
73 |
|
|
74 |
@Override |
|
75 |
protected BlackboardWorkflowJobListener generateBlackboardListener(final Engine engine, final NodeToken token) { |
|
76 |
return new BlackboardWorkflowJobListener(engine, token) { |
|
77 |
|
|
78 |
@Override |
|
79 |
protected void populateEnv(final Env env, final Map<String, String> responseParams) { |
|
80 |
env.setAttribute(getOutputPrefix() + "format", format); |
|
81 |
env.setAttribute(getOutputPrefix() + "layout", layout); |
|
82 |
env.setAttribute(getOutputPrefix() + "interpretation", interpretation); |
|
83 |
env.setAttribute(getOutputPrefix() + "id", responseParams.get("id")); |
|
84 |
} |
|
85 |
}; |
|
86 |
} |
|
87 |
|
|
88 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/repobye/DeleteObjectStoreJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.worker.nodes.repobye; |
|
2 |
|
|
3 |
import org.apache.commons.logging.Log; |
|
4 |
import org.apache.commons.logging.LogFactory; |
|
5 |
|
|
6 |
import com.googlecode.sarasvati.NodeToken; |
|
7 |
|
|
8 |
import eu.dnetlib.data.objectstore.rmi.ObjectStoreService; |
|
9 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
10 |
import eu.dnetlib.msro.worker.nodes.BlackboardJobNode; |
|
11 |
|
|
12 |
public class DeleteObjectStoreJobNode extends BlackboardJobNode { |
|
13 |
|
|
14 |
private static final Log log = LogFactory.getLog(DeleteObjectStoreJobNode.class); |
|
15 |
|
|
16 |
private String objectstoreId; |
|
17 |
|
|
18 |
@Override |
|
19 |
protected String obtainServiceId(final NodeToken token) { |
|
20 |
return getServiceLocator().getServiceId(ObjectStoreService.class); |
|
21 |
} |
|
22 |
|
|
23 |
@Override |
|
24 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) throws Exception { |
|
25 |
log.info("preparing blackboard job: delete of mdstore " + getObjectstoreId()); |
|
26 |
job.setAction("DELETE"); |
|
27 |
job.getParameters().put("obsID", getObjectstoreId()); |
|
28 |
} |
|
29 |
|
|
30 |
/** |
|
31 |
* @return the objectstoreId |
|
32 |
*/ |
|
33 |
public String getObjectstoreId() { |
|
34 |
return objectstoreId; |
|
35 |
} |
|
36 |
|
|
37 |
/** |
|
38 |
* @param objectstoreId |
|
39 |
* the objectstoreId to set |
|
40 |
*/ |
|
41 |
public void setObjectstoreId(final String objectstoreId) { |
|
42 |
this.objectstoreId = objectstoreId; |
|
43 |
} |
|
44 |
|
|
45 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/repobye/DeleteMDStoreJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.worker.nodes.repobye; |
|
2 |
|
|
3 |
import org.apache.commons.logging.Log; |
|
4 |
import org.apache.commons.logging.LogFactory; |
|
5 |
|
|
6 |
import com.googlecode.sarasvati.NodeToken; |
|
7 |
|
|
8 |
import eu.dnetlib.data.mdstore.MDStoreService; |
|
9 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
10 |
import eu.dnetlib.msro.worker.nodes.BlackboardJobNode; |
|
11 |
|
|
12 |
public class DeleteMDStoreJobNode extends BlackboardJobNode { |
|
13 |
|
|
14 |
private static final Log log = LogFactory.getLog(DeleteMDStoreJobNode.class); |
|
15 |
|
|
16 |
private String mdstoreId; |
|
17 |
|
|
18 |
@Override |
|
19 |
protected String obtainServiceId(final NodeToken token) { |
|
20 |
return getServiceLocator().getServiceId(MDStoreService.class, mdstoreId); |
|
21 |
} |
|
22 |
|
|
23 |
@Override |
|
24 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) { |
|
25 |
log.info("preparing blackboard job: delete of mdstore " + getMdstoreId()); |
|
26 |
job.setAction("DELETE"); |
|
27 |
job.getParameters().put("id", getMdstoreId()); |
|
28 |
} |
|
29 |
|
|
30 |
public String getMdstoreId() { |
|
31 |
return mdstoreId; |
|
32 |
} |
|
33 |
|
|
34 |
public void setMdstoreId(final String mdstoreId) { |
|
35 |
this.mdstoreId = mdstoreId; |
|
36 |
} |
|
37 |
|
|
38 |
} |
modules/dnet-components/trunk/src/main/java/eu/dnetlib/enabling/datastructures/ObjectStore.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.datastructures; |
|
2 |
|
|
3 |
import java.util.Date; |
|
4 |
|
|
5 |
import javax.xml.bind.annotation.XmlRootElement; |
|
6 |
|
|
7 |
import eu.dnetlib.enabling.annotations.DnetResource; |
|
8 |
import eu.dnetlib.rmi.objects.is.DnetResourceFormat; |
|
9 |
import eu.dnetlib.rmi.objects.is.DnetResourceKind; |
|
10 |
|
|
11 |
@XmlRootElement |
|
12 |
@DnetResource(type = "ObjectStore", kind = DnetResourceKind.UNIT, format = DnetResourceFormat.JSON) |
|
13 |
public class ObjectStore { |
|
14 |
|
|
15 |
private int size; |
|
16 |
private Date lastUpdate; |
|
17 |
|
|
18 |
public int getSize() { |
|
19 |
return size; |
|
20 |
} |
|
21 |
|
|
22 |
public void setSize(final int size) { |
|
23 |
this.size = size; |
|
24 |
} |
|
25 |
|
|
26 |
public Date getLastUpdate() { |
|
27 |
return lastUpdate; |
|
28 |
} |
|
29 |
|
|
30 |
public void setLastUpdate(final Date lastUpdate) { |
|
31 |
this.lastUpdate = lastUpdate; |
|
32 |
} |
|
33 |
|
|
34 |
} |
modules/dnet-components/trunk/src/main/java/eu/dnetlib/enabling/datastructures/MDStore.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.datastructures; |
|
2 |
|
|
3 |
import java.util.Date; |
|
4 |
|
|
5 |
import javax.xml.bind.annotation.XmlRootElement; |
|
6 |
|
|
7 |
import eu.dnetlib.enabling.annotations.DnetResource; |
|
8 |
import eu.dnetlib.rmi.objects.is.DnetResourceFormat; |
|
9 |
import eu.dnetlib.rmi.objects.is.DnetResourceKind; |
|
10 |
|
|
11 |
@XmlRootElement |
|
12 |
@DnetResource(type = "MDStore", kind = DnetResourceKind.UNIT, format = DnetResourceFormat.JSON) |
|
13 |
public class MDStore { |
|
14 |
|
|
15 |
private int size; |
|
16 |
private Date lastUpdate; |
|
17 |
|
|
18 |
public int getSize() { |
|
19 |
return size; |
|
20 |
} |
|
21 |
|
|
22 |
public void setSize(final int size) { |
|
23 |
this.size = size; |
|
24 |
} |
|
25 |
|
|
26 |
public Date getLastUpdate() { |
|
27 |
return lastUpdate; |
|
28 |
} |
|
29 |
|
|
30 |
public void setLastUpdate(final Date lastUpdate) { |
|
31 |
this.lastUpdate = lastUpdate; |
|
32 |
} |
|
33 |
|
|
34 |
} |
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/soap/MDStoreService.java | ||
---|---|---|
1 |
package eu.dnetlib.rmi.soap; |
|
2 |
|
|
3 |
import javax.jws.WebService; |
|
4 |
|
|
5 |
@WebService(targetNamespace = "http://services.dnetlib.eu/") |
|
6 |
public interface MDStoreService extends BaseService { |
|
7 |
|
|
8 |
} |
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/blackboard/DeleteMDStoreMessage.java | ||
---|---|---|
1 |
package eu.dnetlib.rmi.blackboard; |
|
2 |
|
|
3 |
import eu.dnetlib.enabling.annotations.Blackboard; |
|
4 |
import eu.dnetlib.rmi.soap.MDStoreService; |
|
5 |
|
|
6 |
@Blackboard(action = "DELETE", serviceClass = MDStoreService.class) |
|
7 |
public class DeleteMDStoreMessage { |
|
8 |
|
|
9 |
private String id; |
|
10 |
|
|
11 |
public DeleteMDStoreMessage(final String id) { |
|
12 |
this.id = id; |
|
13 |
} |
|
14 |
|
|
15 |
public String getId() { |
|
16 |
return id; |
|
17 |
} |
|
18 |
|
|
19 |
public void setId(final String id) { |
|
20 |
this.id = id; |
|
21 |
} |
|
22 |
} |
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/blackboard/CreateMDStoreMessage.java | ||
---|---|---|
1 |
package eu.dnetlib.rmi.blackboard; |
|
2 |
|
|
3 |
import eu.dnetlib.enabling.annotations.Blackboard; |
|
4 |
import eu.dnetlib.rmi.soap.MDStoreService; |
|
5 |
|
|
6 |
@Blackboard(action = "CREATE", serviceClass = MDStoreService.class) |
|
7 |
public class CreateMDStoreMessage { |
|
8 |
|
|
9 |
private String id; |
|
10 |
private String format; |
|
11 |
private String layout; |
|
12 |
private String interpretation; |
|
13 |
|
|
14 |
public CreateMDStoreMessage() {} |
|
15 |
|
|
16 |
public CreateMDStoreMessage(final String format, final String layout, final String interpretation) { |
|
17 |
this(null, format, layout, interpretation); |
|
18 |
} |
|
19 |
|
|
20 |
public CreateMDStoreMessage(final String id, final String format, final String layout, final String interpretation) { |
|
21 |
this.id = id; |
|
22 |
this.format = format; |
|
23 |
this.layout = layout; |
|
24 |
this.interpretation = interpretation; |
|
25 |
} |
|
26 |
|
|
27 |
public String getId() { |
|
28 |
return id; |
|
29 |
} |
|
30 |
|
|
31 |
public void setId(final String id) { |
|
32 |
this.id = id; |
|
33 |
} |
|
34 |
|
|
35 |
public String getFormat() { |
|
36 |
return format; |
|
37 |
} |
|
38 |
|
|
39 |
public void setFormat(final String format) { |
|
40 |
this.format = format; |
|
41 |
} |
|
42 |
|
|
43 |
public String getLayout() { |
|
44 |
return layout; |
|
45 |
} |
|
46 |
|
|
47 |
public void setLayout(final String layout) { |
|
48 |
this.layout = layout; |
|
49 |
} |
|
50 |
|
|
51 |
public String getInterpretation() { |
|
52 |
return interpretation; |
|
53 |
} |
|
54 |
|
|
55 |
public void setInterpretation(final String interpretation) { |
|
56 |
this.interpretation = interpretation; |
|
57 |
} |
|
58 |
|
|
59 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/objectStore/DownloadIntoObjectStoreJobNode.java | ||
---|---|---|
4 | 4 |
import java.util.Iterator; |
5 | 5 |
import java.util.Map; |
6 | 6 |
|
7 |
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
|
7 |
import javax.xml.ws.wsaddressing.ResultSet<String>;
|
|
8 | 8 |
import javax.xml.xpath.XPath; |
9 | 9 |
import javax.xml.xpath.XPathFactory; |
10 | 10 |
|
... | ... | |
69 | 69 |
|
70 | 70 |
} |
71 | 71 |
|
72 |
private String eprParam;
|
|
72 |
private String resultSetParam;
|
|
73 | 73 |
|
74 | 74 |
private String objectStoreId; |
75 | 75 |
|
... | ... | |
90 | 90 |
return getServiceLocator().getServiceId(ObjectStoreService.class); |
91 | 91 |
} |
92 | 92 |
|
93 |
public String getEprParam() {
|
|
94 |
return eprParam;
|
|
93 |
public String getResultSetParam() {
|
|
94 |
return resultSetParam;
|
|
95 | 95 |
} |
96 | 96 |
|
97 |
public void setEprParam(final String eprParam) {
|
|
98 |
this.eprParam = eprParam;
|
|
97 |
public void setResultSetParam(final String resultSetParam) {
|
|
98 |
this.resultSetParam = resultSetParam;
|
|
99 | 99 |
} |
100 | 100 |
|
101 | 101 |
public String getObjectStoreId() { |
... | ... | |
115 | 115 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) throws Exception { |
116 | 116 |
|
117 | 117 |
job.setAction("FEEDOBJECT"); |
118 |
final String eprS = token.getEnv().getAttribute(getEprParam());
|
|
118 |
final String eprS = token.getEnv().getAttribute(getResultSetParam());
|
|
119 | 119 |
job.getParameters().put("obsID", getObjectStoreId()); |
120 | 120 |
job.getParameters().put("mime", getContentDescription()); |
121 | 121 |
final Iterator<String> client = resultSetClientFactory.getClient(eprS).iterator(); |
122 | 122 |
|
123 |
final W3CEndpointReference epr = iterableResultSetFactory.createIterableResultSet(new Iterable<String>() {
|
|
123 |
final ResultSet<String> rs = iterableResultSetFactory.createIterableResultSet(new Iterable<String>() {
|
|
124 | 124 |
|
125 | 125 |
@Override |
126 | 126 |
public Iterator<String> iterator() { |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/objectStore/DeleteObjectStoreJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.worker.nodes.objectStore; |
|
2 |
|
|
3 |
import org.apache.commons.logging.Log; |
|
4 |
import org.apache.commons.logging.LogFactory; |
|
5 |
|
|
6 |
import com.googlecode.sarasvati.NodeToken; |
|
7 |
|
|
8 |
import eu.dnetlib.data.objectstore.rmi.ObjectStoreService; |
|
9 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
10 |
import eu.dnetlib.msro.worker.nodes.BlackboardJobNode; |
|
11 |
|
|
12 |
public class DeleteObjectStoreJobNode extends BlackboardJobNode { |
|
13 |
|
|
14 |
private static final Log log = LogFactory.getLog(DeleteObjectStoreJobNode.class); |
|
15 |
|
|
16 |
private String objectstoreId; |
|
17 |
|
|
18 |
@Override |
|
19 |
protected String obtainServiceId(final NodeToken token) { |
|
20 |
return getServiceLocator().getServiceId(ObjectStoreService.class); |
|
21 |
} |
|
22 |
|
|
23 |
@Override |
|
24 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) throws Exception { |
|
25 |
log.info("preparing blackboard job: delete of mdstore " + getObjectstoreId()); |
|
26 |
job.setAction("DELETE"); |
|
27 |
job.getParameters().put("obsID", getObjectstoreId()); |
|
28 |
} |
|
29 |
|
|
30 |
/** |
|
31 |
* @return the objectstoreId |
|
32 |
*/ |
|
33 |
public String getObjectstoreId() { |
|
34 |
return objectstoreId; |
|
35 |
} |
|
36 |
|
|
37 |
/** |
|
38 |
* @param objectstoreId |
|
39 |
* the objectstoreId to set |
|
40 |
*/ |
|
41 |
public void setObjectstoreId(final String objectstoreId) { |
|
42 |
this.objectstoreId = objectstoreId; |
|
43 |
} |
|
44 |
|
|
45 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/objectStore/CreateObjectStoreJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.worker.nodes.objectStore; |
|
2 |
|
|
3 |
import java.util.Map; |
|
4 |
|
|
5 |
import org.apache.commons.logging.Log; |
|
6 |
import org.apache.commons.logging.LogFactory; |
|
7 |
|
|
8 |
import com.googlecode.sarasvati.Engine; |
|
9 |
import com.googlecode.sarasvati.NodeToken; |
|
10 |
import com.googlecode.sarasvati.env.Env; |
|
11 |
|
|
12 |
import eu.dnetlib.data.objectstore.rmi.ObjectStoreService; |
|
13 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
14 |
import eu.dnetlib.msro.worker.nodes.BlackboardJobNode; |
|
15 |
import eu.dnetlib.msro.worker.nodes.blackboard.BlackboardWorkflowJobListener; |
|
16 |
|
|
17 |
public class CreateObjectStoreJobNode extends BlackboardJobNode { |
|
18 |
|
|
19 |
private static final Log log = LogFactory.getLog(CreateObjectStoreJobNode.class); |
|
20 |
|
|
21 |
private String interpretation; |
|
22 |
private String outputPrefix = "objectStore_"; |
|
23 |
|
|
24 |
@Override |
|
25 |
protected String obtainServiceId(final NodeToken token) { |
|
26 |
return getServiceLocator().getServiceId(ObjectStoreService.class); |
|
27 |
} |
|
28 |
|
|
29 |
@Override |
|
30 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) { |
|
31 |
log.info("preparing blackboard job for the creation of the objectStore "); |
|
32 |
job.setAction("CREATE"); |
|
33 |
job.getParameters().put("interpretation", interpretation); |
|
34 |
} |
|
35 |
|
|
36 |
public String getInterpretation() { |
|
37 |
return interpretation; |
|
38 |
} |
|
39 |
|
|
40 |
public void setInterpretation(final String interpretation) { |
|
41 |
this.interpretation = interpretation; |
|
42 |
} |
|
43 |
|
|
44 |
public String getOutputPrefix() { |
|
45 |
return outputPrefix; |
|
46 |
} |
|
47 |
|
|
48 |
public void setOutputPrefix(final String outputPrefix) { |
|
49 |
this.outputPrefix = outputPrefix; |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
protected BlackboardWorkflowJobListener generateBlackboardListener(final Engine engine, final NodeToken token) { |
|
54 |
return new BlackboardWorkflowJobListener(engine, token) { |
|
55 |
|
|
56 |
@Override |
|
57 |
protected void populateEnv(final Env env, final Map<String, String> responseParams) { |
|
58 |
; |
|
59 |
env.setAttribute(getOutputPrefix() + "interpretation", interpretation); |
|
60 |
env.setAttribute(getOutputPrefix() + "id", responseParams.get("objectStoreId")); |
|
61 |
} |
|
62 |
}; |
|
63 |
} |
|
64 |
|
|
65 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/objectStore/RetrieveURLSJobNode.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.msro.worker.nodes.objectStore; |
2 | 2 |
|
3 | 3 |
import javax.annotation.Resource; |
4 |
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
|
4 |
import javax.xml.ws.wsaddressing.ResultSet<String>;
|
|
5 | 5 |
|
6 | 6 |
import org.springframework.beans.factory.annotation.Autowired; |
7 | 7 |
import org.springframework.beans.factory.annotation.Required; |
... | ... | |
22 | 22 |
*/ |
23 | 23 |
public class RetrieveURLSJobNode extends SimpleJobNode { |
24 | 24 |
|
25 |
/** The epr param. */
|
|
26 |
private String inputEprParam;
|
|
25 |
/** The rs param. */
|
|
26 |
private String inputResultSetParam;
|
|
27 | 27 |
|
28 |
/** The output epr param. */
|
|
29 |
private String outputEprParam;
|
|
28 |
/** The output rs param. */
|
|
29 |
private String outputResultSetParam;
|
|
30 | 30 |
|
31 | 31 |
/** The xpath. */ |
32 | 32 |
private String xpath; |
... | ... | |
55 | 55 |
*/ |
56 | 56 |
@Override |
57 | 57 |
protected String execute(final NodeToken token) throws Exception { |
58 |
final W3CEndpointReference inputEpr = (new EPRUtils()).getEpr(token.getEnv().getAttribute(inputEprParam));
|
|
58 |
final ResultSet<String> inputEpr = (new EPRUtils()).getEpr(token.getEnv().getAttribute(inputResultSetParam));
|
|
59 | 59 |
Iterable<String> input = resultSetClientFactory.getClient(inputEpr); |
60 | 60 |
Iterable<String> extractedUrls = Iterables.transform(input, new UrlExtractor(xpath, xpathMetadataId, xpathOpenAccess, xpathEmbargoDate)); |
61 |
W3CEndpointReference eprUrls = resultSetFactory.createIterableResultSet(extractedUrls);
|
|
62 |
token.getEnv().setAttribute(getOutputEprParam(), eprUrls.toString());
|
|
61 |
ResultSet<String> eprUrls = resultSetFactory.createIterableResultSet(extractedUrls);
|
|
62 |
token.getEnv().setAttribute(getOutputResultSetParam(), eprUrls.toString());
|
|
63 | 63 |
return Arc.DEFAULT_ARC; |
64 | 64 |
} |
65 | 65 |
|
... | ... | |
141 | 141 |
} |
142 | 142 |
|
143 | 143 |
/** |
144 |
* Gets the output epr param.
|
|
144 |
* Gets the output rs param.
|
|
145 | 145 |
* |
146 |
* @return the outputEprParam
|
|
146 |
* @return the outputResultSetParam
|
|
147 | 147 |
*/ |
148 |
public String getOutputEprParam() {
|
|
149 |
return outputEprParam;
|
|
148 |
public String getOutputResultSetParam() {
|
|
149 |
return outputResultSetParam;
|
|
150 | 150 |
} |
151 | 151 |
|
152 | 152 |
/** |
153 |
* Sets the output epr param.
|
|
153 |
* Sets the output rs param.
|
|
154 | 154 |
* |
155 |
* @param outputEprParam
|
|
156 |
* the outputEprParam to set
|
|
155 |
* @param outputResultSetParam
|
|
156 |
* the outputResultSetParam to set
|
|
157 | 157 |
*/ |
158 |
public void setOutputEprParam(final String outputEprParam) {
|
|
159 |
this.outputEprParam = outputEprParam;
|
|
158 |
public void setOutputResultSetParam(final String outputResultSetParam) {
|
|
159 |
this.outputResultSetParam = outputResultSetParam;
|
|
160 | 160 |
} |
161 | 161 |
|
162 | 162 |
/** |
163 |
* Gets the input epr param.
|
|
163 |
* Gets the input rs param.
|
|
164 | 164 |
* |
165 |
* @return the inputEprParam
|
|
165 |
* @return the inputResultSetParam
|
|
166 | 166 |
*/ |
167 |
public String getInputEprParam() {
|
|
168 |
return inputEprParam;
|
|
167 |
public String getInputResultSetParam() {
|
|
168 |
return inputResultSetParam;
|
|
169 | 169 |
} |
170 | 170 |
|
171 | 171 |
/** |
172 |
* Sets the input epr param.
|
|
172 |
* Sets the input rs param.
|
|
173 | 173 |
* |
174 |
* @param inputEprParam
|
|
175 |
* the inputEprParam to set
|
|
174 |
* @param inputResultSetParam
|
|
175 |
* the inputResultSetParam to set
|
|
176 | 176 |
*/ |
177 |
public void setInputEprParam(final String inputEprParam) {
|
|
178 |
this.inputEprParam = inputEprParam;
|
|
177 |
public void setInputResultSetParam(final String inputResultSetParam) {
|
|
178 |
this.inputResultSetParam = inputResultSetParam;
|
|
179 | 179 |
} |
180 | 180 |
|
181 | 181 |
/** |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/db/UpdateDbJobNode.java | ||
---|---|---|
18 | 18 |
|
19 | 19 |
private String db; |
20 | 20 |
private String dbParam; |
21 |
private String eprParam;
|
|
21 |
private String resultSetParam;
|
|
22 | 22 |
private ProcessCountingResultSetFactory processCountingResultSetFactory; |
23 | 23 |
private ResultsetProgressProvider progressProvider; |
24 | 24 |
|
... | ... | |
37 | 37 |
|
38 | 38 |
log.info("preparing blackboard job to update DB: " + db); |
39 | 39 |
|
40 |
final String epr = token.getEnv().getAttribute(getEprParam());
|
|
40 |
final String rs = token.getEnv().getAttribute(getResultSetParam());
|
|
41 | 41 |
|
42 | 42 |
this.progressProvider = processCountingResultSetFactory.createProgressProvider(token.getProcess(), epr); |
43 | 43 |
|
... | ... | |
59 | 59 |
this.db = db; |
60 | 60 |
} |
61 | 61 |
|
62 |
public String getEprParam() {
|
|
63 |
return eprParam;
|
|
62 |
public String getResultSetParam() {
|
|
63 |
return resultSetParam;
|
|
64 | 64 |
} |
65 | 65 |
|
66 |
public void setEprParam(final String eprParam) {
|
|
67 |
this.eprParam = eprParam;
|
|
66 |
public void setResultSetParam(final String resultSetParam) {
|
|
67 |
this.resultSetParam = resultSetParam;
|
|
68 | 68 |
} |
69 | 69 |
|
70 | 70 |
public ProcessCountingResultSetFactory getProcessCountingResultSetFactory() { |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/db/QueryDbJobNode.java | ||
---|---|---|
3 | 3 |
import java.io.IOException; |
4 | 4 |
|
5 | 5 |
import javax.annotation.Resource; |
6 |
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
|
6 |
import javax.xml.ws.wsaddressing.ResultSet<String>;
|
|
7 | 7 |
|
8 | 8 |
import org.apache.commons.io.IOUtils; |
9 | 9 |
import org.apache.commons.lang.StringUtils; |
... | ... | |
24 | 24 |
private String sql; |
25 | 25 |
private String sqlForSize; |
26 | 26 |
private String xslt; |
27 |
private String outputEprParam;
|
|
27 |
private String outputResultSetParam;
|
|
28 | 28 |
|
29 | 29 |
@Resource |
30 | 30 |
private DnetServiceLocator serviceLocator; |
... | ... | |
33 | 33 |
protected String execute(final NodeToken token) throws Exception { |
34 | 34 |
final String sqlText = fetchSqlAsText(sql); |
35 | 35 |
|
36 |
W3CEndpointReference epr = null;
|
|
36 |
ResultSet<String> rs = null;
|
|
37 | 37 |
|
38 | 38 |
final DatabaseService dbService = serviceLocator.getService(DatabaseService.class); |
39 | 39 |
|
... | ... | |
41 | 41 |
final String xsltText = IOUtils.toString(getClass().getResourceAsStream(xslt)); |
42 | 42 |
|
43 | 43 |
if (StringUtils.isBlank(sqlForSize)) { |
44 |
epr = dbService.xsltSearchSQL(findDb(token), sqlText, xsltText);
|
|
44 |
rs = dbService.xsltSearchSQL(findDb(token), sqlText, xsltText);
|
|
45 | 45 |
} else { |
46 |
epr = dbService.alternativeXsltSearchSQL(findDb(token), sqlText, fetchSqlAsText(sqlForSize), xsltText);
|
|
46 |
rs = dbService.alternativeXsltSearchSQL(findDb(token), sqlText, fetchSqlAsText(sqlForSize), xsltText);
|
|
47 | 47 |
} |
48 | 48 |
} else { |
49 | 49 |
if (StringUtils.isBlank(sqlForSize)) { |
50 |
epr = dbService.searchSQL(findDb(token), sqlText);
|
|
50 |
rs = dbService.searchSQL(findDb(token), sqlText);
|
|
51 | 51 |
} else { |
52 |
epr = dbService.alternativeSearchSQL(findDb(token), sqlText, fetchSqlAsText(sqlForSize));
|
|
52 |
rs = dbService.alternativeSearchSQL(findDb(token), sqlText, fetchSqlAsText(sqlForSize));
|
|
53 | 53 |
} |
54 | 54 |
} |
55 | 55 |
|
56 |
token.getEnv().setAttribute(outputEprParam, epr.toString());
|
|
56 |
token.getEnv().setAttribute(outputResultSetParam, epr.toString());
|
|
57 | 57 |
|
58 | 58 |
return Arc.DEFAULT_ARC; |
59 | 59 |
} |
... | ... | |
104 | 104 |
this.xslt = xslt; |
105 | 105 |
} |
106 | 106 |
|
107 |
public String getOutputEprParam() {
|
|
108 |
return outputEprParam;
|
|
107 |
public String getOutputResultSetParam() {
|
|
108 |
return outputResultSetParam;
|
|
109 | 109 |
} |
110 | 110 |
|
111 |
public void setOutputEprParam(final String outputEprParam) {
|
|
112 |
this.outputEprParam = outputEprParam;
|
|
111 |
public void setOutputResultSetParam(final String outputResultSetParam) {
|
|
112 |
this.outputResultSetParam = outputResultSetParam;
|
|
113 | 113 |
} |
114 | 114 |
|
115 | 115 |
public String getDbProperty() { |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/repohi/ValidateDatasourceJobNode.java | ||
---|---|---|
8 | 8 |
import com.googlecode.sarasvati.Arc; |
9 | 9 |
import com.googlecode.sarasvati.NodeToken; |
10 | 10 |
|
11 |
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryException; |
|
12 |
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService; |
|
13 |
|
|
11 |
import eu.dnetlib.msro.worker.WorkflowConstants; |
|
14 | 12 |
import eu.dnetlib.msro.worker.nodes.SimpleJobNode; |
15 |
import eu.dnetlib.msro.workflows.util.WorkflowConstants; |
|
13 |
import eu.dnetlib.rmi.objects.datasources.DatasourceConstants; |
|
14 |
import eu.dnetlib.rmi.soap.InformationService; |
|
16 | 15 |
|
17 | 16 |
public class ValidateDatasourceJobNode extends SimpleJobNode { |
18 | 17 |
|
19 | 18 |
@Resource |
20 |
private DnetServiceLocator serviceLocator;
|
|
19 |
private InformationService informationService;
|
|
21 | 20 |
|
22 | 21 |
private static final Log log = LogFactory.getLog(ValidateDatasourceJobNode.class); |
23 | 22 |
|
24 | 23 |
@Override |
25 | 24 |
protected String execute(final NodeToken token) throws Exception { |
26 |
String oldId = token.getFullEnv().getAttribute(WorkflowConstants.DATAPROVIDER_ID); |
|
27 |
String newId = registerDatasourceWorkflow(oldId); |
|
28 |
token.getFullEnv().setAttribute(WorkflowConstants.DATAPROVIDER_ID, newId); |
|
29 |
token.getEnv().setAttribute(WorkflowConstants.DATAPROVIDER_ID, newId); |
|
25 |
final String code = token.getFullEnv().getAttribute(WorkflowConstants.DATAPROVIDER_ID); |
|
26 |
final String id = informationService.getDsByCode(code, DatasourceConstants.DATASOURCE_TYPE).getId(); |
|
30 | 27 |
|
31 |
log.info("Validated datasource - OLD ID: " + oldId); |
|
32 |
log.info("Validated datasource - NEW ID: " + newId); |
|
28 |
informationService.validateResource(id, true); |
|
33 | 29 |
|
30 |
log.info("Validated datasource - ID: " + id + "(code: " + code + ")"); |
|
31 |
|
|
32 |
token.getEnv().setAttribute(WorkflowConstants.DATAPROVIDER_ID, code); |
|
33 |
|
|
34 | 34 |
return Arc.DEFAULT_ARC; |
35 | 35 |
} |
36 |
|
|
37 |
public String registerDatasourceWorkflow(final String oldId) throws ISRegistryException { |
|
38 |
return serviceLocator.getService(ISRegistryService.class).validateProfile(oldId); |
|
39 |
} |
|
40 | 36 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/repohi/UpdateMetaWfStatusJobNode.java | ||
---|---|---|
7 | 7 |
import com.googlecode.sarasvati.Arc; |
8 | 8 |
import com.googlecode.sarasvati.NodeToken; |
9 | 9 |
|
10 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
11 |
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService; |
|
12 |
|
|
13 |
import eu.dnetlib.msro.rmi.ManagerServiceException; |
|
10 |
import eu.dnetlib.common.services.locators.DnetServiceLocator; |
|
11 |
import eu.dnetlib.msro.worker.WorkflowConstants; |
|
12 |
import eu.dnetlib.msro.worker.WorkflowConstants.WorkflowStatus; |
|
14 | 13 |
import eu.dnetlib.msro.worker.nodes.SimpleJobNode; |
15 |
import eu.dnetlib.msro.workflows.util.WorkflowConstants; |
|
16 |
import eu.dnetlib.msro.workflows.util.WorkflowConstants.WorkflowStatus; |
|
14 |
import eu.dnetlib.rmi.soap.exceptions.ManagerServiceException; |
|
17 | 15 |
|
18 | 16 |
public class UpdateMetaWfStatusJobNode extends SimpleJobNode { |
19 | 17 |
|
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/BlackboardJobNode.java | ||
---|---|---|
55 | 55 |
engine.complete(token, "failed"); |
56 | 56 |
return; |
57 | 57 |
} |
58 |
blackboardDispatcher.createDispatcher(serviceId, getMessage(), this);
|
|
58 |
blackboardDispatcher.createDispatcher(serviceId, prepareMessage(), this);
|
|
59 | 59 |
} catch (final Throwable e) { |
60 | 60 |
token.getEnv().setAttribute(WorkflowConstants.SYSTEM_HAS_FAILED, true); |
61 | 61 |
token.getEnv().setAttribute(WorkflowConstants.SYSTEM_ERROR, "cannot prepare blackboard job: " + e); |
... | ... | |
64 | 64 |
} |
65 | 65 |
} |
66 | 66 |
|
67 |
abstract protected T getMessage();
|
|
67 |
abstract protected void saveResponseInEnv(final T t, final Env env);
|
|
68 | 68 |
|
69 |
abstract protected T prepareMessage(); |
|
70 |
|
|
69 | 71 |
abstract protected String obtainServiceId(NodeToken token); |
70 | 72 |
|
71 | 73 |
@Override |
... | ... | |
76 | 78 |
engine.executeQueuedArcTokens(token.getProcess()); |
77 | 79 |
} |
78 | 80 |
|
79 |
abstract protected void saveResponseInEnv(final T t, final Env env); |
|
80 |
|
|
81 | 81 |
@Override |
82 | 82 |
public void onFail(final T t) { |
83 | 83 |
final String error = t instanceof AbstractBlackboardMessage ? ((AbstractBlackboardMessage) t).getError() : "Unknown Error"; |
... | ... | |
93 | 93 |
getToken().getEnv().setAttribute(WorkflowConstants.BLACKBOARD_IS_GOING, true); |
94 | 94 |
} |
95 | 95 |
|
96 |
public Engine getEngine() {
|
|
96 |
protected Engine getEngine() {
|
|
97 | 97 |
return engine; |
98 | 98 |
} |
99 | 99 |
|
100 |
public void setEngine(final Engine engine) { |
|
101 |
this.engine = engine; |
|
102 |
} |
|
103 |
|
|
104 |
public NodeToken getToken() { |
|
100 |
protected NodeToken getToken() { |
|
105 | 101 |
return token; |
106 | 102 |
} |
107 | 103 |
|
108 |
public void setToken(final NodeToken token) {
|
|
109 |
this.token = token;
|
|
104 |
protected DnetServiceLocator getServiceLocator() {
|
|
105 |
return serviceLocator;
|
|
110 | 106 |
} |
111 | 107 |
|
112 | 108 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/repobye/DeleteMetaWfJobNode.java | ||
---|---|---|
14 | 14 |
import com.googlecode.sarasvati.Arc; |
15 | 15 |
import com.googlecode.sarasvati.NodeToken; |
16 | 16 |
|
17 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
18 |
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService; |
|
19 |
|
|
17 |
import eu.dnetlib.msro.worker.WorkflowConstants; |
|
20 | 18 |
import eu.dnetlib.msro.worker.nodes.SimpleJobNode; |
21 |
import eu.dnetlib.msro.workflows.util.WorkflowConstants;
|
|
19 |
import eu.dnetlib.rmi.soap.InformationService;
|
|
22 | 20 |
|
23 | 21 |
public class DeleteMetaWfJobNode extends SimpleJobNode { |
24 | 22 |
|
25 | 23 |
private String metaWfId; |
26 | 24 |
|
27 | 25 |
@Resource |
28 |
private DnetServiceLocator serviceLocator;
|
|
26 |
private InformationService informationService;
|
|
29 | 27 |
|
30 | 28 |
private static final Log log = LogFactory.getLog(DeleteMetaWfJobNode.class); |
31 | 29 |
|
32 | 30 |
@Override |
33 | 31 |
protected String execute(final NodeToken token) throws Exception { |
34 |
final String profile = serviceLocator.getService(ISLookUpService.class).getResourceProfile(metaWfId);
|
|
32 |
final String profile = informationService.getResourceProfile(metaWfId);
|
|
35 | 33 |
final Document doc = new SAXReader().read(new StringReader(profile)); |
36 | 34 |
|
37 | 35 |
final String dsId = doc.valueOf("//DATAPROVIDER/@id"); |
... | ... | |
45 | 43 |
token.getEnv().setAttribute(WorkflowConstants.DATAPROVIDER_NAME, dsName); |
46 | 44 |
token.getEnv().setAttribute(WorkflowConstants.DATAPROVIDER_INTERFACE, ifaceId); |
47 | 45 |
|
48 |
final ISRegistryService registry = serviceLocator.getService(ISRegistryService.class); |
|
49 |
|
|
50 | 46 |
for (Object o : doc.selectNodes("//WORKFLOW")) { |
51 | 47 |
final String wfId = ((Node) o).valueOf("@id"); |
52 | 48 |
try { |
53 |
registry.deleteProfile(wfId);
|
|
49 |
informationService.deleteProfile(wfId);
|
|
54 | 50 |
log.info(" - Deleted Workflow: " + wfId); |
55 | 51 |
} catch (Exception e) { |
56 | 52 |
log.error(" - (ERR) Error deleting profile " + wfId); |
57 | 53 |
} |
58 | 54 |
} |
59 |
registry.deleteProfile(metaWfId);
|
|
55 |
informationService.deleteProfile(metaWfId);
|
|
60 | 56 |
log.info(" - Deleted MetaWorkflow: " + metaWfId); |
61 | 57 |
|
62 |
registry.deleteProfile(destroyWfId);
|
|
58 |
informationService.deleteProfile(destroyWfId);
|
|
63 | 59 |
log.info(" - Deleted destroy workflow: " + destroyWfId); |
64 | 60 |
|
65 | 61 |
verifyDatasource(dsId, ifaceId); |
... | ... | |
84 | 80 |
} |
85 | 81 |
|
86 | 82 |
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 + "'");
|
|
83 |
informationService.updateProfileNode(dsId, "//INTERFACE[@id = '" + ifaceId + "']/@active", "'" + active + "'");
|
|
88 | 84 |
} |
89 | 85 |
|
90 | 86 |
public String getMetaWfId() { |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/index/UpdateIndexJobNode.java | ||
---|---|---|
13 | 13 |
import javax.xml.transform.dom.DOMSource; |
14 | 14 |
import javax.xml.transform.stream.StreamResult; |
15 | 15 |
import javax.xml.transform.stream.StreamSource; |
16 |
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
|
16 |
import javax.xml.ws.wsaddressing.ResultSet<String>;
|
|
17 | 17 |
|
18 | 18 |
import org.apache.commons.codec.binary.Base64; |
19 | 19 |
import org.apache.commons.logging.Log; |
... | ... | |
41 | 41 |
|
42 | 42 |
private static final Log log = LogFactory.getLog(UpdateIndexJobNode.class); |
43 | 43 |
|
44 |
private String eprParam;
|
|
44 |
private String resultSetParam;
|
|
45 | 45 |
private String indexId; |
46 | 46 |
private String format; |
47 | 47 |
private String layout; |
... | ... | |
76 | 76 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException, ISLookUpException, IOException, TransformerException { |
77 | 77 |
log.info("preparing blackboard job update index: " + getIndexId()); |
78 | 78 |
|
79 |
final W3CEndpointReference epr = new EPRUtils().getEpr(token.getEnv().getAttribute(getEprParam()));
|
|
79 |
final ResultSet<String> rs = new EPRUtils().getEpr(token.getEnv().getAttribute(getResultSetParam()));
|
|
80 | 80 |
|
81 |
final W3CEndpointReference mappedEpr = prepareForIndexing(epr, getFormat(), getLayout());
|
|
81 |
final ResultSet<String> mappedEpr = prepareForIndexing(epr, getFormat(), getLayout());
|
|
82 | 82 |
|
83 | 83 |
progressProvider = processCountingResultSetFactory.createProgressProvider(token.getProcess(), mappedEpr); |
84 | 84 |
|
... | ... | |
108 | 108 |
* @throws TransformerException |
109 | 109 |
* could happen |
110 | 110 |
*/ |
111 |
protected W3CEndpointReference prepareForIndexing(final W3CEndpointReference mdStoreRsetEpr, final String format, final String layout)
|
|
111 |
protected ResultSet<String> prepareForIndexing(final ResultSet<String> mdStoreRsetEpr, final String format, final String layout)
|
|
112 | 112 |
throws ISLookUpException, IOException, TransformerException { |
113 | 113 |
|
114 | 114 |
final TransformerFactory factory = TransformerFactory.newInstance(); |
... | ... | |
152 | 152 |
this.indexId = indexId; |
153 | 153 |
} |
154 | 154 |
|
155 |
public String getEprParam() {
|
|
156 |
return eprParam;
|
|
155 |
public String getResultSetParam() {
|
|
156 |
return resultSetParam;
|
|
157 | 157 |
} |
158 | 158 |
|
159 |
public void setEprParam(final String eprParam) {
|
|
160 |
this.eprParam = eprParam;
|
|
159 |
public void setResultSetParam(final String resultSetParam) {
|
|
160 |
this.resultSetParam = resultSetParam;
|
|
161 | 161 |
} |
162 | 162 |
|
163 | 163 |
public String getFeedingType() { |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/download/DownloadFromMetadataJobNode.java | ||
---|---|---|
25 | 25 |
*/ |
26 | 26 |
public class DownloadFromMetadataJobNode extends BlackboardJobNode implements ProgressJobNode { |
27 | 27 |
|
28 |
/** The inputepr param. */
|
|
29 |
private String inputeprParam;
|
|
28 |
/** The inputrs param. */
|
|
29 |
private String inputresultSetParam;
|
|
30 | 30 |
|
31 | 31 |
/** The obejct store id. */ |
32 | 32 |
private String objectStoreID; |
... | ... | |
66 | 66 |
@Override |
67 | 67 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) throws Exception { |
68 | 68 |
job.setAction("DOWNLOAD"); |
69 |
final String eprS = token.getEnv().getAttribute(getInputeprParam());
|
|
69 |
final String eprS = token.getEnv().getAttribute(getInputresultSetParam());
|
|
70 | 70 |
this.progressProvider = processCountingResultSetFactory.createProgressProvider(token.getProcess(), eprS); |
71 | 71 |
job.getParameters().put("epr", progressProvider.getEpr().toString()); |
72 | 72 |
job.getParameters().put("protocol", getProtocol()); |
... | ... | |
94 | 94 |
} |
95 | 95 |
|
96 | 96 |
/** |
97 |
* Gets the inputepr param.
|
|
97 |
* Gets the inputrs param.
|
|
98 | 98 |
* |
99 |
* @return the inputeprParam
|
|
99 |
* @return the inputresultSetParam
|
|
100 | 100 |
*/ |
101 |
public String getInputeprParam() {
|
|
102 |
return inputeprParam;
|
|
101 |
public String getInputresultSetParam() {
|
|
102 |
return inputresultSetParam;
|
|
103 | 103 |
} |
104 | 104 |
|
105 | 105 |
/** |
... | ... | |
179 | 179 |
} |
180 | 180 |
|
181 | 181 |
/** |
182 |
* Sets the inputepr param.
|
|
182 |
* Sets the inputrs param.
|
|
183 | 183 |
* |
184 |
* @param inputeprParam
|
|
185 |
* the inputeprParam to set
|
|
184 |
* @param inputresultSetParam
|
|
185 |
* the inputresultSetParam to set
|
|
186 | 186 |
*/ |
187 |
public void setInputeprParam(final String inputeprParam) {
|
|
188 |
this.inputeprParam = inputeprParam;
|
|
187 |
public void setInputresultSetParam(final String inputresultSetParam) {
|
|
188 |
this.inputresultSetParam = inputresultSetParam;
|
|
189 | 189 |
} |
190 | 190 |
|
191 | 191 |
/* |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/transform/MdBuilderJobNode.java | ||
---|---|---|
18 | 18 |
import eu.dnetlib.enabling.datastructures.Datasource; |
19 | 19 |
import eu.dnetlib.miscutils.ApplyXslt; |
20 | 20 |
import eu.dnetlib.msro.worker.nodes.SimpleJobNode; |
21 |
import eu.dnetlib.rmi.objects.dsmanager.IfaceDesc;
|
|
21 |
import eu.dnetlib.rmi.objects.datasources.IfaceDesc;
|
|
22 | 22 |
import eu.dnetlib.rmi.objects.resultSet.ResultSet; |
23 | 23 |
import eu.dnetlib.rmi.soap.DatasourceManagerService; |
24 | 24 |
import eu.dnetlib.rmi.soap.exceptions.ManagerServiceException; |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/mdstore/DeleteMDStoreJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.worker.nodes.mdstore; |
|
2 |
|
|
3 |
import com.googlecode.sarasvati.NodeToken; |
|
4 |
import com.googlecode.sarasvati.env.Env; |
|
5 |
|
|
6 |
import eu.dnetlib.msro.worker.nodes.BlackboardJobNode; |
|
7 |
import eu.dnetlib.rmi.blackboard.DeleteMDStoreMessage; |
|
8 |
import eu.dnetlib.rmi.soap.MDStoreService; |
|
9 |
|
|
10 |
public class DeleteMDStoreJobNode extends BlackboardJobNode<DeleteMDStoreMessage> { |
|
11 |
|
|
12 |
private String mdstoreId; |
|
13 |
|
|
14 |
@Override |
|
15 |
protected String obtainServiceId(final NodeToken token) { |
|
16 |
return getServiceLocator().getServiceId(MDStoreService.class, mdstoreId); |
|
17 |
} |
|
18 |
|
|
19 |
@Override |
|
20 |
protected DeleteMDStoreMessage prepareMessage() { |
|
21 |
return new DeleteMDStoreMessage(mdstoreId); |
|
22 |
} |
|
23 |
|
|
24 |
@Override |
|
25 |
protected void saveResponseInEnv(final DeleteMDStoreMessage t, final Env env) {} |
|
26 |
|
|
27 |
public String getMdstoreId() { |
|
28 |
return mdstoreId; |
|
29 |
} |
|
30 |
|
|
31 |
public void setMdstoreId(final String mdstoreId) { |
|
32 |
this.mdstoreId = mdstoreId; |
|
33 |
} |
|
34 |
|
|
35 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/mdstore/CreateMDStoreJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.worker.nodes.mdstore; |
|
2 |
|
|
3 |
import com.googlecode.sarasvati.NodeToken; |
|
4 |
import com.googlecode.sarasvati.env.Env; |
|
5 |
|
|
6 |
import eu.dnetlib.msro.worker.nodes.BlackboardJobNode; |
|
7 |
import eu.dnetlib.rmi.blackboard.CreateMDStoreMessage; |
|
8 |
import eu.dnetlib.rmi.soap.MDStoreService; |
|
9 |
|
|
10 |
public class CreateMDStoreJobNode extends BlackboardJobNode<CreateMDStoreMessage> { |
|
11 |
|
|
12 |
private String format; |
|
13 |
private String layout; |
|
14 |
private String interpretation; |
|
15 |
private String outputPrefix = "mdstore"; |
|
16 |
|
|
17 |
@Override |
|
18 |
protected String obtainServiceId(final NodeToken token) { |
|
19 |
return getServiceLocator().getServiceId(MDStoreService.class); |
|
20 |
} |
|
21 |
|
|
22 |
@Override |
|
23 |
protected CreateMDStoreMessage prepareMessage() { |
|
24 |
return new CreateMDStoreMessage(format, layout, interpretation); |
|
25 |
} |
|
26 |
|
|
27 |
@Override |
|
28 |
protected void saveResponseInEnv(final CreateMDStoreMessage m, final Env env) { |
|
29 |
env.setAttribute(getOutputPrefix() + "id", m.getId()); |
|
30 |
env.setAttribute(getOutputPrefix() + "format", m.getFormat()); |
|
31 |
env.setAttribute(getOutputPrefix() + "layout", m.getLayout()); |
|
32 |
env.setAttribute(getOutputPrefix() + "interpretation", m.getInterpretation()); |
|
33 |
} |
|
34 |
|
|
35 |
public String getFormat() { |
|
36 |
return format; |
|
37 |
} |
|
38 |
|
|
39 |
public void setFormat(final String format) { |
|
40 |
this.format = format; |
|
41 |
} |
|
42 |
|
|
43 |
public String getInterpretation() { |
|
44 |
return interpretation; |
|
45 |
} |
|
46 |
|
|
47 |
public void setInterpretation(final String interpretation) { |
|
48 |
this.interpretation = interpretation; |
|
49 |
} |
|
50 |
|
|
51 |
public String getLayout() { |
|
52 |
return layout; |
|
53 |
} |
|
54 |
|
|
55 |
public void setLayout(final String layout) { |
|
56 |
this.layout = layout; |
|
57 |
} |
|
58 |
|
|
59 |
public String getOutputPrefix() { |
|
60 |
return outputPrefix; |
|
61 |
} |
|
62 |
|
|
63 |
public void setOutputPrefix(final String outputPrefix) { |
|
64 |
this.outputPrefix = outputPrefix; |
|
65 |
} |
|
66 |
|
|
67 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/mdstore/MultipleMdStoreIterator.java | ||
---|---|---|
4 | 4 |
import java.util.List; |
5 | 5 |
|
6 | 6 |
import javax.annotation.Resource; |
7 |
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
|
7 |
import javax.xml.ws.wsaddressing.ResultSet<String>;
|
|
8 | 8 |
|
9 | 9 |
import org.apache.commons.logging.Log; |
10 | 10 |
import org.apache.commons.logging.LogFactory; |
... | ... | |
112 | 112 |
*/ |
113 | 113 |
private Iterator<String> getIterableResultset(final String id) { |
114 | 114 |
try { |
115 |
W3CEndpointReference epr = serviceLocator.getService(MDStoreService.class, id).deliverMDRecords(id, "", "", "");
|
|
115 |
ResultSet<String> rs = serviceLocator.getService(MDStoreService.class, id).deliverMDRecords(id, "", "", "");
|
|
116 | 116 |
Iterable<String> input = resultSetClientFactory.getClient(epr); |
117 | 117 |
return input.iterator(); |
118 | 118 |
} catch (MDStoreServiceException e) { |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/mdstore/FetchMultipleMDStores.java | ||
---|---|---|
3 | 3 |
import java.util.List; |
4 | 4 |
|
5 | 5 |
import javax.annotation.Resource; |
6 |
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
|
6 |
import javax.xml.ws.wsaddressing.ResultSet<String>;
|
|
7 | 7 |
|
8 | 8 |
import org.springframework.beans.factory.annotation.Autowired; |
9 | 9 |
|
... | ... | |
24 | 24 |
private List<String> mdId; |
25 | 25 |
private String mdFormat; |
26 | 26 |
|
27 |
private String eprParam;
|
|
27 |
private String resultSetParam;
|
|
28 | 28 |
|
29 | 29 |
/** The result set factory. */ |
30 | 30 |
@Resource(name = "iterableResultSetFactory") |
... | ... | |
47 | 47 |
setMdFormat(token.getEnv().getAttribute("mdFormat")); |
48 | 48 |
} |
49 | 49 |
MultipleMdStoreIterable iter = new MultipleMdStoreIterable(serviceLocator, getMdId(), resultSetClientFactory); |
50 |
W3CEndpointReference eprUrls = resultSetFactory.createIterableResultSet(iter);
|
|
51 |
token.getEnv().setAttribute(getEprParam(), eprUrls.toString());
|
|
50 |
ResultSet<String> eprUrls = resultSetFactory.createIterableResultSet(iter);
|
|
51 |
token.getEnv().setAttribute(getResultSetParam(), eprUrls.toString());
|
|
52 | 52 |
return Arc.DEFAULT_ARC; |
53 | 53 |
} |
54 | 54 |
|
... | ... | |
68 | 68 |
this.mdFormat = mdFormat; |
69 | 69 |
} |
70 | 70 |
|
71 |
public String getEprParam() {
|
|
72 |
return eprParam;
|
|
71 |
public String getResultSetParam() {
|
|
72 |
return resultSetParam;
|
|
73 | 73 |
} |
74 | 74 |
|
75 |
public void setEprParam(final String eprParam) {
|
|
76 |
this.eprParam = eprParam;
|
|
75 |
public void setResultSetParam(final String resultSetParam) {
|
|
76 |
this.resultSetParam = resultSetParam;
|
|
77 | 77 |
} |
78 | 78 |
|
79 | 79 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/mdstore/FetchMDStoreRecordsJobNode.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.msro.worker.nodes.mdstore; |
2 | 2 |
|
3 | 3 |
import javax.annotation.Resource; |
4 |
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
|
4 |
import javax.xml.ws.wsaddressing.ResultSet<String>;
|
|
5 | 5 |
|
6 | 6 |
import org.apache.commons.logging.Log; |
7 | 7 |
import org.apache.commons.logging.LogFactory; |
... | ... | |
23 | 23 |
|
24 | 24 |
private String mdId; |
25 | 25 |
private String mdFormat; |
26 |
private String eprParam;
|
|
26 |
private String resultSetParam;
|
|
27 | 27 |
|
28 | 28 |
@Override |
29 | 29 |
protected String execute(final NodeToken token) throws Exception { |
... | ... | |
35 | 35 |
} |
36 | 36 |
|
37 | 37 |
log.info("getting MDRecords from: " + getMdId()); |
38 |
final W3CEndpointReference epr = serviceLocator.getService(MDStoreService.class, getMdId()).deliverMDRecords(getMdId(), "", "", "");
|
|
39 |
if (epr == null) { throw new ManagerServiceException("unable to read MDRecords from: " + getMdId()); }
|
|
40 |
token.getEnv().setAttribute(getEprParam(), epr.toString());
|
|
38 |
final ResultSet<String> rs = serviceLocator.getService(MDStoreService.class, getMdId()).deliverMDRecords(getMdId(), "", "", "");
|
|
39 |
if (rs == null) { throw new ManagerServiceException("unable to read MDRecords from: " + getMdId()); }
|
|
40 |
token.getEnv().setAttribute(getResultSetParam(), epr.toString());
|
|
41 | 41 |
return Arc.DEFAULT_ARC; |
42 | 42 |
} |
43 | 43 |
|
... | ... | |
57 | 57 |
this.mdFormat = mdFormat; |
58 | 58 |
} |
59 | 59 |
|
60 |
public String getEprParam() {
|
|
61 |
return eprParam;
|
|
60 |
public String getResultSetParam() {
|
|
61 |
return resultSetParam;
|
|
62 | 62 |
} |
63 | 63 |
|
64 |
public void setEprParam(final String eprParam) {
|
|
65 |
this.eprParam = eprParam;
|
|
64 |
public void setResultSetParam(final String resultSetParam) {
|
|
65 |
this.resultSetParam = resultSetParam;
|
|
66 | 66 |
} |
67 | 67 |
} |
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/nodes/mdstore/StoreMDStoreRecordsJobNode.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
private static final Log log = LogFactory.getLog(StoreMDStoreRecordsJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM |
27 | 27 |
|
28 |
private String eprParam;
|
|
28 |
private String resultSetParam;
|
|
29 | 29 |
private String mdId; |
30 | 30 |
private String storingType; |
31 | 31 |
private ProcessCountingResultSetFactory processCountingResultSetFactory; |
... | ... | |
40 | 40 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException { |
41 | 41 |
job.setAction("FEED"); |
42 | 42 |
|
43 |
final String eprS = token.getEnv().getAttribute(getEprParam());
|
|
43 |
final String eprS = token.getEnv().getAttribute(getResultSetParam());
|
|
44 | 44 |
|
45 | 45 |
this.progressProvider = processCountingResultSetFactory.createProgressProvider(token.getProcess(), eprS); |
46 | 46 |
|
... | ... | |
61 | 61 |
}; |
62 | 62 |
} |
63 | 63 |
|
64 |
public String getEprParam() {
|
|
65 |
return eprParam;
|
|
64 |
public String getResultSetParam() {
|
|
65 |
return resultSetParam;
|
|
66 | 66 |
} |
67 | 67 |
|
68 |
public void setEprParam(final String eprParam) {
|
|
69 |
this.eprParam = eprParam;
|
|
68 |
public void setResultSetParam(final String resultSetParam) {
|
|
69 |
this.resultSetParam = resultSetParam;
|
|
70 | 70 |
} |
71 | 71 |
|
72 | 72 |
public String getMdId() { |
Also available in: Unified diff
Create/Delete Stores