4
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
5
"POT-Creation-Date: 2009-06-10 21:02+0000\n"
6
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
7
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
"Content-Type: text/plain; charset=UTF-8\n"
13
msgid "Interceptors and events"
14
msgstr "Interceptores y eventos"
20
"It is useful for the application to react to certain events that occur "
21
"inside Hibernate. This allows for the implementation of generic "
22
"functionality and the extension of Hibernate functionality."
24
"Frecuentemente es útil para la aplicación reaccionar a ciertos "
25
"eventos que ocurran dentro de Hibernate. Esto permite la implementació"
26
"n de ciertos tipos de funcionalidade genérica, y extensión de "
27
"la funcionalidad de Hibernate."
33
msgstr "Interceptores"
39
"The <literal>Interceptor</literal> interface provides callbacks from the "
40
"session to the application, allowing the application to inspect and/or "
41
"manipulate properties of a persistent object before it is saved, updated, "
42
"deleted or loaded. One possible use for this is to track auditing "
43
"information. For example, the following <literal>Interceptor</literal> "
44
"automatically sets the <literal>createTimestamp</literal> when an "
45
"<literal>Auditable</literal> is created and updates the "
46
"<literal>lastUpdateTimestamp</literal> property when an <literal>Auditable</"
47
"literal> is updated."
49
"La interface <literal>Interceptor</literal> provee callbacks desde la "
50
"sesión a la aplicación permitiendo a ésta última "
51
"inspeccionar y/o manipular las propiedades de un objeto persistente antes "
52
"que sea salvado, actualizado, borrado o cargado. Un uso posible de esto es "
53
"seguir la pista de información de auditoría. Por ejemplo, el "
54
"siguiente <literal>Interceptor</literal> establece automáticamente el "
55
"<literal>createTimestamp</literal> cuando un <literal>Auditable</literal> es "
56
"creado y actualiza la propiedad <literal>lastUpdateTimestamp</literal> "
57
"cuando un <literal>Auditable</literal> es acutalizado."
63
"You can either implement <literal>Interceptor</literal> directly or extend "
64
"<literal>EmptyInterceptor</literal>."
66
"UNTRANSLATED! You may either implement <literal>Interceptor</literal> "
67
"directly or (better) extend <literal>EmptyInterceptor</literal>."
69
#. Tag: programlisting
73
"<![CDATA[package org.hibernate.test;\n"
75
"import java.io.Serializable;\n"
76
"import java.util.Date;\n"
77
"import java.util.Iterator;\n"
79
"import org.hibernate.EmptyInterceptor;\n"
80
"import org.hibernate.Transaction;\n"
81
"import org.hibernate.type.Type;\n"
83
"public class AuditInterceptor extends EmptyInterceptor {\n"
85
" private int updates;\n"
86
" private int creates;\n"
87
" private int loads;\n"
89
" public void onDelete(Object entity,\n"
92
" String[] propertyNames,\n"
97
" public boolean onFlushDirty(Object entity,\n"
99
" Object[] currentState,\n"
100
" Object[] previousState,\n"
101
" String[] propertyNames,\n"
104
" if ( entity instanceof Auditable ) {\n"
106
" for ( int i=0; i < propertyNames.length; i++ ) {\n"
107
" if ( \"lastUpdateTimestamp\".equals( propertyNames[i] ) ) {\n"
108
" currentState[i] = new Date();\n"
116
" public boolean onLoad(Object entity,\n"
117
" Serializable id,\n"
119
" String[] propertyNames,\n"
121
" if ( entity instanceof Auditable ) {\n"
127
" public boolean onSave(Object entity,\n"
128
" Serializable id,\n"
130
" String[] propertyNames,\n"
133
" if ( entity instanceof Auditable ) {\n"
135
" for ( int i=0; i<propertyNames.length; i++ ) {\n"
136
" if ( \"createTimestamp\".equals( propertyNames[i] ) ) {\n"
137
" state[i] = new Date();\n"
145
" public void afterTransactionCompletion(Transaction tx) {\n"
146
" if ( tx.wasCommitted() ) {\n"
147
" System.out.println(\"Creations: \" + creates + \", Updates: \" + "
148
"updates, \"Loads: \" + loads);\n"
157
"<![CDATA[package org.hibernate.test;\n"
159
"import java.io.Serializable;\n"
160
"import java.util.Date;\n"
161
"import java.util.Iterator;\n"
163
"import org.hibernate.Interceptor;\n"
164
"import org.hibernate.type.Type;\n"
166
"public class AuditInterceptor implements Interceptor, Serializable {\n"
168
" private int updates;\n"
169
" private int creates;\n"
171
" public void onDelete(Object entity,\n"
172
" Serializable id,\n"
174
" String[] propertyNames,\n"
179
" public boolean onFlushDirty(Object entity,\n"
180
" Serializable id,\n"
181
" Object[] currentState,\n"
182
" Object[] previousState,\n"
183
" String[] propertyNames,\n"
186
" if ( entity instanceof Auditable ) {\n"
188
" for ( int i=0; i < propertyNames.length; i++ ) {\n"
189
" if ( \"lastUpdateTimestamp\".equals( propertyNames[i] ) ) {\n"
190
" currentState[i] = new Date();\n"
198
" public boolean onLoad(Object entity,\n"
199
" Serializable id,\n"
201
" String[] propertyNames,\n"
206
" public boolean onSave(Object entity,\n"
207
" Serializable id,\n"
209
" String[] propertyNames,\n"
212
" if ( entity instanceof Auditable ) {\n"
214
" for ( int i=0; i<propertyNames.length; i++ ) {\n"
215
" if ( \"createTimestamp\".equals( propertyNames[i] ) ) {\n"
216
" state[i] = new Date();\n"
224
" public void postFlush(Iterator entities) {\n"
225
" System.out.println(\"Creations: \" + creates + \", Updates: \" + "
229
" public void preFlush(Iterator entities) {\n"
240
#, fuzzy, no-c-format
242
"There are two kinds of inteceptors: <literal>Session</literal>-scoped and "
243
"<literal>SessionFactory</literal>-scoped."
245
"UNTRANSLATED! Interceptors come in two flavors: <literal>Session</literal>-"
246
"scoped and <literal>SessionFactory</literal>-scoped."
252
"A <literal>Session</literal>-scoped interceptor is specified when a session "
253
"is opened using one of the overloaded SessionFactory.openSession() methods "
254
"accepting an <literal>Interceptor</literal>."
256
"UNTRANSLATED! A <literal>Session</literal>-scoped interceptor is specified "
257
"when a session is opened using one of the overloaded SessionFactory."
258
"openSession() methods accepting an <literal>Interceptor</literal>."
260
#. Tag: programlisting
263
msgid "<![CDATA[Session session = sf.openSession( new AuditInterceptor() );]]>"
265
"<![CDATA[Session session = sf.openSession( new AuditInterceptor() );]]>"
269
#, fuzzy, no-c-format
271
"A <literal>SessionFactory</literal>-scoped interceptor is registered with "
272
"the <literal>Configuration</literal> object prior to building the "
273
"<literal>SessionFactory</literal>. Unless a session is opened explicitly "
274
"specifying the interceptor to use, the supplied interceptor will be applied "
275
"to all sessions opened from that <literal>SessionFactory</literal>. "
276
"<literal>SessionFactory</literal>-scoped interceptors must be thread safe. "
277
"Ensure that you do not store session-specific states, since multiple "
278
"sessions will use this interceptor potentially concurrently."
280
"UNTRANSLATED! A <literal>SessionFactory</literal>-scoped interceptor is "
281
"registered with the <literal>Configuration</literal> object prior to "
282
"building the <literal>SessionFactory</literal>. In this case, the supplied "
283
"interceptor will be applied to all sessions opened from that "
284
"<literal>SessionFactory</literal>; this is true unless a session is opened "
285
"explicitly specifying the interceptor to use. <literal>SessionFactory</"
286
"literal>-scoped interceptors must be thread safe, taking care to not store "
287
"session-specific state since multiple sessions will use this interceptor "
288
"(potentially) concurrently."
290
#. Tag: programlisting
294
"<![CDATA[new Configuration().setInterceptor( new AuditInterceptor() );]]>"
296
"<![CDATA[new Configuration().setInterceptor( new AuditInterceptor() );]]>"
302
msgstr "Sistema de eventos"
306
#, fuzzy, no-c-format
308
"If you have to react to particular events in your persistence layer, you can "
309
"also use the Hibernate3 <emphasis>event</emphasis> architecture. The event "
310
"system can be used in addition, or as a replacement, for interceptors."
312
"Si tienes que reaccionar a eventos particulares en tu capa de persistencia, "
313
"puedes también la arquitectura de <emphasis>eventos</emphasis> de "
314
"Hibernate3. El sistema de eventos puede ser usado en adición o como "
315
"un remplazo a los interceptores."
319
#, fuzzy, no-c-format
321
"All the methods of the <literal>Session</literal> interface correlate to an "
322
"event. You have a <literal>LoadEvent</literal>, a <literal>FlushEvent</"
323
"literal>, etc. Consult the XML configuration-file DTD or the <literal>org."
324
"hibernate.event</literal> package for the full list of defined event types. "
325
"When a request is made of one of these methods, the Hibernate "
326
"<literal>Session</literal> generates an appropriate event and passes it to "
327
"the configured event listeners for that type. Out-of-the-box, these "
328
"listeners implement the same processing in which those methods always "
329
"resulted. However, you are free to implement a customization of one of the "
330
"listener interfaces (i.e., the <literal>LoadEvent</literal> is processed by "
331
"the registered implementation of the <literal>LoadEventListener</literal> "
332
"interface), in which case their implementation would be responsible for "
333
"processing any <literal>load()</literal> requests made of the "
334
"<literal>Session</literal>."
336
"Esencialmente todos los métodos de la interface <literal>Session</"
337
"literal> se correlacionan con un evento. Tienes un <literal>LoadEvent</"
338
"literal>, un <literal>FlushEvent</literal>, etc (consulta el DTD del fichero "
339
"de configuración XML o el paquete <literal>org.hibernate.event</"
340
"literal> para la lista completa de tipos de evento definidos). Cuando se "
341
"hace una petición de uno de estos métodos, la "
342
"<literal>Session</literal> de Hibernate genera un evento apropiado y se lo "
343
"pasa al oyente (listener) de eventos configurado para ese tipo. De fá"
344
"brica, estos oyentes implementan el mismo procesamiento en los que siempre "
345
"resultan aquellos métodos. Sin embargo, eres libre de implementar una "
346
"personalización de una de las interfaces oyentes (es decir, el "
347
"<literal>LoadEvent</literal> es procesado por la implementación "
348
"registrada de la interface <literal>LoadEventListener</literal>), en cuyo "
349
"caso su implementación sería responsable de procesar cualquier "
350
"petición <literal>load()</literal> hecha a la <literal>Session</"
355
#, fuzzy, no-c-format
357
"The listeners should be considered singletons. This means they are shared "
358
"between requests, and should not save any state as instance variables."
360
"Los oyentes deben ser considerados efectivamente singletons; quiere decir, "
361
"que son compartidos entre las peticiones, y por lo tanto no guardan "
362
"ningún estado en variables de instancia."
366
#, fuzzy, no-c-format
368
"A custom listener implements the appropriate interface for the event it "
369
"wants to process and/or extend one of the convenience base classes (or even "
370
"the default event listeners used by Hibernate out-of-the-box as these are "
371
"declared non-final for this purpose). Custom listeners can either be "
372
"registered programmatically through the <literal>Configuration</literal> "
373
"object, or specified in the Hibernate configuration XML. Declarative "
374
"configuration through the properties file is not supported. Here is an "
375
"example of a custom load event listener:"
377
"Un oyente personalizado debe implementar la interface apropiada para el "
378
"evento que quiere procesar y/o extender una de las clases base de "
379
"conveniencia (o incluso los oyentes de eventos por defecto usados por "
380
"Hibernate de fábrica al ser éstos declarados non-final para "
381
"este propósito). Los oyentes personalizados pueden ser registrados "
382
"programáticamente a través del objeto <literal>Configuration</"
383
"literal>, o especificados en el XML de configuración de Hibernate (la "
384
"declaración declarativa a través del fichero de propiedades no "
385
"está soportada). He aquí un ejemplo de un oyente personalizado "
388
#. Tag: programlisting
392
"<![CDATA[public class MyLoadListener implements LoadEventListener {\n"
393
" // this is the single method defined by the LoadEventListener interface\n"
394
" public void onLoad(LoadEvent event, LoadEventListener.LoadType "
396
" throws HibernateException {\n"
397
" if ( !MySecurity.isAuthorized( event.getEntityClassName(), event."
398
"getEntityId() ) ) {\n"
399
" throw MySecurityException(\"Unauthorized access\");\n"
404
"<![CDATA[public class MyLoadListener extends DefaultLoadEventListener {\n"
405
" // this is the single method defined by the LoadEventListener interface\n"
406
" public Object onLoad(LoadEvent event, LoadEventListener.LoadType "
408
" throws HibernateException {\n"
409
" if ( !MySecurity.isAuthorized( event.getEntityClassName(), event."
410
"getEntityId() ) ) {\n"
411
" throw MySecurityException(\"Unauthorized access\");\n"
413
" return super.onLoad(event, loadType);\n"
421
"You also need a configuration entry telling Hibernate to use the listener in "
422
"addition to the default listener:"
424
"Necesitas además una entrada de configuración dicié"
425
"ndole a Hibernate que use el oyente en vez del oyente por defecto:"
427
#. Tag: programlisting
431
"<![CDATA[<hibernate-configuration>\n"
432
" <session-factory>\n"
434
" <event type=\"load\">\n"
435
" <listener class=\"com.eg.MyLoadListener\"/>\n"
436
" <listener class=\"org.hibernate.event.def."
437
"DefaultLoadEventListener\"/>\n"
439
" </session-factory>\n"
440
"</hibernate-configuration>]]>"
442
"<![CDATA[<hibernate-configuration>\n"
443
" <session-factory>\n"
445
" <listener type=\"load\" class=\"MyLoadListener\"/>\n"
446
" </session-factory>\n"
447
"</hibernate-configuration>]]>"
451
#, fuzzy, no-c-format
452
msgid "Instead, you can register it programmatically:"
453
msgstr "En cambio, puedes registrarlo programáticamente:"
455
#. Tag: programlisting
459
"<![CDATA[Configuration cfg = new Configuration();\n"
460
"LoadEventListener[] stack = { new MyLoadListener(), new "
461
"DefaultLoadEventListener() };\n"
462
"cfg.EventListeners().setLoadEventListeners(stack);]]>"
464
"<![CDATA[Configuration cfg = new Configuration();\n"
465
"cfg.getSessionEventListenerConfig().setLoadEventListener( new MyLoadListener"
470
#, fuzzy, no-c-format
472
"Listeners registered declaratively cannot share instances. If the same class "
473
"name is used in multiple <literal><listener/></literal> elements, each "
474
"reference will result in a separate instance of that class. If you need to "
475
"share listener instances between listener types you must use the "
476
"programmatic registration approach."
478
"Los oyentes registrados declarativamente no pueden compartir instancias. Si "
479
"el mismo nombre de clase es usado en múltiples elementos <literal><"
480
"listener/></literal>, cada referencia resultará en una instancia "
481
"separada de esa clase. Si necesitas la capacidad de compartir instancias de "
482
"oyentes entre tipos de oyente debes usar el enfoque de registración "
483
"programática."
487
#, fuzzy, no-c-format
489
"Why implement an interface and define the specific type during "
490
"configuration? A listener implementation could implement multiple event "
491
"listener interfaces. Having the type additionally defined during "
492
"registration makes it easier to turn custom listeners on or off during "
495
"¿Por qué implementar una interface y definir el tipo "
496
"espcífico durante la configuración? Bueno, una "
497
"implementación de oyente podría implementar múltiples "
498
"interfaces de oyente de eventos. Teniendo el tipo definido adicionalmente "
499
"durante la registración lo hace más fácil para activar "
500
"o desactivar oyentes personalizados durante la configuración."
505
msgid "Hibernate declarative security"
506
msgstr "Seguridad declarativa de Hibernate"
510
#, fuzzy, no-c-format
512
"Usually, declarative security in Hibernate applications is managed in a "
513
"session facade layer. Hibernate3 allows certain actions to be permissioned "
514
"via JACC, and authorized via JAAS. This is an optional functionality that is "
515
"built on top of the event architecture."
517
"Usualmente, la seguridad declarativa en aplicaciones Hibernate es manejada "
518
"en una capa de fachada de sesión. Ahora, Hibernate3 permite que "
519
"ciertas acciones sean permitidas vía JACC, y autorizadas vía "
520
"JAAS. Esta en una funcionalidad opcional construída encima de la "
521
"arquitectura de eventos."
527
"First, you must configure the appropriate event listeners, to enable the use "
528
"of JAAS authorization."
530
"Primero, debes configurar los oyentes de eventos apropiados, para habilitar "
531
"el uso de autorización JAAS."
533
#. Tag: programlisting
537
"<![CDATA[<listener type=\"pre-delete\" class=\"org.hibernate.secure."
538
"JACCPreDeleteEventListener\"/>\n"
539
"<listener type=\"pre-update\" class=\"org.hibernate.secure."
540
"JACCPreUpdateEventListener\"/>\n"
541
"<listener type=\"pre-insert\" class=\"org.hibernate.secure."
542
"JACCPreInsertEventListener\"/>\n"
543
"<listener type=\"pre-load\" class=\"org.hibernate.secure."
544
"JACCPreLoadEventListener\"/>]]>"
546
"<![CDATA[<listener type=\"pre-delete\" class=\"org.hibernate.secure."
547
"JACCPreDeleteEventListener\"/>\n"
548
"<listener type=\"pre-update\" class=\"org.hibernate.secure."
549
"JACCPreUpdateEventListener\"/>\n"
550
"<listener type=\"pre-insert\" class=\"org.hibernate.secure."
551
"JACCPreInsertEventListener\"/>\n"
552
"<listener type=\"pre-load\" class=\"org.hibernate.secure."
553
"JACCPreLoadEventListener\"/>]]>"
557
#, fuzzy, no-c-format
559
"Note that <literal><listener type=\"...\" class=\"...\"/></literal> is "
560
"shorthand for <literal><event type=\"...\"><listener class=\"...\"/"
561
"></event></literal> when there is exactly one listener for a "
562
"particular event type."
564
"UNTRANSLATED! Note that <literal><listener type=\"...\" class=\"...\"/>"
565
"</literal> is just a shorthand for <literal><event type=\"...\"><"
566
"listener class=\"...\"/></event></literal> when there is exactly "
567
"one listener for a particular event type."
571
#, fuzzy, no-c-format
573
"Next, while still in <literal>hibernate.cfg.xml</literal>, bind the "
574
"permissions to roles:"
576
"Seguido, aún en <literal>hibernate.cfg.xml</literal>, liga los "
579
#. Tag: programlisting
583
"<![CDATA[<grant role=\"admin\" entity-name=\"User\" actions=\"insert,update,"
585
"<grant role=\"su\" entity-name=\"User\" actions=\"*\"/>]]>"
587
"<![CDATA[<grant role=\"admin\" entity-name=\"User\" actions=\"insert,update,"
589
"<grant role=\"su\" entity-name=\"User\" actions=\"*\"/>]]>"
594
msgid "The role names are the roles understood by your JACC provider."
595
msgstr "Los nombres de role son los roles entendidos por tu proveedor de JACC."
597
#~ msgid "ROLES_OF_TRANSLATORS"
598
#~ msgstr "<!--TRANS:ROLES_OF_TRANSLATORS-->"
600
#~ msgid "CREDIT_FOR_TRANSLATORS"
601
#~ msgstr "<!--TRANS:CREDIT_FOR_TRANSLATORS-->"