Project

General

Profile

Revision 7829

stub for storing IndexEvent objects in Metacat (from metacat-index processing). https://projects.ecoinformatics.org/ecoinfo/issues/5944

View differences:

src/edu/ucsb/nceas/metacat/dataone/hazelcast/HazelcastService.java
62 62

  
63 63
import edu.ucsb.nceas.metacat.IdentifierManager;
64 64
import edu.ucsb.nceas.metacat.McdbDocNotFoundException;
65
import edu.ucsb.nceas.metacat.common.index.event.IndexEvent;
66
import edu.ucsb.nceas.metacat.index.IndexEventEntryListener;
65 67
import edu.ucsb.nceas.metacat.properties.PropertyService;
66 68
import edu.ucsb.nceas.metacat.shared.BaseService;
67 69
import edu.ucsb.nceas.metacat.shared.ServiceException;
......
105 107
  /* The Hazelcast distributed index queue */
106 108
  private String hzIndexQueue;
107 109
  private ISet<SystemMetadata> indexQueue;
110
  
111
  /* The Hazelcast distributed index event map */
112
  private String hzIndexEventMap;
113
  private IMap<Identifier, IndexEvent> indexEventMap;
108 114

  
109 115
  private HazelcastInstance hzInstance;
110 116
      
......
194 200
      missingIdentifiers = this.hzInstance.getSet("hzMissingIdentifiersSet");
195 201
      
196 202
      missingIdentifiers.addItemListener(this, true);
197
      
203

  
204
      // for index tasks
198 205
      hzIndexQueue = PropertyService.getProperty("index.hazelcast.indexqueue");
199 206
      indexQueue = this.hzInstance.getSet(hzIndexQueue);
200 207

  
208
      // for index events (failures)
209
      hzIndexEventMap = PropertyService.getProperty("index.hazelcast.indexeventmap");
210
      indexEventMap = this.hzInstance.getMap(hzIndexEventMap);
211
      // TODO: move this where it can be switched off
212
      indexEventMap.addEntryListener(new IndexEventEntryListener(), true);
213
      
201 214
      // Listen for changes to the system metadata map
202 215
      systemMetadata.addEntryListener(this, true);
203 216
      
......
251 264
   */
252 265
  public ISet<SystemMetadata> getIndexQueue() {
253 266
      return indexQueue;
254
      
255 267
  }
256 268
  
257 269
  /**
270
   * Get the index event map
271
   * @return indexEventMap - the hazelcast map of index events
272
   */
273
  public IMap<Identifier, IndexEvent> getIndexEventMap() {
274
	  return indexEventMap;
275
  }
276
  
277
  /**
258 278
   * When Metacat changes the underlying store, we need to refresh the
259 279
   * in-memory representation of it.
260 280
   * @param guid
src/edu/ucsb/nceas/metacat/index/IndexEventEntryListener.java
1
package edu.ucsb.nceas.metacat.index;
2

  
3
import java.util.Collection;
4
import java.util.Map;
5
import java.util.Set;
6

  
7
import org.dataone.service.types.v1.Identifier;
8

  
9
import com.hazelcast.core.EntryEvent;
10
import com.hazelcast.core.EntryListener;
11
import com.hazelcast.core.MapLoader;
12
import com.hazelcast.core.MapStore;
13

  
14
import edu.ucsb.nceas.metacat.common.index.event.IndexEvent;
15

  
16
public class IndexEventEntryListener implements MapStore<Identifier, IndexEvent>, MapLoader<Identifier, IndexEvent>, EntryListener<Identifier, IndexEvent> {
17

  
18
	
19
	/**
20
	 * The map store/loader methods
21
	 */
22
	
23
	@Override
24
	public IndexEvent load(Identifier arg0) {
25
		// TODO Auto-generated method stub
26
		return null;
27
	}
28

  
29
	@Override
30
	public Map<Identifier, IndexEvent> loadAll(Collection<Identifier> arg0) {
31
		// TODO Auto-generated method stub
32
		return null;
33
	}
34

  
35
	@Override
36
	public Set<Identifier> loadAllKeys() {
37
		// TODO Auto-generated method stub
38
		return null;
39
	}
40

  
41
	@Override
42
	public void delete(Identifier arg0) {
43
		// TODO Auto-generated method stub
44
		
45
	}
46

  
47
	@Override
48
	public void deleteAll(Collection<Identifier> arg0) {
49
		// TODO Auto-generated method stub
50
		
51
	}
52

  
53
	@Override
54
	public void store(Identifier arg0, IndexEvent arg1) {
55
		// TODO Auto-generated method stub
56
		
57
	}
58

  
59
	@Override
60
	public void storeAll(Map<Identifier, IndexEvent> arg0) {
61
		// TODO Auto-generated method stub
62
		
63
	}
64
	
65
	/**
66
	 * The EntryListener methods below
67
	 */
68

  
69
	@Override
70
	public void entryAdded(EntryEvent<Identifier, IndexEvent> arg0) {
71
		// TODO Auto-generated method stub
72
		
73
	}
74

  
75
	@Override
76
	public void entryEvicted(EntryEvent<Identifier, IndexEvent> arg0) {
77
		// TODO Auto-generated method stub
78
		
79
	}
80

  
81
	@Override
82
	public void entryRemoved(EntryEvent<Identifier, IndexEvent> arg0) {
83
		// TODO Auto-generated method stub
84
		
85
	}
86

  
87
	@Override
88
	public void entryUpdated(EntryEvent<Identifier, IndexEvent> arg0) {
89
		// TODO Auto-generated method stub
90
		
91
	}
92

  
93
}
0 94

  

Also available in: Unified diff