Simple Demos for Java's SPI(Service Provider Interface) and java.util.ServiceLoader usage.
This demo app include 6 tiny jar projects.
- CloudService
- Demonstrates pseudo "Cloud Service" providers.
- Defines
spidemo.cloud.spi.Cloud
interface for service provider. - Provides
spidemo.cloud.CloudService
utility class to wrapjava.util.ServiceLoader<Cloud>
operations.
- SearchService
- Demonstrates pseudo "Keyword Search Service" providers.
- Defines
spidemo.search.spi.Search
interface for service provider. - Provides
spidemo.search.SearchService
utility class to wrapjava.util.ServiceLoader<Search>
operations.
- FooProvider
- Implementations for CloudService and SearchService.
- BarProvider
- Includes two implementations for SearchService.
- BazProvider
- Implementation for CloudService.
- DemoApp
- client app for CloudService and SearchService.
- Implementations self providers for both CloudService and SearchService.
- JDK 1.6 or over
- Ant 1.8.x or over
Run default Ant target.
$ ant
run:
[java] Provider Name: My Cloud Provider
[java] My Container
[java] My Tomcat
[java] Provider Name: Foo Cloud Provider
[java] Foo VPC
[java] Foo VPN
[java] Foo Shared Server
[java] Foo Dedicated Server
[java] Provider Name: Baz Cloud Provider
[java] Baz Xen Computing
[java] Baz Security Gateway
[java] Baz Shared Storage
[java] Provider Name: My Search Provider
[java] My Search 1
[java] My Search 2
[java] Provider Name: Foo Search Provider
[java] Foo Search 1
[java] Foo Search 2
[java] Foo Search 3
[java] Provider Name: Bar Search Provider
[java] Bar Search 1
[java] Bar Search 2
[java] Bar Search 3
[java] Provider Name: Bar Search2 Provider
[java] Bar2 Search 1
[java] Bar2 Search 2
[java] Bar2 Search 3
BUILD SUCCESSFUL
Total time: 12 seconds
- Introduction to the Service Provider Interfaces (The Java™ Tutorials > Sound)
- Creating Extensible Applications (The Java™ Tutorials > The Extension Mechanism > Creating and Using Extensions)
- ServiceLoader (Java Platform SE 7 )
(Japanese Language)
- ServiceLoader (Java Platform SE 7 )
- Jarファイルメモ(Hishidama's java-archive Memo)