def create_client(self,methods): registry = ServerRegistry.get_instance() try: server = registry.get_server( ServerDirect._SERVER_PREFIX + self.address #ServerDirect._SERVER_PREFIX + self._machine_id + "__" + self._instance_id + "__" + self._server_id ) except RegistryErrors.RegistryError as rex: raise ProtocolErrors.ClientCreationError( ("Registry exception while retrieving server from registry: %s" % rex), rex ) try: client_class = ClientSkel.factory(Protocols.Direct,methods) except Exception as e: raise ProtocolErrors.ClientClassCreationError( ("Client class creation exception: %s" % e), e ) try: return client_class(server) except Exception as e: raise ProtocolErrors.ClientInstanciationError( ("Exception instaciating the client: %s" % e), e )
def create_client(self, methods): try: client_class = ClientSkel.factory(Protocols.UnixSocket,methods) except Exception as e: raise ProtocolErrors.ClientClassCreationError(("Client class creation exception: %s" % e), e) try: return client_class(path=self._path_id) except Exception as e: raise ProtocolErrors.ClientInstanciationError(("Exception instaciating the client: %s" % e), e)
def create_client(self, methods): try: client_class = ClientSkel.factory(Protocols.InternetSocket, methods) except Exception as e: raise ProtocolErrors.ClientClassCreationError(("Client class creation exception: %s" % e), e) try: return client_class(hostname=self.ip_address, port=self.port) except Exception as e: raise ProtocolErrors.ClientInstanciationError(("Unable to instanciate the InternetSocket client: %s" % e),e)
def create_client(self, methods): registry = ServerRegistry.get_instance() try: server = registry.get_server( ServerDirect._SERVER_PREFIX + self.address #ServerDirect._SERVER_PREFIX + self._machine_id + "__" + self._instance_id + "__" + self._server_id ) except RegistryErrors.RegistryError as rex: raise ProtocolErrors.ClientCreationError( ("Registry exception while retrieving server from registry: %s" % rex), rex) try: client_class = ClientSkel.factory(Protocols.Direct, methods) except Exception as e: raise ProtocolErrors.ClientClassCreationError( ("Client class creation exception: %s" % e), e) try: return client_class(server) except Exception as e: raise ProtocolErrors.ClientInstanciationError( ("Exception instaciating the client: %s" % e), e)
def get_client(protocol,methods): return ClientSkel.factory(protocol,methods)
def get_client(protocol, methods): return ClientSkel.factory(protocol, methods)