import org.eclipse.core.runtime.Status;\r
import org.eclipse.core.runtime.jobs.Job;\r
\r
-import eu.etaxonomy.cdm.api.service.IEntityConstraintViolationService;\r
-import eu.etaxonomy.cdm.api.service.IEntityValidationResultService;\r
-import eu.etaxonomy.cdm.model.validation.EntityValidationResult;\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
* A job that repeatedly checks the error tables and refreshes the problem\r
* markers created from them.\r
- * \r
+ *\r
* @author ayco_holleman\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 IEntityValidationResultService validationResultService;\r
- \r
- @SuppressWarnings("unused")\r
- /* Not currently needed but present for future use if/when required */\r
- private final IEntityConstraintViolationService constraintViolationService;\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
- super("Initializing validation module");\r
-// StoreUtil.info("Initializing validation module");\r
- MessagingUtils.info("Initializing validation module");\r
- constraintViolationService = CdmStore.getService(IEntityConstraintViolationService.class);\r
- validationResultService = CdmStore.getService(IEntityValidationResultService.class);\r
+ super(Messages.ValidationDaemon_RUNNING_DAEMON);\r
+ entityValidationService = CdmStore.getService(IEntityValidationService.class);\r
}\r
\r
- \r
+\r
@Override\r
protected void canceling(){\r
cancelRequested = true;\r
@Override\r
protected IStatus run(IProgressMonitor monitor){\r
MarkerManager markerManager;\r
- List<EntityValidationResult> results;\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
-// StoreUtil.info("Validation module stopped");\r
- MessagingUtils.info("Validation module stopped");\r
+ MessagingUtils.info(Messages.ValidationDaemon_VALIDATION_STOPPED);\r
return Status.OK_STATUS;\r
}\r
catch (Throwable t) {\r
-// StoreUtil.info("Validation module terminated unexpectedly: " + t.getMessage());\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