📄 events.po
字号:
#, no-c-formatmsgid """Essentially all of the methods of the <literal>Session</literal> interface ""correlate to an event. You have a <literal>LoadEvent</literal>, a ""<literal>FlushEvent</literal>, etc (consult the XML configuration-file DTD ""or the <literal>org.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</literal> 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</literal> is processed by ""the registered implemenation of the <literal>LoadEventListener</literal> ""interface), in which case their implementation would be responsible for ""processing any <literal>load()</literal> requests made of the ""<literal>Session</literal>."msgstr """Essencialmente todos os métodos da interface <literal>Session</literal> ""possuem um evento correlacionado. Se você tiver um <literal>LoadEvent</""literal>, um <literal>LoadEvent</literal>, etc (consulte o DTD do XML de ""configuração ou o pacote <literal>org.hibernate.event</literal> para a lista ""completa dos tipos de eventos). Quando uma requisição é feita em um desses ""métodos, a <literal>Session</literal> do hibernate gera um evento apropriado ""e o envia para o listener de evento correspondente àquele tipo de evento. ""Esses listeners implementam a mesma lógica que aqueles métodos, trazendo os ""mesmos resultados. Entretanto, você é livre para implementar uma ""customização de um desses listeners (isto é, o <literal>LoadEvent</literal> ""é processado pela implementação registrada da interface ""<literal>LoadEventListener</literal>), então sua implementação vai ficar ""responsável por processar qualquer requisição <literal>load()</literal> ""feita pela <literal>Session</literal>."#. Tag: para#: events.xml:84#, no-c-formatmsgid """The listeners should be considered effectively singletons; meaning, they are ""shared between requests, and thus should not save any state as instance ""variables."msgstr """Para todos os efeitos esses listeners deve ser considerados singletons; ou ""seja, eles são compartilhados entre as requisições, e assim sendo, não devem ""salvar nenhum estado das variáveis instanciadas."#. Tag: para#: events.xml:89#, no-c-formatmsgid """A custom listener should implement 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</literal> ""object, or specified in the Hibernate configuration XML (declarative ""configuration through the properties file is not supported). Here's an ""example of a custom load event listener:"msgstr """Um listener personalizado deve implementar a interface referente ao evento a ""ser processado e/ou deve estender a classes base equivalente (ou mesmo os ""listeners padrões usados pelo Hibernate, eles não são declarados como finais ""com esse objetivo). O listener personalizado pode ser registrado ""programaticamente no objeto <literal>Configuration</literal>, ou ""declarativamente no XML de configuração do Hibernate (o registro do listener ""no propertie de configuração não é suportado). Aqui temos um exemplo de como ""carregar um listener personalizado:"#. Tag: programlisting#: events.xml:99#, no-c-formatmsgid """<![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 ""#. Tag: para#: events.xml:101#, no-c-formatmsgid """You also need a configuration entry telling Hibernate to use the listener in ""addition to the default listener:"msgstr """Você também precisa adicionar uma entrada no XML de configuração do ""Hibernate para registrar declarativamente qual listener deve se utilizado em ""conjunto com o listener padrão:"#. Tag: programlisting#: events.xml:106#, no-c-formatmsgid """<![CDATA[<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>]]>"msgstr ""#. Tag: para#: events.xml:108#, no-c-formatmsgid "Instead, you may register it programmatically:"msgstr "Ou, você pode registrar o listener programaticamente:"#. Tag: programlisting#: events.xml:112#, no-c-formatmsgid """<![CDATA[Configuration cfg = new Configuration();\n""LoadEventListener[] stack = { new MyLoadListener(), new ""DefaultLoadEventListener() };\n""cfg.EventListeners().setLoadEventListeners(stack);]]>"msgstr ""#. Tag: para#: events.xml:114#, no-c-formatmsgid """Listeners registered declaratively cannot share instances. If the same class ""name is used in multiple <literal><listener/></literal> elements, each ""reference will result in a separate instance of that class. If you need the ""capability to share listener instances between listener types you must use ""the programmatic registration approach."msgstr """Listeners registrados declarativamente não compartilham da mesma instancia. ""Se o mesmo nome da classe é utilizado em vários elementos e <literal><""listener/></literal>, cada um vai resultar em uma instancia separada ""dessa classe. Se você tem a necessidade de compartilhar uma instancia de um ""listener entre diversos tipos de listeners você deve registrar o listener ""programaticamente."#. Tag: para#: events.xml:122#, no-c-formatmsgid """Why implement an interface and define the specific type during ""configuration? Well, 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 """Mas porque implementar uma interface e definir o tipo específico durante a ""configuração? Bem, um listener pode implementar vários listeners de evento. ""Com o tipo sendo definido durante o registro, fica fácil ligar ou desligar ""listeners personalizados durante a configuração."#. Tag: title#: events.xml:132#, no-c-formatmsgid "Hibernate declarative security"msgstr "Hibernate declarative security"#. Tag: para#: events.xml:133#, no-c-formatmsgid """Usually, declarative security in Hibernate applications is managed in a ""session facade layer. Now, Hibernate3 allows certain actions to be ""permissioned via JACC, and authorized via JAAS. This is optional ""functionality built on top of the event architecture."msgstr """Usually, declarative security in Hibernate applications is managed in a ""session facade layer. Now, Hibernate3 allows certain actions to be ""permissioned via JACC, and authorized via JAAS. This is optional ""functionality built on top of the event architecture."#. Tag: para#: events.xml:139#, no-c-formatmsgid """First, you must configure the appropriate event listeners, to enable the use ""of JAAS authorization."msgstr """First, you must configure the appropriate event listeners, to enable the use ""of JAAS authorization."#. Tag: programlisting#: events.xml:144#, no-c-formatmsgid """<![CDATA[<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\"/>]]>"msgstr ""#. Tag: para#: events.xml:146#, no-c-formatmsgid """Note that <literal><listener type=\"...\" class=\"...\"/></literal> is ""just a shorthand for <literal><event type=\"...\"><listener class=""\"...\"/></event></literal> when there is exactly one listener for ""a particular event type."msgstr """Note that <literal><listener type=\"...\" class=\"...\"/></literal> is ""just a shorthand for <literal><event type=\"...\"><listener class=""\"...\"/></event></literal> when there is exactly one listener for ""a particular event type."#. Tag: para#: events.xml:152#, no-c-formatmsgid """Next, still in <literal>hibernate.cfg.xml</literal>, bind the permissions to ""roles:"msgstr """Next, still in <literal>hibernate.cfg.xml</literal>, bind the permissions to ""roles:"#. Tag: programlisting#: events.xml:156#, no-c-formatmsgid """<![CDATA[<grant role=\"admin\" entity-name=\"User\" actions=\"insert,update,""read\"/>\n""<grant role=\"su\" entity-name=\"User\" actions=\"*\"/>]]>"msgstr ""#. Tag: para#: events.xml:158#, no-c-formatmsgid "The role names are the roles understood by your JACC provider."msgstr "The role names are the roles understood by your JACC provider."
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -