当前位置: 首页>>代码示例>>Java>>正文


Java CheckResult类代码示例

本文整理汇总了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)));
        }
    }
}
 
开发者ID:MTA-SZTAKI,项目名称:longneck-weblog,代码行数:19,代码来源:WeblogLine.java

示例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);
    }
}
 
开发者ID:MTA-SZTAKI,项目名称:longneck-lookup,代码行数:15,代码来源:Translate.java

示例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);
    }
}
 
开发者ID:MTA-SZTAKI,项目名称:longneck-dns,代码行数:44,代码来源:ReverseDns.java


注:本文中的hu.sztaki.ilab.longneck.process.constraint.CheckResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。