|
20 | 20 | import com.google.common.base.Predicates; |
21 | 21 | import com.google.common.base.Strings; |
22 | 22 | import com.google.common.collect.ComparisonChain; |
| 23 | +import com.google.edwmigration.dumper.application.dumper.annotations.RespectsInput; |
| 24 | +import com.google.edwmigration.dumper.application.dumper.connector.Connector; |
| 25 | +import com.google.edwmigration.dumper.application.dumper.connector.ConnectorProperty; |
| 26 | +import com.google.edwmigration.dumper.plugin.ext.jdk.annotation.Description; |
23 | 27 | import java.io.Console; |
24 | 28 | import java.io.File; |
25 | 29 | import java.io.IOException; |
|
54 | 58 | import joptsimple.ValueConverter; |
55 | 59 | import org.apache.commons.lang3.BooleanUtils; |
56 | 60 | import org.apache.commons.lang3.StringUtils; |
57 | | -import com.google.edwmigration.dumper.application.dumper.annotations.RespectsInput; |
58 | | -import com.google.edwmigration.dumper.application.dumper.connector.Connector; |
59 | | -import com.google.edwmigration.dumper.application.dumper.connector.ConnectorProperty; |
60 | | -import com.google.edwmigration.dumper.plugin.ext.jdk.annotation.Description; |
61 | 61 | import org.slf4j.Logger; |
62 | 62 | import org.slf4j.LoggerFactory; |
63 | 63 | import org.springframework.core.annotation.AnnotationUtils; |
@@ -138,7 +138,8 @@ public class ConnectorArguments extends DefaultArguments { |
138 | 138 | private final OptionSpec<String> optionOracleSID = parser.accepts(OPT_ORACLE_SID, "SID name for oracle").withRequiredArg().describedAs("orcl").ofType(String.class); |
139 | 139 | private final OptionSpec<String> optionConfiguration = parser.accepts("config", "Configuration for DB connector").withRequiredArg().ofType(String.class).withValuesSeparatedBy(';').describedAs("key=val;key1=val1"); |
140 | 140 | // private final OptionSpec<String> optionDatabase = parser.accepts("database", "database (can be repeated; all if not specified)").withRequiredArg().describedAs("my_dbname").withValuesSeparatedBy(','); |
141 | | - private final OptionSpec<File> optionOutput = parser.accepts("output", "Output file").withRequiredArg().ofType(File.class).describedAs("cw-dump.zip"); |
| 141 | + private final OptionSpec<File> optionOutput = parser.accepts("output", "Output file (cannot be used together with --output-dir)").withRequiredArg().ofType(File.class).describedAs("cw-dump.zip"); |
| 142 | + private final OptionSpec<String> optionOutputDir = parser.accepts("output-dir", "Output directory where the zip file with the default filename should be created (cannot be used together with --output option). If you want to specify the filename, use --output option instead.").withRequiredArg().ofType(String.class).defaultsTo("").describedAs("/home/user/my-dump-dir"); |
142 | 143 | private final OptionSpec<Void> optionOutputContinue = parser.accepts("continue", "Continues writing a previous output file."); |
143 | 144 | // TODO: Make this be an ISO instant. |
144 | 145 | @Deprecated |
@@ -466,6 +467,11 @@ public File getOutputFile() { |
466 | 467 | return getOptions().valueOf(optionOutput); |
467 | 468 | } |
468 | 469 |
|
| 470 | + @CheckForNull |
| 471 | + public String getOutputDirectory() { |
| 472 | + return getOptions().valueOf(optionOutputDir); |
| 473 | + } |
| 474 | + |
469 | 475 | public boolean isOutputContinue() { |
470 | 476 | return getOptions().has(optionOutputContinue); |
471 | 477 | } |
@@ -627,6 +633,7 @@ public String toString() { |
627 | 633 | .add("user", getUser()) |
628 | 634 | .add("configuration", getConfiguration()) |
629 | 635 | .add("output", getOutputFile()) |
| 636 | + .add("output-dir", getOutputDirectory()) |
630 | 637 | .add("query-log-earliest-timestamp", getQueryLogEarliestTimestamp()) |
631 | 638 | .add("query-log-days", getQueryLogDays()) |
632 | 639 | .add("query-log-start", getQueryLogStart()) |
|
0 commit comments