JCE providers as services

Paul Sandoz paul.sandoz at oracle.com
Tue Jun 19 11:37:29 PDT 2012


On Jun 19, 2012, at 7:48 PM, Sean Mullan wrote:
> I'm working on trying to convert the JCE providers to modular services.
> 
> In the JDK, more than one module will need to export/provide the same JCE service interface. Is this a problem?
> 

No. 

The "provide service S with I" clause does not export the service interface S (in this case java.security.Provider) nor does it export the service provider class I (in this case com.sun.crypto.provider.SunJCE or org.jcp.xmldsig.internal.dom.XMLDSigRI).

In your example there is an implicit requires of the jdk.base module that exports the service interface java.security.Provider.


> For example:
> 
> 1. jdk.crypto at 8-ea
>   ...
>     provides service java.security.Provider
>       with com.sun.crypto.provider.SunJCE
> 
> 2. jdk.xmldsig at 8-ea
>   ...
>     provides service java.security.Provider
>       with org.jcp.xmldsig.internal.dom.XMLDSigRI
> 
> Will a service consumer be able to discover all of the installed JCE services just by adding a "requires service java.security.Provider"?

Yes.

Paul.

> In other words, I'm assuming it doesn't need to also add the modules exporting that service as a dependency.
> 



More information about the jigsaw-dev mailing list