cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Java extension SDK serialization

jlebourhis1
1-Newbie

Java extension SDK serialization

Hello,

I was working on a cache system for Thingworx, done directly from the java SDK. The matter is that no Thingworx class is Serializable !

Not all classes should be, of course, but all the "result" classes as Infotable (and all needed subclasses) should be.

The other problem is that these classes or the classes they use are often final.

This means that if you want to serialize an Infotable, you have to create an entire set of objects that would be the serializable counterparts of the non serializable Thingworx objects. And that represents a lot of classes !

My question is : Will you make these classes serializable so that we can do stuffs like a cache system without re-coding the entire Thingworx API ??

Thanks a lot !

6 REPLIES 6

Just out of interest, what are you trying to cache and why...?

For instance, a result from a big query in a database.

Just another note to this : The toJSON() and fromJSON functions are not working and we cannot even use them for an infotable...

mhollenbach
5-Regular Member
(To:jlebourhis1)

JeanBriac,

Are you trying to use the Java SDK or create a Java Extension? What version of either of these are you using?

Regards,

Meghan

Hello Meghan,

To be sure to talk about the same thing as you :

I was not doing this with the Thingworx java sdk comming from the market.

I was attempting to do it with a Thingworx java extension using the thingorx java api (downloadable from the support) and an external caching library.

When you look at the api, none of the objects are serializable.

And when you try to use the JSON methods that could have been used, these classes return null...

Hello JeanBriac,

Even if this doesn't answer your question, I tried using Infotable.ToJSON(); in 6.6.2 and it works OK, returning a nice JSON.

Beware that there are 2 snippets: One is a resource (didn't use it) and one is an Infotable method (this is the one I used.)

BR,

Vladi

Top Tags