Example usage for java.lang Runtime exec

List of usage examples for java.lang Runtime exec

Introduction

In this page you can find the example usage for java.lang Runtime exec.

Prototype

public Process exec(String cmdarray[]) throws IOException 

Source Link

Document

Executes the specified command and arguments in a separate process.

Usage

From source file:com._17od.upm.gui.MainWindow.java

private void LaunchSelectedURL(String url) {

    if (Desktop.isDesktopSupported()) {
        Desktop desktop = Desktop.getDesktop();

        try {//from w w  w  . ja va2s  . com
            desktop.browse(new URI(url));

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (URISyntaxException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();

        }
        // Linux and Mac specific code in order to launch url
    } else {
        Runtime runtime = Runtime.getRuntime();

        try {
            runtime.exec("xdg-open " + url);

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

}

From source file:configuration.Util.java

public static boolean changeDirWindows(String path) {
    try {//from ww  w. j  a v a2s. com
        String[] command = { "cmd.exe", "/C", "CD", "\"" + path + "\"" };
        for (String s : command)
            Config.log(s + "\t");
        Runtime r = Runtime.getRuntime();
        Process p = r.exec(command);
        int result = p.waitFor();
        File f = new File("");
        Config.log(path + " : " + f.getAbsolutePath());
        return result == 0;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}

From source file:logdruid.ui.chart.GraphPanel.java

public void load(JPanel panel_2) {
    startDateJSpinner = (JSpinner) panel_2.getComponent(2);
    endDateJSPinner = (JSpinner) panel_2.getComponent(3);
    // scrollPane.setV
    panel.removeAll();/*  www  . j av a  2 s .  co  m*/
    Dimension panelSize = this.getSize();
    add(scrollPane, BorderLayout.CENTER);
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    // scrollPane.set trying to replace scroll where it was
    JCheckBox relativeCheckBox = (JCheckBox) panel_2.getComponent(5);
    estimatedTime = System.currentTimeMillis() - startTime;
    logger.info("gathering time: " + estimatedTime);
    startTime = System.currentTimeMillis();
    //   Map<Source, Map<String, MineResult>>
    Map<Source, Map<String, MineResult>> treeMap = new TreeMap<Source, Map<String, MineResult>>(
            mineResultSet.mineResults);
    Iterator mineResultSetIterator = treeMap.entrySet().iterator();
    int ite = 0;
    logger.debug("mineResultSet size: " + mineResultSet.mineResults.size());
    while (mineResultSetIterator.hasNext()) {
        final Map.Entry pairs = (Map.Entry) mineResultSetIterator.next();
        logger.debug("mineResultSet key/source: " + ((Source) pairs.getKey()).getSourceName());
        JCheckBox checkBox = (JCheckBox) panel_1.getComponent(ite++);
        logger.debug("checkbox: " + checkBox.getText() + ", " + checkBox.isSelected());
        if (checkBox.isSelected()) {

            Map mrArrayList = (Map<String, MineResult>) pairs.getValue();
            ArrayList<String> mineResultGroup = new ArrayList<String>();
            Set<String> mrss = mrArrayList.keySet();

            mineResultGroup.addAll(mrss);
            Collections.sort(mineResultGroup, new AlphanumComparator());
            Iterator mrArrayListIterator = mineResultGroup.iterator();
            while (mrArrayListIterator.hasNext()) {

                String key = (String) mrArrayListIterator.next();
                logger.debug(key);
                final MineResult mr = (MineResult) mrArrayList.get(key);
                Map<String, ExtendedTimeSeries> statMap = mr.getStatTimeseriesMap();
                Map<String, ExtendedTimeSeries> eventMap = mr.getEventTimeseriesMap();
                // logger.info("mineResultSet hash size: "
                // +mr.getTimeseriesMap().size());
                // logger.info("mineResultSet hash content: " +
                // mr.getStatTimeseriesMap());
                logger.debug("mineResultSet mr.getStartDate(): " + mr.getStartDate()
                        + " mineResultSet mr.getEndDate(): " + mr.getEndDate());
                logger.debug("mineResultSet (Date)jsp.getValue(): " + (Date) startDateJSpinner.getValue());
                logger.debug("mineResultSet (Date)jsp2.getValue(): " + (Date) endDateJSPinner.getValue());
                if (mr.getStartDate() != null && mr.getEndDate() != null) {
                    if ((mr.getStartDate().before((Date) endDateJSPinner.getValue()))
                            && (mr.getEndDate().after((Date) startDateJSpinner.getValue()))) {

                        ArrayList<String> mineResultGroup2 = new ArrayList<String>();
                        Set<String> mrss2 = statMap.keySet();
                        mineResultGroup2.addAll(mrss2);
                        Collections.sort(mineResultGroup2, new AlphanumComparator());
                        Iterator statMapIterator = mineResultGroup2.iterator();

                        //            Iterator statMapIterator = statMap.entrySet().iterator();
                        if (!statMap.entrySet().isEmpty() || !eventMap.entrySet().isEmpty()) {
                            JPanel checkboxPanel = new JPanel(new WrapLayout());

                            checkboxPanel.setBackground(Color.white);

                            int count = 1;
                            chart = ChartFactory.createXYAreaChart(// Title
                                    mr.getSourceID() + " " + mr.getGroup(), // +
                                    null, // X-Axis
                                    // label
                                    null, // Y-Axis label
                                    null, // Dataset
                                    PlotOrientation.VERTICAL, false, // Show
                                    // legend
                                    true, // tooltips
                                    false // url
                            );
                            TextTitle my_Chart_title = new TextTitle(mr.getSourceID() + " " + mr.getGroup(),
                                    new Font("Verdana", Font.BOLD, 17));
                            chart.setTitle(my_Chart_title);
                            XYPlot plot = (XYPlot) chart.getPlot();
                            ValueAxis range = plot.getRangeAxis();
                            range.setVisible(false);

                            final DateAxis domainAxis1 = new DateAxis();
                            domainAxis1.setTickLabelsVisible(true);
                            // domainAxis1.setTickMarksVisible(true);

                            logger.debug("getRange: " + domainAxis1.getRange());
                            if (relativeCheckBox.isSelected()) {
                                domainAxis1.setRange((Date) startDateJSpinner.getValue(),
                                        (Date) endDateJSPinner.getValue());
                            } else {
                                Date startDate = mr.getStartDate();
                                Date endDate = mr.getEndDate();
                                if (mr.getStartDate().before((Date) startDateJSpinner.getValue())) {
                                    startDate = (Date) startDateJSpinner.getValue();
                                    logger.debug("setMinimumDate: " + (Date) startDateJSpinner.getValue());
                                }
                                if (mr.getEndDate().after((Date) endDateJSPinner.getValue())) {
                                    endDate = (Date) endDateJSPinner.getValue();
                                    logger.debug("setMaximumDate: " + (Date) endDateJSPinner.getValue());
                                }
                                if (startDate.before(endDate)) {
                                    domainAxis1.setRange(startDate, endDate);
                                }
                            }
                            XYToolTipGenerator tt1 = new XYToolTipGenerator() {
                                public String generateToolTip(XYDataset dataset, int series, int item) {
                                    StringBuffer sb = new StringBuffer();
                                    String htmlStr = "<html>";
                                    Number x;
                                    FastDateFormat sdf = FastDateFormat.getInstance("dd-MMM-yyyy HH:mm:ss");
                                    x = dataset.getX(series, item);
                                    sb.append(htmlStr);
                                    if (x != null) {
                                        sb.append("<p style='color:#000000;'>" + (sdf.format(x)) + "</p>");
                                        sb.append("<p style='color:#000000;'>"
                                                + dataset.getSeriesKey(series).toString() + ": "
                                                + form.format(dataset.getYValue(0, item)) + "</p>");
                                        if (mr.getFileLineForDate(new Date(x.longValue()),
                                                dataset.getSeriesKey(series).toString()) != null) {
                                            sb.append(
                                                    "<p style='color:#0000FF;'>"
                                                            + cd.sourceFileArrayListMap
                                                                    .get(pairs.getKey()).get(mr
                                                                            .getFileLineForDate(
                                                                                    new Date(x.longValue()),
                                                                                    dataset.getSeriesKey(series)
                                                                                            .toString())
                                                                            .getFileId())
                                                                    .getFile().getName()
                                                            + ":"
                                                            + mr.getFileLineForDate(new Date(x.longValue()),
                                                                    dataset.getSeriesKey(series).toString())
                                                                    .getLineNumber()
                                                            + "</p>");

                                        }
                                    }
                                    return sb.toString();
                                }
                            };

                            while (statMapIterator.hasNext()) {

                                TimeSeriesCollection dataset = new TimeSeriesCollection();
                                String me = (String) statMapIterator.next();

                                ExtendedTimeSeries ts = (ExtendedTimeSeries) statMap.get(me);
                                // logger.info(((TimeSeries)
                                // me.getValue()).getMaxY());
                                if (((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY() > 0)
                                    dataset.addSeries(ts.getTimeSeries());
                                logger.debug("mineResultSet group: " + mr.getGroup() + ", key: " + me
                                        + " nb records: " + ((ExtendedTimeSeries) statMap.get(me))
                                                .getTimeSeries().getItemCount());
                                logger.debug("(((TimeSeries) me.getValue()).getMaxY(): "
                                        + (((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY()));
                                logger.debug("(((TimeSeries) me.getValue()).getMinY(): "
                                        + (((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMinY()));
                                XYPlot plot1 = chart.getXYPlot();
                                //   LogarithmicAxis axis4 = new LogarithmicAxis(me.toString());
                                NumberAxis axis4 = new NumberAxis(me.toString());
                                axis4.setAutoRange(true);
                                axis4.setAxisLineVisible(true);
                                axis4.setAutoRangeIncludesZero(false);
                                plot1.setDomainCrosshairVisible(true);
                                plot1.setRangeCrosshairVisible(true);
                                axis4.setRange(new Range(
                                        ((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMinY(),
                                        ((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY()));
                                axis4.setLabelPaint(colors[count]);
                                axis4.setTickLabelPaint(colors[count]);
                                plot1.setRangeAxis(count, axis4);
                                final ValueAxis domainAxis = domainAxis1;
                                domainAxis.setLowerMargin(0.0);
                                domainAxis.setUpperMargin(0.0);
                                plot1.setDomainAxis(domainAxis);
                                plot1.setForegroundAlpha(0.5f);
                                plot1.setDataset(count, dataset);
                                plot1.mapDatasetToRangeAxis(count, count);
                                final XYAreaRenderer renderer = new XYAreaRenderer(); // XYAreaRenderer2
                                // also
                                // nice
                                if ((((ExtendedTimeSeries) statMap.get(me)).getTimeSeries().getMaxY()
                                        - ((ExtendedTimeSeries) statMap.get(me)).getTimeSeries()
                                                .getMinY()) > 0) {

                                    // renderer.setToolTipGenerator(new
                                    // StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,new
                                    // FastDateFormat("d-MMM-yyyy HH:mm:ss"),
                                    // new DecimalFormat("#,##0.00")));
                                }
                                renderer.setSeriesPaint(0, colors[count]);
                                renderer.setSeriesVisible(0, true);
                                renderer.setSeriesToolTipGenerator(0, tt1);
                                plot1.setRenderer(count, renderer);
                                int hits = 0; // ts.getStat()[1]
                                int matchs = 0;
                                if (((ExtendedTimeSeries) statMap.get(me)).getStat() != null) {
                                    hits = ((ExtendedTimeSeries) statMap.get(me)).getStat()[1];
                                    //   matchs= ((ExtendedTimeSeries) statMap.get(me)).getStat()[0];
                                }
                                JCheckBox jcb = new JCheckBox(new VisibleAction(panel, checkboxPanel, axis4,
                                        me.toString() + "(" + hits + ")", 0));
                                Boolean selected = true;
                                jcb.setSelected(true);
                                jcb.setBackground(Color.white);
                                jcb.setBorderPainted(true);
                                jcb.setBorder(BorderFactory.createLineBorder(colors[count], 1, true));
                                jcb.setFont(new Font("Sans-serif", oldSmallFont.getStyle(),
                                        oldSmallFont.getSize()));
                                checkboxPanel.add(jcb);
                                count++;
                            }
                            Iterator eventMapIterator = eventMap.entrySet().iterator();
                            while (eventMapIterator.hasNext()) {

                                //   HistogramDataset histoDataSet=new HistogramDataset();

                                TimeSeriesCollection dataset = new TimeSeriesCollection();
                                Map.Entry me = (Map.Entry) eventMapIterator.next();
                                // if (dataset.getEndXValue(series, item))
                                if (((ExtendedTimeSeries) me.getValue()).getTimeSeries().getMaxY() > 0)
                                    dataset.addSeries(((ExtendedTimeSeries) me.getValue()).getTimeSeries());

                                logger.debug("mineResultSet group: " + mr.getGroup() + ", key: " + me.getKey()
                                        + " nb records: "
                                        + ((ExtendedTimeSeries) me.getValue()).getTimeSeries().getItemCount());
                                logger.debug("mineResultSet hash content: " + mr.getEventTimeseriesMap());
                                logger.debug("(((TimeSeries) me.getValue()).getMaxY(): "
                                        + (((ExtendedTimeSeries) me.getValue()).getTimeSeries().getMaxY()));
                                logger.debug("(((TimeSeries) me.getValue()).getMinY(): "
                                        + (((ExtendedTimeSeries) me.getValue()).getTimeSeries().getMinY()));
                                XYPlot plot2 = chart.getXYPlot();
                                //   LogarithmicAxis axis4 = new LogarithmicAxis(me.toString());
                                NumberAxis axis4 = new NumberAxis(me.getKey().toString());
                                axis4.setAutoRange(true);
                                // axis4.setInverted(true);
                                axis4.setAxisLineVisible(true);
                                axis4.setAutoRangeIncludesZero(true);

                                // axis4.setRange(new Range(((TimeSeries)
                                // axis4.setRange(new Range(((TimeSeries)
                                // me.getValue()).getMinY(), ((TimeSeries)
                                // me.getValue()).getMaxY()));
                                axis4.setLabelPaint(colors[count]);
                                axis4.setTickLabelPaint(colors[count]);
                                plot2.setRangeAxis(count, axis4);
                                final ValueAxis domainAxis = domainAxis1;

                                // domainAxis.setLowerMargin(0.001);
                                // domainAxis.setUpperMargin(0.0);
                                plot2.setDomainCrosshairVisible(true);
                                plot2.setRangeCrosshairVisible(true);
                                //plot2.setRangeCrosshairLockedOnData(true);
                                plot2.setDomainAxis(domainAxis);
                                plot2.setForegroundAlpha(0.5f);
                                plot2.setDataset(count, dataset);
                                plot2.mapDatasetToRangeAxis(count, count);
                                XYBarRenderer rend = new XYBarRenderer(); // XYErrorRenderer

                                rend.setShadowVisible(false);
                                rend.setDrawBarOutline(true);
                                Stroke stroke = new BasicStroke(5);
                                rend.setBaseStroke(stroke);
                                final XYItemRenderer renderer = rend;
                                renderer.setSeriesToolTipGenerator(0, tt1);
                                // renderer.setItemLabelsVisible(true);
                                renderer.setSeriesPaint(0, colors[count]);
                                renderer.setSeriesVisible(0, true);
                                plot2.setRenderer(count, renderer);
                                int hits = 0;
                                int matchs = 0;

                                if (((ExtendedTimeSeries) me.getValue()).getStat() != null) {
                                    hits = ((ExtendedTimeSeries) me.getValue()).getStat()[1];
                                    //   matchs= ((ExtendedTimeSeries) me.getValue()).getStat()[0];
                                }
                                JCheckBox jcb = new JCheckBox(new VisibleAction(panel, checkboxPanel, axis4,
                                        me.getKey().toString() + "(" + hits + ")", 0));

                                jcb.setSelected(true);
                                jcb.setBackground(Color.white);
                                jcb.setBorderPainted(true);
                                jcb.setBorder(BorderFactory.createLineBorder(colors[count], 1, true));
                                jcb.setFont(new Font("Sans-serif", oldSmallFont.getStyle(),
                                        oldSmallFont.getSize()));
                                checkboxPanel.add(jcb);
                                count++;
                            }

                            JPanel pan = new JPanel();

                            pan.setLayout(new BorderLayout());
                            pan.setPreferredSize(new Dimension(600,
                                    Integer.parseInt((String) Preferences.getPreference("chartSize"))));
                            // pan.setPreferredSize(panelSize);
                            panel.add(pan);
                            final ChartPanel cpanel = new ChartPanel(chart);
                            cpanel.setMinimumDrawWidth(0);
                            cpanel.setMinimumDrawHeight(0);
                            cpanel.setMaximumDrawWidth(1920);
                            cpanel.setMaximumDrawHeight(1200);
                            // cpanel.setInitialDelay(0);
                            cpanel.setDismissDelay(9999999);
                            cpanel.setInitialDelay(50);
                            cpanel.setReshowDelay(200);
                            cpanel.setPreferredSize(new Dimension(600, 350));
                            // cpanel.restoreAutoBounds(); fix the tooltip
                            // missing problem but then relative display is
                            // broken
                            panel.add(new JSeparator(SwingConstants.HORIZONTAL));
                            pan.add(cpanel, BorderLayout.CENTER);
                            // checkboxPanel.setPreferredSize(new Dimension(600,
                            // 0));
                            cpanel.addChartMouseListener(new ChartMouseListener() {

                                public void chartMouseClicked(ChartMouseEvent chartmouseevent) {
                                    // chartmouseevent.getEntity().

                                    ChartEntity entity = chartmouseevent.getEntity();
                                    if (entity instanceof XYItemEntity) {
                                        XYItemEntity item = ((XYItemEntity) entity);
                                        if (item.getDataset() instanceof TimeSeriesCollection) {

                                            TimeSeriesCollection data = (TimeSeriesCollection) item
                                                    .getDataset();
                                            TimeSeries series = data.getSeries(item.getSeriesIndex());
                                            TimeSeriesDataItem dataitem = series.getDataItem(item.getItem());

                                            // logger.info(" Serie: "+series.getKey().toString()
                                            // +
                                            // " Period : "+dataitem.getPeriod().toString());
                                            // mr.getFileForDate(new Date
                                            // (x.longValue())
                                            ;
                                            int x = chartmouseevent.getTrigger().getX();
                                            // logger.info(mr.getFileForDate(dataitem.getPeriod().getEnd()));
                                            int y = chartmouseevent.getTrigger().getY();
                                            String myString = "";
                                            if (dataitem.getPeriod() != null) {
                                                logger.info(dataitem.getPeriod().getEnd());
                                                //                                    myString = mr.getFileForDate(dataitem.getPeriod().getEnd()).toString();
                                                String lineString = ""
                                                        + mr.getFileLineForDate(dataitem.getPeriod().getEnd(),
                                                                item.getDataset()
                                                                        .getSeriesKey(item.getSeriesIndex())
                                                                        .toString())
                                                                .getLineNumber();
                                                String fileString = cd.sourceFileArrayListMap
                                                        .get(pairs.getKey())
                                                        .get(mr.getFileLineForDate(
                                                                dataitem.getPeriod().getEnd(),
                                                                item.getDataset()
                                                                        .getSeriesKey(item.getSeriesIndex())
                                                                        .toString())
                                                                .getFileId())
                                                        .getFile().getAbsolutePath();
                                                String command = Preferences.getPreference("editorCommand");
                                                command = command.replace("$line", lineString);
                                                command = command.replace("$file", fileString);
                                                logger.info(command);
                                                Runtime rt = Runtime.getRuntime();
                                                try {
                                                    rt.exec(command);
                                                } catch (IOException e1) {
                                                    // TODO Auto-generated catch block
                                                    e1.printStackTrace();
                                                }
                                                StringSelection stringSelection = new StringSelection(
                                                        fileString);
                                                Clipboard clpbrd = Toolkit.getDefaultToolkit()
                                                        .getSystemClipboard();
                                                clpbrd.setContents(stringSelection, null);
                                                //      cpanel.getGraphics().drawString("file name copied", x - 5, y - 5);
                                                try {
                                                    Thread.sleep(500);
                                                } catch (InterruptedException e) {
                                                    // TODO Auto-generated catch
                                                    // block
                                                    e.printStackTrace();
                                                }
                                            }

                                            // logger.info(mr.getFileForDate(dataitem.getPeriod().getStart()));
                                        }
                                    }
                                }

                                public void chartMouseMoved(ChartMouseEvent e) {
                                }

                            });

                            pan.add(checkboxPanel, BorderLayout.SOUTH);

                        }
                    }
                } else {
                    logger.debug("mr dates null: " + mr.getGroup() + mr.getSourceID() + mr.getLogFiles());
                }
            }
        }
    }
    // Map=miner.mine(sourceFiles,repo);
    estimatedTime = System.currentTimeMillis() - startTime;

    revalidate();
    logger.info("display time: " + estimatedTime);
}

From source file:com.datatorrent.stram.StreamingAppMasterService.java

/**
 * Dump out contents of $CWD and the environment to stdout for debugging
 *///from   w  ww .  j a  va  2 s  . c  o m
@SuppressWarnings("UseOfSystemOutOrSystemErr")
public void dumpOutDebugInfo() {
    LOG.info("Dump debug output");
    Map<String, String> envs = System.getenv();
    LOG.info("\nDumping System Env: begin");
    for (Map.Entry<String, String> env : envs.entrySet()) {
        LOG.info("System env: key=" + env.getKey() + ", val=" + env.getValue());
    }
    LOG.info("Dumping System Env: end");

    String cmd = "ls -al";
    Runtime run = Runtime.getRuntime();
    Process pr;
    try {
        pr = run.exec(cmd);
        pr.waitFor();

        BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));
        String line;
        LOG.info("\nDumping files in local dir: begin");
        try {
            while ((line = buf.readLine()) != null) {
                LOG.info("System CWD content: " + line);
            }
            LOG.info("Dumping files in local dir: end");
        } finally {
            buf.close();
        }
    } catch (IOException e) {
        LOG.debug("Exception", e);
    } catch (InterruptedException e) {
        LOG.info("Interrupted", e);
    }

    LOG.info("Classpath: {}", System.getProperty("java.class.path"));
    LOG.info("Config resources: {}", getConfig().toString());
    try {
        // find a better way of logging this using the logger.
        Configuration.dumpConfiguration(getConfig(), new PrintWriter(System.out));
    } catch (Exception e) {
        LOG.error("Error dumping configuration.", e);
    }
}

From source file:com.emergya.persistenceGeo.importer.shp.ShpImporterImpl.java

@Override
public boolean importShpToDb(String pathToShp, String tableName, boolean dropExistingTable) {
    boolean result = true;
    String srcProjection = "";
    Runtime rt = Runtime.getRuntime();
    if (pathToShp == null || !pathToShp.endsWith(".shp")) {
        throw new IllegalArgumentException("pathToShp does not end with .shp");
    }//from   w  w w .  j  a  va 2  s .  co  m
    int lastIndexOfSlash = pathToShp.lastIndexOf(File.separatorChar);
    int lastIndexOfShp = pathToShp.lastIndexOf('.');
    String path = pathToShp.substring(0, lastIndexOfSlash);
    String file = pathToShp.substring(lastIndexOfSlash + 1, lastIndexOfShp);
    boolean exists = checkIfAllFilesExist(path, file);
    if (!exists) {
        throw new ShpImporterException("Not all mandatory shape file components could be found");
    }

    // If exists a .prj file try to guess the EPSG code. If not code found
    // defaults to EPSG:4326
    if (checkIfPrjFileExist(path, file)) {
        String prjPath = pathToShp.substring(0, pathToShp.lastIndexOf('.')) + ".prj";
        try {
            Process proc = rt.exec(new String[] { GUESS_PROJECTION_COMMAND, prjPath });
            BufferedReader standarStream = new BufferedReader(new InputStreamReader(proc.getInputStream()));

            int projStatus = proc.waitFor();
            String line;
            if (projStatus == 0) {
                while ((line = standarStream.readLine()) != null) {
                    if (!"EPSG:-1".equals(line)) {
                        srcProjection = line.split(":")[1] + ":";
                    }
                }
            } else {
                if (LOG.isWarnEnabled()) {
                    LOG.warn(GUESS_PROJECTION_COMMAND + " return code was " + projStatus);
                }
                if (LOG.isDebugEnabled()) {
                    BufferedReader errorStream = new BufferedReader(
                            new InputStreamReader(proc.getErrorStream()));
                    while ((line = errorStream.readLine()) != null) {
                        LOG.debug(GUESS_PROJECTION_COMMAND + ": " + line);
                    }
                }

            }

        } catch (IOException e) {
            if (LOG.isErrorEnabled()) {
                LOG.error("guessEPSG.py not found. Please put this file " + " in the path");
            }
        } catch (InterruptedException e) {
            LOG.error(GUESS_PROJECTION_COMMAND + " thread interrupted", e);
        }

    }

    File shp = new File(pathToShp);
    String dropTableParameter = "";
    if (dropExistingTable) {
        dropTableParameter = DROP_TABLE_OPTION;
    }

    String command = MessageFormat.format(SHP2PGSQL_COMMAND, dropTableParameter, srcProjection,
            dbConfig.getDestSrid(), shp.getAbsolutePath(), dbConfig.getSchema(), tableName,
            dbConfig.getPostgresHost(), dbConfig.getPostgresPort(), dbConfig.getDatabaseName(),
            dbConfig.getPostgresUser());
    if (LOG.isDebugEnabled()) {
        LOG.debug("SHPIMPORTER Command: " + command);
    }
    try {
        Process proc = rt.exec(new String[] { BASH_COMMAND, BASH_COMMAND_FIRST_ARGUMENT, command },
                new String[] { "PGPASSWORD=" + dbConfig.getPostgresPassword() });

        BufferedReader standarStream = new BufferedReader(new InputStreamReader(proc.getInputStream()));

        BufferedReader errorStream = new BufferedReader(new InputStreamReader(proc.getErrorStream()));

        String line;
        while ((line = standarStream.readLine()) != null) {
            if (line.contains("ROLLBACK")) {
                result = false;
            }
            if (LOG.isDebugEnabled()) {
                LOG.debug("SHPIMPORTER standar output: " + line);
            }
        }

        while ((line = errorStream.readLine()) != null) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("SHPIMPORTER error output: ");
            }
        }
        standarStream.close();
        errorStream.close();
        int exitStatus = proc.waitFor();

        // Am I checking the real subcommand parameter exit status or only
        // bash command exit status?
        if (exitStatus != 0) {
            throw new ShpImporterException("Exit status is not 0 after executing " + command);
        }
    } catch (IOException e) {
        throw new ShpImporterException("IOExcption thrown while executing SHP import", e);
    } catch (InterruptedException e) {
        throw new ShpImporterException(
                "Another thread interrumped this when it " + " was waiting for SHP import command ending.", e);
    }

    return result;

}

From source file:edu.uci.ics.asterix.aoya.AsterixApplicationMaster.java

private void dumpOutDebugInfo() {

    LOG.info("Dump debug output");
    Map<String, String> envs = System.getenv();
    for (Map.Entry<String, String> env : envs.entrySet()) {
        LOG.info("System env: key=" + env.getKey() + ", val=" + env.getValue());
        System.out.println("System env: key=" + env.getKey() + ", val=" + env.getValue());
    }//from w  w  w  .jav  a2s.c o  m

    String cmd = "ls -alhLR";
    Runtime run = Runtime.getRuntime();
    Process pr = null;
    try {
        pr = run.exec(cmd);
        pr.waitFor();

        BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));
        String line = "";
        while ((line = buf.readLine()) != null) {
            LOG.info("System CWD content: " + line);
            System.out.println("System CWD content: " + line);
        }
        buf.close();
    } catch (IOException e) {
        LOG.info(e);
    } catch (InterruptedException e) {
        LOG.info(e);
    }
}

From source file:org.ala.spatial.web.services.GDMWSController.java

private int runGDM(int level, String params) {
    Runtime runtime = Runtime.getRuntime();
    Process proc;/*w ww.  j  a  va  2s.c  o m*/
    InputStreamReader isre = null, isr = null;
    BufferedReader bre = null, br = null;
    int exitValue = -1;

    try {
        String command = AlaspatialProperties.getAnalysisGdmCmd() + " -g" + level + " " + params;
        System.out.println("Running gdm: " + command);

        //            return 111;

        proc = runtime.exec(command);

        isre = new InputStreamReader(proc.getErrorStream());
        bre = new BufferedReader(isre);
        isr = new InputStreamReader(proc.getInputStream());
        br = new BufferedReader(isr);
        String line;

        while ((line = bre.readLine()) != null) {
            System.out.println(line);
        }

        while ((line = br.readLine()) != null) {
            System.out.println(line);
        }

        int exitVal = proc.waitFor();

        // any error???
        exitValue = exitVal;

    } catch (Exception e) {
        System.out.println("Error executing GDM: ");
        e.printStackTrace(System.out);
    } finally {
        try {
            isre.close();
            bre.close();
            isr.close();
            br.close();
        } catch (IOException ioe) {
            System.out.println("Error closing output and error streams");
        }
    }

    return exitValue;
}

From source file:ch.kostceco.tools.kostsimy.comparison.moduleim.impl.CompareImageModuleImpl.java

@Override
public boolean validate(File origDatei, File repDatei, File directoryOfLogfile) throws CompareImageException {
    boolean isValid = true;
    // boolean isValidFailed = false;
    boolean compResult = false;
    int allInt = 0;
    boolean allNoInt = false;
    String allStr = "";

    String imToleranceTxt = getConfigurationService().getImTolerance();
    String imTolerance = "5%";
    float percentageInvalid = 99.9999f;
    /* Nicht vergessen in "src/main/resources/config/applicationContext-services.xml" beim
     * entsprechenden Modul die property anzugeben: <property name="configurationService"
     * ref="configurationService" /> */

    /* Initialisierung ImageMagick -> berprfen der Angaben: existiert die compare.exe,
     * msvcp120.dll, msvcr120.dll, vcomp120.dll am vorgegebenen Ort? */
    String compareExe = "compare.exe";
    String msvcp120Dll = "msvcp120.dll";
    String msvcr120Dll = "msvcr120.dll";
    String vcomp120Dll = "vcomp120.dll";
    String im = "resources" + File.separator + "ImageMagickCompare-6.9.1-Q16";
    boolean imExist = true;
    File fCompareExe = new File(im + File.separator + compareExe);
    if (!fCompareExe.exists()) {
        // Compare.exe von ImageMagick existiert nicht, kein Vergleich --> Abbruch
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                + getTextResourceService().getText(ERROR_XML_IMCMP_MISSING, compareExe));
        imExist = false;//from w ww .  ja  v a  2 s  .  co m
    }
    File fMsvcp120Dll = new File(im + File.separator + msvcp120Dll);
    if (!fMsvcp120Dll.exists()) {
        // msvcp120.dll von ImageMagick existiert nicht, kein Vergleich --> Abbruch
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                + getTextResourceService().getText(ERROR_XML_IMCMP_MISSING, msvcp120Dll));
        imExist = false;
    }
    File fMsvcr120Dll = new File(im + File.separator + msvcr120Dll);
    if (!fMsvcr120Dll.exists()) {
        // msvcr120.dll von ImageMagick existiert nicht, kein Vergleich --> Abbruch
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                + getTextResourceService().getText(ERROR_XML_IMCMP_MISSING, msvcr120Dll));
        imExist = false;
    }
    File fVcomp120Dll = new File(im + File.separator + vcomp120Dll);
    if (!fVcomp120Dll.exists()) {
        // vcomp120.dll von ImageMagick existiert nicht, kein Vergleich --> Abbruch
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                + getTextResourceService().getText(ERROR_XML_IMCMP_MISSING, vcomp120Dll));
        imExist = false;
    }
    if (!imExist) {
        // compare.exe/msvcp120.dll/msvcr120.dll/vcomp120.dll von ImageMagick existiert nicht --> Abbruch
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                + getTextResourceService().getText(ERROR_XML_IMCMP_MISSING, vcomp120Dll));
        return false;
    }

    if (imToleranceTxt.contains("N") || imToleranceTxt.contains("n")) {
        // null = 0%
        imTolerance = "0%";
        percentageInvalid = (float) 100.000000000;
        imToleranceTxt = "N";
    } else if (imToleranceTxt.contains("S") || imToleranceTxt.contains("s")) {
        // small = 2%
        imTolerance = "2%";
        percentageInvalid = (float) 99.9999;
        imToleranceTxt = "S";
    } else if (imToleranceTxt.contains("XL") || imToleranceTxt.contains("xl")) {
        // xlarge = 15%
        imTolerance = "15%";
        percentageInvalid = (float) 99.9;
        imToleranceTxt = "XL";
    } else if (imToleranceTxt.contains("L") || imToleranceTxt.contains("l")) {
        // large = 10%
        imTolerance = "10%";
        percentageInvalid = (float) 99.99;
        imToleranceTxt = "L";
    } else {
        // medium = 5%
        imTolerance = "5%";
        imToleranceTxt = "M";
        percentageInvalid = (float) 99.999;
    }
    String pathToCompareExe = fCompareExe.getAbsolutePath();

    File report;
    File reportId;
    String imgPx1 = "1";

    StringBuffer concatenatedOutputs = new StringBuffer();

    try {

        String pathToOutput = directoryOfLogfile.getAbsolutePath() + File.separator + origDatei.getName()
                + "_compare_report.txt";
        String pathToOutputId = directoryOfLogfile.getAbsolutePath() + File.separator + origDatei.getName()
                + "_identify_report.txt";
        String pathToMask = directoryOfLogfile.getAbsolutePath() + File.separator + origDatei.getName()
                + "_mask.jpg";

        /* compare -fuzz 15% -metric AE -quiet -identify -verbose -highlight-color DarkRed Image_1.jpg
         * Image_2.jpg mask.jpg >>results_id.txt 2>results.txt */

        String command = "cmd /c \"\"" + pathToCompareExe + "\" -fuzz " + imTolerance
                + " -metric AE -quiet -identify -verbose -highlight-color DarkRed \""
                + origDatei.getAbsolutePath() + "\" \"" + repDatei.getAbsolutePath() + "\" \"" + pathToMask
                + "\" >>\"" + pathToOutputId + "\" 2>\"" + pathToOutput + "\"";
        /* Das redirect Zeichen verunmglicht eine direkte eingabe. mit dem geschachtellten Befehl
         * gehts: cmd /c\"urspruenlicher Befehl\" */

        Process proc = null;
        Runtime rt = null;

        try {
            report = new File(pathToOutput);
            reportId = new File(pathToOutputId);
            // falls das File bereits existiert, z.B. von einem vorhergehenden Durchlauf, lschen
            // wir es
            if (report.exists()) {
                report.delete();
            }
            if (reportId.exists()) {
                reportId.delete();
            }
            Util.switchOffConsole();
            rt = Runtime.getRuntime();
            proc = rt.exec(command.toString().split(" "));
            // .split(" ") ist notwendig wenn in einem Pfad ein Doppelleerschlag vorhanden ist!

            // Fehleroutput holen
            StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");

            // Output holen
            StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");

            // Threads starten
            errorGobbler.start();
            outputGobbler.start();

            // Warte, bis wget fertig ist
            proc.waitFor();

            Util.switchOnConsole();
            // Kontrolle ob die Reports existieren
            if (!report.exists()) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                        + getTextResourceService().getText(ERROR_XML_IMCMP_NOREPORT, report.getAbsolutePath()));
                if (!reportId.exists()) {
                    getMessageService().logError(
                            getTextResourceService().getText(MESSAGE_XML_MODUL_CI) + getTextResourceService()
                                    .getText(ERROR_XML_IMCMP_NOREPORT, reportId.getAbsolutePath()));
                    return false;
                }
                return false;
            }
            if (!reportId.exists()) {
                getMessageService().logError(
                        getTextResourceService().getText(MESSAGE_XML_MODUL_CI) + getTextResourceService()
                                .getText(ERROR_XML_IMCMP_NOREPORT, reportId.getAbsolutePath()));
                return false;
            }
        } catch (Exception e) {
            getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                    + getTextResourceService().getText(ERROR_XML_IMCMP_SERVICEFAILED, e.getMessage()));
            return false;
        } finally {
            if (proc != null) {
                closeQuietly(proc.getOutputStream());
                closeQuietly(proc.getInputStream());
                closeQuietly(proc.getErrorStream());
            }
        }
        // Kontrolle ob die Reports existieren
        if (!report.exists()) {
            getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                    + getTextResourceService().getText(ERROR_XML_IMCMP_NOREPORT, report.getAbsolutePath()));
            if (!reportId.exists()) {
                getMessageService().logError(
                        getTextResourceService().getText(MESSAGE_XML_MODUL_CI) + getTextResourceService()
                                .getText(ERROR_XML_IMCMP_NOREPORT, reportId.getAbsolutePath()));
                return false;
            }
            return false;
        }
        if (!reportId.exists()) {
            getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                    + getTextResourceService().getText(ERROR_XML_IMCMP_NOREPORT, reportId.getAbsolutePath()));
            return false;
        }

        // Ende IMCMP direkt auszulsen

        // TODO: Marker: ReportId und auswerten (Grsse und der Pixel)
        try {
            BufferedReader in = new BufferedReader(new FileReader(reportId));
            String line;
            String imgSize1 = "1";
            String imgSize2 = "2";
            String imgPx2 = "2";

            while ((line = in.readLine()) != null) {

                concatenatedOutputs.append(line);
                concatenatedOutputs.append(NEWLINE);

                /* Format: TIFF (Tagged Image File Format) Mime type: image/tiff
                 * 
                 * Geometry: 2469x3568+0+0
                 * 
                 * Channel statistics:
                 * 
                 * Pixels: 8809392
                 * 
                 * Geometry und Pixels scheinen immer ausgegeben zu werden
                 * 
                 * Gemotry und Pixels mssen identisch sein */
                if (line.contains("  Geometry: ")) {
                    if (imgSize1.equals("1")) {
                        imgSize1 = line;
                    } else {
                        imgSize2 = line;
                    }
                } else if (line.contains("  Pixels: ")) {
                    if (imgPx1.equals("1")) {
                        imgPx1 = line;
                    } else {
                        imgPx2 = line;
                    }
                }

                // TODO: Marker: Auswertung und Fehlerausgabe wenn nicht bestanden.
            }
            if (imgPx1.equals("1") && imgPx2.equals("2") && imgSize1.equals("1") && imgSize2.equals("2")) {
                // identify_report ist leer oder enthlt nicht das was er sollte
                isValid = false;
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                        + getTextResourceService().getText(ERROR_XML_IMCMP_NOREPORTTEXT));
                in.close();
                return false;
            }
            if (!imgPx1.equals(imgPx2)) {
                // die beiden Bilder haben nicht gleich viel Pixels
                isValid = false;
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                        + getTextResourceService().getText(ERROR_XML_CI_PIXELINVALID, imgPx1, imgPx2));
            }
            if (!imgSize1.equals(imgSize2)) {
                // die beiden Bilder sind nicht gleich gross
                isValid = false;
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                        + getTextResourceService().getText(ERROR_XML_CI_SIZEINVALID, imgSize1, imgSize2));
            }
            if (!isValid) {
                // die beiden Bilder sind nicht gleich gross
                in.close();
                return false;
            }
            in.close();
        } catch (Exception e) {
            getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                    + getTextResourceService().getText(ERROR_XML_UNKNOWN, "identify: " + e.getMessage()));
            return false;
        }

        // TODO: Marker: Report auswerten (Bildvergleich) wenn grsse & PixelAnzahl identisch
        try {
            BufferedReader in = new BufferedReader(new FileReader(report));
            String line;
            boolean allNull = false;
            boolean allExist = false;

            while ((line = in.readLine()) != null) {

                concatenatedOutputs.append(line);
                concatenatedOutputs.append(NEWLINE);

                /* img1.tif[0] TIFF 2469x3568 2469x3568+0+0 8-bit Grayscale Gray 8.833MB 1.451u 0:01.774
                 * 
                 * img2.jp2[0] JP2 2469x3568 2469x3568+0+0 8-bit Gray 1.842MB 1.357u 0:01.378
                 * 
                 * all: 0
                 * 
                 * in den ersten zwei zeilen sind die eigenschaften der beiden Bilder enthalten
                 * 
                 * Danach die Anzahl Pixel mit einer grsseren Abweichung aus, allg: 0= vergleichbar */
                if (line.contains(" all: ")) {
                    allExist = true;
                    if (line.contains(" all: 0")) {
                        allNull = true;
                    } else {
                        /* Invalide Px extrahieren "    all: 3563" extrahieren */
                        String lineReportAll = line.substring(9);
                        try {
                            // lineReport = 3563
                            allInt = Integer.parseInt(lineReportAll);
                        } catch (Exception e) {
                            allNoInt = true;
                            allStr = lineReportAll;
                        }
                    }
                }

                if (allNull) {
                    compResult = true;
                }
            }
            in.close();
            if (!allExist) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                        + getTextResourceService().getText(ERROR_XML_IMCMP_NOALL));
                return false;
            }
            if (!compResult) {
                // Bildvergleich nicht bestanden
                if (allNoInt) {
                    /* Bilder mit vielen Pixels die Abweichen (Potenz -> String): Vereinfachte Fehlerausgabe */

                    /* Invalide [allStr] und total px z2 aus imgPx1 "    Pixels: 8809392" extrahieren */
                    String lineReport = imgPx1.substring(12);
                    // lineReport = 8809392

                    isValid = false;

                    getMessageService().logError(
                            getTextResourceService().getText(MESSAGE_XML_MODUL_CI) + getTextResourceService()
                                    .getText(ERROR_XML_CI_CIINVALIDSTR, lineReport, imToleranceTxt, allStr));

                } else {
                    /* Bilder mit einer Abweichung (Int): Prozent ermitteln und mit percentageInvalid
                     * abgleichen */
                    double z1 = 0;
                    double z2 = 0;
                    float percentageCalc = (float) 0.0;
                    float percentageCalcInv = (float) 0.0;

                    /* Invalide z1 [allInt] und total px z2 aus imgPx1 "    Pixels: 8809392" extrahieren */
                    String lineReport = imgPx1.substring(12);
                    // lineReport = 8809392
                    z2 = Double.parseDouble(lineReport);
                    z1 = allInt;

                    percentageCalc = (float) (100 - (100 / z2 * z1));
                    percentageCalcInv = 100 - percentageCalc;

                    // Prozentzahlen vergleichen
                    if (percentageInvalid > percentageCalc) {
                        // Bilder mit einer grsseren Abweichung
                        isValid = false;

                        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                                + getTextResourceService().getText(ERROR_XML_CI_CIINVALID, percentageCalcInv,
                                        z2, imToleranceTxt, z1));
                    }
                }
            }
        } catch (Exception e) {
            getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                    + getTextResourceService().getText(ERROR_XML_UNKNOWN, "compare: " + e.getMessage()));
            return false;
        }
    } catch (Exception e) {
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_CI)
                + getTextResourceService().getText(ERROR_XML_UNKNOWN, e.getMessage()));
        return false;
    }

    // reports lschen
    if (report.exists()) {
        report.delete();
    }
    if (reportId.exists()) {
        reportId.delete();
    }

    return isValid;
}

From source file:com.eucalyptus.blockstorage.OverlayManager.java

private int losetup(String absoluteFileName, String loDevName) {
    try {/* w ww.  j a  v a2  s  .c  o  m*/
        Runtime rt = Runtime.getRuntime();
        Process proc = rt.exec(
                new String[] { StorageProperties.EUCA_ROOT_WRAPPER, "losetup", loDevName, absoluteFileName });
        StreamConsumer error = new StreamConsumer(proc.getErrorStream());
        StreamConsumer output = new StreamConsumer(proc.getInputStream());
        error.start();
        output.start();
        int errorCode = proc.waitFor();
        output.join();
        LOG.info("Finished executing: losetup " + loDevName + " " + absoluteFileName);
        LOG.info("Result of: losetup " + loDevName + " " + absoluteFileName + " stdout: "
                + output.getReturnValue());
        LOG.info("Result of: losetup" + loDevName + " " + absoluteFileName + " return value: "
                + error.getReturnValue());
        return errorCode;
    } catch (Exception t) {
        LOG.error(t);
    }
    return -1;
}

From source file:org.pentaho.di.trans.steps.teradatabulkloader.TeraDataBulkLoader.java

/**
 * Execute./*from w ww.  j a v  a 2  s  .co  m*/
 *
 * @param meta the meta
 * @return true, if successful
 * @throws KettleException the kettle exception
 */
public boolean execute(TeraDataBulkLoaderMeta meta) throws KettleException {
    Runtime rt = Runtime.getRuntime();

    try {
        // 1) Create the FIFO file using the "mkfifo" command...
        // Make sure to log all the possible output, also from STDERR
        data.fifoFilename = environmentSubstitute(meta.getFifoFileName());
        if (meta.isRandomizeFifoFilename()) {
            data.fifoFilename += "." + new Random().nextInt(2139999999);
        }
        setVariable("TPT_FIFO_FILENAME", data.fifoFilename);

        File fifoFile = new File(data.fifoFilename);
        if (!fifoFile.exists()) {
            // MKFIFO!
            String mkFifoCmd = "mkfifo " + data.fifoFilename;
            logDetailed(BaseMessages.getString(PKG, "TeraDataBulkLoader.Log.CreatePipe", mkFifoCmd));
            Process mkFifoProcess = rt.exec(mkFifoCmd);
            StreamLogger errorLogger = new StreamLogger(log, mkFifoProcess.getErrorStream(), "mkFifoError");
            StreamLogger outputLogger = new StreamLogger(log, mkFifoProcess.getInputStream(), "mkFifoOuptut");
            new Thread(errorLogger).start();
            new Thread(outputLogger).start();
            int result = mkFifoProcess.waitFor();
            if (result != 0) {
                throw new Exception(BaseMessages.getString(PKG,
                        "TeraDataBulkLoader.Exception.CommandReturnCodeError", result, mkFifoCmd));
            }

            String chmodCmd = "chmod 666 " + data.fifoFilename;
            logDetailed(BaseMessages.getString(PKG, "TeraDataBulkLoader.Log.SetPipePermissions", chmodCmd));
            Process chmodProcess = rt.exec(chmodCmd);
            errorLogger = new StreamLogger(log, chmodProcess.getErrorStream(), "chmodError");
            outputLogger = new StreamLogger(log, chmodProcess.getInputStream(), "chmodOuptut");
            new Thread(errorLogger).start();
            new Thread(outputLogger).start();
            result = chmodProcess.waitFor();
            if (result != 0) {
                throw new Exception(BaseMessages.getString(PKG,
                        "TeraDataBulkLoader.Exception.CommandReturnCodeError", result, chmodCmd));
            }
        }
        // 3) Now we are ready to run the load command...
        //
        executeLoadCommand();
    } catch (Exception ex) {
        throw new KettleException(ex);
    }

    return true;
}