本文整理汇总了Java中hu.sztaki.ilab.longneck.process.constraint.CheckResult类的典型用法代码示例。如果您正苦于以下问题:Java CheckResult类的具体用法?Java CheckResult怎么用?Java CheckResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CheckResult类属于hu.sztaki.ilab.longneck.process.constraint包,在下文中一共展示了CheckResult类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import hu.sztaki.ilab.longneck.process.constraint.CheckResult; //导入依赖的package包/类
@Override
public void apply(Record record, VariableSpace parentScope) throws CheckError {
for (String fieldName : applyTo) {
String value = BlockUtils.getValue(fieldName, record, parentScope);
try {
logParser.doProcess(record, value);
} catch (InputMismatchException e) {
logParser.LOG.error(e);
String executedPattern = logParser.appliedPattern.pattern();
throw new CheckError(
new CheckResult(this, false, this.getClass().getName().toString(), value,
String.format("<Weblog-parser-source> is not able to parse line according to pattern: '%1$s'", executedPattern)));
}
}
}
示例2: apply
import hu.sztaki.ilab.longneck.process.constraint.CheckResult; //导入依赖的package包/类
@Override
public void apply(Record record, VariableSpace parentScope) throws CheckError {
String val = dictionary.translate(BlockUtils.getValue(from, record, parentScope));
// if dictionary not contains, then raise a CheckError exeption.
if (val == null) {
throw new CheckError(
new CheckResult(this, false, from,
BlockUtils.getValue(from, record, parentScope),
"Not found in translation dictionary."));
}
for (String fName : applyTo) {
BlockUtils.setValue(fName, val, record, parentScope);
}
}
示例3: apply
import hu.sztaki.ilab.longneck.process.constraint.CheckResult; //导入依赖的package包/类
@Override
public void apply(final Record record, VariableSpace variables) throws CheckError {
// Get thread-local lookup service
if (lookupService == null) {
lookupService = lookupServiceFactory.getLookupService();
}
try {
String ipAddr = BlockUtils.getValue(IPFIELD, record, variables);
if (ipAddr == null || "".equals(ipAddr)) {
LOG.warn("IP address (to be reverse resolved) is null or empty.");
throw new CheckError(new CheckResult(this, false, ipAddress, ipAddr,
"Cannot resolve empty ip address."));
}
// Query from cache
ReverseData reverseData = dnsCache.getReverse(ipAddr);
// Check result and do a dns lookup if necessary
if (reverseData == null ||
Calendar.getInstance().getTimeInMillis() > reverseData.getExpirationDate()) {
reverseData = lookupService.getReverseDns(ipAddr);
// Check returned value
if (reverseData != null) {
dnsCache.add(reverseData);
}
}
if (reverseData != null && LookupResult.OK.equals(reverseData.getResult())) {
BlockUtils.setValue(HOSTNAMEFIELD, reverseData.getDomain(), record, variables);
BlockUtils.setValue(EXPIRYFIELD,
dateFormat.format(new Date(reverseData.getExpirationDate())),
record, variables);
}
// it is considered to be normal, if reverse lookup fails (no hostname)
} catch (RuntimeException ex) {
LOG.error("DNS lookup failed.", ex);
}
}