Project

General

Profile

« Previous | Next » 

Revision 36275

added back the dep to DFM

View differences:

modules/dnet-openaireplus-workflows/trunk/src/main/java/eu/dnetlib/msro/openaireplus/workflows/nodes/dataFlowMonitoring/TriggerPrepublicMonitoringScenarioJobNode.java
1 1
package eu.dnetlib.msro.openaireplus.workflows.nodes.dataFlowMonitoring;
2 2

  
3 3
import java.io.IOException;
4
import java.util.HashMap;
4 5
import java.util.List;
5 6

  
6 7
import javax.annotation.Resource;
7 8

  
9
import org.apache.commons.io.IOUtils;
8 10
import org.apache.commons.logging.Log;
9 11
import org.apache.commons.logging.LogFactory;
10 12

  
13
import com.google.gson.Gson;
11 14
import com.googlecode.sarasvati.Arc;
12 15
import com.googlecode.sarasvati.NodeToken;
13 16

  
14 17
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
15 18
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
16 19
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
20
import eu.dnetlib.monitoring.core.sensors.SensorFactory;
21
import eu.dnetlib.monitoring.core.sensors.collection.CollectionSensor;
22
import eu.dnetlib.monitoring.core.sensors.collection.SensorWrapper;
23
import eu.dnetlib.monitoring.core.sensors.collection.index.solr.SolrObserverFactory;
24
import eu.dnetlib.monitoring.core.sensors.collection.kv.redis.RedisObserverFactory;
25
import eu.dnetlib.monitoring.model.SensorConfiguration;
17 26
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
18 27

  
19 28
public class TriggerPrepublicMonitoringScenarioJobNode extends SimpleJobNode {
......
30 39
	@Resource
31 40
	private UniqueServiceLocator serviceLocator;
32 41

  
33
	// private CollectionSensor solrSensor;
34
	// private CollectionSensor redisSensor;
35
	// private SensorWrapper wrapper;
42
	private CollectionSensor solrSensor;
43
	private CollectionSensor redisSensor;
44
	private SensorWrapper wrapper;
36 45

  
37 46
	@Override
38 47
	protected String execute(final NodeToken token) throws IOException, InstantiationException, IllegalAccessException, InterruptedException, ISLookUpException {
39 48
		log.info("Execution of TriggerPrepublicMonitoringScenarioJobNode");
40 49

  
41 50
		/* Configuring SOLR sensor */
42
		// String conf =
43
		// IOUtils.toString(getClass().getResourceAsStream("/eu/dnetlib/msro/openaireplus/workflows/data-flow-monitoring/solr-conf.json"));
44
		// SensorConfiguration solrConf = new SensorConfiguration(new Gson().fromJson(conf, HashMap.class));
45
		// String actualCollection = evaluateCurrentSolrCollection();
46
		// log.info("At this round, the Pre-public monitoring scenario will check against " + actualCollection + "SOLR collection");
47
		// solrConf.setParam("collection", actualCollection);
48
		// solrSensor = SensorFactory.createSensorWithConfiguration(CollectionSensor.class, solrConf, new SolrObserverFactory(solrConf),
49
		// "solrQueries");
51
		String conf =
52
				IOUtils.toString(getClass().getResourceAsStream("/eu/dnetlib/msro/openaireplus/workflows/data-flow-monitoring/solr-conf.json"));
53
		SensorConfiguration solrConf = new SensorConfiguration(new Gson().fromJson(conf, HashMap.class));
54
		String actualCollection = evaluateCurrentSolrCollection();
55
		log.info("At this round, the Pre-public monitoring scenario will check against " + actualCollection + "SOLR collection");
56
		solrConf.setParam("collection", actualCollection);
57
		solrSensor = SensorFactory.createSensorWithConfiguration(CollectionSensor.class, solrConf, new SolrObserverFactory(solrConf),
58
				"solrQueries");
50 59

  
51 60
		/* Configuring Redis sensor */
52
		// conf =
53
		// IOUtils.toString(getClass().getResourceAsStream("/eu/dnetlib/msro/openaireplus/workflows/data-flow-monitoring/redis-conf.json"));
54
		// SensorConfiguration redisConf = new SensorConfiguration(new Gson().fromJson(conf, HashMap.class));
55
		// redisSensor = SensorFactory.createSensorWithConfiguration(CollectionSensor.class, redisConf, new RedisObserverFactory(redisConf),
56
		// "redisQueries");
57
		//
58
		// /* Wrapping the two sensors together */
59
		// wrapper = (SensorWrapper) SensorFactory.createSensor(SensorWrapper.class);
60
		// wrapper.registerSensor(solrSensor);
61
		// wrapper.registerSensor(redisSensor);
62
		//
63
		// log.info("Measuring prepublic scenario");
64
		// wrapper.measure();
65
		// log.info("DONE!");
61
		conf =
62
				IOUtils.toString(getClass().getResourceAsStream("/eu/dnetlib/msro/openaireplus/workflows/data-flow-monitoring/redis-conf.json"));
63
		SensorConfiguration redisConf = new SensorConfiguration(new Gson().fromJson(conf, HashMap.class));
64
		redisSensor = SensorFactory.createSensorWithConfiguration(CollectionSensor.class, redisConf, new RedisObserverFactory(redisConf),
65
				"redisQueries");
66

  
67
		/* Wrapping the two sensors together */
68
		wrapper = (SensorWrapper) SensorFactory.createSensor(SensorWrapper.class);
69
		wrapper.registerSensor(solrSensor);
70
		wrapper.registerSensor(redisSensor);
71

  
72
		log.info("Measuring prepublic scenario");
73
		wrapper.measure();
74
		log.info("DONE!");
66 75
		return Arc.DEFAULT_ARC;
67 76
	}
68 77

  
modules/dnet-openaireplus-workflows/trunk/pom.xml
11 11
	<artifactId>dnet-openaireplus-workflows</artifactId>
12 12
	<packaging>jar</packaging>
13 13
	<version>3.0.9-SNAPSHOT</version>
14

  
15 14
	<scm>
16 15
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-openaireplus-workflows/trunk</developerConnection>
17 16
	</scm>
17
	<repositories>
18
	   <repository>
19
	      <id>dfm-snapshots</id>
20
	      <url>http://maven.research-infrastructures.eu/nexus/content/repositories/dfm-snapshots</url>
21
	   </repository>
22
	</repositories>
18 23
	<dependencies>
19
<!-- 		<dependency> -->
20
<!-- 			<groupId>eu.dnetlib</groupId> -->
21
<!-- 			<artifactId>cnr-data-flow-monitoring-core</artifactId> -->
22
<!-- 			<version>0.0.1-SNAPSHOT</version> -->
23
<!-- 			<exclusions> -->
24
<!-- 				<exclusion> -->
25
<!-- 					<artifactId>wstx-asl</artifactId> -->
26
<!-- 					<groupId>org.codehaus.woodstox</groupId> -->
27
<!-- 				</exclusion> -->
28
<!-- 			</exclusions> -->
29
<!-- 		</dependency> -->
30 24
		<dependency>
31 25
			<groupId>eu.dnetlib</groupId>
26
			<artifactId>cnr-data-flow-monitoring-core</artifactId>
27
			<version>0.0.1-SNAPSHOT</version>
28
			<exclusions>
29
				<exclusion>
30
					<artifactId>wstx-asl</artifactId>
31
					<groupId>org.codehaus.woodstox</groupId>
32
				</exclusion>
33
			</exclusions>
34
		</dependency>
35
		<dependency>
36
			<groupId>eu.dnetlib</groupId>
32 37
			<artifactId>cnr-enabling-database-api</artifactId>
33 38
			<version>[1.0.0,2.0.0)</version>
34 39
		</dependency>

Also available in: Unified diff