if (!checkConstraints()) {
return false;
}
// Store the currentState to be able to 'back-track' later.
StateVertex orrigionalState = this.getStateMachine().getCurrentState();
if (orrigionalState.searchForCandidateElements(candidateExtractor, configurationReader
.getTagElements(), configurationReader.getExcludeTagElements(),
configurationReader.getCrawlSpecificationReader().getClickOnce())) {
// Only execute the preStateCrawlingPlugins when it's the first time
LOGGER.info("Starting preStateCrawlingPlugins...");
List<CandidateElement> candidateElements =
orrigionalState.getUnprocessedCandidateElements();
CrawljaxPluginsUtil.runPreStateCrawlingPlugins(controller.getSession(),
candidateElements);
// update crawlActions
orrigionalState.filterCandidateActions(candidateElements);
}
CandidateCrawlAction action =
orrigionalState.pollCandidateCrawlAction(this, crawlQueueManager);
while (action != null) {
if (depthLimitReached(depth)) {
return true;
}
if (!checkConstraints()) {
return false;
}
ClickResult result = this.crawlAction(action);
orrigionalState.finishedWorking(this, action);
switch (result) {
case newState:
return newStateDetected(orrigionalState);
case cloneDetected:
return true;
default:
break;
}
action = orrigionalState.pollCandidateCrawlAction(this, crawlQueueManager);
}
return true;
}