2831 refactor names of variables and methods used for correlation engine enabling to be more clear

This commit is contained in:
William Schaefer 2017-09-11 13:25:12 -04:00
parent b25fde5b3b
commit bd1390671d
3 changed files with 21 additions and 21 deletions

View File

@ -194,7 +194,7 @@ public class CaseEventListener implements PropertyChangeListener {
*/ */
if ((null == evt.getOldValue()) && (evt.getNewValue() instanceof Case)) { if ((null == evt.getOldValue()) && (evt.getNewValue() instanceof Case)) {
Case curCase = (Case) evt.getNewValue(); Case curCase = (Case) evt.getNewValue();
IngestEventsListener.resetIngestJobCounter(); IngestEventsListener.resetCeModuleInstanceCount();
try { try {
// only add default evidence tag if case is open and it doesn't already exist in the tags list. // only add default evidence tag if case is open and it doesn't already exist in the tags list.
if (Case.isCaseOpen() if (Case.isCaseOpen()

View File

@ -52,7 +52,7 @@ public class IngestEventsListener {
private static final Logger LOGGER = Logger.getLogger(EamArtifact.class.getName()); private static final Logger LOGGER = Logger.getLogger(EamArtifact.class.getName());
final Collection<String> addedCeArtifactTrackerSet = new LinkedHashSet<>(); final Collection<String> addedCeArtifactTrackerSet = new LinkedHashSet<>();
private static long ingestJobCounter = 0; private static long ceModuleInstanceCount = 0;
private final PropertyChangeListener pcl1 = new IngestModuleEventListener(); private final PropertyChangeListener pcl1 = new IngestModuleEventListener();
private final PropertyChangeListener pcl2 = new IngestJobEventListener(); private final PropertyChangeListener pcl2 = new IngestJobEventListener();
@ -73,47 +73,47 @@ public class IngestEventsListener {
} }
/** /**
* Enable this IngestEventsListener to add contents to the Central * Enable this IngestEventsListener to add contents to the Correlation
* Repository. * Engine.
* *
*/ */
public synchronized static void enableCentralRepositoryModule() { public synchronized static void enableCorrelationEngineModule() {
ingestJobCounter++; //Should be called once in the central repository module's startup method. ceModuleInstanceCount++; //Should be called once in the Correlation Engine module's startup method.
} }
/** /**
* Disable this IngestEventsListener from adding contents to the Central * Disable this IngestEventsListener from adding contents to the Correlation
* Repository. * Engine.
*/ */
public synchronized static void disableCentralRepositoryModule() { public synchronized static void disableCorrelationEngineModule() {
if (isCentralRepositoryModuleEnabled()) { //prevent it ingestJobCounter from going negative if (isCorrelationEngineModuleEnabled()) { //prevent it ingestJobCounter from going negative
ingestJobCounter--; //Should be called once in the central repository module's shutdown method. ceModuleInstanceCount--; //Should be called once in the Correlation Engine module's shutdown method.
} }
} }
/** /**
* Reset the counter which keeps track of if the Central Repository Module * Reset the counter which keeps track of if the Correlation Engine Module
* is being run during injest to 0. * is being run during injest to 0.
*/ */
synchronized static void resetIngestJobCounter() { synchronized static void resetCeModuleInstanceCount() {
ingestJobCounter = 0; //called when a case is opened in case for some reason counter was not reset ceModuleInstanceCount = 0; //called when a case is opened in case for some reason counter was not reset
} }
/** /**
* Wether or not the Central Repository Module is enabled for any of the * Wether or not the Correlation Engine Module is enabled for any of the
* currently running ingest jobs. * currently running ingest jobs.
* *
* @return boolean True for Central Repo enabled, False for disabled * @return boolean True for Correlation Engine enabled, False for disabled
*/ */
private synchronized static boolean isCentralRepositoryModuleEnabled() { private synchronized static boolean isCorrelationEngineModuleEnabled() {
return ingestJobCounter > 0; return ceModuleInstanceCount > 0;
} }
private class IngestModuleEventListener implements PropertyChangeListener { private class IngestModuleEventListener implements PropertyChangeListener {
@Override @Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
if (isCentralRepositoryModuleEnabled()) { if (isCorrelationEngineModuleEnabled()) {
EamDb dbManager; EamDb dbManager;
try { try {
dbManager = EamDb.getInstance(); dbManager = EamDb.getInstance();

View File

@ -156,7 +156,7 @@ class IngestModule implements FileIngestModule {
@Override @Override
public void shutDown() { public void shutDown() {
IngestEventsListener.disableCentralRepositoryModule(); IngestEventsListener.disableCorrelationEngineModule();
if (EamDb.isEnabled() == false) { if (EamDb.isEnabled() == false) {
/* /*
* Not signaling an error for now. This is a workaround for the way * Not signaling an error for now. This is a workaround for the way
@ -197,7 +197,7 @@ class IngestModule implements FileIngestModule {
}) })
@Override @Override
public void startUp(IngestJobContext context) throws IngestModuleException { public void startUp(IngestJobContext context) throws IngestModuleException {
IngestEventsListener.enableCentralRepositoryModule(); IngestEventsListener.enableCorrelationEngineModule();
if (EamDb.isEnabled() == false) { if (EamDb.isEnabled() == false) {
/* /*
* Not throwing the customary exception for now. This is a * Not throwing the customary exception for now. This is a