You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Aaron Whiteside (JIRA)" <ji...@apache.org> on 2013/03/06 17:26:13 UTC

[jira] [Comment Edited] (CAMEL-6130) EndpointHelper.setReferenceProperties() does not work with OSGiServiceRegistry

    [ https://issues.apache.org/jira/browse/CAMEL-6130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13594828#comment-13594828 ] 

Aaron Whiteside edited comment on CAMEL-6130 at 3/6/13 4:24 PM:
----------------------------------------------------------------

The javadoc for that method says:

{quote}
clazz - The class under whose name the service was registered. Must not be null.
{quote}

I think in this case the _user_ is the Endpoint who is trying to lookup a property/bean and inject it into a method. So the method it finds to inject into determines the type? I think EndpointHelper.setReferenceProperties() is only used in that specific scenario and not by the wider public.

Services in OSGi CAN be registered with any type, interface or not. But the general rule of thumb is you NEVER register a classes concert type, abstract types are OK, only the service interface. This is the essence of loosely coupled services, so I don't see this happening in practice.

If the service was registered with it's concert class and you try and look it up by an interface it implements, you will not be able to find it. Mind you in OSGi you can expose/register a service via many interfaces/abstract classes.

So no the OSGi service registry wouldn't be smart enough to figure it out by itself.
                
      was (Author: aaronjwhiteside):
    The javadoc for that method says:

{quote}
clazz - The class under whose name the service was registered. Must not be null.
{quote}

I think in this case the _user_ is the Endpoint who is trying to lookup a property/bean and inject it into a method. So the method is finds to inject it into determines the type? I think EndpointHelper.setReferenceProperties() is only used in that specific scenario and not by the wider public.

Services in OSGi CAN be registered with any type, interface or not. But the general rule of thumb is you NEVER register a classes concert type, abstract types are OK, only the service interface. This is the essence of loosely coupled services, so I don't see this happening in practice.

If the service was registered with it's concert class and you try and look it up by an interface it implements, you will not be able to find it. Mind you in OSGi you can expose/register a service via many interfaces/abstract classes.

So no the OSGi service registry wouldn't be smart enough to figure it out by itself.
                  
> EndpointHelper.setReferenceProperties() does not work with OSGiServiceRegistry
> ------------------------------------------------------------------------------
>
>                 Key: CAMEL-6130
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6130
>             Project: Camel
>          Issue Type: Bug
>          Components: osgi
>    Affects Versions: 2.9.5, 2.10.4
>            Reporter: Aaron Whiteside
>            Priority: Critical
>             Fix For: 2.9.7, 2.10.5, 2.11.0
>
>         Attachments: CAMEL-6130.patch
>
>
> EndpointHelper.setReferenceProperties() does not work with OSGiServiceRegistry
> setReferenceProperties() is hard-coded to lookup services of type Object.class.
> It should use reflection to determine the type that the setter method accepts and then use that type to lookup the reference in the service registry.
> At the moment this issue is stopping #bean references in Endpoints from being resolved when using an OSGiServiceRegistry, in OSGi you need to know the class of the service you want before hand.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira