use of nl.basjes.parse.useragent.parse.UserAgentTreeFlattener in project yauaa by nielsbasjes.
the class AbstractUserAgentAnalyzerDirect method finalizeLoadingRules.
protected void finalizeLoadingRules() {
logVersion();
flattener = new UserAgentTreeFlattener(this);
if (wantedFieldNames != null) {
int wantedSize = wantedFieldNames.size();
if (wantedFieldNames.contains(SET_ALL_FIELDS)) {
wantedSize--;
}
LOG.info("Building all needed matchers for the requested {} fields.", wantedSize);
} else {
LOG.info("Building all matchers for all possible fields.");
}
Map<String, MatcherConfig> matcherConfigs = config.getMatcherConfigs();
if (matcherConfigs.isEmpty()) {
throw new InvalidParserConfigurationException("No matchers were loaded at all.");
}
allMatchers.clear();
for (Map.Entry<String, MatcherConfig> matcherConfigEntry : matcherConfigs.entrySet()) {
MatcherConfig matcherConfig = matcherConfigEntry.getValue();
try {
allMatchers.add(new Matcher(this, wantedFieldNames, matcherConfig));
} catch (UselessMatcherException ume) {
// skippedMatchers++;
}
}
verifyWeAreNotAskingForImpossibleFields();
if (!delayInitialization) {
initializeMatchers();
}
}
Aggregations