<?xml version="1.0" encoding="Shift_JIS"?>

<!DOCTYPE document SYSTEM "./dtd/document-v10.dtd">

<document>
  <header>
    <title>JBuilder 4 との統合/JBuilder 4 Integration</title>
    <authors>
      <person name="Cedric Chabanois" email="cchabanois@ifrance.com"/>
      <person name="Kunal Vaishnav" email="Kunal_Vaishnav@jdedwards.com"/>
      <person name="Vincent Massol" email="vmassol@apache.org"/>
    </authors>
    <translators><person name="漆島賢二"/></translators>
  </header>

  <body>

    <s1 title="序文および必要条件/Forewords and Requirements">
      <p>
        First of all, you need to download the
        <link href="downloads.html">Cactus distribution</link>
      </p>
      <p>
	まず最初に、<link href="downloads.html">Cactus ディストリビューション</link>をダウンロードする必要があります
      </p>
    </s1>

    <s1 title="ステップ 1 : JBuilder ライブラリの生成/Step 1 : Create JBuilder libraries">

      <p>
        Let's assume the following conventions :
        <strong><code>{Cactus dir}</code></strong> is the directory where you
        have unzipped the Cactus distribution or sources.
        Let's also assume <strong><code>{Tomcat dir}</code></strong> to be the Tomcat directory.
      </p>
      <p>
        次の取り決めをしましょう : 
        <strong><code>{Cactus dir}</code></strong> は、
	Cactus ディストリビューションを解凍したディレクトリです。
	また、<strong><code>{Tomcat dir}</code></strong> を、
	Tomcat のディレクトリとします。
      </p>

      <figure src="images/jb_libraries.gif" alt="jbuilder libraries" />

      <s2 title="JUnit ライブラリの作成/Create the JUnit library">

        <p>
          Create a JUnit library and include <code>junit.jar</code>.
        </p>
        <p>
	  JUnit ライブラリを作成し、<code>junit.jar</code>をインクルードします。
        </p>

      </s2>

      <s2 title="Cactus ライブラリの作成/Create the Cactus library">

        <p>
          Create a Cactus library containing <code>cactus.jar</code> and
          <code>aspectjrt.jar</code> (you can actually create a separate
          library for AspectJ if you wish).
        </p>
        <p>
	  <code>cactus.jar</code> および
          <code>aspectjrt.jar</code> の入っている Cactus ライブラリを作成します。
	  (お望みなら、実際に AspectJ の別のライブラリを作ることもできます)
        </p>

        <note>
          You can also add the source file directories in the source tab.
          This way, you will be able to debug inside cactus sources.
        </note>
        <note>
	  ソースタブにソースファイルディレクトリを加えることもできます。
	  この方法により、Cactus のソースの中身をデバッグすることができます。
        </note>

      </s2>

      <s2 title="Tomcat ライブラリの作成/Create the tomcat library">
        <p>
          Create another library named <code>tomcat</code>
          and add all the jar files from <code>{Tomcat dir}/lib</code>.
        </p>
        <p>
	  <code>tomcat</code> という名前の別のライブラリを作成し、
	  <code>{Tomcat dir}/lib</code> の全ての jar ファイルを加えます。
        </p>

        <note>
          If you use JBuilder 4 Enterprise or JBuilder 4 Professionnal, you don't need to create
          this library because Tomcat 3.1 is provided with those versions.
        </note>
        <note>
	  JBuilder 4 Enterprise あるいは、JBuilder 4 Professionnal
	  を使っている場合、それらのバージョンに Tomcat 3.1 はついているので、
	  このライブラリを作成する必要はありません。
        </note>

      </s2>
    </s1>

    <s1 title="ステップ 2 : cactus.properties ファイルの設定/Step 2 : Set up the cactus.properties file">

      <p>
        Edit a new file named <code>cactus.properties</code>
        (see the <link href="howto_config.html">Configuration Howto</link>
        tutorial for more details on <code>cactus.properties</code>).
      </p>
      <p>
	<code>cactus.properties</code> という名前の新しいファイルを編集します。
	(<code>cactus.properties</code> の詳しい説明は、
<link href="howto_config.html">Configuration Howto</link>
	チュートリアルをご覧ください。)
      </p>
      <p>
        Copy your <code>cactus.properties</code> file to a directory present
        in your classpath. You can copy it to a directory and add this
        directory in the class tab of the cactus library.
      </p>
      <p>
	自分の <code>cactus.properties</code> ファイルを自分のクラスパスにある任意のディレクトリにコピーします。
	任意のディレクトリにコピーして、
	そのディレクトリを Cactus ライブラリのクラスタブに加えることもできます。
      </p>

    </s1>

    <s1 title="ステップ 3 : Tomcat 環境の設定/Step 3 : Configure Tomcat Environment">

      <s2 title="cactus webapp の作成/Create a cactus webapp">

        <p>
          Create and edit the file
          <code>{Tomcat dir}/webapps/cactus/WEB-INF/web.xml</code>. Here is an
          example for Servlet API 2.2 :
        </p>
        <p>
	  <code>{Tomcat dir}/webapps/cactus/WEB-INF/web.xml</code> ファイルを作成して編集します。
	  ここで、Servlet API 2.2 の例を示します : 
        </p>

<source><![CDATA[
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
    <servlet>
        <servlet-name>ServletRedirector</servlet-name>
        <servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>ServletRedirector</servlet-name>
        <url-pattern>/ServletRedirector</url-pattern>
    </servlet-mapping>
</web-app>
]]></source>

      </s2>

      <note>
        You can edit <code>{Tomcat dir}/conf/web.xml</code> instead if you
        prefer. <br/>
        You can also edit the <code>web.xml</code> file of the webapp where is
        located the servlet(s) you want to test. <br/>
        Don't forget to modify <code>cactus.properties</code> file accordingly.
      </note>
      <note>
	そのほうがよければ、
	<code>{Tomcat dir}/conf/web.xml</code> の方を代わりに編集することもできます。<br/>
	また、テストしたいサーブレットが置かれた webapp ディレクトリの
	<code>web.xml</code> を編集することも可能です。<br/>
	それに合わせて、<code>cactus.properties</code> ファイルを変更することを忘れないでください。
      </note>
    </s1>

    <s1 title="ステップ 4 : 自分のプロジェクトの設定/Step 4 : Configure your project">
      <ol>
        <li>
          Put <code>-classic -Dtomcat.home="{Tomcat dir}"</code> as the VM
          parameters for your project and
          <code>org.apache.tomcat.startup.Tomcat</code> as the main class.
        </li>
        <li>
	  プロジェクトの VM のパラメータとして、
	  <code>-classic -Dtomcat.home="{Tomcat dir}"</code> を、
	  メインクラスとして、
	  <code>org.apache.tomcat.startup.Tomcat</code> を設定します。
        </li>
        <li>
          Add the following libraries in the <code>Required Libraries</code>
          tab in the project properties :<br/>
	  プロジェクトプロパティの
	  <code>Required Libraries</code> タブに次のライブラリを加えます : <br/>
          <ul>
            <li>tomcat</li>
            <li>servlet</li>
            <li>junit</li>
            <li>cactus</li>
          </ul>
          <figure src="images/jb_paths.gif" alt="jbuilder libraries" />
        </li>
      </ol>
    </s1>

    <s1 title="ステップ 5 : サーブレットのテストとデバッグ/Step 5 : Test and debug your servlet">

      <s2 title="サーブレットのテスト/Test your servlet">
        <ol>
          <li>
            Start Tomcat using the <code>Run/Run Project</code> menu.
          </li>
          <li>
            <code>Run/Run Project</code> メニューにより Tomcat を起動します
          </li>
          <li>
            Run your unit tests : right Click on the file containing your test
            case and click on <code>run</code>
          </li>
          <li>
            単体テストを実行します : 自分のテストケースが含まれているファイルをクリックし、<code>run</code> をクリックします。
          </li>
        </ol>
      </s2>

      <s2 title="自分のサーブレットとテストのデバッグ/Debug your servlet and your tests">
        <p>
          You can easily print the results of the methods on the server-side
          itself.
        </p>
        <p>
	  サーバー側自身のメソッドの結果は簡単に出力できます。
        </p>
        <p>
          You can also start Tomcat in debug mode (<code>Run/debug
          project</code>). This way, you can stop at breakpoints on methods
          that are executed on the server side (<code>void testXXX()</code> for
          example)
        </p>
        <p>
	  Tomcat をデバッグモードで起動することもできます。
	  (<code>Run/debug project</code>)
	  この方法により、
	  サーバー側で実行されるメソッドをブレークポイントで停止させることもできます。
          (例えば、<code>void testXXX()</code> など)
        </p>
        <p>
          If you right click on the file containing your test case and click
          on <code>debug</code>, you can stop at breakpoints on methods that
          are executed on the client side like
          <code>void endXXX(WebResponse)</code> or
          <code>void beginXXX(WebRequest)</code>
        </p>
        <p>
	  自分のテストケースが入っているファイルを右クリックし、
	  <code>debug</code> をクリックした場合、
          <code>void endXXX(WebResponse)</code> や、
          <code>void beginXXX(WebRequest)</code> のようにクライアント側で実行されたメソッドにおいて、ブレークポイントで停止させることができます。
        </p>
      </s2>
    </s1>

  </body>
</document>
