svnno****@sourc*****
svnno****@sourc*****
2008年 6月 26日 (木) 18:12:19 JST
Revision: 48
http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jetspeed-japan&view=rev&rev=48
Author: karma
Date: 2008-06-26 18:12:19 +0900 (Thu, 26 Jun 2008)
Log Message:
-----------
update translate
Modified Paths:
--------------
jetspeed-2-trans/trunk/ja/xdocs/j1-migration.xml
-------------- next part --------------
Modified: jetspeed-2-trans/trunk/ja/xdocs/j1-migration.xml
===================================================================
--- jetspeed-2-trans/trunk/ja/xdocs/j1-migration.xml 2008-06-26 04:54:57 UTC (rev 47)
+++ jetspeed-2-trans/trunk/ja/xdocs/j1-migration.xml 2008-06-26 09:12:19 UTC (rev 48)
@@ -474,18 +474,38 @@
<p>
<b>doView</b> メソッドは,Jetspeed 1 API の <b>getContent</b> メソッドと同等の,ポートレット API のメソッドです.ポートレット API は <b>ポートレットのモード</b> の概念を持ちます.<b>view, edit, help</b> の 3 つのデフォルトのポートレットモードがあります.これらのモードそれぞれに対して,あなたのポートレットがオーバーライド出来る 3 つのメソッドがあります.<b>doView, doEdit, doHelp</b> です.Jetspeed 1 では,RunData パラメータ 1 つだったところが,ポートレットAPI では,より Servlet API 的な <b>RenderRequest</b> と <b>RenderResponse</b> の 2 つのパラメータを持つことに注意してください.あなたのアプリケーションを移行する最も大きな部分の 1 つが RunData を RenderRequest と RenderReponse に変換する事でしょう.移行を始める前に,Portlet API のトレーニングコースを受講するか,ポートレット仕様を自分で読んだ上に,関連する記事や書籍を読んで,API を学ぶ事をおすすめします.ポートレット API を学び始めるのに良い書籍に,<a href='http://www.manning.com/hepper/'>Portlets and Apache Portals</a> があります.
</p>
+<div class="original">
<p>When rendering content, Jetspeed 1 makes use of a HTML construction kit called <b>ECS</b>. All rendering goes through Turbine and ECS.
The return type of the getContent method is a <b>ConcreteElement</b>, which is defined in the ECS API. Here is the typical way to
generate output from a portlet in Jetspeed-1:
</p>
+</div>
+<p>
+コンテンツを描画するとき,Jetspeed 1 は <b>ECS</b> と呼ばれる HTML 構築キットを使います.全ての描画は,Turbine と ECS を通じて行われます.
+</p>
+<div class="original">
<source>
<![CDATA[
...
String helloString = "Hello World. This is the portlet output in view mode.";
return new org.apache.jetspeed.util.JetspeedClearElement(helloString);
]]>
-</source>
+</source>
+</div>
+<source>
+<![CDATA[
+...
+String helloString = "Hello World. This is the portlet output in view mode.";
+return new org.apache.jetspeed.util.JetspeedClearElement(helloString);
+]]>
+</source>
+<div class="original">
<p>When rendering content in Jetspeed-2, the Portlet API uses a streaming interface:</p>
+</div>
+<p>
+Jetspeed 2 では,コンテンツを描画するとき,ポートレット API はストリーミングインターフェースを使います.
+</p>
+<div class="original">
<source>
<![CDATA[
response.setContentType("text/html");
@@ -500,11 +520,32 @@
response.getPortletOutputStream().write(helloString.getBytes());
]]>
</source>
+</div>
+<source>
+<![CDATA[
+response.setContentType("text/html");
+String helloString = "Hello World. This is the portlet output in view mode.";
+
+// using Java writers
+response.getWriter().println(helloString);
+
+.. OR ...
+
+// using Java streaming
+response.getPortletOutputStream().write(helloString.getBytes());
+]]>
+</source>
+<div class="original">
<p>Of course you can use JSPs or Velocity with either Jetspeed-1 or Jetspeed-2.
With Jetspeed-1, the common practice is to make use of the Jetspeed-1 <b>GenericMVCPortlet</b> or one of its derivitives,
the <b>VelocityPortlet</b> or the <b>JspPortlet</b>. Both the VelocityPortlet and JspPortlet are really just GenericMVCPortlets.
Here is the xreg example of a WeatherPortlet which extends the GenericMVCPortlet by setting its parent to Velocity
</p>
+</div>
+<p>
+もちろん,Jetspeed 1 か Jetspeed 2 のどちらでも JSP や Velocity を使うことは出来ます.Jetspeed 1 では,良く行われている事に,Jetspeed 1 <b>GenericMVCPortlet</b> またはその派生物,<b>VelocityPortlet</b> または <b>JspPortlet</b> の利用があります.VelocityPortlet と JspPortlet は両方共,GenericMVCPortlets です.ここに,その親に Velocity を設定した GenericMVCPortlet を継承した WeatherPortlet の xreg の例があります.
+</p>
+<div class="original">
<source>
<![CDATA[
<portlet-entry name="WeatherPortlet" hidden="false" type="ref" parent="Velocity" application="false">
@@ -512,11 +553,23 @@
</portlet-entry>
]]>
</source>
+</div>
+<source>
+<![CDATA[
+ <portlet-entry name="WeatherPortlet" hidden="false" type="ref" parent="Velocity" application="false">
+ <parameter name="template" value="weather" hidden="true"/>
+ </portlet-entry>
+]]>
+</source>
+<div class="original">
<p>The template parameter is named <b>weather</b>. Since this is a Velocity MVC portlet, Jetspeed-1 knows to look under
the <b>WEB-INF/templates/vm/portlets/html</b> directory to find <b>weather.vm</b>. The MVC portlet will automatically handle
the details of dispatching to this Velocity template to render your portlet. Here is the actual contents of the velocity template.
Note that we don't have to write any portlet Java code in this case, but only the actual template.
</p>
+</div>
+<p>テンプレートパラメータは <b>weather</b> と名づけられています.これは Velocity MVC portlet なので,Jetspeed 1 は <b>WEB-INF/templates/vm/portlets/html</b> ディレクトリ以下に <b>weather.vm</b> が見つかることを知っています.MVC ポートレットは自動的に,ポートレットを描画するために,この Velocity テンプレートの割り当てを処理するでしょう.ここに,Velocity テンプレートの実際のコンテンツがあります.この場合,ポートレットの Java コードを書く必要はなく,実際のテンプレートを書くだけで良いことに注意してください.</p>
+<div class="original">
<source>
<![CDATA[
#if (!$weather_city_info)
@@ -528,9 +581,27 @@
#end
]]>
</source>
+</div>
+<source>
+<![CDATA[
+#if (!$weather_city_info)
+<BR>${l10n.WEATHER_PLEASE_CUSTOMIZE_YO_VM}<br><BR>
+#else
+<a href="http://www.wunderground.com/${weather_city_info}.html"
+target="_blank"><img src="http://banners.wunderground.com/banner/${weather_style}/language/www/${weather_city_info}.gif"
+alt="Click for ${weather_city_info} Forecast" border="0"></a>
+#end
+]]>
+</source>
+<div class="original">
<p>With Jetspeed-2 and the Portlet API, we can make use of the Velocity Bridge or the JSP Bridge to delegate to portlets.
The simplest case is just dispatching the call yourself to the JSP or Velocity servlet. Here is an example of dispatching to a JSP from the doView:
</p>
+</div>
+<p>
+Jetspeed 2 とポートレット API では,ポートレットに処理を移譲するために,Velocity ブリッジ,もしくは JSP ブリッジを使うことが出来ます.この最も簡単なケースは,自身の呼び出しに JSP か Velocity サーブレットを割り当てるケースです.ここに,doView から JSP を割り当てる例があります.
+</p>
+<div class="original">
<source>
<![CDATA[
protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
@@ -543,9 +614,27 @@
}
]]>
</source>
+</div>
+<source>
+<![CDATA[
+protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
+{
+ PortletContext context = getPortletContext();
+ ResourceBundle resource = getPortletConfig().getResourceBundle(request.getLocale());
+ request.setAttribute("viewMessage", resource.getString("preference.label.MyModeIsView"));
+ PortletRequestDispatcher rd = context.getRequestDispatcher("/WEB-INF/demo/preference/pref-view.jsp");
+ rd.include(request, response);
+}
+]]>
+</source>
+<div class="original">
<p>And here is an example of the WeatherPortlet extending the Velocity Bridge, and making use of the Portlet API User Preferences feature,
note that we do not directly create a dispatcher here, but the framework will do that automatically:
</p>
+</div>
+<p>そして,ここに Velocity ブリッジを継承した WeatherPortlet の例があります.ここではポートレット API の User Preferences 機能を使っています.ここでは直接ディスパッチャーを作成していないにも関わらず,フレームワークが自動的にそれを実行していることに注意してください.
+</p>
+<div class="original">
<source>
<![CDATA[
import org.apache.portals.bridges.velocity.GenericVelocityPortlet;
@@ -577,7 +666,43 @@
}
]]>
</source>
+</div>
+<source>
+<![CDATA[
+import org.apache.portals.bridges.velocity.GenericVelocityPortlet;
+...
+
+public class WeatherPortlet extends GenericVelocityPortlet
+{
+...
+
+public void doView(RenderRequest request, RenderResponse response)
+ throws PortletException, IOException
+{
+ Context context = super.getContext(request);
+
+ String cityInfo = (String) request.getPortletSession().getAttribute(
+ WEATHER_CITY_INFO);
+
+ PortletPreferences prefs = request.getPreferences();
+ String city = prefs.getValue(WEATHER_CITY, "Bakersfield");
+ String state = prefs.getValue(WEATHER_STATE, "CA");
+ String station = prefs.getValue(WEATHER_STATION, null);
+ cityInfo = getCityInfo(city, state, station);
+ context.put(WEATHER_CITY_INFO, cityInfo);
+
+ String style = prefs.getValue(WEATHER_STYLE, "infobox");
+ context.put(WEATHER_STYLE, style);
+ response.setProperty("david", "taylor");
+ super.doView(request, response);
+}
+]]>
+</source>
+<div class="original">
<p>And here is the Velocity template to render the portlet content:</p>
+</div>
+<p>そして,ここにポートレットのコンテンツを描画するための Velocity テンプレートがあります.</p>
+<div class="original">
<source>
<![CDATA[
#if (!$weather_city_info)
@@ -589,6 +714,18 @@
#end
]]>
</source>
+</div>
+<source>
+<![CDATA[
+#if (!$weather_city_info)
+Please configure your Weather settings.
+#else
+<a href="http://www.wunderground.com/${weather_city_info}.html"
+target="_blank"><img src="http://banners.wunderground.com/banner/$!weather_style/language/www/${weather_city_info}.gif"
+alt="Click for $weather_city_info Forecast" border="0"></a>
+#end
+]]>
+</source>
</subsection>
<subsection name='Converting a Turbine Action'>
<p>The Portlet API defines several phases of execution during the processing of a portlet page. The action phase is designed to be executed