Presentation is loading. Please wait.

Presentation is loading. Please wait.

NetArchive Suite Workshop 2011 Technical Track - Code refactoring with the Spring Framework.

Similar presentations


Presentation on theme: "NetArchive Suite Workshop 2011 Technical Track - Code refactoring with the Spring Framework."— Presentation transcript:

1 NetArchive Suite Workshop 2011 Technical Track - Code refactoring with the Spring Framework

2 Introduction The Spring framework has grown as a major, if not unavoidable, framework set for developing enterprise Java applications. It offers a wide range of technologies to address both fundamental and transverse aspects of application programming. Here are a few quotes about how Spring developpers envision coding with Spring: Spring should be a pleasure to use Your application code should not depend on Spring APIs Spring should not compete with good existing solutions, but should foster integration. (For example, JDO, Toplink, and Hibernate are great O/R mapping solutions. We don't need to develop another one.)

3 An overview of Spring Core technologies (from SpringSource website) Spring is a layered Java/J2EE application platform, based on code published in Expert One-on-One J2EE Design and Development by Rod Johnson. Spring includes:Expert One-on-One J2EE Design and Development a complete lightweight container a common abstraction layer for transaction management a JDBC abstraction layer that offers a meaningful exception hierarchy, simplifies error handling, and greatly reduces the amount of code you'll need to write. Integration with Toplink, Hibernate, JDO, and iBATIS SQL Maps AOP functionality, fully integrated into Spring configuration management A flexible MVC web application framework, built on core Spring functionality

4 Experience return from BnF: BCWeb Curator Tool (1/4) The development of BnF’s new curator tool (BCWeb) is making extensive use of the Spring Core 3.0 framework.BCWeb The application first version is aimed at BnF curators and external institutional collaborators, and aims at the following main functionalities : Shared selection of web sites to be harvested, related to disciplines, projects and events. Organizing these websites as coherent documentary collections and sharing responsibilities between collection departments. Providing a documentary and technical descriptions of websites Daily management tasks of web sites (e.g. adding new sites, updating informations relative to a website, removing a website from harvests, changing harvest frequency…)

5 Experience return from BnF: BCWeb Curator Tool (2/4) BCWeb Database (PostgreSQL) Tomcat 5.5 or 6.0 Web application Berkeley DB (Transfer) Active Directory Open LDAP Data input and visulaization, administration Authentication Data transfers to NetArchive Suite Legend : data streams NetArchive Suite Database Architectural overview schema

6 Experience return from BnF: BCWeb Curator Tool (3/4) Spring 3.0 is the backbone of the application code: –Definition of components (scoping and lifecycle) is done through the lightweight container, using annotations: @Component, @Repository, etc… and package scanning –DAO layer uses NamedParameterJDBCTemplate (we chose not to use Hibernate which felt a bit overkill for our needs) –The web tier uses Spring MVC + JSTL + jQuery.

7 Experience return from BnF: BCWeb Curator Tool (4/4) Initial learning phase not too long DAO framework is very easy to use Annotation-based wiring of components is cool :) Hardest part to master proved to be test-related APIs, we still have a long way to go! Ultimately there is no turning back once you start using Spring, benefits are obvious. But at the same time you become dependent on a very large set of frameworks... the decision can be tough to make.

8 Areas in NAS where Spring could help (1/2) Wiring and lifecycle management of objects, would imply rewriting the settings management and deployer code. But it could help a lot to make configuration more readable. We would need to use the declarative and not annotations. DAO code would benefit a lot of a Spring rewrite : transaction and datasource management are made much easier. Hibernate could also be considered, as one of its interesting features is the ability to configure lazy loading, which could improve performance when the data grows big.

9 Areas in NAS where Spring could help (2/2) The web UI of course would benefit from a major upgrade, Spring MVC seems the right choice. Spring offers easy integration of JMX for objects managed by the lightweight container, could this be an alternative to JMS communication?

10 Q&A Questions? Code samples from BCWeb if anyone interested and there is time left :)


Download ppt "NetArchive Suite Workshop 2011 Technical Track - Code refactoring with the Spring Framework."

Similar presentations


Ads by Google