Search code examples
javapythonconnectionshared

Java <-> Python: share objects


I have an embedded system using a python interface. Currently the system is using a (system-local) XML-file to persist data in case the system gets turned off. But normally the system is running the entire time. When the system starts, the XML-file is read in and information is stored in python-objects. The information then is used for processing. My aim is to edit this information remotely (over TCP/IP) even during process. I would like to use JAVA to get this done, and i have been thinking about something to share the objects. The problem is, that I'm missing some keywords to find the right technologies to get this done. What i found is SOAP, but i think it is not the right thing for this case, is that true? I'm grateful for any tips.


Solution

  • As I understand, you are using XML file to store start up configuration

    And my assumptions on your interface between Java & Python apps

    • You want your Java application to retrieve objects over Python interface
    • And process them locally and send it back to Python interface to reload config ?

    So, depending on your circumstances, you can workout something with the following

    Jython

    Pickle (if you have no restriction on startup config file format or can afford to do conversion)

    https://pypi.python.org/pypi/Pyro4

    Also you can get some ideas from here: Sharing a complex object between Python processes?