Example #1
0
 public void SetiBOT(AIMLBot.iBOT intelligentBOT)
 {
     _iBot = intelligentBOT;
 }
Example #2
0
 //-----------------------------------------------------------------------------------------------
 public bool initialize()
 {
     _iBot = new AIMLBot.iBOT(AppDomain.CurrentDomain.BaseDirectory + "\\aiml");
     return _iBot.initialize_iBOT();
 }
Example #3
0
        //-----------------------------------------------------------------------------------------------
        // constructors
        //-----------------------------------------------------------------------------------------------
        /// <summary>
        /// Creates an instance of the GExecutor with the given end points 
        /// (one for itself, and one for the manager), credentials and other options.
        /// </summary>
        /// <param name="managerEP">Manager end point</param>
        /// <param name="ownEP">Own end point</param>
        /// <param name="id">executor id</param>
        /// <param name="dedicated">Specifies whether the executor is dedicated</param>
        /// <param name="sc">Security credentials</param>
        /// <param name="baseDir">Working directory for the executor</param>
        public GExecutor(RemoteEndPoint managerEP, OwnEndPoint ownEP, string id, bool dedicated, SecurityCredentials sc, string baseDir)
            : base(managerEP, ownEP, sc, id)
        {
            //eduGRID Addition
                iBot = new AIMLBot.iBOT();
            //Edn of eduGRID Addition

            _BaseDir = baseDir;
            if (_BaseDir == "" || _BaseDir==null)
            {
                _BaseDir = AppDomain.CurrentDomain.BaseDirectory;
            }

            string datDir = Path.Combine(_BaseDir,"dat");

            logger.Debug("datadir="+datDir);
            if (!Directory.Exists(datDir))
            {
                logger.Debug("Couldnot find datadir. Creating it..."+datDir);
                Directory.CreateDirectory(datDir);
            }

            _Dedicated = dedicated;
            _Id = id;

            if (_Id == "")
            {
                logger.Info("Registering new executor");
                _Id = Manager.Executor_RegisterNewExecutor(Credentials, null, Info);
                logger.Info("Successfully Registered new executor:"+_Id);
            }
            else
            {
                // update the executor data if it exists in the database or create a new one if it is not found
                _Id = Manager.Executor_RegisterNewExecutor(Credentials, _Id, Info);
                logger.Debug("Id is "+_Id);
            }

            //handle exception since we want to connect to the manager
            //even if it doesnt succeed the first time.
            //that is, we need to handle InvalidExecutor and ConnectBack Exceptions.
            try
            {
                try
                {
                    ConnectToManager();
                }
                catch (InvalidExecutorException)
                {
                    logger.Info("Invalid executor! Registering new executor again...");

                    _Id = Manager.Executor_RegisterNewExecutor(Credentials, null, Info);

                    logger.Info("New ExecutorID = " + _Id);
                    ConnectToManager();
                }
            }
            catch (ConnectBackException)
            {
                logger.Warn("Couldn't connect as dedicated executor. Reverting to non-dedicated executor. ConnectBackException");
                _Dedicated = false;
                ConnectToManager();
            }

            //for non-dedicated mode, the heart-beat thread will be started
            if (_Dedicated)
            {
                logger.Debug("Dedicated mode: starting heart-beat thread");
                StartHeartBeatThread();
            }
        }
Example #4
0
 public void SetiBOT(AIMLBot.iBOT intelligentBOT)
 {
     _iBot = intelligentBOT;
 }
Example #5
0
        //-----------------------------------------------------------------------------------------------

        public bool initialize()
        {
            _iBot = new AIMLBot.iBOT(AppDomain.CurrentDomain.BaseDirectory + "\\aiml");
            return(_iBot.initialize_iBOT());
        }
Example #6
0
        //-----------------------------------------------------------------------------------------------
        // constructors
        //-----------------------------------------------------------------------------------------------

        /// <summary>
        /// Creates an instance of the GExecutor with the given end points
        /// (one for itself, and one for the manager), credentials and other options.
        /// </summary>
        /// <param name="managerEP">Manager end point</param>
        /// <param name="ownEP">Own end point</param>
        /// <param name="id">executor id</param>
        /// <param name="dedicated">Specifies whether the executor is dedicated</param>
        /// <param name="sc">Security credentials</param>
        /// <param name="baseDir">Working directory for the executor</param>
        public GExecutor(RemoteEndPoint managerEP, OwnEndPoint ownEP, string id, bool dedicated, SecurityCredentials sc, string baseDir) : base(managerEP, ownEP, sc, id)
        {
            //eduGRID Addition
            iBot = new AIMLBot.iBOT();
            //Edn of eduGRID Addition

            _BaseDir = baseDir;
            if (_BaseDir == "" || _BaseDir == null)
            {
                _BaseDir = AppDomain.CurrentDomain.BaseDirectory;
            }

            string datDir = Path.Combine(_BaseDir, "dat");

            logger.Debug("datadir=" + datDir);
            if (!Directory.Exists(datDir))
            {
                logger.Debug("Couldnot find datadir. Creating it..." + datDir);
                Directory.CreateDirectory(datDir);
            }

            _Dedicated = dedicated;
            _Id        = id;

            if (_Id == "")
            {
                logger.Info("Registering new executor");
                _Id = Manager.Executor_RegisterNewExecutor(Credentials, null, Info);
                logger.Info("Successfully Registered new executor:" + _Id);
            }
            else
            {
                // update the executor data if it exists in the database or create a new one if it is not found
                _Id = Manager.Executor_RegisterNewExecutor(Credentials, _Id, Info);
                logger.Debug("Id is " + _Id);
            }

            //handle exception since we want to connect to the manager
            //even if it doesnt succeed the first time.
            //that is, we need to handle InvalidExecutor and ConnectBack Exceptions.
            try
            {
                try
                {
                    ConnectToManager();
                }
                catch (InvalidExecutorException)
                {
                    logger.Info("Invalid executor! Registering new executor again...");

                    _Id = Manager.Executor_RegisterNewExecutor(Credentials, null, Info);

                    logger.Info("New ExecutorID = " + _Id);
                    ConnectToManager();
                }
            }
            catch (ConnectBackException)
            {
                logger.Warn("Couldn't connect as dedicated executor. Reverting to non-dedicated executor. ConnectBackException");
                _Dedicated = false;
                ConnectToManager();
            }

            //for non-dedicated mode, the heart-beat thread will be started
            if (_Dedicated)
            {
                logger.Debug("Dedicated mode: starting heart-beat thread");
                StartHeartBeatThread();
            }
        }