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


Java ContextUtils.sendShortInfo方法代码示例

本文整理汇总了Java中eu.unifiedviews.helpers.dpu.context.ContextUtils.sendShortInfo方法的典型用法代码示例。如果您正苦于以下问题:Java ContextUtils.sendShortInfo方法的具体用法?Java ContextUtils.sendShortInfo怎么用?Java ContextUtils.sendShortInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eu.unifiedviews.helpers.dpu.context.ContextUtils的用法示例。


在下文中一共展示了ContextUtils.sendShortInfo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkGraph

import eu.unifiedviews.helpers.dpu.context.ContextUtils; //导入方法依赖的package包/类
protected void checkGraph(RepositoryConnection connection, final List<RDFDataUnit.Entry> entries) throws DPUException {

        SparqlUtils.SparqlAskObject ask = null;
        try {
            ask = SparqlUtils.createAsk(config.getAskQuery(), entries);
            SparqlUtils.execute(connection, ask);
        } catch (RepositoryException | MalformedQueryException | UpdateExecutionException | QueryEvaluationException | SparqlProblemException | DataUnitException e) {
            throw new DPUException(e.getLocalizedMessage(), e);
        }

        if (!ask.result) {
            reportFailure();
        }
        else {
            //everything OK:
            ContextUtils.sendShortInfo(ctx, "rdfvalidation.finished.ok");
        }

    }
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:20,代码来源:SparqlAsk.java

示例2: innerExecute

import eu.unifiedviews.helpers.dpu.context.ContextUtils; //导入方法依赖的package包/类
@Override
protected void innerExecute() throws DPUException {
    if (useDataset()) {
        ContextUtils.sendShortInfo(ctx, "SparqlConstruct.execute.openrdfMode");
    } else {
        ContextUtils.sendShortInfo(ctx, "SparqlConstruct.execute.virtuosoMode");
    }
    // Update query ie. substitute constract with insert.
    String query = config.getQuery();
    if (query == null || query.isEmpty()) {
        throw ContextUtils.dpuException(ctx, "SparqlConstruct.execute.exception.emptyQuery");
    }
    // Modify query - we always do inserts.
    query = query.replaceFirst("(?i)CONSTRUCT", "INSERT");
    // Get graphs.
    final List<RDFDataUnit.Entry> sourceEntries = getInputEntries(rdfInput);
    // Execute.
    executeUpdateQuery(query, sourceEntries);
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:20,代码来源:SparqlConstruct.java

示例3: innerExecute

import eu.unifiedviews.helpers.dpu.context.ContextUtils; //导入方法依赖的package包/类
@Override
protected void innerExecute() throws DPUException {

    ContextUtils.sendShortInfo(ctx, "ExcelToCsv.message");

    try {
        sheetNameSet = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); // case-insensitive sheet names
        String sheetNames = config.getSheetNames();
        if (sheetNames != null && sheetNames.length() > 0) {
            sheetNameSet.addAll(Arrays.asList(sheetNames.split(Pattern.quote(":"))));
        }

        Set<FilesDataUnit.Entry> entries = FilesHelper.getFiles(input);
        for (FilesDataUnit.Entry entry : entries) {
            excelToCsv(entry);
        }
    } catch (DataUnitException | EncryptedDocumentException | InvalidFormatException | IOException ex) {
        throw ContextUtils.dpuException(ctx, ex, "ExcelToCsv.dpuFailed");
    }
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:21,代码来源:ExcelToCsv.java

示例4: requestExtractionModelUpdateService

import eu.unifiedviews.helpers.dpu.context.ContextUtils; //导入方法依赖的package包/类
/**
 * Check and refresh extraction model of the PoolParty project
 * @param wrapper Wrapped HTTP state used for requests
 */
private void requestExtractionModelUpdateService(HttpStateWrapper wrapper) {
    try {
        String modelStatus = null;
        String requestUrl = config.getExtractionModelServiceUrl() + "/" + config.getProjectId();
        HttpGet httpGet = new HttpGet(requestUrl);
        CloseableHttpResponse response = wrapper.client.execute(wrapper.host, httpGet, wrapper.context);
        int status = response.getStatusLine().getStatusCode();
        if (status == HttpStatus.SC_OK) {
            modelStatus = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
        }
        response.close();

        if (modelStatus != null && modelStatus.contains("\"upToDate\" : true")) {
            LOG.info("Extraction model is up-to-date");
            return;
        } else {
            LOG.info("Start to update extraction model because its status is unknown");
            requestUrl = requestUrl + "/refresh";
            httpGet = new HttpGet(requestUrl);
            response = wrapper.client.execute(wrapper.host, httpGet, wrapper.context);
            status = response.getStatusLine().getStatusCode();
            if (status != HttpStatus.SC_OK) {
                ContextUtils.sendShortInfo(ctx, "Extraction model update failed, extraction result may be outdated");
                LOG.warn("Extraction model update failed, extraction result may be outdated");
            }
        }
    } catch (Exception e) {
        LOG.warn("Encountered an exception when requesting extraction model update service", e);
    }
}
 
开发者ID:poolparty-team,项目名称:PP-UnifiedViews-Plugins,代码行数:35,代码来源:ConceptExtractor.java

示例5: innerExecute

import eu.unifiedviews.helpers.dpu.context.ContextUtils; //导入方法依赖的package包/类
@Override
protected void innerExecute() throws DPUException {
    final Date dateStart = new Date();

    try {
        distributionOutput.addNewDataGraph(outputSymbolicName);
        ResourceHelpers.setResource(distributionOutput, outputSymbolicName, DistributionMetadataConfigToResourceConverter.v1ToResource(config));
    } catch (DataUnitException ex) {
        ContextUtils.dpuException(ctx, ex, "DistributionMetadata.execute.exception");
    }

    final Date dateEnd = new Date();
    ContextUtils.sendShortInfo(ctx, "DistributionMetadata.innerExecute.done", (dateEnd.getTime() - dateStart.getTime()));
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:15,代码来源:DistributionMetadata.java

示例6: innerExecute

import eu.unifiedviews.helpers.dpu.context.ContextUtils; //导入方法依赖的package包/类
@Override
protected void innerExecute() throws DPUException {
    final Date dateStart = new Date();

    generateMetadata();

    final Date dateEnd = new Date();
    ContextUtils.sendShortInfo(ctx, "Done in %d ms", (dateEnd.getTime() - dateStart.getTime()));
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:10,代码来源:Metadata.java

示例7: excelToCsv

import eu.unifiedviews.helpers.dpu.context.ContextUtils; //导入方法依赖的package包/类
private void excelToCsv(FilesDataUnit.Entry entry) throws EncryptedDocumentException, InvalidFormatException, IOException,
        DataUnitException {

    ContextUtils.sendShortInfo(ctx, "ExcelToCsv.excelTransformationStared", entry.getSymbolicName());

    File excelFile = FilesHelper.asFile(entry);

    try (Workbook wb = WorkbookFactory.create(OPCPackage.open(excelFile, PackageAccess.READ))) {
        for (int s = 0; s < wb.getNumberOfSheets(); s++) {
            Sheet sheet = wb.getSheetAt(s);
            ContextUtils.sendShortInfo(ctx, "ExcelToCsv.sheetName", sheet.getSheetName());
            if (sheetNameSet.isEmpty() || sheetNameSet.contains(sheet.getSheetName())) {
                DpuFile csvFile = createCsvFile(entry.getSymbolicName(), sheet.getSheetName());
                ContextUtils.sendShortInfo(ctx, "ExcelToCsv.csvGenerationStarted", csvFile.symbolicName);
                sheetToCsv(sheet, csvFile.file);
                ContextUtils.sendShortInfo(ctx, "ExcelToCsv.csvGenerationFinished", csvFile.symbolicName);
            } else {
                ContextUtils.sendShortInfo(ctx, "ExcelToCsv.sheetIgnored", sheet.getSheetName());
            }
        }
    } catch (EncryptedDocumentException | InvalidFormatException | IOException ex) {
        ContextUtils.sendError(ctx, "ExcelToCsv.excelTransformationFailed", ex, "ExcelToCsv.excelTransformationFailed", entry.getSymbolicName());
        throw ex;
    }

    ContextUtils.sendShortInfo(ctx, "ExcelToCsv.excelTransformationFinishedSuccessfully", entry.getSymbolicName());
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:28,代码来源:ExcelToCsv.java

示例8: innerExecute

import eu.unifiedviews.helpers.dpu.context.ContextUtils; //导入方法依赖的package包/类
@Override
protected void innerExecute() throws DPUException {
    // Prepare tabular convertor.
    final TableToRdf tableToRdf = new TableToRdf(
            config.getTableToRdfConfig(),
            rdfTableWrap,
            rdfTableWrap.getValueFactory());
    // Prepare parser based on type.
    final Parser parser;
    switch (config.getTableType()) {
        case CSV:
            parser = new ParserCsv(config.getParserCsvConfig(), tableToRdf, ctx);
            break;
        case DBF:
            parser = new ParserDbf(config.getParserDbfConfig(), tableToRdf, ctx);
            break;
        case XLS:
            parser = new ParserXls(config.getParserXlsConfig(), tableToRdf, ctx);
            break;
        default:
            throw ContextUtils.dpuException(this.ctx, "execution.errors.table.unknown", this.config.getXlsSheetName());
    }
    // Get files to process.
    final List<FilesDataUnit.Entry> files = FaultToleranceUtils.getEntries(faultTolerance, inFilesTable,
            FilesDataUnit.Entry.class);

    for (final FilesDataUnit.Entry entry : files) {
        if (ctx.canceled()) {
            throw ContextUtils.dpuExceptionCancelled(ctx);
        }
        // Set output graph.
        final RDFDataUnit.Entry entryOutput = faultTolerance.execute(new FaultTolerance.ActionReturn<RDFDataUnit.Entry>() {

            @Override
            public RDFDataUnit.Entry action() throws Exception {
                return RdfDataUnitUtils.addGraph(outRdfTables, entry.getSymbolicName());
            }
        });
        rdfTableWrap.setOutput(entryOutput);
        final String symbolicName = faultTolerance.execute(new FaultTolerance.ActionReturn<String>() {

            @Override
            public String action() throws Exception {
                return entry.getSymbolicName();
            }
        });

        ContextUtils.sendShortInfo(this.ctx, "dpu.execution.file.processing", symbolicName);
        // Output data.
        try {
            // If set add subject for the whole table.
            if (config.isUseTableSubject()) {
                // Prepare subject for table.
                // TODO: We can use better subject here!
                final IRI tableURI = faultTolerance.execute(new FaultTolerance.ActionReturn<IRI>() {

                    @Override
                    public IRI action() throws Exception {
                        return rdfTableWrap.getValueFactory().createIRI(entry.getFileURIString());
                    }
                });
                // Set as a table subject.
                tableToRdf.setTableSubject(tableURI);
                // Add metadata (symbolic name) to table subject.
                faultTolerance.execute(new FaultTolerance.Action() {

                    @Override
                    public void action() throws Exception {
                        rdfTableWrap.add(tableURI, TabularOntology.TABLE_SYMBOLIC_NAME,
                                rdfTableWrap.getValueFactory().createLiteral(entry.getSymbolicName()));
                    }
                });
            }
            // Parse file.
            parser.parse(FaultToleranceUtils.asFile(faultTolerance, entry));
        } catch (ParseFailed ex) {
            throw ContextUtils.dpuException(this.ctx, ex, "dpu.execution.errors.conversion.failed", entry);
        }
    }
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:81,代码来源:Tabular.java

示例9: innerExecute

import eu.unifiedviews.helpers.dpu.context.ContextUtils; //导入方法依赖的package包/类
@Override
protected void innerExecute() throws DPUException {
    final List<FilesDataUnit.Entry> files = FaultToleranceUtils.getEntries(faultTolerance, inFilesData, FilesDataUnit.Entry.class);
    final Iterator<FilesDataUnit.Entry> filesIteration = files.iterator();

    try {
        // for each input file
        while (!ctx.canceled() && filesIteration.hasNext()) {
            final File inputFile = FilesDataUnitUtils.asFile(filesIteration.next());
            LOG.debug("Adding file: {}", inputFile.getName());

            RelationalParser parser = null;
            switch (config.getParserType()) {
                case CSV:
                    parser = new CSVParser(ctx, config, outRelationalData);
                    break;
                case XLS:
                    parser = new XLSParser(ctx, config, outRelationalData);
                    break;
                case DBF:
                    parser = new DBFParser(ctx, config, outRelationalData);
                    break;
                default:
                    throw new DataUnitException("Unsupported ParserType!");
            }

            // parse file and add output to result table
            parser.parseFile(inputFile);
        }

        // finally add metadata
        final String tableName = config.getTableName().toUpperCase();
        outRelationalData.addExistingDatabaseTable(tableName, tableName);
        faultTolerance.execute(new FaultTolerance.Action() {
            @Override
            public void action() throws Exception {
                Resource resource = ResourceHelpers.getResource(outRelationalData, tableName);
                Date now = new Date();
                resource.setCreated(now);
                resource.setLast_modified(now);
                ResourceHelpers.setResource(outRelationalData, tableName, resource);
            }
        });
    } catch (DataUnitException e) {
        throw ContextUtils.dpuException(ctx, e, "errors.dpu.parse.failed");
    }
    ContextUtils.sendShortInfo(ctx, "parsing.finished");
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:49,代码来源:TabularToRelational.java

示例10: innerExecute

import eu.unifiedviews.helpers.dpu.context.ContextUtils; //导入方法依赖的package包/类
@Override
protected void innerExecute() throws DPUException {

    ContextUtils.sendShortInfo(ctx, "${dpu_name}.message");
    
}
 
开发者ID:UnifiedViews,项目名称:Plugin-DevEnv,代码行数:7,代码来源:__dpu_name__.java


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