本文整理汇总了Java中org.embulk.config.TaskSource.loadTask方法的典型用法代码示例。如果您正苦于以下问题:Java TaskSource.loadTask方法的具体用法?Java TaskSource.loadTask怎么用?Java TaskSource.loadTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.embulk.config.TaskSource
的用法示例。
在下文中一共展示了TaskSource.loadTask方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
@Override
public TaskReport run(TaskSource taskSource,
Schema schema, int taskIndex,
PageOutput output)
{
PluginTask task = taskSource.loadTask(PluginTask.class);
Integer rows = task.getRows();
final HashMap<Column, Map<String, Integer>> columnOptions = getColumnOptions(task);
try (PageBuilder pagebuilder =
new PageBuilder(Exec.getBufferAllocator(), schema, output)) {
IntStream.rangeClosed(
taskIndex * rows + 1,
taskIndex * rows + rows
).boxed().forEach(rowNumber -> {
RandomjColumnVisitor visitor = new RandomjColumnVisitor(pagebuilder, task, rowNumber, columnOptions);
schema.visitColumns(visitor);
pagebuilder.addRecord();
});
pagebuilder.finish();
}
TaskReport taskReport = Exec.newTaskReport();
taskReport.set("columns", schema.size());
taskReport.set("rows", rows);
return taskReport;
}
示例2: open
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
@Override
public FileInput open(TaskSource taskSource, FileInput fileInput) {
final PluginTask task = taskSource.loadTask(PluginTask.class);
final FileInputInputStream files = new FileInputInputStream(fileInput);
return new InputStreamFileInput(
task.getBufferAllocator(),
new InputStreamFileInput.Provider() {
public InputStream openNext() throws IOException {
if (!files.nextFile()) {
return null;
}
LOGGER.debug("generate LZ4FrameInputStream for {}", files.toString());
return new LZ4FrameInputStream(files);
}
public void close() throws IOException {
files.close();
}
}
);
}
示例3: open
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
@Override
public FileInput open(TaskSource taskSource, FileInput input)
{
PluginTask task = taskSource.loadTask(PluginTask.class);
return new CommonsCompressFileInput(
task.getBufferAllocator(),
new CommonsCompressProvider(task, new FileInputInputStream(input) {
// NOTE: This is workaround code to avoid hanging issue.
// This issue will be fixed after merging #112.
// https://github.com/embulk/embulk/pull/112
@Override
public long skip(long len) {
long skipped = super.skip(len);
return skipped > 0 ? skipped : 0;
}
}));
}
示例4: Icu4jPageOutput
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
public Icu4jPageOutput(TaskSource taskSource, Schema inputSchema, Schema outputSchema, PageOutput output) {
this.task = taskSource.loadTask(PluginTask.class);
this.keyNameColumns = Lists.newArrayList();
this.transliteratorsList = Lists.newArrayList();
this.inputSchema = inputSchema;
this.outputSchema = outputSchema;
for (String keyName : task.getKeyNames()) {
keyNameColumns.add(inputSchema.lookupColumn(keyName));
}
for (Map<String, String> setting : task.getSettings()) {
List<Transliterator> tokenizers = Lists.newArrayList();
for (String convertType : setting.get("transliterators").split(",")) {
Transliterator transliterator = Transliterator.getInstance(convertType);
tokenizers.add(transliterator);
}
transliteratorsList.add(tokenizers);
}
reader = new PageReader(inputSchema);
builder = new PageBuilder(Exec.getBufferAllocator(), outputSchema, output);
}
示例5: WootheePageOutput
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
public WootheePageOutput(TaskSource taskSource, Schema inputSchema, Schema outputSchema, PageOutput output) {
this.task = taskSource.loadTask(PluginTask.class);
this.outputColumns = outputSchema.getColumns();
this.inputColumns = inputSchema.getColumns();
Map<String, Column> inputColumnMap = Maps.newHashMap();
this.wootheeColumnMap = Maps.newHashMap();
for (Column column : outputColumns) {
if (!inputColumns.contains(column)) {
wootheeColumnMap.put(column.getName(), column);
} else {
inputColumnMap.put(column.getName(), column);
}
}
this.reader = new PageReader(inputSchema);
this.builder = new PageBuilder(Exec.getBufferAllocator(), outputSchema, output);
this.keyNameColumn = inputColumnMap.get(task.getKeyName());
}
示例6: run
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
@Override
public void run(TaskSource taskSource, Schema schema,
FileInput input, PageOutput output)
{
PluginTask task = taskSource.loadTask(PluginTask.class);
LineDecoder lineDecoder = new LineDecoder(input,task);
PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), schema, output);
String line = null;
final String columnName = task.getColumnName();
while( input.nextFile() ){
while(true){
line = lineDecoder.poll();
if( line == null ){
break;
}
pageBuilder.setString(0, line);
pageBuilder.addRecord();
}
}
pageBuilder.finish();
}
示例7: open
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
@Override
public PageOutput open(TaskSource taskSource, Schema inputSchema,
Schema outputSchema, PageOutput output)
{
System.out.println("open!");
System.out.print("taskSource: ");
System.out.println(taskSource);
System.out.print("inputSchema: ");
System.out.println(inputSchema);
System.out.print("outputSchema: ");
System.out.println(outputSchema);
System.out.print("output: ");
System.out.println(output);
PluginTask task = taskSource.loadTask(PluginTask.class);
System.out.print("task: ");
System.out.println(task);
return new MyPageOutput(inputSchema, outputSchema, output);
}
示例8: GoogleTranslateApiPageOutput
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
public GoogleTranslateApiPageOutput(TaskSource taskSource, Schema inputSchema, Schema outputSchema, PageOutput output) {
this.task = taskSource.loadTask(PluginTask.class);
this.outputSchema = outputSchema;
this.inputColumns = inputSchema.getColumns();
this.reader = new PageReader(inputSchema);
this.builder = new PageBuilder(Exec.getBufferAllocator(), outputSchema, output);
this.keyNameColumns = Lists.newArrayList();
for (String keyName : task.getKeyNames()) {
this.keyNameColumns.add(outputSchema.lookupColumn(keyName));
}
this.translate = createTranslateService();
this.srcLang = task.getSourceLang().isPresent() ? TranslateOption.sourceLanguage(task.getSourceLang().get()) : null;
this.model = task.getModel().isPresent() ? TranslateOption.model(task.getModel().get()) : null;
}
开发者ID:toyama0919,项目名称:embulk-filter-google_translate_api,代码行数:16,代码来源:GoogleTranslateApiPageOutput.java
示例9: open
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
@Override
public TransactionalPageOutput open(TaskSource taskSource, Schema schema, int taskIndex) {
PluginTask task = taskSource.loadTask(PluginTask.class);
PageReader reader = new PageReader(schema);
PluginPageOutput output = new PluginPageOutput(reader, schema, task);
return output;
}
示例10: open
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
@Override
public TransactionalPageOutput open(TaskSource taskSource, Schema schema, int taskIndex) {
PluginTask task = taskSource.loadTask(PluginTask.class);
SolrClient client = createSolrClient(task);
TransactionalPageOutput pageOutput = new SolrPageOutput(client, schema, task);
return pageOutput;
}
示例11: open
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
@Override
public TransactionalPageOutput open(TaskSource taskSource, Schema schema, int taskIndex)
{
PluginTask task = taskSource.loadTask(PluginTask.class);
S3PerRecordPageOutput output = new S3PerRecordPageOutput(task, schema);
output.open();
return output;
}
示例12: open
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
@Override
public PageOutput open(TaskSource taskSource, final Schema inputSchema,
final Schema outputSchema, final PageOutput output)
{
final PluginTask task = taskSource.loadTask(PluginTask.class);
return new PageOutput()
{
private PageReader pageReader = new PageReader(inputSchema);
private PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), outputSchema, output);
private BuildJsonVisitorImpl visitor = new BuildJsonVisitorImpl(task, inputSchema, outputSchema, pageReader, pageBuilder);
@Override
public void finish()
{
pageBuilder.finish();
}
@Override
public void close()
{
pageBuilder.close();
}
@Override
public void add(Page page)
{
pageReader.setPage(page);
while (pageReader.nextRecord()) {
outputSchema.visitColumns(visitor);
pageBuilder.addRecord();
}
}
};
}
示例13: open
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
@Override
public PageOutput open(final TaskSource taskSource, final Schema inputSchema,
final Schema outputSchema, final PageOutput output)
{
final PluginTask task = taskSource.loadTask(PluginTask.class);
return new PageOutput() {
private PageReader pageReader = new PageReader(inputSchema);
private PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), outputSchema, output);
private ColumnVisitorImpl visitor = new ColumnVisitorImpl(task, inputSchema, outputSchema, pageReader, pageBuilder);
@Override
public void finish()
{
pageBuilder.finish();
}
@Override
public void close()
{
pageBuilder.close();
}
@Override
public void add(Page page)
{
pageReader.setPage(page);
while (pageReader.nextRecord()) {
inputSchema.visitColumns(visitor);
pageBuilder.addRecord();
}
}
};
}
示例14: open
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
@Override
public PageOutput open(final TaskSource taskSource, final Schema inputSchema,
final Schema outputSchema, final PageOutput output) {
final PluginTask task = taskSource.loadTask(PluginTask.class);
final Map<String, List<Base58Column>> base58ColumnMap = convertBase58ColumnListToMap(task.getColumns());
final Map<String, Column> outputColumnMap = convertColumnListToMap(outputSchema.getColumns(), logger);
return new PageOutput() {
private PageReader reader = new PageReader(inputSchema);
private PageBuilder builder = new PageBuilder(Exec.getBufferAllocator(), outputSchema, output);
@Override
public void add(Page page) {
reader.setPage(page);
while (reader.nextRecord()) {
setValue(base58ColumnMap, outputColumnMap, reader, outputSchema, builder);
builder.addRecord();
}
}
@Override
public void finish() {
builder.finish();
}
@Override
public void close() {
builder.close();
}
};
}
示例15: open
import org.embulk.config.TaskSource; //导入方法依赖的package包/类
@Override
public PageOutput open(final TaskSource taskSource, final Schema inputSchema,
final Schema outputSchema, final PageOutput output)
{
final PluginTask task = taskSource.loadTask(PluginTask.class);
return new PageOutput() {
private PageReader pageReader = new PageReader(inputSchema);
private PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), outputSchema, output);
private ColumnVisitorImpl visitor = new ColumnVisitorImpl(task, inputSchema, outputSchema, pageReader, pageBuilder);
@Override
public void finish()
{
pageBuilder.finish();
}
@Override
public void close()
{
pageBuilder.close();
}
@Override
public void add(Page page)
{
pageReader.setPage(page);
while (pageReader.nextRecord()) {
inputSchema.visitColumns(visitor);
pageBuilder.addRecord();
}
}
};
}