Revision: 1145
Author: lstreepy
Date: 2006-05-11 07:59:47 -0700 (Thu, 11 May 2006)
ViewCVS: http://svn.sourceforge.net/spring-rich-c/?rev=1145&view=rev
Log Message:
-----------
Add notes about avoiding member initializers for service access.
Modified Paths:
--------------
trunk/spring-richclient/src/site/apt/user/upgrading.apt
Modified: trunk/spring-richclient/src/site/apt/user/upgrading.apt
===================================================================
--- trunk/spring-richclient/src/site/apt/user/upgrading.apt 2006-05-11
14:49:03 UTC (rev 1144)
+++ trunk/spring-richclient/src/site/apt/user/upgrading.apt 2006-05-11
14:59:47 UTC (rev 1145)
@@ -114,14 +114,46 @@
appropriate delegated calls, so it can continue to be used as is. Also,
the
<<<Application.services()>>> method still exists, it just delegates to
<<<ApplicationServicesLocator.services()>>>.
+
+ One final note. The order of object initialization has gotten a little
more sensitive
+ with this change. Previously, several classes used a member initializer
to obtain
+ a reference to a needed service (like LabeledEnumResolver). This can be a
problem
+ now if the class in question is itself a service that needs to be
registered with
+ the service locator. If so (as was the DefaultComponentFactory for
example), then
+ you need to refactor the member initializer to use runtime resolution
instead. As
+ a concrete example, the code in DefaultFormFactory used to have this
initializer:
++---
+ private LabeledEnumResolver enumResolver =
(LabeledEnumResolver)ApplicationServicesLocator.services().getService(LabeledEnumResolver.class);
++---
+
+ Now, this code should be used (and all references to the
<<<eunumResolver>>> member
+ should be replaced with calls to <<<getEnumResolver>>>):
+
++---
+ public void setEnumResolver(LabeledEnumResolver enumResolver) {
+ this.enumResolver = enumResolver;
+ }
+
+ protected LabeledEnumResolver getEnumResolver() {
+ if (enumResolver == null) {
+ enumResolver =
(LabeledEnumResolver)ApplicationServicesLocator.services().getService(LabeledEnumResolver.class);
+ }
+ return enumResolver;
+ }
++---
+
In order to support simple programmatic use of the
<<<ApplicationServices>>>, a new
<<<StaticApplicationServices>>> class has been provided. It has a simple
<<<registerService(Object service, Class serviceInterface)>>> method for
registering
- a service. Take a look at the new <<<SpringRichTestClass>>> for an
example of how this
- can be used for programmatic control.
+ a service.
+ And lastly, there is a new test case base class that makes getting the
proper application
+ and services locator configured, named <<<SpringRichTestClass>>>. Take a
look at how
+ it's used in the existing test classes for more details. All new tests
should use this
+ class as their base class.
+
pre-0.1.0 to 0.1.0
* Switch from CVS with ANT to Subversion with Maven 2:
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs