Ejemplo n.º 1
0
    def _init_components(self, aggregator):
        from umit.icm.agent.core.PeerInfo import PeerInfo
        self.peer_info = PeerInfo()

        from umit.icm.agent.core.PeerManager import PeerManager
        self.peer_manager = PeerManager()

        from umit.icm.agent.core.EventManager import EventManager
        self.event_manager = EventManager()

        from umit.icm.agent.core.TaskManager import TaskManager
        self.task_manager = TaskManager()

        from umit.icm.agent.core.ReportManager import ReportManager
        self.report_manager = ReportManager()

        from umit.icm.agent.core.ReportUploader import ReportUploader
        self.report_uploader = ReportUploader(self.report_manager)

        from umit.icm.agent.core.TaskScheduler import TaskScheduler
        self.task_scheduler = TaskScheduler(self.task_manager,
                                            self.report_manager)

        from umit.icm.agent.core.TaskAssignFetch import TaskAssignFetch
        self.task_assign = TaskAssignFetch(self.task_manager)

        from umit.icm.agent.core.TestSetsFetcher import TestSetsFetcher
        self.test_sets = TestSetsFetcher(self.task_manager,
                                         self.report_manager)

        from umit.icm.agent.secure.KeyManager import KeyManager
        self.key_manager = KeyManager()

        from umit.icm.agent.core.Statistics import Statistics
        self.statistics = Statistics()

        from umit.icm.agent.rpc.aggregator import AggregatorAPI
        self.aggregator = AggregatorAPI(aggregator)

        from umit.icm.agent.super.SuperBehaviourByManual import SuperBehaviourByManual
        self.speer_by_manual = SuperBehaviourByManual(self)

        self.quitting = False
        self.is_auto_login = False
        self.is_successful_login = False  #fix the login failure, save DB problem
    def _init_components(self, aggregator):
        from umit.icm.agent.core.PeerInfo import PeerInfo
        self.peer_info = PeerInfo()

        from umit.icm.agent.core.PeerManager import PeerManager
        self.peer_manager = PeerManager()

        from umit.icm.agent.core.EventManager import EventManager
        self.event_manager = EventManager()

        from umit.icm.agent.core.TaskManager import TaskManager
        self.task_manager = TaskManager()

        from umit.icm.agent.core.ReportManager import ReportManager
        self.report_manager = ReportManager()

        from umit.icm.agent.core.ReportUploader import ReportUploader
        self.report_uploader = ReportUploader(self.report_manager)

        from umit.icm.agent.core.TaskScheduler import TaskScheduler
        self.task_scheduler = TaskScheduler(self.task_manager,
                                            self.report_manager)

        from umit.icm.agent.core.TaskAssignFetch import TaskAssignFetch
        self.task_assign = TaskAssignFetch(self.task_manager)
        
        from umit.icm.agent.core.TestSetsFetcher import TestSetsFetcher
        self.test_sets = TestSetsFetcher(self.task_manager,
                                         self.report_manager)
        
        from umit.icm.agent.secure.KeyManager import KeyManager
        self.key_manager = KeyManager()

        from umit.icm.agent.core.Statistics import Statistics
        self.statistics = Statistics()

        from umit.icm.agent.rpc.aggregator import AggregatorAPI
        self.aggregator = AggregatorAPI(aggregator)

        from umit.icm.agent.super.SuperBehaviourByManual import SuperBehaviourByManual
        self.speer_by_manual = SuperBehaviourByManual(self)

        self.quitting = False
        self.is_auto_login = False        
        self.is_successful_login = False #fix the login failure, save DB problem
Ejemplo n.º 3
0
class Application(object):
    def __init__(self):
        pass

    def _init_components(self, aggregator):
        from umit.icm.agent.core.PeerInfo import PeerInfo
        self.peer_info = PeerInfo()

        from umit.icm.agent.core.PeerManager import PeerManager
        self.peer_manager = PeerManager()

        from umit.icm.agent.core.EventManager import EventManager
        self.event_manager = EventManager()

        from umit.icm.agent.core.TaskManager import TaskManager
        self.task_manager = TaskManager()

        from umit.icm.agent.core.ReportManager import ReportManager
        self.report_manager = ReportManager()

        from umit.icm.agent.core.ReportUploader import ReportUploader
        self.report_uploader = ReportUploader(self.report_manager)

        from umit.icm.agent.core.TaskScheduler import TaskScheduler
        self.task_scheduler = TaskScheduler(self.task_manager,
                                            self.report_manager)

        from umit.icm.agent.core.TaskAssignFetch import TaskAssignFetch
        self.task_assign = TaskAssignFetch(self.task_manager)

        from umit.icm.agent.core.TestSetsFetcher import TestSetsFetcher
        self.test_sets = TestSetsFetcher(self.task_manager,
                                         self.report_manager)

        from umit.icm.agent.secure.KeyManager import KeyManager
        self.key_manager = KeyManager()

        from umit.icm.agent.core.Statistics import Statistics
        self.statistics = Statistics()

        from umit.icm.agent.rpc.aggregator import AggregatorAPI
        self.aggregator = AggregatorAPI(aggregator)

        from umit.icm.agent.super.SuperBehaviourByManual import SuperBehaviourByManual
        self.speer_by_manual = SuperBehaviourByManual(self)

        self.quitting = False
        self.is_auto_login = False
        self.is_successful_login = False  #fix the login failure, save DB problem

    def _load_from_db(self):
        """
        """
        self.peer_manager.load_from_db()
        # restore unsent reports
        self.report_manager.load_unsent_reports()
        # desktop agent stats saving
        self.statistics.load_from_db()

    def init_after_running(self,
                           port=None,
                           username=None,
                           password=None,
                           server_enabled=True,
                           skip_server_check=False):
        """
        """
        #####################################################
        # Create agent service(need to add the port confilct)
        if server_enabled:
            self.listen_port = port if port is not None else g_config.getint(
                'network', 'listen_port')
            try:
                from umit.icm.agent.rpc.AgentService import AgentFactory
                self.factory = AgentFactory()
                g_logger.info("Listening on port %d.", self.listen_port)
                reactor.listenTCP(self.listen_port, self.factory)
            except Exception, info:
                #There can add more information

                self.quit_window_in_wrong(primary_text = _("The Listen Port has been used by other applications"), \
                                          secondary_text = _("Please check the Port") )

        #############################
        # Create mobile agent service
        from umit.icm.agent.rpc.mobile import MobileAgentService
        self.ma_service = MobileAgentService()

        if self.use_gui:
            # Init GUI
            from umit.icm.agent.gui.GtkMain import GtkMain
            self.gtk_main = GtkMain()

        self.is_auto_login = g_config.getboolean('application',
                                                 'auto_login_swittch')

        ###################################################################
        #debug switch: It can show the gtkWindow without any authentication
        if g_config.getboolean('debug', 'debug_switch') and self.use_gui:
            self.login_simulate()

        ######################################
        #check aggregator can be reached first
        if not skip_server_check:
            defer_ = self.aggregator.check_aggregator_website()
            defer_.addCallback(self.check_aggregator_success)
            defer_.addErrback(self.check_aggregator_failed)
class Application(object):
    def __init__(self):
        pass

    def _init_components(self, aggregator):
        from umit.icm.agent.core.PeerInfo import PeerInfo
        self.peer_info = PeerInfo()

        from umit.icm.agent.core.PeerManager import PeerManager
        self.peer_manager = PeerManager()

        from umit.icm.agent.core.EventManager import EventManager
        self.event_manager = EventManager()

        from umit.icm.agent.core.TaskManager import TaskManager
        self.task_manager = TaskManager()

        from umit.icm.agent.core.ReportManager import ReportManager
        self.report_manager = ReportManager()

        from umit.icm.agent.core.ReportUploader import ReportUploader
        self.report_uploader = ReportUploader(self.report_manager)

        from umit.icm.agent.core.TaskScheduler import TaskScheduler
        self.task_scheduler = TaskScheduler(self.task_manager,
                                            self.report_manager)

        from umit.icm.agent.core.TaskAssignFetch import TaskAssignFetch
        self.task_assign = TaskAssignFetch(self.task_manager)
        
        from umit.icm.agent.core.TestSetsFetcher import TestSetsFetcher
        self.test_sets = TestSetsFetcher(self.task_manager,
                                         self.report_manager)
        
        from umit.icm.agent.secure.KeyManager import KeyManager
        self.key_manager = KeyManager()

        from umit.icm.agent.core.Statistics import Statistics
        self.statistics = Statistics()

        from umit.icm.agent.rpc.aggregator import AggregatorAPI
        self.aggregator = AggregatorAPI(aggregator)

        from umit.icm.agent.super.SuperBehaviourByManual import SuperBehaviourByManual
        self.speer_by_manual = SuperBehaviourByManual(self)

        self.quitting = False
        self.is_auto_login = False        
        self.is_successful_login = False #fix the login failure, save DB problem
                       
    def _load_from_db(self):
        """
        """
        self.peer_manager.load_from_db()
        # restore unsent reports
        self.report_manager.load_unsent_reports()
        # desktop agent stats saving
        self.statistics.load_from_db()

    def init_after_running(self, port=None, username=None, password=None,
                           server_enabled=True, skip_server_check=False):
        """
        """
        #####################################################
        # Create agent service(need to add the port confilct)
        if server_enabled:
            self.listen_port = port if port is not None else g_config.getint('network', 'listen_port')
            try:
                from umit.icm.agent.rpc.AgentService import AgentFactory
                self.factory = AgentFactory()
                g_logger.info("Listening on port %d.", self.listen_port)
                reactor.listenTCP(self.listen_port, self.factory)
            except Exception,info:
                #There can add more information

                self.quit_window_in_wrong(primary_text = _("The Listen Port has been used by other applications"), \
                                          secondary_text = _("Please check the Port") )
                
        #############################
        # Create mobile agent service
        from umit.icm.agent.rpc.mobile import MobileAgentService
        self.ma_service = MobileAgentService()

        if self.use_gui:
            # Init GUI
            from umit.icm.agent.gui.GtkMain import GtkMain
            self.gtk_main = GtkMain()
        
        self.is_auto_login = g_config.getboolean('application', 'auto_login_swittch')
        
        ###################################################################
        #debug switch: It can show the gtkWindow without any authentication 
        if g_config.getboolean('debug','debug_switch') and self.use_gui:
            self.login_simulate()
        
        ######################################
        #check aggregator can be reached first
        if not skip_server_check:
            defer_ = self.aggregator.check_aggregator_website()
            defer_.addCallback(self.check_aggregator_success)
            defer_.addErrback(self.check_aggregator_failed)