コード例 #1
0
ファイル: protocol_udp.py プロジェクト: targeted/pythomnic3k
    def __init__(self, name: str, *,
                 server_address: (str, int),
                 broadcast: bool):

        TransactionalResource.__init__(self, name)

        self._server_address = server_address
        self._broadcast = broadcast

        self._server_info = "{0:s} udp://{1[0]:s}:{1[1]:d}".\
                            format(name, self._server_address)
コード例 #2
0
ファイル: protocol_jms.py プロジェクト: targeted/pythomnic3k
    def __init__(self, name: str, *,
                 java: os_path.isfile,
                 arguments: tuple_of(str),
                 classpath: str,
                 jndi: dict_of(str, str),
                 factory: str,
                 queue: str,
                 username: str,
                 password: str):

        TransactionalResource.__init__(self, name)
        AdapterHost.__init__(self, "org.pythomnic.jms.Sender",
                             java = java, arguments = arguments, classpath = classpath,
                             jndi = jndi, factory = factory, queue = queue,
                             username = username, password = password)
        self._request_count = 0
コード例 #3
0
    def __init__(self, name: str, *,
                 target_directory: optional(str) = None,
                 temp_directory: optional(str) = None,
                 temp_extension: str,
                 file_permissions: by_regex("^(?:[r-][w-][x-]){3}$")):

        TransactionalResource.__init__(self, name)

        self._target_directory = target_directory
        self._temp_directory = temp_directory
        self._temp_suffix = ".{0:s}".format(temp_extension)

        self._perm_mask = 0
        for i, perm_flag in enumerate((S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP,
                                       S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH)):
            if file_permissions[i] != "-":
                self._perm_mask |= perm_flag
コード例 #4
0
    def __init__(self,
                 name: str,
                 *,
                 server_address: (str, int),
                 connect_timeout: float,
                 database: valid_database,
                 username: optional(str) = None,
                 password: optional(str) = None):

        TransactionalResource.__init__(self, name)
        self._server_address = server_address
        self._connect_timeout = connect_timeout
        self._database = database
        self._username = username
        self._connection = MongoDB_Connection(server_address=server_address,
                                              auth_database=database,
                                              username=username,
                                              password=password)
コード例 #5
0
ファイル: protocol_smpp.py プロジェクト: targeted/pythomnic3k
    def __init__(self, name: str, *,
                 source_addr_ton: byte,
                 source_addr_npi: byte,
                 source_addr: str,
                 asynchronous: bool,
                 pack_7bit: optional(bool) = None,
                 frag_method: optional(one_of("sar", "udh")) = None):

        TransactionalResource.__init__(self, name)

        self._interface_name = name.split("/", 1)[0]
        self._source_addr_ton = source_addr_ton
        self._source_addr_npi = source_addr_npi
        self._source_addr = source_addr
        self._asynchronous = asynchronous
        self._pack_7bit = pack_7bit or False
        self._frag_method = frag_method

        self._interface = None
コード例 #6
0
    def __init__(self,
                 name,
                 *,
                 server_address: (str, int),
                 connect_timeout: float,
                 ssl_key_cert_file: optional(os_path.isfile),
                 ssl_ca_cert_file: optional(os_path.isfile),
                 ssl_ciphers: optional(str) = None,
                 ssl_protocol: optional(
                     one_of("SSLv23", "TLSv1", "TLSv1_1", "TLSv1_2",
                            "TLS")) = None,
                 ssl_server_hostname: optional(str) = None,
                 ssl_ignore_hostname: optional(bool) = False,
                 extra_headers: dict_of(str, str),
                 http_version: str,
                 server_uri: str,
                 request_encoding: str,
                 allow_none: optional(bool) = False):

        TransactionalResource.__init__(self, name)

        self._server_uri = server_uri
        self._request_encoding = request_encoding
        self._allow_none = allow_none

        self._http_resource = \
            pmnc.protocol_http.Resource(name,
                                        server_address = server_address,
                                        connect_timeout = connect_timeout,
                                        ssl_key_cert_file = ssl_key_cert_file,
                                        ssl_ca_cert_file = ssl_ca_cert_file,
                                        ssl_ciphers = ssl_ciphers,
                                        ssl_protocol = ssl_protocol,
                                        ssl_server_hostname = ssl_server_hostname,
                                        ssl_ignore_hostname = ssl_ignore_hostname,
                                        extra_headers = extra_headers,
                                        http_version = http_version)
コード例 #7
0
 def __init__(self, name: str, **config):
     TransactionalResource.__init__(self, name)
     self._connect = config.pop("connect", self._noop)
     self._disconnect = config.pop("disconnect", self._noop)
     self._config = config
コード例 #8
0
 def __init__(self, name: str, **config):
     TransactionalResource.__init__(self, name)
     self._connect = config.pop("connect", self._noop)
     self._disconnect = config.pop("disconnect", self._noop)
     self._config = config