Introduction
|
| Platform プラットフォーム | Database データベース | Testers テスト者 |
| Linux | MySQL | Jason van Zyl |
| Linux | PostgreSQL | Jason van Zyl |
| Window2K | MySQL | Martin Poeschl |
| NT (sp6) | MySQL | Randall G. Alley |
If the combination is not listed here, it doesn't mean that the TDK won't work for you. It just means that no one regularly tests that combination when new TDKs are released. If you get an unsupported combination to work and you would like to test your combination please post a message to the list and we will add you to the list above.
組み合わせがこのリストにないとしても、TDKが動作しないという意味ではありません。ただ単に、新たなTDKがリリースされたときに、誰もその組み合わせを正式にテストしていないという意味です。サポートされていない組み合わせで動作させようとして、その組み合わせでテストしようとする場合には、リスト宛てにメッセージを送ってください。上記のリストに追加します。
First of all, you have to get the TDK distribution. You can fetch it from the Turbine release repository. Search for the directory with the latest version, and download the file tdk-2.1.tar.gz (preferred choice for Unix systems), or tdk-2.1.zip (for Windows systems this may be more practical).
まず最初に、TDKディストリビューションを手に入れなければなりません。それはTurbineリリースリポジトリから取ってくることが可能です。最新バージョンのディレクトリを探し、tdk-2.1.tar.gz(Unixシステムに適した選択)、あるいはtdk-2.1.zip(Windowsシステムにはより適しています)ファイルをダウンロードします。
Unpack the TDK distribution into a directory of your choosing. On Windows, use WinZip to unpack the files and on Unix, something like:
TDKディストリビューションを任意のディレクトリに解凍します。Windowsではファイルを解凍するするためにWinZipを使用し、Unixでは
tar -xvzf tdk-2.1.tar.gz
should to the trick. This is all that you have to do to install the TDK.
というような要領で解凍します。TDKをインストールするためにしなければならないことは、これだけです。
Now that you have Turbine installed on your machine, you need to create a sample application in order to begin using it. This is done in the following manner:
Turbineをマシンにインストールしたのですから、それを使い始めるためには、サンプルアプリケーションを作成する必要があります。それは以下の方法で行います。
1. Open up the file "build.properties" in the root TDK directory. Change the property "target.package" to the name of the package that you would like your java files to live in and the property "target.directory" to the directory that you would like your classes to be created in. These two values are usually a mirror of one another. Finally, change the property "tdk.project" to the name of the application that you would like to create. Usually this is the same as the identifier specified at the end of your target.package.
1. TDKのルートディレクトリにある"build.properties"ファイルを開きます。"target.package"プロパティをjavaファイルを置こうとするパッケージの名前に、"target.directory"プロパティをクラスファイルを作成しようとするディレクトリに変更します。この2つの値は通常、互いを反映したものとなります。最後に、"tdk.project"プロパティを作成するアプリケーションの名前に変更します。これは通常、target.packageの最後に指定した識別子と同じです。
<訳者注:実際にインストールしたtdk-2.1では、build.propertiesファイルにtdk.projectプロパティは見当たりませんでした。おそらく、turbine.appプロパティのことを指しているのではないかと思います。>
2. Set the JAVA_HOME environment value for your system. On *nix/BSD using the Bash shell, this can be done with:
2. システムのJAVA_HOME環境変数を設定します。*nix/BSDでは、Bashシェルを使用し、次のように行います。
export JAVA_HOME="/PATH/TO/JDK/"
3. Run Ant in the root directory of the TDK installation. The sample application will be generated with the default name of newapp. If you wish to change the name of the default sample app then you must change the turbine.app.name property in the build.properties file.
3. TDKがインストールされているルートディレクトリでAntを実行します。サンプルアプリケーションが、newappというデフォルトの名前で作成されます。デフォルトのサンプルアプリケーションの名前を変更したいときには、build.propertiesファイルの中のturbine.app.nameプロパティを変更しなければなりません。
<訳者注:実際にインストールしたtdk-2.1では、build.propertiesファイルにturbine.app.nameプロパティは見当たりませんでした。おそらく、turbine.appプロパティのことを指しているのではないかと思います。>
ant
from your root TDK directory. This will create most of the files necessary for running your turbine app.
TDKルートディレクトリから実行します。これにより、Turbineアプリケーションを実行するために必要なほとんどのファイルが作成されます。
4. Once the initial set of files has been created, you will need to go into the directory "/TDKROOT/webapps/APPNAME/WEB-INF/build" and edit your "build.properties" file. This file is used to specify properties such as the type of database you are using and your DB connection info. This information is used to create the tables Turbine will be using and the classes used to access them. At this time you should also copy your JDBC drivers (renaming .zip files to .jar files) into the "webapps/APPNAME/WEB-INF/lib" directory if you are using a database for which the TDK does not provide JDBC drivers. These files will be important when creating the database tables in the next step.
4. 最初のファイルが一通り作成されたならば、"/TDKROOT/webapps/APPNAME/WEB-INF/build"ディレクトリに移って、"build.properties"ファイルを編集します。このファイルは、使用するデータベースの種類とDBに接続するための情報といったプロパティを指定するために使用されます。この情報は、Turbineが使用するテーブルと、それらにアクセスするために使用されるクラスを作成するために使用されます。現時点では、TDKがJDBCドライバを提供していないデータベースを使用する場合には、JDBCドライバを(.zipファイルを.jarファイルに名前を変えて)"webapps/APPNAME/WEB-INF/lib"ディレクトリにコピーすべきです。これらのファイルは、次のステップでデータベースのテーブルを作成する際に重要になります。
5. Go to the directory "/TDKROOT/webapps/APPNAME/WEB-INF/build" and run the command "ant init" This command must be run before attempting to use the TDK. It creates the database tables and OM classes for accessing them.
5. "/TDKROOT/webapps/APPNAME/WEB-INF/build"ディレクトリに移り、"ant init"コマンドを実行します。このコマンドは、TDKを使用しようとする前に必ず実行しなければなりません。これはデータベースのテーブルを作成し、それらにアクセスするためのOMクラスを作成します。
NOTE
For Oracle and Sybase users it is often common that the database
has already been created: if this is the case then by setting the
database.manual.creation property in your "build.properties"
file you can force the 'create-database' target to
be skipped.
注記
OracleとSybaseを使用する場合は、たいてい、データベースは既に作成されていることが一般的です。このようなケースでは、"build.properties"ファイルの中のdatabase.manual.creationプロパティを設定することにより、'create-database'ターゲットを強制的にスキップさせることができます。
6. Your first Turbine app has now been created! go back to the root directory of your TDK installation and type in "./bin/catalina.sh run" if you want to see console output or "./bin/catalina.sh start" if you want the servlet container process to run in the background.
6. 初めてのTurbineアプリケーションが、これで作成されました!TDKがインストールされているルートディレクトリに戻り、コンソール出力を見たければ"./bin/catalina.sh run"とタイプし、サーブレットコンテナにバックグラウンドで実行させたければ"./bin/catalina.sh start"とタイプします。
NOTE
If you want automatic class reloading to work, then you have to
configure it specifically for each webapp that you generate.
Class reloading for automatically configured webapps doesn't
appear to be working Catalina b5. Hopefully this will be
resolved before the 2.1 release. If you use the the default
setup, then class reloading will be setup for you i.e. your
APPNAME is 'newapp'. If, for example, your APPNAME is 'rupert'
then you must add the following to your conf/server.xml file:
注記 自動クラスリローダを動作させたいときには、生成したそれぞれのwebアプリケーションに対して、明確に設定しなければなりません。自動的に設定されたwebアプリケーションのクラスのリロードは、Catalina b5では動作しないようです。うまくいけば、これは2.1のリリース前に解決されるでしょう。デフォルトの設定を使用する際には、すなわちAPPNAMEが'newapp'の場合は、クラスリローダは設定されるでしょう。例えばAPPNAMEが'rupert'の場合は、conf/server.xmlファイルに以下を追加しなければなりません。
<context path="/rupert" docBase="rupert" reloadable="true"/>
Look for 'TDK SITE' in the conf/server.xml file and make the adjustment just above it to get class reloading working. You will see how the class reload has been setup for the default 'newapp' and you can use that as an example.
conf/server.xmlファイルの中で'TDK SITE'を探し、クラスリロードが動作するよう、上記のとおりに修正します。デフォルトの'newapp'に対してどのようにクラスリロードが設定されているかを参照して、例として使用することができます。
Now that you have your Turbine application created and running by following the instructions above, point your browser to http://SERVERNAME:8080/APPNAME/servlet/APPNAME where SERVERNAME is the hostname of the machine running Tomcat, and APPNAME is the name of the application you created.
Turbineアプリケーションを作成し、続いて上記の命令で実行しているので、ブラウザでhttp://SERVERNAME:8080/APPNAME/servlet/APPNAMEを参照します。ここでのSERVERNAMEはTomcatが実行されているマシンのホスト名、APPNAMEは作成したアプリケーションの名前です。
The initial login screen should appear and you should login with username 'turbine' and password 'turbine' This will bring you to the initial "Turbine Data Manager" layout. From here you can insert/delete/edit entries in the default database or create and manage users using Flux, the built-in user management system for Turbine. These are the example turbine apps.
最初のログイン画面が表示され、ユーザ名'turbine'、パスワード'turbine'でログインができるでしょう。これにより、最初の"Turbine Data Manager"レイアウトにたどり着きます。ここから、デフォルトのデータベースに項目の挿入/削除/編集をしたり、Turbineに組み込まれたユーザ管理システムであるFluxを使用して、ユーザの作成と管理が行えます。
Look at the example app that you now have on your screen. The view that you are seeing actually consists of 4 different parts (top, bottom, menu and index) that were assembled for you on the fly by Velocity. In order to see how this works, you have to edit the file "webapps/APPNAME/templates/app/layouts/Default.vm" This file defines how the default layout is shown on your screen. As you can see, it is written as a fragment of HTML that will eventually be integrated into your final page. Editing this file will affect the layout of your entire application.
いま画面に表示されている例題アプリケーションを見てください。実際に見えるビューは、4つの異なるパート(トップ、ボトム、メニュー、インデックス)から構成されています。これは、Velocityによって大急ぎで組み立てられたものです。これがどのように動作しているかを知るためには、"webapps/APPNAME/templates/app/layouts/Default.vm"ファイルを編集する必要があります。このファイルは、デフォルトのレイアウトがどのように画面に表示されるかを定義しています。見てのとおり、HTMLの断片として書かれていて、最終的には最終的なページに統合されます。このファイルの編集は、アプリケーション全体のレイアウトに影響します。
Knowing now how the page is laid out, go to the directory "webapps/APPNAME/templates/app/navigations" to see the files that will be inserted into the layout template above. Edit the file "DefaultBottom.vm", save your changes back, and reload your page. By doing this you should see whatever changes you have made to the file appear at the bottom of your layout. This change will also occur in all of the other pages on your site. Navigate to a different page in order to confirm this behavior.
どのようにページが配置されるかを理解したところで、"webapps/APPNAME/templates/app/navigations"ディレクトリに移り、上記のレイアウトテンプレートに挿入されるファイルを見てみます。"DefaultBottom.vm"ファイルを編集し、変更を保存して、ページをリロードします。これを行うことによって、ファイルへのどのような変更でもレイアウトのボトムに現れることがわかるでしょう。この変更はまた、サイトにある他のすべてのページに現れます。この振る舞いを確かめるために、別のページを表示してみてください。
Now go into the directory "webapps/APPNAME/templates/app/screens" The files in this directory are the ones that replace the "$screen_placeholder" variable in the original layout. Open up the file "Index.vm" and you will see that a variable is defined called "$headings" that holds the strings for each of the headings on the Index page and that a variable called "$entries" is used to show the dynamic data on the page. This variable comes from the Java class file that is associated with this .vm page, as explained in the next paragraph. The Index.vm page also includes a number of functions that begin with #, such as "#entryCell(...)" These functions are replaced with HTML fragments at runtime, as defined in the "webapps/APPNAME/templates/app/GlobalMacros.vm" file. Look at this file to get an idea of what each of these methods do. This file can be edited in order to add your own velocity macros to the system as well.
こんどは"webapps/APPNAME/templates/app/screens"ディレクトリに移ります。このディレクトリにあるファイルは、オリジナルのレイアウトで"$screen_placeholder"変数を置き換えるものです。"Index.vm"ファイルを開くと、"$headings"という変数が定義されてIndexページのそれぞれの見出しとなる文字を保持していること、"$entries"という変数がページの動的データを表すのに使われていることがわかります。この変数は、次の段落で説明されるように、この.vmページに関連付けられたJavaのクラスファイルからきています。Index.vmページはまた、"#entryCell(...)"のような、#で始まる多くのファンクションを含んでいます。これらのファンクションは、"webapps/APPNAME/templates/app/GlobalMacros.vm"ファイルで定義されているように、実行時にHTMLの断片に置き換えられます。このファイルを見ると、これらのそれぞれのメソッドが何をするかの考えを知ることができます。さらにこのファイルは、システムに独自のVelocityマクロを追加するために編集することができます。
In order to view the Java file that is associated with the Index.vm, go to the directory "webapps/APPNAME/WEB-INF/src/java/PACKAGE/modules/screens" A quick look in this directory should show you that each page with dynamic data in it has an associated class file in this directory. Open the file "Index.java" and look over its contents. As you can see, the "doBuildTemplate" method creates a variable called "entries" and associates the data that it pulls from the database in the "getEntries" method into it. In the case of the Index.vm page, this corresponds to all of the entries from our example database. The "context.put("entries", getEntries())" method places the data and the associated handle for it into our session context so that it can be accessed from our Index.vm page. You would edit this file to change the behavior of a given page. More information on building sites with Velocity is available here.
Index.vmに関連付けられているJavaファイルを見るために、"webapps/APPNAME/WEB-INF/src/java/PACKAGE/modules/screens"ディレクトリに移ります。このディレクトリをざっと見わたすと、動的なデータを含むそれぞれのページが、このディレクトリ内に関連付けられたクラスファイルを持っていることがわかります。"Index.java"ファイルを開いて内容に目を通します。見てのとおり、"doBuildTemplate"メソッドは"entries"という変数を作成し、"getEntries"メソッドの中でデータベースから引き出されるデータを関連付けています。Index.vmページのケースでは、これが例題のデータベースからのすべての項目に対応します。"context.put("entries", getEntries())"メソッドが、データと、それに関連付けられたハンドルをセッションの内容に配置するので、その結果、Index.vmページからアクセスができます。与えられたページの振る舞いを変更するために、このファイルを編集するでしょう。Velocityを使ったサイトの構築に関するより多くの情報は、ここにあります。
Now go back into your sample app in your web browser and insert an entry into the table. Look at the URL line in your browser. The end of it should contain "/action/SQL" This is the method that Turbine just used to insert your data into the database. The class file corresponding to it can be found in "webapps/APPNAME/WEB-INF/src/java/PACKAGE/modules/actions" and is called SQL.java. In fact, when you did your Insert of the data, Turbine called a method called "doInsert" inside of the SQL class in order to insert the data. A full explaination of how actions work is available here.
こんどはwebブラウザの例題アプリケーションに戻り、テーブルの項目を挿入します。ブラウザのURL表示を見てください。末尾には"/action/SQL"が含まれています。これは、Turbineがデータをデータベースに挿入するために使用するメソッドです。これに対応するクラスファイルは、"webapps/APPNAME/WEB-INF/src/java/PACKAGE/modules/actions"の中にあり、SQL.javaというものです。実際、データの挿入を行ったとき、Turbineはデータを挿入するために、SQLクラス内の"doInsert"というメソッドを呼び出しました。どのようにアクションが動作するかの完全な説明はここにあります。
Now that we know about actions, we should change our database to something more useful. In order to do this, move to the directory "webapps/APPNAME/WEB-INF/conf" and open up the file "APPNAME-schema.xml". This file contains our database schema in XML. This file should be rather self explainatory. Within it you can create new tables and new fields within existing tables. Add some more rows to the example table and save the file back. Now go to the directory "webapps/APPNAME/WEB-INF/build" and run the command "ant init" again. (WARNING: If this is done you will lose all of your data in the existing tables, do not run if you have data in your tables that you want to save.) This will update existing databases and their objects with new fields and create the databases defined in the .xml file, along with their associated java classes. The java classes that Turbine uses to access your database are located in the directory "webapps/APPNAME/WEB-INF/src/java/PACKAGE/om" Look at them to get an idea of how the object-model portion of Turbine operates. There should be one named after each of the tables that you defined above in your schema. These classes will be used to interact with the database while using Turbine.
アクションについて知ったので、データベースをより役に立つものに変更しましょう。それを行うために、"webapps/APPNAME/WEB-INF/conf"ディレクトリに移り、"APPNAME-schema.xml"ファイルを開きます。このファイルにはデータベースのスキーマがXMLで含まれています。このファイルは多少、自己説明的でしょう。この中で、新たなテーブルや、既存テーブルの中に新たなフィールドを作成することができます。さらにいくつかの行を例題テーブルに追加し、ファイルを保存します。こんどは"webapps/APPNAME/WEB-INF/build"ディレクトリに移り、"ant init"コマンドを再び実行します。(注意:これを行うと、既存テーブルのデータをすべて失います。テーブル内に保存しておきたいデータがある場合には実行してはいけません。)これは既存データベースとそのオブジェクトを新しいフィールドに更新し、.xmlファイルで定義されているデータベースを関連付けられたjavaクラスと一緒に作成します。Turbineがデータベースにアクセスするのに使用するjavaクラスは、"webapps/APPNAME/WEB-INF/src/java/PACKAGE/om"ディレクトリに配置されています。それらを見ると、Turbineのオブジェクトモデル部分がどのような操作をするかの考えを知ることができます。上記でスキーマの中に定義したそれぞれのテーブルの後ろに名前の付けられたものがあるでしょう。これらのクラスが、Turbineを使用しているときに、データベースと相互に作用するために使用されます。
After our schema has been updated we will need to go back and edit the .vm files that operate on it. Go back into "Index.vm" as described above and change the headings to those that match your new schema. If you have created another table that you would like to call from the Index, or have changed the name of your original table, edit your "Index.java" file to get the data from that Database instead of the default one by calling the OM object for it instead.
スキーマが更新された後、それを操作する.vmファイルに戻って編集する必要があります。上で述べたように"Index.vm"に戻り、新しいスキーマにあうようにヘッダを変更します。Indexから呼び出したい別のテーブルを作成している場合、もしくはオリジナルテーブルの名前を変更している場合は、"Index.java"ファイルを編集して、代わりにそのデータベースに対するOMオブジェクトを呼び出すことで、デフォルトのデータベースの代わりにそのデータベースからデータを取得するようにします。
You now have your first Turbine application up and running and you now know how to edit the Java and .vm files in the TDK in order to begin building a specific application. In order to recompile any Java files that you change or create in the TDK, move to "webapps/APPNAME/WEB-INF/build" and run "ant compile". This will recompile all of the Java files that have changed in your project. You may also wish to join the Turbine Users mailing list. Instructions for doing so can be found here.
ここまでで、初めてのTurbineアプリケーションを設定して実行し、特定のアプリケーションを構築し始めるためにTDKの中のJavaファイルと.vmファイルをどのように編集するかを知りました。TDKの中で変更、もしくは作成したどのJavaファイルを再コンパイルするためにも、"webapps/APPNAME/WEB-INF/build"に移動して、"ant compile"を実行します。これは、プロジェクト内で変更されたすべてのJavaファイルを再コンパイルします。Turbineユーザのメーリングリストにも参加したいことでしょう。参加するための説明書はここにあります。
The TDK uses Tomcat 4.0 as it's Servlet container, but you can package up your webapps and run them under any compliant Servlet container. The only thing that you have to change are the references to the Servlet 2.3 DTDs in your web.xml file. If you change these references, webapps that you develop with the TDK should be fully portable. We use the Tomcat 4.0 server because it is the burgeoning standard.
TDKはサーブレットコンテナとしてTomcat 4.0を使用していますが、規格に準拠したどのサーブレットコンテナの下でも、webアプリケーションをパッケージして実行することができます。変更しなければならないのは、web.xmlファイルの中にあるServlet 2.3 DTDへの参照だけです。これらの参照を変更すれば、TDKを使って開発するwebアプリケーションは完全にポータブルなものになるでしょう。我々はTomcat 4.0サーバを使用しています。なぜなら、それが成長の著しい標準であるからです。
We'll add more notes to this as the TDK gains more deployment features. There is a very primitive 'deploy' target, but all it currently does is package up your webapp in a WAR file.
我々は、TDKがより広く展開されるにしたがい、より多くの記述を追加するつもりです。ここにはかなり初期の'展開'ターゲットがありますが、それが現在行っているすべては、WARファイルの中のwebアプリケーションのパッケージです。