• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ConfigException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.embulk.config.ConfigException的典型用法代码示例。如果您正苦于以下问题:Java ConfigException类的具体用法?Java ConfigException怎么用?Java ConfigException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ConfigException类属于org.embulk.config包,在下文中一共展示了ConfigException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: transaction

import org.embulk.config.ConfigException; //导入依赖的package包/类
@Override
public void transaction(ConfigSource config, Schema schema,
        FormatterPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);

    // validate avsc option
    try {
        File avsc = task.getAvsc().getFile();
        new org.apache.avro.Schema.Parser().parse(avsc);
    } catch (IOException e) {
        throw new ConfigException("avsc file is not found");
    }


    // validate column_options
    for (String columnName : task.getColumnOptions().keySet()) {
        schema.lookupColumn(columnName);  // throws SchemaConfigException
    }

    control.run(task.dump());
}
 
开发者ID:joker1007,项目名称:embulk-formatter-avro,代码行数:23,代码来源:AvroFormatterPlugin.java


示例2: transaction

import org.embulk.config.ConfigException; //导入依赖的package包/类
@Override
public void transaction(ConfigSource config, ParserPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);

    File avsc = task.getAvsc().getFile();
    org.apache.avro.Schema avroSchema;
    try {
        avroSchema = new org.apache.avro.Schema.Parser().parse(avsc);
    } catch (IOException e) {
        throw new ConfigException("avsc file is not found");
    }

    Schema schema = buildSchema(task.getColumns(), avroSchema);

    control.run(task.dump(), schema);
}
 
开发者ID:joker1007,项目名称:embulk-parser-avro,代码行数:18,代码来源:AvroParserPlugin.java


示例3: configure

import org.embulk.config.ConfigException; //导入依赖的package包/类
private void configure(PluginTask task, Schema inputSchema)
{
    List<ColumnConfig> columns = task.getColumns();

    if (columns.size() < 2) {
        throw new ConfigException("\"columns\" should be specified 2~ columns.");
    }

    // throw if column type is not supported
    for (ColumnConfig columnConfig : columns) {
        String name = columnConfig.getName();
        Type type = inputSchema.lookupColumn(name).getType();

        if (type instanceof JsonType) {
            throw new ConfigException(String.format("casting to json is not available: \"%s\"", name));
        }
        if (type instanceof TimestampType) {
            throw new ConfigException(String.format("casting to timestamp is not available: \"%s\"", name));
        }
    }
}
 
开发者ID:toru-takahashi,项目名称:embulk-filter-concat,代码行数:22,代码来源:ConcatFilterPlugin.java


示例4: assertJsonPathFormat

import org.embulk.config.ConfigException; //导入依赖的package包/类
public static void assertJsonPathFormat(String path)
{
    Path compiledPath;
    try {
        compiledPath = PathCompiler.compile(path);
    }
    catch (InvalidPathException e) {
        throw new ConfigException(String.format("jsonpath %s, %s", path, e.getMessage()));
    }
    PathToken pathToken = compiledPath.getRoot();
    while (true) {
        assertSupportedPathToken(pathToken, path);
        if (pathToken.isLeaf()) {
            break;
        }
        pathToken = pathToken.next();
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-typecast,代码行数:19,代码来源:JsonPathUtil.java


示例5: assertSupportedPathToken

import org.embulk.config.ConfigException; //导入依赖的package包/类
protected static void assertSupportedPathToken(PathToken pathToken, String path)
{
    if (pathToken instanceof ArrayPathToken) {
        ArrayIndexOperation arrayIndexOperation = ((ArrayPathToken) pathToken).getArrayIndexOperation();
        assertSupportedArrayPathToken(arrayIndexOperation, path);
    }
    else if (pathToken instanceof ScanPathToken) {
        throw new ConfigException(String.format("scan path token is not supported \"%s\"", path));
    }
    else if (pathToken instanceof FunctionPathToken) {
        throw new ConfigException(String.format("function path token is not supported \"%s\"", path));
    }
    else if (pathToken instanceof PredicatePathToken) {
        throw new ConfigException(String.format("predicate path token is not supported \"%s\"", path));
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-typecast,代码行数:17,代码来源:JsonPathUtil.java


示例6: dispatchPerTask

import org.embulk.config.ConfigException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected RestClientInputPluginDelegate dispatchPerTask(PluginTask task)
{
    Target target = task.getTarget();
    switch (target) {
        case LEAD:
        case ACTIVITY:
            if (!task.getWrappedFromDate().isPresent()) {
                throw new ConfigException("From date is required for target LEAD or ACTIVITY");
            }
            Date date = task.getWrappedFromDate().get();
            task.setFromDate(date);
            break;
    }
    return target.getRestClientInputPluginDelegate();
}
 
开发者ID:treasure-data,项目名称:embulk-input-marketo,代码行数:18,代码来源:MarketoInputPluginDelegate.java


示例7: validateInputTask

import org.embulk.config.ConfigException; //导入依赖的package包/类
@Override
public void validateInputTask(T task)
{
    super.validateInputTask(task);
    if (task.getFromDate() == null) {
        throw new ConfigException("From date is required for Bulk Extract");
    }
    if (task.getFromDate().getTime() >= task.getJobStartTime().getMillis()) {
        throw new ConfigException("From date can't not be in future");
    }
    if (task.getIncremental()
            && task.getIncrementalColumn().isPresent()
            && task.getIncrementalColumn().get().equals("updatedAt")) {
        throw new ConfigException("Column 'updatedAt' cannot be incremental imported");
    }
    //Calculate to date
    DateTime toDate = getToDate(task);
    task.setToDate(Optional.of(toDate.toDate()));
}
 
开发者ID:treasure-data,项目名称:embulk-input-marketo,代码行数:20,代码来源:MarketoBaseBulkExtractInputPlugin.java


示例8: CsvTokenizer

import org.embulk.config.ConfigException; //导入依赖的package包/类
public CsvTokenizer(String delimiter, char quote, char escape, String newline, boolean trimIfNotQuoted, long maxQuotedSizeLimit, String commentLineMarker, LineDecoder input, String nullStringOrNull)
{
    if (delimiter.length() == 0) {
        throw new ConfigException("Empty delimiter is not allowed");
    }
    else {
        this.delimiterChar = delimiter.charAt(0);
        if (delimiter.length() > 1) {
            delimiterFollowingString = delimiter.substring(1);
        }
        else {
            delimiterFollowingString = null;
        }
    }
    this.quote = quote;
    this.escape = escape;
    this.newline = newline;
    this.trimIfNotQuoted = trimIfNotQuoted;
    this.maxQuotedSizeLimit = maxQuotedSizeLimit;
    this.commentLineMarker = commentLineMarker;
    this.input = input;
    this.nullStringOrNull = nullStringOrNull;
}
 
开发者ID:treasure-data,项目名称:embulk-input-marketo,代码行数:24,代码来源:CsvTokenizer.java


示例9: validateInputTaskFromDateMoreThanJobStartTime

import org.embulk.config.ConfigException; //导入依赖的package包/类
@Test()
public void validateInputTaskFromDateMoreThanJobStartTime()
{
    Date fromDate = new Date(1507619744000L);
    DateTime jobStartTime = new DateTime(1506842144000L);
    MarketoBaseBulkExtractInputPlugin.PluginTask pluginTask = Mockito.mock(MarketoBaseBulkExtractInputPlugin.PluginTask.class);
    Mockito.when(pluginTask.getFromDate()).thenReturn(fromDate);
    Mockito.when(pluginTask.getJobStartTime()).thenReturn(jobStartTime);

    try {
        baseBulkExtractInputPlugin.validateInputTask(pluginTask);
    }
    catch (ConfigException ex) {
        return;
    }
    fail();
}
 
开发者ID:treasure-data,项目名称:embulk-input-marketo,代码行数:18,代码来源:MarketoBaseBulkExtractInputPluginTest.java


示例10: initializeStandardFileSystemManager

import org.embulk.config.ConfigException; //导入依赖的package包/类
private StandardFileSystemManager initializeStandardFileSystemManager()
{
    if (!logger.isDebugEnabled()) {
        // TODO: change logging format: org.apache.commons.logging.Log
        System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
    }
    StandardFileSystemManager manager = new StandardFileSystemManager();
    manager.setClassLoader(SftpUtils.class.getClassLoader());
    try {
        manager.init();
    }
    catch (FileSystemException e) {
        logger.error(e.getMessage());
        throw new ConfigException(e);
    }

    return manager;
}
 
开发者ID:embulk,项目名称:embulk-output-sftp,代码行数:19,代码来源:SftpUtils.java


示例11: assertSupportedPathToken

import org.embulk.config.ConfigException; //导入依赖的package包/类
public static void assertSupportedPathToken(PathToken pathToken, String path)
{
    if (pathToken instanceof ArrayPathToken) {
        ArrayIndexOperation arrayIndexOperation = ((ArrayPathToken) pathToken).getArrayIndexOperation();
        assertSupportedArrayPathToken(arrayIndexOperation, path);
    }
    else if (pathToken instanceof ScanPathToken) {
        throw new ConfigException(String.format("scan path token is not supported \"%s\"", path));
    }
    else if (pathToken instanceof FunctionPathToken) {
        throw new ConfigException(String.format("function path token is not supported \"%s\"", path));
    }
    else if (pathToken instanceof PredicatePathToken) {
        throw new ConfigException(String.format("predicate path token is not supported \"%s\"", path));
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-column,代码行数:17,代码来源:JsonPathUtil.java


示例12: getTailIndex

import org.embulk.config.ConfigException; //导入依赖的package包/类
public static Long getTailIndex(String path)
{
    Path compiledPath = PathCompiler.compile(path);
    PathToken tail = ((RootPathToken) compiledPath.getRoot()).getTail();
    if (tail instanceof ArrayPathToken) {
        ArrayIndexOperation arrayIndexOperation = ((ArrayPathToken) tail).getArrayIndexOperation();
        if (arrayIndexOperation == null) {
            throw new ConfigException(String.format("Array Slice Operation is not supported \"%s\"", path));
        }
        if (arrayIndexOperation.isSingleIndexOperation()) {
            return arrayIndexOperation.indexes().get(0).longValue();
        }
        else {
            throw new ConfigException(String.format("Multi Array Indexes is not supported \"%s\"", path));
        }
    }
    else {
        return null;
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-column,代码行数:21,代码来源:JsonColumn.java


示例13: getSchemaConfig

import org.embulk.config.ConfigException; //导入依赖的package包/类
private SchemaConfig getSchemaConfig(PluginTask task)
{
    if (task.getOldSchemaConfig().isPresent()) {
        log.warn("Please use 'columns' option instead of 'schema' because the 'schema' option is deprecated. The next version will stop 'schema' option support.");
    }

    if (task.getSchemaConfig().isPresent()) {
        return task.getSchemaConfig().get();
    }
    else if (task.getOldSchemaConfig().isPresent()) {
        return task.getOldSchemaConfig().get();
    }
    else {
        throw new ConfigException("Attribute 'columns' is required but not set");
    }
}
 
开发者ID:shun0102,项目名称:embulk-parser-jsonl,代码行数:17,代码来源:JsonlParserPlugin.java


示例14: getLocalMd5hash

import org.embulk.config.ConfigException; //导入依赖的package包/类
private String getLocalMd5hash(String filePath) throws IOException
{
    try {
        MessageDigest md = MessageDigest.getInstance("MD5");
        try (BufferedInputStream input = new BufferedInputStream(new FileInputStream(new File(filePath)))) {
            byte[] buffer = new byte[256];
            int len;
            while ((len = input.read(buffer, 0, buffer.length)) >= 0) {
                md.update(buffer, 0, len);
            }
            return new String(Base64.encodeBase64(md.digest()));
        }
    }
    catch (NoSuchAlgorithmException ex) {
        throw new ConfigException("MD5 algorism not found");
    }
}
 
开发者ID:embulk,项目名称:embulk-output-gcs,代码行数:18,代码来源:GcsOutputPlugin.java


示例15: checkDefaultValuesP12keyNull

import org.embulk.config.ConfigException; //导入依赖的package包/类
@Test(expected = ConfigException.class)
public void checkDefaultValuesP12keyNull()
{
    ConfigSource config = Exec.newConfigSource()
            .set("in", inputConfig())
            .set("parser", parserConfig(schemaConfig()))
            .set("type", "gcs")
            .set("bucket", GCP_BUCKET)
            .set("path_prefix", "my-prefix")
            .set("file_ext", ".csv")
            .set("auth_method", "private_key")
            .set("service_account_email", GCP_EMAIL)
            .set("p12_keyfile", null)
            .set("formatter", formatterConfig());

    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();

    runner.transaction(config, schema, 0, new Control());
}
 
开发者ID:embulk,项目名称:embulk-output-gcs,代码行数:20,代码来源:TestGcsOutputPlugin.java


示例16: checkDefaultValuesConflictSetting

import org.embulk.config.ConfigException; //导入依赖的package包/类
@Test(expected = ConfigException.class)
public void checkDefaultValuesConflictSetting()
{
    ConfigSource config = Exec.newConfigSource()
            .set("in", inputConfig())
            .set("parser", parserConfig(schemaConfig()))
            .set("type", "gcs")
            .set("bucket", GCP_BUCKET)
            .set("path_prefix", "my-prefix")
            .set("file_ext", ".csv")
            .set("auth_method", "private_key")
            .set("service_account_email", GCP_EMAIL)
            .set("p12_keyfile", GCP_P12_KEYFILE)
            .set("p12_keyfile_path", GCP_P12_KEYFILE)
            .set("formatter", formatterConfig());

    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();

    runner.transaction(config, schema, 0, new Control());
}
 
开发者ID:embulk,项目名称:embulk-output-gcs,代码行数:21,代码来源:TestGcsOutputPlugin.java


示例17: checkDefaultValuesInvalidPrivateKey

import org.embulk.config.ConfigException; //导入依赖的package包/类
@Test(expected = ConfigException.class)
public void checkDefaultValuesInvalidPrivateKey()
{
    ConfigSource config = Exec.newConfigSource()
            .set("in", inputConfig())
            .set("parser", parserConfig(schemaConfig()))
            .set("type", "gcs")
            .set("bucket", GCP_BUCKET)
            .set("path_prefix", "my-prefix")
            .set("file_ext", ".csv")
            .set("auth_method", "private_key")
            .set("service_account_email", GCP_EMAIL)
            .set("p12_keyfile", "invalid-key.p12")
            .set("formatter", formatterConfig());

    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();

    runner.transaction(config, schema, 0, new Control());
}
 
开发者ID:embulk,项目名称:embulk-output-gcs,代码行数:20,代码来源:TestGcsOutputPlugin.java


示例18: checkDefaultValuesJsonKeyfileNull

import org.embulk.config.ConfigException; //导入依赖的package包/类
@Test(expected = ConfigException.class)
public void checkDefaultValuesJsonKeyfileNull()
{
    ConfigSource config = Exec.newConfigSource()
            .set("in", inputConfig())
            .set("parser", parserConfig(schemaConfig()))
            .set("type", "gcs")
            .set("bucket", GCP_BUCKET)
            .set("path_prefix", "my-prefix")
            .set("file_ext", ".csv")
            .set("auth_method", "json_key")
            .set("service_account_email", GCP_EMAIL)
            .set("json_keyfile", null)
            .set("formatter", formatterConfig());

    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();

    runner.transaction(config, schema, 0, new Control());
}
 
开发者ID:embulk,项目名称:embulk-output-gcs,代码行数:20,代码来源:TestGcsOutputPlugin.java


示例19: configure

import org.embulk.config.ConfigException; //导入依赖的package包/类
void configure(PluginTask task, Schema inputSchema) throws ConfigException
{
    if (task.getConditions().isPresent()) {
        logger.warn("embulk-filter-row: \"conditions\" is deprecated, use \"where\" instead.");
        for (ConditionConfig conditionConfig : task.getConditions().get()) {
            String columnName = conditionConfig.getColumn();
            inputSchema.lookupColumn(columnName); // throw SchemaConfigException if not found
        }

        String condition = task.getCondition().toLowerCase();
        if (!condition.equals("or") && !condition.equals("and")) {
            throw new ConfigException("condition must be either of \"or\" or \"and\".");
        }
    }
    else if (task.getWhere().isPresent()) {
        String where = task.getWhere().get();
        Parser parser = new Parser(inputSchema);
        // objects must be created in open since plugin instances in transaction and open are different
        parser.parse(where); // throws ConfigException if something wrong
    }
    else {
        throw new ConfigException("Either of `conditions` or `where` must be set.");
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-row,代码行数:25,代码来源:RowFilterPlugin.java


示例20: TimestampOpExp

import org.embulk.config.ConfigException; //导入依赖的package包/类
public TimestampOpExp(ParserLiteral left, ParserLiteral right, int operator)
{
    this.left = left.isIdentifier() ? left : new TimestampLiteral(left);
    this.right = right.isIdentifier() ? right : new TimestampLiteral(right);
    this.operator = operator;

    if (! this.left.isTimestamp()) {
        throw new ConfigException(String.format("\"%s\" is not a Timestamp column", ((IdentifierLiteral)this.left).name));
    }
    if (! this.right.isTimestamp()) {
        throw new ConfigException(String.format("\"%s\" is not a Timestamp column", ((IdentifierLiteral)this.right).name));
    }
    if (! isOperatorAllowed(operators, operator)) {
        throw new ConfigException(String.format("\"%s\" is not an allowed operator for TimestampOpExp", Parser.yyname[operator]));
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-row,代码行数:17,代码来源:ParserExp.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MemoryConfiguration类代码示例发布时间:2022-05-21
下一篇:
Java Fiber类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap