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
# Michael H. Smith <mhideo@redhat.com>, 2007.
# Angela Garcia <agarcia@redhat.com>, 2009.
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# 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-12 09:03+1000\n"
"Last-Translator: Angela Garcia <agarcia@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 "Interceptores y eventos"

#. 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 ""
"Es útil para la aplicación reaccionar a ciertos eventos que ocurren dentro "
"de Hibernate. Esto permite la implementación de funcionalidades genéricas y "
"la extensión de la funcionalidad de Hibernate."

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

#. 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 brinda callbacks desde la sesión "
"a la aplicación, permitiendole a ésta última inspeccionar y/o manipular las "
"propiedades de un objeto persistente antes de que sea guardado, actualizado, "
"borrado o cargado. Un uso posible de esto es seguir la pista de la "
"información de auditoría. Por ejemplo, el siguiente <literal>InterceptorcreateTimestamp "
"cuando se crea un <literal>Auditable y se actualiza la propiedad "
"<literal>lastUpdateTimestamp cuando se actualiza un "
"<literal>Auditable."

#. Tag: para
#, no-c-format
msgid ""
"You can either implement <literal>Interceptor directly or extend "
"<literal>EmptyInterceptor."
msgstr ""
"Puede implementar el <literal>Interceptor directamente o extender "
"el <literal>EmptyInterceptor."

#. Tag: para
#, no-c-format
msgid ""
"There are two kinds of inteceptors: <literal>Session-scoped and "
"<literal>SessionFactory-scoped."
msgstr ""
"Hay dos clases de interceptores: incluído en <literal>Session- e "
"incluído en <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 ""
"Se especifica un interceptor incluído <literal>Session cuando se "
"abre una sesión utilizando uno de los métodos SessionFactory.openSession() "
"sobrecargados aceptando un <literal>Interceptor."

#. 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 interceptor incluido en <literal>SessionFactory se encuentra "
"registrado con el objeto <literal>Configuration antes de construir "
"el <literal>SessionFactory. En este caso, el interceptor proveido "
"será aplicado a todas las sesiones abiertas desde ese "
"<literal>SessionFactory; a menos de que se abra una sesión "
"especificando explícitamente el interceptor a utilizar. Los interceptores "
"<literal>SessionFactory incluidos deben ser a prueba de hilos. "
"Asegúrese de no almacenar un estado especifico a la sesión ya que múltiples "
"sesiones utilizarán este interceptor potencialmente de manera concurrente."

#. Tag: title
#, no-c-format
msgid "Event system"
msgstr "Sistema de eventos"

#. 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 tiene que reaccionar a eventos particulares en su capa de persistencia, "
"también puede utilizar la arquitectura de <emphasis>eventos de "
"Hibernate3. El sistema de eventos se puede ser utilizar además de o como un "
"remplazo para los interceptores."

#. 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 ""
"Todos los métodos de la interfaz <literal>Session se correlacionan "
"con un evento. Tiene un <literal>LoadEvent, un "
"<literal>FlushEvent, etc. Consulte el DTD del archivo de "
"configuración XML o el paquete <literal>org.hibernate.event para "
"ver la lista completa de los tipos de eventos definidos. Cuando se realiza "
"una petición de uno de estos métodos, la <literal>Session de "
"Hibernate genera un evento apropiado y se lo pasa al escucha (listener) de "
"eventos configurado para ese tipo. Tal como vienen, estos escuchas "
"implementan el mismo procesamiento en aquellos métodos donde siempre "
"resultan . Sin embargo, usted es libre de implementar una personalización de "
"una de las interfaces escuchas (por ejemplo, el <literal>LoadEvent "
"es procesado por la implementación registrada de la interfaz "
"<literal>LoadEventListener), en cuyo caso su implementación sería "
"responsable de procesar cualquier petición <literal>load() "
"realizada a 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 ""
"Los escuchas se deben considerar como singletons. Esto significa que son "
"compartidos entre las peticiones y por lo tanto, no deben guardar ningún "
"estado como variables de instancia."

#. 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 escucha personalizado implementa la interfaz apropiada para el evento que "
"quiere procesar y/o extender una de las clases base de conveniencia (o "
"incluso los escuchas de eventos predeterminados utilizados por Hibernate de "
"fábrica al declararlos como no-finales para este propósito). Los escuchas "
"personalizados pueden ser registrados programáticamente a través del objeto "
"<literal>Configuration, o especificados en el XML de configuración "
"de Hibernate. No se soporta la configuración declarativa a través del "
"archivo de propiedades. Este es un ejemplo de un escucha personalizado de "
"eventos load:"

#. 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 ""
"También necesita una entrada de configuración diciéndole a Hibernate que "
"utilice el oyente en vez del oyente por defecto:"

#. Tag: para
#, no-c-format
msgid "Instead, you can register it programmatically:"
msgstr "En cambio, puede registrarlo programáticamente: "

#. 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 ""
"Los oyentes registrados declarativamente no pueden compartir instancias. Si "
"se utiliza el mismo nombre de clase en múltiples elementos <literal><"
"listener/></literal>, cada referencia resultará en una instancia separada "
"de esa clase. Si necesita compartir instancias de oyentes entre tipos de "
"oyentes debe usar el enfoque de registración programática."

#. 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 ""
"¿Por qué implementar una interfaz y definir el tipo específico durante la "
"configuración? Una implementación de escucha podría implementar múltiples "
"interfaces de escucha de eventos. Teniendo el tipo definido adicionalmente "
"durante la registración hace más fácil activar o desactivar escuchas "
"personalizados durante la configuración."

#. Tag: title
#, no-c-format
msgid "Hibernate declarative security"
msgstr "Seguridad declarativa 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 ""
"Usualmente, la seguridad declarativa en aplicaciones Hibernate se administra "
"en una capa de fachada de sesión. Hibernate3 permite que ciertas acciones se "
"permitan por medio de JACC y las autoriza por medio de JAAS. Esta es una "
"funcionalidad opcional construída encima de la arquitectura de eventos."

#. Tag: para
#, no-c-format
msgid ""
"First, you must configure the appropriate event listeners, to enable the use "
"of JAAS authorization."
msgstr ""
"Primero, tiene que configurar los oyentes de eventos apropiados, para "
"habilitar la utilización de autorización 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 ""
"Note que <literal><listener type=\"...\" class=\"...\"/> es "
"la abreviatura para <literal><event type=\"...\"><listener class="
"\"...\"/></event></literal> cuando hay exactamente un escucha para "
"un tipo de evento en particular."

#. Tag: para
#, no-c-format
msgid ""
"Next, while still in <literal>hibernate.cfg.xml, bind the "
"permissions to roles:"
msgstr ""
"A continuación, todavía en <literal>hibernate.cfg.xml, enlace los "
"permisos a los roles:"

#. Tag: para
#, no-c-format
msgid "The role names are the roles understood by your JACC provider."
msgstr "Los nombres de los roles son comprendidos por su proveedor de JACC."

#~ 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-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.