5757import software .amazon .documentdb .jdbc .metadata .DocumentDbSchemaColumn ;
5858import software .amazon .documentdb .jdbc .metadata .DocumentDbSchemaTable ;
5959import software .amazon .documentdb .jdbc .persist .DocumentDbSchemaSecurityException ;
60- import software .amazon .documentdb .jdbc .sshtunnel .DocumentDbSshTunnelService ;
6160
6261import java .io .Console ;
6362import java .io .File ;
@@ -118,7 +117,6 @@ public class DocumentDbMain {
118117 private static final Options HELP_VERSION_OPTIONS ;
119118 private static final Option HELP_OPTION ;
120119 private static final Option VERSION_OPTION ;
121- private static final Options SSH_TUNNEL_SERVICE_OPTIONS ;
122120 private static final OptionGroup COMMAND_OPTIONS ;
123121 private static final List <Option > REQUIRED_OPTIONS ;
124122 private static final List <Option > OPTIONAL_OPTIONS ;
@@ -161,7 +159,6 @@ public class DocumentDbMain {
161159 private static final String USER_OPTION_FLAG = "u" ;
162160 private static final String USER_OPTION_NAME = "user" ;
163161 private static final String VERSION_OPTION_NAME = "version" ;
164- public static final String SSH_TUNNEL_SERVICE_OPTION_NAME = "ssh-tunnel-service" ;
165162 // Option argument string constants
166163 private static final String DATABASE_NAME_ARG_NAME = "database-name" ;
167164 private static final String FILE_NAME_ARG_NAME = "file-name" ;
@@ -170,7 +167,6 @@ public class DocumentDbMain {
170167 private static final String METHOD_ARG_NAME = "method" ;
171168 private static final String USER_NAME_ARG_NAME = "user-name" ;
172169 private static final String TABLE_NAMES_ARG_NAME = "[table-name[,...]]" ;
173- private static final String SSH_TUNNEL_SERVICE_ARG_NAME = "ssh-properties" ;
174170 // Option description string constants
175171 private static final String GENERATE_NEW_OPTION_DESCRIPTION =
176172 "Generates a new schema for the database. "
@@ -230,8 +226,6 @@ public class DocumentDbMain {
230226 private static final String OUTPUT_OPTION_DESCRIPTION =
231227 "Write the exported schema to <file-name> in your home directory (instead of stdout)."
232228 + " This will overwrite any existing file with the same name" ;
233- private static final String SSH_TUNNEL_SERVICE_OPTION_DESCRIPTION =
234- "Starts an SSH Tunnel service." ;
235229 // Messages string constants
236230 public static final String DUPLICATE_COLUMN_KEY_DETECTED_FOR_TABLE_SCHEMA =
237231 "Duplicate column key '%s' detected for table schema '%s'. Original column '%s'."
@@ -247,7 +241,6 @@ public class DocumentDbMain {
247241 LIBRARY_NAME = getLibraryName ();
248242 HELP_OPTION = buildHelpOption ();
249243 VERSION_OPTION = buildVersionOption ();
250- SSH_TUNNEL_SERVICE_OPTIONS = buildSshTunnelServiceOption ();
251244 COMMAND_OPTIONS = buildCommandOptions ();
252245 REQUIRED_OPTIONS = buildRequiredOptions ();
253246 OPTIONAL_OPTIONS = buildOptionalOptions ();
@@ -348,13 +341,6 @@ static void handleCommandLine(final String[] args, final StringBuilder output)
348341 }
349342 try {
350343 final CommandLineParser parser = new DefaultParser ();
351- // First check for the SSH tunnel service option separately from the other options.
352- final CommandLine commandLineSshTunnelService = parser .parse (SSH_TUNNEL_SERVICE_OPTIONS , args , true );
353- if (commandLineSshTunnelService .hasOption (SSH_TUNNEL_SERVICE_OPTION_NAME )) {
354- performSshTunnelService (commandLineSshTunnelService , output );
355- return ;
356- }
357- // Otherwise, consider the "complete" options for metadata options.
358344 final CommandLine commandLine = parser .parse (COMPLETE_OPTIONS , args );
359345 final DocumentDbConnectionProperties properties = new DocumentDbConnectionProperties ();
360346 if (!tryGetConnectionProperties (commandLine , properties , output )) {
@@ -420,30 +406,6 @@ private static void closeClient() {
420406 }
421407 }
422408
423- private static void performSshTunnelService (
424- final CommandLine commandLine ,
425- final StringBuilder output ) throws DuplicateKeyException {
426- try (DocumentDbSshTunnelService service = new DocumentDbSshTunnelService (
427- commandLine .getOptionValue (SSH_TUNNEL_SERVICE_OPTION_NAME ))) {
428- final Thread serviceThread = new Thread (service );
429- serviceThread .setDaemon (true );
430- serviceThread .start ();
431- do {
432- serviceThread .join (1000 );
433- } while (serviceThread .isAlive ());
434- service .getExceptions ().forEach (
435- e -> output
436- .append (e .getMessage ())
437- .append (System .lineSeparator ())
438- .append (Arrays .stream (e .getStackTrace ())
439- .map (StackTraceElement ::toString )
440- .collect (Collectors .joining (System .lineSeparator ())))
441- .append (System .lineSeparator ()));
442- } catch (Exception e ) {
443- output .append (e .getMessage ());
444- }
445- }
446-
447409 private static void performImport (
448410 final CommandLine commandLine ,
449411 final DocumentDbConnectionProperties properties ,
@@ -1034,16 +996,6 @@ private static Option buildVersionOption() {
1034996 .build ();
1035997 }
1036998
1037- private static Options buildSshTunnelServiceOption () {
1038- return new Options ().addOption (
1039- Option .builder ()
1040- .longOpt (SSH_TUNNEL_SERVICE_OPTION_NAME )
1041- .desc (SSH_TUNNEL_SERVICE_OPTION_DESCRIPTION )
1042- .numberOfArgs (1 )
1043- .argName (SSH_TUNNEL_SERVICE_ARG_NAME )
1044- .build ());
1045- }
1046-
1047999 private static Option buildHelpOption () {
10481000 return Option .builder (HELP_OPTION_FLAG )
10491001 .longOpt (HELP_OPTION_NAME )
0 commit comments