alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (events.po)

This example Hibernate source code file (events.po) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

auditable, auditinterceptor, cdata, hibernate, hibernate, loadeventlistener, object, object, serializable, serializable, string, tag, tag, type

The Hibernate events.po source code

# translation of Collection_Mapping.po to
# Xi HUANG <xhuang@redhat.com>, 2007, 2010.
msgid ""
msgstr ""
"Project-Id-Version: Collection_Mapping\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-02-10T07:25:34\n"
"PO-Revision-Date: 2010-01-13 11:47+1000\n"
"Last-Translator: Xi HUANG <xhuang@redhat.com>\n"
"Language-Team:  <en@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\n"

#. Tag: title
#, no-c-format
msgid "Interceptors and events"
msgstr "インターセプタとイベント"

#. Tag: para
#, no-c-format
msgid ""
"It is useful for the application to react to certain events that occur "
"inside Hibernate. This allows for the implementation of generic "
"functionality and the extension of Hibernate functionality."
msgstr ""
"アプリケーションが Hibernate の内部で発生するイベントに対応できると役に立つこ"
"とがあります。ある種の一般的な機能を実装できるようになり、また Hibernate の機"
"能を拡張することもできるようになります。"

#. Tag: title
#, no-c-format
msgid "Interceptors"
msgstr "インターセプタ"

#. Tag: para
#, no-c-format
msgid ""
"The <literal>Interceptor interface provides callbacks from the "
"session to the application, allowing the application to inspect and/or "
"manipulate properties of a persistent object before it is saved, updated, "
"deleted or loaded. One possible use for this is to track auditing "
"information. For example, the following <literal>Interceptor "
"automatically sets the <literal>createTimestamp when an "
"<literal>Auditable is created and updates the "
"<literal>lastUpdateTimestamp property when an Auditable インターフェースを使って、セッションからアプリ"
"ケーションへコールバックをすることができます。これにより永続オブジェクトの保"
"存、更新、削除、読み込みの前に、アプリケーションがプロパティを検査したり操作"
"したりできるようになります。これは監査情報の追跡に利用できます。下の例で "
"<literal>InterceptorAuditable が作成されると"
"自動的に <literal>createTimestamp を設定し、 AuditablelastUpdateTimestamp プロパ"
"ティを更新します。"

#. Tag: para
#, no-c-format
msgid ""
"You can either implement <literal>Interceptor directly or extend "
"<literal>EmptyInterceptor."
msgstr ""
"<literal>Interceptor を直接実装したり、 (さらによいのは) "
"<literal>EmptyInterceptor を拡張したりできます。"

#. Tag: para
#, no-c-format
msgid ""
"There are two kinds of inteceptors: <literal>Session-scoped and "
"<literal>SessionFactory-scoped."
msgstr ""
"インターセプタには二種類あります: <literal>Session スコープのもの"
"と <literal>SessionFactory スコープのものです。"

#. Tag: para
#, no-c-format
msgid ""
"A <literal>Session-scoped interceptor is specified when a session "
"is opened using one of the overloaded SessionFactory.openSession() methods "
"accepting an <literal>Interceptor."
msgstr ""
"<literal>Session スコープのインターセプタは、セッションをオープンす"
"るときに指定します。 <literal>Interceptor を引数に取る "
"SessionFactory.openSession() のオーバーロードメソッドの一つを使います。"

#. Tag: para
#, no-c-format
msgid ""
"A <literal>SessionFactory-scoped interceptor is registered with "
"the <literal>Configuration object prior to building the "
"<literal>SessionFactory. Unless a session is opened explicitly "
"specifying the interceptor to use, the supplied interceptor will be applied "
"to all sessions opened from that <literal>SessionFactory. "
"<literal>SessionFactory-scoped interceptors must be thread safe. "
"Ensure that you do not store session-specific states, since multiple "
"sessions will use this interceptor potentially concurrently."
msgstr ""
"<literal>SessionFactory スコープのインターセプタは "
"<literal>Configuration オブジェクトを使って登録します。これは "
"<literal>SessionFactory の構築よりも優先されます。この場合、提供さ"
"れるインターセプタは <literal>SessionFactory からオープンされたすべ"
"てのセッションに適用されます。これは使用するインターセプタを明示的に指定して"
"セッションをオープンしない限り、そうなります。 <literal>SessionFactory architecture. The event "
"system can be used in addition, or as a replacement, for interceptors."
msgstr ""
"永続化層で特定のイベントに対応しなければならない場合、 Hibernate3 の "
"<emphasis>イベント アーキテクチャを使うこともできます。イベントシ"
"ステムはインターセプタと一緒に使うか、またはインターセプタの代わりとして使う"
"ことができます。"

#. Tag: para
#, no-c-format
msgid ""
"All the methods of the <literal>Session interface correlate to an "
"event. You have a <literal>LoadEvent, a FlushEventorg."
"hibernate.event</literal> package for the full list of defined event types. "
"When a request is made of one of these methods, the Hibernate "
"<literal>Session generates an appropriate event and passes it to "
"the configured event listeners for that type. Out-of-the-box, these "
"listeners implement the same processing in which those methods always "
"resulted. However, you are free to implement a customization of one of the "
"listener interfaces (i.e., the <literal>LoadEvent is processed by "
"the registered implementation of the <literal>LoadEventListener "
"interface), in which case their implementation would be responsible for "
"processing any <literal>load() requests made of the "
"<literal>Session."
msgstr ""
"本質的に <literal>Session インターフェースのすべてのメソッドは、1個"
"のイベントと相互に関連します。例えば <literal>LoadEvent 、 "
"<literal>FlushEvent などがあります (定義済みのイベント型の一覧につ"
"いては、 XML 設定ファイルの DTD や <literal>org.hibernate.event "
"パッケージを調べてください) 。リクエストがこれらのメソッドの1つから作られる"
"とき、 Hibernate の <literal>Session は適切なイベントを生成し、その"
"イベント型に設定されたイベントリスナに渡します。すばらしいことに、これらのリ"
"スナはそのメソッドと同じ処理を実装します。とはいえ、リスナインターフェースの"
"一つを自由にカスタム実装できます (つまり、 <literal>LoadEvent は登"
"録された <literal>LoadEventListener インターフェースの実装により処"
"理されます)。その場合、その実装には <literal>Session から作られた"
"どのような <literal>load() リクエストをも処理する責任があります。"

#. Tag: para
#, no-c-format
msgid ""
"The listeners should be considered singletons. This means they are shared "
"between requests, and should not save any state as instance variables."
msgstr ""
"リスナは事実上シングルトンであると見なせます。つまりリスナはリクエスト間で共"
"有されるため、インスタンス変数として状態を保持するべきではないということで"
"す。"

#. Tag: para
#, no-c-format
msgid ""
"A custom listener implements the appropriate interface for the event it "
"wants to process and/or extend one of the convenience base classes (or even "
"the default event listeners used by Hibernate out-of-the-box as these are "
"declared non-final for this purpose). Custom listeners can either be "
"registered programmatically through the <literal>Configuration "
"object, or specified in the Hibernate configuration XML. Declarative "
"configuration through the properties file is not supported. Here is an "
"example of a custom load event listener:"
msgstr ""
"カスタムリスナは処理したいイベントについて適切なインターフェースを実装するべ"
"きです。便利な??底クラスのうちの一つを継承してもよいです (または Hibernate "
"がデフォルトで使用するイベントリスナを継承してもよいです。すばらしいことに、"
"この目的のために非 final として宣言されています) 。カスタムリスナは "
"<literal>Configuration オブジェクトを使ってプログラムから登録する"
"か、 Hibernate の XML 設定ファイルで指定できます (プロパティファイルで宣言的"
"に設定する方法はサポートされていません) 。カスタムロードイベントリスナの例を"
"示します:"

#. Tag: para
#, no-c-format
msgid ""
"You also need a configuration entry telling Hibernate to use the listener in "
"addition to the default listener:"
msgstr ""
"デフォルトリスナ以外のリスナを使うには、 Hibernate への設定も必要です:"

#. Tag: para
#, no-c-format
msgid "Instead, you can register it programmatically:"
msgstr "またその他に、プログラムで登録する方法もあります:"

#. Tag: para
#, no-c-format
msgid ""
"Listeners registered declaratively cannot share instances. If the same class "
"name is used in multiple <literal><listener/> elements, each "
"reference will result in a separate instance of that class. If you need to "
"share listener instances between listener types you must use the "
"programmatic registration approach."
msgstr ""
"リスナを宣言的に登録すると、そのリスナのインスタンスを共有できません。複数の "
"<literal><listener/> 要素で同じクラス名が使われると、それぞれ"
"の参照はそのクラスの別々のインスタンスを指すことになります。リスナ型の間でリ"
"スナインスタンスを共有する必要があれば、プログラムで登録する方法を採らなけれ"
"ばなりません。"

#. Tag: para
#, no-c-format
msgid ""
"Why implement an interface and define the specific type during "
"configuration? A listener implementation could implement multiple event "
"listener interfaces. Having the type additionally defined during "
"registration makes it easier to turn custom listeners on or off during "
"configuration."
msgstr ""
"なぜインターフェースを実装して、特化した型を設定時に指定するのでしょうか?リ"
"スナの実装クラスに、複数のイベントリスナインターフェースを実装できるからで"
"す。登録時に追加で型を指定することで、カスタムリスナの on/off を設定時に簡単"
"に切り替えられます。"

#. Tag: title
#, no-c-format
msgid "Hibernate declarative security"
msgstr "Hibernate の宣言的なセキュリティ"

#. Tag: para
#, no-c-format
msgid ""
"Usually, declarative security in Hibernate applications is managed in a "
"session facade layer. Hibernate3 allows certain actions to be permissioned "
"via JACC, and authorized via JAAS. This is an optional functionality that is "
"built on top of the event architecture."
msgstr ""
"一般的に Hibernate アプリケーションの宣言的なセキュリティは、セッションファ"
"サード層で管理します。現在、 Hiberenate3 は JACC で許可し、さらに JAAS で認証"
"したアクションを許しています。これはイベントアーキテクチャの最上位に組み込ま"
"れているオプションの機能です。"

#. Tag: para
#, no-c-format
msgid ""
"First, you must configure the appropriate event listeners, to enable the use "
"of JAAS authorization."
msgstr ""
"まず最初に、適切なイベントリスナを設定して JAAS 認証を使えるようにしなければ"
"なりません。"

#. Tag: para
#, no-c-format
msgid ""
"Note that <literal><listener type=\"...\" class=\"...\"/> is "
"shorthand for <literal><event type=\"...\"><listener class=\"...\"/"
"></event></literal> when there is exactly one listener for a "
"particular event type."
msgstr ""
"特定のイベント型に対してちょうど一つのリスナがあるとき、 <literal><"
"listener type=\"...\" class=\"...\"/></literal> は <event "
"type=\"...\"><listener class=\"...\"/></event></literal> の簡"
"略形に過ぎないことに注意してください。"

#. Tag: para
#, no-c-format
msgid ""
"Next, while still in <literal>hibernate.cfg.xml, bind the "
"permissions to roles:"
msgstr ""
"次に、同じく <literal>hibernate.cfg.xml でロールにパーミッションを"
"与えてください:"

#. Tag: para
#, no-c-format
msgid "The role names are the roles understood by your JACC provider."
msgstr "このロール名は使用する JACC プロバイダに理解されるロールです。"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[package org.hibernate.test;\n"
#~ "\n"
#~ "import java.io.Serializable;\n"
#~ "import java.util.Date;\n"
#~ "import java.util.Iterator;\n"
#~ "\n"
#~ "import org.hibernate.EmptyInterceptor;\n"
#~ "import org.hibernate.Transaction;\n"
#~ "import org.hibernate.type.Type;\n"
#~ "\n"
#~ "public class AuditInterceptor extends EmptyInterceptor {\n"
#~ "\n"
#~ "    private int updates;\n"
#~ "    private int creates;\n"
#~ "    private int loads;\n"
#~ "\n"
#~ "    public void onDelete(Object entity,\n"
#~ "                         Serializable id,\n"
#~ "                         Object[] state,\n"
#~ "                         String[] propertyNames,\n"
#~ "                         Type[] types) {\n"
#~ "        // do nothing\n"
#~ "    }\n"
#~ "\n"
#~ "    public boolean onFlushDirty(Object entity,\n"
#~ "                                Serializable id,\n"
#~ "                                Object[] currentState,\n"
#~ "                                Object[] previousState,\n"
#~ "                                String[] propertyNames,\n"
#~ "                                Type[] types) {\n"
#~ "\n"
#~ "        if ( entity instanceof Auditable ) {\n"
#~ "            updates++;\n"
#~ "            for ( int i=0; i < propertyNames.length; i++ ) {\n"
#~ "                if ( \"lastUpdateTimestamp\".equals( propertyNames[i] ) ) "
#~ "{\n"
#~ "                    currentState[i] = new Date();\n"
#~ "                    return true;\n"
#~ "                }\n"
#~ "            }\n"
#~ "        }\n"
#~ "        return false;\n"
#~ "    }\n"
#~ "\n"
#~ "    public boolean onLoad(Object entity,\n"
#~ "                          Serializable id,\n"
#~ "                          Object[] state,\n"
#~ "                          String[] propertyNames,\n"
#~ "                          Type[] types) {\n"
#~ "        if ( entity instanceof Auditable ) {\n"
#~ "            loads++;\n"
#~ "        }\n"
#~ "        return false;\n"
#~ "    }\n"
#~ "\n"
#~ "    public boolean onSave(Object entity,\n"
#~ "                          Serializable id,\n"
#~ "                          Object[] state,\n"
#~ "                          String[] propertyNames,\n"
#~ "                          Type[] types) {\n"
#~ "\n"
#~ "        if ( entity instanceof Auditable ) {\n"
#~ "            creates++;\n"
#~ "            for ( int i=0; i<propertyNames.length; i++ ) {\n"
#~ "                if ( \"createTimestamp\".equals( propertyNames[i] ) ) {\n"
#~ "                    state[i] = new Date();\n"
#~ "                    return true;\n"
#~ "                }\n"
#~ "            }\n"
#~ "        }\n"
#~ "        return false;\n"
#~ "    }\n"
#~ "\n"
#~ "    public void afterTransactionCompletion(Transaction tx) {\n"
#~ "        if ( tx.wasCommitted() ) {\n"
#~ "            System.out.println(\"Creations: \" + creates + \", Updates: "
#~ "\" + updates, \"Loads: \" + loads);\n"
#~ "        }\n"
#~ "        updates=0;\n"
#~ "        creates=0;\n"
#~ "        loads=0;\n"
#~ "    }\n"
#~ "\n"
#~ "}]]>"
#~ msgstr ""
#~ "package org.hibernate.test;\n"
#~ "\n"
#~ "import java.io.Serializable;\n"
#~ "import java.util.Date;\n"
#~ "import java.util.Iterator;\n"
#~ "\n"
#~ "import org.hibernate.EmptyInterceptor;\n"
#~ "import org.hibernate.Transaction;\n"
#~ "import org.hibernate.type.Type;\n"
#~ "\n"
#~ "public class AuditInterceptor extends EmptyInterceptor {\n"
#~ "\n"
#~ "    private int updates;\n"
#~ "    private int creates;\n"
#~ "    private int loads;\n"
#~ "\n"
#~ "    public void onDelete(Object entity,\n"
#~ "                         Serializable id,\n"
#~ "                         Object[] state,\n"
#~ "                         String[] propertyNames,\n"
#~ "                         Type[] types) {\n"
#~ "        // do nothing\n"
#~ "    }\n"
#~ "\n"
#~ "    public boolean onFlushDirty(Object entity,\n"
#~ "                                Serializable id,\n"
#~ "                                Object[] currentState,\n"
#~ "                                Object[] previousState,\n"
#~ "                                String[] propertyNames,\n"
#~ "                                Type[] types) {\n"
#~ "\n"
#~ "        if ( entity instanceof Auditable ) {\n"
#~ "            updates++;\n"
#~ "            for ( int i=0; i < propertyNames.length; i++ ) {\n"
#~ "                if ( \"lastUpdateTimestamp\".equals( propertyNames[i] ) ) "
#~ "{\n"
#~ "                    currentState[i] = new Date();\n"
#~ "                    return true;\n"
#~ "                }\n"
#~ "            }\n"
#~ "        }\n"
#~ "        return false;\n"
#~ "    }\n"
#~ "\n"
#~ "    public boolean onLoad(Object entity,\n"
#~ "                          Serializable id,\n"
#~ "                          Object[] state,\n"
#~ "                          String[] propertyNames,\n"
#~ "                          Type[] types) {\n"
#~ "        if ( entity instanceof Auditable ) {\n"
#~ "            loads++;\n"
#~ "        }\n"
#~ "        return false;\n"
#~ "    }\n"
#~ "\n"
#~ "    public boolean onSave(Object entity,\n"
#~ "                          Serializable id,\n"
#~ "                          Object[] state,\n"
#~ "                          String[] propertyNames,\n"
#~ "                          Type[] types) {\n"
#~ "\n"
#~ "        if ( entity instanceof Auditable ) {\n"
#~ "            creates++;\n"
#~ "            for ( int i=0; i<propertyNames.length; i++ ) {\n"
#~ "                if ( \"createTimestamp\".equals( propertyNames[i] ) ) {\n"
#~ "                    state[i] = new Date();\n"
#~ "                    return true;\n"
#~ "                }\n"
#~ "            }\n"
#~ "        }\n"
#~ "        return false;\n"
#~ "    }\n"
#~ "\n"
#~ "    public void afterTransactionCompletion(Transaction tx) {\n"
#~ "        if ( tx.wasCommitted() ) {\n"
#~ "            System.out.println(\"Creations: \" + creates + \", Updates: "
#~ "\" + updates,\n"
#~ "                \"Loads: \" + loads);\n"
#~ "        }\n"
#~ "        updates=0;\n"
#~ "        creates=0;\n"
#~ "        loads=0;\n"
#~ "    }\n"
#~ "\n"
#~ "}"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[Session session = sf.openSession( new AuditInterceptor() );]]>"
#~ msgstr "Session session = sf.openSession( new AuditInterceptor() );"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[new Configuration().setInterceptor( new AuditInterceptor() );]]>"
#~ msgstr "new Configuration().setInterceptor( new AuditInterceptor() );"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[public class MyLoadListener implements LoadEventListener {\n"
#~ "    // this is the single method defined by the LoadEventListener "
#~ "interface\n"
#~ "    public void onLoad(LoadEvent event, LoadEventListener.LoadType "
#~ "loadType)\n"
#~ "            throws HibernateException {\n"
#~ "        if ( !MySecurity.isAuthorized( event.getEntityClassName(), event."
#~ "getEntityId() ) ) {\n"
#~ "            throw MySecurityException(\"Unauthorized access\");\n"
#~ "        }\n"
#~ "    }\n"
#~ "}]]>"
#~ msgstr ""
#~ "public class MyLoadListener implements LoadEventListener {\n"
#~ "    // this is the single method defined by the LoadEventListener "
#~ "interface\n"
#~ "    public void onLoad(LoadEvent event, LoadEventListener.LoadType "
#~ "loadType)\n"
#~ "            throws HibernateException {\n"
#~ "        if ( !MySecurity.isAuthorized( event.getEntityClassName(), event."
#~ "getEntityId() ) ) {\n"
#~ "            throw MySecurityException(\"Unauthorized access\");\n"
#~ "        }\n"
#~ "    }\n"
#~ "}"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<hibernate-configuration>\n"
#~ "    <session-factory>\n"
#~ "        ...\n"
#~ "        <event type=\"load\">\n"
#~ "            <listener class=\"com.eg.MyLoadListener\"/>\n"
#~ "            <listener class=\"org.hibernate.event.def."
#~ "DefaultLoadEventListener\"/>\n"
#~ "        </event>\n"
#~ "    </session-factory>\n"
#~ "</hibernate-configuration>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[Configuration cfg = new Configuration();\n"
#~ "LoadEventListener[] stack = { new MyLoadListener(), new "
#~ "DefaultLoadEventListener() };\n"
#~ "cfg.EventListeners().setLoadEventListeners(stack);]]>"
#~ msgstr ""
#~ "Configuration cfg = new Configuration();\n"
#~ "LoadEventListener[] stack = { new MyLoadListener(), new "
#~ "DefaultLoadEventListener() };\n"
#~ "cfg.EventListeners().setLoadEventListeners(stack);"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<listener type=\"pre-delete\" class=\"org.hibernate.secure."
#~ "JACCPreDeleteEventListener\"/>\n"
#~ "<listener type=\"pre-update\" class=\"org.hibernate.secure."
#~ "JACCPreUpdateEventListener\"/>\n"
#~ "<listener type=\"pre-insert\" class=\"org.hibernate.secure."
#~ "JACCPreInsertEventListener\"/>\n"
#~ "<listener type=\"pre-load\" class=\"org.hibernate.secure."
#~ "JACCPreLoadEventListener\"/>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<grant role=\"admin\" entity-name=\"User\" actions=\"insert,update,read"
#~ "\"/>\n"
#~ "<grant role=\"su\" entity-name=\"User\" actions=\"*\"/>"

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate events.po source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.