Author: struberg
Date: Sat Oct 19 08:17:03 2013
New Revision: 1533705
URL: http://svn.apache.org/r1533705
Log:
explain the openwebbeans.properties trick to load the right SPI implementation
Modified:
openwebbeans/cms-site/trunk/content/openwebbeans-spi.mdtext
Modified: openwebbeans/cms-site/trunk/content/openwebbeans-spi.mdtext
URL:
http://svn.apache.org/viewvc/openwebbeans/cms-site/trunk/content/openwebbeans-spi.mdtext?rev=1533705&r1=1533704&r2=1533705&view=diff
==============================================================================
--- openwebbeans/cms-site/trunk/content/openwebbeans-spi.mdtext (original)
+++ openwebbeans/cms-site/trunk/content/openwebbeans-spi.mdtext Sat Oct 19
08:17:03 2013
@@ -18,7 +18,7 @@ Notice: Licensed to the Apache Softwa
# OpenWebBeans SPI
-###What is an SPI?
+##What is an SPI?
> Service Provider Interface (SPI) is an API intended to be implemented
> or extended by a third party. It can be used to enable framework
@@ -26,8 +26,10 @@ Notice: Licensed to the Apache Softwa
- [wikipedia][1]
-###How does the SPI functionality work in OpenWebBeans?
-First off reading about [OpenWebBeans Core](openwebbeans-impl.html) will give
you the overall idea.
+##Why using a SPI in OpenWebBeans?
+First off reading about [OpenWebBeans Core](openwebbeans-impl.html) will give
you
+the overall idea about the usage of SPIs in our plugin system.
+
Now as mentioned in that description the SPI is simply used to integrate other
frameworks with OpenWebBeans. The point of gravity for Java EE is definitely
going
towards CDI today and the SPI pattern ensures that OpenWebBeans can manage
this handily.
@@ -64,9 +66,32 @@ After seeing this interface one can easi
Now since this is part of the specification for JSF 2.x the JSF plugin of
course implements it and actually the JSF 1.2 plugin as well. Supporting the
Conversation Id in another plugin should be rather intuitive and this is true
for the SPI in general.
+### How does OWB know which implementation it should pick?
+
+Each OpenWebBeans JAR has a property file to configure it's internal features
+and also the SPI implementation which should be used:
+
+ META-INF/openwebbeans/openwebbeans.properties
+
+All those files contain at single property ``configuration.ordinal`` which
defines their
+'importance'. Any setting from a property file with a higher
configuration.ordinal will
+overwrite settings from one with a lower configuration.ordinal. The internally
used
+configuration.ordinal values range from 1 to 100.
+
+For example: if you use a different UI technology than JSF like Vaadin, you
could still provide
+CDI Conversations by writing an own implementation of the respective SPI and
tweak
+some configuration settings:
+ configuration.ordinal=120
+
+ # enable CDI conversation support at all
+ org.apache.webbeans.application.supportsConversation=true
+ # define your own implementation of our ConversationService SPI
+
org.apache.webbeans.spi.ConversationService=some.mycomp.MyVaadinConversationService
+All those tricks allow us to remain extensible in the future and to support
whatever scenario
+we will face.
[1]: http://en.wikipedia.org/wiki/Service_provider_interface