Velocity

Velocityについて

コミュニティ

ドキュメント

ツール

比較

日本語訳について

Design − 設計

Velocity is a Java-based template engine. It can be used as a standalone utility for generating source code, HTML, reports, or it can be combined with other systems to provide template services. Velocity will be tightly integrated with the Turbine web application framework. Velocity-Turbine provide a template service by which web applications may be developed according to a true MVC model.

Velocity は、Java ベースのテンプレートエンジンです。 ソースコード、HTML、レポートを生成するためのスタンドアローンユーティリティ としても使えますし、他のシステムと組み合わせて、 テンプレートサービスを提供することも出来ます。 Velocity は、Turbine Web アプリケーションフレームワークと緊密に統合されています。 Velocity-Turbine は、Web アプリケーションを真の MVC モデルに従って 開発できるテンプレートサービスを提供します。

Velocity has a myriad of potential uses -- generating SQL, PostScript, or Java source code from templates -- but web developers looking for a viable alternative to PHP and Java Server Pages (JSPs) are expected to be its principle user group.

Velocity には、その利用に関して無限の可能性があります ─ テンプレートからSQL や PostScript や Java ソースコードを生成できます ─ しかし、主要なユーザグループとして想定されるのは、 PHPJava Server Pages (JSP) の実行可能な代案を探している Web 開発者でしょう。

Velocity allows web page designers to embed simple yet powerful script elements in their web pages. These script elements work in conjunction with a Context object, which is defined in Java code. A context object--essentially a hashtable that provides get and set methods for retrieving and setting objects by name within the Context --provides a "hook" from the Java code to the Velocity script elements. These script elements allow a web designer to retrieve objects from the Context and insert these into a web page as text values. The web designer has some control over looping (for each) and conditional statements (if/else).

Velocity を使うと、Web ページデザイナが、単純であるにもかかわらず強力なスクリプト要素を Web ページに埋め込むことができます。 これらのスクリプト要素は、Java コードで定義される コンテキストオブジェクトと連動して動作します。 コンテキストオブジェクト ─ 本質的にはコンテキスト内で、 名前を使ってオブジェクトの取り出しと設定をする get、set メソッドを提供するハッシュテーブル ─ は、Java コードから Velocity スクリプトへの「接続(hook)」を提供します。 Web デザイナは、これらのスクリプト要素を使って、 オブジェクトをコンテキストから取り出して、 テキスト値としてこれらをWeb ページに挿入できます。 また、Web デザイナは、ループ(for each)や条件文 (if/else)を制御できます。

Velocity enforces a Model-View-Controller (MVC) style of development by separating Java code from HTML template code. Unlike JSPs, Velocity does not allow Java code to be embedded in pages. Unlike PHP, Velocity does not implement features with other functions. The MVC approach is one of Velocity's great strengths, and allows for more maintainable and better-designed web pages.

Velocity では、Java コードを HTML テンプレートコードから切り離すことによって、 モデル-ビュー-コントローラ(MVC)スタイルの開発を強化できます。 JSP と違って、Velocity は Java コードをページに埋め込ませません。 PHP と違って、Velocity は他の関数を使った機能実装をさせません。 MVC アプローチは、Velocity の素晴らしい利点のうちのひとつで、 それによって、保守しやすく、うまくデザインされた Web ページを実現できます。

Although MVC-style development can sometimes lead to longer incubation periods for web sites, particularly if the developers involved are new to MVC, this approach saves time over the long term (believe us, we have been doing this for a long time now). The MVC abstraction prevents web page designers from messing with a software engineer's Java code, and programmers from unduly influencing the look of web sites. Velocity enforces a contract that defines what roles people play in the web site development process.

時には、MVC 方式の開発は、Web サイトで長い準備期間が必要になることがあります。 関係する開発者が MVC に不慣れならなおさらです。 しかし、この方法は、長い目で見れば、時間を節約することになります (信じてください。私たちはこの方法でずっとやってきたのです)。 MVC による抽象化によって、Web ページデザイナがソフトウェアエンジニアの Java コードに巻き込まれずにすみますし、 プログラマが過度に Web サイトの見た目に影響を与えずにすみます。 Velocity を使うと、Webサイトの開発工程における役割を各人が果たすよう 強いることが出来ます。

Velocity uses a grammar-based parser generated by JavaCC (Java Compiler Compiler) using the JJTree extension to create an Abstract Syntax Tree.

Velocity は JavaCC (Java Compiler Compiler) で生成された文法ベースのパーサを使用します。 JavaCCはJJTree 拡張を使って抽象構文木(Abstract Syntax Tree)を生成します。

Velocity's design concept is borrowed from WebMacro. Those involved in the Velocity project acknowledge and appreciate the development and design work that went into the WebMacro project.

Velocity の設計コンセプトは、 WebMacro に由来しています。 Velocity プロジェクト関係者一同は、 WebMacro プロジェクトに開発と設計にかかわった方々に感謝をいたします。



このドキュメントは、 熊坂祐二 、 高橋達男 、 吉岡朋子 が訳しました。
コメントがある場合は、 report@jajakarta.org までお願いします。
オリジナル英文 Copyright © 1999-2005, The Apache Software Foundation