def __init__( self, services ): if type( services ) in ( types.StringType, types.UnicodeType ): services = [ services ] self.__services = {} self.__alive = True self.__listeningConnections = {} self.__stats = ReactorStats() for serviceName in services: while serviceName[0] == "/": serviceName = serviceName[1:] if serviceName == GatewayService.GATEWAY_NAME: self.__services[ serviceName ] = GatewayService() else: self.__services[ serviceName ] = Service( serviceName )
def initialize(self, servicesList): try: servicesList.remove(GatewayService.GATEWAY_NAME) self.__services[GatewayService.GATEWAY_NAME] = GatewayService() except ValueError: # No GW in the service list pass result = self.__loader.loadModules(servicesList) if not result['OK']: return result self.__serviceModules = self.__loader.getModules() for serviceName in self.__serviceModules: self.__services[serviceName] = Service(self.__serviceModules[serviceName]) # Loop again to include the GW in case there is one (included in the __init__) for serviceName in self.__services: gLogger.info("Initializing %s" % serviceName) result = self.__services[serviceName].initialize() if not result['OK']: return result return S_OK()
def __init__( self ): Service.__init__( self, GatewayService.GATEWAY_NAME ) self.__delegatedCredentials = DictCache() self.__transferBytesLimit = 1024 * 1024 * 100