Let’s quickly look at the Java EE 8-JCache bridge project. This is another concrete step as far as Java EE 8 integration efforts are concerned..
Details on the general idea behind this can be picked up from one of my recent posts on this topic
A bridge ?? What for ?
- Serve as the integration point for JCache & Java EE 8
- Provide decoupling: the Java EE 8 platform and the JCache API can be allowed to evolve separately and the bridge would provide a much needed cushion. Think of it as a regular Bridge Pattern (from the GoF) – just implemented in the form of a JSR😉
- Derive from exiting (and popular) specifications like JPA which can make it easier to adopt and use
- Standardise a JCache descriptor (configuration)
- Implement Cache injection
- Look at support for custom cache properties (which vary across different providers)
Crossing the bridge
All it does is
- Defines a named cache in cache.xml placed within WEB-INF/classes/META-INF (this is a pre-requisite for WAR based artifacts)
- Inject the cache in a JAX-RS resource
- Save the JSR info in the cache for future use (if it already does not exist there)
- It provides you JSR information e.g. http://localhost:9000/jcachejavaee8bridge/370 and tells you whether it has been picked up from the cache
Other notable points
- The cache bridge API source has been included directly into the sample project to make dependency management easier (since its not in Maven yet). You might want to have the latest fork for your experiments
- The JCache RI is being used by internally by the bridge. Experiment with another JCache provider (Hazelcast, Infinispan etc.), include its dependency and include it in the cache.xml configuration
How can you contribute ?
- Explore the project
- Provide ideas, files issues
- Write tests, break stuff, file some more issues !
- Get in touch with Adam Bien, translate your ideas into code and submit a PR…