Revision 46596
Added by Alessia Bardi almost 7 years ago
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/ReadMDStoreJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
|
2 |
|
|
3 |
import javax.annotation.Resource; |
|
4 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
|
5 |
|
|
6 |
import org.apache.commons.logging.Log; |
|
7 |
import org.apache.commons.logging.LogFactory; |
|
8 |
|
|
9 |
import com.googlecode.sarasvati.Arc; |
|
10 |
import com.googlecode.sarasvati.NodeToken; |
|
11 |
|
|
12 |
import eu.dnetlib.data.mdstore.MDStoreService; |
|
13 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
14 |
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode; |
|
15 |
|
|
16 |
public class ReadMDStoreJobNode extends SimpleJobNode { |
|
17 |
|
|
18 |
private static final Log log = LogFactory.getLog(ReadMDStoreJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM |
|
19 |
|
|
20 |
/** |
|
21 |
* Name of the env attribute where the output epr will be saved. |
|
22 |
*/ |
|
23 |
private String eprParam; |
|
24 |
|
|
25 |
// info about the metadata format of the records I'm reading |
|
26 |
private String mdFormatName; |
|
27 |
private String mdFormatLayout; |
|
28 |
private String mdFormatInterpretation; |
|
29 |
|
|
30 |
/** Name of the datasource whose records I am reading **/ |
|
31 |
private String datasource; |
|
32 |
|
|
33 |
/** |
|
34 |
* Identifier of the input mdstore. |
|
35 |
*/ |
|
36 |
private String mdstoreId; |
|
37 |
|
|
38 |
@Resource |
|
39 |
private UniqueServiceLocator serviceLocator; |
|
40 |
|
|
41 |
@Override |
|
42 |
protected String execute(final NodeToken token) throws Exception { |
|
43 |
|
|
44 |
/* |
|
45 |
* public W3CEndpointReference deliverMDRecords( String mdId, String from, String until, String recordFilter) throws |
|
46 |
* MDStoreServiceException; |
|
47 |
*/ |
|
48 |
W3CEndpointReference epr = serviceLocator.getService(MDStoreService.class, mdstoreId).deliverMDRecords(mdstoreId, null, null, null); |
|
49 |
log.debug("Created W3CEndpointReference to read from mdstoreId = " + mdstoreId); |
|
50 |
token.getEnv().setAttribute(eprParam, epr.toString()); |
|
51 |
token.getEnv().setAttribute("oai_formatName", mdFormatName); |
|
52 |
token.getEnv().setAttribute("oai_formatLayout", mdFormatLayout); |
|
53 |
token.getEnv().setAttribute("oai_formatInterpretation", mdFormatInterpretation); |
|
54 |
token.getEnv().setAttribute("oai_recordSource", datasource); |
|
55 |
return Arc.DEFAULT_ARC; |
|
56 |
} |
|
57 |
|
|
58 |
public String getEprParam() { |
|
59 |
return eprParam; |
|
60 |
} |
|
61 |
|
|
62 |
public void setEprParam(final String eprParam) { |
|
63 |
this.eprParam = eprParam; |
|
64 |
} |
|
65 |
|
|
66 |
public String getMdFormatName() { |
|
67 |
return mdFormatName; |
|
68 |
} |
|
69 |
|
|
70 |
public void setMdFormatName(final String mdFormatName) { |
|
71 |
this.mdFormatName = mdFormatName; |
|
72 |
} |
|
73 |
|
|
74 |
public String getMdFormatLayout() { |
|
75 |
return mdFormatLayout; |
|
76 |
} |
|
77 |
|
|
78 |
public void setMdFormatLayout(final String mdFormatLayout) { |
|
79 |
this.mdFormatLayout = mdFormatLayout; |
|
80 |
} |
|
81 |
|
|
82 |
public String getMdFormatInterpretation() { |
|
83 |
return mdFormatInterpretation; |
|
84 |
} |
|
85 |
|
|
86 |
public void setMdFormatInterpretation(final String mdFormatInterpretation) { |
|
87 |
this.mdFormatInterpretation = mdFormatInterpretation; |
|
88 |
} |
|
89 |
|
|
90 |
public String getDatasource() { |
|
91 |
return datasource; |
|
92 |
} |
|
93 |
|
|
94 |
public void setDatasource(final String datasource) { |
|
95 |
this.datasource = datasource; |
|
96 |
} |
|
97 |
|
|
98 |
public String getMdstoreId() { |
|
99 |
return mdstoreId; |
|
100 |
} |
|
101 |
|
|
102 |
public void setMdstoreId(final String mdstoreId) { |
|
103 |
this.mdstoreId = mdstoreId; |
|
104 |
} |
|
105 |
|
|
106 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/RefreshSetsFromConfigJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
|
2 |
|
|
3 |
import com.googlecode.sarasvati.NodeToken; |
|
4 |
|
|
5 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
6 |
|
|
7 |
public class RefreshSetsFromConfigJobNode extends AbstractOAIJobNode { |
|
8 |
|
|
9 |
@Override |
|
10 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
|
11 |
job.setAction("REFRESH_CONFIG"); |
|
12 |
} |
|
13 |
|
|
14 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAISetsCountJobNode.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
2 | 2 |
|
3 |
import org.apache.commons.lang.StringUtils; |
|
4 |
|
|
5 | 3 |
import com.googlecode.sarasvati.NodeToken; |
6 |
|
|
4 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
7 | 5 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
8 | 6 |
|
9 | 7 |
public class OAISetsCountJobNode extends AbstractOAIJobNode { |
10 | 8 |
|
11 | 9 |
private String configuredOnly; |
12 |
private String oaiStoreCollectionParam; |
|
13 |
// overrides the value in the env param oaiStoreCollectionParam |
|
14 |
private String oaiStoreCollection; |
|
15 | 10 |
|
16 | 11 |
@Override |
17 | 12 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
18 | 13 |
job.setAction("COUNT_SETS"); |
19 |
job.getParameters().put("configuredOnly", configuredOnly); |
|
20 |
job.getParameters().put("collection", getCollectionName(token)); |
|
21 |
job.getParameters().put("oai_dbName", token.getEnv().getAttribute("oai_dbName")); |
|
14 |
job.getParameters().put(OAIParameterNames.OAI_CONFIGURED_SETS_ONLY, getConfiguredOnly()); |
|
22 | 15 |
} |
23 | 16 |
|
24 |
private String getCollectionName(final NodeToken token) { |
|
25 |
if (StringUtils.isNotBlank(oaiStoreCollection)) return oaiStoreCollection; |
|
26 |
else { |
|
27 |
String collName = token.getEnv().getAttribute(getOaiStoreCollectionParam()); |
|
28 |
if (collName == null) { |
|
29 |
collName = ""; |
|
30 |
} |
|
31 |
return collName; |
|
32 |
} |
|
33 |
} |
|
34 |
|
|
35 | 17 |
public String getConfiguredOnly() { |
36 | 18 |
return configuredOnly; |
37 | 19 |
} |
... | ... | |
40 | 22 |
this.configuredOnly = configuredOnly; |
41 | 23 |
} |
42 | 24 |
|
43 |
public String getOaiStoreCollectionParam() { |
|
44 |
return oaiStoreCollectionParam; |
|
45 |
} |
|
46 |
|
|
47 |
public void setOaiStoreCollectionParam(final String oaiStoreCollectionParam) { |
|
48 |
this.oaiStoreCollectionParam = oaiStoreCollectionParam; |
|
49 |
} |
|
50 |
|
|
51 |
public String getOaiStoreCollection() { |
|
52 |
return oaiStoreCollection; |
|
53 |
} |
|
54 |
|
|
55 |
public void setOaiStoreCollection(final String oaiStoreCollection) { |
|
56 |
this.oaiStoreCollection = oaiStoreCollection; |
|
57 |
} |
|
58 |
|
|
59 | 25 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/PrepareOaiDataJobNode.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import javax.annotation.Resource; |
4 | 4 |
|
5 |
import org.apache.commons.logging.Log; |
|
6 |
import org.apache.commons.logging.LogFactory; |
|
7 |
|
|
8 | 5 |
import com.googlecode.sarasvati.Arc; |
9 | 6 |
import com.googlecode.sarasvati.NodeToken; |
10 |
|
|
7 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
11 | 8 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
12 | 9 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
13 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
|
14 | 10 |
import eu.dnetlib.msro.rmi.MSROException; |
15 | 11 |
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode; |
12 |
import org.apache.commons.lang.StringUtils; |
|
13 |
import org.apache.commons.logging.Log; |
|
14 |
import org.apache.commons.logging.LogFactory; |
|
16 | 15 |
|
17 | 16 |
/** |
18 |
* The Class PrepareOaiDataJobNode. |
|
17 |
* The Class PrepareOaiDataJobNode. Sets the OAI parameters in the env using the constants in OAIParameterNames, to be used by subsequent nodes.
|
|
19 | 18 |
*/ |
20 | 19 |
public class PrepareOaiDataJobNode extends SimpleJobNode { |
21 | 20 |
|
... | ... | |
26 | 25 |
@Resource |
27 | 26 |
private UniqueServiceLocator serviceLocator; |
28 | 27 |
|
29 |
/** Target mongo oai store collection name. **/ |
|
30 |
private String oaiStoreCollectionParam; |
|
28 |
private String oaiDbName; |
|
29 |
private String oaiFormat; |
|
30 |
private String oaiLayout; |
|
31 |
private String oaiInterpretation; |
|
32 |
private String oaiSource; |
|
31 | 33 |
|
32 |
/** Target mongo database name. **/ |
|
33 |
private String oaiDBName; |
|
34 |
/** Name of the env property where to put the value of oaiDBName. **/ |
|
35 |
private String oaiDBNameParam; |
|
36 |
|
|
37 |
private String formatParam = "oai_format"; |
|
38 |
|
|
39 |
private String layoutParam = "oai_layout"; |
|
40 |
|
|
41 |
private String interpretationParam = "oai_interpretation"; |
|
42 |
|
|
43 |
private boolean skipDuplicates = false; |
|
44 |
private String duplicateXPath; |
|
45 |
|
|
46 | 34 |
/* |
47 | 35 |
* (non-Javadoc) |
48 | 36 |
* |
... | ... | |
52 | 40 |
protected String execute(final NodeToken token) throws Exception { |
53 | 41 |
|
54 | 42 |
log.info("start preparing job"); |
43 |
setIfNotBlank(OAIParameterNames.OAI_DB, oaiDbName, token); |
|
44 |
setIfNotBlank(OAIParameterNames.OAI_FORMAT_NAME, oaiFormat, token); |
|
45 |
setIfNotBlank(OAIParameterNames.OAI_FORMAT_LAYOUT, oaiLayout, token); |
|
46 |
setIfNotBlank(OAIParameterNames.OAI_FORMAT_INTERPRETATION, oaiInterpretation, token); |
|
47 |
setIfNotBlank(OAIParameterNames.OAI_COLLECTON, oaiFormat + "-" + oaiLayout + "-" + oaiInterpretation, token); |
|
55 | 48 |
|
56 |
// set the target mongo collection name |
|
57 |
String format = token.getEnv().getAttribute(getFormatParam()); |
|
58 |
String interpretation = token.getEnv().getAttribute(getInterpretationParam()); |
|
59 |
String layout = token.getEnv().getAttribute(getLayoutParam()); |
|
60 |
token.getEnv().setAttribute(getOaiStoreCollectionParam(), format + "-" + layout + "-" + interpretation); |
|
61 |
|
|
62 | 49 |
String configurationProfile = getConfigurationProfile(); |
63 |
token.getEnv().setAttribute("oaiConfiguration", configurationProfile); |
|
64 |
token.getEnv().setAttribute("oai.feed.date", DateUtils.now_ISO8601()); |
|
65 |
|
|
66 |
token.getEnv().setAttribute(getOaiDBNameParam(), getOaiDBName()); |
|
67 |
|
|
68 |
// services.publisher.oai. |
|
69 |
// duplicates |
|
70 |
token.getEnv().setAttribute("services.publisher.oai.skipDuplicates", skipDuplicates); |
|
71 |
token.getEnv().setAttribute("services.publisher.oai.duplicateXPath", duplicateXPath); |
|
72 |
|
|
50 |
setIfNotBlank(OAIParameterNames.OAI_CONFIGURATION_PROFILE, configurationProfile, token); |
|
73 | 51 |
return Arc.DEFAULT_ARC; |
74 | 52 |
} |
75 | 53 |
|
54 |
private void setIfNotBlank(final String attrName, final String attrValue, final NodeToken token){ |
|
55 |
if(StringUtils.isNotBlank(attrValue)) |
|
56 |
token.getEnv().setAttribute(attrName, attrValue); |
|
57 |
} |
|
58 |
|
|
76 | 59 |
/** |
77 | 60 |
* Gets the configuration profile. |
78 | 61 |
* |
... | ... | |
89 | 72 |
} |
90 | 73 |
} |
91 | 74 |
|
92 |
/** |
|
93 |
* Gets the oai store collection param. |
|
94 |
* |
|
95 |
* @return the oai store collection param |
|
96 |
*/ |
|
97 |
public String getOaiStoreCollectionParam() { |
|
98 |
return oaiStoreCollectionParam; |
|
75 |
public String getOaiDbName() { |
|
76 |
return oaiDbName; |
|
99 | 77 |
} |
100 | 78 |
|
101 |
/** |
|
102 |
* Sets the oai store collection param. |
|
103 |
* |
|
104 |
* @param oaiStoreCollectionParam |
|
105 |
* the new oai store collection param |
|
106 |
*/ |
|
107 |
public void setOaiStoreCollectionParam(final String oaiStoreCollectionParam) { |
|
108 |
this.oaiStoreCollectionParam = oaiStoreCollectionParam; |
|
79 |
public void setOaiDbName(final String oaiDbName) { |
|
80 |
this.oaiDbName = oaiDbName; |
|
109 | 81 |
} |
110 | 82 |
|
111 |
public String getOaiDBName() {
|
|
112 |
return oaiDBName;
|
|
83 |
public String getOaiFormat() {
|
|
84 |
return oaiFormat;
|
|
113 | 85 |
} |
114 | 86 |
|
115 |
public void setOaiDBName(final String oaiDBName) {
|
|
116 |
this.oaiDBName = oaiDBName;
|
|
87 |
public void setOaiFormat(final String oaiFormat) {
|
|
88 |
this.oaiFormat = oaiFormat;
|
|
117 | 89 |
} |
118 | 90 |
|
119 |
public String getOaiDBNameParam() {
|
|
120 |
return oaiDBNameParam;
|
|
91 |
public String getOaiLayout() {
|
|
92 |
return oaiLayout;
|
|
121 | 93 |
} |
122 | 94 |
|
123 |
public void setOaiDBNameParam(final String oaiDBNameParam) {
|
|
124 |
this.oaiDBNameParam = oaiDBNameParam;
|
|
95 |
public void setOaiLayout(final String oaiLayout) {
|
|
96 |
this.oaiLayout = oaiLayout;
|
|
125 | 97 |
} |
126 | 98 |
|
127 |
public String getFormatParam() {
|
|
128 |
return formatParam;
|
|
99 |
public String getOaiInterpretation() {
|
|
100 |
return oaiInterpretation;
|
|
129 | 101 |
} |
130 | 102 |
|
131 |
public void setFormatParam(final String formatParam) {
|
|
132 |
this.formatParam = formatParam;
|
|
103 |
public void setOaiInterpretation(final String oaiInterpretation) {
|
|
104 |
this.oaiInterpretation = oaiInterpretation;
|
|
133 | 105 |
} |
134 | 106 |
|
135 |
public String getLayoutParam() {
|
|
136 |
return layoutParam;
|
|
107 |
public String getOaiSource() {
|
|
108 |
return oaiSource;
|
|
137 | 109 |
} |
138 | 110 |
|
139 |
public void setLayoutParam(final String layoutParam) {
|
|
140 |
this.layoutParam = layoutParam;
|
|
111 |
public void setOaiSource(final String oaiSource) {
|
|
112 |
this.oaiSource = oaiSource;
|
|
141 | 113 |
} |
142 | 114 |
|
143 |
public String getInterpretationParam() { |
|
144 |
return interpretationParam; |
|
145 |
} |
|
146 | 115 |
|
147 |
public void setInterpretationParam(final String interpretationParam) { |
|
148 |
this.interpretationParam = interpretationParam; |
|
149 |
} |
|
150 |
|
|
151 |
public boolean isSkipDuplicates() { |
|
152 |
return skipDuplicates; |
|
153 |
} |
|
154 |
|
|
155 |
public void setSkipDuplicates(final boolean skipDuplicates) { |
|
156 |
this.skipDuplicates = skipDuplicates; |
|
157 |
} |
|
158 |
|
|
159 |
public String getDuplicateXPath() { |
|
160 |
return duplicateXPath; |
|
161 |
} |
|
162 |
|
|
163 |
public void setDuplicateXPath(final String duplicateXPath) { |
|
164 |
this.duplicateXPath = duplicateXPath; |
|
165 |
} |
|
166 |
|
|
167 | 116 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/SyncOAIStoreJobNode.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
2 | 2 |
|
3 |
import org.apache.commons.logging.Log; |
|
4 |
import org.apache.commons.logging.LogFactory; |
|
5 |
import org.springframework.beans.factory.annotation.Required; |
|
6 |
|
|
7 | 3 |
import com.googlecode.sarasvati.NodeToken; |
8 |
|
|
4 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
9 | 5 |
import eu.dnetlib.enabling.resultset.rmi.ResultSetException; |
10 | 6 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
7 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
|
11 | 8 |
import eu.dnetlib.msro.workflows.nodes.ProgressJobNode; |
12 | 9 |
import eu.dnetlib.msro.workflows.resultset.ProcessCountingResultSetFactory; |
13 | 10 |
import eu.dnetlib.msro.workflows.util.ProgressProvider; |
14 | 11 |
import eu.dnetlib.msro.workflows.util.ResultsetProgressProvider; |
12 |
import org.apache.commons.logging.Log; |
|
13 |
import org.apache.commons.logging.LogFactory; |
|
14 |
import org.springframework.beans.factory.annotation.Required; |
|
15 | 15 |
|
16 | 16 |
public class SyncOAIStoreJobNode extends AbstractOAIJobNode implements ProgressJobNode { |
17 | 17 |
|
18 | 18 |
private static final Log log = LogFactory.getLog(SyncOAIStoreJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM |
19 | 19 |
|
20 |
private String eprParam; |
|
21 |
|
|
22 | 20 |
private ProcessCountingResultSetFactory processCountingResultSetFactory; |
23 | 21 |
|
24 | 22 |
private ResultsetProgressProvider progressProvider; |
25 | 23 |
|
26 |
private String formatParam, layoutParam, interpretationParam, oai_dbName; |
|
27 |
|
|
24 |
private String eprParam; |
|
28 | 25 |
private boolean alwaysNewRecord = false; |
26 |
private boolean skipDuplicates = false; |
|
27 |
private String duplicateXPath; |
|
29 | 28 |
|
30 | 29 |
@Override |
31 | 30 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException { |
... | ... | |
33 | 32 |
final String eprS = token.getEnv().getAttribute(getEprParam()); |
34 | 33 |
this.progressProvider = processCountingResultSetFactory.createProgressProvider(token.getProcess(), eprS); |
35 | 34 |
job.setAction("SYNC"); |
36 |
job.getParameters().put("oai_syncEpr", progressProvider.getEpr().toString()); |
|
37 |
job.getParameters().put("oai_recordSource", token.getEnv().getAttribute("oai_recordSource")); |
|
38 |
job.getParameters().put("oai_formatName", token.getEnv().getAttribute(formatParam)); |
|
39 |
job.getParameters().put("oai_formatLayout", token.getEnv().getAttribute(layoutParam)); |
|
40 |
job.getParameters().put("oai_formatInterpretation", token.getEnv().getAttribute(interpretationParam)); |
|
41 |
job.getParameters().put("oai_dbName", getOai_dbName()); |
|
42 |
job.getParameters().put("oai_alwaysNewRecord", String.valueOf(alwaysNewRecord)); |
|
43 |
token.getEnv().setAttribute("oai_dbName", getOai_dbName()); |
|
44 |
log.fatal("Job prepared"); |
|
45 |
|
|
35 |
job.getParameters().put(OAIParameterNames.OAI_FEED_DATE, DateUtils.now_ISO8601()); |
|
36 |
job.getParameters().put(OAIParameterNames.OAI_SKIP_DUPLICATES, String.valueOf(skipDuplicates)); |
|
37 |
if(skipDuplicates) job.getParameters().put(OAIParameterNames.OAI_DUPLICATE_XPATH, duplicateXPath); |
|
38 |
job.getParameters().put(OAIParameterNames.OAI_SYNC_EPR, progressProvider.getEpr().toString()); |
|
39 |
job.getParameters().put(OAIParameterNames.OAI_ALWAYS_NEW_RECORD, String.valueOf(alwaysNewRecord)); |
|
40 |
log.fatal("OAI Sync Job prepared"); |
|
46 | 41 |
} |
47 | 42 |
|
48 |
public String getEprParam() { |
|
49 |
return eprParam; |
|
50 |
} |
|
51 |
|
|
52 |
public void setEprParam(final String eprParam) { |
|
53 |
this.eprParam = eprParam; |
|
54 |
} |
|
55 |
|
|
56 | 43 |
public ProcessCountingResultSetFactory getProcessCountingResultSetFactory() { |
57 | 44 |
return processCountingResultSetFactory; |
58 | 45 |
} |
... | ... | |
62 | 49 |
this.processCountingResultSetFactory = processCountingResultSetFactory; |
63 | 50 |
} |
64 | 51 |
|
65 |
public String getFormatParam() { |
|
66 |
return formatParam; |
|
52 |
@Override |
|
53 |
public ProgressProvider getProgressProvider() { |
|
54 |
return this.progressProvider; |
|
67 | 55 |
} |
68 | 56 |
|
69 |
public void setFormatParam(final String formatParam) { |
|
70 |
this.formatParam = formatParam; |
|
71 |
} |
|
72 | 57 |
|
73 |
public String getLayoutParam() {
|
|
74 |
return layoutParam;
|
|
58 |
public String getEprParam() {
|
|
59 |
return eprParam;
|
|
75 | 60 |
} |
76 | 61 |
|
77 |
public void setLayoutParam(final String layoutParam) {
|
|
78 |
this.layoutParam = layoutParam;
|
|
62 |
public void setEprParam(final String eprParam) {
|
|
63 |
this.eprParam = eprParam;
|
|
79 | 64 |
} |
80 | 65 |
|
81 |
public String getInterpretationParam() {
|
|
82 |
return interpretationParam;
|
|
66 |
public boolean isAlwaysNewRecord() {
|
|
67 |
return alwaysNewRecord;
|
|
83 | 68 |
} |
84 | 69 |
|
85 |
public void setInterpretationParam(final String interpretationParam) {
|
|
86 |
this.interpretationParam = interpretationParam;
|
|
70 |
public void setAlwaysNewRecord(boolean alwaysNewRecord) {
|
|
71 |
this.alwaysNewRecord = alwaysNewRecord;
|
|
87 | 72 |
} |
88 | 73 |
|
89 |
public String getOai_dbName() {
|
|
90 |
return oai_dbName;
|
|
74 |
public boolean isSkipDuplicates() {
|
|
75 |
return skipDuplicates;
|
|
91 | 76 |
} |
92 | 77 |
|
93 |
public void setOai_dbName(final String oai_dbName) {
|
|
94 |
this.oai_dbName = oai_dbName;
|
|
78 |
public void setSkipDuplicates(final boolean skipDuplicates) {
|
|
79 |
this.skipDuplicates = skipDuplicates;
|
|
95 | 80 |
} |
96 | 81 |
|
97 |
@Override |
|
98 |
public ProgressProvider getProgressProvider() { |
|
99 |
return this.progressProvider; |
|
82 |
public String getDuplicateXPath() { |
|
83 |
return duplicateXPath; |
|
100 | 84 |
} |
101 | 85 |
|
102 |
public boolean isAlwaysNewRecord() {
|
|
103 |
return alwaysNewRecord;
|
|
86 |
public void setDuplicateXPath(final String duplicateXPath) {
|
|
87 |
this.duplicateXPath = duplicateXPath;
|
|
104 | 88 |
} |
105 | 89 |
|
106 |
public void setAlwaysNewRecord(boolean alwaysNewRecord) { |
|
107 |
this.alwaysNewRecord = alwaysNewRecord; |
|
108 |
} |
|
109 |
|
|
110 | 90 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAICreateIndexJobNode.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
2 | 2 |
|
3 |
import org.apache.commons.lang.StringUtils; |
|
4 |
|
|
5 | 3 |
import com.googlecode.sarasvati.NodeToken; |
6 |
|
|
4 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
7 | 5 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
8 | 6 |
|
7 |
/** |
|
8 |
* Create indexes on the oaistore on the fields specified in the parameter. |
|
9 |
*/ |
|
9 | 10 |
public class OAICreateIndexJobNode extends AbstractOAIJobNode { |
10 | 11 |
|
11 |
private String oaiStoreCollectionParam; |
|
12 |
// overrides the value in the env param oaiStoreCollectionParam |
|
13 |
private String oaiStoreCollection; |
|
14 |
|
|
15 | 12 |
/** |
16 | 13 |
* Name of the fields (comma separated) to be included in the same index. For several indexes separate the fieldNames with ; |
17 | 14 |
* <p> |
... | ... | |
24 | 21 |
@Override |
25 | 22 |
public void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
26 | 23 |
job.setAction("CREATE_OAI_INDEX"); |
27 |
job.getParameters().put("collection", getCollectionName(token)); |
|
28 |
job.getParameters().put("oai_index_fieldNames", fieldNames); |
|
24 |
job.getParameters().put(OAIParameterNames.OAI_INDEXES, getFieldNames()); |
|
29 | 25 |
} |
30 | 26 |
|
31 |
private String getCollectionName(final NodeToken token) { |
|
32 |
if (StringUtils.isNotBlank(oaiStoreCollection)) return oaiStoreCollection; |
|
33 |
else { |
|
34 |
String collName = token.getEnv().getAttribute(getOaiStoreCollectionParam()); |
|
35 |
if (collName == null) { |
|
36 |
collName = ""; |
|
37 |
} |
|
38 |
return collName; |
|
39 |
} |
|
40 |
} |
|
41 |
|
|
42 | 27 |
public String getFieldNames() { |
43 | 28 |
return fieldNames; |
44 | 29 |
} |
... | ... | |
46 | 31 |
public void setFieldNames(final String fieldNames) { |
47 | 32 |
this.fieldNames = fieldNames; |
48 | 33 |
} |
49 |
|
|
50 |
public String getOaiStoreCollectionParam() { |
|
51 |
return oaiStoreCollectionParam; |
|
52 |
} |
|
53 |
|
|
54 |
public void setOaiStoreCollectionParam(final String oaiStoreCollectionParam) { |
|
55 |
this.oaiStoreCollectionParam = oaiStoreCollectionParam; |
|
56 |
} |
|
57 |
|
|
58 |
public String getOaiStoreCollection() { |
|
59 |
return oaiStoreCollection; |
|
60 |
} |
|
61 |
|
|
62 |
public void setOaiStoreCollection(final String oaiStoreCollection) { |
|
63 |
this.oaiStoreCollection = oaiStoreCollection; |
|
64 |
} |
|
65 |
|
|
66 | 34 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAICreateStoreJobNode.java | ||
---|---|---|
6 | 6 |
|
7 | 7 |
public class OAICreateStoreJobNode extends AbstractOAIJobNode { |
8 | 8 |
|
9 |
private String formatParam, layoutParam, interpretationParam; |
|
10 |
|
|
11 | 9 |
@Override |
12 | 10 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
13 | 11 |
job.setAction("CREATE_STORE"); |
14 |
job.getParameters().put("format", token.getEnv().getAttribute(formatParam)); |
|
15 |
job.getParameters().put("layout", token.getEnv().getAttribute(layoutParam)); |
|
16 |
job.getParameters().put("interpretation", token.getEnv().getAttribute(interpretationParam)); |
|
17 | 12 |
} |
18 | 13 |
|
19 |
public String getFormatParam() { |
|
20 |
return formatParam; |
|
21 |
} |
|
22 | 14 |
|
23 |
public void setFormatParam(final String formatParam) { |
|
24 |
this.formatParam = formatParam; |
|
25 |
} |
|
26 |
|
|
27 |
public String getLayoutParam() { |
|
28 |
return layoutParam; |
|
29 |
} |
|
30 |
|
|
31 |
public void setLayoutParam(final String layoutParam) { |
|
32 |
this.layoutParam = layoutParam; |
|
33 |
} |
|
34 |
|
|
35 |
public String getInterpretationParam() { |
|
36 |
return interpretationParam; |
|
37 |
} |
|
38 |
|
|
39 |
public void setInterpretationParam(final String interpretationParam) { |
|
40 |
this.interpretationParam = interpretationParam; |
|
41 |
} |
|
42 |
|
|
43 | 15 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAIDropStoreJobNode.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
2 | 2 |
|
3 |
import org.apache.commons.lang.StringUtils; |
|
4 |
|
|
5 | 3 |
import com.googlecode.sarasvati.NodeToken; |
6 |
import com.googlecode.sarasvati.env.Env; |
|
7 |
|
|
8 | 4 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
9 | 5 |
|
10 | 6 |
public class OAIDropStoreJobNode extends AbstractOAIJobNode { |
11 | 7 |
|
12 |
private String formatParam, layoutParam, interpretationParam; |
|
13 |
// name of the env attribute where you can find the set name |
|
14 |
private String setSpecParam; |
|
15 |
private String setSpec; |
|
16 |
|
|
17 | 8 |
@Override |
18 | 9 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
19 | 10 |
job.setAction("DROP_STORE"); |
20 |
job.getParameters().put("format", token.getEnv().getAttribute(formatParam)); |
|
21 |
job.getParameters().put("layout", token.getEnv().getAttribute(layoutParam)); |
|
22 |
job.getParameters().put("interpretation", token.getEnv().getAttribute(interpretationParam)); |
|
23 |
String set = getTheSetName(token.getEnv()); |
|
24 |
if (StringUtils.isNotBlank(set)) { |
|
25 |
job.getParameters().put("set", set); |
|
26 |
} |
|
27 | 11 |
} |
28 | 12 |
|
29 |
private String getTheSetName(final Env env) { |
|
30 |
if (StringUtils.isNotBlank(setSpec)) return setSpec; |
|
31 |
else return env.getAttribute(setSpecParam); |
|
32 |
|
|
33 |
} |
|
34 |
|
|
35 |
public String getFormatParam() { |
|
36 |
return formatParam; |
|
37 |
} |
|
38 |
|
|
39 |
public void setFormatParam(final String formatParam) { |
|
40 |
this.formatParam = formatParam; |
|
41 |
} |
|
42 |
|
|
43 |
public String getLayoutParam() { |
|
44 |
return layoutParam; |
|
45 |
} |
|
46 |
|
|
47 |
public void setLayoutParam(final String layoutParam) { |
|
48 |
this.layoutParam = layoutParam; |
|
49 |
} |
|
50 |
|
|
51 |
public String getInterpretationParam() { |
|
52 |
return interpretationParam; |
|
53 |
} |
|
54 |
|
|
55 |
public void setInterpretationParam(final String interpretationParam) { |
|
56 |
this.interpretationParam = interpretationParam; |
|
57 |
} |
|
58 |
|
|
59 |
public String getSetNameParam() { |
|
60 |
return setSpecParam; |
|
61 |
} |
|
62 |
|
|
63 |
public void setSetNameParam(final String setNameParam) { |
|
64 |
this.setSpecParam = setNameParam; |
|
65 |
} |
|
66 |
|
|
67 |
public String getSetName() { |
|
68 |
return setSpec; |
|
69 |
} |
|
70 |
|
|
71 |
public void setSetName(final String setName) { |
|
72 |
this.setSpec = setName; |
|
73 |
} |
|
74 |
|
|
75 | 13 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAIEnsureIndexesJobNode.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
2 | 2 |
|
3 |
import org.apache.commons.lang.StringUtils; |
|
4 |
|
|
5 | 3 |
import com.googlecode.sarasvati.NodeToken; |
6 |
|
|
7 | 4 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
8 | 5 |
|
6 |
/** |
|
7 |
* Creates the indexes on OAI stores based on the OAI configuration. |
|
8 |
*/ |
|
9 | 9 |
public class OAIEnsureIndexesJobNode extends AbstractOAIJobNode { |
10 | 10 |
|
11 |
private String oaiStoreCollectionParam; |
|
12 |
// overrides the value in the env param oaiStoreCollectionParam |
|
13 |
private String oaiStoreCollection; |
|
14 |
|
|
15 | 11 |
@Override |
16 | 12 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
17 |
|
|
18 | 13 |
job.setAction("ENSURE_INDEXES"); |
19 |
job.getParameters().put("collection", getCollectionName(token)); |
|
20 | 14 |
} |
21 |
|
|
22 |
private String getCollectionName(final NodeToken token) { |
|
23 |
if (StringUtils.isNotBlank(oaiStoreCollection)) return oaiStoreCollection; |
|
24 |
else { |
|
25 |
String collName = token.getEnv().getAttribute(getOaiStoreCollectionParam()); |
|
26 |
return StringUtils.isBlank(collName)? "" : collName; |
|
27 |
} |
|
28 |
} |
|
29 |
|
|
30 |
public String getOaiStoreCollectionParam() { |
|
31 |
return oaiStoreCollectionParam; |
|
32 |
} |
|
33 |
|
|
34 |
public void setOaiStoreCollectionParam(final String oaiStoreCollectionParam) { |
|
35 |
this.oaiStoreCollectionParam = oaiStoreCollectionParam; |
|
36 |
} |
|
37 |
|
|
38 |
public String getOaiStoreCollection() { |
|
39 |
return oaiStoreCollection; |
|
40 |
} |
|
41 |
|
|
42 |
public void setOaiStoreCollection(final String oaiStoreCollection) { |
|
43 |
this.oaiStoreCollection = oaiStoreCollection; |
|
44 |
} |
|
45 |
|
|
46 | 15 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/AbstractOAIJobNode.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
2 | 2 |
|
3 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
3 | 4 |
import org.apache.commons.lang.StringUtils; |
4 | 5 |
|
5 | 6 |
import com.googlecode.sarasvati.NodeToken; |
... | ... | |
11 | 12 |
|
12 | 13 |
public abstract class AbstractOAIJobNode extends BlackboardJobNode { |
13 | 14 |
|
14 |
private String dbNameParam;
|
|
15 |
// overrides the value in the env param dbNameParam
|
|
16 |
private String dbName;
|
|
15 |
private String oaiDbNameParam = OAIParameterNames.OAI_DB;
|
|
16 |
// overrides the value in the env param oaiDbNameParam
|
|
17 |
private String oaiDbName;
|
|
17 | 18 |
|
18 |
protected String getTheDBName(final NodeToken token) { |
|
19 |
if (StringUtils.isNotBlank(dbName)) { |
|
20 |
return dbName; |
|
21 |
} else { |
|
22 |
return token.getEnv().getAttribute(getDbNameParam()); |
|
23 |
} |
|
19 |
private String oaiFormatParam = OAIParameterNames.OAI_FORMAT_NAME; |
|
20 |
private String oaiFormat; |
|
21 |
|
|
22 |
private String oaiLayoutParam = OAIParameterNames.OAI_FORMAT_LAYOUT; |
|
23 |
private String oaiLayout; |
|
24 |
|
|
25 |
private String oaiInterpretationParam = OAIParameterNames.OAI_FORMAT_INTERPRETATION; |
|
26 |
private String oaiInterpretation; |
|
27 |
|
|
28 |
private String oaiSourceParam = OAIParameterNames.OAI_SOURCE; |
|
29 |
// overrides the value in the env param oaiSourceParam |
|
30 |
private String oaiSource; |
|
31 |
|
|
32 |
protected String getTheOAIDBName(final NodeToken token) { |
|
33 |
return StringUtils.isNotBlank(oaiDbName)? oaiDbName : token.getEnv().getAttribute(oaiDbNameParam); |
|
24 | 34 |
} |
35 |
protected String getTheOAIFormat(final NodeToken token) { |
|
36 |
return StringUtils.isNotBlank(oaiFormat)? oaiFormat : token.getEnv().getAttribute(oaiFormatParam); |
|
37 |
} |
|
38 |
protected String getTheOAILayout(final NodeToken token) { |
|
39 |
return StringUtils.isNotBlank(oaiLayout)? oaiLayout : token.getEnv().getAttribute(oaiLayoutParam); |
|
40 |
} |
|
41 |
protected String getTheOAIInterpretation(final NodeToken token) { |
|
42 |
return StringUtils.isNotBlank(oaiInterpretation)? oaiInterpretation : token.getEnv().getAttribute(oaiInterpretationParam); |
|
43 |
} |
|
44 |
protected String getTheOAISource(final NodeToken token) { |
|
45 |
return StringUtils.isNotBlank(oaiSource)? oaiSource : token.getEnv().getAttribute(oaiSourceParam); |
|
46 |
} |
|
25 | 47 |
|
48 |
protected String getTheOAICollection(final NodeToken token) { |
|
49 |
return getTheOAIFormat(token) + "-" + getTheOAILayout(token) + "-" + getTheOAIInterpretation(token); |
|
50 |
} |
|
51 |
|
|
52 |
|
|
26 | 53 |
@Override |
27 | 54 |
protected String obtainServiceId(final NodeToken token) { |
28 | 55 |
return getServiceLocator().getServiceId(OAIStoreService.class); |
... | ... | |
30 | 57 |
|
31 | 58 |
@Override |
32 | 59 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException { |
33 |
job.getParameters().put("oai_dbName", getTheDBName(token)); |
|
60 |
job.getParameters().put(OAIParameterNames.OAI_DB, getTheOAIDBName(token)); |
|
61 |
job.getParameters().put(OAIParameterNames.OAI_FORMAT_NAME, getTheOAIFormat(token)); |
|
62 |
job.getParameters().put(OAIParameterNames.OAI_FORMAT_LAYOUT, getTheOAILayout(token)); |
|
63 |
job.getParameters().put(OAIParameterNames.OAI_FORMAT_INTERPRETATION, getTheOAIInterpretation(token)); |
|
64 |
job.getParameters().put(OAIParameterNames.OAI_COLLECTON, getTheOAICollection(token)); |
|
65 |
String theSource = getTheOAISource(token); |
|
66 |
if(StringUtils.isNotBlank(theSource)) job.getParameters().put(OAIParameterNames.OAI_SOURCE, getTheOAISource(token)); |
|
34 | 67 |
completePrepareJob(job, token); |
35 | 68 |
} |
36 | 69 |
|
37 | 70 |
abstract void completePrepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException; |
38 | 71 |
|
39 |
public String getDbNameParam() { |
|
40 |
return dbNameParam;
|
|
72 |
public String getOaiDbNameParam() {
|
|
73 |
return oaiDbNameParam;
|
|
41 | 74 |
} |
42 | 75 |
|
43 |
public void setDbNameParam(final String dbNameParam) {
|
|
44 |
this.dbNameParam = dbNameParam;
|
|
76 |
public void setOaiDbNameParam(final String oaiDbNameParam) {
|
|
77 |
this.oaiDbNameParam = oaiDbNameParam;
|
|
45 | 78 |
} |
46 | 79 |
|
47 |
public String getDbName() { |
|
48 |
return dbName;
|
|
80 |
public String getOaiDbName() {
|
|
81 |
return oaiDbName;
|
|
49 | 82 |
} |
50 | 83 |
|
51 |
public void setDbName(final String dbName) {
|
|
52 |
this.dbName = dbName;
|
|
84 |
public void setOaiDbName(final String oaiDbName) {
|
|
85 |
this.oaiDbName = oaiDbName;
|
|
53 | 86 |
} |
87 |
|
|
88 |
public String getOaiFormatParam() { |
|
89 |
return oaiFormatParam; |
|
90 |
} |
|
91 |
|
|
92 |
public void setOaiFormatParam(final String oaiFormatParam) { |
|
93 |
this.oaiFormatParam = oaiFormatParam; |
|
94 |
} |
|
95 |
|
|
96 |
public String getOaiFormat() { |
|
97 |
return oaiFormat; |
|
98 |
} |
|
99 |
|
|
100 |
public void setOaiFormat(final String oaiFormat) { |
|
101 |
this.oaiFormat = oaiFormat; |
|
102 |
} |
|
103 |
|
|
104 |
public String getOaiLayoutParam() { |
|
105 |
return oaiLayoutParam; |
|
106 |
} |
|
107 |
|
|
108 |
public void setOaiLayoutParam(final String oaiLayoutParam) { |
|
109 |
this.oaiLayoutParam = oaiLayoutParam; |
|
110 |
} |
|
111 |
|
|
112 |
public String getOaiLayout() { |
|
113 |
return oaiLayout; |
|
114 |
} |
|
115 |
|
|
116 |
public void setOaiLayout(final String oaiLayout) { |
|
117 |
this.oaiLayout = oaiLayout; |
|
118 |
} |
|
119 |
|
|
120 |
public String getOaiInterpretationParam() { |
|
121 |
return oaiInterpretationParam; |
|
122 |
} |
|
123 |
|
|
124 |
public void setOaiInterpretationParam(final String oaiInterpretationParam) { |
|
125 |
this.oaiInterpretationParam = oaiInterpretationParam; |
|
126 |
} |
|
127 |
|
|
128 |
public String getOaiInterpretation() { |
|
129 |
return oaiInterpretation; |
|
130 |
} |
|
131 |
|
|
132 |
public void setOaiInterpretation(final String oaiInterpretation) { |
|
133 |
this.oaiInterpretation = oaiInterpretation; |
|
134 |
} |
|
135 |
|
|
136 |
public String getOaiSourceParam() { |
|
137 |
return oaiSourceParam; |
|
138 |
} |
|
139 |
|
|
140 |
public void setOaiSourceParam(final String oaiSourceParam) { |
|
141 |
this.oaiSourceParam = oaiSourceParam; |
|
142 |
} |
|
143 |
|
|
144 |
public String getOaiSource() { |
|
145 |
return oaiSource; |
|
146 |
} |
|
147 |
|
|
148 |
public void setOaiSource(final String oaiSource) { |
|
149 |
this.oaiSource = oaiSource; |
|
150 |
} |
|
54 | 151 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/SetCurrentOAIDBJobNode.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import javax.annotation.Resource; |
4 | 4 |
|
5 |
import org.apache.commons.lang.StringUtils; |
|
6 |
import org.apache.commons.logging.Log; |
|
7 |
import org.apache.commons.logging.LogFactory; |
|
8 |
|
|
9 | 5 |
import com.googlecode.sarasvati.Arc; |
10 | 6 |
import com.googlecode.sarasvati.NodeToken; |
11 |
|
|
7 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
12 | 8 |
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService; |
13 | 9 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
14 | 10 |
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode; |
11 |
import org.apache.commons.lang.StringUtils; |
|
12 |
import org.apache.commons.logging.Log; |
|
13 |
import org.apache.commons.logging.LogFactory; |
|
15 | 14 |
|
16 |
/** |
|
17 |
* The Class PrepareOaiDataJobNode. |
|
18 |
*/ |
|
19 | 15 |
public class SetCurrentOAIDBJobNode extends SimpleJobNode { |
20 | 16 |
|
21 | 17 |
/** The Constant log. */ |
... | ... | |
24 | 20 |
/** The service locator. */ |
25 | 21 |
@Resource |
26 | 22 |
private UniqueServiceLocator serviceLocator; |
23 |
// overrides the value in the env param |
|
24 |
private String oaiDbName; |
|
27 | 25 |
|
28 |
/** Target mongo database name. **/ |
|
29 |
private String oaiDBName; |
|
30 |
/** Name of the env property where to put the value of oaiDBName. **/ |
|
31 |
private String oaiDBNameParam; |
|
32 |
|
|
33 | 26 |
private String xpathToCurrentDB = "//RESOURCE_PROFILE[.//RESOURCE_TYPE/@value = 'OAIPublisherConfigurationDSResourceType']//CONFIGURATION/CURRENTDB"; |
34 | 27 |
|
35 |
protected String getTheDBName(final NodeToken token) { |
|
36 |
if (StringUtils.isNotBlank(oaiDBName)) { |
|
37 |
return oaiDBName; |
|
38 |
} else { |
|
39 |
return token.getEnv().getAttribute(oaiDBNameParam); |
|
40 |
} |
|
41 |
} |
|
42 |
|
|
43 |
/* |
|
44 |
* (non-Javadoc) |
|
45 |
* |
|
46 |
* @see eu.dnetlib.msro.workflows.nodes.SimpleJobNode#execute(com.googlecode.sarasvati.NodeToken) |
|
47 |
*/ |
|
48 | 28 |
@Override |
49 | 29 |
protected String execute(final NodeToken token) throws Exception { |
50 |
String dbToSet = getTheDBName(token); |
|
30 |
String dbToSet = getTheOAIDBName(token);
|
|
51 | 31 |
log.fatal("Setting OAI Publisher to use db " + dbToSet); |
52 | 32 |
String xUpdate = "update value " + xpathToCurrentDB + " with '" + dbToSet + "'"; |
53 | 33 |
this.serviceLocator.getService(ISRegistryService.class).executeXUpdate(xUpdate); |
54 | 34 |
return Arc.DEFAULT_ARC; |
55 | 35 |
} |
56 | 36 |
|
57 |
public String getOaiDBName() {
|
|
58 |
return oaiDBName;
|
|
37 |
protected String getTheOAIDBName(final NodeToken token) {
|
|
38 |
return StringUtils.isNotBlank(oaiDbName)? oaiDbName : token.getEnv().getAttribute(OAIParameterNames.OAI_DB);
|
|
59 | 39 |
} |
60 | 40 |
|
61 |
public void setOaiDBName(final String oaiDBName) {
|
|
62 |
this.oaiDBName = oaiDBName;
|
|
41 |
public String getOaiDbName() {
|
|
42 |
return oaiDbName;
|
|
63 | 43 |
} |
64 | 44 |
|
65 |
public String getOaiDBNameParam() {
|
|
66 |
return oaiDBNameParam;
|
|
45 |
public void setOaiDbName(final String oaiDbName) {
|
|
46 |
this.oaiDbName = oaiDbName;
|
|
67 | 47 |
} |
68 | 48 |
|
69 |
public void setOaiDBNameParam(final String oaiDBNameParam) { |
|
70 |
this.oaiDBNameParam = oaiDBNameParam; |
|
71 |
} |
|
72 |
|
|
73 | 49 |
public String getXpathToCurrentDB() { |
74 | 50 |
return xpathToCurrentDB; |
75 | 51 |
} |
... | ... | |
78 | 54 |
this.xpathToCurrentDB = xpathToCurrentDB; |
79 | 55 |
|
80 | 56 |
} |
57 |
|
|
81 | 58 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/RefreshOAIConfigJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
|
2 |
|
|
3 |
import com.googlecode.sarasvati.NodeToken; |
|
4 |
|
|
5 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
6 |
|
|
7 |
public class RefreshOAIConfigJobNode extends AbstractOAIJobNode { |
|
8 |
|
|
9 |
@Override |
|
10 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
|
11 |
job.setAction("REFRESH_CONFIG"); |
|
12 |
} |
|
13 |
|
|
14 |
} |
modules/dnet-oai-common-workflows/trunk/src/main/resources/eu/dnetlib/test/profiles/workflows/oai/oai.consistency.xml | ||
---|---|---|
12 | 12 |
<WORKFLOW_TYPE>Provision</WORKFLOW_TYPE> |
13 | 13 |
<WORKFLOW_PRIORITY>30</WORKFLOW_PRIORITY> |
14 | 14 |
<CONFIGURATION start="manual"> |
15 |
<NODE name="setFormat" type="SetFormatInfo" isStart="true"> |
|
16 |
<DESCRIPTION /> |
|
17 |
<PARAMETERS> |
|
18 |
<PARAM name="format" type="string" managedBy="user" required="true">oaf</PARAM> |
|
19 |
<PARAM name="layout" type="string" managedBy="user" required="true">index</PARAM> |
|
20 |
<PARAM name="interpretation" type="string" managedBy="user" required="true">openaire</PARAM> |
|
21 |
<PARAM name="formatParam" type="string" managedBy="system" required="true">oai_format</PARAM> |
|
22 |
<PARAM name="layoutParam" type="string" managedBy="system" required="true">oai_layout</PARAM> |
|
23 |
<PARAM name="interpretationParam" type="string" managedBy="system" required="true">oai_interpretation</PARAM> |
|
24 |
</PARAMETERS> |
|
25 |
<ARCS> |
|
26 |
<ARC to="prepareOAI" /> |
|
27 |
</ARCS> |
|
28 |
</NODE> |
|
29 |
<NODE name="prepareOAI" type="PrepareOaiJob"> |
|
15 |
<NODE name="prepareOAI" type="PrepareOaiJob" isStart="true"> |
|
30 | 16 |
<DESCRIPTION>Prepare target OAI store</DESCRIPTION> |
31 | 17 |
<PARAMETERS> |
32 |
<PARAM name="oaiStoreCollectionParam" type="string" managedBy="system" required="true">oaiStoreCollection</PARAM> |
|
33 |
<PARAM name="oaiDBName" type="string" managedBy="user" required="true">oaistore</PARAM> |
|
34 |
<PARAM name="oaiDBNameParam" type="string" managedBy="system" required="true">oai_dbName</PARAM> |
|
18 |
<PARAM name="oaiDbName" type="string" managedBy="user" required="true">oaistore</PARAM> |
|
19 |
<PARAM name="oaiFormat" type="string" managedBy="user" required="true">oaf</PARAM> |
|
20 |
<PARAM name="oaiLayout" type="string" managedBy="user" required="true">index</PARAM> |
|
21 |
<PARAM name="oaiInterpretation" type="string" managedBy="user" required="true">openaire</PARAM> |
|
22 |
<PARAM name="oaiSource" type="string" managedBy="user" required="false"></PARAM> |
|
35 | 23 |
</PARAMETERS> |
36 | 24 |
<ARCS> |
37 | 25 |
<ARC to="RefreshConfig" /> |
... | ... | |
39 | 27 |
</NODE> |
40 | 28 |
<NODE name="RefreshConfig" type="OAIRefreshConfiguration"> |
41 | 29 |
<DESCRIPTION>Reads the current OAI configuration and upsert OAI sets accordingly</DESCRIPTION> |
42 |
<PARAMETERS> |
|
43 |
<PARAM name="dbNameParam" required="true" type="string" managedBy="system">oai_dbName</PARAM> |
|
44 |
</PARAMETERS> |
|
30 |
<PARAMETERS></PARAMETERS> |
|
45 | 31 |
<ARCS> |
46 | 32 |
<ARC to="SELECT_UPDATE_INDICES" /> |
47 | 33 |
</ARCS> |
... | ... | |
59 | 45 |
<NODE name="CompoundIndexes" type="OAICreateIndex"> |
60 | 46 |
<DESCRIPTION>Create composite indexes for the OAI store</DESCRIPTION> |
61 | 47 |
<PARAMETERS> |
62 |
<PARAM name="dbNameParam" required="true" type="string" managedBy="system">oai_dbName</PARAM> |
|
63 |
<PARAM name="oaiStoreCollectionParam" type="string" managedBy="system" required="true">oaiStoreCollection</PARAM> |
|
64 | 48 |
<PARAM name="fieldNames" type="string" managedBy="user" required="true">set,datestamp;license,oaftype;set,oaftype;oaftype,funder;resulttypeid,oaftype</PARAM> |
65 | 49 |
</PARAMETERS> |
66 | 50 |
<ARCS> |
... | ... | |
68 | 52 |
</ARCS> |
69 | 53 |
</NODE> |
70 | 54 |
<NODE name="ConfigIndexes" type="OAIEnsureIndexes" > |
71 |
<DESCRIPTION>Ensure an index exists on fields as specified in the configuration profile</DESCRIPTION>
|
|
55 |
<DESCRIPTION>Create indexes on fields as specified in the configuration profile</DESCRIPTION>
|
|
72 | 56 |
<PARAMETERS> |
73 |
<PARAM name="dbNameParam" required="true" type="string" managedBy="system">oai_dbName</PARAM> |
|
74 |
<PARAM name="oaiStoreCollectionParam" type="string" managedBy="system" required="true">oaiStoreCollection</PARAM> |
|
75 | 57 |
</PARAMETERS> |
76 | 58 |
<ARCS> |
77 | 59 |
<ARC to="SELECT_REFRESH_SET_COUNTS" /> |
... | ... | |
90 | 72 |
<NODE name="SetsCount" type="OAISetsCountUpdate"> |
91 | 73 |
<DESCRIPTION>Count records in each OAI set, for each exported metadata format linked to the given oai collection</DESCRIPTION> |
92 | 74 |
<PARAMETERS> |
93 |
<PARAM name="dbNameParam" required="true" type="string" managedBy="system">oai_dbName</PARAM> |
|
94 |
<PARAM name="oaiStoreCollectionParam" type="string" managedBy="system" required="true">oaiStoreCollection</PARAM> |
|
95 | 75 |
<PARAM name="configuredOnly" type="boolean" managedBy="user" required="true">false</PARAM> |
96 | 76 |
</PARAMETERS> |
97 | 77 |
<ARCS> |
... | ... | |
110 | 90 |
</ARCS> |
111 | 91 |
</NODE> |
112 | 92 |
<NODE name="SetOAIDB" type="SetCurrentOAIDB"> |
113 |
<DESCRIPTION>Update the currentdb in the OAI configuration profile to the value in oai_dbName</DESCRIPTION>
|
|
93 |
<DESCRIPTION>Update the currentdb in the OAI configuration profile</DESCRIPTION> |
|
114 | 94 |
<PARAMETERS> |
115 |
<PARAM name="oaiDBNameParam" required="true" type="string" managedBy="system">oai_dbName</PARAM> |
|
116 | 95 |
</PARAMETERS> |
117 | 96 |
<ARCS> |
118 | 97 |
<ARC to="success" /> |
modules/dnet-oai-common-workflows/trunk/src/main/resources/eu/dnetlib/applicationContext-dnet-oai-common-workflows.xml | ||
---|---|---|
20 | 20 |
|
21 | 21 |
<!-- Reload the current sets configuration --> |
22 | 22 |
<bean id="wfNodeOAIRefreshConfiguration" |
23 |
class="eu.dnetlib.msro.oai.workflows.nodes.RefreshSetsFromConfigJobNode"
|
|
23 |
class="eu.dnetlib.msro.oai.workflows.nodes.RefreshOAIConfigJobNode"
|
|
24 | 24 |
scope="prototype" /> |
25 |
<!-- Keeping the old name as alias, just to avoid things at runtime to fail |
|
26 |
becasue of the renaming --> |
|
27 |
<alias name="wfNodeOAIRefreshConfiguration" alias="wfNodeRefreshSetsFromConfig" /> |
|
28 | 25 |
|
29 |
|
|
30 | 26 |
<!-- Refresh sets based on current config --> |
31 | 27 |
<bean id="wfNodeOAIEnsureIndexes" |
32 | 28 |
class="eu.dnetlib.msro.oai.workflows.nodes.OAIEnsureIndexesJobNode" |
33 | 29 |
scope="prototype" /> |
34 | 30 |
|
35 |
<!-- Read from MDStore --> |
|
36 |
<bean id="wfNodeReadMDStore" class="eu.dnetlib.msro.oai.workflows.nodes.ReadMDStoreJobNode" |
|
37 |
scope="prototype" /> |
|
38 |
|
|
39 | 31 |
<!-- Create new OAI store if needed --> |
40 | 32 |
<bean id="wfNodeOAICreateStore" |
41 | 33 |
class="eu.dnetlib.msro.oai.workflows.nodes.OAICreateStoreJobNode" |
modules/dnet-oai-common-workflows/trunk/pom.xml | ||
---|---|---|
9 | 9 |
<groupId>eu.dnetlib</groupId> |
10 | 10 |
<artifactId>dnet-oai-common-workflows</artifactId> |
11 | 11 |
<packaging>jar</packaging> |
12 |
<version>3.2.4-SNAPSHOT</version>
|
|
12 |
<version>5.0.0-SNAPSHOT</version>
|
|
13 | 13 |
<scm> |
14 | 14 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-oai-common-workflows/trunk</developerConnection> |
15 | 15 |
</scm> |
Also available in: Unified diff
integrated changes from 'refactoring' branch