\r
import eu.etaxonomy.cdm.api.service.IEntityValidationService;\r
import eu.etaxonomy.cdm.model.validation.EntityValidation;\r
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;\r
import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
\r
*\r
*/\r
public class ValidationDaemon extends Job {\r
-\r
@SuppressWarnings("unused")\r
private static final Logger logger = Logger.getLogger(ValidationDaemon.class);\r
\r
- private final IEntityValidationService validationResultService;\r
+ private final IEntityValidationService entityValidationService;\r
\r
+ // Might want to make this configurable:\r
+ private int SLEEP_TIME = 5000;\r
+ \r
private boolean cancelRequested = false;\r
\r
\r
\r
- public ValidationDaemon()\r
- {\r
- super("Running validation daemon");\r
- validationResultService = CdmStore.getService(IEntityValidationService.class);\r
+ public ValidationDaemon(){\r
+ super(Messages.ValidationDaemon_RUNNING_DAEMON);\r
+ entityValidationService = CdmStore.getService(IEntityValidationService.class);\r
}\r
\r
\r
@Override\r
- protected void canceling()\r
- {\r
+ protected void canceling(){\r
cancelRequested = true;\r
}\r
\r
* {@link Job#cancel()}, because that method does not have the desired\r
* effect.\r
*/\r
- public void setCancelRequested()\r
- {\r
+ public void setCancelRequested(){\r
cancelRequested = true;\r
}\r
\r
\r
@Override\r
- protected IStatus run(IProgressMonitor monitor)\r
- {\r
+ protected IStatus run(IProgressMonitor monitor){\r
MarkerManager markerManager;\r
List<EntityValidation> results;\r
try {\r
while (!cancelRequested) {\r
- results = validationResultService.getValidationResults();\r
+ results = entityValidationService.getValidationResults();\r
markerManager = new MarkerManager(results);\r
markerManager.deleteObsoleteMarkers();\r
markerManager.createMarkers();\r
- // Might want to make this configurable:\r
- Thread.sleep(5000);\r
+ Thread.sleep(SLEEP_TIME);\r
}\r
- MessagingUtils.info("Validation module stopped");\r
+ MessagingUtils.info(Messages.ValidationDaemon_VALIDATION_STOPPED);\r
return Status.OK_STATUS;\r
}\r
catch (Throwable t) {\r
- MessagingUtils.info("Validation module terminated unexpectedly: " + t.getMessage());\r
+ MessagingUtils.info(Messages.ValidationDaemon_VALIDATION_EXCEPTION + t.getMessage());\r
return Status.CANCEL_STATUS;\r
}\r
}\r