felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felix Meschberger (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-3963) Properly handle method resolution through reflection
Date Wed, 27 Mar 2013 14:47:16 GMT

    [ https://issues.apache.org/jira/browse/FELIX-3963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13615334#comment-13615334

Felix Meschberger commented on FELIX-3963:

After discussion on the list, none of the patches will be applied. Rather we don't use reflection
for InventoryPrinter at all and for ConfigurationPrinter we support the backwards compatible
mechanism of only looking for the method in the class of the registered service object and
expect the method to be public.

The solution to prevent eager API binding is to use dynamic imports and ServiceFactory as
explained in the FAQ http://felix.apache.org/documentation/tutorials-examples-and-presentations/apache-felix-osgi-faq.html#how-to-provide-optional-services
> Properly handle method resolution through reflection
> ----------------------------------------------------
>                 Key: FELIX-3963
>                 URL: https://issues.apache.org/jira/browse/FELIX-3963
>             Project: Felix
>          Issue Type: Bug
>          Components: Inventory
>    Affects Versions: inventory-1.0.0
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: inventory-1.0.0
>         Attachments: FELIX-3963-get.patch, FELIX-3963-search.patch
> An InventoryPrinter can be registered as an InventoryPrinter service implementing the
interface or it can be registered as service of any type as long as a particular method signature
is implemented (along with a number of service registration properties required in both cases).
> The method signature is similar to the InventoryPrinter method is:
>    void print(String mode, PrinterWriter writer, boolean isZip)
> Previously the ConfigurationPrinter support in Web Console 4.0 supported the same mechanism
(with a slightly different signature, of course).
> The question is, how is the method found:
> (1) Use the service implementation class only to find any declared method. This is how
Web Console 4.0 supports ConfigurationPrinter discovery.
> (2) Use the service implementation class hierarchy to find a properly declared method.
This is the current intent of the InventoryPrinter.
> I think for the backwards compatibility use case (ConfigurationPrinter signatures) we
should implement the "implementation-class-only" variant (1).
> For new InventoryPrinter services we might consider variant (2). Yet I am not sure, whether
this really is usefull: Does such a one-off InventoryPrinter service really support inheritance
and method selection through the class hierarchy ? In such cases implementing the InventoryPrinter
might make more sense.
> See also the discussion at http://felix.markmail.org/thread/rtkogb7uukyt6gky

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

View raw message