Revision b119539f
Added by Andreas Müller about 9 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/validation/ValidationDaemon.java | ||
---|---|---|
21 | 21 |
* |
22 | 22 |
*/ |
23 | 23 |
public class ValidationDaemon extends Job { |
24 |
|
|
25 | 24 |
@SuppressWarnings("unused") |
26 | 25 |
private static final Logger logger = Logger.getLogger(ValidationDaemon.class); |
27 | 26 |
|
28 |
private final IEntityValidationService validationResultService;
|
|
27 |
private final IEntityValidationService entityValidationService;
|
|
29 | 28 |
|
29 |
// Might want to make this configurable: |
|
30 |
private int SLEEP_TIME = 5000; |
|
31 |
|
|
30 | 32 |
private boolean cancelRequested = false; |
31 | 33 |
|
32 | 34 |
|
33 | 35 |
|
34 |
public ValidationDaemon() |
|
35 |
{ |
|
36 |
public ValidationDaemon(){ |
|
36 | 37 |
super("Running validation daemon"); |
37 |
validationResultService = CdmStore.getService(IEntityValidationService.class);
|
|
38 |
entityValidationService = CdmStore.getService(IEntityValidationService.class);
|
|
38 | 39 |
} |
39 | 40 |
|
40 | 41 |
|
41 | 42 |
@Override |
42 |
protected void canceling() |
|
43 |
{ |
|
43 |
protected void canceling(){ |
|
44 | 44 |
cancelRequested = true; |
45 | 45 |
} |
46 | 46 |
|
... | ... | |
50 | 50 |
* {@link Job#cancel()}, because that method does not have the desired |
51 | 51 |
* effect. |
52 | 52 |
*/ |
53 |
public void setCancelRequested() |
|
54 |
{ |
|
53 |
public void setCancelRequested(){ |
|
55 | 54 |
cancelRequested = true; |
56 | 55 |
} |
57 | 56 |
|
58 | 57 |
|
59 | 58 |
@Override |
60 |
protected IStatus run(IProgressMonitor monitor) |
|
61 |
{ |
|
59 |
protected IStatus run(IProgressMonitor monitor){ |
|
62 | 60 |
MarkerManager markerManager; |
63 | 61 |
List<EntityValidation> results; |
64 | 62 |
try { |
65 | 63 |
while (!cancelRequested) { |
66 |
results = validationResultService.getValidationResults();
|
|
64 |
results = entityValidationService.getValidationResults();
|
|
67 | 65 |
markerManager = new MarkerManager(results); |
68 | 66 |
markerManager.deleteObsoleteMarkers(); |
69 | 67 |
markerManager.createMarkers(); |
70 |
// Might want to make this configurable: |
|
71 |
Thread.sleep(5000); |
|
68 |
Thread.sleep(SLEEP_TIME); |
|
72 | 69 |
} |
73 | 70 |
MessagingUtils.info("Validation module stopped"); |
74 | 71 |
return Status.OK_STATUS; |
Also available in: Unified diff
minor renaming