Revision 29168
Added by Alessia Bardi over 10 years ago
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAISetsCountJobNode.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
public class OAISetsCountJobNode extends BlackboardJobNode implements ProgressJobNode { |
13 | 13 |
|
14 |
private String configuredOnlyParam;
|
|
14 |
private String configuredOnly; |
|
15 | 15 |
|
16 | 16 |
@Override |
17 | 17 |
protected String getXqueryForServiceId(final NodeToken token) { |
... | ... | |
21 | 21 |
@Override |
22 | 22 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException { |
23 | 23 |
job.setAction("COUNT_SETS"); |
24 |
job.getParameters().put("configuredOnly", token.getEnv().getAttribute(configuredOnlyParam));
|
|
24 |
job.getParameters().put("configuredOnly", configuredOnly);
|
|
25 | 25 |
} |
26 | 26 |
|
27 | 27 |
@Override |
... | ... | |
29 | 29 |
return new InaccurateProgressProvider(); |
30 | 30 |
} |
31 | 31 |
|
32 |
public String getConfiguredOnlyParam() {
|
|
33 |
return configuredOnlyParam;
|
|
32 |
public String getConfiguredOnly() { |
|
33 |
return configuredOnly; |
|
34 | 34 |
} |
35 | 35 |
|
36 |
public void setConfiguredOnlyParam(final String configuredOnlyParam) {
|
|
37 |
this.configuredOnlyParam = configuredOnlyParam;
|
|
36 |
public void setConfiguredOnly(final String configuredOnly) {
|
|
37 |
this.configuredOnly = configuredOnly;
|
|
38 | 38 |
} |
39 |
|
|
39 | 40 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAICreateIndexJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
|
2 |
|
|
3 |
import org.apache.commons.lang.StringUtils; |
|
4 |
import org.apache.commons.logging.Log; |
|
5 |
import org.apache.commons.logging.LogFactory; |
|
6 |
|
|
7 |
import com.googlecode.sarasvati.NodeToken; |
|
8 |
|
|
9 |
import eu.dnetlib.enabling.resultset.rmi.ResultSetException; |
|
10 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
11 |
import eu.dnetlib.msro.oai.workflows.InaccurateProgressProvider; |
|
12 |
import eu.dnetlib.msro.workflows.nodes.BlackboardJobNode; |
|
13 |
import eu.dnetlib.msro.workflows.nodes.ProgressJobNode; |
|
14 |
import eu.dnetlib.msro.workflows.util.ProgressProvider; |
|
15 |
|
|
16 |
public class OAICreateIndexJobNode extends BlackboardJobNode implements ProgressJobNode { |
|
17 |
|
|
18 |
private static final Log log = LogFactory.getLog(OAICreateIndexJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM |
|
19 |
|
|
20 |
private String mdPrefix; |
|
21 |
/** |
|
22 |
* Name of the fields (comma separated) to be included in the same index. For several indexes separate the fieldNames with ; |
|
23 |
* <p> |
|
24 |
* Examples: field1,field2 -- one compound index on the given two fields field1,field2;field3,field4 -- two compound indices: one on |
|
25 |
* field1 and field2, the other on field3 and field4 |
|
26 |
* </p> |
|
27 |
* **/ |
|
28 |
private String fieldNames; |
|
29 |
|
|
30 |
@Override |
|
31 |
protected String getXqueryForServiceId(final NodeToken token) { |
|
32 |
return "//RESOURCE_IDENTIFIER[../RESOURCE_TYPE/@value='OAIStoreServiceResourceType']/@value/string()"; |
|
33 |
} |
|
34 |
|
|
35 |
@Override |
|
36 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException { |
|
37 |
|
|
38 |
job.setAction("CREATE_OAI_INDEX"); |
|
39 |
if (StringUtils.isNotBlank(mdPrefix)) { |
|
40 |
job.getParameters().put("oai_index_mdPrefix", mdPrefix); |
|
41 |
} else { |
|
42 |
log.debug("mdPrefix not set"); |
|
43 |
} |
|
44 |
if (StringUtils.isNotBlank(fieldNames)) { |
|
45 |
job.getParameters().put("oai_index_fieldNames", fieldNames); |
|
46 |
} else { |
|
47 |
log.debug("fieldNames not set"); |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public ProgressProvider getProgressProvider() { |
|
53 |
return new InaccurateProgressProvider(); |
|
54 |
} |
|
55 |
|
|
56 |
public String getMdPrefix() { |
|
57 |
return mdPrefix; |
|
58 |
} |
|
59 |
|
|
60 |
public void setMdPrefix(final String mdPrefix) { |
|
61 |
this.mdPrefix = mdPrefix; |
|
62 |
} |
|
63 |
|
|
64 |
public String getFieldNames() { |
|
65 |
return fieldNames; |
|
66 |
} |
|
67 |
|
|
68 |
public void setFieldNames(final String fieldNames) { |
|
69 |
this.fieldNames = fieldNames; |
|
70 |
} |
|
71 |
|
|
72 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/resources/eu/dnetlib/test/profiles/workflows/oai/oai-sets-count.xml | ||
---|---|---|
17 | 17 |
isStart="true"> |
18 | 18 |
<DESCRIPTION>Count records in each OAI set, for each metadata.</DESCRIPTION> |
19 | 19 |
<PARAMETERS> |
20 |
<PARAM name="configuredOnlyParam" required="true" type="boolean"
|
|
20 |
<PARAM name="configuredOnly" required="true" type="boolean" |
|
21 | 21 |
managedBy="user" /> |
22 | 22 |
</PARAMETERS> |
23 | 23 |
<ARCS> |
modules/dnet-oai-common-workflows/trunk/src/main/resources/eu/dnetlib/applicationContext-dnet-oai-common-workflows.xml | ||
---|---|---|
32 | 32 |
<bean id="wfNodeOAICreateStore" |
33 | 33 |
class="eu.dnetlib.msro.oai.workflows.nodes.OAICreateStoreJobNode" |
34 | 34 |
scope="prototype" /> |
35 |
|
|
36 |
<!-- Create new (compound) index on OAI stores --> |
|
37 |
<bean id="wfNodeOAICreateIndex" |
|
38 |
class="eu.dnetlib.msro.oai.workflows.nodes.OAICreateIndexJobNode" |
|
39 |
scope="prototype" /> |
|
35 | 40 |
</beans> |
Also available in: Unified diff
Added Job node to create index on mongodb (useful to tell the OAI store to create compound indices.