Project

General

Profile

« Previous | Next » 

Revision 44267

simplified IndexDSUpdateJobNode, it now sets only the INDEX_LAST_UPDATE value in the index DS profile

View differences:

modules/dnet-deduplication/trunk/src/main/java/eu/dnetlib/msro/workflows/hadoop/IndexDSUpdateJobNode.java
17 17

  
18 18
	private static final Log log = LogFactory.getLog(IndexDSUpdateJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
19 19

  
20
	public final static String N_RECORDS_PARAM = "blackboard:param:index.status code: 0";
21

  
22 20
	@Resource
23 21
	private UniqueServiceLocator serviceLocator;
24 22

  
......
27 25

  
28 26
		final String dsId = token.getEnv().getAttribute("index_id");
29 27
		final String version = token.getEnv().getAttribute("index.feed.timestamp");
28
		log.info("updating indexDS: " + dsId + " version: " + version);
29
		updateIndexDS(dsId, version);
30 30

  
31
		try {
32
			final int count = Integer.parseInt(token.getEnv().getAttribute(N_RECORDS_PARAM));
33
			log.info("updating indexDS: " + dsId + " version: " + version + " record count: " + count);
34
			updateIndexDS(dsId, version, count);
35
		} catch (NumberFormatException e) {
36
			log.warn("unable to find index feeding details in the workflow env, skippind DS update");
37
		}
38

  
39 31
		return Arc.DEFAULT_ARC;
40 32
	}
41 33

  
......
43 35
	 * method updates the given indexDataStructureId INDEX_SIZE, INDEX_LAST_UPDATE
44 36
	 * 
45 37
	 * @param dsId
46
	 * @param size
38
	 * @param version
47 39
	 * @return true if the update was performed successfully, false otherwise
48 40
	 * @throws ISRegistryException
49 41
	 */
50
	private boolean updateIndexDS(final String dsId, final String version, final long count) throws ISRegistryException {
42
	private boolean updateIndexDS(final String dsId, final String version) throws ISRegistryException {
51 43

  
52 44
		final String xquery = "for $x in collection('')/RESOURCE_PROFILE[.//RESOURCE_IDENTIFIER/@value = '" + dsId + "']"
53
				+ " return update value $x//INDEX_SIZE with " + String.valueOf(count) + ","
54
				+ "for $x in collection('')/RESOURCE_PROFILE[.//RESOURCE_IDENTIFIER/@value = '" + dsId + "']"
55
				+ " return update value $x//INDEX_LAST_UPDATE with '" + version + "' ";
45
				+ " return update value $x//INDEX_LAST_UPDATE with '" + version + "'";
56 46

  
57 47
		log.debug("\n\n updating indexDataStructure: " + xquery + "\n\n");
58 48

  

Also available in: Unified diff