You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Rick McGuire (JIRA)" <ji...@apache.org> on 2010/03/10 14:23:27 UTC

[jira] Created: (GERONIMO-5178) Inconsistent handling of META-INF/services files by different Geronmo specs.

Inconsistent handling of META-INF/services files by different Geronmo specs. 
-----------------------------------------------------------------------------

                 Key: GERONIMO-5178
                 URL: https://issues.apache.org/jira/browse/GERONIMO-5178
             Project: Geronimo
          Issue Type: Bug
      Security Level: public (Regular issues)
    Affects Versions: 3.0
            Reporter: Rick McGuire
            Assignee: Rick McGuire
             Fix For: 3.0


A number of the Geronimo specs use the provider resolution pattern defined by the ServiceLoader class in Java 6 to resolve different provider classes.  In this pattern, a file with a given class name in the META-INF/services directory can define one or more provider classes for a given source interface name.  As implemented by the ServiceLoader class, these files can contain multiple lines with pure comment lines and line comments on lines that define classes, as well as multiple providers defined per file.  Thus a file like this would be considered valiid:

# A set of provider classes for the blah.blah interface
org.apache.geronimo.foo.BlahImpl  # The default first one 
org.apache.geronimo.bar.BlahImpl  # The secondary fall back. 

The different spec projects that use these files parse them under different assumptions:

- Some unilaterally take the first line without any comment processing at all or recognition that there might be multiple providers defined per file. 
- Some projects allow for pure comment lines but don't parse for comments on a definition line. 
- Not all projects are opening these files assuming a utf-8 encoding. 

This could best be solved by refactoring the code to use some common methods.  This refactoring will also allow OSGi-awareness to be added to the service file lookups.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (GERONIMO-5178) Inconsistent handling of META-INF/services files by different Geronmo specs.

Posted by "Rick McGuire (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GERONIMO-5178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick McGuire updated GERONIMO-5178:
-----------------------------------

    Issue Type: Sub-task  (was: Bug)
        Parent: GERONIMO-5090

> Inconsistent handling of META-INF/services files by different Geronmo specs. 
> -----------------------------------------------------------------------------
>
>                 Key: GERONIMO-5178
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5178
>             Project: Geronimo
>          Issue Type: Sub-task
>      Security Level: public(Regular issues) 
>    Affects Versions: 3.0
>            Reporter: Rick McGuire
>            Assignee: Rick McGuire
>             Fix For: 3.0
>
>
> A number of the Geronimo specs use the provider resolution pattern defined by the ServiceLoader class in Java 6 to resolve different provider classes.  In this pattern, a file with a given class name in the META-INF/services directory can define one or more provider classes for a given source interface name.  As implemented by the ServiceLoader class, these files can contain multiple lines with pure comment lines and line comments on lines that define classes, as well as multiple providers defined per file.  Thus a file like this would be considered valiid:
> # A set of provider classes for the blah.blah interface
> org.apache.geronimo.foo.BlahImpl  # The default first one 
> org.apache.geronimo.bar.BlahImpl  # The secondary fall back. 
> The different spec projects that use these files parse them under different assumptions:
> - Some unilaterally take the first line without any comment processing at all or recognition that there might be multiple providers defined per file. 
> - Some projects allow for pure comment lines but don't parse for comments on a definition line. 
> - Not all projects are opening these files assuming a utf-8 encoding. 
> This could best be solved by refactoring the code to use some common methods.  This refactoring will also allow OSGi-awareness to be added to the service file lookups.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (GERONIMO-5178) Inconsistent handling of META-INF/services files by different Geronmo specs.

Posted by "Rick McGuire (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GERONIMO-5178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick McGuire updated GERONIMO-5178:
-----------------------------------

    Fix Version/s:     (was: 3.0)
                   3.0-M1

> Inconsistent handling of META-INF/services files by different Geronmo specs. 
> -----------------------------------------------------------------------------
>
>                 Key: GERONIMO-5178
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5178
>             Project: Geronimo
>          Issue Type: Sub-task
>      Security Level: public(Regular issues) 
>          Components: osgi
>    Affects Versions: 3.0
>            Reporter: Rick McGuire
>            Assignee: Rick McGuire
>             Fix For: 3.0-M1
>
>
> A number of the Geronimo specs use the provider resolution pattern defined by the ServiceLoader class in Java 6 to resolve different provider classes.  In this pattern, a file with a given class name in the META-INF/services directory can define one or more provider classes for a given source interface name.  As implemented by the ServiceLoader class, these files can contain multiple lines with pure comment lines and line comments on lines that define classes, as well as multiple providers defined per file.  Thus a file like this would be considered valiid:
> # A set of provider classes for the blah.blah interface
> org.apache.geronimo.foo.BlahImpl  # The default first one 
> org.apache.geronimo.bar.BlahImpl  # The secondary fall back. 
> The different spec projects that use these files parse them under different assumptions:
> - Some unilaterally take the first line without any comment processing at all or recognition that there might be multiple providers defined per file. 
> - Some projects allow for pure comment lines but don't parse for comments on a definition line. 
> - Not all projects are opening these files assuming a utf-8 encoding. 
> This could best be solved by refactoring the code to use some common methods.  This refactoring will also allow OSGi-awareness to be added to the service file lookups.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (GERONIMO-5178) Inconsistent handling of META-INF/services files by different Geronmo specs.

Posted by "Rick McGuire (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GERONIMO-5178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick McGuire closed GERONIMO-5178.
----------------------------------


> Inconsistent handling of META-INF/services files by different Geronmo specs. 
> -----------------------------------------------------------------------------
>
>                 Key: GERONIMO-5178
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5178
>             Project: Geronimo
>          Issue Type: Sub-task
>      Security Level: public(Regular issues) 
>          Components: osgi
>    Affects Versions: 3.0
>            Reporter: Rick McGuire
>            Assignee: Rick McGuire
>             Fix For: 3.0-M1
>
>
> A number of the Geronimo specs use the provider resolution pattern defined by the ServiceLoader class in Java 6 to resolve different provider classes.  In this pattern, a file with a given class name in the META-INF/services directory can define one or more provider classes for a given source interface name.  As implemented by the ServiceLoader class, these files can contain multiple lines with pure comment lines and line comments on lines that define classes, as well as multiple providers defined per file.  Thus a file like this would be considered valiid:
> # A set of provider classes for the blah.blah interface
> org.apache.geronimo.foo.BlahImpl  # The default first one 
> org.apache.geronimo.bar.BlahImpl  # The secondary fall back. 
> The different spec projects that use these files parse them under different assumptions:
> - Some unilaterally take the first line without any comment processing at all or recognition that there might be multiple providers defined per file. 
> - Some projects allow for pure comment lines but don't parse for comments on a definition line. 
> - Not all projects are opening these files assuming a utf-8 encoding. 
> This could best be solved by refactoring the code to use some common methods.  This refactoring will also allow OSGi-awareness to be added to the service file lookups.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (GERONIMO-5178) Inconsistent handling of META-INF/services files by different Geronmo specs.

Posted by "David Jencks (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GERONIMO-5178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Jencks updated GERONIMO-5178:
-----------------------------------

    Component/s: osgi

> Inconsistent handling of META-INF/services files by different Geronmo specs. 
> -----------------------------------------------------------------------------
>
>                 Key: GERONIMO-5178
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5178
>             Project: Geronimo
>          Issue Type: Sub-task
>      Security Level: public(Regular issues) 
>          Components: osgi
>    Affects Versions: 3.0
>            Reporter: Rick McGuire
>            Assignee: Rick McGuire
>             Fix For: 3.0
>
>
> A number of the Geronimo specs use the provider resolution pattern defined by the ServiceLoader class in Java 6 to resolve different provider classes.  In this pattern, a file with a given class name in the META-INF/services directory can define one or more provider classes for a given source interface name.  As implemented by the ServiceLoader class, these files can contain multiple lines with pure comment lines and line comments on lines that define classes, as well as multiple providers defined per file.  Thus a file like this would be considered valiid:
> # A set of provider classes for the blah.blah interface
> org.apache.geronimo.foo.BlahImpl  # The default first one 
> org.apache.geronimo.bar.BlahImpl  # The secondary fall back. 
> The different spec projects that use these files parse them under different assumptions:
> - Some unilaterally take the first line without any comment processing at all or recognition that there might be multiple providers defined per file. 
> - Some projects allow for pure comment lines but don't parse for comments on a definition line. 
> - Not all projects are opening these files assuming a utf-8 encoding. 
> This could best be solved by refactoring the code to use some common methods.  This refactoring will also allow OSGi-awareness to be added to the service file lookups.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (GERONIMO-5178) Inconsistent handling of META-INF/services files by different Geronmo specs.

Posted by "Rick McGuire (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GERONIMO-5178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12843637#action_12843637 ] 

Rick McGuire commented on GERONIMO-5178:
----------------------------------------

Ok, will do.  I don''t believe I'm introducing anything that will be a problem here.  I'm not changing the lookup order at all, just delegating the reading/parsing of the META-INF/services files to methods I'm adding to the ProviderLocator class that is already getting included in the bundle as a result of my prior updates.   I've avoided using the ServiceLoader class for some of this stuff for precisely that reason. 

> Inconsistent handling of META-INF/services files by different Geronmo specs. 
> -----------------------------------------------------------------------------
>
>                 Key: GERONIMO-5178
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5178
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>    Affects Versions: 3.0
>            Reporter: Rick McGuire
>            Assignee: Rick McGuire
>             Fix For: 3.0
>
>
> A number of the Geronimo specs use the provider resolution pattern defined by the ServiceLoader class in Java 6 to resolve different provider classes.  In this pattern, a file with a given class name in the META-INF/services directory can define one or more provider classes for a given source interface name.  As implemented by the ServiceLoader class, these files can contain multiple lines with pure comment lines and line comments on lines that define classes, as well as multiple providers defined per file.  Thus a file like this would be considered valiid:
> # A set of provider classes for the blah.blah interface
> org.apache.geronimo.foo.BlahImpl  # The default first one 
> org.apache.geronimo.bar.BlahImpl  # The secondary fall back. 
> The different spec projects that use these files parse them under different assumptions:
> - Some unilaterally take the first line without any comment processing at all or recognition that there might be multiple providers defined per file. 
> - Some projects allow for pure comment lines but don't parse for comments on a definition line. 
> - Not all projects are opening these files assuming a utf-8 encoding. 
> This could best be solved by refactoring the code to use some common methods.  This refactoring will also allow OSGi-awareness to be added to the service file lookups.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (GERONIMO-5178) Inconsistent handling of META-INF/services files by different Geronmo specs.

Posted by "Rick McGuire (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GERONIMO-5178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick McGuire resolved GERONIMO-5178.
------------------------------------

    Resolution: Fixed

All spec implementations now use a comment service to resolve the services providers and the processing orders have been made compliant with the individual spec requirements. 

> Inconsistent handling of META-INF/services files by different Geronmo specs. 
> -----------------------------------------------------------------------------
>
>                 Key: GERONIMO-5178
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5178
>             Project: Geronimo
>          Issue Type: Sub-task
>      Security Level: public(Regular issues) 
>          Components: osgi
>    Affects Versions: 3.0
>            Reporter: Rick McGuire
>            Assignee: Rick McGuire
>             Fix For: 3.0
>
>
> A number of the Geronimo specs use the provider resolution pattern defined by the ServiceLoader class in Java 6 to resolve different provider classes.  In this pattern, a file with a given class name in the META-INF/services directory can define one or more provider classes for a given source interface name.  As implemented by the ServiceLoader class, these files can contain multiple lines with pure comment lines and line comments on lines that define classes, as well as multiple providers defined per file.  Thus a file like this would be considered valiid:
> # A set of provider classes for the blah.blah interface
> org.apache.geronimo.foo.BlahImpl  # The default first one 
> org.apache.geronimo.bar.BlahImpl  # The secondary fall back. 
> The different spec projects that use these files parse them under different assumptions:
> - Some unilaterally take the first line without any comment processing at all or recognition that there might be multiple providers defined per file. 
> - Some projects allow for pure comment lines but don't parse for comments on a definition line. 
> - Not all projects are opening these files assuming a utf-8 encoding. 
> This could best be solved by refactoring the code to use some common methods.  This refactoring will also allow OSGi-awareness to be added to the service file lookups.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (GERONIMO-5178) Inconsistent handling of META-INF/services files by different Geronmo specs.

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GERONIMO-5178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12847212#action_12847212 ] 

Donald Woods commented on GERONIMO-5178:
----------------------------------------

General question on discovering Providers.
In the JPA2 spec api, we now have something like -
           try {
                // add each one to our list
                List<Object> serviceProviders = ProviderLocator.getServices(PersistenceProvider.class.getName(), this.getClass(), cl);
                for (Object o : serviceProviders) {
                     providers.add((PersistenceProvider)o);
                 }
            } catch (ClassNotFoundException e) {
. . .
Since multiple providers can be listed in one services file, should the failure/exception to load one cause none of them to be returned?  Should we silently eat or log the exceptions and just return null if we fail to load any of the configured providers?

> Inconsistent handling of META-INF/services files by different Geronmo specs. 
> -----------------------------------------------------------------------------
>
>                 Key: GERONIMO-5178
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5178
>             Project: Geronimo
>          Issue Type: Sub-task
>      Security Level: public(Regular issues) 
>    Affects Versions: 3.0
>            Reporter: Rick McGuire
>            Assignee: Rick McGuire
>             Fix For: 3.0
>
>
> A number of the Geronimo specs use the provider resolution pattern defined by the ServiceLoader class in Java 6 to resolve different provider classes.  In this pattern, a file with a given class name in the META-INF/services directory can define one or more provider classes for a given source interface name.  As implemented by the ServiceLoader class, these files can contain multiple lines with pure comment lines and line comments on lines that define classes, as well as multiple providers defined per file.  Thus a file like this would be considered valiid:
> # A set of provider classes for the blah.blah interface
> org.apache.geronimo.foo.BlahImpl  # The default first one 
> org.apache.geronimo.bar.BlahImpl  # The secondary fall back. 
> The different spec projects that use these files parse them under different assumptions:
> - Some unilaterally take the first line without any comment processing at all or recognition that there might be multiple providers defined per file. 
> - Some projects allow for pure comment lines but don't parse for comments on a definition line. 
> - Not all projects are opening these files assuming a utf-8 encoding. 
> This could best be solved by refactoring the code to use some common methods.  This refactoring will also allow OSGi-awareness to be added to the service file lookups.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (GERONIMO-5178) Inconsistent handling of META-INF/services files by different Geronmo specs.

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GERONIMO-5178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12843617#action_12843617 ] 

Donald Woods commented on GERONIMO-5178:
----------------------------------------

Rick, please ping me before changing the jpa_2.0_spec code, as we've had some long discussions about how this should be handled over in OpenJPA (we currently allow multiple providers to be specified as allowed by the Java ServiceLoader spec) and have some legacy behaviors we need to support (like allowing users to override the provider via properties.)  There are also some tie-ins with Apache Aries JPA support and we need the Spec API to continue support for Java SE 5 users and not rely on any Java SE 6 only APIs/behaviors.


> Inconsistent handling of META-INF/services files by different Geronmo specs. 
> -----------------------------------------------------------------------------
>
>                 Key: GERONIMO-5178
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5178
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>    Affects Versions: 3.0
>            Reporter: Rick McGuire
>            Assignee: Rick McGuire
>             Fix For: 3.0
>
>
> A number of the Geronimo specs use the provider resolution pattern defined by the ServiceLoader class in Java 6 to resolve different provider classes.  In this pattern, a file with a given class name in the META-INF/services directory can define one or more provider classes for a given source interface name.  As implemented by the ServiceLoader class, these files can contain multiple lines with pure comment lines and line comments on lines that define classes, as well as multiple providers defined per file.  Thus a file like this would be considered valiid:
> # A set of provider classes for the blah.blah interface
> org.apache.geronimo.foo.BlahImpl  # The default first one 
> org.apache.geronimo.bar.BlahImpl  # The secondary fall back. 
> The different spec projects that use these files parse them under different assumptions:
> - Some unilaterally take the first line without any comment processing at all or recognition that there might be multiple providers defined per file. 
> - Some projects allow for pure comment lines but don't parse for comments on a definition line. 
> - Not all projects are opening these files assuming a utf-8 encoding. 
> This could best be solved by refactoring the code to use some common methods.  This refactoring will also allow OSGi-awareness to be added to the service file lookups.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (GERONIMO-5178) Inconsistent handling of META-INF/services files by different Geronmo specs.

Posted by "Rick McGuire (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GERONIMO-5178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12847294#action_12847294 ] 

Rick McGuire commented on GERONIMO-5178:
----------------------------------------

Unfortunately, there has been no guidance on any of the specifications on how this should be handled.  Most of the spec implementations would fail immediately if there was a classloading or instantiation failure when processing any of the META-INF/services files it located, so that's how I ended up coding the ProviderLocator.getServices() call.  We end up with multiple levels of log points in this whole stack, so I suspect throwing the exception is the appropriate way to handle this.  

> Inconsistent handling of META-INF/services files by different Geronmo specs. 
> -----------------------------------------------------------------------------
>
>                 Key: GERONIMO-5178
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5178
>             Project: Geronimo
>          Issue Type: Sub-task
>      Security Level: public(Regular issues) 
>    Affects Versions: 3.0
>            Reporter: Rick McGuire
>            Assignee: Rick McGuire
>             Fix For: 3.0
>
>
> A number of the Geronimo specs use the provider resolution pattern defined by the ServiceLoader class in Java 6 to resolve different provider classes.  In this pattern, a file with a given class name in the META-INF/services directory can define one or more provider classes for a given source interface name.  As implemented by the ServiceLoader class, these files can contain multiple lines with pure comment lines and line comments on lines that define classes, as well as multiple providers defined per file.  Thus a file like this would be considered valiid:
> # A set of provider classes for the blah.blah interface
> org.apache.geronimo.foo.BlahImpl  # The default first one 
> org.apache.geronimo.bar.BlahImpl  # The secondary fall back. 
> The different spec projects that use these files parse them under different assumptions:
> - Some unilaterally take the first line without any comment processing at all or recognition that there might be multiple providers defined per file. 
> - Some projects allow for pure comment lines but don't parse for comments on a definition line. 
> - Not all projects are opening these files assuming a utf-8 encoding. 
> This could best be solved by refactoring the code to use some common methods.  This refactoring will also allow OSGi-awareness to be added to the service file lookups.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.