All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ch.software_atelier.simpleflex.interfaces.file.FileInterfaceHandler Maven / Gradle / Ivy

There is a newer version: 2.2.2
Show newest version
package ch.software_atelier.simpleflex.interfaces.file;
import ch.software_atelier.simpleflex.SimpleFlexAccesser;
import ch.software_atelier.simpleflex.conf.text.ConfigElement;
import ch.software_atelier.simpleflex.conf.text.ConfigFileIO;
import ch.software_atelier.simpleflex.conf.text.SyntaxErrorNotifiable;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class FileInterfaceHandler {
    private final File _interfaceFile;
    private final int _interval;
    private boolean _running = false;
    private final InterfaceFileListener _interfceFileListener;
    private final SimpleFlexAccesser _sfa;
    
    private static final String CLASSPATH = "CLASSPATH";
    
    static Logger LOG = LogManager.getLogger(FileInterfaceHandler.class);

    public FileInterfaceHandler(File interfaceFile, int interval, SimpleFlexAccesser sfa) {
        _sfa = sfa;
        _interfceFileListener = new InterfaceFileListener();
        _interfaceFile = interfaceFile;
        _interval = interval;
        if (_interfaceFile.exists())
            _interfaceFile.delete();
        
        
    }

    public void start(){
        if (!_running){
            _running = true;
            _interfceFileListener.start();
        }
    }

    public void stop(){
        _running = false;
    }
    
    private class InterfaceFileListener extends Thread implements SyntaxErrorNotifiable{
        private boolean _syntaxError = false;
        
        public void run(){
            while (_running){
                if (_interfaceFile.exists()){
                    ConfigElement[] configs = readFile();
                    if (!_syntaxError){
                        if (configs!=null){
                            for (int i=0;i "+classp);
        }
        
        private void inProcUnSucceeded(String classp){
            LOG.info("process() failed > "+classp);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy