Revision 48591
Added by Alessia Bardi almost 6 years ago
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/deploy.info | ||
---|---|---|
1 |
{"type_source": "SVN", "goal": "package -U source:jar", |
|
2 |
"url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-oai-common-workflows/trunk/", |
|
3 |
"deploy_repository": "dnet45-snapshots", "version": "4", |
|
4 |
"mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", |
|
5 |
"deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots", "name": "dnet-oai-common-workflows"} |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAISetsCountJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
|
2 |
|
|
3 |
import com.googlecode.sarasvati.NodeToken; |
|
4 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
5 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
6 |
|
|
7 |
public class OAISetsCountJobNode extends AbstractOAIJobNode { |
|
8 |
|
|
9 |
private String configuredOnly; |
|
10 |
|
|
11 |
@Override |
|
12 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
|
13 |
job.setAction("COUNT_SETS"); |
|
14 |
job.getParameters().put(OAIParameterNames.OAI_CONFIGURED_SETS_ONLY, getConfiguredOnly()); |
|
15 |
} |
|
16 |
|
|
17 |
public String getConfiguredOnly() { |
|
18 |
return configuredOnly; |
|
19 |
} |
|
20 |
|
|
21 |
public void setConfiguredOnly(final String configuredOnly) { |
|
22 |
this.configuredOnly = configuredOnly; |
|
23 |
} |
|
24 |
|
|
25 |
} |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/PrepareOaiDataJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
|
2 |
|
|
3 |
import javax.annotation.Resource; |
|
4 |
|
|
5 |
import com.googlecode.sarasvati.Arc; |
|
6 |
import com.googlecode.sarasvati.NodeToken; |
|
7 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
8 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
9 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
10 |
import eu.dnetlib.msro.rmi.MSROException; |
|
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; |
|
15 |
|
|
16 |
/** |
|
17 |
* The Class PrepareOaiDataJobNode. Sets the OAI parameters in the env using the constants in OAIParameterNames, to be used by subsequent nodes. |
|
18 |
*/ |
|
19 |
public class PrepareOaiDataJobNode extends SimpleJobNode { |
|
20 |
|
|
21 |
/** The Constant log. */ |
|
22 |
private static final Log log = LogFactory.getLog(PrepareOaiDataJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM |
|
23 |
|
|
24 |
/** The service locator. */ |
|
25 |
@Resource |
|
26 |
private UniqueServiceLocator serviceLocator; |
|
27 |
|
|
28 |
private String oaiDbName; |
|
29 |
private String oaiFormat; |
|
30 |
private String oaiLayout; |
|
31 |
private String oaiInterpretation; |
|
32 |
private String oaiSource; |
|
33 |
|
|
34 |
private boolean skipDuplicates = false; |
|
35 |
private String duplicateXPath; |
|
36 |
|
|
37 |
/* |
|
38 |
* (non-Javadoc) |
|
39 |
* |
|
40 |
* @see eu.dnetlib.msro.workflows.nodes.SimpleJobNode#execute(com.googlecode.sarasvati.NodeToken) |
|
41 |
*/ |
|
42 |
@Override |
|
43 |
protected String execute(final NodeToken token) throws Exception { |
|
44 |
|
|
45 |
log.info("start preparing job"); |
|
46 |
setIfNotBlank(OAIParameterNames.OAI_DB, oaiDbName, token); |
|
47 |
setIfNotBlank(OAIParameterNames.OAI_FORMAT_NAME, oaiFormat, token); |
|
48 |
setIfNotBlank(OAIParameterNames.OAI_FORMAT_LAYOUT, oaiLayout, token); |
|
49 |
setIfNotBlank(OAIParameterNames.OAI_FORMAT_INTERPRETATION, oaiInterpretation, token); |
|
50 |
setIfNotBlank(OAIParameterNames.OAI_COLLECTON, oaiFormat + "-" + oaiLayout + "-" + oaiInterpretation, token); |
|
51 |
|
|
52 |
String configurationProfile = getConfigurationProfile(); |
|
53 |
setIfNotBlank(OAIParameterNames.OAI_CONFIGURATION_PROFILE, configurationProfile, token); |
|
54 |
token.getEnv().setAttribute(OAIParameterNames.OAI_SKIP_DUPLICATES, String.valueOf(skipDuplicates)); |
|
55 |
if(skipDuplicates) token.getEnv().setAttribute(OAIParameterNames.OAI_DUPLICATE_XPATH, duplicateXPath); |
|
56 |
return Arc.DEFAULT_ARC; |
|
57 |
} |
|
58 |
|
|
59 |
private void setIfNotBlank(final String attrName, final String attrValue, final NodeToken token){ |
|
60 |
if(StringUtils.isNotBlank(attrValue)) |
|
61 |
token.getEnv().setAttribute(attrName, attrValue); |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* Gets the configuration profile. |
|
66 |
* |
|
67 |
* @return the configuration profile |
|
68 |
* @throws MSROException |
|
69 |
* the MSRO exception |
|
70 |
*/ |
|
71 |
private String getConfigurationProfile() throws MSROException { |
|
72 |
try { |
|
73 |
return this.serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery( |
|
74 |
"//RESOURCE_PROFILE[.//RESOURCE_TYPE/@value = 'OAIPublisherConfigurationDSResourceType']"); |
|
75 |
} catch (Exception e) { |
|
76 |
throw new MSROException("Cannot find OAI configuration profile", e); |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
public String getOaiDbName() { |
|
81 |
return oaiDbName; |
|
82 |
} |
|
83 |
|
|
84 |
public void setOaiDbName(final String oaiDbName) { |
|
85 |
this.oaiDbName = oaiDbName; |
|
86 |
} |
|
87 |
|
|
88 |
public String getOaiFormat() { |
|
89 |
return oaiFormat; |
|
90 |
} |
|
91 |
|
|
92 |
public void setOaiFormat(final String oaiFormat) { |
|
93 |
this.oaiFormat = oaiFormat; |
|
94 |
} |
|
95 |
|
|
96 |
public String getOaiLayout() { |
|
97 |
return oaiLayout; |
|
98 |
} |
|
99 |
|
|
100 |
public void setOaiLayout(final String oaiLayout) { |
|
101 |
this.oaiLayout = oaiLayout; |
|
102 |
} |
|
103 |
|
|
104 |
public String getOaiInterpretation() { |
|
105 |
return oaiInterpretation; |
|
106 |
} |
|
107 |
|
|
108 |
public void setOaiInterpretation(final String oaiInterpretation) { |
|
109 |
this.oaiInterpretation = oaiInterpretation; |
|
110 |
} |
|
111 |
|
|
112 |
public String getOaiSource() { |
|
113 |
return oaiSource; |
|
114 |
} |
|
115 |
|
|
116 |
public void setOaiSource(final String oaiSource) { |
|
117 |
this.oaiSource = oaiSource; |
|
118 |
} |
|
119 |
|
|
120 |
public boolean isSkipDuplicates() { |
|
121 |
return skipDuplicates; |
|
122 |
} |
|
123 |
|
|
124 |
public void setSkipDuplicates(final boolean skipDuplicates) { |
|
125 |
this.skipDuplicates = skipDuplicates; |
|
126 |
} |
|
127 |
|
|
128 |
public String getDuplicateXPath() { |
|
129 |
return duplicateXPath; |
|
130 |
} |
|
131 |
|
|
132 |
public void setDuplicateXPath(final String duplicateXPath) { |
|
133 |
this.duplicateXPath = duplicateXPath; |
|
134 |
} |
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
} |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/SyncOAIStoreJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
|
2 |
|
|
3 |
import com.googlecode.sarasvati.NodeToken; |
|
4 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
5 |
import eu.dnetlib.enabling.resultset.rmi.ResultSetException; |
|
6 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
7 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
|
8 |
import eu.dnetlib.msro.workflows.nodes.ProgressJobNode; |
|
9 |
import eu.dnetlib.msro.workflows.resultset.ProcessCountingResultSetFactory; |
|
10 |
import eu.dnetlib.msro.workflows.util.ProgressProvider; |
|
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 |
|
|
16 |
public class SyncOAIStoreJobNode extends AbstractOAIJobNode implements ProgressJobNode { |
|
17 |
|
|
18 |
private static final Log log = LogFactory.getLog(SyncOAIStoreJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM |
|
19 |
|
|
20 |
private ProcessCountingResultSetFactory processCountingResultSetFactory; |
|
21 |
|
|
22 |
private ResultsetProgressProvider progressProvider; |
|
23 |
|
|
24 |
private String eprParam; |
|
25 |
private boolean alwaysNewRecord = false; |
|
26 |
private boolean skipDuplicates = false; |
|
27 |
private String duplicateXPath; |
|
28 |
|
|
29 |
@Override |
|
30 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException { |
|
31 |
|
|
32 |
final String eprS = token.getEnv().getAttribute(getEprParam()); |
|
33 |
this.progressProvider = processCountingResultSetFactory.createProgressProvider(token.getProcess(), eprS); |
|
34 |
job.setAction("SYNC"); |
|
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"); |
|
41 |
} |
|
42 |
|
|
43 |
public ProcessCountingResultSetFactory getProcessCountingResultSetFactory() { |
|
44 |
return processCountingResultSetFactory; |
|
45 |
} |
|
46 |
|
|
47 |
@Required |
|
48 |
public void setProcessCountingResultSetFactory(final ProcessCountingResultSetFactory processCountingResultSetFactory) { |
|
49 |
this.processCountingResultSetFactory = processCountingResultSetFactory; |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
public ProgressProvider getProgressProvider() { |
|
54 |
return this.progressProvider; |
|
55 |
} |
|
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 boolean isAlwaysNewRecord() { |
|
67 |
return alwaysNewRecord; |
|
68 |
} |
|
69 |
|
|
70 |
public void setAlwaysNewRecord(boolean alwaysNewRecord) { |
|
71 |
this.alwaysNewRecord = alwaysNewRecord; |
|
72 |
} |
|
73 |
|
|
74 |
public boolean isSkipDuplicates() { |
|
75 |
return skipDuplicates; |
|
76 |
} |
|
77 |
|
|
78 |
public void setSkipDuplicates(final boolean skipDuplicates) { |
|
79 |
this.skipDuplicates = skipDuplicates; |
|
80 |
} |
|
81 |
|
|
82 |
public String getDuplicateXPath() { |
|
83 |
return duplicateXPath; |
|
84 |
} |
|
85 |
|
|
86 |
public void setDuplicateXPath(final String duplicateXPath) { |
|
87 |
this.duplicateXPath = duplicateXPath; |
|
88 |
} |
|
89 |
|
|
90 |
} |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAICreateIndexJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
|
2 |
|
|
3 |
import com.googlecode.sarasvati.NodeToken; |
|
4 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
5 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
6 |
|
|
7 |
/** |
|
8 |
* Create indexes on the oaistore on the fields specified in the parameter. |
|
9 |
*/ |
|
10 |
public class OAICreateIndexJobNode extends AbstractOAIJobNode { |
|
11 |
|
|
12 |
/** |
|
13 |
* Name of the fields (comma separated) to be included in the same index. For several indexes separate the fieldNames with ; |
|
14 |
* <p> |
|
15 |
* Examples: field1,field2 -- one compound index on the given two fields field1,field2;field3,field4 -- two compound indices: one on |
|
16 |
* field1 and field2, the other on field3 and field4 |
|
17 |
* </p> |
|
18 |
* **/ |
|
19 |
private String fieldNames; |
|
20 |
|
|
21 |
@Override |
|
22 |
public void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
|
23 |
job.setAction("CREATE_OAI_INDEX"); |
|
24 |
job.getParameters().put(OAIParameterNames.OAI_INDEXES, getFieldNames()); |
|
25 |
} |
|
26 |
|
|
27 |
public String getFieldNames() { |
|
28 |
return fieldNames; |
|
29 |
} |
|
30 |
|
|
31 |
public void setFieldNames(final String fieldNames) { |
|
32 |
this.fieldNames = fieldNames; |
|
33 |
} |
|
34 |
} |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAICreateStoreJobNode.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 OAICreateStoreJobNode extends AbstractOAIJobNode { |
|
8 |
|
|
9 |
@Override |
|
10 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
|
11 |
job.setAction("CREATE_STORE"); |
|
12 |
} |
|
13 |
|
|
14 |
|
|
15 |
} |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAIDropStoreJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
|
2 |
|
|
3 |
import com.googlecode.sarasvati.NodeToken; |
|
4 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
5 |
|
|
6 |
public class OAIDropStoreJobNode extends AbstractOAIJobNode { |
|
7 |
|
|
8 |
@Override |
|
9 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
|
10 |
job.setAction("DROP_STORE"); |
|
11 |
} |
|
12 |
|
|
13 |
} |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAIEnsureIndexesJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
|
2 |
|
|
3 |
import com.googlecode.sarasvati.NodeToken; |
|
4 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
5 |
|
|
6 |
/** |
|
7 |
* Creates the indexes on OAI stores based on the OAI configuration. |
|
8 |
*/ |
|
9 |
public class OAIEnsureIndexesJobNode extends AbstractOAIJobNode { |
|
10 |
|
|
11 |
@Override |
|
12 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
|
13 |
job.setAction("ENSURE_INDEXES"); |
|
14 |
} |
|
15 |
} |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/AbstractOAIJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
|
2 |
|
|
3 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
4 |
import org.apache.commons.lang.StringUtils; |
|
5 |
|
|
6 |
import com.googlecode.sarasvati.NodeToken; |
|
7 |
|
|
8 |
import eu.dnetlib.data.oai.store.OAIStoreService; |
|
9 |
import eu.dnetlib.enabling.resultset.rmi.ResultSetException; |
|
10 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
|
11 |
import eu.dnetlib.msro.workflows.nodes.BlackboardJobNode; |
|
12 |
|
|
13 |
public abstract class AbstractOAIJobNode extends BlackboardJobNode { |
|
14 |
|
|
15 |
private String oaiDbNameParam = OAIParameterNames.OAI_DB; |
|
16 |
// overrides the value in the env param oaiDbNameParam |
|
17 |
private String oaiDbName; |
|
18 |
|
|
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); |
|
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 |
} |
|
47 |
|
|
48 |
protected String getTheOAICollection(final NodeToken token) { |
|
49 |
return getTheOAIFormat(token) + "-" + getTheOAILayout(token) + "-" + getTheOAIInterpretation(token); |
|
50 |
} |
|
51 |
|
|
52 |
|
|
53 |
@Override |
|
54 |
protected String obtainServiceId(final NodeToken token) { |
|
55 |
return getServiceLocator().getServiceId(OAIStoreService.class); |
|
56 |
} |
|
57 |
|
|
58 |
@Override |
|
59 |
protected void prepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException { |
|
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)); |
|
67 |
completePrepareJob(job, token); |
|
68 |
} |
|
69 |
|
|
70 |
abstract void completePrepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException; |
|
71 |
|
|
72 |
public String getOaiDbNameParam() { |
|
73 |
return oaiDbNameParam; |
|
74 |
} |
|
75 |
|
|
76 |
public void setOaiDbNameParam(final String oaiDbNameParam) { |
|
77 |
this.oaiDbNameParam = oaiDbNameParam; |
|
78 |
} |
|
79 |
|
|
80 |
public String getOaiDbName() { |
|
81 |
return oaiDbName; |
|
82 |
} |
|
83 |
|
|
84 |
public void setOaiDbName(final String oaiDbName) { |
|
85 |
this.oaiDbName = oaiDbName; |
|
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 |
} |
|
151 |
} |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/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/tags/dnet-oai-common-workflows-5.0.2/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/SetCurrentOAIDBJobNode.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
|
2 |
|
|
3 |
import javax.annotation.Resource; |
|
4 |
|
|
5 |
import com.googlecode.sarasvati.Arc; |
|
6 |
import com.googlecode.sarasvati.NodeToken; |
|
7 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
8 |
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService; |
|
9 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
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; |
|
14 |
|
|
15 |
public class SetCurrentOAIDBJobNode extends SimpleJobNode { |
|
16 |
|
|
17 |
/** The Constant log. */ |
|
18 |
private static final Log log = LogFactory.getLog(SetCurrentOAIDBJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM |
|
19 |
|
|
20 |
/** The service locator. */ |
|
21 |
@Resource |
|
22 |
private UniqueServiceLocator serviceLocator; |
|
23 |
// overrides the value in the env param |
|
24 |
private String oaiDbName; |
|
25 |
|
|
26 |
private String xpathToCurrentDB = "//RESOURCE_PROFILE[.//RESOURCE_TYPE/@value = 'OAIPublisherConfigurationDSResourceType']//CONFIGURATION/CURRENTDB"; |
|
27 |
|
|
28 |
@Override |
|
29 |
protected String execute(final NodeToken token) throws Exception { |
|
30 |
String dbToSet = getTheOAIDBName(token); |
|
31 |
log.fatal("Setting OAI Publisher to use db " + dbToSet); |
|
32 |
String xUpdate = "update value " + xpathToCurrentDB + " with '" + dbToSet + "'"; |
|
33 |
this.serviceLocator.getService(ISRegistryService.class).executeXUpdate(xUpdate); |
|
34 |
return Arc.DEFAULT_ARC; |
|
35 |
} |
|
36 |
|
|
37 |
protected String getTheOAIDBName(final NodeToken token) { |
|
38 |
return StringUtils.isNotBlank(oaiDbName)? oaiDbName : token.getEnv().getAttribute(OAIParameterNames.OAI_DB); |
|
39 |
} |
|
40 |
|
|
41 |
public String getOaiDbName() { |
|
42 |
return oaiDbName; |
|
43 |
} |
|
44 |
|
|
45 |
public void setOaiDbName(final String oaiDbName) { |
|
46 |
this.oaiDbName = oaiDbName; |
|
47 |
} |
|
48 |
|
|
49 |
public String getXpathToCurrentDB() { |
|
50 |
return xpathToCurrentDB; |
|
51 |
} |
|
52 |
|
|
53 |
public void setXpathToCurrentDB(final String xpathToCurrentDB) { |
|
54 |
this.xpathToCurrentDB = xpathToCurrentDB; |
|
55 |
|
|
56 |
} |
|
57 |
|
|
58 |
} |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/src/main/resources/eu/dnetlib/test/profiles/workflows/oai/oai.consistency.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<RESOURCE_PROFILE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
|
3 |
<HEADER> |
|
4 |
<RESOURCE_IDENTIFIER value="440e5de7-7106-469c-8c8d-89c261a1e09d_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl"/> |
|
5 |
<RESOURCE_TYPE value="WorkflowDSResourceType"/> |
|
6 |
<RESOURCE_KIND value="WorkflowDSResources"/> |
|
7 |
<RESOURCE_URI value=""/> |
|
8 |
<DATE_OF_CREATION value="2014-07-16T18:13:51.0Z"/> |
|
9 |
</HEADER> |
|
10 |
<BODY> |
|
11 |
<WORKFLOW_NAME>OAI Post feed</WORKFLOW_NAME> |
|
12 |
<WORKFLOW_TYPE>Provision</WORKFLOW_TYPE> |
|
13 |
<WORKFLOW_PRIORITY>30</WORKFLOW_PRIORITY> |
|
14 |
<CONFIGURATION start="manual"> |
|
15 |
<NODE name="prepareOAI" type="PrepareOaiJob" isStart="true"> |
|
16 |
<DESCRIPTION>Prepare target OAI store</DESCRIPTION> |
|
17 |
<PARAMETERS> |
|
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> |
|
23 |
</PARAMETERS> |
|
24 |
<ARCS> |
|
25 |
<ARC to="RefreshConfig" /> |
|
26 |
</ARCS> |
|
27 |
</NODE> |
|
28 |
<NODE name="RefreshConfig" type="OAIRefreshConfiguration"> |
|
29 |
<DESCRIPTION>Reads the current OAI configuration and upsert OAI sets accordingly</DESCRIPTION> |
|
30 |
<PARAMETERS></PARAMETERS> |
|
31 |
<ARCS> |
|
32 |
<ARC to="SELECT_UPDATE_INDICES" /> |
|
33 |
</ARCS> |
|
34 |
</NODE> |
|
35 |
<NODE name="SELECT_UPDATE_INDICES" type="Selection"> |
|
36 |
<DESCRIPTION>Do we update the indices on the oai store?</DESCRIPTION> |
|
37 |
<PARAMETERS> |
|
38 |
<PARAM function="validValues(['YES', 'NO'])" managedBy="user" name="selection" required="true" type="string">YES</PARAM> |
|
39 |
</PARAMETERS> |
|
40 |
<ARCS> |
|
41 |
<ARC name="YES" to="CompoundIndexes" /> |
|
42 |
<ARC name="NO" to="SELECT_REFRESH_SET_COUNTS" /> |
|
43 |
</ARCS> |
|
44 |
</NODE> |
|
45 |
<NODE name="CompoundIndexes" type="OAICreateIndex"> |
|
46 |
<DESCRIPTION>Create composite indexes for the OAI store</DESCRIPTION> |
|
47 |
<PARAMETERS> |
|
48 |
<PARAM name="fieldNames" type="string" managedBy="user" required="true">set,datestamp;license,oaftype;set,oaftype;oaftype,funder;resulttypeid,oaftype</PARAM> |
|
49 |
</PARAMETERS> |
|
50 |
<ARCS> |
|
51 |
<ARC to="ConfigIndexes" /> |
|
52 |
</ARCS> |
|
53 |
</NODE> |
|
54 |
<NODE name="ConfigIndexes" type="OAIEnsureIndexes" > |
|
55 |
<DESCRIPTION>Create indexes on fields as specified in the configuration profile</DESCRIPTION> |
|
56 |
<PARAMETERS> |
|
57 |
</PARAMETERS> |
|
58 |
<ARCS> |
|
59 |
<ARC to="SELECT_REFRESH_SET_COUNTS" /> |
|
60 |
</ARCS> |
|
61 |
</NODE> |
|
62 |
<NODE name="SELECT_REFRESH_SET_COUNTS" type="Selection"> |
|
63 |
<DESCRIPTION>Do we refresh the sets counts?</DESCRIPTION> |
|
64 |
<PARAMETERS> |
|
65 |
<PARAM function="validValues(['YES', 'NO'])" managedBy="user" name="selection" required="true" type="string">YES</PARAM> |
|
66 |
</PARAMETERS> |
|
67 |
<ARCS> |
|
68 |
<ARC name="YES" to="SetsCount" /> |
|
69 |
<ARC name="NO" to="SELECT_SWITCH_OAIDB" /> |
|
70 |
</ARCS> |
|
71 |
</NODE> |
|
72 |
<NODE name="SetsCount" type="OAISetsCountUpdate"> |
|
73 |
<DESCRIPTION>Count records in each OAI set, for each exported metadata format linked to the given oai collection</DESCRIPTION> |
|
74 |
<PARAMETERS> |
|
75 |
<PARAM name="configuredOnly" type="boolean" managedBy="user" required="true">false</PARAM> |
|
76 |
</PARAMETERS> |
|
77 |
<ARCS> |
|
78 |
<ARC to="SELECT_SWITCH_OAIDB" /> |
|
79 |
</ARCS> |
|
80 |
</NODE> |
|
81 |
|
|
82 |
<NODE name="SELECT_SWITCH_OAIDB" type="Selection"> |
|
83 |
<DESCRIPTION>Do we switch the oaistore db for the public now? If not, you can change the value manually on the configuration profile</DESCRIPTION> |
|
84 |
<PARAMETERS> |
|
85 |
<PARAM function="validValues(['YES', 'NO'])" managedBy="user" name="selection" required="true" type="string">YES</PARAM> |
|
86 |
</PARAMETERS> |
|
87 |
<ARCS> |
|
88 |
<ARC name="YES" to="SetOAIDB" /> |
|
89 |
<ARC name="NO" to="success" /> |
|
90 |
</ARCS> |
|
91 |
</NODE> |
|
92 |
<NODE name="SetOAIDB" type="SetCurrentOAIDB"> |
|
93 |
<DESCRIPTION>Update the currentdb in the OAI configuration profile</DESCRIPTION> |
|
94 |
<PARAMETERS> |
|
95 |
</PARAMETERS> |
|
96 |
<ARCS> |
|
97 |
<ARC to="success" /> |
|
98 |
</ARCS> |
|
99 |
</NODE> |
|
100 |
|
|
101 |
</CONFIGURATION> |
|
102 |
<STATUS /> |
|
103 |
</BODY> |
|
104 |
</RESOURCE_PROFILE> |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/src/main/resources/eu/dnetlib/test/profiles/workflows/oai/oai-consistency.meta.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<RESOURCE_PROFILE> |
|
3 |
<HEADER> |
|
4 |
<RESOURCE_IDENTIFIER value="f2779189-b313-4b14-867b-09afd07eeb8f_TWV0YVdvcmtmbG93RFNSZXNvdXJjZXMvTWV0YVdvcmtmbG93RFNSZXNvdXJjZVR5cGU=" /> |
|
5 |
<RESOURCE_TYPE value="MetaWorkflowDSResourceType" /> |
|
6 |
<RESOURCE_KIND value="MetaWorkflowDSResources" /> |
|
7 |
<RESOURCE_URI value="" /> |
|
8 |
<DATE_OF_CREATION value="2013-11-25T17:47:51.0Z" /> |
|
9 |
</HEADER> |
|
10 |
<BODY> |
|
11 |
<METAWORKFLOW_NAME family="provision">OAI consistency</METAWORKFLOW_NAME> |
|
12 |
<METAWORKFLOW_DESCRIPTION>Perform operations to ensure data consistency in OAI store</METAWORKFLOW_DESCRIPTION> |
|
13 |
<METAWORKFLOW_SECTION>InfoSpace Provision</METAWORKFLOW_SECTION> |
|
14 |
<ADMIN_EMAIL/> |
|
15 |
<CONFIGURATION status="EXECUTABLE"> |
|
16 |
<WORKFLOW id="440e5de7-7106-469c-8c8d-89c261a1e09d_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl" name="OAI Post feed"/> |
|
17 |
</CONFIGURATION> |
|
18 |
<SCHEDULING enabled="false"> |
|
19 |
<CRON>29 5 22 ? * *</CRON> |
|
20 |
<MININTERVAL>10080</MININTERVAL> |
|
21 |
</SCHEDULING> |
|
22 |
</BODY> |
|
23 |
</RESOURCE_PROFILE> |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/src/main/resources/eu/dnetlib/applicationContext-dnet-oai-common-workflows.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" |
|
4 |
xmlns:util="http://www.springframework.org/schema/util" |
|
5 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd |
|
6 |
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd |
|
7 |
http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd"> |
|
8 |
|
|
9 |
<bean id="wfNodePrepareOaiJob" |
|
10 |
class="eu.dnetlib.msro.oai.workflows.nodes.PrepareOaiDataJobNode" |
|
11 |
scope="prototype" /> |
|
12 |
|
|
13 |
<!-- OAI feed --> |
|
14 |
<bean id="wfNodeSyncOAIStores" class="eu.dnetlib.msro.oai.workflows.nodes.SyncOAIStoreJobNode" |
|
15 |
scope="prototype" p:processCountingResultSetFactory-ref="msroProcessCountingResultSetFactory" /> |
|
16 |
|
|
17 |
<!-- Update OAI sets count --> |
|
18 |
<bean id="wfNodeOAISetsCountUpdate" class="eu.dnetlib.msro.oai.workflows.nodes.OAISetsCountJobNode" |
|
19 |
scope="prototype" /> |
|
20 |
|
|
21 |
<!-- Reload the current sets configuration --> |
|
22 |
<bean id="wfNodeOAIRefreshConfiguration" |
|
23 |
class="eu.dnetlib.msro.oai.workflows.nodes.RefreshOAIConfigJobNode" |
|
24 |
scope="prototype" /> |
|
25 |
|
|
26 |
<!-- Refresh sets based on current config --> |
|
27 |
<bean id="wfNodeOAIEnsureIndexes" |
|
28 |
class="eu.dnetlib.msro.oai.workflows.nodes.OAIEnsureIndexesJobNode" |
|
29 |
scope="prototype" /> |
|
30 |
|
|
31 |
<!-- Create new OAI store if needed --> |
|
32 |
<bean id="wfNodeOAICreateStore" |
|
33 |
class="eu.dnetlib.msro.oai.workflows.nodes.OAICreateStoreJobNode" |
|
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" /> |
|
40 |
|
|
41 |
<!-- Drop OAI store --> |
|
42 |
<bean id="wfNodeOAIDropStore" class="eu.dnetlib.msro.oai.workflows.nodes.OAIDropStoreJobNode" |
|
43 |
scope="prototype" /> |
|
44 |
|
|
45 |
<!-- Set backend db --> |
|
46 |
<bean id="wfNodeSetCurrentOAIDB" |
|
47 |
class="eu.dnetlib.msro.oai.workflows.nodes.SetCurrentOAIDBJobNode" |
|
48 |
scope="prototype" /> |
|
49 |
</beans> |
modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<parent> |
|
4 |
<groupId>eu.dnetlib</groupId> |
|
5 |
<artifactId>dnet45-parent</artifactId> |
|
6 |
<version>1.0.0</version> |
|
7 |
</parent> |
|
8 |
<modelVersion>4.0.0</modelVersion> |
|
9 |
<groupId>eu.dnetlib</groupId> |
|
10 |
<artifactId>dnet-oai-common-workflows</artifactId> |
|
11 |
<packaging>jar</packaging> |
|
12 |
<version>5.0.2</version> |
|
13 |
<scm> |
|
14 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.2</developerConnection> |
|
15 |
</scm> |
|
16 |
<dependencies> |
|
17 |
<dependency> |
|
18 |
<groupId>eu.dnetlib</groupId> |
|
19 |
<artifactId>dnet-msro-service</artifactId> |
|
20 |
<version>[3.0.0,4.0.0)</version> |
|
21 |
<scope>provided</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>eu.dnetlib</groupId> |
|
25 |
<artifactId>dnet-oai-store-service-rmi</artifactId> |
|
26 |
<version>[4.0.0,5.0.0)</version> |
|
27 |
</dependency> |
|
28 |
</dependencies> |
|
29 |
</project> |
Also available in: Unified diff
[maven-release-plugin] copy for tag dnet-oai-common-workflows-5.0.2