public static String handleRequest()

in code/src/main/java/init.java [37:111]


    public static String handleRequest(final Object input, final Context context) throws JCoException {

        config = Config.getInstance();
        
        if(input.toString().contains("debug"))
        config.debug = true;

        config.iteration++;

        if (context != null && input != null) { 

            config.logger = context.getLogger();

            if (config.debug){
                config.logger.log("Received Command: " + input + "\n");
                config.logger.log("Debugging ON");
            }

            //REINITIALIZE
            if (input.toString().contains("refresh")) {
                config.destination_name = null;
                config.guid = null;
                config.guid_validity = null;
                config.connected = false;
                config.reset = true;
                config.iteration = 1;
                config.logger.log("Config RESET");
            }

        }

        config.readSecrets();
        
        if (connection == null) {
            connection = new Connection(); 
        }
        connection.connect();

        if (config.connected) {

            config.getSystemTime();

            //SDF/SMON
            if (mysmon == null) {
                mysmon = new DataProviderSMON();
            }
            mysmon.getData();

            //ST03
            if (myst03 == null) {
                myst03 = new DataProviderST03();
            }
            myst03.getData();
            
            //ST22
            if (myst22 == null) {
                myst22 = new DataProviderST22();
            }
            myst22.getData();
            
            //SM37
            if (mysm37 == null) {
                mysm37 = new DataProviderSM37();
            }
            mysm37.getData();
            
            //WE02
            if (mywe02 == null) {
                mywe02 = new DataProviderWE02();
            }
            mywe02.getData();
        }

        return "Monitor operational - Pass '{ \"refresh\": \"true\" } ' to force a config reset! Received Command: " + input;
    }