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, cdata, hibernate, hibernate, loadeventlistener, object, object, serializable, string, tag, tag, type

The Hibernate events.po source code

# translation of events.po to French
# Myriam Malga <mmalga@redhat.com>, 2007.
# Xi HUANG <xhuang@redhat.com>, 2007.
# Corina Roe <croe@redhat.com>, 2009.
# translation of Collection_Mapping.po to
msgid ""
msgstr ""
"Project-Id-Version: events\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-02-10T07:25:34\n"
"PO-Revision-Date: 2009-11-11 09:16+1000\n"
"Last-Translator: Corina Roe <croe@redhat.com>\n"
"Language-Team: French <i18@redhat.com>\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 "Intercepteurs et événements"

#. 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 ""
"Il est souvent utile pour l'application de réagir à certains événements qui "
"surviennent dans Hibernate. Cela autorise l'implémentation de certaines "
"fonctionnalités génériques, et l'extension de fonctionnalités d'Hibernate."

#. Tag: title
#, no-c-format
msgid "Interceptors"
msgstr "Intercepteurs"

#. 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 fournit des \"callbacks\" de la "
"session vers l'application permettant à l'application de consulter et/ou de "
"manipuler des propriétés d'un objet persistant avant qu'il soit sauvegardé, "
"mis à jour, supprimé ou chargé. Une utilisation possible de cette "
"fonctionnalité est de tracer l'accès à l'information. Par exemple, "
"l'<literal>Interceptor suivant positionne "
"<literal>createTimestamp quand un Auditable est "
"créé et met à jour la propriété <literal>lastUpdateTimestamp quand "
"un <literal>Auditable est mis à jour. "

#. Tag: para
#, no-c-format
msgid ""
"You can either implement <literal>Interceptor directly or extend "
"<literal>EmptyInterceptor."
msgstr ""
"Vous pouvez soit implémenter <literal>Interceptor directement ou "
"(mieux) étendre <literal>EmptyInterceptor. "

#. Tag: para
#, no-c-format
msgid ""
"There are two kinds of inteceptors: <literal>Session-scoped and "
"<literal>SessionFactory-scoped."
msgstr ""
"Il y a deux types d'intercepteurs : lié à la <literal>Session et "
"lié à la <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 ""
"Un intercepteur lié à la <literal>Session est défini lorsqu'une "
"session est ouverte via l'invocation des méthodes surchargées SessionFactory."
"openSession() acceptant un <literal>Interceptor (comme argument)."

#. 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 ""
"Un intercepteur lié à <literal>SessionFactory est enregistré avec "
"l'objet <literal>Configuration avant la construction de la "
"<literal>SessionFactory. Dans ce cas, les intercepteurs fournis "
"seront appliqués à toutes les sessions ouvertes pour cette "
"<literal>SessionFactory; ceci est vrai à moins que la session ne "
"soit ouverte en spécifiant l'intercepteur à utiliser. Les intercepteurs liés "
"à la <literal>SessionFactory doivent être thread safe, en faisant "
"attention à ne pas stocker des états spécifiques de la session puisque "
"plusieurs sessions peuvent utiliser cet intercepteur (potentiellement) de "
"manière concurrente. "

#. Tag: title
#, no-c-format
msgid "Event system"
msgstr "Système d'événements"

#. Tag: para
#, no-c-format
msgid ""
"If you have to react to particular events in your persistence layer, you can "
"also use the Hibernate3 <emphasis>event architecture. The event "
"system can be used in addition, or as a replacement, for interceptors."
msgstr ""
"Si vous devez réagir à des événements particuliers dans votre couche de "
"persistance, vous pouvez aussi utiliser l'architecture "
"d'<emphasis>événements de Hibernate3. Le système d'événements "
"peut être utilisé en supplément ou en remplacement des interceptors. "

#. 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 ""
"Essentiellement toutes les méthodes de l'interface <literal>SessionLoadEventFlushEvent, etc (consultez la DTD du fichier "
"de configuration XML ou le paquetage <literal>org.hibernate.event "
"pour avoir la liste complète des types d'événement définis). Quand une "
"requête est faite à partir d'une de ces méthodes, la <literal>Session est traité par "
"l'implémentation de l'interface <literal>LoadEventListener "
"déclarée), dans quel cas leur implémentation devrait être responsable du "
"traitement des requêtes <literal>load() faites par la "
"<literal>Session. "

#. 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 ""
"Les listeners devraient effectivement être considérés comme des singletons ; "
"dans le sens où ils sont partagés entre des requêtes, et donc ne devraient "
"pas sauvegarder des états en tant que variables d'instance. "

#. 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 ""
"Un listener personnalisé devrait implémenter l'interface appropriée pour "
"l'événement qu'il veut traiter et/ou étendre une des classes de base (ou "
"même l'événement prêt à l'emploi utilisé par Hibernate comme ceux déclarés "
"non-finaux à cette intention). Les listeners personnalisés peuvent être soit "
"inscrits par programmation à travers l'objet <literal>Configuration 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 ""
"Les listeners inscrits déclarativement ne peuvent pas partager d'instances. "
"Si le même nom de classe est utilisée dans plusieurs éléments <literal><"
"listener/></literal>, chaque référence résultera en une instance "
"distincte de cette classe. Si vous avez besoin de la faculté de partager des "
"instances de listener entre plusieurs types de listener, vous devez utiliser "
"l'approche d'inscription par programmation. "

#. 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 ""
"Pourquoi implémenter une interface et définir le type spécifique durant la "
"configuration ? Une implémentation de listener pourrait implémenter "
"plusieurs interfaces de listener d'événements. Par ailleurs, le fait de "
"définir le type durant l'inscription, rend l'activation ou la désactivation "
"plus facile au moment de la configuration. "

#. Tag: title
#, no-c-format
msgid "Hibernate declarative security"
msgstr "Sécurité déclarative de 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 ""
"Généralement, la sécurité déclarative dans les applications Hibernate est "
"gérée dans la couche de session. Maintenant, Hibernate3 permet à certaines "
"actions d'être approuvées via JACC, et autorisées via JAAS. Cette "
"fonctionnalité optionnelle est construite au dessus de l'architecture "
"d'événements. "

#. Tag: para
#, no-c-format
msgid ""
"First, you must configure the appropriate event listeners, to enable the use "
"of JAAS authorization."
msgstr ""
"D'abord, vous devez configurer les listeners d'événements appropriés pour "
"permettre l'utilisation d'autorisations 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 ""
"Notez que <literal><listener type=\"...\" class=\"...\"/> "
"est juste un raccourci pour <literal><event type=\"...\"><listener "
"class=\"...\"/></event></literal> quand il y a exactement un "
"listener pour un type d'événement particulier. "

#. Tag: para
#, no-c-format
msgid ""
"Next, while still in <literal>hibernate.cfg.xml, bind the "
"permissions to roles:"
msgstr ""
"Ensuite, toujours dans <literal>hibernate.cfg.xml, liez les "
"permissions aux rôles : "

#. Tag: para
#, no-c-format
msgid "The role names are the roles understood by your JACC provider."
msgstr "Les noms de rôle sont les rôles compris par votre fournisseur JAAC."

#~ 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 ""
#~ "<![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"
#~ "}]]>"

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

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

#~ 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 ""
#~ "<![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"
#~ "}]]>"

#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<![CDATA["

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

#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<![CDATA["

#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<![CDATA["

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-2024 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.