Skip to main content

Listener of a well behaved OCAP application

2 replies [Last post]
say_ocap
Offline
Joined: 2010-08-19
Points: 0

I have some questions on OCAP Well-Behaved Applications.I understand that like any other well behaved listener,OCAP application listener should not block.
1. Listener would be called from implementation's execution context
2. Any call made by the application from the event listener code would be also in implementation's execution context and not the application's context.
As per above two statements, the implementation identifies the caller (in this case the OCAP application) based on the caller's context, then caller's context will be incorrect if call is made directly from the event listener callaback.

example
1. OCAP application registers for ServiceContext events.
2. Implementation calls receiceServiceContext() of the application.
3. Application calls a OCAP API (example getServiceContentHandlers())in turn

i.e
public void receiceServiceContext(ServiceContextEvent event) //OCAP app
{
context.getServiceContentHandlers();
}

Now for the implementation, getServiceContentHandlers() is called in implementation's execution context and not in applications's context even though it's the application which is making the call.

What is the expected behaviour here?
1. OCAP Application listener should take care to make the calls from it's own context?How?
2. Should implementation be identifying the API caller without using the context?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
greg80303
Offline
Joined: 2008-07-03
Points: 0

OCAP middleware implementations must ensure that any threads sent through application code execute in that application's context. Any listener methods that your application has registered is free to call back into the stack upon invocation. Your call will be granted all the permissions and privileges of your application.

G

say_ocap
Offline
Joined: 2010-08-19
Points: 0

Hi greg80303 ,
Thanks for your reply.My doubts are resolved.