Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/pom.xml
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/pom.xml	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/pom.xml	(revision 48067)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+	<parent>
+		<groupId>eu.dnetlib</groupId>
+		<artifactId>dnet45-parent</artifactId>
+		<version>1.0.0</version>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>eu.dnetlib</groupId>
+	<artifactId>dnet-oai-common-workflows</artifactId>
+	<packaging>jar</packaging>
+	<version>5.0.0</version>
+	<scm>
+		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0</developerConnection>
+	</scm>
+	<dependencies>
+		<dependency>
+			<groupId>eu.dnetlib</groupId>
+			<artifactId>dnet-msro-service</artifactId>
+			<version>[3.0.0,4.0.0)</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>eu.dnetlib</groupId>
+			<artifactId>dnet-oai-store-service-rmi</artifactId>
+			<version>[4.0.0,5.0.0)</version>
+		</dependency>
+	</dependencies>
+</project>
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/deploy.info
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/deploy.info	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/deploy.info	(revision 48067)
@@ -0,0 +1,5 @@
+{"type_source": "SVN", "goal": "package -U source:jar", 
+"url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-oai-common-workflows/trunk/", 
+"deploy_repository": "dnet45-snapshots", "version": "4", 
+"mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", 
+"deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots", "name": "dnet-oai-common-workflows"}
\ No newline at end of file
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAISetsCountJobNode.java
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAISetsCountJobNode.java	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAISetsCountJobNode.java	(revision 48067)
@@ -0,0 +1,25 @@
+package eu.dnetlib.msro.oai.workflows.nodes;
+
+import com.googlecode.sarasvati.NodeToken;
+import eu.dnetlib.data.information.oai.utils.OAIParameterNames;
+import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
+
+public class OAISetsCountJobNode extends AbstractOAIJobNode {
+
+	private String configuredOnly;
+
+	@Override
+	void completePrepareJob(final BlackboardJob job, final NodeToken token) {
+		job.setAction("COUNT_SETS");
+		job.getParameters().put(OAIParameterNames.OAI_CONFIGURED_SETS_ONLY, getConfiguredOnly());
+	}
+
+	public String getConfiguredOnly() {
+		return configuredOnly;
+	}
+
+	public void setConfiguredOnly(final String configuredOnly) {
+		this.configuredOnly = configuredOnly;
+	}
+
+}
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/PrepareOaiDataJobNode.java
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/PrepareOaiDataJobNode.java	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/PrepareOaiDataJobNode.java	(revision 48067)
@@ -0,0 +1,116 @@
+package eu.dnetlib.msro.oai.workflows.nodes;
+
+import javax.annotation.Resource;
+
+import com.googlecode.sarasvati.Arc;
+import com.googlecode.sarasvati.NodeToken;
+import eu.dnetlib.data.information.oai.utils.OAIParameterNames;
+import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
+import eu.dnetlib.enabling.locators.UniqueServiceLocator;
+import eu.dnetlib.msro.rmi.MSROException;
+import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The Class PrepareOaiDataJobNode. Sets the OAI parameters in the env using the constants in OAIParameterNames, to be used by subsequent nodes.
+ */
+public class PrepareOaiDataJobNode extends SimpleJobNode {
+
+	/** The Constant log. */
+	private static final Log log = LogFactory.getLog(PrepareOaiDataJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
+
+	/** The service locator. */
+	@Resource
+	private UniqueServiceLocator serviceLocator;
+
+	private String oaiDbName;
+	private String oaiFormat;
+	private String oaiLayout;
+	private String oaiInterpretation;
+	private String oaiSource;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see eu.dnetlib.msro.workflows.nodes.SimpleJobNode#execute(com.googlecode.sarasvati.NodeToken)
+	 */
+	@Override
+	protected String execute(final NodeToken token) throws Exception {
+
+		log.info("start preparing job");
+		setIfNotBlank(OAIParameterNames.OAI_DB, oaiDbName, token);
+		setIfNotBlank(OAIParameterNames.OAI_FORMAT_NAME, oaiFormat, token);
+		setIfNotBlank(OAIParameterNames.OAI_FORMAT_LAYOUT, oaiLayout, token);
+		setIfNotBlank(OAIParameterNames.OAI_FORMAT_INTERPRETATION, oaiInterpretation, token);
+		setIfNotBlank(OAIParameterNames.OAI_COLLECTON, oaiFormat + "-" + oaiLayout + "-" + oaiInterpretation, token);
+
+		String configurationProfile = getConfigurationProfile();
+		setIfNotBlank(OAIParameterNames.OAI_CONFIGURATION_PROFILE, configurationProfile, token);
+		return Arc.DEFAULT_ARC;
+	}
+
+	private void setIfNotBlank(final String attrName, final String attrValue, final NodeToken token){
+		if(StringUtils.isNotBlank(attrValue))
+			token.getEnv().setAttribute(attrName, attrValue);
+	}
+
+	/**
+	 * Gets the configuration profile.
+	 * 
+	 * @return the configuration profile
+	 * @throws MSROException
+	 *             the MSRO exception
+	 */
+	private String getConfigurationProfile() throws MSROException {
+		try {
+			return this.serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(
+					"//RESOURCE_PROFILE[.//RESOURCE_TYPE/@value = 'OAIPublisherConfigurationDSResourceType']");
+		} catch (Exception e) {
+			throw new MSROException("Cannot find OAI configuration profile", e);
+		}
+	}
+
+	public String getOaiDbName() {
+		return oaiDbName;
+	}
+
+	public void setOaiDbName(final String oaiDbName) {
+		this.oaiDbName = oaiDbName;
+	}
+
+	public String getOaiFormat() {
+		return oaiFormat;
+	}
+
+	public void setOaiFormat(final String oaiFormat) {
+		this.oaiFormat = oaiFormat;
+	}
+
+	public String getOaiLayout() {
+		return oaiLayout;
+	}
+
+	public void setOaiLayout(final String oaiLayout) {
+		this.oaiLayout = oaiLayout;
+	}
+
+	public String getOaiInterpretation() {
+		return oaiInterpretation;
+	}
+
+	public void setOaiInterpretation(final String oaiInterpretation) {
+		this.oaiInterpretation = oaiInterpretation;
+	}
+
+	public String getOaiSource() {
+		return oaiSource;
+	}
+
+	public void setOaiSource(final String oaiSource) {
+		this.oaiSource = oaiSource;
+	}
+
+
+}
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/SyncOAIStoreJobNode.java
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/SyncOAIStoreJobNode.java	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/SyncOAIStoreJobNode.java	(revision 48067)
@@ -0,0 +1,90 @@
+package eu.dnetlib.msro.oai.workflows.nodes;
+
+import com.googlecode.sarasvati.NodeToken;
+import eu.dnetlib.data.information.oai.utils.OAIParameterNames;
+import eu.dnetlib.enabling.resultset.rmi.ResultSetException;
+import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
+import eu.dnetlib.miscutils.datetime.DateUtils;
+import eu.dnetlib.msro.workflows.nodes.ProgressJobNode;
+import eu.dnetlib.msro.workflows.resultset.ProcessCountingResultSetFactory;
+import eu.dnetlib.msro.workflows.util.ProgressProvider;
+import eu.dnetlib.msro.workflows.util.ResultsetProgressProvider;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.annotation.Required;
+
+public class SyncOAIStoreJobNode extends AbstractOAIJobNode implements ProgressJobNode {
+
+	private static final Log log = LogFactory.getLog(SyncOAIStoreJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
+
+	private ProcessCountingResultSetFactory processCountingResultSetFactory;
+	
+	private ResultsetProgressProvider progressProvider;
+
+	private String eprParam;
+	private boolean alwaysNewRecord = false;
+	private boolean skipDuplicates = false;
+	private String duplicateXPath;
+
+	@Override
+	void completePrepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException {
+
+		final String eprS = token.getEnv().getAttribute(getEprParam());
+		this.progressProvider = processCountingResultSetFactory.createProgressProvider(token.getProcess(), eprS);
+		job.setAction("SYNC");
+		job.getParameters().put(OAIParameterNames.OAI_FEED_DATE, DateUtils.now_ISO8601());
+		job.getParameters().put(OAIParameterNames.OAI_SKIP_DUPLICATES, String.valueOf(skipDuplicates));
+		if(skipDuplicates) job.getParameters().put(OAIParameterNames.OAI_DUPLICATE_XPATH, duplicateXPath);
+		job.getParameters().put(OAIParameterNames.OAI_SYNC_EPR, progressProvider.getEpr().toString());
+		job.getParameters().put(OAIParameterNames.OAI_ALWAYS_NEW_RECORD, String.valueOf(alwaysNewRecord));
+		log.fatal("OAI Sync Job prepared");
+	}
+
+	public ProcessCountingResultSetFactory getProcessCountingResultSetFactory() {
+		return processCountingResultSetFactory;
+	}
+
+	@Required
+	public void setProcessCountingResultSetFactory(final ProcessCountingResultSetFactory processCountingResultSetFactory) {
+		this.processCountingResultSetFactory = processCountingResultSetFactory;
+	}
+
+	@Override
+	public ProgressProvider getProgressProvider() {
+		return this.progressProvider;
+	}
+
+
+	public String getEprParam() {
+		return eprParam;
+	}
+
+	public void setEprParam(final String eprParam) {
+		this.eprParam = eprParam;
+	}
+
+	public boolean isAlwaysNewRecord() {
+		return alwaysNewRecord;
+	}
+
+	public void setAlwaysNewRecord(boolean alwaysNewRecord) {
+		this.alwaysNewRecord = alwaysNewRecord;
+	}
+
+	public boolean isSkipDuplicates() {
+		return skipDuplicates;
+	}
+
+	public void setSkipDuplicates(final boolean skipDuplicates) {
+		this.skipDuplicates = skipDuplicates;
+	}
+
+	public String getDuplicateXPath() {
+		return duplicateXPath;
+	}
+
+	public void setDuplicateXPath(final String duplicateXPath) {
+		this.duplicateXPath = duplicateXPath;
+	}
+
+}
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAICreateIndexJobNode.java
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAICreateIndexJobNode.java	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAICreateIndexJobNode.java	(revision 48067)
@@ -0,0 +1,34 @@
+package eu.dnetlib.msro.oai.workflows.nodes;
+
+import com.googlecode.sarasvati.NodeToken;
+import eu.dnetlib.data.information.oai.utils.OAIParameterNames;
+import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
+
+/**
+ * Create indexes on the oaistore on the fields specified in the parameter.
+ */
+public class OAICreateIndexJobNode extends AbstractOAIJobNode {
+
+	/**
+	 * Name of the fields (comma separated) to be included in the same index. For several indexes separate the fieldNames with ;
+	 * <p>
+	 * Examples: field1,field2 -- one compound index on the given two fields field1,field2;field3,field4 -- two compound indices: one on
+	 * field1 and field2, the other on field3 and field4
+	 * </p>
+	 * **/
+	private String fieldNames;
+
+	@Override
+	public void completePrepareJob(final BlackboardJob job, final NodeToken token) {
+		job.setAction("CREATE_OAI_INDEX");
+		job.getParameters().put(OAIParameterNames.OAI_INDEXES, getFieldNames());
+	}
+
+	public String getFieldNames() {
+		return fieldNames;
+	}
+
+	public void setFieldNames(final String fieldNames) {
+		this.fieldNames = fieldNames;
+	}
+}
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAICreateStoreJobNode.java
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAICreateStoreJobNode.java	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAICreateStoreJobNode.java	(revision 48067)
@@ -0,0 +1,15 @@
+package eu.dnetlib.msro.oai.workflows.nodes;
+
+import com.googlecode.sarasvati.NodeToken;
+
+import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
+
+public class OAICreateStoreJobNode extends AbstractOAIJobNode {
+
+	@Override
+	void completePrepareJob(final BlackboardJob job, final NodeToken token) {
+		job.setAction("CREATE_STORE");
+	}
+
+
+}
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAIDropStoreJobNode.java
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAIDropStoreJobNode.java	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAIDropStoreJobNode.java	(revision 48067)
@@ -0,0 +1,13 @@
+package eu.dnetlib.msro.oai.workflows.nodes;
+
+import com.googlecode.sarasvati.NodeToken;
+import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
+
+public class OAIDropStoreJobNode extends AbstractOAIJobNode {
+
+	@Override
+	void completePrepareJob(final BlackboardJob job, final NodeToken token) {
+		job.setAction("DROP_STORE");
+	}
+
+}
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAIEnsureIndexesJobNode.java
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAIEnsureIndexesJobNode.java	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/OAIEnsureIndexesJobNode.java	(revision 48067)
@@ -0,0 +1,15 @@
+package eu.dnetlib.msro.oai.workflows.nodes;
+
+import com.googlecode.sarasvati.NodeToken;
+import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
+
+/**
+ * Creates the indexes on OAI stores based on the OAI configuration.
+ */
+public class OAIEnsureIndexesJobNode extends AbstractOAIJobNode {
+
+	@Override
+	void completePrepareJob(final BlackboardJob job, final NodeToken token) {
+		job.setAction("ENSURE_INDEXES");
+	}
+}
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/AbstractOAIJobNode.java
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/AbstractOAIJobNode.java	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/AbstractOAIJobNode.java	(revision 48067)
@@ -0,0 +1,151 @@
+package eu.dnetlib.msro.oai.workflows.nodes;
+
+import eu.dnetlib.data.information.oai.utils.OAIParameterNames;
+import org.apache.commons.lang.StringUtils;
+
+import com.googlecode.sarasvati.NodeToken;
+
+import eu.dnetlib.data.oai.store.OAIStoreService;
+import eu.dnetlib.enabling.resultset.rmi.ResultSetException;
+import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
+import eu.dnetlib.msro.workflows.nodes.BlackboardJobNode;
+
+public abstract class AbstractOAIJobNode extends BlackboardJobNode {
+
+	private String oaiDbNameParam = OAIParameterNames.OAI_DB;
+	// overrides the value in the env param oaiDbNameParam
+	private String oaiDbName;
+
+	private String oaiFormatParam = OAIParameterNames.OAI_FORMAT_NAME;
+	private String oaiFormat;
+
+	private String oaiLayoutParam = OAIParameterNames.OAI_FORMAT_LAYOUT;
+	private String oaiLayout;
+
+	private String oaiInterpretationParam = OAIParameterNames.OAI_FORMAT_INTERPRETATION;
+	private String oaiInterpretation;
+
+	private String oaiSourceParam = OAIParameterNames.OAI_SOURCE;
+	// overrides the value in the env param oaiSourceParam
+	private String oaiSource;
+
+	protected String getTheOAIDBName(final NodeToken token) {
+		return StringUtils.isNotBlank(oaiDbName)? oaiDbName : token.getEnv().getAttribute(oaiDbNameParam);
+	}
+	protected String getTheOAIFormat(final NodeToken token) {
+		return StringUtils.isNotBlank(oaiFormat)? oaiFormat : token.getEnv().getAttribute(oaiFormatParam);
+	}
+	protected String getTheOAILayout(final NodeToken token) {
+		return StringUtils.isNotBlank(oaiLayout)? oaiLayout : token.getEnv().getAttribute(oaiLayoutParam);
+	}
+	protected String getTheOAIInterpretation(final NodeToken token) {
+		return StringUtils.isNotBlank(oaiInterpretation)? oaiInterpretation : token.getEnv().getAttribute(oaiInterpretationParam);
+	}
+	protected String getTheOAISource(final NodeToken token) {
+		return StringUtils.isNotBlank(oaiSource)? oaiSource : token.getEnv().getAttribute(oaiSourceParam);
+	}
+
+	protected String getTheOAICollection(final NodeToken token) {
+		return getTheOAIFormat(token) + "-" + getTheOAILayout(token) + "-" + getTheOAIInterpretation(token);
+	}
+
+
+	@Override
+	protected String obtainServiceId(final NodeToken token) {
+		return getServiceLocator().getServiceId(OAIStoreService.class);
+	}
+
+	@Override
+	protected void prepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException {
+		job.getParameters().put(OAIParameterNames.OAI_DB, getTheOAIDBName(token));
+		job.getParameters().put(OAIParameterNames.OAI_FORMAT_NAME, getTheOAIFormat(token));
+		job.getParameters().put(OAIParameterNames.OAI_FORMAT_LAYOUT, getTheOAILayout(token));
+		job.getParameters().put(OAIParameterNames.OAI_FORMAT_INTERPRETATION, getTheOAIInterpretation(token));
+		job.getParameters().put(OAIParameterNames.OAI_COLLECTON, getTheOAICollection(token));
+		String theSource = getTheOAISource(token);
+		if(StringUtils.isNotBlank(theSource)) job.getParameters().put(OAIParameterNames.OAI_SOURCE, getTheOAISource(token));
+		completePrepareJob(job, token);
+	}
+
+	abstract void completePrepareJob(final BlackboardJob job, final NodeToken token) throws ResultSetException;
+
+	public String getOaiDbNameParam() {
+		return oaiDbNameParam;
+	}
+
+	public void setOaiDbNameParam(final String oaiDbNameParam) {
+		this.oaiDbNameParam = oaiDbNameParam;
+	}
+
+	public String getOaiDbName() {
+		return oaiDbName;
+	}
+
+	public void setOaiDbName(final String oaiDbName) {
+		this.oaiDbName = oaiDbName;
+	}
+
+	public String getOaiFormatParam() {
+		return oaiFormatParam;
+	}
+
+	public void setOaiFormatParam(final String oaiFormatParam) {
+		this.oaiFormatParam = oaiFormatParam;
+	}
+
+	public String getOaiFormat() {
+		return oaiFormat;
+	}
+
+	public void setOaiFormat(final String oaiFormat) {
+		this.oaiFormat = oaiFormat;
+	}
+
+	public String getOaiLayoutParam() {
+		return oaiLayoutParam;
+	}
+
+	public void setOaiLayoutParam(final String oaiLayoutParam) {
+		this.oaiLayoutParam = oaiLayoutParam;
+	}
+
+	public String getOaiLayout() {
+		return oaiLayout;
+	}
+
+	public void setOaiLayout(final String oaiLayout) {
+		this.oaiLayout = oaiLayout;
+	}
+
+	public String getOaiInterpretationParam() {
+		return oaiInterpretationParam;
+	}
+
+	public void setOaiInterpretationParam(final String oaiInterpretationParam) {
+		this.oaiInterpretationParam = oaiInterpretationParam;
+	}
+
+	public String getOaiInterpretation() {
+		return oaiInterpretation;
+	}
+
+	public void setOaiInterpretation(final String oaiInterpretation) {
+		this.oaiInterpretation = oaiInterpretation;
+	}
+
+	public String getOaiSourceParam() {
+		return oaiSourceParam;
+	}
+
+	public void setOaiSourceParam(final String oaiSourceParam) {
+		this.oaiSourceParam = oaiSourceParam;
+	}
+
+	public String getOaiSource() {
+		return oaiSource;
+	}
+
+	public void setOaiSource(final String oaiSource) {
+		this.oaiSource = oaiSource;
+	}
+}
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/SetCurrentOAIDBJobNode.java
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/SetCurrentOAIDBJobNode.java	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/SetCurrentOAIDBJobNode.java	(revision 48067)
@@ -0,0 +1,58 @@
+package eu.dnetlib.msro.oai.workflows.nodes;
+
+import javax.annotation.Resource;
+
+import com.googlecode.sarasvati.Arc;
+import com.googlecode.sarasvati.NodeToken;
+import eu.dnetlib.data.information.oai.utils.OAIParameterNames;
+import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
+import eu.dnetlib.enabling.locators.UniqueServiceLocator;
+import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class SetCurrentOAIDBJobNode extends SimpleJobNode {
+
+	/** The Constant log. */
+	private static final Log log = LogFactory.getLog(SetCurrentOAIDBJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
+
+	/** The service locator. */
+	@Resource
+	private UniqueServiceLocator serviceLocator;
+	// overrides the value in the env param
+	private String oaiDbName;
+
+	private String xpathToCurrentDB = "//RESOURCE_PROFILE[.//RESOURCE_TYPE/@value = 'OAIPublisherConfigurationDSResourceType']//CONFIGURATION/CURRENTDB";
+
+	@Override
+	protected String execute(final NodeToken token) throws Exception {
+		String dbToSet = getTheOAIDBName(token);
+		log.fatal("Setting OAI Publisher to use db " + dbToSet);
+		String xUpdate = "update value " + xpathToCurrentDB + " with '" + dbToSet + "'";
+		this.serviceLocator.getService(ISRegistryService.class).executeXUpdate(xUpdate);
+		return Arc.DEFAULT_ARC;
+	}
+
+	protected String getTheOAIDBName(final NodeToken token) {
+		return StringUtils.isNotBlank(oaiDbName)? oaiDbName : token.getEnv().getAttribute(OAIParameterNames.OAI_DB);
+	}
+
+	public String getOaiDbName() {
+		return oaiDbName;
+	}
+
+	public void setOaiDbName(final String oaiDbName) {
+		this.oaiDbName = oaiDbName;
+	}
+
+	public String getXpathToCurrentDB() {
+		return xpathToCurrentDB;
+	}
+
+	public void setXpathToCurrentDB(final String xpathToCurrentDB) {
+		this.xpathToCurrentDB = xpathToCurrentDB;
+
+	}
+
+}
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/RefreshOAIConfigJobNode.java
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/RefreshOAIConfigJobNode.java	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/java/eu/dnetlib/msro/oai/workflows/nodes/RefreshOAIConfigJobNode.java	(revision 48067)
@@ -0,0 +1,14 @@
+package eu.dnetlib.msro.oai.workflows.nodes;
+
+import com.googlecode.sarasvati.NodeToken;
+
+import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
+
+public class RefreshOAIConfigJobNode extends AbstractOAIJobNode {
+
+	@Override
+	void completePrepareJob(final BlackboardJob job, final NodeToken token) {
+		job.setAction("REFRESH_CONFIG");
+	}
+
+}
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/resources/eu/dnetlib/test/profiles/workflows/oai/oai.consistency.xml
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/resources/eu/dnetlib/test/profiles/workflows/oai/oai.consistency.xml	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/resources/eu/dnetlib/test/profiles/workflows/oai/oai.consistency.xml	(revision 48067)
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<RESOURCE_PROFILE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <HEADER>
+        <RESOURCE_IDENTIFIER value="440e5de7-7106-469c-8c8d-89c261a1e09d_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl"/>
+        <RESOURCE_TYPE value="WorkflowDSResourceType"/>
+        <RESOURCE_KIND value="WorkflowDSResources"/>
+        <RESOURCE_URI value=""/>
+        <DATE_OF_CREATION value="2014-07-16T18:13:51.0Z"/>
+    </HEADER>
+    <BODY>
+        <WORKFLOW_NAME>OAI Post feed</WORKFLOW_NAME>
+        <WORKFLOW_TYPE>Provision</WORKFLOW_TYPE>
+        <WORKFLOW_PRIORITY>30</WORKFLOW_PRIORITY>
+		<CONFIGURATION start="manual">
+			<NODE name="prepareOAI" type="PrepareOaiJob" isStart="true">
+				<DESCRIPTION>Prepare target OAI store</DESCRIPTION>
+				<PARAMETERS>
+					<PARAM name="oaiDbName" type="string" managedBy="user" required="true">oaistore</PARAM>
+					<PARAM name="oaiFormat" type="string" managedBy="user" required="true">oaf</PARAM>
+					<PARAM name="oaiLayout" type="string" managedBy="user" required="true">index</PARAM>
+					<PARAM name="oaiInterpretation" type="string" managedBy="user" required="true">openaire</PARAM>
+					<PARAM name="oaiSource" type="string" managedBy="user" required="false"></PARAM>
+				</PARAMETERS>
+				<ARCS>
+					<ARC to="RefreshConfig" />
+				</ARCS>
+			</NODE>
+			<NODE name="RefreshConfig" type="OAIRefreshConfiguration">
+				<DESCRIPTION>Reads the current OAI configuration and upsert OAI sets accordingly</DESCRIPTION>
+				<PARAMETERS></PARAMETERS>
+				<ARCS>
+					<ARC to="SELECT_UPDATE_INDICES" />
+				</ARCS>
+			</NODE>
+			<NODE name="SELECT_UPDATE_INDICES" type="Selection">
+				<DESCRIPTION>Do we update the indices on the oai store?</DESCRIPTION>
+				<PARAMETERS>
+					<PARAM function="validValues(['YES', 'NO'])" managedBy="user" name="selection" required="true" type="string">YES</PARAM>
+				</PARAMETERS>
+				<ARCS>
+					<ARC name="YES" to="CompoundIndexes" />
+					<ARC name="NO" to="SELECT_REFRESH_SET_COUNTS" />
+				</ARCS>
+			</NODE>
+			<NODE name="CompoundIndexes" type="OAICreateIndex">
+				<DESCRIPTION>Create composite indexes for the OAI store</DESCRIPTION>
+				<PARAMETERS>
+					<PARAM name="fieldNames" type="string" managedBy="user" required="true">set,datestamp;license,oaftype;set,oaftype;oaftype,funder;resulttypeid,oaftype</PARAM>
+				</PARAMETERS>
+				<ARCS>
+					<ARC to="ConfigIndexes" />
+				</ARCS>
+			</NODE>
+			<NODE name="ConfigIndexes" type="OAIEnsureIndexes" >
+				<DESCRIPTION>Create indexes on fields as specified in the configuration profile</DESCRIPTION>
+				<PARAMETERS>
+				</PARAMETERS>
+				<ARCS>
+					<ARC to="SELECT_REFRESH_SET_COUNTS" />
+				</ARCS>
+			</NODE>			
+			<NODE name="SELECT_REFRESH_SET_COUNTS" type="Selection">
+				<DESCRIPTION>Do we refresh the sets counts?</DESCRIPTION>
+				<PARAMETERS>
+					<PARAM function="validValues(['YES', 'NO'])" managedBy="user" name="selection" required="true" type="string">YES</PARAM>
+				</PARAMETERS>
+				<ARCS>
+					<ARC name="YES" to="SetsCount" />
+					<ARC name="NO" to="SELECT_SWITCH_OAIDB" />
+				</ARCS>
+			</NODE>
+			<NODE name="SetsCount" type="OAISetsCountUpdate">
+				<DESCRIPTION>Count records in each OAI set, for each exported metadata format linked to the given oai collection</DESCRIPTION>
+				<PARAMETERS>
+					<PARAM name="configuredOnly" type="boolean" managedBy="user" required="true">false</PARAM>	
+				</PARAMETERS>
+				<ARCS>
+					<ARC to="SELECT_SWITCH_OAIDB" />
+				</ARCS>
+			</NODE>			
+			
+			<NODE name="SELECT_SWITCH_OAIDB" type="Selection">
+				<DESCRIPTION>Do we switch the oaistore db for the public now? If not, you can change the value manually on the configuration profile</DESCRIPTION>
+				<PARAMETERS>
+					<PARAM function="validValues(['YES', 'NO'])" managedBy="user" name="selection" required="true" type="string">YES</PARAM>
+				</PARAMETERS>
+				<ARCS>
+					<ARC name="YES" to="SetOAIDB" />
+					<ARC name="NO" to="success" />
+				</ARCS>
+			</NODE>
+			<NODE name="SetOAIDB" type="SetCurrentOAIDB">
+				<DESCRIPTION>Update the currentdb in the OAI configuration profile</DESCRIPTION>
+				<PARAMETERS>
+				</PARAMETERS>
+				<ARCS>
+					<ARC to="success" />
+				</ARCS>
+			</NODE>
+			
+		</CONFIGURATION>
+		<STATUS />
+	</BODY>
+</RESOURCE_PROFILE>
\ No newline at end of file
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/resources/eu/dnetlib/test/profiles/workflows/oai/oai-consistency.meta.xml
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/resources/eu/dnetlib/test/profiles/workflows/oai/oai-consistency.meta.xml	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/resources/eu/dnetlib/test/profiles/workflows/oai/oai-consistency.meta.xml	(revision 48067)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<RESOURCE_PROFILE>
+	<HEADER>
+		<RESOURCE_IDENTIFIER value="f2779189-b313-4b14-867b-09afd07eeb8f_TWV0YVdvcmtmbG93RFNSZXNvdXJjZXMvTWV0YVdvcmtmbG93RFNSZXNvdXJjZVR5cGU=" />
+		<RESOURCE_TYPE value="MetaWorkflowDSResourceType" />
+		<RESOURCE_KIND value="MetaWorkflowDSResources" />
+		<RESOURCE_URI value="" />
+		<DATE_OF_CREATION value="2013-11-25T17:47:51.0Z" />
+	</HEADER>
+	<BODY>
+		<METAWORKFLOW_NAME family="provision">OAI consistency</METAWORKFLOW_NAME>
+		<METAWORKFLOW_DESCRIPTION>Perform operations to ensure data consistency in OAI store</METAWORKFLOW_DESCRIPTION>
+		<METAWORKFLOW_SECTION>InfoSpace Provision</METAWORKFLOW_SECTION>
+		<ADMIN_EMAIL/>
+		<CONFIGURATION status="EXECUTABLE">
+			<WORKFLOW id="440e5de7-7106-469c-8c8d-89c261a1e09d_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl" name="OAI Post feed"/>
+		</CONFIGURATION>
+		<SCHEDULING enabled="false">
+			<CRON>29 5 22 ? * *</CRON>
+			<MININTERVAL>10080</MININTERVAL>
+		</SCHEDULING>
+	</BODY>
+</RESOURCE_PROFILE>
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/resources/eu/dnetlib/applicationContext-dnet-oai-common-workflows.xml
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/resources/eu/dnetlib/applicationContext-dnet-oai-common-workflows.xml	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0/src/main/resources/eu/dnetlib/applicationContext-dnet-oai-common-workflows.xml	(revision 48067)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+	xmlns:util="http://www.springframework.org/schema/util"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ 		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+        http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd">
+
+	<bean id="wfNodePrepareOaiJob"
+		class="eu.dnetlib.msro.oai.workflows.nodes.PrepareOaiDataJobNode"
+		scope="prototype" />
+
+	<!-- OAI feed -->
+	<bean id="wfNodeSyncOAIStores" class="eu.dnetlib.msro.oai.workflows.nodes.SyncOAIStoreJobNode"
+		scope="prototype" p:processCountingResultSetFactory-ref="msroProcessCountingResultSetFactory" />
+
+	<!-- Update OAI sets count -->
+	<bean id="wfNodeOAISetsCountUpdate" class="eu.dnetlib.msro.oai.workflows.nodes.OAISetsCountJobNode"
+		scope="prototype" />
+
+	<!-- Reload the current sets configuration -->
+	<bean id="wfNodeOAIRefreshConfiguration"
+		class="eu.dnetlib.msro.oai.workflows.nodes.RefreshOAIConfigJobNode"
+		scope="prototype" />
+
+	<!-- Refresh sets based on current config -->
+	<bean id="wfNodeOAIEnsureIndexes"
+		class="eu.dnetlib.msro.oai.workflows.nodes.OAIEnsureIndexesJobNode"
+		scope="prototype" />
+
+	<!-- Create new OAI store if needed -->
+	<bean id="wfNodeOAICreateStore"
+		class="eu.dnetlib.msro.oai.workflows.nodes.OAICreateStoreJobNode"
+		scope="prototype" />
+
+	<!-- Create new (compound) index on OAI stores -->
+	<bean id="wfNodeOAICreateIndex"
+		class="eu.dnetlib.msro.oai.workflows.nodes.OAICreateIndexJobNode"
+		scope="prototype" />
+
+	<!-- Drop OAI store -->
+	<bean id="wfNodeOAIDropStore" class="eu.dnetlib.msro.oai.workflows.nodes.OAIDropStoreJobNode"
+		scope="prototype" />
+
+	<!-- Set backend db -->
+	<bean id="wfNodeSetCurrentOAIDB"
+		class="eu.dnetlib.msro.oai.workflows.nodes.SetCurrentOAIDBJobNode"
+		scope="prototype" />
+</beans>
\ No newline at end of file
Index: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0
===================================================================
--- modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0	(nonexistent)
+++ modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0	(revision 48067)

Property changes on: modules/dnet-oai-common-workflows/tags/dnet-oai-common-workflows-5.0.0
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,6 ##
+.project
+.settings
+target
+.springBeans
+.classpath
+*.iml
