Esempio n. 1
0
    def _export_service(self, svc, ed):
        # pylint: disable=W0212
        # modify svc class to have appropriate metadata for py4j
        timeout = ed.get_osgi_basic_timeout()
        if not timeout:
            timeout = 30

        args = [
            self._get_distribution_provider()._get_bridge(),
            ed.get_interfaces(),
            svc,
            self._executor,
            timeout,
        ]

        if (
            ECF_PY4JPB_PYTHON_HOST_CONFIG_TYPE
            in ed.get_remote_configs_supported()
        ):
            clazz = ProtobufPythonService
        else:
            clazz = PythonService

        psvc = clazz(*args)

        self._get_distribution_provider()._get_bridge().export(
            psvc, ed.get_properties()
        )
        ExportContainer._export_service(self, psvc, ed)
        return True
Esempio n. 2
0
File: py4j.py Progetto: pisua/yblues
    def _export_service(self, svc, ed):
        # pylint: disable=W0212
        # modify svc class to have appropriate metadata for py4j
        timeout = ed.get_osgi_basic_timeout()
        if not timeout:
            timeout = 30

        args = [
            self._get_distribution_provider()._get_bridge(),
            ed.get_interfaces(),
            svc,
            self._executor,
            timeout,
        ]

        if (
            ECF_PY4JPB_PYTHON_HOST_CONFIG_TYPE
            in ed.get_remote_configs_supported()
        ):
            clazz = ProtobufPythonService
        else:
            clazz = PythonService

        psvc = clazz(*args)

        self._get_distribution_provider()._get_bridge().export(
            psvc, ed.get_properties()
        )
        ExportContainer._export_service(self, psvc, ed)
        return True
Esempio n. 3
0
File: py4j.py Progetto: pisua/yblues
 def _unexport_service(self, ed):
     # pylint: disable=W0212
     dp = self._get_distribution_provider()
     if dp:
         bridge = dp._get_bridge()
         if bridge:
             bridge.unexport(ed.get_id())
     ExportContainer._unexport_service(self, ed)
     return True
Esempio n. 4
0
 def _unexport_service(self, ed):
     # pylint: disable=W0212
     dp = self._get_distribution_provider()
     if dp:
         bridge = dp._get_bridge()
         if bridge:
             bridge.unexport(ed.get_id())
     ExportContainer._unexport_service(self, ed)
     return True
Esempio n. 5
0
 def _invalidate_component(self, bundle_context):
     # pylint: disable=W0212
     """
     First invalidate by unregistering the servlet/dispatcher,
     and then call super._invalidate
     """
     try:
         dp = self._get_distribution_provider()
         dp._httpservice.unregister(dp._uri_path)
         ExportContainer._invalidate_component(self, bundle_context)
     except:
         pass
Esempio n. 6
0
 def _validate_component(self, bundle_context, container_props):
     # pylint: disable=W0212
     ExportContainer._validate_component(self, bundle_context,
                                         container_props)
     timeout = container_props.get(ECF_XMLRPC_TIMEOUT_PROP, None)
     dp = self._get_distribution_provider()
     if Executor:
         executor = ThreadPoolExecutor(max_workers=5)
     else:
         executor = None
     # register the ServerDispatcher instance our uri_path
     dp._httpservice.register_servlet(
         dp._uri_path,
         ServerDispatcher(self._dispatch_exported, timeout, executor),
     )
Esempio n. 7
0
File: py4j.py Progetto: pisua/yblues
 def get_connected_id(self):
     return ExportContainer.get_connected_id(self)
Esempio n. 8
0
File: py4j.py Progetto: pisua/yblues
 def __init__(self, max_workers=5):
     ExportContainer.__init__(self)
     ImportContainer.__init__(self)
     self._max_workers = max_workers
     self._executor = None
Esempio n. 9
0
 def get_connected_id(self):
     return ExportContainer.get_connected_id(self)
Esempio n. 10
0
 def __init__(self, max_workers=5):
     ExportContainer.__init__(self)
     ImportContainer.__init__(self)
     self._max_workers = max_workers
     self._executor = None