# Path: umit/icm/agent/logger.py
# LOGLEVEL = 'DEBUG'


import os
import sys
import time
import socket
from umit.icm.agent.logger import g_logger
from umit.icm.agent.BasePaths import *
from umit.icm.agent.Global import *
from twisted.internet import reactor
        from umit.icm.agent.rpc.message import *
        from umit.icm.agent.rpc.MessageFactory import MessageFactory
        from umit.icm.agent.utils.CreateDB import mod,exp 
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA




class SuperBehaviourByManual(object):
    """
    """
    def __init__(self,application):
        """
        """
        self.application = application
    
    def peer_communication(self):
        """
        """
        if self.check_peer_authentical() == True:
            g_logger.info("Now, the desktop agent will try to connect the super peer")
            
            ###############################################
            #here, we load the necessay information from db
            self.application.login_simulate()
            
            ###############################################
            #check if there are some super peers in peer db,
            #if some are loaded, we will skip this step
            if self.application.peer_manager.super_peers.values() != []:
                print self.application.peer_manager.super_peers.values()

# Path: umit/icm/agent/logger.py
# LOGLEVEL = 'DEBUG'


# Path: umit/icm/agent/super/SuperBehaviourByManual.py
import os
import sys
import time
import socket
from umit.icm.agent.logger import g_logger
from umit.icm.agent.BasePaths import *
from umit.icm.agent.Global import *
from twisted.internet import reactor
        from umit.icm.agent.rpc.message import *
        from umit.icm.agent.rpc.MessageFactory import MessageFactory
        from umit.icm.agent.utils.CreateDB import mod,exp 

# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA




class SuperBehaviourByManual(object):
    """
    """
    def __init__(self,application):
        """
        """
        self.application = application
    
    def peer_communication(self):
        """
        """
        if self.check_peer_authentical() == True:
            g_logger.info("Now, the desktop agent will try to connect the super peer")
            
            ###############################################
            #here, we load the necessay information from db
            self.application.login_simulate()
            
            ###############################################
            #check if there are some super peers in peer db,
            #if some are loaded, we will skip this step
            if self.application.peer_manager.super_peers.values() != []:
                print self.application.peer_manager.super_peers.values()

                g_logger.info("Skip super peer add from superpeer by manual list")