コード例 #1
0
    def transport_mqttrpc(self):
        """
        Installs the MQTT-RPC transport bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle("pelix.remote.transport.mqtt_rpc").start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(
                rs.FACTORY_TRANSPORT_MQTTRPC_EXPORTER,
                "pelix-mqttrpc-exporter",
                {
                    "mqtt.host": self.arguments.mqtt_host,
                    "mqtt.port": self.arguments.mqtt_port,
                },
            )
            ipopo.add(
                rs.FACTORY_TRANSPORT_MQTTRPC_IMPORTER,
                "pelix-mqttrpc-importer",
                {
                    "mqtt.host": self.arguments.mqtt_host,
                    "mqtt.port": self.arguments.mqtt_port,
                },
            )
コード例 #2
0
ファイル: run_remote.py プロジェクト: tcalmant/ipopo
    def transport_mqttrpc(self):
        """
        Installs the MQTT-RPC transport bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle("pelix.remote.transport.mqtt_rpc").start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(
                rs.FACTORY_TRANSPORT_MQTTRPC_EXPORTER,
                "pelix-mqttrpc-exporter",
                {
                    "mqtt.host": self.arguments.mqtt_host,
                    "mqtt.port": self.arguments.mqtt_port,
                },
            )
            ipopo.add(
                rs.FACTORY_TRANSPORT_MQTTRPC_IMPORTER,
                "pelix-mqttrpc-importer",
                {
                    "mqtt.host": self.arguments.mqtt_host,
                    "mqtt.port": self.arguments.mqtt_port,
                },
            )
コード例 #3
0
ファイル: run_http.py プロジェクト: debbabi/cohorte-herald
def main(http_port, peer_name, node_name, app_id):
    """
    Runs the framework

    :param http_port: HTTP port to listen to
    :param peer_name: Name of the peer
    :param node_name: Name (also, UID) of the node hosting the peer
    :param app_id: Application ID
    """
    # Create the framework
    framework = pelix.framework.create_framework(
        ('pelix.ipopo.core',
         'pelix.ipopo.waiting',
         'pelix.shell.core',
         'pelix.shell.ipopo',
         'pelix.shell.console',
         'pelix.http.basic',

         # Herald core
         'herald.core',
         'herald.directory',
         'herald.shell',

         # Herald HTTP
         'herald.transports.http.directory',
         'herald.transports.http.discovery_multicast',
         'herald.transports.http.servlet',
         'herald.transports.http.transport',

         # RPC
         'pelix.remote.dispatcher',
         'pelix.remote.registry',
         'herald.remote.discovery',
         'herald.remote.herald_xmlrpc',),
        {herald.FWPROP_NODE_UID: node_name,
         herald.FWPROP_NODE_NAME: node_name,
         herald.FWPROP_PEER_NAME: peer_name,
         herald.FWPROP_APPLICATION_ID: app_id})

    # Start everything
    framework.start()
    context = framework.get_bundle_context()

    # Instantiate components
    with use_waiting_list(context) as ipopo:
        # ... HTTP server
        ipopo.add(pelix.http.FACTORY_HTTP_BASIC, "http-server",
                  {pelix.http.HTTP_SERVICE_PORT: http_port})

        # ... HTTP reception servlet
        ipopo.add(herald.transports.http.FACTORY_SERVLET,
                  "herald-http-servlet")

        # ... HTTP multicast discovery
        ipopo.add(herald.transports.http.FACTORY_DISCOVERY_MULTICAST,
                  "herald-http-discovery-multicast")

    # Start the framework and wait for it to stop
    framework.wait_for_stop()
コード例 #4
0
def main(xmpp_server, xmpp_port, peer_name, node_name, app_id,
         xmpp_jid=None, xmpp_password=None):
    """
    Runs the framework

    :param xmpp_server: Address of the XMPP server
    :param xmpp_port: Port of the XMPP server
    :param peer_name: Name of the peer
    :param node_name: Name (also, UID) of the node hosting the peer
    :param app_id: Application ID
    :param xmpp_jid: XMPP JID, None for Anonymous login
    :param xmpp_password: XMPP account password
    """
    # Create the framework
    framework = pelix.framework.create_framework(
        ('pelix.ipopo.core',
         'pelix.ipopo.waiting',
         'pelix.shell.core',
         'pelix.shell.ipopo',
         'pelix.shell.console',

         # Herald core
         'herald.core',
         'herald.directory',
         'herald.shell',

         # Herald XMPP
         'herald.transports.xmpp.directory',
         'herald.transports.xmpp.transport',

         # RPC
         'pelix.remote.dispatcher',
         'pelix.remote.registry',
         'herald.remote.discovery',
         'herald.remote.herald_xmlrpc',),
        {herald.FWPROP_NODE_UID: node_name,
         herald.FWPROP_NODE_NAME: node_name,
         herald.FWPROP_PEER_NAME: peer_name,
         herald.FWPROP_APPLICATION_ID: app_id})
    context = framework.get_bundle_context()

    # Start everything
    framework.start()

    # Instantiate components
    with use_waiting_list(context) as ipopo:
        # ... XMPP Transport
        ipopo.add(herald.transports.xmpp.FACTORY_TRANSPORT,
                  "herald-xmpp-transport",
                  {herald.transports.xmpp.PROP_XMPP_SERVER: xmpp_server,
                   herald.transports.xmpp.PROP_XMPP_PORT: xmpp_port,
                   herald.transports.xmpp.PROP_XMPP_JID: xmpp_jid,
                   herald.transports.xmpp.PROP_XMPP_PASSWORD: xmpp_password})

    # Start the framework and wait for it to stop
    framework.wait_for_stop()
コード例 #5
0
def main(xmpp_server, xmpp_port, peer_name, node_name, app_id,
         xmpp_jid=None, xmpp_password=None):
    """
    Runs the framework

    :param xmpp_server: Address of the XMPP server
    :param xmpp_port: Port of the XMPP server
    :param peer_name: Name of the peer
    :param node_name: Name (also, UID) of the node hosting the peer
    :param app_id: Application ID
    :param xmpp_jid: XMPP JID, None for Anonymous login
    :param xmpp_password: XMPP account password
    """
    # Create the framework
    framework = pelix.framework.create_framework(
        ('pelix.ipopo.core',
         'pelix.ipopo.waiting',
         'pelix.shell.core',
         'pelix.shell.ipopo',
         'pelix.shell.console',

         # Herald core
         'herald.core',
         'herald.directory',
         'herald.shell',

         # Herald XMPP
         'herald.transports.xmpp.directory',
         'herald.transports.xmpp.transport',

         # RPC
         'pelix.remote.dispatcher',
         'pelix.remote.registry',
         'herald.remote.discovery',
         'herald.remote.herald_xmlrpc',),
        {herald.FWPROP_NODE_UID: node_name,
         herald.FWPROP_NODE_NAME: node_name,
         herald.FWPROP_PEER_NAME: peer_name,
         herald.FWPROP_APPLICATION_ID: app_id})
    context = framework.get_bundle_context()

    # Start everything
    framework.start()

    # Instantiate components
    with use_waiting_list(context) as ipopo:
        # ... XMPP Transport
        ipopo.add(herald.transports.xmpp.FACTORY_TRANSPORT,
                  "herald-xmpp-transport",
                  {herald.transports.xmpp.PROP_XMPP_SERVER: xmpp_server,
                   herald.transports.xmpp.PROP_XMPP_PORT: xmpp_port,
                   herald.transports.xmpp.PROP_XMPP_JID: xmpp_jid,
                   herald.transports.xmpp.PROP_XMPP_PASSWORD: xmpp_password})

    # Start the framework and wait for it to stop
    framework.wait_for_stop()
コード例 #6
0
    def discovery_multicast(self):
        """
        Installs the multicast discovery bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle('pelix.remote.discovery.multicast').start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(rs.FACTORY_DISCOVERY_MULTICAST,
                      "pelix-discovery-multicast")
コード例 #7
0
ファイル: run_remote.py プロジェクト: ahmadshahwan/ipopo
    def discovery_multicast(self):
        """
        Installs the multicast discovery bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle('pelix.remote.discovery.multicast').start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(rs.FACTORY_DISCOVERY_MULTICAST,
                      "pelix-discovery-multicast")
コード例 #8
0
ファイル: run_remote.py プロジェクト: tcalmant/ipopo
    def discovery_mdns(self):
        """
        Installs the mDNS discovery bundles and instantiates components
        """
        # Remove Zeroconf debug output
        logging.getLogger("zeroconf").setLevel(logging.WARNING)

        # Install the bundle
        self.context.install_bundle("pelix.remote.discovery.mdns").start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(rs.FACTORY_DISCOVERY_ZEROCONF, "pelix-discovery-zeroconf")
コード例 #9
0
ファイル: run_remote.py プロジェクト: ahmadshahwan/ipopo
    def transport_xmlrpc(self):
        """
        Installs the XML-RPC transport bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle('pelix.remote.xml_rpc').start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(rs.FACTORY_TRANSPORT_XMLRPC_EXPORTER,
                      "pelix-xmlrpc-exporter")
            ipopo.add(rs.FACTORY_TRANSPORT_XMLRPC_IMPORTER,
                      "pelix-xmlrpc-importer")
コード例 #10
0
ファイル: run_remote.py プロジェクト: ahmadshahwan/ipopo
    def discovery_mqtt(self):
        """
        Installs the MQTT discovery bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle('pelix.remote.discovery.mqtt').start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(rs.FACTORY_DISCOVERY_MQTT, "pelix-discovery-mqtt",
                      {"application.id": "sample.rs",
                       "mqtt.host": self.arguments.mqtt_host,
                       "mqtt.port": self.arguments.mqtt_port})
コード例 #11
0
    def transport_jsonrpc(self):
        """
        Installs the JSON-RPC transport bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle("pelix.remote.json_rpc").start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(rs.FACTORY_TRANSPORT_JSONRPC_EXPORTER,
                      "pelix-jsonrpc-exporter")
            ipopo.add(rs.FACTORY_TRANSPORT_JSONRPC_IMPORTER,
                      "pelix-jsonrpc-importer")
コード例 #12
0
    def transport_xmlrpc(self):
        """
        Installs the XML-RPC transport bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle('pelix.remote.xml_rpc').start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(rs.FACTORY_TRANSPORT_XMLRPC_EXPORTER,
                      "pelix-xmlrpc-exporter")
            ipopo.add(rs.FACTORY_TRANSPORT_XMLRPC_IMPORTER,
                      "pelix-xmlrpc-importer")
コード例 #13
0
ファイル: run_remote.py プロジェクト: ahmadshahwan/ipopo
    def transport_jabsorbrpc(self):
        """
        Installs the JABSORB-RPC transport bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle('pelix.remote.transport.jabsorb_rpc') \
            .start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(rs.FACTORY_TRANSPORT_JABSORBRPC_EXPORTER,
                      "pelix-jabsorbrpc-exporter")
            ipopo.add(rs.FACTORY_TRANSPORT_JABSORBRPC_IMPORTER,
                      "pelix-jabsorbrpc-importer")
コード例 #14
0
    def discovery_mdns(self):
        """
        Installs the mDNS discovery bundles and instantiates components
        """
        # Remove Zeroconf debug output
        logging.getLogger("zeroconf").setLevel(logging.WARNING)

        # Install the bundle
        self.context.install_bundle('pelix.remote.discovery.mdns').start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(rs.FACTORY_DISCOVERY_ZEROCONF,
                      "pelix-discovery-zeroconf")
コード例 #15
0
    def transport_jabsorbrpc(self):
        """
        Installs the JABSORB-RPC transport bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle('pelix.remote.transport.jabsorb_rpc') \
            .start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(rs.FACTORY_TRANSPORT_JABSORBRPC_EXPORTER,
                      "pelix-jabsorbrpc-exporter")
            ipopo.add(rs.FACTORY_TRANSPORT_JABSORBRPC_IMPORTER,
                      "pelix-jabsorbrpc-importer")
コード例 #16
0
    def discovery_mqtt(self):
        """
        Installs the MQTT discovery bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle('pelix.remote.discovery.mqtt').start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(
                rs.FACTORY_DISCOVERY_MQTT, "pelix-discovery-mqtt", {
                    "application.id": "sample.rs",
                    "mqtt.host": self.arguments.mqtt_host,
                    "mqtt.port": self.arguments.mqtt_port
                })
コード例 #17
0
ファイル: run_remote.py プロジェクト: matthieucan/ipopo
    def discovery_zookeeper(self):
        """
        Installs the ZooKeeper discovery bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle('pelix.remote.discovery.zookeeper').start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(
                rs.FACTORY_DISCOVERY_ZOOKEEPER, "pelix-discovery-zookeeper", {
                    "application.id": "sample.rs",
                    "zookeeper.hosts": self.arguments.zk_hosts,
                    "zookeeper.prefix": self.arguments.zk_prefix
                })
コード例 #18
0
ファイル: run_remote.py プロジェクト: matthieucan/ipopo
    def discovery_redis(self):
        """
        Installs the Redis discovery bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle('pelix.remote.discovery.redis').start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(
                rs.FACTORY_DISCOVERY_REDIS, "pelix-discovery-redis", {
                    "application.id": "sample.rs",
                    "redis.host": self.arguments.redis_host,
                    "redis.port": self.arguments.redis_port
                })
コード例 #19
0
ファイル: run_remote.py プロジェクト: tcalmant/ipopo
    def transport_jsonrpc(self):
        """
        Installs the JSON-RPC transport bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle("pelix.remote.json_rpc").start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(
                rs.FACTORY_TRANSPORT_JSONRPC_EXPORTER, "pelix-jsonrpc-exporter"
            )
            ipopo.add(
                rs.FACTORY_TRANSPORT_JSONRPC_IMPORTER, "pelix-jsonrpc-importer"
            )
コード例 #20
0
ファイル: run_remote.py プロジェクト: tcalmant/ipopo
    def discovery_redis(self):
        """
        Installs the Redis discovery bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle("pelix.remote.discovery.redis").start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(
                rs.FACTORY_DISCOVERY_REDIS,
                "pelix-discovery-redis",
                {
                    "application.id": "sample.rs",
                    "redis.host": self.arguments.redis_host,
                    "redis.port": self.arguments.redis_port,
                },
            )
コード例 #21
0
ファイル: run_remote.py プロジェクト: tcalmant/ipopo
    def discovery_zookeeper(self):
        """
        Installs the ZooKeeper discovery bundles and instantiates components
        """
        # Install the bundle
        self.context.install_bundle("pelix.remote.discovery.zookeeper").start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(
                rs.FACTORY_DISCOVERY_ZOOKEEPER,
                "pelix-discovery-zookeeper",
                {
                    "application.id": "sample.rs",
                    "zookeeper.hosts": self.arguments.zk_hosts,
                    "zookeeper.prefix": self.arguments.zk_prefix,
                },
            )
コード例 #22
0
def main(http_port, peer_name, node_name, app_id):
    """
    Runs the framework

    :param http_port: HTTP port to listen to
    :param peer_name: Name of the peer
    :param node_name: Name (also, UID) of the node hosting the peer
    :param app_id: Application ID
    """
    # Create the framework
    framework = pelix.framework.create_framework(
        (
            'pelix.ipopo.core',
            'pelix.ipopo.waiting',
            'pelix.shell.core',
            'pelix.shell.ipopo',
            'pelix.shell.console',
            'pelix.http.basic',

            # Herald core
            'herald.core',
            'herald.directory',
            'herald.shell',

            # Herald HTTP
            'herald.transports.http.directory',
            'herald.transports.http.discovery_multicast',
            'herald.transports.http.servlet',
            'herald.transports.http.transport',

            # RPC
            'pelix.remote.dispatcher',
            'pelix.remote.registry',
            'herald.remote.discovery',
            'herald.remote.herald_xmlrpc',
        ),
        {
            herald.FWPROP_NODE_UID: node_name,
            herald.FWPROP_NODE_NAME: node_name,
            herald.FWPROP_PEER_NAME: peer_name,
            herald.FWPROP_APPLICATION_ID: app_id
        })

    # Start everything
    framework.start()
    context = framework.get_bundle_context()

    # Instantiate components
    with use_waiting_list(context) as ipopo:
        # ... HTTP server
        ipopo.add(pelix.http.FACTORY_HTTP_BASIC, "http-server",
                  {pelix.http.HTTP_SERVICE_PORT: http_port})

        # ... HTTP reception servlet
        ipopo.add(herald.transports.http.FACTORY_SERVLET,
                  "herald-http-servlet")

        # ... HTTP multicast discovery
        ipopo.add(herald.transports.http.FACTORY_DISCOVERY_MULTICAST,
                  "herald-http-discovery-multicast")

    # Start the framework and wait for it to stop
    framework.wait_for_stop()
コード例 #23
0
def main(is_server, discoveries, transports, http_port, other_arguments):
    """
    Runs the framework

    :param is_server: If True, starts the provider bundle,
                      else the consumer one
    :param discoveries: List of discovery protocols
    :param transports: List of RPC protocols
    :param http_port: Port of the HTTP server
    :param other_arguments: Other arguments
    """
    # Create the framework
    framework = pelix.framework.create_framework(
        (
            'pelix.ipopo.core',
            'pelix.ipopo.waiting',
            # Shell
            'pelix.shell.core',
            'pelix.shell.ipopo',
            'pelix.shell.console',
            # HTTP Service
            "pelix.http.basic",
            # Remote Services (core)
            'pelix.remote.dispatcher',
            'pelix.remote.registry'),
        # Framework properties
        {pelix.constants.FRAMEWORK_UID: other_arguments.fw_uid})

    # Start everything
    framework.start()
    context = framework.get_bundle_context()

    # Instantiate components
    # Get the iPOPO service
    with use_waiting_list(context) as ipopo:
        # Instantiate remote service components
        # ... HTTP server
        ipopo.add("pelix.http.service.basic.factory", "http-server",
                  {"pelix.http.port": http_port})

        # ... servlet giving access to the registry
        ipopo.add(rs.FACTORY_REGISTRY_SERVLET,
                  "pelix-remote-dispatcher-servlet")

    # Prepare the utility object
    util = InstallUtils(context, other_arguments)

    # Install the discovery bundles
    for discovery in discoveries:
        getattr(util, "discovery_{0}".format(discovery))()

    # Install the transport bundles
    for transport in transports:
        getattr(util, "transport_{0}".format(transport))()

    # Start the service provider or consumer
    if is_server:
        # ... the provider
        context.install_bundle("remote.provider").start()

    else:
        # ... or the consumer
        context.install_bundle("remote.consumer").start()

    # Start the framework and wait for it to stop
    framework.wait_for_stop()
コード例 #24
0
ファイル: run_remote.py プロジェクト: ahmadshahwan/ipopo
def main(is_server, discoveries, transports, http_port, other_arguments):
    """
    Runs the framework

    :param is_server: If True, starts the provider bundle,
                      else the consumer one
    :param discoveries: List of discovery protocols
    :param transports: List of RPC protocols
    :param http_port: Port of the HTTP server
    :param other_arguments: Other arguments
    """
    # Create the framework
    framework = pelix.framework.create_framework(
        ('pelix.ipopo.core',
         'pelix.ipopo.waiting',
         # Shell
         'pelix.shell.core',
         'pelix.shell.ipopo',
         'pelix.shell.console',
         # HTTP Service
         "pelix.http.basic",
         # Remote Services (core)
         'pelix.remote.dispatcher',
         'pelix.remote.registry'),
        # Framework properties
        {pelix.constants.FRAMEWORK_UID: other_arguments.fw_uid})

    # Start everything
    framework.start()
    context = framework.get_bundle_context()

    # Instantiate components
    # Get the iPOPO service
    with use_waiting_list(context) as ipopo:
        # Instantiate remote service components
        # ... HTTP server
        ipopo.add("pelix.http.service.basic.factory", "http-server",
                  {"pelix.http.address": "0.0.0.0",
                   "pelix.http.port": http_port})

        # ... servlet giving access to the registry
        ipopo.add(rs.FACTORY_REGISTRY_SERVLET,
                  "pelix-remote-dispatcher-servlet")

    # Prepare the utility object
    util = InstallUtils(context, other_arguments)

    # Install the discovery bundles
    for discovery in discoveries:
        getattr(util, "discovery_{0}".format(discovery))()

    # Install the transport bundles
    for transport in transports:
        getattr(util, "transport_{0}".format(transport))()

    # Start the service provider or consumer
    if is_server:
        # ... the provider
        context.install_bundle("remote.provider").start()

    else:
        # ... or the consumer
        context.install_bundle("remote.consumer").start()

    # Start the framework and wait for it to stop
    framework.wait_for_stop()