Inheriting the LiveCycle ES container context in a custom component

Earlier this week, I was working on one of the samples that we will be showing at MAX this year. The idea is to show people how to create a custom component in Java and then deploy it into the LiveCycle ES service container. The sample I needed to create has to be simple and not have any dependencies  on internet access (this is a lab exercise and connectivity at large events is often spotty at best). Anyway, I decided to create a custom component that calls the JobManager API to query what instances might be in the LiveCycle ES server queue.

Just like any other service, I needed to get a handle on the current execution context so that I would use the same security context and connection factory already instantiated within the container. Basically, I need to get the exact same security context of the process that will be calling my component and use it to call JobManager as the calling user might not have permissions to query the LC ES queue. We can’t be bypassing that now can we?

Anyway, after poking around for a while… I could not find any samples or documentation on it. So I talked to some of my resources (thanks Brad) and got the answer. 

JobManager jm = new JobManager(ServiceClientFactory.createInstance());

In the code above, I simply create a new JobManager object and in the constructor arguments, use the ServiceClientFactory.createInstance() call. This will attempt to locate the container’s context and pass it in the the ServiceClientFactory. From there, I can call any JobManager operation knowing that I will use the current user context and not bypass any security rules.


Long title for a simple solution 🙂

Comments Closed

One Response to Inheriting the LiveCycle ES container context in a custom component