Thursday, September 11, 2008

Java SE 6 platform provides a new API that helps you find, load, and use service providers. This API was part of the platform from version 1.3 but was not public.

There is a good introduction in this API on Sun Developer Network site - Creating Extensible Applications With the Java Platform.

Trying to get advantages of this new API in RAP based application, where service providers are developed as components and build with Maven, I found that there no hint/tip regarding how to create the Manifest information to publish the information needed by Service Loader API to find service providers in ClassPath.

Service Components that are part of RAP application are following standard Maven code organization structure. The easiest way to publish service information is to create a new folder name META-INF under src/main/resources. Under META-INF you can create the services folder. Services folder is the one that Service Loader API is using to identify service providers. The introductory tutorial mention above describe how to create the meta information for service provider.