/** command line 명령어를 생성한다. */ private String buildCommand(String working) { List<String> command = new LinkedList<>(); try { Map<String, String> defaultEnvs = getDefaultEnvs(working); Set<String> keys = defaultEnvs.keySet(); for (String key : keys) { if (!isEmpty(defaultEnvs.get(key))) { command.add( MessageFormatter.arrayFormat( "export {}={}\n", new Object[] {key, defaultEnvs.get(key)}) .getMessage()); } } command.add(getHelper().get("sqoop.home") + "/bin/sqoop"); command.add("import"); if (variable.get("jdbcUrl") != null && !StringUtils.isEmpty(variable.get("jdbcUrl").toString())) { command.add("--connect"); command.add(variable.getProperty("jdbcUrl")); } if (variable.get("jdbcDriver") != null && !StringUtils.isEmpty(variable.get("jdbcDriver").toString())) { command.add("--driver"); command.add(variable.getProperty("jdbcDriver")); } if (variable.get("sqoopTable") != null && !StringUtils.isEmpty(variable.get("sqoopTable").toString())) { command.add("--table"); command.add(variable.getProperty("sqoopTable")); } if (variable.get("sqoopUsername") != null && !StringUtils.isEmpty(variable.get("sqoopUsername").toString())) { command.add("--username"); command.add(variable.getProperty("sqoopUsername")); } if (variable.get("sqoopPassword") != null && !StringUtils.isEmpty(variable.get("sqoopPassword").toString())) { command.add("--password"); command.add(variable.getProperty("sqoopPassword")); } if (variable.get("output") != null && !StringUtils.isEmpty(variable.get("output").toString())) { command.add("--target-dir"); command.add(variable.getProperty("output")); } command.add("--num-mappers"); command.add("1"); } catch (Exception e) { throw new ServiceException("You can not create a Sqoop import command.", e); } return org.opencloudengine.flamingo2.util.StringUtils.listToDelimitedString(command, " "); }