accessing java object saved in hazelcast from python - java

In our application, we are saving data in hz maps from a java app and down the line a python app needs to access that data. Data is saved in object form. How can we access these java objects from python module.
Thanks in advance

You need to implement one of IdentifiedSerializable or Portable serialization methods for your classes on both side.
And see this for python serialization.

Related

How to retrieve real-time data from an existing Java application without access to source code?

Update: Jun 10, 2022
I have successfully been able to create a demo application with AspectJ integration that could extract variables from the demo application. It was quite a hassle since there's a bit of trouble going on with Eclipse AJDT integration.
I was able to use CLI Java and ajc (AspectJ compiler) to achieve binary weaving into my demo application.
Original Question:
I am trying to retrieve real-time data from a running Java application and push it into an API I have on a server.|
I have no access to the source code of the running application; I only have the Jar file. I have tried decompilation into .java files; however, due to the scale of the app, I was not able to fix all of the missing access$000 function calls.
Is there a certain approach I should use when retrieving real-time data from an existing Java application? Has that been done before? Am I missing something that I am not aware of?
Any help is appreciated.
This is big challenge obviously. If you can glean enough understanding of how the program works from decompiling and reading log files to target some methods where you suspect there's data of interest to your API, then I would read up about Aspect Oriented Programming [AOP] and use those tools.
With AOP you can modify the classes in the jar file at runtime as its loaded by the JVM and access the classes.
For example: You can gather data from:
fields within the class that owns a method
parameters passed to a method
value returned from a method
Once you gather the data, you can also insert calls to your API.
Here's a place to start - https://www.baeldung.com/aspectj .

Reading shared variables from LabView in Java/Android

I have a shared variable in LabView and I want to read it on my Android application written in Java. Does anybody know how could I do it?
As stated by some other users, NI's Shared Variable interface is proprietary, and is only supported through using their products. However, there are a few workarounds I can think of:
If there is a LabVIEW or TestStand instance generating the values for the shared variables, you could send the data via UDP or TCP directly to the java application, instead of, or in addition to, writing to the variables.
You are able to tie Shared Variables to OPC variables within the NI software. This requires having an OPC server to write these values to (Which NI also has-it's a re-skin of Kepware), but there are many options for reading OPC variables using Java.
Basic file I/O, as also previously mentioned, could be possible depending on the system layout.
With LabVIEW you can deploy RESTful web services which will execute specific VI's upon receiving requests. You may be able to leverage these to retrieve the values of the shared variables you are targeting.
I suggest your best bet is to write the value out to a file using LabVIEW and read it in JAVA or open an network connection/RabbitMQ pipe between the two applications.

ObjectInput/OutputStream from Java to Android

I'm developing a Java SE application that does save its content as a Serializable object through a ObjectOutputStream.
My question is, reading a ObjectInputStream in a Android native app will correctly load the content?
And plus: there's another simple way to save data structures (that supports modification of the model classes)?
Yes.
There are many, such as XML beans, JSON, etc, but you should also be aware that Serialization supports extensive versioning facilities as well ('modification of classes'). There's a whole chapter about it in the Object Serialization Specification.

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.
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?
You should ask your python application to open a XML-RPC socket which clients can connect on. This could let an outside application to execute an endpoint, which would manipulate your python object values in someway. There are several good choices for Java XML-RPC libraries, including the amazing org.apache.xmlrpc library.

Sharing or Sending complex Data to Coldfusion From Java

I am writing JavaClass which reads Excel files and it creates a Collection object.
What will be the best possible options to pass a Structure from Java to Coldfusion?
Have the java class return a java.util.Map. CF will automatically convert it to a structure which can be used with any of the CF structure functions.
That said, Craig makes a good point. If you are using CF9 or Railo, both have spreadsheet functions available. You might want to investigate using those rather than rolling your own.

Categories