embulk 0.8.27-java → 0.8.28-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +11 -1
- data/appveyor.yml +4 -4
- data/bin/embulk +33 -9
- data/build.gradle +17 -4
- data/embulk-cli/build.gradle +1 -0
- data/embulk-cli/src/main/bat/{selfrun.bat → selfrun.bat.template} +1 -2
- data/embulk-cli/src/main/java/org/embulk/cli/EmbulkArguments.java +54 -0
- data/embulk-cli/src/main/java/org/embulk/cli/EmbulkBundle.java +44 -0
- data/embulk-cli/src/main/java/org/embulk/cli/EmbulkCommandLine.java +256 -0
- data/embulk-cli/src/main/java/org/embulk/cli/EmbulkCommandLineException.java +25 -0
- data/embulk-cli/src/main/java/org/embulk/cli/EmbulkGlobalJRubyScriptingContainer.java +195 -0
- data/embulk-cli/src/main/java/org/embulk/cli/EmbulkMigrate.java +9 -5
- data/embulk-cli/src/main/java/org/embulk/cli/EmbulkRun.java +769 -0
- data/embulk-cli/src/main/java/org/embulk/cli/EmbulkSelfUpdate.java +1 -14
- data/embulk-cli/src/main/java/org/embulk/cli/EmbulkSubcommand.java +47 -0
- data/embulk-cli/src/main/java/org/embulk/cli/Main.java +12 -21
- data/embulk-cli/src/main/java/org/embulk/cli/parse/AbstractHelpLineDefinition.java +15 -0
- data/embulk-cli/src/main/java/org/embulk/cli/parse/CliHelpFormatterWithHelpMessages.java +141 -0
- data/embulk-cli/src/main/java/org/embulk/cli/parse/CliOptionsWithHelpMessages.java +45 -0
- data/embulk-cli/src/main/java/org/embulk/cli/parse/EmbulkCommandLineHelpRequired.java +10 -0
- data/embulk-cli/src/main/java/org/embulk/cli/parse/EmbulkCommandLineParseException.java +25 -0
- data/embulk-cli/src/main/java/org/embulk/cli/parse/EmbulkCommandLineParser.java +183 -0
- data/embulk-cli/src/main/java/org/embulk/cli/parse/HelpMessageAsCliOption.java +36 -0
- data/embulk-cli/src/main/java/org/embulk/cli/parse/HelpMessageLineDefinition.java +20 -0
- data/embulk-cli/src/main/java/org/embulk/cli/parse/OptionBehavior.java +39 -0
- data/embulk-cli/src/main/java/org/embulk/cli/parse/OptionDefinition.java +120 -0
- data/embulk-cli/src/main/sh/{selfrun.sh → selfrun.sh.template} +1 -1
- data/embulk-cli/src/test/java/org/embulk/cli/SelfrunTest.java +7 -3
- data/embulk-core/src/main/java/org/embulk/EmbulkRunner.java +526 -0
- data/embulk-core/src/main/java/org/embulk/EmbulkSetup.java +70 -0
- data/embulk-core/src/main/java/org/embulk/plugin/PluginClassLoader.java +3 -3
- data/embulk-docs/src/release.rst +1 -0
- data/embulk-docs/src/release/release-0.8.28.rst +14 -0
- data/lib/embulk.rb +21 -17
- data/lib/embulk/runner.rb +35 -166
- data/lib/embulk/version.rb +1 -1
- metadata +29 -11
- data/lib/embulk/command/embulk_bundle.rb +0 -47
- data/lib/embulk/command/embulk_main.rb +0 -2
- data/lib/embulk/command/embulk_run.rb +0 -418
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb3a3ad55003d5d87e050680472c891f8fef9de9
|
4
|
+
data.tar.gz: d9a164a0112947615e837dcf42a260eaaff716f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e6dfbcea73023ac911cc6260176a681d632e6a3023daa2cd9236504c91a30a9b00a121f633974b8ad7637a872da9be9c467b9bdc46182af06c7c09a4b715a0d
|
7
|
+
data.tar.gz: c4b28535cb4c54d2427f2b86a13f62e83c73dc89436b913ae8b6d2ac917dbc7e075f746c8eb6494a092bf615949b3989d39e6ec5a65342c3700d2cfc3e812b45
|
data/.travis.yml
CHANGED
@@ -8,7 +8,7 @@ sudo: false
|
|
8
8
|
install:
|
9
9
|
- pip install --user sphinx
|
10
10
|
script:
|
11
|
-
- ./gradlew --info
|
11
|
+
- ./gradlew --info $GRADLE_TASK # each Travis process configures GRADLE_TASK by env.matrix
|
12
12
|
after_success:
|
13
13
|
- PATH="$HOME/.local/bin:$PATH" ./embulk-docs/push-gh-pages.sh
|
14
14
|
env:
|
@@ -16,3 +16,13 @@ env:
|
|
16
16
|
- GIT_USER_NAME=travis
|
17
17
|
- GIT_USER_EMAIL=travis@embulk.org
|
18
18
|
- secure: K5qT2PcCP/40dNW+1H4NZ6y1+GAZbyP/lMQ1tSMsAICGkMQ/A+Mp5wtnIGIsAf6JGcJ1PvpCoLE1V6wKFL5fEwxi4SRcTnZTh9PkeAk8dgezOMoX4EqeZiQAYv4MM2zKL+Gr6QivjmRA7I5jrZCo8JyaA5XfQ7ygjICKNJy8NaE=
|
19
|
+
# To speed up the Travis build, the build can be broken up into several parts by env.matrix.
|
20
|
+
# They'll run in parallel. Each Travis process set environment variables declared in each
|
21
|
+
# env.matrix like GRADLE_TASK. See: https://docs.travis-ci.com/user/speeding-up-the-build/
|
22
|
+
matrix:
|
23
|
+
- GRADLE_TASK=':embulk-core:check'
|
24
|
+
- GRADLE_TASK=':embulk-standards:check'
|
25
|
+
- GRADLE_TASK=':embulk-jruby-strptime:check'
|
26
|
+
- GRADLE_TASK=':embulk-test:check'
|
27
|
+
- GRADLE_TASK=':embulk-cli:check'
|
28
|
+
- GRADLE_TASK='rubyTest'
|
data/appveyor.yml
CHANGED
@@ -4,18 +4,18 @@ build:
|
|
4
4
|
verbosity: detailed
|
5
5
|
|
6
6
|
install:
|
7
|
-
-
|
8
|
-
-
|
9
|
-
- ps: 7z x $zipPath -y -o"$env:APPVEYOR_BUILD_FOLDER" | Out-Null
|
7
|
+
- if not exist C:\Users\appveyor\handle mkdir C:\Users\appveyor\handle
|
8
|
+
- if not exist C:\Users\appveyor\handle\handle.exe appveyor DownloadFile "https://live.sysinternals.com/handle.exe" -FileName "C:\Users\appveyor\handle\handle.exe"
|
10
9
|
|
11
10
|
# To avoid call-selfrun.bat FileNotFound exception, it installs and uses handle.exe as workaround provided by AppVeyor support.
|
12
11
|
# see http://help.appveyor.com/discussions/problems/5975-the-process-cannot-access-the-file-because-it-is-being-used-by-another-process
|
13
12
|
build_script:
|
14
|
-
- handle.exe -a -u C:\projects\embulk\embulk-cli\build\classes\test\org\embulk\cli\call-selfrun.bat -nobanner
|
13
|
+
- C:\Users\appveyor\handle\handle.exe -a -u C:\projects\embulk\embulk-cli\build\classes\test\org\embulk\cli\call-selfrun.bat -nobanner
|
15
14
|
- gradlew.bat --info --no-daemon check rubyTest
|
16
15
|
|
17
16
|
cache:
|
18
17
|
- C:\Users\appveyor\.gradle
|
18
|
+
- C:\Users\appveyor\handle
|
19
19
|
|
20
20
|
environment:
|
21
21
|
matrix:
|
data/bin/embulk
CHANGED
@@ -1,22 +1,33 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
if RUBY_PLATFORM =~ /java/i
|
4
|
+
STDERR.puts "################################################################################"
|
5
|
+
STDERR.puts "[WARN] embulk.gem is deprecated, and will be removed from v0.9."
|
6
|
+
STDERR.puts "[WARN] embulk.gem's bin/embulk will be also removed from v0.9."
|
7
|
+
STDERR.puts "[WARN] Use the jar version installed from http://dl.embulk.org/ instead."
|
8
|
+
STDERR.puts "[WARN] See the issue and comment at: https://github.com/embulk/embulk/issues/628"
|
9
|
+
STDERR.puts "################################################################################"
|
10
|
+
STDERR.puts ""
|
11
|
+
|
12
|
+
require 'java'
|
13
|
+
|
4
14
|
if ENV['EMBULK_BIN_ENABLE_BUNDLE'] == File.expand_path(__FILE__)
|
5
|
-
# bin/embulk is
|
15
|
+
# bin/embulk is started by CRuby (embulk gem for CRuby is installed), and re-run by JRuby at the end of the script.
|
16
|
+
# Bundler may be enabled in this path.
|
6
17
|
ENV.delete('EMBULK_BIN_ENABLE_BUNDLE')
|
7
|
-
# include -cp CLASSPATH to LOAD_PATH so that embulk_bundle.rb can load bundler included in embulk-core.jar
|
8
|
-
$LOAD_PATH << "uri:classloader:/"
|
9
18
|
|
10
|
-
# Handle environment variables before entering
|
19
|
+
# Handle environment variables before entering org.embulk.cli.EmbulkBundle.
|
11
20
|
# See: https://github.com/embulk/embulk/pull/604
|
12
21
|
|
13
22
|
bundle_path = ENV['EMBULK_BUNDLE_PATH'].to_s
|
14
23
|
bundle_path = nil if bundle_path.empty?
|
15
24
|
|
16
25
|
# Search for -b or --bundle, and remove it.
|
17
|
-
|
18
|
-
|
26
|
+
bundle_option_index = ARGV.find_index {|arg| arg == '-b' || arg == '--bundle' }
|
27
|
+
if bundle_option_index
|
28
|
+
ARGV.slice!(bundle_option_index, 2)[1]
|
19
29
|
end
|
30
|
+
|
20
31
|
if bundle_path
|
21
32
|
ENV['EMBULK_BUNDLE_PATH'] = bundle_path
|
22
33
|
ENV['BUNDLE_GEMFILE'] = File.expand_path File.join(bundle_path, "Gemfile")
|
@@ -33,11 +44,24 @@ if RUBY_PLATFORM =~ /java/i
|
|
33
44
|
ENV.delete('BUNDLE_GEMFILE')
|
34
45
|
end
|
35
46
|
|
36
|
-
|
47
|
+
require 'embulk/version'
|
48
|
+
Java::org.embulk.cli.EmbulkBundle::checkBundleWithEmbulkVersion(ARGV,
|
49
|
+
Java::JavaUtil::ArrayList.new,
|
50
|
+
Embulk::VERSION_INTERNAL)
|
37
51
|
else
|
38
|
-
# bin/embulk is
|
52
|
+
# bin/embulk is started by JRuby (embulk gem for JRuby is installed).
|
53
|
+
# Bundler must be disabled in this path not to bother the JRuby's bundler.
|
39
54
|
$LOAD_PATH << File.expand_path('../lib', File.dirname(__FILE__))
|
40
|
-
|
55
|
+
Dir.glob("#{File.expand_path('../classpath', File.dirname(__FILE__))}/*").each do |f_jar|
|
56
|
+
$CLASSPATH << f_jar
|
57
|
+
end
|
58
|
+
require 'embulk/version'
|
59
|
+
# The ScriptingContainer instance below is the same JRuby instance with the one running this bin/embulk itself
|
60
|
+
# as it's LocalContextScope.SINGLETON. The instance then inherits $LOAD_PATH and $CLASSPATH configured above.
|
61
|
+
global_jruby_container = Java::org.jruby.embed.ScriptingContainer.new(
|
62
|
+
Java::org.jruby.embed.LocalContextScope::SINGLETON, Java::org.jruby.embed.LocalVariableBehavior::PERSISTENT)
|
63
|
+
embulk_run = Java::org.embulk.cli.EmbulkRun.new(Embulk::VERSION_INTERNAL, global_jruby_container)
|
64
|
+
embulk_run.run(Java::JavaUtil::ArrayList.new(ARGV), Java::JavaUtil::ArrayList.new)
|
41
65
|
end
|
42
66
|
exit 0
|
43
67
|
end
|
data/build.gradle
CHANGED
@@ -16,7 +16,7 @@ def release_projects = [project(":embulk-core"), project(":embulk-standards"), p
|
|
16
16
|
|
17
17
|
allprojects {
|
18
18
|
group = 'org.embulk'
|
19
|
-
version = '0.8.
|
19
|
+
version = '0.8.28'
|
20
20
|
|
21
21
|
ext {
|
22
22
|
jrubyVersion = '9.1.5.0'
|
@@ -209,18 +209,27 @@ task classpath(dependsOn: ['build', ':embulk-cli:classpath']) { doLast {} }
|
|
209
209
|
|
210
210
|
clean { delete 'classpath' }
|
211
211
|
|
212
|
+
//
|
213
|
+
// Gets RbConfig::CONFIG['ruby_version'] from the same version of JRuby with Embulk's embedded.
|
214
|
+
//
|
215
|
+
task retrieveRubyVersion(type: JRubyExec) {
|
216
|
+
standardOutput = new ByteArrayOutputStream()
|
217
|
+
jrubyArgs '-e', "print RbConfig::CONFIG['ruby_version']"
|
218
|
+
}
|
219
|
+
|
212
220
|
//
|
213
221
|
// cli task
|
214
222
|
//
|
215
|
-
task cli(dependsOn: ':embulk-cli:shadowJar') {
|
223
|
+
task cli(dependsOn: ['retrieveRubyVersion', ':embulk-cli:shadowJar']) {
|
216
224
|
doLast {
|
225
|
+
def rubyVersion = retrieveRubyVersion.standardOutput.toString().trim()
|
217
226
|
file('pkg').mkdirs()
|
218
227
|
File f = file("pkg/embulk-${project.version}.jar")
|
219
228
|
f.write("")
|
220
229
|
f.append("\n: <<END_OF_EMBULK_SELFRUN_BATCH_PART\r\n")
|
221
|
-
f.append(file("embulk-cli/src/main/bat/selfrun.bat").
|
230
|
+
f.append(file("embulk-cli/src/main/bat/selfrun.bat.template").getText().replace("<%= ruby_version %>", rubyVersion))
|
222
231
|
f.append("\r\nEND_OF_EMBULK_SELFRUN_BATCH_PART\r\n\n")
|
223
|
-
f.append(file("embulk-cli/src/main/sh/selfrun.sh").
|
232
|
+
f.append(file("embulk-cli/src/main/sh/selfrun.sh.template").getText().replace("<%= ruby_version %>", rubyVersion))
|
224
233
|
f.append(file("embulk-cli/build/libs/embulk-cli-${project.version}-all.jar").readBytes())
|
225
234
|
f.setExecutable(true)
|
226
235
|
}
|
@@ -243,6 +252,10 @@ project(':embulk-cli') {
|
|
243
252
|
// - embulk-core: MavenPluginSource and the related (from v0.8.26)
|
244
253
|
relocate 'org.eclipse.aether', 'org.embulk.third_party.org.eclipse.aether'
|
245
254
|
|
255
|
+
// 'org.apache.commons.cli' is used in:
|
256
|
+
// - embulk-cli: EmbulkCommandLineParser (from v0.8.28)
|
257
|
+
relocate 'org.apache.commons.cli', 'org.embulk.third_party.org.apache.commons.cli'
|
258
|
+
|
246
259
|
// NOTE: This 'Implementation-Version' in the manifest is referred to provide the Embulk version at runtime.
|
247
260
|
// See also: embulk-core/src/main/java/org/embulk/EmbulkVersion.java
|
248
261
|
manifest {
|
data/embulk-cli/build.gradle
CHANGED
@@ -79,8 +79,7 @@ endlocal && set BUNDLE_GEMFILE=%bundle_gemfile%
|
|
79
79
|
setlocal enabledelayedexpansion
|
80
80
|
|
81
81
|
if not defined EMBULK_BUNDLE_PATH (
|
82
|
-
|
83
|
-
set gem_home=%USERPROFILE%\.embulk\jruby\!ruby_version!
|
82
|
+
set gem_home=%USERPROFILE%\.embulk\jruby\<%= ruby_version %>
|
84
83
|
) else (
|
85
84
|
set gem_home=
|
86
85
|
)
|
@@ -0,0 +1,54 @@
|
|
1
|
+
package org.embulk.cli;
|
2
|
+
|
3
|
+
import java.util.ArrayList;
|
4
|
+
import java.util.Collections;
|
5
|
+
import java.util.List;
|
6
|
+
|
7
|
+
public class EmbulkArguments
|
8
|
+
{
|
9
|
+
private EmbulkArguments(final EmbulkSubcommand subcommand, final List<String> subcommandArguments)
|
10
|
+
{
|
11
|
+
this.subcommand = subcommand;
|
12
|
+
this.subcommandArguments = Collections.unmodifiableList(subcommandArguments);
|
13
|
+
}
|
14
|
+
|
15
|
+
public static EmbulkArguments extract(final List<String> arguments)
|
16
|
+
throws EmbulkCommandLineException
|
17
|
+
{
|
18
|
+
final ArrayList<String> subcommandArguments = new ArrayList<String>();
|
19
|
+
|
20
|
+
EmbulkSubcommand subcommand = null;
|
21
|
+
for (final String argument : arguments) {
|
22
|
+
if (subcommand == null && (!argument.startsWith("-"))) {
|
23
|
+
subcommand = EmbulkSubcommand.of(argument);
|
24
|
+
}
|
25
|
+
else if (subcommand == null && (argument.equals("-b") || argument.equals("--bundle"))) {
|
26
|
+
throw new EmbulkCommandLineException("\"-b\" or \"--bundle\" before a subcommand is not supported.");
|
27
|
+
}
|
28
|
+
else if (argument.equals("-version")) {
|
29
|
+
return new EmbulkArguments(EmbulkSubcommand.VERSION_ERR, new ArrayList<String>());
|
30
|
+
}
|
31
|
+
else if (argument.equals("--version")) {
|
32
|
+
return new EmbulkArguments(EmbulkSubcommand.VERSION_OUT, new ArrayList<String>());
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
subcommandArguments.add(argument);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
return new EmbulkArguments(subcommand, subcommandArguments);
|
40
|
+
}
|
41
|
+
|
42
|
+
public final EmbulkSubcommand getSubcommand()
|
43
|
+
{
|
44
|
+
return this.subcommand;
|
45
|
+
}
|
46
|
+
|
47
|
+
public final List<String> getSubcommandArguments()
|
48
|
+
{
|
49
|
+
return this.subcommandArguments;
|
50
|
+
}
|
51
|
+
|
52
|
+
private final EmbulkSubcommand subcommand;
|
53
|
+
private final List<String> subcommandArguments;
|
54
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
package org.embulk.cli;
|
2
|
+
|
3
|
+
import java.util.Arrays;
|
4
|
+
import java.util.Collections;
|
5
|
+
import java.util.List;
|
6
|
+
import org.embulk.EmbulkVersion;
|
7
|
+
import org.jruby.embed.ScriptingContainer;
|
8
|
+
|
9
|
+
public class EmbulkBundle
|
10
|
+
{
|
11
|
+
public static void checkBundle(
|
12
|
+
final String[] embulkArgs,
|
13
|
+
final List<String> jrubyOptions)
|
14
|
+
{
|
15
|
+
checkBundleWithEmbulkVersion(embulkArgs, jrubyOptions, EmbulkVersion.VERSION);
|
16
|
+
}
|
17
|
+
|
18
|
+
// It accepts |embulkVersion| so that it can receive Embulk's version from Ruby (bin/embulk).
|
19
|
+
public static void checkBundleWithEmbulkVersion(
|
20
|
+
final String[] embulkArgs,
|
21
|
+
final List<String> jrubyOptions,
|
22
|
+
final String embulkVersion)
|
23
|
+
{
|
24
|
+
final String bundlePath = System.getenv("EMBULK_BUNDLE_PATH");
|
25
|
+
|
26
|
+
final ScriptingContainer globalJRubyContainer =
|
27
|
+
EmbulkGlobalJRubyScriptingContainer.setup(embulkArgs, jrubyOptions, bundlePath, System.err);
|
28
|
+
|
29
|
+
// NOTE: It was written in Ruby as follows in case |bundlePath| != null:
|
30
|
+
// begin
|
31
|
+
// require 'embulk/command/embulk_main'
|
32
|
+
// rescue LoadError
|
33
|
+
// $LOAD_PATH << File.expand_path('../../', File.dirname(__FILE__))
|
34
|
+
// require 'embulk/command/embulk_main'
|
35
|
+
// end
|
36
|
+
//
|
37
|
+
// NOTE: It was written in Ruby as follows in case |bundlePath| == null::
|
38
|
+
// require 'embulk/command/embulk_main'
|
39
|
+
//
|
40
|
+
// TODO: Consider handling LoadError or similar errors.
|
41
|
+
final EmbulkRun runner = new EmbulkRun(embulkVersion, globalJRubyContainer);
|
42
|
+
runner.run(Collections.unmodifiableList(Arrays.asList(embulkArgs)), jrubyOptions);
|
43
|
+
}
|
44
|
+
}
|
@@ -0,0 +1,256 @@
|
|
1
|
+
package org.embulk.cli;
|
2
|
+
|
3
|
+
import java.util.ArrayList;
|
4
|
+
import java.util.Arrays;
|
5
|
+
import java.util.Collections;
|
6
|
+
import java.util.HashMap;
|
7
|
+
import java.util.List;
|
8
|
+
import java.util.Map;
|
9
|
+
|
10
|
+
public class EmbulkCommandLine
|
11
|
+
{
|
12
|
+
private EmbulkCommandLine(
|
13
|
+
final List<String> arguments,
|
14
|
+
final Map<String, Object> systemConfig,
|
15
|
+
final String bundle,
|
16
|
+
final String bundlePath,
|
17
|
+
final List<String> classpath,
|
18
|
+
final String configDiff,
|
19
|
+
final boolean force,
|
20
|
+
final String format,
|
21
|
+
final List<String> load,
|
22
|
+
final List<String> loadPath,
|
23
|
+
final String output,
|
24
|
+
final String resumeState)
|
25
|
+
{
|
26
|
+
this.arguments = Collections.unmodifiableList(arguments);
|
27
|
+
this.systemConfig = Collections.unmodifiableMap(systemConfig);
|
28
|
+
this.bundle = bundle;
|
29
|
+
this.bundlePath = bundlePath;
|
30
|
+
this.classpath = Collections.unmodifiableList(classpath);
|
31
|
+
this.configDiff = configDiff;
|
32
|
+
this.force = force;
|
33
|
+
this.format = format;
|
34
|
+
this.load = Collections.unmodifiableList(load);
|
35
|
+
this.loadPath = Collections.unmodifiableList(loadPath);
|
36
|
+
this.output = output;
|
37
|
+
this.resumeState = resumeState;
|
38
|
+
}
|
39
|
+
|
40
|
+
public static final class Builder
|
41
|
+
{
|
42
|
+
public Builder()
|
43
|
+
{
|
44
|
+
this.arguments = new ArrayList<String>();
|
45
|
+
this.systemConfig = new HashMap<String, Object>();
|
46
|
+
this.bundle = null;
|
47
|
+
this.bundlePath = null;
|
48
|
+
this.classpath = new ArrayList<String>();
|
49
|
+
this.configDiff = null;
|
50
|
+
this.force = false;
|
51
|
+
this.format = null;
|
52
|
+
this.load = new ArrayList<String>();
|
53
|
+
this.loadPath = new ArrayList<String>();
|
54
|
+
this.output = null;
|
55
|
+
this.resumeState = null;
|
56
|
+
}
|
57
|
+
|
58
|
+
public EmbulkCommandLine build()
|
59
|
+
{
|
60
|
+
return new EmbulkCommandLine(
|
61
|
+
this.arguments,
|
62
|
+
this.systemConfig,
|
63
|
+
this.bundle,
|
64
|
+
this.bundlePath,
|
65
|
+
this.classpath,
|
66
|
+
this.configDiff,
|
67
|
+
this.force,
|
68
|
+
this.format,
|
69
|
+
this.load,
|
70
|
+
this.loadPath,
|
71
|
+
this.output,
|
72
|
+
this.resumeState);
|
73
|
+
}
|
74
|
+
|
75
|
+
public Builder addArguments(final List<String> arguments)
|
76
|
+
{
|
77
|
+
this.arguments.addAll(arguments);
|
78
|
+
return this;
|
79
|
+
}
|
80
|
+
|
81
|
+
public Builder setSystemConfig(final String key, final String value)
|
82
|
+
{
|
83
|
+
this.systemConfig.put(key, value);
|
84
|
+
return this;
|
85
|
+
}
|
86
|
+
|
87
|
+
public Builder addSystemConfig(final String key, final String value)
|
88
|
+
{
|
89
|
+
final Object existingValue = this.systemConfig.get(key);
|
90
|
+
if (existingValue != null && existingValue instanceof String) {
|
91
|
+
this.systemConfig.put(key, Arrays.asList((String) existingValue, value));
|
92
|
+
}
|
93
|
+
else if (existingValue != null && existingValue instanceof List) {
|
94
|
+
@SuppressWarnings("unchecked")
|
95
|
+
final ArrayList<String> newList = new ArrayList<String>((List<String>) existingValue);
|
96
|
+
newList.add(value);
|
97
|
+
this.systemConfig.put(key, Collections.unmodifiableList(newList));
|
98
|
+
}
|
99
|
+
else {
|
100
|
+
this.systemConfig.put(key, Arrays.asList(value));
|
101
|
+
}
|
102
|
+
return this;
|
103
|
+
}
|
104
|
+
|
105
|
+
public Builder setBundle(final String bundle)
|
106
|
+
{
|
107
|
+
this.bundle = bundle;
|
108
|
+
return this;
|
109
|
+
}
|
110
|
+
|
111
|
+
public Builder setBundlePath(final String bundlePath)
|
112
|
+
{
|
113
|
+
this.bundlePath = bundlePath;
|
114
|
+
return this;
|
115
|
+
}
|
116
|
+
|
117
|
+
public Builder addClasspath(final String classpath)
|
118
|
+
{
|
119
|
+
this.classpath.add(classpath);
|
120
|
+
return this;
|
121
|
+
}
|
122
|
+
|
123
|
+
public Builder setConfigDiff(final String configDiff)
|
124
|
+
{
|
125
|
+
this.configDiff = configDiff;
|
126
|
+
return this;
|
127
|
+
}
|
128
|
+
|
129
|
+
public Builder setForce(final boolean force)
|
130
|
+
{
|
131
|
+
this.force = force;
|
132
|
+
return this;
|
133
|
+
}
|
134
|
+
|
135
|
+
public Builder setFormat(final String format)
|
136
|
+
{
|
137
|
+
this.format = format;
|
138
|
+
return this;
|
139
|
+
}
|
140
|
+
|
141
|
+
public Builder addLoad(final String load)
|
142
|
+
{
|
143
|
+
this.load.add(load);
|
144
|
+
return this;
|
145
|
+
}
|
146
|
+
|
147
|
+
public Builder addLoadPath(final String loadPath)
|
148
|
+
{
|
149
|
+
this.loadPath.add(loadPath);
|
150
|
+
return this;
|
151
|
+
}
|
152
|
+
|
153
|
+
public Builder setOutput(final String output)
|
154
|
+
{
|
155
|
+
this.output = output;
|
156
|
+
return this;
|
157
|
+
}
|
158
|
+
|
159
|
+
public Builder setResumeState(final String resumeState)
|
160
|
+
{
|
161
|
+
this.resumeState = resumeState;
|
162
|
+
return this;
|
163
|
+
}
|
164
|
+
|
165
|
+
private ArrayList<String> arguments;
|
166
|
+
private HashMap<String, Object> systemConfig;
|
167
|
+
private String bundle;
|
168
|
+
private String bundlePath;
|
169
|
+
private ArrayList<String> classpath;
|
170
|
+
private String configDiff;
|
171
|
+
private boolean force;
|
172
|
+
private String format;
|
173
|
+
private ArrayList<String> load;
|
174
|
+
private ArrayList<String> loadPath;
|
175
|
+
private String output;
|
176
|
+
private String resumeState;
|
177
|
+
}
|
178
|
+
|
179
|
+
public static Builder builder()
|
180
|
+
{
|
181
|
+
return new Builder();
|
182
|
+
}
|
183
|
+
|
184
|
+
public final List<String> getArguments()
|
185
|
+
{
|
186
|
+
return this.arguments;
|
187
|
+
}
|
188
|
+
|
189
|
+
public final Map<String, Object> getSystemConfig()
|
190
|
+
{
|
191
|
+
return this.systemConfig;
|
192
|
+
}
|
193
|
+
|
194
|
+
public final String getBundle()
|
195
|
+
{
|
196
|
+
return this.bundle;
|
197
|
+
}
|
198
|
+
|
199
|
+
public final String getBundlePath()
|
200
|
+
{
|
201
|
+
return this.bundlePath;
|
202
|
+
}
|
203
|
+
|
204
|
+
public final List<String> getClasspath()
|
205
|
+
{
|
206
|
+
return this.classpath;
|
207
|
+
}
|
208
|
+
|
209
|
+
public final String getConfigDiff()
|
210
|
+
{
|
211
|
+
return this.configDiff;
|
212
|
+
}
|
213
|
+
|
214
|
+
public final boolean getForce()
|
215
|
+
{
|
216
|
+
return this.force;
|
217
|
+
}
|
218
|
+
|
219
|
+
public final String getFormat()
|
220
|
+
{
|
221
|
+
return this.format;
|
222
|
+
}
|
223
|
+
|
224
|
+
public final List<String> getLoad()
|
225
|
+
{
|
226
|
+
return this.load;
|
227
|
+
}
|
228
|
+
|
229
|
+
public final List<String> getLoadPath()
|
230
|
+
{
|
231
|
+
return this.loadPath;
|
232
|
+
}
|
233
|
+
|
234
|
+
public final String getOutput()
|
235
|
+
{
|
236
|
+
return this.output;
|
237
|
+
}
|
238
|
+
|
239
|
+
public final String getResumeState()
|
240
|
+
{
|
241
|
+
return this.resumeState;
|
242
|
+
}
|
243
|
+
|
244
|
+
private final List<String> arguments;
|
245
|
+
private final Map<String, Object> systemConfig;
|
246
|
+
private final String bundle;
|
247
|
+
private final String bundlePath;
|
248
|
+
private final List<String> classpath;
|
249
|
+
private final String configDiff;
|
250
|
+
private final boolean force;
|
251
|
+
private final String format;
|
252
|
+
private final List<String> load;
|
253
|
+
private final List<String> loadPath;
|
254
|
+
private final String output;
|
255
|
+
private final String resumeState;
|
256
|
+
}
|