VMware {code} Community
atoka
Contributor
Contributor

Initialization/Startup method for plugin custom java service

Hello,
 
I have a HTML plugin with custom java service. 

HI all,

I have a HTML plugin with custom java service. The HTML plugin is able to properly access the REST end-point exposed by my custom java service.

There are couple of intialization operations that I need to perform when my plugin is loaded. Is there a way to run an initialization method when a custom java service is loaded?

Thanks!

3 Replies
laurentsd
VMware Employee
VMware Employee

Yes, you can have a static block in your service class to perform some initialization.  But 1) you won't have any authenticated session, and 2) that code must be light enough to not delay your bundle deployment.

atoka
Contributor
Contributor

Thank you laurentsd for the response. Yes, the static block will help me with some part of my initialization steps. But, I also have some steps which need session information for all the vCenter Servers in linked-mode. When will these session information be available?

Is the UserSessionService object which is injected to plugin-service only valid for the duration when plugin service is serving request from plugin ui?

Thanks

Reply
0 Kudos
laurentsd
VMware Employee
VMware Employee

The UserSession information is tied to each logged in user so there is no other information available during static initialization.

If you need to initialize something through the plugin that requires a vCenter session  your only choice is to do it when the first user invokes the plugin.

Reply
0 Kudos