As this Java<->Python communication conforms to the OSGi Remote Services specification, everything is completely inter-operable with Declarative Services and/or other frameworks based upon OSGi Services. It will also run in any OSGi R5+ environment, including Eclipse, Karaf, OSGi-based web servers, or other OSGi-based environments.->
Recently, Python 3 has introduced the concept of an Import Hook. An import hook allows the python path and the behavior of the python import statement to be dynamically or extended.
In the most recent version (2.7) of the ECF Py4j Distribution Provider, we use import hooks so that Python module import is resolved by a Java-side OSGi ModuleResolver service. For example, as described in this tutorial, this Python statement
imports the hello.py module as a string loaded from within an OSGi bundle. Among other things, this allows OSGi dynamics to be used to add and remove modules from the python path without stopping and restarting either the Java or the Python processes.from hello import HelloServiceImpl
No comments:
Post a Comment