Developer Reference

Guidelines and Best Practices for uPortal Developers.

All developers writing code for uPortal should review the Code Style and Conventions for the project. After reviewing those conventions the technologies and techniques that uPortal has standardized on are listed below.

Interface Based Programming, IoC, and the Spring Framework

uPortal follows Interfaced Based Programming practices and uses interfaces to define all functional objects and in many cases data objects when the implementation of the object is specific to a DAO. Through the use of interfaces Inversion of Control is made easy to achieve. All functional objects should only ever rely on the interface definitions of other functional objects and provide setters for each interface. The Spring Framework provides a richly featured IoC container which uPortal relies on to instantiate and configure the functional service objects.

IoC Autowiring

In uPortal 3.2 and earlier use explicit XML based wiring of dependencies in Spring's IoC container. After uPortal 3.2 annotation based autowiring is used wherever possible.

Database Access

uPortal uses JPA with Hibernate as the underlying implementation for all database interactions. There are still legacy portions of the framework written in plain JDBC but these are being re-written as JPA as each component is reviewed and updated. If JPA or Hibernate will not work for a component the task should be first reviewed on the uportal-dev email list and then the Spring JDBC framework should be used. Under no circumstances should plain JDBC code be written.

Framework Portlets

Portlets that are part of the uPortal framework, such as administrative tools, are implemented using Spring Web Flow with JSPs using JSTL as the view layer. Web Flow has the very nice ability to call flows as sub-flows, allowing both interface and controller logic reuse very similar to a method call in Java.

JavaScript Components

JavaScript written to enhance the uPortal user interface is written as Fluid Components. Fluid components are extensions of the jQuery and Fluid frameworks and their configuration fits in very with the uPortal theme and skin systems.

Resource Loading

Any file system or classpath resource that is frequently used should be loaded via the CachingResourceLoader interface. This API takes care of caching the loaded and parsed object version of the file and re-loading that object when the file changes.