// Path: src/main/java/com/cipherdyne/gui/IConsole.java
// public interface IConsole {
//     /**
//      * Append a message to a console
//      * 
//      * @param msg Message to append to the console
//      */
//     public void appendToConsole(String msg);
// }


import com.cipherdyne.gui.IConsole;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
/* 
 * JFwknop is developed primarily by the people listed in the file 'AUTHORS'.
 * Copyright (C) 2016 JFwknop developers and contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package com.cipherdyne.jfwknop;


/**
 * This class intends to provide an interface to run external commands periodically or only once.
 */
public class ExternalCommand implements Runnable {

    // Logger
    static final Logger LOGGER = LogManager.getLogger(ExternalCommand.class.getName());

    // Command line to execute - can be more than one arguments - space separated list
    private final String[] args;

    // Timeout before two executions - Set to 0 to run the only command once
    private final long period;

    // Set to false when a periodic command has to be stoppped
    private boolean isRunning;

    // IConsole interface used to log external command output
// Path: src/main/java/com/cipherdyne/gui/IConsole.java
// public interface IConsole {
//     /**
//      * Append a message to a console
//      * 
//      * @param msg Message to append to the console
//      */
//     public void appendToConsole(String msg);
// }


// Path: src/main/java/com/cipherdyne/jfwknop/ExternalCommand.java
import com.cipherdyne.gui.IConsole;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

/* 
 * JFwknop is developed primarily by the people listed in the file 'AUTHORS'.
 * Copyright (C) 2016 JFwknop developers and contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package com.cipherdyne.jfwknop;


/**
 * This class intends to provide an interface to run external commands periodically or only once.
 */
public class ExternalCommand implements Runnable {

    // Logger
    static final Logger LOGGER = LogManager.getLogger(ExternalCommand.class.getName());

    // Command line to execute - can be more than one arguments - space separated list
    private final String[] args;

    // Timeout before two executions - Set to 0 to run the only command once
    private final long period;

    // Set to false when a periodic command has to be stoppped
    private boolean isRunning;

    // IConsole interface used to log external command output
    private final IConsole console;