11 января, 2008

Эта статья является вводной частью к серии статей о создании веб-приложения с использованием Java фреймворка Spring. Тем, кто уже знаком с этим фреймворком статья будет мало полезной, в основном это для тех, кто ничего не знает о Spring или же только слышал и собирался в будущем попробовать.

Spring - это фреймворк объединяющий в себе достаточно много полезной функциональности: управление транзакциями, удалённый доступ к логике приложения используя RMI или веб-сервисы, множество возможностей для хранения ваших данных в БД, полнофункциональный MVC-фреймворк, прозрачную интеграцию AOP в приложении, интеграцию с другими известными фреймворками. Основным преимуществом фреймворка является компонентная архитектура, которая позволяет выборочно использовать любой из компонентов, в тоже время предоставляя связанный фреймворк для разработки J2EE приложений.

Архитектура фреймворка выглядит так:

Модульная архитектура фреймворка Spring

Каждый из этих компонентов может использоваться независимо или же в связке с другими. Ниже приведено общее описание функциональности каждого из них:

  • IoC контейнер. Основная часть фреймворка обеспечивающая базовую функциональность.
  • Spring Context. Spring контекст - это конфиогурационный файл предоставляющий контекстную информацию приложения, такую как: описание базнес-объектов в приложении, JNDI русурсы, EJB, e-mail, интернационализацию, валидацию.
  • Spring AOP. Данный модуль интегрирует аспектно-ориентированное программирование непосредственно в фреймворк, используя его конфигурационные возможности. В результате, вы можете применить AOP к любому управляемому фреймворком объекту вашего приложения. Spring AOP предоставляет поддержку управления транзакциями для объектов Spring-приложения.
  • Spring DAO. Предоставляет абстрактный слой для поддержки DAO. Также, содержит в себе полноценную иерархию эксепшенов для управления ошибками, возникающими при работе с различными базами данных.
  • Spring ORM. Включает в себя набор различных фреймворков, для обеспечения поддержки ORM (Object Relational Mapping) в приложении, а именно: JDO, интеграцию Hibernate и iBatis.
  • Spring Web Module. Предоставляет контекс для web-based приложений. Поддерживает интеграцию с Struts.
  • Spring MVC Framework. Полноценная реализация MVC паттерна для разработки веб-приложений.

Из личного опыта могу сказать, что использовал Spring в 3-х крупных проектах. Негативных отзывов нет, есть только положительные. Благодаря Inversion of Control в приложение можно подключить любой другой фреймворк или билиотеку без особого труда. Конфигурируется всё очень просто, отличная поддержка транзакций благодаря модулю AOP (Spring сам заботится о целостности данных, автоматически выполняя commit и rollback, основываясь на эксепшенах). Простая и удобная реализация MVC.

Хорошие примеры использования Spring: FeedBurner, DZone, LinkedIn.

3 октября, 2007

At the previous post I wrote about Portal technology and JSR-168. I listed the most famous portal platforms at the end of post.
So, lets start from overview of these Portal platforms and their main features and benefits.

Liferay Portal (http://www.liferay.com)

Liferay Portal is one of the most mature portal frameworks on the market (in development since 2000) and offers these basic benefits:

  • Personalization
    Different people with the same role work differently
  • Customization
    Different roles require different information
  • Workflow
    Efficiency - people get directly to the information and applications they need. Customization ensures they don’t miss anything

These are the mature features:

  • Provides a plug-in framework to install Liferay components
  • Sitemaps Protocol support
  • Microformat support
  • ICEfaces Integration for AJAX + JSF
  • Javascript Client Libraries for JSON Web Services
  • PHP and Ruby Support
  • Enterprise Password Policy Management
  • OpenID enabled
  • Database tuning
  • Scalability - optimize memory usage
  • Integration with Microsoft Exchange
  • Yahoo Maps
  • Full WebDAV Support
  • Eclipse Portlet development/deployment
  • Role-base Theme management
  • Standardize on jQuery JavaScript Framework
  • Mobile device support

Full list of supported features you can find here.

These are an “after-installation” functionality provided by included Portlets:

  • Enterprise admin
    Allows users (with permissions) to manage users, organizations, locations, user groups, and roles, and to set their permissions.
  • Page settings
    Liferay also has a Page Settings configuration area that can be used to change look and feel with one click, manage portal pages, insert Javascript and meta-data, and set friendly URLs.
  • Document library
    Provides document management backed by the Jackrabbit JSR-170 compliant Java content repository. Includes check in / check out, meta data, and versioning.
  • Journal
    Main interface for Liferay’s integrated web publishing system. Allows users to create, edit, and publish articles, as well as article templates for one click changes in layout. Journal has built in workflow, article versioning, search, and meta-data.
  • Navigation
    Provides a directory of links reflecting the portal’s page structure, with drill down into the current page. Style and appearance can be adjusted. Unlike the Breadcrumb Portlet, the Navigation Portlet displays links for other pages outside of the current page’s trail of “parent” pages.
  • Site Map
  • Blogs
  • Calendar
  • Enterprise Instant Messaging
    An AJAX Enterprise Instant Messaging client that allows users to automatically chat over Jabber protocol with other logged-in portal users. Chat sessions are persisted across portal pages and as secure as other portal functionality.
  • Mail
    An AJAX webmail client that can be configured to work with any mail server. Liferay Mail displays message lists and message previews in a dual pane window to reduce page refreshes. Messages can be searched or sorted by different criteria to find messages quickly. Drag and drop makes it easy to organize and delete messages.
  • Wiki
  • Bookmarks
  • Communities
  • Polls
  • Google Portlets (Google Search Portlet, Google AdSense, Google Gadget for publishing Google’s widgets to Liferay Portal, Google Maps Portlet to facilitate mashup creation and show customized driving directions and locations.)
  • News and RSS
  • Weather
  • Shopping
  • Prototype Portlets
    Several Prototype Portlets ship with Liferay to provide examples of how to incorporate other technologies with Liferay at the presentation layer. These include Flash, Laszlo, Velocity, JSP, Struts, IFrames, and Web Proxy.

After installation you get almost completed portal with basic functionality. All you need is just customize look-and-fill and may be develop your special features.

1 октября, 2007

Introduction

Over the some time I engaged in search of good stable platform for my new web-project, designed for big auditorium, high loads and large volume of data. The main criteria are: stability for high loads, implemented basic functionality (authorization, user accounts, simple news, comments, rss feeds and others…) to reduce time on development, component architecture, supported clusterization, work with separated databases, and easy scalability.
The recent pleasant discovery for me was the Portal Java technology, which implements specification JSR-168 (Java Specification Request).

What is JSR-168?

Portlets are Web-based components managed by portlet containers that supply
dynamic content. Portals employ portlets as pluggable user-interface components—a
presentation layer—for information systems.
Originally proposed by Sun and IBM and released in October 2003, JSR 168 defines the APIs that standardize the development of portlets. It performs two major tasks:

  • Defines a standard Java technology-based Web component model for portlets in portal servers that are built on the Java platform.
  • Enables portability and vendor independence.

However, JSR 168 does not define interoperability of remote portlets. Portlets that are built according to the JSR 168 model work with all Java technology-based portal servers.

Why I choose Portal?
  • Simple API
  • Component architecture
  • Great scalability
  • Hot deployment and re-deployment of Portal applications
  • Support for Localization and Internationalization
  • Ready to use a lot of functionality by hundreds Portlets

Portal platforms

There’re some famous opensource Portal implementations:

14 июня, 2007

A great, great article:
Agile Database Refactoring with Hibernate