Project

General

Profile

« Previous | Next » 

Revision 42019

[maven-release-plugin] copy for tag dnet-msro-service-3.1.8

View differences:

modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/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>dnet-parent</artifactId>
6
		<version>1.0.0</version>
7
		<relativePath />
8
	</parent>
9
	<modelVersion>4.0.0</modelVersion>
10
	<groupId>eu.dnetlib</groupId>
11
	<artifactId>dnet-msro-service</artifactId>
12
	<packaging>jar</packaging>
13
	<version>3.1.8</version>
14
	<scm>
15
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-msro-service/tags/dnet-msro-service-3.1.8</developerConnection>
16
	</scm>
17
	<dependencies>
18
		<dependency>
19
			<groupId>opensymphony</groupId>
20
			<artifactId>quartz</artifactId>
21
			<version>1.6.6</version>
22
		</dependency>
23
		<dependency>
24
			<groupId>eu.dnetlib</groupId>
25
			<artifactId>dnet-msro-service-api</artifactId>
26
			<version>[2.0.0,3.0.0)</version>
27
		</dependency>
28
		<dependency>
29
			<groupId>eu.dnetlib</groupId>
30
			<artifactId>cnr-resultset-service</artifactId>
31
			<version>[2.0.0,3.0.0)</version>
32
		</dependency>
33
		<dependency>
34
			<groupId>eu.dnetlib</groupId>
35
			<artifactId>cnr-data-utility-cleaner-rmi</artifactId>
36
			<version>[2.0.0,3.0.0)</version>
37
		</dependency>
38
		<dependency>
39
			<groupId>eu.dnetlib</groupId>
40
			<artifactId>cnr-resultset-client</artifactId>
41
			<version>[2.0.0,3.0.0)</version>
42
		</dependency>
43
		<dependency>
44
			<groupId>eu.dnetlib</groupId>
45
			<artifactId>dnet-download-service-rmi</artifactId>
46
			<version>[1.1.0,2.0.0)</version>
47
		</dependency>
48
		<dependency>
49
			<groupId>eu.dnetlib</groupId>
50
			<artifactId>dnet-datasource-manager-rmi</artifactId>
51
			<version>[4.0.0,5.0.0)</version>
52
		</dependency>
53
		<dependency>
54
			<groupId>eu.dnetlib</groupId>
55
			<artifactId>cnr-blackboard-common</artifactId>
56
			<version>[2.1.0,3.0.0)</version>
57
		</dependency>
58
		<dependency>
59
			<groupId>eu.dnetlib</groupId>
60
			<artifactId>dnet-mongo-logging</artifactId>
61
			<version>[1.0.0,2.0.0)</version>
62
		</dependency>
63
		<dependency>
64
			<groupId>com.googlecode</groupId>
65
			<artifactId>sarasvati</artifactId>
66
			<version>1.0.3</version>
67
		</dependency>
68
		<dependency>
69
			<groupId>com.googlecode</groupId>
70
			<artifactId>sarasvati-visual</artifactId>
71
			<version>1.0.3</version>
72
		</dependency>
73
		<dependency>
74
			<groupId>eu.dnetlib</groupId>
75
			<artifactId>dnet-modular-collector-service-rmi</artifactId>
76
			<version>[1.3.0,2.0.0)</version>
77
		</dependency>
78
		<dependency>
79
			<groupId>eu.dnetlib</groupId>
80
			<artifactId>cnr-enabling-database-api</artifactId>
81
			<version>[2.0.0,3.0.0)</version>
82
		</dependency>
83
		<dependency>
84
			<groupId>eu.dnetlib</groupId>
85
			<artifactId>dnet-objectstore-rmi</artifactId>
86
			<version>[2.0.0,3.0.0)</version>
87
		</dependency>
88
		<dependency>
89
			<groupId>eu.dnetlib</groupId>
90
			<artifactId>dnet-data-transformation-service-rmi</artifactId>
91
			<version>[1.0.0,2.0.0)</version>
92
		</dependency>
93
		<dependency>
94
			<groupId>eu.dnetlib</groupId>
95
			<artifactId>dnet-data-provision-rmi</artifactId>
96
			<version>[1.0.0,2.0.0)</version>
97
		</dependency>
98
		<dependency>
99
			<groupId>eu.dnetlib</groupId>
100
			<artifactId>dnet-runtime</artifactId>
101
			<version>[1.0.0,2.0.0)</version>
102
		</dependency>
103
		<dependency>
104
			<groupId>javax.mail</groupId>
105
			<artifactId>mail</artifactId>
106
			<version>1.4</version>
107
		</dependency>
108
		<dependency>
109
			<groupId>org.codehaus.groovy</groupId>
110
			<artifactId>groovy-all</artifactId>
111
			<version>2.1.6</version>
112
		</dependency>
113
		<dependency>
114
			<groupId>junit</groupId>
115
			<artifactId>junit</artifactId>
116
			<version>${junit.version}</version>
117
			<scope>test</scope>
118
		</dependency>
119
		<dependency>
120
			<groupId>joda-time</groupId>
121
			<artifactId>joda-time</artifactId>
122
			<version>2.3</version>
123
		</dependency>
124
	</dependencies>
125

  
126
	<properties>
127
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
128
	</properties>
129

  
130
</project>
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/resources/eu/dnetlib/msro/service/logIndex.conf
1
dnet.log.index.conf { "system:profileId" {}, "system:processId" {}, "system:isCompletedSuccessfully" {}, "system:profileFamily" {} }
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/resources/eu/dnetlib/msro/service/applicationContext-msro-nodes.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
       xmlns:p="http://www.springframework.org/schema/p"
4
       xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns="http://www.springframework.org/schema/beans"
5
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
6

  
7

  
8
                                    http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd">
9

  
10
	<bean id="wfNodeSelection" class="eu.dnetlib.msro.workflows.nodes.sel.SelectiveNode"
11
		scope="prototype" />
12
		
13
	<!-- IS -->
14
	<bean id="wfNodeValidateProfiles"
15
		class="eu.dnetlib.msro.workflows.nodes.is.ValidateProfilesJobNode"
16
		scope="prototype" />
17

  
18
	<!-- Datasources -->
19
	<bean id="wfNodeSetProviderInfo"
20
		class="eu.dnetlib.msro.workflows.nodes.info.SetProviderInfoJobNode"
21
		scope="prototype" />
22

  
23
	<bean id="wfNodeValidateDatasource"
24
		class="eu.dnetlib.msro.workflows.nodes.repohi.ValidateDatasourceJobNode"
25
		scope="prototype" />
26
		
27
	<bean id="wfNodeVerifyDatasource"
28
		class="eu.dnetlib.msro.workflows.nodes.repohi.VerifyDatasourceJobNode"
29
		scope="prototype" />
30

  
31
	<bean id="wfNodeCreateObjectStore"
32
		class="eu.dnetlib.msro.workflows.nodes.repohi.CreateObjectStoreJobNode"
33
		scope="prototype" />
34

  
35
	<bean id="wfNodeDropContentObjectStore"
36
	      class="eu.dnetlib.msro.workflows.nodes.objectStore.DropContentObjectStoreJobNode"
37
	      scope="prototype"/>
38
		
39
	<!-- Unpack -->
40
	<bean id="wfNodeUnpack" 
41
		class="eu.dnetlib.msro.workflows.nodes.unpack.UnpackJobNode"
42
		p:resultSetClientFactory-ref="resultSetClientFactory"
43
		p:iterableResultSetFactory-ref="iterableResultSetFactory" 
44
		scope="prototype" />
45
	
46
	<!--  ObjectStore -->
47
	<bean id="wfNodeDownloadIntoObjectStore"
48
		class="eu.dnetlib.msro.workflows.nodes.objectStore.DownloadIntoObjectStoreJobNode"
49
		scope="prototype" 
50
		p:processCountingResultSetFactory-ref="msroProcessCountingResultSetFactory"
51
		p:resultSetClientFactory-ref="resultSetClientFactory"
52
		p:iterableResultSetFactory-ref="iterableResultSetFactory"  />
53
	<bean id ="wfNodeDeleteObjectStore" class= "eu.dnetlib.msro.workflows.nodes.repobye.DeleteObjectStoreJobNode"
54
		scope="prototype" />
55

  
56
	<bean id="wfNodeRetrieveURLS"
57
		class="eu.dnetlib.msro.workflows.nodes.objectStore.RetrieveURLSJobNode"
58
		p:xpathMetadataId="${msro.wf.nodes.download.xpathMetadataId}"
59
		scope="prototype" />
60
		
61
	<!-- Download Service -->
62
	<bean id="wfNodeRetrieveMdStoreId" class ="eu.dnetlib.msro.workflows.nodes.objectStore.RetrieveMdStoreId"
63
		p:metadataFormat="${msro.wf.nodes.mdstoreSearch.format}"
64
		p:interpretation="${msro.wf.nodes.mdstoreSearch.interpretation}"
65
	/>
66
	
67
	<bean id ="wfNodeDownloadFromMetadata" class="eu.dnetlib.msro.workflows.nodes.download.DownloadFromMetadataJobNode"		
68
		scope="prototype" />
69
		
70
	<bean id ="wfNodeUpdateObjectStoreSize" class="eu.dnetlib.msro.workflows.nodes.objectStore.UpdateObjectStoreSizeJobNode"		
71
		scope="prototype" />
72
	
73
	<!-- Collector service -->
74
	<bean id="wfNodeCollectRecords"
75
		class="eu.dnetlib.msro.workflows.nodes.collect.CollectRecordsJobNode"
76
		scope="prototype" />
77
		
78
	<bean id="wfNodeDateRangeCollectRecords"
79
		class="eu.dnetlib.msro.workflows.nodes.collect.DateRangeCollectRecordsJobNode"
80
		scope="prototype" />
81
	
82
	<bean id="wfNodeFindDateRangeForIncrementalHarvesting" 
83
		class="eu.dnetlib.msro.workflows.nodes.collect.FindDateRangeForIncrementalHarvestingJobNode" 
84
		scope="prototype"/>
85
	
86
	<bean id="wfNodeMdBuilder"
87
		class="eu.dnetlib.msro.workflows.nodes.transform.MdBuilderJobNode"
88
		p:xsltMappedResultSetFactory-ref="xsltResultSetFactory"
89
		p:mdBuilderTemplateXslt="${msro.wf.nodes.mdbuilder.xslt.template}"
90
		scope="prototype" />
91

  
92
	<!-- Transform -->
93
	<bean id="wfNodeTransform"
94
		class="eu.dnetlib.msro.workflows.nodes.transform.TransformJobNode"
95
		scope="prototype" />
96
		
97
	<bean id="wfNodeApplyXslt"
98
		class="eu.dnetlib.msro.workflows.nodes.transform.ApplyXsltJobNode"
99
		p:xsltMappedResultSetFactory-ref="xsltResultSetFactory"
100
		scope="prototype" />	
101
		
102
	<bean id="wfNodeGroovy"
103
		class="eu.dnetlib.msro.workflows.nodes.transform.GroovyJobNode"
104
		p:mappedResultSetFactory-ref="xsltResultSetFactory"
105
		scope="prototype" />
106
	
107
		
108
	<bean id="wfNodeClean"
109
		class="eu.dnetlib.msro.workflows.nodes.transform.CleanJobNode"
110
		scope="prototype" />		
111
	
112
	<!-- Index -->
113
	<bean id="wfNodeUpdateIndex" class="eu.dnetlib.msro.workflows.nodes.index.UpdateIndexJobNode"
114
		scope="prototype" 
115
		p:layoutToRecordStylesheet="classpath:/eu/dnetlib/msro/workflows/xslt/layoutToRecordStylesheet.xsl"
116
		p:xsltRSFactory-ref="xsltResultSetFactory"
117
		p:processCountingResultSetFactory-ref="msroProcessCountingResultSetFactory"
118
		p:defaultIndexId="${service.msro.index.defaultIndex}"  />
119

  
120
	<bean id="wfNodeCreateIndex" class="eu.dnetlib.msro.workflows.nodes.index.CreateIndexJobNode"
121
		scope="prototype" p:defaultBackendId="${service.msro.index.defaultIndex}" />
122
		
123
	<bean id="wfNodeDeleteIndex" class="eu.dnetlib.msro.workflows.nodes.index.DeleteIndexJobNode"
124
		scope="prototype" p:defaultIndexId="${service.msro.index.defaultIndex}" />	
125
		
126
	<bean id="wfNodePrepareCreateIndex"
127
		class="eu.dnetlib.msro.workflows.nodes.index.PrepareCreateIndexJobNode"
128
		scope="prototype" />
129
	
130
	<!-- Database -->
131
	<bean id="wfNodeUpdateDb" class="eu.dnetlib.msro.workflows.nodes.db.UpdateDbJobNode"
132
		scope="prototype" p:processCountingResultSetFactory-ref="msroProcessCountingResultSetFactory" />
133

  
134
	<bean id="wfNodeQueryDb" class="eu.dnetlib.msro.workflows.nodes.db.QueryDbJobNode"
135
		scope="prototype" />
136

  
137
	<bean id="wfNodeExecuteSql" class="eu.dnetlib.msro.workflows.nodes.db.ExecuteSqlJobNode"
138
		scope="prototype" />
139

  
140
	<bean id="wfNodeExecuteSqlFromEnv" class="eu.dnetlib.msro.workflows.nodes.db.ExecuteSqlFromEnvJobNode"
141
	      scope="prototype"/>
142

  
143
	<!-- MDStore -->
144
	<bean id="wfNodeCreateMDStore"
145
		class="eu.dnetlib.msro.workflows.nodes.repohi.CreateMDStoreJobNode"
146
		scope="prototype" />
147

  
148
	<bean id="wfNodeStoreMDStoreRecords"
149
		class="eu.dnetlib.msro.workflows.nodes.mdstore.StoreMDStoreRecordsJobNode"
150
		scope="prototype" p:processCountingResultSetFactory-ref="msroProcessCountingResultSetFactory" />
151

  
152
	<bean id="wfNodeFetchMDStoreRecords"
153
		class="eu.dnetlib.msro.workflows.nodes.mdstore.FetchMDStoreRecordsJobNode"
154
		scope="prototype" />
155
		
156
	<bean id="wfNodeFetchMultipleMDStoreRecords"
157
		class="eu.dnetlib.msro.workflows.nodes.mdstore.FetchMultipleMDStores"
158
		scope="prototype" />
159

  
160
	<bean id="wfNodeMDStoreToApiExtraField"
161
		class="eu.dnetlib.msro.workflows.nodes.info.MDStoreToApiExtraFieldJobNode"
162
		scope="prototype" />
163
		
164
	<bean id="wfNodeObjectStoreToApiExtraField"
165
		class="eu.dnetlib.msro.workflows.nodes.info.ObjectStoreToApiExtraFieldJobNode"
166
		scope="prototype" />
167
		
168
	<bean id="wfNodeRemoveApiExtraFields"
169
		class="eu.dnetlib.msro.workflows.nodes.info.RemoveApiExtraFieldsJobNode"
170
		scope="prototype" />
171
		
172
	<bean id="wfNodeSetFormatInfo"
173
		class="eu.dnetlib.msro.workflows.nodes.SetFormatInfoJobNode"
174
		scope="prototype" />
175
		
176
	<bean id="wfNodeSetEnvParameter"
177
		class="eu.dnetlib.msro.workflows.nodes.SetEnvParameterJobNode"
178
		scope="prototype" />
179
		
180
</beans>
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/java/eu/dnetlib/msro/workflows/nodes/transform/TransformJobNode.java
1
package eu.dnetlib.msro.workflows.nodes.transform;
2

  
3
import javax.annotation.Resource;
4
import javax.xml.ws.wsaddressing.W3CEndpointReference;
5

  
6
import com.googlecode.sarasvati.Arc;
7
import com.googlecode.sarasvati.NodeToken;
8

  
9
import eu.dnetlib.data.transformation.service.rmi.TransformationService;
10
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
11
import eu.dnetlib.enabling.resultset.client.utils.EPRUtils;
12
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
13

  
14
public class TransformJobNode extends SimpleJobNode {
15

  
16
	private String inputEprParam;
17
	private String outputEprParam;
18
	private String ruleId;
19

  
20
	@Resource
21
	private UniqueServiceLocator serviceLocator;
22

  
23
	@Override
24
	protected String execute(final NodeToken token) throws Exception {
25
		final W3CEndpointReference inputEpr = new EPRUtils().getEpr(token.getEnv().getAttribute(inputEprParam));
26
		final W3CEndpointReference outputEpr = serviceLocator.getService(TransformationService.class).transform(ruleId, inputEpr);
27

  
28
		token.getEnv().setAttribute(outputEprParam, outputEpr.toString());
29

  
30
		return Arc.DEFAULT_ARC;
31
	}
32

  
33
	public String getInputEprParam() {
34
		return inputEprParam;
35
	}
36

  
37
	public void setInputEprParam(final String inputEprParam) {
38
		this.inputEprParam = inputEprParam;
39
	}
40

  
41
	public String getOutputEprParam() {
42
		return outputEprParam;
43
	}
44

  
45
	public void setOutputEprParam(final String outputEprParam) {
46
		this.outputEprParam = outputEprParam;
47
	}
48

  
49
	public String getRuleId() {
50
		return ruleId;
51
	}
52

  
53
	public void setRuleId(final String ruleId) {
54
		this.ruleId = ruleId;
55
	}
56

  
57
}
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/resources/eu/dnetlib/msro/service/applicationContext-msro-service.properties
1
msro.wf.ui.dataprovider.protocols = [ {name: 'OAI', value: 'OAI', icon: 'icon-book'}, {name: 'FTP', value: 'FTP', icon: 'icon-download-alt'}, {name: 'local dir', value: 'filesystem', icon: 'icon-folder-open'}, {name: 'local file', value: 'file', icon: 'icon-file'}, {name: 'http', value: 'http', icon: 'icon-arrow-down'} ]
2
msro.wf.ui.dataprovider.typologies= [ {name: 'Publication repository', value: 'pubsrepository', icon: 'icon-hdd'}, {name: 'Dataset repository', value: 'datarepository', icon: 'icon-hdd'}, {name: 'Aggregator', value: 'AGGREGATOR', icon: 'icon-hdd'}, {name: 'Entity registry', value: 'entityregistry', icon: 'icon-hdd'} ]
3
msro.wf.logger.name = wf_logs
4
msro.wf.logger.index.conf = classpath:/eu/dnetlib/msro/service/logIndex.conf
5
msro.wf.registry.maxSize = 20
6
msro.wf.max.running = 5
7
msro.wf.scheduler.startDelay = 60000
8
msro.wf.scheduler.repeatInterval = 600000
9
msro.wf.scheduler.window.size = 7200000
10

  
11
msro.wf.mail.thread.startDelay = 60000
12
msro.wf.mail.thread.repeatInterval = 60000
13

  
14
msro.wf.mail.from = dnet-noreply@research-infrastructures.eu
15
msro.wf.mail.fromName = D-NET Workflow Manager
16
msro.wf.mail.cc = michele.artini@isti.cnr.it
17
msro.wf.mail.smtp.host = localhost
18
msro.wf.mail.smtp.port = 587
19
msro.wf.mail.smtp.user = 
20
msro.wf.mail.smtp.password =
21
msro.wf.nodes.mdstoreSearch.format = DMF
22
msro.wf.nodes.mdstoreSearch.interpretation = cleaned
23
msro.wf.nodes.download.xpathMetadataId = //*[local-name()='objIdentifier']
24
service.msro.index.defaultIndex = solr
25

  
26
msro.wf.mail.message.baseUrl = http://localhost:8280/app/mvc/ui
27
msro.wf.mail.message.infrastructure= ${container.hostname}
28

  
29
#This property is the default value used by the bean 'mdBuilderTemplateXslt' and injected in MdBuilderJobNode node ~ A.M.
30
msro.wf.nodes.mdbuilder.xslt.template = classpath:/eu/dnetlib/msro/workflows/xslt/mdBuilder.xslt.st
31

  
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/java/eu/dnetlib/msro/workflows/nodes/transform/GroovyUnaryFunction.java
1
package eu.dnetlib.msro.workflows.nodes.transform;
2

  
3
import java.util.Map;
4

  
5
import eu.dnetlib.miscutils.functional.UnaryFunction;
6

  
7
public abstract class GroovyUnaryFunction implements UnaryFunction<String, String> {
8

  
9
	private Map<String, String> params;
10

  
11
	@Override
12
	abstract public String evaluate(String input);
13

  
14
	public Map<String, String> getParams() {
15
		return params;
16
	}
17

  
18
	public void setParams(final Map<String, String> params) {
19
		this.params = params;
20
	}
21

  
22
}
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/resources/eu/dnetlib/msro/service/applicationContext-msro-service.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
       xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:sec="http://cxf.apache.org/configuration/security"
4
       xmlns:wsa="http://cxf.apache.org/ws/addressing" xmlns:p="http://www.springframework.org/schema/p"
5
       xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:t="http://dnetlib.eu/springbeans/t"
6
       xmlns:template="http://dnetlib.eu/springbeans/template" xmlns="http://www.springframework.org/schema/beans"
7
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
8
                                    http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
9
                                    http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
10
                                    http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
11
                            http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
12
                            http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd">
13
	<!-- beans -->
14
	<bean id="msroService" class="eu.dnetlib.msro.MSROServiceImpl"
15
		init-method="start" destroy-method="stop" 
16
		p:notificationHandler-ref="msroNotificationHandlerChain"
17
		p:processRegistry-ref="graphProcessRegistry" />
18

  
19
	<bean id="msroNotificationHandlerChain"
20
		class="eu.dnetlib.enabling.tools.blackboard.NotificationHandlerChainImpl">
21
		<property name="handlerExecutor">
22
			<bean class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"
23
				p:corePoolSize="32" p:keepAliveSeconds="3600" p:queueCapacity="0" />
24
		</property>
25
		<property name="handlers">
26
			<list>
27
				<ref bean="msroBlackboardNotificationHandler" />
28
			</list>
29
		</property>
30
	</bean>
31

  
32
	<bean id="wfDependencyLauncherNotificationHandler" class="eu.dnetlib.msro.notification.WfDependencyLauncherNotificationHandler"
33
		p:enabled="true" p:topicExpression="UPDATE/WorkflowDSResourceType/*/RESOURCE_PROFILE/BODY/STATUS/LAST_EXECUTION_DATE" />
34

  
35
	<alias name="cxfEndpointReferenceBuilder" alias="eprBuilder" />
36
	
37
	<bean id="msroWfEngine" class="eu.dnetlib.msro.workflows.sarasvati.loader.InjectableMemEngine">
38
		<property name="graphFactory">
39
			<bean class="eu.dnetlib.msro.workflows.sarasvati.loader.InjectableMemGraphFactory">
40
				<property name="nodeFactory">
41
					<bean class="eu.dnetlib.msro.workflows.sarasvati.loader.InjectableNodeFactory"
42
						p:beanNamePrefix="wfNode" />				
43
				</property>
44
			</bean>
45
		</property>
46
	</bean>
47
	
48
	<bean id="graphProcessRegistry" class="eu.dnetlib.msro.workflows.sarasvati.registry.GraphProcessRegistry" 
49
		p:maxSize="${msro.wf.registry.maxSize}" />
50

  
51
	<bean id="sarasvatiGraphLoader" 
52
		class="eu.dnetlib.msro.workflows.sarasvati.loader.GraphLoader" 
53
		p:engine-ref="msroWfEngine" /> 
54
		
55
	<bean id="sarasvatiWorkflowExecutor" class="eu.dnetlib.msro.workflows.sarasvati.loader.WorkflowExecutor"
56
	      p:engine-ref="msroWfEngine"
57
	      p:graphLoader-ref="sarasvatiGraphLoader"
58
	      p:graphProcessRegistry-ref="graphProcessRegistry"
59
	      p:profileToSarasvatiConverter-ref="msroProfileToSarasvatiConverter"
60
	      p:maxRunningWorkflows="${msro.wf.max.running}"
61
	      init-method="init"/>
62
	
63
	<bean id="workflowsConstants" class="eu.dnetlib.msro.workflows.util.WorkflowsConstants"
64
		init-method="init" 
65
		p:dataproviderProtocolsJson="${msro.wf.ui.dataprovider.protocols}" 
66
		p:dataproviderTypologiesJson="${msro.wf.ui.dataprovider.typologies}" />
67
		
68
	<bean id="msroProfileToSarasvatiConverter" class="eu.dnetlib.msro.workflows.sarasvati.loader.ProfileToSarasvatiConverter"
69
	 	p:xslt="classpath:/eu/dnetlib/msro/workflows/xslt/wf_profile2sarasvati.xslt" />
70
	
71
	<bean id="msroBlackboardNotificationHandler"
72
		class="eu.dnetlib.enabling.tools.blackboard.DeletingBlackboardNotificationHandler"
73
		p:blackboardHandler-ref="blackboardClientHandler" />
74
	
75
	<bean id="datasourceMetaWorkflowFactory" class="eu.dnetlib.msro.workflows.metawf.DatasourceMetaWorkflowFactory"/>
76
	
77
	<bean id="msroProcessCountingResultSetFactory" 
78
		class="eu.dnetlib.msro.workflows.resultset.ProcessCountingResultSetFactory"
79
		p:resultSetFactory-ref="openResultSetFactory" p:serviceResolver-ref="serviceResolver" />
80
	
81
	<bean t:id="msroJobSchedulerAccessor"
82
		class="org.springframework.scheduling.quartz.SchedulerAccessorBean"
83
		p:scheduler-ref="jobScheduler">
84
		<property name="triggers">
85
			<list>
86
				<bean class="org.springframework.scheduling.quartz.SimpleTriggerBean"
87
					p:startDelay="6000" p:repeatCount="0">
88
					<property name="jobDetail">
89
						<bean class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"
90
							p:targetObject-ref="msroBlackboardSubscriber" p:targetMethod="subscribeAll" />
91
					</property>
92
				</bean>
93
				<bean class="org.springframework.scheduling.quartz.SimpleTriggerBean"
94
					p:startDelay="${msro.wf.scheduler.startDelay}" p:repeatInterval="${msro.wf.scheduler.repeatInterval}">
95
					<property name="jobDetail">
96
						<bean class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"
97
							p:targetObject-ref="msroScheduledWorkflowLauncher" p:targetMethod="verifySheduledWorkflows" />
98
					</property>
99
				</bean>
100
				<bean class="org.springframework.scheduling.quartz.SimpleTriggerBean"
101
					p:startDelay="${msro.wf.mail.thread.startDelay}" p:repeatInterval="${msro.wf.mail.thread.repeatInterval}">
102
					<property name="jobDetail">
103
						<bean class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"
104
							p:targetObject-ref="msroMailDispatcher" p:targetMethod="processMailQueue" />
105
					</property>
106
				</bean>
107
			</list>
108
		</property>
109
	</bean>		
110
	
111
	<bean id="msroBlackboardSubscriber" class="eu.dnetlib.msro.workflows.nodes.blackboard.BlackboardSubscriber"
112
		p:endpoint-ref="msroServiceEndpoint" />
113
	
114
	<bean id="msroScheduledWorkflowLauncher" class="eu.dnetlib.msro.cron.ScheduledWorkflowLauncher"
115
		p:graphProcessRegistry-ref="graphProcessRegistry" p:workflowExecutor-ref="sarasvatiWorkflowExecutor"
116
		p:windowSize="${msro.wf.scheduler.window.size}" />
117
	
118
	
119
	<bean id="msroWorkflowLogger" class="eu.dnetlib.common.logging.DnetLogger"
120
		p:name="${msro.wf.logger.name}" p:indexConf="${msro.wf.logger.index.conf}" />
121
	
122
	<bean id="msroMailDispatcher" class="eu.dnetlib.msro.notification.EmailDispatcher"
123
		p:from="${msro.wf.mail.from}" p:fromName="${msro.wf.mail.fromName}" p:cc="${msro.wf.mail.cc}"
124
		p:smtpHost="${msro.wf.mail.smtp.host}" p:smtpPort="${msro.wf.mail.smtp.port}" p:smtpUser="${msro.wf.mail.smtp.user}" p:smtpPassword="${msro.wf.mail.smtp.password}" 
125
		p:baseUrl="${msro.wf.mail.message.baseUrl}" p:infrastructure="${msro.wf.mail.message.infrastructure}"/>
126
	
127
	<!-- System nodes -->
128
	<bean id="wfNodeSuccess" class="eu.dnetlib.msro.workflows.nodes.SuccessFailureNode" p:success="true" scope="prototype" />
129
	<bean id="wfNodeFailure" class="eu.dnetlib.msro.workflows.nodes.SuccessFailureNode" p:success="false" scope="prototype" />
130
		
131
	<!-- REPO_HI and REPO_BYE -->
132
	<bean id="wfNodeRegisterMetaWf"	class="eu.dnetlib.msro.workflows.nodes.repohi.RegisterMetaWfJobNode" scope="prototype" />
133
	<bean id="wfNodeUpdateMetaWf" class="eu.dnetlib.msro.workflows.nodes.repohi.UpdateMetaWfJobNode" scope="prototype" />
134
	<bean id="wfNodeUpdateMetaWfStatus"	class="eu.dnetlib.msro.workflows.nodes.repohi.UpdateMetaWfStatusJobNode" scope="prototype" />
135
	<bean id="wfNodeDeleteMetaWf" class="eu.dnetlib.msro.workflows.nodes.repobye.DeleteMetaWfJobNode" scope="prototype" />
136
	<bean id="wfNodeDeleteMDStore" class="eu.dnetlib.msro.workflows.nodes.repobye.DeleteMDStoreJobNode" scope="prototype" />
137
	
138
	<!-- endpoints -->
139
	<jaxws:endpoint id="msroServiceEndpoint" implementor="#msroService"
140
		implementorClass="eu.dnetlib.msro.rmi.MSROService"
141
		address="/msro" />
142

  
143
	<template:instance name="serviceRegistrationManager"
144
		t:serviceRegistrationManagerClass="eu.dnetlib.enabling.tools.registration.ValidatingServiceRegistrationManagerImpl"
145
		t:name="msroServiceRegistrationManager" t:service="msroService"
146
		t:endpoint="msroServiceEndpoint" t:jobScheduler="jobScheduler" />
147

  
148
</beans>
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/java/eu/dnetlib/msro/workflows/nodes/info/MDStoreToApiExtraFieldJobNode.java
1
package eu.dnetlib.msro.workflows.nodes.info;
2

  
3
import java.io.StringReader;
4
import java.util.Map;
5

  
6
import javax.annotation.Resource;
7

  
8
import org.dom4j.Document;
9
import org.dom4j.Node;
10
import org.dom4j.io.SAXReader;
11

  
12
import com.google.common.collect.Maps;
13
import com.googlecode.sarasvati.Arc;
14
import com.googlecode.sarasvati.NodeToken;
15

  
16
import eu.dnetlib.enabling.datasources.rmi.DatasourceManagerService;
17
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
18
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
19
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
20

  
21
public class MDStoreToApiExtraFieldJobNode extends SimpleJobNode {
22

  
23
	private String mdId;
24
	private String datasourceId;
25
	private String datasourceInterface;
26
	private String extraFieldForTotal;
27
	private String extraFieldForDate;
28
	private String extraFieldForMdId;
29

  
30
	@Resource
31
	private UniqueServiceLocator serviceLocator;
32

  
33
	@Override
34
	protected String execute(final NodeToken token) throws Exception {
35
		final String xq = "for $x in collection('/db/DRIVER/MDStoreDSResources/MDStoreDSResourceType') " +
36
				"where $x//RESOURCE_IDENTIFIER/@value='" + mdId + "' " +
37
				"return concat($x//NUMBER_OF_RECORDS, ' @=@ ', $x//LAST_STORAGE_DATE)";
38

  
39
		final String s = serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(xq);
40

  
41
		final String[] arr = s.split(" @=@ ");
42

  
43
		final Map<String, String> map = getCurrentExtraFields(datasourceId, datasourceInterface);
44
		map.put(extraFieldForTotal, arr[0].trim());
45
		map.put(extraFieldForDate, arr[1].trim());
46
		map.put(extraFieldForMdId, mdId);
47

  
48
		serviceLocator.getService(DatasourceManagerService.class).bulkUpdateApiExtraFields(datasourceId, datasourceInterface, map);
49

  
50
		return Arc.DEFAULT_ARC;
51
	}
52

  
53
	private Map<String, String> getCurrentExtraFields(final String repoId, final String ifaceId) throws Exception {
54
		final Map<String, String> res = Maps.newHashMap();
55

  
56
		final String profile = serviceLocator.getService(ISLookUpService.class).getResourceProfile(repoId);
57

  
58
		final SAXReader reader = new SAXReader();
59
		final Document doc = reader.read(new StringReader(profile));
60

  
61
		final Node ifcNode = doc.selectSingleNode("//INTERFACE[@id='" + ifaceId + "']");
62
		if (ifcNode != null) {
63
			for (Object o : ifcNode.selectNodes("./INTERFACE_EXTRA_FIELD")) {
64
				res.put(((Node) o).valueOf("@name"), ((Node) o).getText());
65
			}
66
		}
67

  
68
		return res;
69
	}
70

  
71
	public String getMdId() {
72
		return mdId;
73
	}
74

  
75
	public void setMdId(final String mdId) {
76
		this.mdId = mdId;
77
	}
78

  
79
	public String getDatasourceId() {
80
		return datasourceId;
81
	}
82

  
83
	public void setDatasourceId(final String datasourceId) {
84
		this.datasourceId = datasourceId;
85
	}
86

  
87
	public String getDatasourceInterface() {
88
		return datasourceInterface;
89
	}
90

  
91
	public void setDatasourceInterface(final String datasourceInterface) {
92
		this.datasourceInterface = datasourceInterface;
93
	}
94

  
95
	public String getExtraFieldForTotal() {
96
		return extraFieldForTotal;
97
	}
98

  
99
	public void setExtraFieldForTotal(final String extraFieldForTotal) {
100
		this.extraFieldForTotal = extraFieldForTotal;
101
	}
102

  
103
	public String getExtraFieldForDate() {
104
		return extraFieldForDate;
105
	}
106

  
107
	public void setExtraFieldForDate(final String extraFieldForDate) {
108
		this.extraFieldForDate = extraFieldForDate;
109
	}
110

  
111
	public String getExtraFieldForMdId() {
112
		return extraFieldForMdId;
113
	}
114

  
115
	public void setExtraFieldForMdId(final String extraFieldForMdId) {
116
		this.extraFieldForMdId = extraFieldForMdId;
117
	}
118

  
119
}
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/resources/eu/dnetlib/msro/workflows/templates/meta-workflow.xml.st
1
<?xml version="1.0" encoding="UTF-8"?>
2
<RESOURCE_PROFILE>
3
	<HEADER>
4
		<RESOURCE_IDENTIFIER value="" />
5
		<RESOURCE_TYPE value="MetaWorkflowDSResourceType" />
6
		<RESOURCE_KIND value="MetaWorkflowDSResources" />
7
		<RESOURCE_URI value="" />
8
		<DATE_OF_CREATION value="2006-05-04T18:13:51.0Z" />
9
	</HEADER>
10
	<BODY>
11
		<DATAPROVIDER id="$dsId$" interface="$ifaceId$">$dsName$</DATAPROVIDER>
12
		<METAWORKFLOW_NAME family="$wfFamily$">$wfName$</METAWORKFLOW_NAME>
13
		<METAWORKFLOW_DESCRIPTION></METAWORKFLOW_DESCRIPTION>
14
		<METAWORKFLOW_SECTION>$section$</METAWORKFLOW_SECTION>
15
		<ADMIN_EMAIL>$adminEmail$</ADMIN_EMAIL>
16
		<CONFIGURATION status="$status$" />
17
		<SCHEDULING enabled="false">
18
			<CRON>0 0 0 ? * *</CRON>
19
			<MININTERVAL>10080</MININTERVAL>
20
		</SCHEDULING>
21
	</BODY>
22
</RESOURCE_PROFILE>
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/resources/eu/dnetlib/msro/workflows/templates/workflow.xml.st
1
<?xml version="1.0" encoding="UTF-8"?>
2
<RESOURCE_PROFILE>
3
    <HEADER>
4
        <RESOURCE_IDENTIFIER value=""/>
5
        <RESOURCE_TYPE value="WorkflowDSResourceType"/>
6
        <RESOURCE_KIND value="WorkflowDSResources"/>
7
        <RESOURCE_URI value=""/>
8
        <DATE_OF_CREATION value="2006-05-04T18:13:51.0Z"/>
9
    </HEADER>
10
    <BODY>
11
        <WORKFLOW_NAME>$name$</WORKFLOW_NAME>
12
		<WORKFLOW_TYPE>$type$</WORKFLOW_TYPE>
13
		<WORKFLOW_PRIORITY>$priority$</WORKFLOW_PRIORITY>
14
        <CONFIGURATION start="$startMode$">
15
        	$conf$
16
        </CONFIGURATION>
17
        <STATUS />
18
    </BODY>
19
</RESOURCE_PROFILE>
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/java/eu/dnetlib/msro/workflows/nodes/info/ObjectStoreToApiExtraFieldJobNode.java
1
package eu.dnetlib.msro.workflows.nodes.info;
2

  
3
import java.io.StringReader;
4
import java.util.Map;
5

  
6
import javax.annotation.Resource;
7

  
8
import org.dom4j.Document;
9
import org.dom4j.Node;
10
import org.dom4j.io.SAXReader;
11

  
12
import com.google.common.collect.Maps;
13
import com.googlecode.sarasvati.Arc;
14
import com.googlecode.sarasvati.NodeToken;
15

  
16
import eu.dnetlib.enabling.datasources.rmi.DatasourceManagerService;
17
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
18
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
19
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
20

  
21
public class ObjectStoreToApiExtraFieldJobNode extends SimpleJobNode {
22

  
23
	private String objId;
24
	private String datasourceId;
25
	private String datasourceInterface;
26
	private String extraFieldForTotal;
27
	private String extraFieldForDate;
28
	private String extraFieldForObjId;
29

  
30
	@Resource
31
	private UniqueServiceLocator serviceLocator;
32

  
33
	@Override
34
	protected String execute(final NodeToken token) throws Exception {
35
		final String xq = "for $x in collection('/db/DRIVER/ObjectStoreDSResources/ObjectStoreDSResourceType') " + "where $x//RESOURCE_IDENTIFIER/@value='"
36
				+ objId + "' " + "return concat($x//COUNT_STORE, ' @=@ ', $x//LAST_STORAGE_DATE)";
37

  
38
		final String s = serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(xq);
39

  
40
		final String[] arr = s.split(" @=@ ");
41

  
42
		final Map<String, String> map = getCurrentExtraFields(datasourceId, datasourceInterface);
43
		map.put(extraFieldForTotal, arr[0].trim());
44
		map.put(extraFieldForDate, arr[1].trim());
45
		map.put(extraFieldForObjId, objId);
46

  
47
		serviceLocator.getService(DatasourceManagerService.class).bulkUpdateApiExtraFields(datasourceId, datasourceInterface, map);
48

  
49
		return Arc.DEFAULT_ARC;
50
	}
51

  
52
	private Map<String, String> getCurrentExtraFields(final String repoId, final String ifaceId) throws Exception {
53
		final Map<String, String> res = Maps.newHashMap();
54

  
55
		final String profile = serviceLocator.getService(ISLookUpService.class).getResourceProfile(repoId);
56

  
57
		final SAXReader reader = new SAXReader();
58
		final Document doc = reader.read(new StringReader(profile));
59

  
60
		final Node ifcNode = doc.selectSingleNode("//INTERFACE[@id='" + ifaceId + "']");
61
		if (ifcNode != null) {
62
			for (Object o : ifcNode.selectNodes("./INTERFACE_EXTRA_FIELD")) {
63
				res.put(((Node) o).valueOf("@name"), ((Node) o).getText());
64
			}
65
		}
66

  
67
		return res;
68
	}
69

  
70
	public String getDatasourceId() {
71
		return datasourceId;
72
	}
73

  
74
	public void setDatasourceId(final String datasourceId) {
75
		this.datasourceId = datasourceId;
76
	}
77

  
78
	public String getDatasourceInterface() {
79
		return datasourceInterface;
80
	}
81

  
82
	public void setDatasourceInterface(final String datasourceInterface) {
83
		this.datasourceInterface = datasourceInterface;
84
	}
85

  
86
	public String getExtraFieldForTotal() {
87
		return extraFieldForTotal;
88
	}
89

  
90
	public void setExtraFieldForTotal(final String extraFieldForTotal) {
91
		this.extraFieldForTotal = extraFieldForTotal;
92
	}
93

  
94
	public String getExtraFieldForDate() {
95
		return extraFieldForDate;
96
	}
97

  
98
	public void setExtraFieldForDate(final String extraFieldForDate) {
99
		this.extraFieldForDate = extraFieldForDate;
100
	}
101

  
102
	/**
103
	 * @return the objId
104
	 */
105
	public String getObjId() {
106
		return objId;
107
	}
108

  
109
	/**
110
	 * @param objId
111
	 *            the objId to set
112
	 */
113
	public void setObjId(final String objId) {
114
		this.objId = objId;
115
	}
116

  
117
	/**
118
	 * @return the extraFieldForObjId
119
	 */
120
	public String getExtraFieldForObjId() {
121
		return extraFieldForObjId;
122
	}
123

  
124
	/**
125
	 * @param extraFieldForObjId
126
	 *            the extraFieldForObjId to set
127
	 */
128
	public void setExtraFieldForObjId(final String extraFieldForObjId) {
129
		this.extraFieldForObjId = extraFieldForObjId;
130
	}
131

  
132
}
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/resources/eu/dnetlib/msro/workflows/templates/workflow_status.xml.st
1
<STATUS>
2
	<LAST_EXECUTION_ID>$procId$</LAST_EXECUTION_ID>
3
	<LAST_EXECUTION_DATE>$date$</LAST_EXECUTION_DATE>
4
	$if(error)$
5
		<LAST_EXECUTION_STATUS>FAILURE</LAST_EXECUTION_STATUS>
6
		<LAST_EXECUTION_ERROR>$error$</LAST_EXECUTION_ERROR>
7
	$else$
8
		<LAST_EXECUTION_STATUS>SUCCESS</LAST_EXECUTION_STATUS>
9
		<LAST_EXECUTION_ERROR />
10
	$endif$
11
	$params.keys:{k|<LAST_EXECUTION_OUTPUT name='$k$'>$params.(k)$</LAST_EXECUTION_OUTPUT>}$
12
</STATUS>
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/java/eu/dnetlib/msro/workflows/nodes/db/UpdateDbJobNode.java
1
package eu.dnetlib.msro.workflows.nodes.db;
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
import com.googlecode.sarasvati.NodeToken;
8

  
9
import eu.dnetlib.enabling.database.rmi.DatabaseService;
10
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
11
import eu.dnetlib.msro.workflows.nodes.BlackboardJobNode;
12
import eu.dnetlib.msro.workflows.nodes.ProgressJobNode;
13
import eu.dnetlib.msro.workflows.resultset.ProcessCountingResultSetFactory;
14
import eu.dnetlib.msro.workflows.util.ProgressProvider;
15
import eu.dnetlib.msro.workflows.util.ResultsetProgressProvider;
16

  
17
public class UpdateDbJobNode extends BlackboardJobNode implements ProgressJobNode {
18

  
19
	private String db;
20
	private String dbParam;
21
	private String eprParam;
22
	private ProcessCountingResultSetFactory processCountingResultSetFactory;
23
	private ResultsetProgressProvider progressProvider;
24

  
25
	private static final Log log = LogFactory.getLog(UpdateDbJobNode.class);
26

  
27
	@Override
28
	protected String obtainServiceId(final NodeToken token) {
29
		return getServiceLocator().getServiceId(DatabaseService.class);
30
	}
31

  
32
	@Override
33
	protected void prepareJob(final BlackboardJob job, final NodeToken token) throws Exception {
34
		if (db == null || db.isEmpty()) {
35
			db = token.getEnv().getAttribute(getDbParam());
36
		}
37

  
38
		log.info("preparing blackboard job to update DB: " + db);
39

  
40
		final String epr = token.getEnv().getAttribute(getEprParam());
41

  
42
		this.progressProvider = processCountingResultSetFactory.createProgressProvider(token.getProcess(), epr);
43

  
44
		job.setAction("IMPORT");
45
		job.getParameters().put("db", db);
46
		job.getParameters().put("epr", this.progressProvider.getEpr().toString());
47
	}
48

  
49
	@Override
50
	public ProgressProvider getProgressProvider() {
51
		return progressProvider;
52
	}
53

  
54
	public String getDb() {
55
		return db;
56
	}
57

  
58
	public void setDb(final String db) {
59
		this.db = db;
60
	}
61

  
62
	public String getEprParam() {
63
		return eprParam;
64
	}
65

  
66
	public void setEprParam(final String eprParam) {
67
		this.eprParam = eprParam;
68
	}
69

  
70
	public ProcessCountingResultSetFactory getProcessCountingResultSetFactory() {
71
		return processCountingResultSetFactory;
72
	}
73

  
74
	@Required
75
	public void setProcessCountingResultSetFactory(final ProcessCountingResultSetFactory processCountingResultSetFactory) {
76
		this.processCountingResultSetFactory = processCountingResultSetFactory;
77
	}
78

  
79
	public String getDbParam() {
80
		return dbParam;
81
	}
82

  
83
	public void setDbParam(final String dbParam) {
84
		this.dbParam = dbParam;
85
	}
86

  
87
}
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/resources/eu/dnetlib/msro/workflows/xslt/mdBuilder.xslt.st
1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
    xmlns:datetime="http://exslt.org/dates-and-times" xmlns:exslt="http://exslt.org/common"
4
    xmlns:oai="http://www.openarchives.org/OAI/2.0/"
5
    xmlns:dnet="eu.dnetlib.miscutils.functional.xml.DnetXsltFunctions"
6
    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
7
    exclude-result-prefixes="xsl datetime exslt dnet">
8
    
9
    <xsl:variable name="status" select="/*[local-name() = 'record']/*[local-name() = 'header']/@status" />
10
    
11
    <xsl:template match="/">
12
        <oai:record xmlns:oai="http://www.openarchives.org/OAI/2.0/"
13
            xmlns:dri="http://www.driver-repository.eu/namespace/dri"
14
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
15
            
16
            <xsl:variable name="datestamp" select="datetime:dateTime()" />
17
            <xsl:variable name="evaluatedMetadataId" select="normalize-space($xpath$)" />
18
            
19
			<!-- Patch OAI header or create ex-novo if not oai -->
20
            <oai:header>
21
                <xsl:if test="\$status">
22
                    <xsl:attribute name="status" >
23
                        <xsl:value-of select="\$status"/>
24
                    </xsl:attribute>
25
                </xsl:if>
26
                <xsl:if test="not(.//dri:objIdentifier)">
27
                	<xsl:if test="\$evaluatedMetadataId != ''">
28
	                    <dri:objIdentifier><xsl:value-of select="concat('$namespacePrefix$::', dnet:md5(\$evaluatedMetadataId))"/></dri:objIdentifier>
29
                	</xsl:if>
30
                </xsl:if>
31
                <xsl:if test="not(.//dri:recordIdentifier)">
32
                    <dri:recordIdentifier><xsl:value-of select="\$evaluatedMetadataId"/></dri:recordIdentifier>
33
                </xsl:if>
34
                <xsl:if test="not(.//dri:dateOfCollection)">
35
                    <dri:dateOfCollection><xsl:value-of select="\$datestamp"/></dri:dateOfCollection>
36
                </xsl:if>
37
				<xsl:if test="not(.//dri:repositoryId)">
38
                    <dri:repositoryId>$datasourceId$</dri:repositoryId>
39
                </xsl:if>
40
                <xsl:if test="not(.//dri:datasourceprefix)">
41
                    <dri:datasourceprefix>$namespacePrefix$</dri:datasourceprefix>
42
                </xsl:if>
43
                
44
				<!-- Bulk copy of old header -->
45
                <xsl:for-each select="/*[local-name() = 'record']/*[local-name() = 'header']/*">
46
                    <xsl:copy-of select="."/>
47
                </xsl:for-each>
48
            </oai:header>
49
            
50
			<!-- Handle metadata block -->
51
            <xsl:choose>
52
            	<!-- If OAI then copy copy the metadata block along -->
53
                <xsl:when test="count(/*[local-name() = 'record']/*[local-name() = 'metadata']) &gt; 0">
54
                    <xsl:copy-of select="/*[local-name() = 'record']/*[local-name() = 'metadata']"/>
55
                </xsl:when>
56
                <!-- If OAI copy in bulk the metadata block -->
57
                <xsl:when test="\$status = 'deleted'" />
58
                <!-- If not-OAI copy ALL the record inside metadata block -->
59
                <xsl:otherwise>
60
                    <oai:metadata>
61
                        <xsl:copy-of select="."/>
62
                    </oai:metadata>
63
                </xsl:otherwise>
64
            </xsl:choose>
65
            
66
            <!-- Handle oai:about block -->
67
            <oai:about>
68
                <provenance xmlns="http://www.openarchives.org/OAI/2.0/provenance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/provenance http://www.openarchives.org/OAI/2.0/provenance.xsd">
69
  					<originDescription harvestDate="{\$datestamp}" altered="true">
70
	    				<baseURL>$baseurl$</baseURL>
71
	    				<identifier><xsl:value-of select="//*[local-name()='header']/*[local-name()='identifier']"/></identifier>
72
	    				<datestamp><xsl:value-of select="//*[local-name()='header']/*[local-name()='datestamp']"/></datestamp>
73
	    				<metadataNamespace>$metadatanamespace$</metadataNamespace>
74
	    				<xsl:copy-of select="//*[local-name()='provenance']/*[local-name() = 'originDescription']"/>
75
  					</originDescription>
76
				</provenance>
77
			</oai:about>
78
        </oai:record>
79
    </xsl:template>
80
    
81
</xsl:stylesheet>
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/java/eu/dnetlib/msro/workflows/nodes/SuccessFailureNode.java
1
package eu.dnetlib.msro.workflows.nodes;
2

  
3
import java.util.Map;
4
import javax.annotation.Resource;
5

  
6
import com.google.common.collect.Maps;
7
import com.googlecode.sarasvati.Arc;
8
import com.googlecode.sarasvati.NodeToken;
9
import eu.dnetlib.common.logging.DnetLogger;
10
import eu.dnetlib.common.logging.LogMessage;
11
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
12
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
13
import eu.dnetlib.miscutils.datetime.DateUtils;
14
import eu.dnetlib.msro.workflows.util.WorkflowsConstants;
15
import org.antlr.stringtemplate.StringTemplate;
16
import org.apache.commons.io.IOUtils;
17
import org.apache.commons.lang.StringEscapeUtils;
18
import org.apache.commons.lang.StringUtils;
19
import org.apache.commons.logging.Log;
20
import org.apache.commons.logging.LogFactory;
21
import org.springframework.beans.factory.annotation.Required;
22

  
23
/**
24
 * The success node sets the "isCompletedSuccessfully" env var.
25
 * 
26
 */
27
public class SuccessFailureNode extends SimpleJobNode {
28

  
29
	private static final Log log = LogFactory.getLog(SuccessFailureNode.class);
30
	/**
31
	 * is completed successfully.
32
	 */
33
	private boolean success;
34
	@Resource
35
	private UniqueServiceLocator serviceLocator;
36
	@Resource(name = "msroWorkflowLogger")
37
	private DnetLogger dnetLogger;
38

  
39
	@Override
40
	protected String execute(final NodeToken token) {
41
		final String profileId = token.getFullEnv().getAttribute(WorkflowsConstants.SYSTEM_WF_PROFILE_ID).trim();
42

  
43
		final long now = DateUtils.now();
44
		final String date = DateUtils.calculate_ISO8601(now);
45

  
46
		token.getProcess().getEnv().setAttribute(WorkflowsConstants.SYSTEM_END_DATE, now);
47
		token.getProcess().getEnv().setAttribute(WorkflowsConstants.SYSTEM_END_HUMAN_DATE, date);
48

  
49
		final Map<String, String> params = mergeEnvAttributes(token);
50
		final LogMessage logMessage = dnetLogger.newLogMessage().addDetails(params);
51

  
52
		try {
53
			final String template = IOUtils.toString(getClass().getResourceAsStream("/eu/dnetlib/msro/workflows/templates/workflow_status.xml.st"));
54
			final StringTemplate st = new StringTemplate(template);
55
			st.setAttribute("procId", StringEscapeUtils.escapeXml(params.get(WorkflowsConstants.SYSTEM_WF_PROCESS_ID)));
56
			st.setAttribute("date", StringEscapeUtils.escapeXml(date));
57
			st.setAttribute("params", filterOutputParams(params));
58
			if (!isSuccess()) {
59
				st.setAttribute("error", StringEscapeUtils.escapeXml(params.get(WorkflowsConstants.SYSTEM_ERROR)));
60
			}
61

  
62
			serviceLocator.getService(ISRegistryService.class).updateProfileNode(profileId, "//STATUS", st.toString());
63

  
64
			token.getProcess().getEnv().setAttribute(WorkflowsConstants.SYSTEM_COMPLETED_SUCCESSFULLY, isSuccess());
65

  
66
			logMessage.addDetail(WorkflowsConstants.SYSTEM_COMPLETED_SUCCESSFULLY, Boolean.toString(isSuccess()));
67
		} catch (Exception e) {
68
			log.error("Error updating workflow profile: " + profileId, e);
69
			token.getProcess().getEnv().setAttribute(WorkflowsConstants.SYSTEM_COMPLETED_SUCCESSFULLY, false);
70
			logMessage.addDetail(WorkflowsConstants.SYSTEM_COMPLETED_SUCCESSFULLY, Boolean.toString(false));
71
		}
72

  
73
		logMessage.flush();
74

  
75
		return Arc.DEFAULT_ARC;
76
	}
77

  
78
	private Map<String, String> filterOutputParams(final Map<String, String> map) {
79
		final Map<String, String> res = Maps.newHashMap();
80

  
81
		if (map != null) {
82
			for (String k : map.keySet()) {
83
				if (!StringUtils.isBlank(k) && (k.startsWith(WorkflowsConstants.DATAPROVIDER_PREFIX) || k.startsWith(WorkflowsConstants.MAIN_LOG_PREFIX))) {
84
					final String key = StringEscapeUtils.escapeXml(k);
85
					final String v = map.get(k);
86
					res.put(key, v != null ? escapeAttribute(StringEscapeUtils.escapeXml(v)) : "null");
87
				}
88
			}
89
		}
90

  
91
		return res;
92
	}
93

  
94
	private String escapeAttribute(String s) {
95
		return s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;").replaceAll("\\{", "{{").replaceAll("\\}", "}}");
96
	}
97

  
98
	private Map<String, String> mergeEnvAttributes(final NodeToken token) {
99
		final Map<String, String> map = Maps.newHashMap();
100

  
101
		for (String s : token.getEnv().getAttributeNames()) {
102
			map.put(s, token.getEnv().getAttribute(s));
103
		}
104
		for (String s : token.getFullEnv().getAttributeNames()) {
105
			map.put(s, token.getFullEnv().getAttribute(s));
106
		}
107
		return map;
108
	}
109

  
110
	public boolean isSuccess() {
111
		return success;
112
	}
113

  
114
	@Required
115
	public void setSuccess(final boolean success) {
116
		this.success = success;
117
	}
118

  
119
}
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/resources/eu/dnetlib/msro/workflows/xslt/layoutToRecordStylesheet.xsl
1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0"
3
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:nxsl="http://www.w3.org/1999/XSL/TransformXX"
4
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5

  
6
	<xsl:output omit-xml-declaration="yes" method="xml"
7
		encoding="UTF-8" />
8
	<xsl:namespace-alias stylesheet-prefix="nxsl"
9
		result-prefix="xsl" />
10

  
11
	<xsl:param name="format" />
12

  
13
	<xsl:template match="/">
14
		<xsl:apply-templates select="//LAYOUT" />
15
	</xsl:template>
16

  
17
	<xsl:template match="LAYOUT">
18
		<nxsl:stylesheet version="1.0"
19
			xmlns:dr="http://www.driver-repository.eu/namespace/dr" xmlns:dc="http://purl.org/dc/elements/1.1/"
20
			xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:dnet="eu.dnetlib.miscutils.functional.xml.DnetXsltFunctions"
21
			xmlns:exsl="http://exslt.org/common"
22
      extension-element-prefixes="exsl">
23

  
24
			<nxsl:output version="1.0" omit-xml-declaration="yes"
25
				method="xml" encoding="UTF8" />
26

  
27
			<nxsl:variable name="format">
28
				<xsl:value-of select="$format" />
29
			</nxsl:variable>
30

  
31
			<nxsl:template match="/">
32
				<indexRecord>
33
					<indexRecordIdentifier>
34
						<nxsl:value-of select="//dri:objIdentifier" />
35
					</indexRecordIdentifier>
36
					<targetFields>
37
						<nxsl:if test="count(//*[local-name()='metadata']/*) &gt; 0">
38
							<xsl:apply-templates select="FIELDS/FIELD[@indexable='true']" />
39
						</nxsl:if>		
40
					</targetFields>
41
					<result>
42
						<header>
43
							<dri:objIdentifier>
44
								<nxsl:value-of select="//dri:objIdentifier" />
45
							</dri:objIdentifier>
46
							<dri:repositoryId>
47
								<nxsl:value-of select="//dri:repositoryId" />
48
							</dri:repositoryId>
49
							<dri:dateOfCollection>
50
								<nxsl:value-of select="//dri:dateOfCollection" />
51
							</dri:dateOfCollection>
52
							<xsl:apply-templates select="FIELDS/FIELD"
53
								mode="header" />
54
						</header>
55
						<metadata>
56
							<xsl:apply-templates select="FIELDS/FIELD"
57
								mode="result" />
58
						</metadata>
59
					</result>
60
				</indexRecord>
61
			</nxsl:template>
62
		</nxsl:stylesheet>
63
	</xsl:template>
64

  
65
	<xsl:template match="FIELD[@indexable='true']">
66
		<xsl:choose>
67
			<!-- 
68
			<xsl:when test="@name = 'description'">
69
				<nxsl:for-each select="{@xpath}">
70
					<xsl:element name="{@name}">
71
						<nxsl:value-of select="substring(.,1,210)" />
72
					</xsl:element>
73
				</nxsl:for-each>
74
			</xsl:when>
75
			 -->
76
			<xsl:when test="@constant">
77
				<xsl:element name="{@name}">
78
					<xsl:value-of select="@constant" />
79
				</xsl:element>
80
			</xsl:when>
81
			<xsl:when test="@value and not(@xpath)">
82
				<nxsl:element name="{@name}">
83
					<nxsl:value-of select="{@value}" />
84
				</nxsl:element>
85
			</xsl:when>
86
			<xsl:otherwise>
87
				<xsl:variable name="value">
88
					<xsl:choose>
89
						<xsl:when test="@value">
90
							<xsl:value-of select="@value" />
91
						</xsl:when>
92
						<xsl:otherwise>
93
							.
94
						</xsl:otherwise>
95
					</xsl:choose>
96
				</xsl:variable>
97
				<nxsl:for-each select="{@xpath}">
98
					<xsl:element name="{@name}">
99
						<xsl:if test="@external='true'">
100
							<xsl:attribute name="external">true</xsl:attribute>
101
						</xsl:if>
102
						<xsl:choose>
103
							<xsl:when test="@tokenizable='false'">
104
								<nxsl:value-of select="normalize-space({normalize-space($value)})" />
105
							</xsl:when>
106
							<xsl:otherwise>
107
								<nxsl:value-of select="{normalize-space($value)}" />
108
							</xsl:otherwise>
109
						</xsl:choose>
110
					</xsl:element>
111
				</nxsl:for-each>
112
			</xsl:otherwise>
113
		</xsl:choose>
114
	</xsl:template>
115

  
116

  
117
	<xsl:template match="FIELD" mode="result">
118
		<xsl:if test="@result='true'">
119
			<nxsl:copy-of select="{@xpath}" />
120
		</xsl:if>
121
	</xsl:template>
122

  
123
	<xsl:template match="FIELD" mode="header">
124
		<xsl:if test="@header='true'">
125
			<nxsl:copy-of select="{@xpath}" />
126
		</xsl:if>
127
	</xsl:template>
128

  
129
</xsl:stylesheet>
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/java/eu/dnetlib/msro/workflows/nodes/repohi/CreateObjectStoreJobNode.java
1
package eu.dnetlib.msro.workflows.nodes.repohi;
2

  
3
import java.util.Map;
4

  
5
import org.apache.commons.lang.StringUtils;
6
import org.apache.commons.logging.Log;
7
import org.apache.commons.logging.LogFactory;
8

  
9
import com.googlecode.sarasvati.Engine;
10
import com.googlecode.sarasvati.NodeToken;
11
import com.googlecode.sarasvati.env.Env;
12

  
13
import eu.dnetlib.data.objectstore.rmi.ObjectStoreService;
14
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
15
import eu.dnetlib.msro.workflows.nodes.BlackboardJobNode;
16
import eu.dnetlib.msro.workflows.nodes.blackboard.BlackboardWorkflowJobListener;
17

  
18
public class CreateObjectStoreJobNode extends BlackboardJobNode {
19

  
20
	private static final Log log = LogFactory.getLog(CreateObjectStoreJobNode.class);
21

  
22
	private String interpretation;
23
	private String outputPrefix = "objectStore_";
24

  
25
	@Override
26
	protected String obtainServiceId(final NodeToken token) {
27
		return getServiceLocator().getServiceId(ObjectStoreService.class);
28
	}
29

  
30
	@Override
31
	protected void prepareJob(final BlackboardJob job, final NodeToken token) {
32
		log.info("preparing blackboard job for the creation of the objectStore ");
33
		String basePath  = token.getEnv().getAttribute("objectStoreBasePath");
34
		job.setAction("CREATE");
35
		job.getParameters().put("interpretation", interpretation);
36
		if (!StringUtils.isEmpty(basePath)) {
37
			job.getParameters().put("basePath", basePath);
38
		}
39
	}
40

  
41
	public String getInterpretation() {
42
		return interpretation;
43
	}
44

  
45
	public void setInterpretation(final String interpretation) {
46
		this.interpretation = interpretation;
47
	}
48

  
49
	public String getOutputPrefix() {
50
		return outputPrefix;
51
	}
52

  
53
	public void setOutputPrefix(final String outputPrefix) {
54
		this.outputPrefix = outputPrefix;
55
	}
56

  
57
	@Override
58
	protected BlackboardWorkflowJobListener generateBlackboardListener(final Engine engine, final NodeToken token) {
59
		return new BlackboardWorkflowJobListener(engine, token) {
60

  
61
			@Override
62
			protected void populateEnv(final Env env, final Map<String, String> responseParams) {
63

  
64
				env.setAttribute(getOutputPrefix() + "interpretation", interpretation);
65
				env.setAttribute(getOutputPrefix() + "id", responseParams.get("objectStoreId"));
66
			}
67
		};
68
	}
69

  
70
}
modules/dnet-msro-service/tags/dnet-msro-service-3.1.8/src/main/resources/eu/dnetlib/msro/workflows/xslt/wf_profile2sarasvati.xslt
1
<?xml version="1.0"?>
2

  
3
<xsl:stylesheet version="1.0"
4
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5

  
6
	<xsl:template match="/">
7
		<xsl:variable name="wfname" select="translate(.//WORKFLOW_NAME, ' ', '_')" />
8

  
9
		<process-definition name="{$wfname}" xmlns="http://sarasvati.googlecode.com/ProcessDefinition">
10
			<xsl:apply-templates select=".//NODE"/>            
11
			
12
			<node name="success" type="Success" />
13
			<node name="failure" type="Failure" />
14
		</process-definition>
15
	</xsl:template>
16

  
17
	<xsl:template match="NODE">
18
		<xsl:element name="node" namespace="http://sarasvati.googlecode.com/ProcessDefinition">
19
			<xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute>
20
			<xsl:if test="@isJoin = 'true'">
21
				<xsl:attribute name="joinType">and</xsl:attribute>
22
			</xsl:if>
23
			<xsl:if test="@isStart = 'true'">
24
				<xsl:attribute name="isStart">true</xsl:attribute>
25
			</xsl:if>
26
			<xsl:if test="string-length(@type) &gt; 0">
27
				<xsl:attribute name="type"><xsl:value-of select="@type" /></xsl:attribute>
28
			</xsl:if>
29
			
30
			<xsl:apply-templates select=".//ARC"/>
31
			
32
			<arc xmlns="http://sarasvati.googlecode.com/ProcessDefinition" name="failed" to="failure" />
33
			
34
			<xsl:if test="count(.//PARAM[string-length(normalize-space(text())) &gt; 0]) &gt; 0">
35
				<custom xmlns="http://sarasvati.googlecode.com/ProcessDefinition">
36
					<xsl:apply-templates select=".//PARAM"/>
37
				</custom>
38
			</xsl:if>
39
		</xsl:element>
40
	</xsl:template>
41

  
42
	<xsl:template match="ARC">
43
		<xsl:element name="arc" namespace="http://sarasvati.googlecode.com/ProcessDefinition">
44
			<xsl:attribute name="to"><xsl:value-of select="@to" /></xsl:attribute>
45
			<xsl:if test="string-length(@name) &gt; 0">
46
				<xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute>
47
			</xsl:if>
48
		</xsl:element> 
49
	</xsl:template>
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff