Skip navigation

Jive Release Blog

2 Posts authored by: dolan.halbrook

For those of you who are fans of Spring, or those who are just plain curious, I'd like to briefly go over the parts of the framework we used in the latest release of Clearspace.  One of our goals for the new release was to take advantage of the power the framework offered where it made sense to us, and in the end it turned out Spring and Clearspace are a good fit for eachother.


Core Context and Struts: The JiveContext now extends the Spring ApplicationContext.  Everything registered with the context is a Spring bean.  Struts actions and interceptors are autowired using these bean definitions.  Writing Actions just got a whole lot simpler.


Data Access: We changed a lot of our code to use Spring's JdbcTemplate and SimpleJdbcTemplate.  This has the advantage of making our DAO code much simpler and less error prone, as well as quicker to write.  Some classes ended up half the size after this effort.  We used annotation-based transactions, wired in using Spring's AspectJ support via the AnnotationTransactionAspect.  This allowed us to quickly add transactional coverage of far more DAO methods than before, and more easily make methods transactional in future development.  Finally we used Spring's LDAPTemplate in several places to simplify directory access code.


Security: We're using Acegi (Spring Security) for authentication.  This allows the possibility to authenticate against more than one data store.  For example, you could have one account that authenticates against LDAP, and a separate machine account that authenticates against a database.  It also provides a well documented, peer-reviewed framework to use as a platform for developing custom authentication solutions.  We are investigating using Acegi more fully for authorization in future releases.


Tasks: We worked hard to externalize timed tasks so that they each have bean definitions.  This gives greater insight into what is being fired, why, and where.  It also makes it much easier to control when a task is firing, or turn it off completely for testing purposes.


Plugins: We allow plugins to add their own Spring bean definitions to the context, so that Plugin actions and interceptors can be autowired as expected.  This is done via the plugin's "spring.xml" file.


Web Services and AJAX: Apache CXF is now used to expose SOAP and REST style web services.  It relies heavily on Spring for its configuration.  We are also using Spring for DWR configuration, via the Spring 2.0 DWR namespace.


Customizations: As part of the new release we also parse any XML file in the <jive home>/etc directory with the expectation that it's a Spring configuration file.  Developers can use this to extend or override bean definitions in the core application context.


In the end, we found Spring very helpful to simplifying our codebase and providing a point of cohesion.  We look forward to using it even more fully as we continue to develop Clearspace, and as the Spring framework itself evolves.

Spring Is Coming

Posted by dolan.halbrook Jan 17, 2008

Among the changes being made to Clearspace during 2008 is the adoption of the Spring framework in many parts of the application.  The first and most obvious feature of Spring of which we are taking advantage is the well-known and robust configuration and dependency injection service.  Much of what was formerly done using the JiveContext is now delegated to a Spring ApplicationContext, and this trend will continue.  This enables easier integration with existing libraries, more pluggability and testablility, and greater familiarity to the developer world.  What is more, with our upgrade to Struts2 (from WebWork2) all Struts objects are created using Spring as the object factory.  The immediate benefit to the developer is that any Spring-managed dependencies in a Struts object (actions, interceptors, etc) will automagically be set using Spring autowiring.


JDBC and Transactional support are other areas where we have attempted to make use of the facilities provided by the Spring framework.  Indeed anyone who has used the code provided by the framework for those two areas will be clear as to why we have chosen to do so.  Because of the improved ease of layering transactions declaratively, much more of the codebase will be transactional than before, leading to improved data integrity across the system.  We have also taken advantage of Spring LDAP support, DWR integration, CXF integration, and OSWorkflow integration.  Last but not least, we have worked to integrate the Acegi framework for authentication, and are working to use it for authorization as well.


The inclusion of the Spring framework into our project lays the groundwork for many benefits in upcoming versions of Clearspace.  We hope that you're as excited as we are to explore the possibilities and reap the benefits of its arrival.

Filter Blog

By date: By tag: