VMware Cloud Community
yatigammanabnd
Enthusiast
Enthusiast
Jump to solution

Can I pass a Vc Scripting object to my Java Plugin (without having to serialize/deserialize it)?

In my plugin, I have a method on one of my scripting objects that use the attributes of different ManagedObjects (Vc Scripting objects), e.g: the name and type of a Folder and Datastore ManagedObjects.

Is there a way I can use the Objects as is within my plugin? Because it would be nicer to just use a VcManagedObject within my plugin rather than what I am currently doing:

I extract the name, type and sdkId from these different managed objects to create a custom JSONobject, that is then serialized. Then within the method of my scripting object, it deserializes it (via Gson) into a custom "SimpleManagedObject" class I have created within my plugin.

Any thoughts?

Thanks

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Well, usually it is not a good idea for a plug-in to rely on Java stuff provided by another plug-in (like directly using its scripting objects). Plug-in implementations may change over time and this will break all other plug-ins if they were dependent on the changed plug-in internals; for example, this was exactly the case with vCenter plug-in which got completely different implementation in vRO 7.3 and this caused some issues with another plug-in that expected certain Java classes/packages to be there.

View solution in original post

2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Well, usually it is not a good idea for a plug-in to rely on Java stuff provided by another plug-in (like directly using its scripting objects). Plug-in implementations may change over time and this will break all other plug-ins if they were dependent on the changed plug-in internals; for example, this was exactly the case with vCenter plug-in which got completely different implementation in vRO 7.3 and this caused some issues with another plug-in that expected certain Java classes/packages to be there.

yatigammanabnd
Enthusiast
Enthusiast
Jump to solution

That makes sense. I'll stick with my serializing/deserializing approach then 😃

0 Kudos