Seam SVN: r11028 - branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-28 22:17:32 -0400 (Thu, 28 May 2009)
New Revision: 11028
Added:
branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/ClusteringAndEJBPassivation.xml
Modified:
branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/master.xml
Log:
JBSEAM-3425
Added: branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/ClusteringAndEJBPassivation.xml
===================================================================
--- branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/ClusteringAndEJBPassivation.xml (rev 0)
+++ branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/ClusteringAndEJBPassivation.xml 2009-05-29 02:17:32 UTC (rev 11028)
@@ -0,0 +1,424 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+<chapter id="ClusteringAndEJBPassivation">
+ <title>Clustering and EJB Passivation</title>
+
+ <para>
+ <emphasis>Please note that this chapter is still being reviewed. Tread carefully.</emphasis>
+ </para>
+
+ <para>
+ This chapter covers two distinct topics that happen share a common solution in Seam, (web) clustering and EJB
+ passivation. Therefore, they are addressed together in this reference manual. Although performance tends to be
+ grouped in this category as well, it's kept separate because the focus of this chapter is on the programming
+ model and how it's affected by the use of the aforementioned features.
+ </para>
+
+ <para>
+ In this chapter you will learn how Seam manages the passivation of Seam components and entity instances, how to
+ activate this feature, and how this feature is related to clustering. You will also learn how to deploy a Seam
+ application into a cluster and verify that HTTP session replication is working properly. Let's start with a
+ little background on clustering and see an example of how you deploy a Seam application to a JBoss AS cluster.
+ </para>
+
+ <sect1>
+ <title>Clustering</title>
+
+ <para>
+ Clustering (more formally web clustering) allows an application to run on two or more parallel servers
+ (i.e., nodes) while providing a uniform view of the application to clients. Load is distributed across the
+ servers in such a way that if one or more of the servers fails, the application is still accessible via any
+ of the surviving nodes. This topology is crucial for building scalable enterprise applications as
+ performance and availability can be improved simply by adding nodes. But it brings up an important question.
+ <emphasis>What happens to the state that was on the server that failed?</emphasis>
+ </para>
+
+ <para>
+ Since day one, Seam has always provided support for stateful applications running in a cluster. Up to this
+ point, you have learned that Seam provides state management in the form of additional scopes and by governing
+ the life cycle of stateful (scoped) components. But state management in Seam goes beyond creating, storing
+ and destroying instances. Seam tracks changes to JavaBean components and stores the changes at strategic
+ points during the request so that the changes can be restored when the request shifts to a secondary node in
+ the cluster. Fortunately, monitoring and replication of stateful EJB components is already handled by the EJB
+ server, so this feature of Seam is intended to put stateful JavaBeans on par with their EJB cohorts.
+ </para>
+
+ <para>
+ But wait, there's more! Seam also offers an incredibly unique feature for clustered applications. In
+ addition to monitoring JavaBean components, Seam ensures that managed entity instances (i.e. JPA and
+ Hibernate entities) don't become detatched during replication. Seam keeps a record of the entities that are
+ loaded and automatically loads them on the secondary node. You must, however, be using a Seam-managed
+ persistence context to get this feature. More in depth information about this feature is provided in the
+ second half of this chapter.
+ </para>
+
+ <para>
+ Now that you understand what features Seam offers to support a clustered environment, let's look at how you
+ program for clustering.
+ </para>
+
+ <sect2>
+ <title>Programming for clustering</title>
+ <para>
+ Any session- or conversation-scoped mutable JavaBean component that will be used in a clustered
+ environment must implement the <literal>Mutable</literal> interface from the Seam API. As part of the
+ contract, the component must maintain a dirty flag that is reported and reset by the
+ <literal>clearDirty()</literal> method. Seam calls this method to determine if it is necessary to
+ replicate the component. This avoids having to use the more cumbersome Servlet API to add and remove the
+ session attribute on every change of the object.
+ </para>
+ <para>
+ You also must ensure that all session- and conversation-scoped JavaBean components are Serializable.
+ Additional, all fields of a stateful component (EJB or JavaBean) must Serializable unless the field is
+ marked transient or set to null in a <literal>@PrePassivate</literal> method. You can restore the value
+ of a transient or nullified field in a <literal>@PostActivate</literal> method.
+ </para>
+ <para>
+ One area where people often get bitten is by using <literal>List.subList</literal> to create a list. The
+ resulting list is not Serializable. So watch out for situations like that. If hit a
+ <literal>java.io.NotSerializableException</literal> and cannot locate the culprit at first glance, you
+ can put a breakpoint on this exception, run the application server in debug mode and attach a debugger
+ (such as Eclipse) to see what deserialization is choking on.
+ </para>
+ <note>
+ <para>
+ Please note that clustering does not work with hot deployable compoennts. But then again, you shouldn't
+ be using hot deployable components in a non-development environment anyway.
+ </para>
+ </note>
+ </sect2>
+
+ <sect2>
+ <title>Deploying a Seam application to a JBoss AS cluster with session replication</title>
+
+ <para>
+ The procedure outlined in this tutorial has been validated with an seam-gen application and the Seam
+ booking example.
+ </para>
+
+ <para>
+ In the tutorial, I assume that the IP addresses of the master and slave servers are 192.168.1.2 and
+ 192.168.1.3, respectively. I am intentionally not using the mod_jk load balancer so that it's easier to
+ validate that both nodes are responding to requests and can share sessions.
+ </para>
+
+ <para>
+ I'm using the farm deployment method in these instructions, though you could also deploy the application
+ normally and allow the two servers to negotiate a master/slave relationship based on startup order.
+ </para>
+
+ <note>
+ <para>
+ JBoss AS clustering relies on UDP multicasting provided by jGroups. The SELinux configuration that
+ ships with RHEL/Fedora blocks these packets by default. You can allow them to pass by modifying the
+ iptables rules (as root). The following commands apply to an IP address that matches 192.168.1.x.
+ </para>
+ <programlisting>/sbin/iptables -I RH-Firewall-1-INPUT 5 -p udp -d 224.0.0.0/4 -j ACCEPT
+/sbin/iptables -I RH-Firewall-1-INPUT 9 -p udp -s 192.168.1.0/24 -j ACCEPT
+/sbin/iptables -I RH-Firewall-1-INPUT 10 -p tcp -s 192.168.1.0/24 -j ACCEPT
+/etc/init.d/iptables save</programlisting>
+ <para>Detailed information can be found on <ulink url="http://www.jboss.org/community/docs/DOC-11935">this page</ulink> on the JBoss Wiki.</para>
+ </note>
+
+ <itemizedlist>
+ <listitem>
+ <para>Create two instances of JBoss AS (just extract the zip twice)</para>
+ </listitem>
+ <listitem>
+ <para>Deploy the JDBC driver to server/all/lib/ on both instances if not using HSQLDB</para>
+ </listitem>
+ <listitem>
+ <para>Add <literal><distributable/></literal> as the first child element in WEB-INF/web.xml</para>
+ </listitem>
+ <listitem>
+ <para>Set the <literal>distributable</literal> property on
+ <literal>org.jboss.seam.core.init</literal> to true to enable the ManagedEntityInterceptor (i.e.,
+ <literal><![CDATA[<core:init distributable="true"/>]]></literal>)</para>
+ </listitem>
+ <listitem>
+ <para>Ensure you have two IP addresses available (two computers, two network cards, or two IP
+ addressses bound to the same interface). I'll assume the two IP address are 192.168.1.2 and
+ 192.168.1.3</para>
+ </listitem>
+ <listitem>
+ <para>Start the master JBoss AS instance on the first IP</para>
+ <programlisting>./bin/run.sh -c all -b 192.168.1.2</programlisting>
+ <para>The log should report that there are 1 cluster members and 0 other members.</para>
+ </listitem>
+ <listitem>
+ <para>Verify that the server/all/farm directory is empty in the slave JBoss AS instance</para>
+ </listitem>
+ <listitem>
+ <para>Start the slave JBoss AS instance on the second IP</para>
+ <programlisting>./bin/run.sh -c all -b 192.168.1.3</programlisting>
+ <para>The log should report that there are 2 cluster members and 1 other members. It should also
+ show the state being retrieved from the master.</para>
+ </listitem>
+ <listitem>
+ <para>Deploy the -ds.xml to server/all/farm of the master instance</para>
+ <para>In the log of the master you should see acknowledgement of the deployment. In the log of the
+ slave you should see a corresponding message acknowledging the deployment to the slave.</para>
+ </listitem>
+ <listitem>
+ <para>Deploy the application to the server/all/farm directory</para>
+ <para>In the log of the master you should see acknowledgement of the deployment. In the log of the
+ slave you should see a corresponding message acknowledging the deployment to the slave. Note that
+ you may have to wait up to 3 minutes for the deployed archive to be transfered.</para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ You're application is now running in a cluster with HTTP session replication! But, of course, you are
+ going to want to validate that the clustering actually works.
+ </para>
+ </sect2>
+ <sect2>
+ <title>Validating the distributable services of an application running in a JBoss AS cluster </title>
+ <para>
+ It's all well and fine to see the application start successfully on two different JBoss AS servers, but
+ seeing is believing. You likely want to validate that the two instances are exchanging HTTP sessions to
+ allow the slave to take over when the master instance is stopped.
+ </para>
+
+ <para>
+ Start off by visiting the application running on the master instance in your browser. That will produce
+ the first HTTP session. Now, open up the JBoss AS JMX console on that instance and navigate to the
+ following MBean:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para><emphasis>Category:</emphasis> jboss.cache</para>
+ </listitem>
+ <listitem>
+ <para><emphasis>Entry:</emphasis> service=TomcatClusteringCache</para>
+ </listitem>
+ <listitem>
+ <para><emphasis>Method:</emphasis> printDetails()</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>
+ Invoke the printDetails() method. You will see a tree of active HTTP sessions. Verify that the session
+ your browser is using corresponds to one of the sessions in this tree.
+ </para>
+
+ <para>
+ Now switch over to the slave instance and invoke the same method in the JMX console. You should see an
+ identical list (at least underneath this application's context path).
+ </para>
+
+ <para>
+ So you can see that at least both servers claim to have identical sessions. Now, time to test that the
+ data is serializing and unserializing properly.
+ </para>
+
+ <para>
+ Sign in using using the URL of the master instance. Then, construct a URL for the second instance by
+ putting the ;jsessionid=XXXX immediately after the servlet path and changing the IP address. You should
+ see that the session has carried over to the other instance. Now kill the master instance and see that
+ you can continue to use the application from the slave instance. Remove the deployments from the
+ server/all/farm directory and start the instance again. Switch the IP in the URL back to that of the
+ master instance and visit the URL. You'll see that the original session is still being used.
+ </para>
+
+ <para>
+ One way to watch objects passivate and activate is to create a session- or conversation-scoped Seam
+ component and implement the appropriate life-cycle methods. You can either use methods from the
+ HttpSessionActivationListener interface (Seam automatically registers this interface on all non-EJB
+ components):
+ </para>
+
+ <programlisting role="JAVA"><![CDATA[public void sessionWillPassivate(HttpSessionEvent e);
+public void sessionDidActivate(HttpSessionEvent e);]]></programlisting>
+
+ <para>
+ Or you can simply mark two no-argument public void methods with <literal>@PrePassivate</literal> and
+ <literal>@PostActivate</literal>, respectively. Note that the passivation step occurs at the end of
+ every request, while the activation step occurs when a node is called upon.
+ </para>
+
+ </sect2>
+ <para>
+ Now that you understand the big picture of running Seam in a cluster, it's time to address Seam's most
+ mysterious, yet remarkable agent, the ManagedEntityInterceptor.
+ </para>
+ </sect1>
+
+ <sect1>
+ <title>EJB Passivation and the ManagedEntityInterceptor</title>
+
+ <para>
+ The ManagedEntityInterceptor (MEI) is an optional interceptor in Seam that gets applied to
+ conversation-scoped components when enabled. Enabling it is simple. You just set the distributable property
+ on the org.jboss.seam.init.core component to true. More simply put, you add (or update) the following
+ component declaration in the component descriptor (i.e., components.xml).
+ </para>
+
+ <programlisting role="XML"><![CDATA[<core:init distributable="true"/>]]></programlisting>
+
+ <para>
+ Note that this doesn't enable replication of HTTP sessions, but it does prepare Seam to be able to deal with
+ passivation of either EJB components or components in the HTTP session.
+ </para>
+
+ <para>
+ The MEI serves two distinct scenarios (EJB passivation and HTTP session passivation), although to accomplish
+ the same overall goal. It ensures that throughout the life of a conversation using at least one extended
+ persistence context, the entity instances loaded by the persistence context(s) remain managed (they do not
+ become detatched prematurally by a passivation event). In short, it ensures the integrity of the extended
+ persistence context (and therefore its guarantees).
+ </para>
+
+ <para>
+ The previous statement implies that there is a challenge that threatens this contract. In fact, there are
+ two. One case is when a stateful session bean (SFSB) that hosts an extended persistence context is
+ passivated (to save memory or to migrate it to another node in the cluster) and the second is when the HTTP
+ session is passivated (to prepare it to be migrated to another node in the cluster).
+ </para>
+
+ <para>
+ I first want to discuss the general problem of passivation and then look at the two challenges cited
+ individually.
+ </para>
+
+ <sect2>
+ <title>The friction between passivation and persistence</title>
+
+ <para>
+ The persistence context is where the persistence manager (i.e., JPA EntityManager or Hibernate Session)
+ stores entity instances (i.e., objects) it has loaded from the database (via the object-relational
+ mappings). Within a persistence context, there is no more than one object per unique database record.
+ The persistence context is often referred to as the first-level cache because if the application asks
+ for a record by its unique identifier that has already been loaded into the persistence context, a call
+ to the database is avoided. But it's about more than just caching.
+ </para>
+
+ <para>
+ Objects held in the persistence context can be modified, which the persistence manager tracks. When an
+ object is modified, it's considered "dirty". The persistence manager will migrate these changes to the
+ database using a technique known as write-behind (which basically means only when necessary). Thus, the
+ persistence context maintains a set of pending changes to the database.
+ </para>
+
+ <para>
+ Database-oriented applications do much more than just read from and write to the database. They capture
+ transactional bits of information that need to be tranfered into the database atomically (at once). It's
+ not always possible to capture this information all on one screen. Additionally, the user might need to
+ make a judgement call about whether to approve or reject the pending changes.
+ </para>
+
+ <para>
+ What we are getting at here is that the idea of a transaction from the user's perspective needs to be
+ extended. And that is why the extended persistence context fits so perfectly with this requirement. It
+ can hold such changes for as long as the application can keep it open and then use the built-in
+ capabilities of the persistence manager to push these pending changes to the database without requiring
+ the application developer to worry about the low-level details (a simple call to
+ <literal>EntityManager#flush()</literal> does the trick).
+ </para>
+
+ <para>
+ The link between the persistence manager and the entity instances is maintained using object references.
+ The entity instances are serializable, but the persistence manager (and in turn its persistence context)
+ is not. Therefore, the process of serialization works against this design. Serialization can occur
+ either when a SFSB or the HTTP session is passivated. In order to sustain the activity in the
+ application, the persistence manager and the entity instances it manages must weather serialization
+ without losing their relationship. That's the aid that the MEI provides.
+ </para>
+
+ </sect2>
+
+ <sect2>
+ <title>Case #1: Surviving EJB passivation</title>
+
+ <para>
+ Conversations were initially designed with stateful session beans (SFSBs) in mind, primarily because the
+ EJB 3 specification designates SFSBs as hosts of the extended persistence context. Seam introduces a
+ compliment to the extended persistence context, known as a Seam-managed persistence context, which works
+ around a number of limitations in the specification (complex propagation rules and lack of manual
+ flushing). Both can be used with a SFSB.
+ </para>
+
+ <para>
+ A SFSB relies on a client to hold a reference to it in order to keep it active. Seam has provided an
+ ideal place for this reference in the conversation context. Thus, for as long as the conversation
+ context is active, the SFSB is active. If an EntityManager is injected into that SFSB using the
+ annotation @PersistenceContext(EXTENDED), then that EntityManager will be bound to the SFSB and remain
+ open throughout its lifetime, the lifetime of the conversation. If an EntityManager is injected using
+ @In, then that EntityManager is maintained by Seam and stored directly in the conversation context, thus
+ living for the lifetime of the conversation independent of the lifetime of the SFSB.
+ </para>
+
+ <para>
+ With all of that said, the Java EE container can passivate a SFSB, which means it will serialize the
+ object to an area of storage external to the JVM. When this happens depends on the settings of the
+ individual SFSB. This process can even be disabled. However, the persistence context is not serialized
+ (is this only true of SMPC?). In fact, what happens depends highly on the Java EE container. The spec is
+ not very clear about this situation. Many vendors just tell you not to let it happen if you need the
+ guarnatees of the extended persistence context. Seam's approach is more conservative. Seam basically
+ doesn't trust the SFSB with the persistence context or the entity instances. After each invocation of
+ the SFSB, Seam moves the reference to entity instance held by the SFSB into the current conversation
+ (and therefore into the HTTP session), nullifying those fields on the SFSB. It then restores this
+ references at the beginning of the next invocation. Of course, Seam is already storing the persistence
+ manager in the conversation. Thus, when the SFSB passivates and later activates, it has absolutely no
+ averse affect on the application.
+ </para>
+
+ <note>
+ <para>
+ If you are using SFSBs in your application that hold references to extended persistence contexts,
+ and those SFSBs can passivate, then you must use the MEI. This requirement holds even if you are
+ using a single instance (not a cluster). However, if you are using clustered SFSB, then this
+ requirement also applies.
+ </para>
+ </note>
+
+ <para>
+ It is possible to disable passivation on a SFSB. See the <ulink
+ url="http://www.jboss.org/community/docs/DOC-9656">Ejb3DisableSfsbPassivation</ulink> page on the JBoss
+ Wiki for details.
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Case #2: Surviving HTTP session replication</title>
+
+ <para>
+ Dealing with passivation of a SFSB works by leveraging the HTTP session. But what happens when the HTTP
+ session passivates? This happens in a clustered environment with session replication enabled. This case
+ is much tricker to deal with and is where a bulk of the MEI infrastructure comes into play. In thise
+ case, the persistence manager is going to be destroyed because it cannot be serialized. Seam handles
+ this deconstruction (hence ensuring that the HTTP session serializes properly). But what happens on the
+ other end. Well, when the MEI sticks an entity instance into the conversation, it embeds the instance in
+ a wrapper that provides information on how to reassociate the instance with a persistence manager
+ post-serialization. So when the application jumps to another node in the cluster (presumably because the
+ target node went down) the MEI infrastruture essentially reconstructs the persistence context. The huge
+ drawback here is that since the persistence context is being reconstructed (from the database), pending
+ changes are dropped. However, what Seam does do is ensure that if the entity instance is versioned, that
+ the guarantees of optimistic locking are upheld. (why isn't the dirty state transfered?)
+ </para>
+
+ <note>
+ <para>
+ If you are deploying your application in a cluster and using HTTP session replication, you must use the MEI.
+ </para>
+ </note>
+ </sect2>
+
+ <sect2>
+ <title>ManagedEntityInterceptor wrap-up</title>
+
+ <para>
+ The important point of this section is that the MEI is there for a reason. It's there to ensure that the
+ extended persistence context can retain intact in the face of passivation (of either a SFSB or the HTTP
+ session). This matters because the natural design of Seam applications (and conversational state in
+ general) revolve around the state of this resource.
+ </para>
+
+ </sect2>
+
+ </sect1>
+
+<!--
+ vim:et:ts=4:sw=4:tw=120
+-->
+</chapter>
Modified: branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/master.xml
===================================================================
--- branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/master.xml 2009-05-28 19:15:03 UTC (rev 11027)
+++ branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/master.xml 2009-05-29 02:17:32 UTC (rev 11028)
@@ -38,6 +38,7 @@
<xi:include href="Components.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Controls.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Elenhancements.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="ClusteringAndEJBPassivation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Performance.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Testing.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Tools.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
15 years, 6 months
Seam SVN: r11027 - in examples/trunk/booking: ejb-jar/src/main/java/org/jboss/seam/examples/booking/account and 6 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-28 15:15:03 -0400 (Thu, 28 May 2009)
New Revision: 11027
Added:
examples/trunk/booking/ejb-jar/src/main/resources/messages.properties
examples/trunk/booking/war/src/main/resources/
examples/trunk/booking/war/src/main/webapp/denied.xhtml
Modified:
examples/trunk/booking/WORKLOG
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/account/AccountProducerBean.java
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/account/PasswordManagerBean.java
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/account/RegistrarBean.java
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingHistoryBean.java
examples/trunk/booking/ejb-jar/src/main/resources/META-INF/beans.xml
examples/trunk/booking/war/src/main/webapp/WEB-INF/web.xml
examples/trunk/booking/war/src/main/webapp/error.xhtml
Log:
remove Faces deployment type
fix login after register
introduce resource bundle (messages) and add StatusMessages from resource bundle
add access denied page
update worklog
Modified: examples/trunk/booking/WORKLOG
===================================================================
--- examples/trunk/booking/WORKLOG 2009-05-28 19:13:06 UTC (rev 11026)
+++ examples/trunk/booking/WORKLOG 2009-05-28 19:15:03 UTC (rev 11027)
@@ -1,25 +1,21 @@
KNOWN ISSUES
============
-(1) Ajax is not working on blur in p:edit form fields (had to disable)
- Alert box showing "error malformedXML"
+(1) No list of workspaces
-(2) No list of workspaces
+(2) @AfterTransactionSuccess observer does not work
-(3) @AfterTransactionSuccess observer does not work
-
-(4) Ghost click first time clicking on View after results are returned
+(3) Ghost click first time clicking on View after results are returned
Mojarra Issue #1116; ViewState is not being put in form on partial page update
-(5) If you visit the main.seam page before logging in, when you logging, you remain an anonymous user; the session-scoped
- user bean is not being cleared on login. (temporary fix)
+(4) If you visit the main.seam page before logging in, when you logging, you remain an anonymous user; the session-scoped
+ user bean is not being cleared on login. (temporary fix in place, but it's a hack)
-(6) blank user shown after registering
+(5) would like to put messages in war/src/main/resources but loader cannot see it there at the moment
TODO
====
-- secure pages (likely will use <s:restrictView require=""/>
- add remember me from Seam identity
- get status messages from default or resource bundle (not just hardcoded defaults)
- demonstrate use of exception handling in JSF 2
Modified: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/account/AccountProducerBean.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/account/AccountProducerBean.java 2009-05-28 19:13:06 UTC (rev 11026)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/account/AccountProducerBean.java 2009-05-28 19:15:03 UTC (rev 11027)
@@ -47,7 +47,7 @@
}
log.info("Producing dummy User");
- // TODO can't return null, but then we are not honoring the semantics of our binding type
+ // TODO can't return null because this is a scoped producer, but then we are not honoring the semantics of our binding type
return new User();
}
}
Modified: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/account/PasswordManagerBean.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/account/PasswordManagerBean.java 2009-05-28 19:13:06 UTC (rev 11026)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/account/PasswordManagerBean.java 2009-05-28 19:15:03 UTC (rev 11027)
@@ -40,7 +40,7 @@
// FIXME: dirty hack, can't merge a managed bean
em.merge(new User(user.getName(), user.getUsername(), user.getPassword()));
user.setPassword(null);
- statusMessages.add("Password successfully updated.");
+ statusMessages.addFromResourceBundleOrDefault("account.passwordChanged", "Password successfully updated.");
changed = true;
}
else
@@ -48,7 +48,8 @@
// FIME reverting isn't going to work here
//revertUser();
confirmPassword = null;
- statusMessages.addToControl(formControls.getConfirmPasswordControlId(), "Passwords do not match. Please re-type the new password.");
+ statusMessages.addToControlFromResourceBundleOrDefault(formControls.getConfirmPasswordControlId(),
+ "account.passwordsDoNotMatch", "Passwords do not match. Please re-type the new password.");
}
}
Modified: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/account/RegistrarBean.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/account/RegistrarBean.java 2009-05-28 19:13:06 UTC (rev 11026)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/account/RegistrarBean.java 2009-05-28 19:15:03 UTC (rev 11027)
@@ -49,9 +49,10 @@
{
em.persist(newUser);
credentials.setUsername(newUser.getUsername());
- identity.login();
+ credentials.setPassword(newUser.getPassword());
+ identity.quietLogin();
registered = true;
- statusMessages.add("You have been successfully registered as the user {0}!", newUser.getUsername());
+ statusMessages.addFromResourceBundleOrDefault("registration.registered", "You have been successfully registered as the user {0}!", newUser.getUsername());
}
else
{
@@ -69,7 +70,7 @@
{
if (validationFailed || registrationInvalid)
{
- statusMessages.add(StatusMessage.Severity.WARN, "Invalid registration. Please correct the errors and try again.");
+ statusMessages.addFromResourceBundleOrDefault(StatusMessage.Severity.WARN, "registration.invalid", "Invalid registration. Please correct the errors and try again.");
}
}
@@ -105,7 +106,8 @@
{
if (!newUser.getPassword().equals(confirmPassword))
{
- statusMessages.addToControl(formControls.getConfirmPasswordControlId(), "Passwords do not match. Please re-type your password.");
+ statusMessages.addToControlFromResourceBundleOrDefault(formControls.getConfirmPasswordControlId(),
+ "account.passwordsDoNotMatch", "Passwords do not match. Please re-type your password.");
confirmPassword = null;
return false;
}
@@ -118,7 +120,8 @@
User existing = em.find(User.class, newUser.getUsername());
if (existing != null)
{
- statusMessages.addToControl(formControls.getUsernameControlId(), "The username '{0}' is already taken. Please choose another username.", newUser.getUsername());
+ statusMessages.addToControlFromResourceBundleOrDefault(formControls.getUsernameControlId(),
+ "account.usernameTaken", "The username '{0}' is already taken. Please choose another username.", newUser.getUsername());
return false;
}
Modified: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java 2009-05-28 19:13:06 UTC (rev 11026)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java 2009-05-28 19:15:03 UTC (rev 11027)
@@ -93,7 +93,7 @@
calendar.add(Calendar.DAY_OF_MONTH, 1);
booking.setCheckoutDate(calendar.getTime());
hotelSelection = null;
- statusMessages.add("You've initiated a booking at {0}.", booking.getHotel().getName());
+ statusMessages.addFromResourceBundleOrDefault("booking.initiated", "You've initiated a booking at {0}.", booking.getHotel().getName());
}
public void validateBooking()
@@ -102,12 +102,12 @@
calendar.add(Calendar.DAY_OF_MONTH, -1);
if (booking.getCheckinDate().before(calendar.getTime()))
{
- statusMessages.addToControl(formControls.getCheckinDateControlId(), "Check in date must be a future date");
+ statusMessages.addToControlFromResourceBundleOrDefault(formControls.getCheckinDateControlId(), "booking.checkInNotFutureDate", "Check in date must be a future date");
bookingValid = false;
}
else if (!booking.getCheckinDate().before(booking.getCheckoutDate()))
{
- statusMessages.addToControl(formControls.getCheckoutDateControlId(), "Check out date must be after check in date");
+ statusMessages.addToControlFromResourceBundleOrDefault(formControls.getCheckoutDateControlId(), "booking.checkOutBeforeCheckIn", "Check out date must be after check in date");
bookingValid = false;
}
else
@@ -123,7 +123,7 @@
//bookingConfirmedEvent.fire(new BookingEvent(booking));
manager.fireEvent(new BookingEvent(booking), new AnnotationLiteral<Confirmed>() {});
log.info("New booking at the {0} confirmed for {1}", booking.getHotel().getName(), booking.getUser().getName());
- statusMessages.add("You're booked!");
+ statusMessages.addFromResourceBundleOrDefault("booking.confirmed", "Booking confirmed.");
conversation.end();
}
Modified: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingHistoryBean.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingHistoryBean.java 2009-05-28 19:13:06 UTC (rev 11026)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingHistoryBean.java 2009-05-28 19:15:03 UTC (rev 11027)
@@ -66,11 +66,11 @@
if (booking != null)
{
em.remove(booking);
- statusMessages.add("The booking at the {0} on {1,date} has been canceled.", selectedBooking.getHotel().getName(), selectedBooking.getCheckinDate());
+ statusMessages.addFromResourceBundleOrDefault("booking.canceled", "The booking at the {0} on {1,date} has been canceled.", selectedBooking.getHotel().getName(), selectedBooking.getCheckinDate());
}
else
{
- statusMessages.add("Our records indicate that the booking you selected has already been canceled.");
+ statusMessages.addFromResourceBundleOrDefault("booking.doesNotExist", "Our records indicate that the booking you selected has already been canceled.");
}
bookingsForUser.remove(selectedBooking);
Modified: examples/trunk/booking/ejb-jar/src/main/resources/META-INF/beans.xml
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/resources/META-INF/beans.xml 2009-05-28 19:13:06 UTC (rev 11026)
+++ examples/trunk/booking/ejb-jar/src/main/resources/META-INF/beans.xml 2009-05-28 19:15:03 UTC (rev 11027)
@@ -1,8 +0,0 @@
-<Beans xmlns="urn:java:ee"
- xmlns:faces="urn:java:org.jboss.seam.faces">
- <Deploy>
- <Standard/>
- <Production/>
- <faces:Faces/>
- </Deploy>
-</Beans>
Added: examples/trunk/booking/ejb-jar/src/main/resources/messages.properties
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/resources/messages.properties (rev 0)
+++ examples/trunk/booking/ejb-jar/src/main/resources/messages.properties 2009-05-28 19:15:03 UTC (rev 11027)
@@ -0,0 +1,11 @@
+booking.initiated=You've initiated a booking at {0}.
+booking.checkInNotFutureDate=Check in date must be a future date.
+booking.checkOutBeforeCheckIn=Check out date must be after check in date.
+booking.confirmed=You're booked!
+booking.canceled=The booking at the {0} on {1,date} has been canceled.
+booking.doesNotExist=Our records indicate that the booking you selected has already been canceled.
+account.passwordChanged=Password successfully updated.
+account.passwordsDoNotMatch=Passwords do not match. Please re-type the new password.
+account.usernameTaken=The username '{0}' is already taken. Please choose another username.
+registration.registered=You have been successfully registered as the user {0}!
+registration.invalid=Invalid registration. Please correct the errors and try again.
Modified: examples/trunk/booking/war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/WEB-INF/web.xml 2009-05-28 19:13:06 UTC (rev 11026)
+++ examples/trunk/booking/war/src/main/webapp/WEB-INF/web.xml 2009-05-28 19:15:03 UTC (rev 11027)
@@ -64,7 +64,7 @@
<error-page>
<exception-type>org.jboss.seam.security.AuthorizationException</exception-type>
- <location>/error.seam</location>
+ <location>/denied.seam</location>
</error-page>
<error-page>
Added: examples/trunk/booking/war/src/main/webapp/denied.xhtml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/denied.xhtml (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/denied.xhtml 2009-05-28 19:15:03 UTC (rev 11027)
@@ -0,0 +1,23 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:p="http://http://java.sun.com/jsf/composite/components/property"
+ template="/WEB-INF/layout/template.xhtml">
+
+ <ui:define name="content">
+
+ <div class="section">
+ <h1>Access Denied</h1>
+ </div>
+
+ <div class="section">
+ <p>You are not authorized to perform the requested action.</p>
+ <p>#{facesContext.externalContext.requestMap['javax.servlet.error.message']}</p>
+ </div>
+
+ </ui:define>
+
+</ui:composition>
Modified: examples/trunk/booking/war/src/main/webapp/error.xhtml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/error.xhtml 2009-05-28 19:13:06 UTC (rev 11026)
+++ examples/trunk/booking/war/src/main/webapp/error.xhtml 2009-05-28 19:15:03 UTC (rev 11027)
@@ -14,7 +14,7 @@
</div>
<div class="section">
- <p>You are not authorized to perform the requested action.</p>
+ <p>An unexpected error has occurred.</p>
<p>#{facesContext.externalContext.requestMap['javax.servlet.error.message']}</p>
</div>
15 years, 6 months
Seam SVN: r11026 - in modules/trunk: el/src/test/java/org/jboss/seam/el and 19 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-28 15:13:06 -0400 (Thu, 28 May 2009)
New Revision: 11026
Added:
modules/trunk/faces/src/main/java/org/jboss/seam/faces/context/
modules/trunk/faces/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/el/FacesExpressions.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/
modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/FacesLocaleResolver.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/FacesMessages.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/resources/
modules/trunk/faces/src/main/java/org/jboss/seam/faces/resources/FacesResourceLoader.java
modules/trunk/faces/src/test/java/org/jboss/seam/faces/context/
modules/trunk/faces/src/test/java/org/jboss/seam/faces/context/FacesContextProducerTest.java
modules/trunk/faces/src/test/java/org/jboss/seam/faces/el/
modules/trunk/faces/src/test/java/org/jboss/seam/faces/el/FacesExpressionsTest.java
modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/
modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/FacesLocaleProducerTest.java
modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/FacesMessagesTest.java
modules/trunk/international/src/main/java/org/jboss/seam/international/AutoInterpolatedMessages.java
modules/trunk/international/src/main/java/org/jboss/seam/international/AutoInterpolatedMessagesProducer.java
modules/trunk/international/src/main/java/org/jboss/seam/international/InterpolatingResourceBundle.java
modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleResolver.java
modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleResolverProducer.java
modules/trunk/international/src/main/java/org/jboss/seam/international/SeamResourceBundleAdapter.java
modules/trunk/international/src/test/java/org/jboss/seam/international/AutoInterpolatedMessagesTest.java
modules/trunk/international/src/test/java/org/jboss/seam/international/Thing.java
modules/trunk/international/src/test/resources/messages.properties
Removed:
modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesContextProducer.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesExpressions.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesMessages.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesResourceLoader.java
modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesContextProducerTest.java
modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesExpressionsTest.java
modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesMessagesTest.java
modules/trunk/international/src/main/java/org/jboss/seam/international/ResourceBundle.java
modules/trunk/international/src/main/java/org/jboss/seam/international/ResourceLoader.java
modules/trunk/international/src/main/java/org/jboss/seam/international/util/Resources.java
Modified:
modules/trunk/el/src/main/java/org/jboss/seam/el/AbstractELResolver.java
modules/trunk/el/src/main/java/org/jboss/seam/el/ExpressionsProducer.java
modules/trunk/el/src/test/java/org/jboss/seam/el/ExpressionsProducerTest.java
modules/trunk/faces/pom.xml
modules/trunk/faces/src/main/java/org/jboss/seam/faces/DataModels.java
modules/trunk/faces/src/main/resources/META-INF/seam-faces.taglib.xml
modules/trunk/faces/src/test/resources/test-suite.xml
modules/trunk/international/pom.xml
modules/trunk/international/src/main/java/org/jboss/seam/international/Interpolator.java
modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleProducer.java
modules/trunk/international/src/main/java/org/jboss/seam/international/MessagesProducer.java
modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessage.java
modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java
modules/trunk/international/src/test/java/org/jboss/seam/international/InterpolatorTest.java
modules/trunk/international/src/test/java/org/jboss/seam/international/LocaleProducerTest.java
modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesTest.java
modules/trunk/parent/pom.xml
modules/trunk/resources/src/main/java/org/jboss/seam/resources/DefaultResourceLoader.java
modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoader.java
modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoaderProducer.java
Log:
add resource module to parent
add methods to ResourceLoader
implement runtime selected ResourceLoader w/ JSF impl
implement Seam resource bundle
add resource bundle functionality to StatusMessages
implement runtime selected Locale w/ JSF impl
repackaging in faces module
implements runtime selected Expressions w/ JSF impl
Modified: modules/trunk/el/src/main/java/org/jboss/seam/el/AbstractELResolver.java
===================================================================
--- modules/trunk/el/src/main/java/org/jboss/seam/el/AbstractELResolver.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/el/src/main/java/org/jboss/seam/el/AbstractELResolver.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,4 +1,4 @@
-/*
+/*
* JBoss, Home of Professional Open Source
* Copyright 2009, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
@@ -24,6 +24,7 @@
package org.jboss.seam.el;
import java.util.Iterator;
+
import javax.el.ELContext;
import javax.el.ELResolver;
@@ -38,8 +39,8 @@
*
* @author Dan Allen
*/
-public abstract class AbstractELResolver extends ELResolver {
-
+public abstract class AbstractELResolver extends ELResolver
+{
/**
* A default implementation that returns <code>null</code> unconditionally.
*
@@ -93,5 +94,4 @@
public void setValue(ELContext context, Object base, Object property, Object value)
{
}
-
}
Modified: modules/trunk/el/src/main/java/org/jboss/seam/el/ExpressionsProducer.java
===================================================================
--- modules/trunk/el/src/main/java/org/jboss/seam/el/ExpressionsProducer.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/el/src/main/java/org/jboss/seam/el/ExpressionsProducer.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,6 +1,7 @@
package org.jboss.seam.el;
import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Initializer;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.BeanManager;
@@ -26,6 +27,7 @@
@Override
public
+ @RequestScoped
@Produces
Expressions selectImplementation()
{
Modified: modules/trunk/el/src/test/java/org/jboss/seam/el/ExpressionsProducerTest.java
===================================================================
--- modules/trunk/el/src/test/java/org/jboss/seam/el/ExpressionsProducerTest.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/el/src/test/java/org/jboss/seam/el/ExpressionsProducerTest.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -15,6 +15,6 @@
{
Expressions expressions = getCurrentManager().getInstanceByType(Expressions.class);
assertNotNull(expressions);
- assertSame(expressions.getClass(), Expressions.class);
+ assertSame(expressions.getExpressionFactory(), SeamExpressionFactory.INSTANCE);
}
}
Modified: modules/trunk/faces/pom.xml
===================================================================
--- modules/trunk/faces/pom.xml 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/faces/pom.xml 2009-05-28 19:13:06 UTC (rev 11026)
@@ -60,6 +60,11 @@
<artifactId>seam-international</artifactId>
</dependency>
+ <dependency>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-resources</artifactId> <!-- may become inherited -->
+ </dependency>
+
<!-- QUESTION do we want this dependency? -->
<dependency>
<groupId>${seam.groupId}</groupId>
Modified: modules/trunk/faces/src/main/java/org/jboss/seam/faces/DataModels.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/DataModels.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/DataModels.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -5,6 +5,7 @@
import java.util.Set;
import javax.faces.model.DataModel;
+
import org.jboss.seam.faces.model.ArrayDataModel;
import org.jboss.seam.faces.model.ListDataModel;
import org.jboss.seam.faces.model.MapDataModel;
Deleted: modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesContextProducer.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesContextProducer.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesContextProducer.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,20 +0,0 @@
-//$Id: FacesContext.java 5350 2007-06-20 17:53:19Z gavin $
-package org.jboss.seam.faces;
-
-import javax.enterprise.inject.Produces;
-import javax.faces.context.FacesContext;
-
-/**
- * Support for injecting the JSF FacesContext object
- *
- * @author Gavin King
- */
-public class FacesContextProducer
-{
- public
- @Produces
- FacesContext getFacesContext()
- {
- return FacesContext.getCurrentInstance();
- }
-}
Deleted: modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesExpressions.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesExpressions.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesExpressions.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,35 +0,0 @@
-//$Id: FacesExpressions.java 9684 2008-12-01 21:41:20Z dan.j.allen $
-package org.jboss.seam.faces;
-
-import javax.el.ELContext;
-import javax.faces.context.FacesContext;
-
-import org.jboss.seam.beans.RuntimeSelected;
-import org.jboss.seam.beans.RuntimeSelectedBean;
-import org.jboss.seam.el.Expressions;
-
-/**
- * Factory for method and value bindings in a JSF environment.
- *
- * @author Gavin King
- * @author Dan Allen
- */
-public
-@RuntimeSelected
-class FacesExpressions extends Expressions implements RuntimeSelectedBean
-{
- public boolean isActive()
- {
- return FacesContext.getCurrentInstance() != null && FacesContext.getCurrentInstance().getCurrentPhaseId() != null;
- }
-
- /**
- * @return the JSF ELContext
- */
- @Override
- public ELContext getELContext()
- {
- return FacesContext.getCurrentInstance().getELContext();
- }
-
-}
\ No newline at end of file
Deleted: modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesMessages.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesMessages.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesMessages.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,238 +0,0 @@
-package org.jboss.seam.faces;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.enterprise.inject.Initializer;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.jboss.seam.international.StatusMessage;
-import org.jboss.seam.international.StatusMessages;
-import org.jboss.seam.international.StatusMessagesDelegate;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-
-/**
- * <p>
- * A bean which wraps the generic StatusMessages component to provide support
- * for JSF. The StatusMessage objects are translated to JSF FacesMessage objects
- * and registered with the FacesContext by this class prior to view rendering or
- * a servlet redirect.
- * </p>
- *
- * <p>
- * To access the JSF FacesMessage objects once they have been registered with
- * the FacesContext, you should use the methods getMessageList() and
- * getMessagesList(String), which were added to FacesContext in JSF 2.0.
- * </p>
- *
- * <p>
- * For instance, to retrieve the list of global messages, you can use the
- * following value expression in your page:
- * </p>
- *
- * <pre>
- * #{facesContext.getMessageList(null)}
- * </pre>
- *
- * <p>
- * To retrieve the list of messages for a "client id", you can use this
- * expression:
- * </p>
- *
- * <pre>
- * #{facesContext.getMessageList('username')}
- * </pre>
- *
- * <p>
- * These examples rely, of course, on the JBoss EL.
- * </p>
- *
- * @author Gavin King
- * @author Pete Muir
- * @author Dan Allen
- */
-public
-@Faces
-class FacesMessages extends StatusMessagesDelegate
-{
- private static final LogProvider log = Logging.getLogProvider(FacesMessages.class);
-
- private StatusMessages statusMessages;
-
- public
- @Initializer
- FacesMessages(StatusMessages statusMessages)
- {
- this.statusMessages = statusMessages;
- }
-
- @Override
- public StatusMessages getStatusMessages()
- {
- return this.statusMessages;
- }
-
- /**
- * A convenience method to convert a FacesMessage into a StatusMessage and
- * register it as a global message. It may be that the application receives a
- * FacesMessage object from some part of the system and needs to join it with
- * the current set of StatusMessage objects.
- *
- * @param message A populated JSF FacesMessage object
- */
- public void add(FacesMessage message)
- {
- add(toSeverity(message.getSeverity()), null, null, message.getSummary(), message.getDetail());
- }
-
- /**
- * A convenience method to convert a FacesMessage into a StatusMessage and
- * register it with a control. It may be that the application receives a
- * FacesMessage object from some part of the system and needs to join it with
- * the current set of StatusMessage objects.
- *
- * @param id The client id of the target component
- * @param message A populated JSF FacesMessage object
- */
- public void addToControl(String id, FacesMessage message)
- {
- addToControl(id, toSeverity(message.getSeverity()), null, null, message.getSummary(), message.getDetail());
- }
-
- /**
- * Called by a JSF SystemEventListener listening for the PreRenderViewEvent
- * to transpose Seam status messages to real JSF messages and register them
- * with the FacesContext.
- */
- @Override
- public void onBeforeRender()
- {
- super.onBeforeRender();
- FacesContext facesContext = FacesContext.getCurrentInstance();
- for (StatusMessage statusMessage : getGlobalMessages())
- {
- facesContext.addMessage(null, toFacesMessage(statusMessage));
- }
- for (Map.Entry<String, List<StatusMessage>> messagesForKey : getKeyedMessages().entrySet())
- {
- String clientId = getClientId(messagesForKey.getKey(), facesContext);
- if (clientId == null)
- {
- log.warn("Could not locate control '" + messagesForKey.getKey() + "' when registering JSF message. A global message will be created as a fallback.");
- }
- for (StatusMessage statusMessage : messagesForKey.getValue())
- {
- facesContext.addMessage(clientId, toFacesMessage(statusMessage));
- }
- }
- clear();
- }
-
- /**
- * Convert a StatusMessage to a FacesMessage
- */
- private FacesMessage toFacesMessage(StatusMessage statusMessage)
- {
- if (statusMessage.getSummary() != null && statusMessage.getSummary().length() > 0)
- {
- return new FacesMessage(toFacesSeverity(statusMessage.getSeverity()), statusMessage.getSummary(), statusMessage.getDetail());
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Convert a FacesMessage.Severity to a StatusMessage.Severity
- */
- private static StatusMessage.Severity toSeverity(FacesMessage.Severity severity)
- {
- if (FacesMessage.SEVERITY_ERROR.equals(severity))
- {
- return StatusMessage.Severity.ERROR;
- }
- else if (FacesMessage.SEVERITY_FATAL.equals(severity))
- {
- return StatusMessage.Severity.FATAL;
- }
- else if (FacesMessage.SEVERITY_WARN.equals(severity))
- {
- return StatusMessage.Severity.WARN;
- }
- else
- {
- return StatusMessage.Severity.INFO;
- }
- }
-
- /**
- * Convert a StatusMessage.Severity to a FacesMessage.Severity
- */
- private FacesMessage.Severity toFacesSeverity(StatusMessage.Severity severity)
- {
- switch (severity)
- {
- case ERROR:
- return FacesMessage.SEVERITY_ERROR;
- case FATAL:
- return FacesMessage.SEVERITY_FATAL;
- case WARN:
- return FacesMessage.SEVERITY_WARN;
- case INFO:
- default:
- return FacesMessage.SEVERITY_INFO;
- }
- }
-
- /**
- * Calculate the JSF client ID from the provided widget ID.
- * TODO It would be great if this could do suffix maching.
- */
- private String getClientId(String targetId, FacesContext facesContext)
- {
- if (isAbsoluteClientIdPresent(targetId, facesContext))
- {
- return targetId;
- }
- else
- {
- return getClientId(facesContext.getViewRoot(), targetId, facesContext);
- }
- }
-
- /**
- * FIXME does not work if element is inside of form with prependId="false"
- */
- private boolean isAbsoluteClientIdPresent(String targetId, FacesContext facesContext)
- {
- return facesContext.getViewRoot().findComponent(targetId) != null;
- }
-
- private String getClientId(UIComponent component, String targetLocalId, FacesContext facesContext)
- {
- String currentLocalId = component.getId();
- if (currentLocalId != null && currentLocalId.equals(targetLocalId))
- {
- return component.getClientId(facesContext);
- }
- else
- {
- Iterator<UIComponent> iter = component.getFacetsAndChildren();
- while (iter.hasNext())
- {
- String clientId = getClientId(iter.next(), targetLocalId, facesContext);
- if (clientId != null)
- {
- return clientId;
- }
- }
- return null;
- }
- }
-
-}
Deleted: modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesResourceLoader.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesResourceLoader.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesResourceLoader.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,72 +0,0 @@
-package org.jboss.seam.faces;
-
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.faces.context.FacesContext;
-import javax.servlet.ServletContext;
-
-import org.jboss.seam.international.ResourceLoader;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-
-/**
- * Extend the standard {@link ResourceLoader} and attempt to first load
- * the resource from the web context root.
- *
- * @author Dan Allen
- */
-public class FacesResourceLoader extends ResourceLoader
-{
- private static final LogProvider log = Logging.getLogProvider(FacesResourceLoader.class);
-
- //@Current
- FacesContext facesContext;
-
- @Override
- protected URL getResource(String path, String relativePath)
- {
- ServletContext servletContext = getServletContext();
- if (servletContext != null)
- {
- try
- {
- URL url = servletContext.getResource(path);
- log.debug("Loaded resource from servlet context: " + url);
- return url;
- }
- catch (Exception e)
- {
- // swallow
- }
- }
-
- return super.getResource(path, relativePath);
- }
-
- @Override
- protected InputStream getResourceAsStream(String path, String relativePath)
- {
- ServletContext servletContext = getServletContext();
- if (servletContext != null)
- {
- try
- {
- InputStream stream = servletContext.getResourceAsStream(path);
- log.debug("Loaded resource stream from servlet context: " + path);
- return stream;
- }
- catch (Exception e)
- {
- // swallow
- }
- }
-
- return super.getResourceAsStream(path, relativePath);
- }
-
- private ServletContext getServletContext()
- {
- return (ServletContext) facesContext.getExternalContext().getContext();
- }
-}
Copied: modules/trunk/faces/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java (from rev 10994, modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesContextProducer.java)
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java (rev 0)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,22 @@
+//$Id: FacesContext.java 5350 2007-06-20 17:53:19Z gavin $
+package org.jboss.seam.faces.context;
+
+import javax.enterprise.inject.Produces;
+import javax.faces.context.FacesContext;
+
+/**
+ * Support for injecting the JSF FacesContext object
+ *
+ * QUESTION should we return null if there is no current phase id? (seems to be a common check)
+ *
+ * @author Gavin King
+ */
+public class FacesContextProducer
+{
+ public
+ @Produces
+ FacesContext getFacesContext()
+ {
+ return FacesContext.getCurrentInstance();
+ }
+}
Copied: modules/trunk/faces/src/main/java/org/jboss/seam/faces/el/FacesExpressions.java (from rev 11012, modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesExpressions.java)
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/el/FacesExpressions.java (rev 0)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/el/FacesExpressions.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,40 @@
+//$Id: FacesExpressions.java 9684 2008-12-01 21:41:20Z dan.j.allen $
+package org.jboss.seam.faces.el;
+
+import javax.el.ELContext;
+import javax.enterprise.inject.Current;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.beans.RuntimeSelected;
+import org.jboss.seam.beans.RuntimeSelectedBean;
+import org.jboss.seam.el.Expressions;
+
+/**
+ * Factory for method and value bindings in a JSF environment.
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+public
+@RuntimeSelected
+class FacesExpressions extends Expressions implements RuntimeSelectedBean
+{
+ @Current FacesContext facesContext;
+
+ public boolean isActive()
+ {
+ // FIXME temporary hack since a bogus FacesContext is being injected
+ facesContext = FacesContext.getCurrentInstance();
+ return facesContext != null && facesContext.getCurrentPhaseId() != null;
+ }
+
+ /**
+ * @return the JSF ELContext
+ */
+ @Override
+ public ELContext getELContext()
+ {
+ return facesContext.getELContext();
+ }
+
+}
\ No newline at end of file
Added: modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/FacesLocaleResolver.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/FacesLocaleResolver.java (rev 0)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/FacesLocaleResolver.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,45 @@
+package org.jboss.seam.faces.international;
+
+import java.util.Locale;
+
+import javax.enterprise.inject.Current;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.beans.RuntimeSelected;
+import org.jboss.seam.beans.RuntimeSelectedBean;
+import org.jboss.seam.international.LocaleResolver;
+
+/**
+ * A specialized version of the LocaleProducer that returns
+ * the Locale associated with the current UIViewRoot or,
+ * if the UIViewRoot has not been established, uses the
+ * ViewHandler to calculate the Locale.
+ *
+ * @author Dan Allen
+ */
+public
+@RuntimeSelected
+class FacesLocaleResolver extends LocaleResolver implements RuntimeSelectedBean
+{
+ @Current FacesContext facesContext;
+
+ public boolean isActive()
+ {
+ // FIXME temporary hack since the FacesContext being injected is bogus
+ facesContext = FacesContext.getCurrentInstance();
+ return facesContext != null && facesContext.getCurrentPhaseId() != null;
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ if (facesContext.getViewRoot() != null)
+ {
+ return facesContext.getViewRoot().getLocale();
+ }
+ else
+ {
+ return facesContext.getApplication().getViewHandler().calculateLocale(facesContext);
+ }
+ }
+}
Copied: modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/FacesMessages.java (from rev 11013, modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesMessages.java)
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/FacesMessages.java (rev 0)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/FacesMessages.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,239 @@
+package org.jboss.seam.faces.international;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.Initializer;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.faces.Faces;
+import org.jboss.seam.international.StatusMessage;
+import org.jboss.seam.international.StatusMessages;
+import org.jboss.seam.international.StatusMessagesDelegate;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ * <p>
+ * A bean which wraps the generic StatusMessages component to provide support
+ * for JSF. The StatusMessage objects are translated to JSF FacesMessage objects
+ * and registered with the FacesContext by this class prior to view rendering or
+ * a servlet redirect.
+ * </p>
+ *
+ * <p>
+ * To access the JSF FacesMessage objects once they have been registered with
+ * the FacesContext, you should use the methods getMessageList() and
+ * getMessagesList(String), which were added to FacesContext in JSF 2.0.
+ * </p>
+ *
+ * <p>
+ * For instance, to retrieve the list of global messages, you can use the
+ * following value expression in your page:
+ * </p>
+ *
+ * <pre>
+ * #{facesContext.getMessageList(null)}
+ * </pre>
+ *
+ * <p>
+ * To retrieve the list of messages for a "client id", you can use this
+ * expression:
+ * </p>
+ *
+ * <pre>
+ * #{facesContext.getMessageList('username')}
+ * </pre>
+ *
+ * <p>
+ * These examples rely, of course, on the JBoss EL.
+ * </p>
+ *
+ * @author Gavin King
+ * @author Pete Muir
+ * @author Dan Allen
+ */
+public
+@Faces
+class FacesMessages extends StatusMessagesDelegate
+{
+ private static final LogProvider log = Logging.getLogProvider(FacesMessages.class);
+
+ private StatusMessages statusMessages;
+
+ public
+ @Initializer
+ FacesMessages(StatusMessages statusMessages)
+ {
+ this.statusMessages = statusMessages;
+ }
+
+ @Override
+ public StatusMessages getStatusMessages()
+ {
+ return this.statusMessages;
+ }
+
+ /**
+ * A convenience method to convert a FacesMessage into a StatusMessage and
+ * register it as a global message. It may be that the application receives a
+ * FacesMessage object from some part of the system and needs to join it with
+ * the current set of StatusMessage objects.
+ *
+ * @param message A populated JSF FacesMessage object
+ */
+ public void add(FacesMessage message)
+ {
+ add(toSeverity(message.getSeverity()), null, null, message.getSummary(), message.getDetail());
+ }
+
+ /**
+ * A convenience method to convert a FacesMessage into a StatusMessage and
+ * register it with a control. It may be that the application receives a
+ * FacesMessage object from some part of the system and needs to join it with
+ * the current set of StatusMessage objects.
+ *
+ * @param id The client id of the target component
+ * @param message A populated JSF FacesMessage object
+ */
+ public void addToControl(String id, FacesMessage message)
+ {
+ addToControl(id, toSeverity(message.getSeverity()), null, null, message.getSummary(), message.getDetail());
+ }
+
+ /**
+ * Called by a JSF SystemEventListener listening for the PreRenderViewEvent
+ * to transpose Seam status messages to real JSF messages and register them
+ * with the FacesContext.
+ */
+ @Override
+ public void onBeforeRender()
+ {
+ super.onBeforeRender();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ for (StatusMessage statusMessage : getGlobalMessages())
+ {
+ facesContext.addMessage(null, toFacesMessage(statusMessage));
+ }
+ for (Map.Entry<String, List<StatusMessage>> messagesForKey : getKeyedMessages().entrySet())
+ {
+ String clientId = getClientId(messagesForKey.getKey(), facesContext);
+ if (clientId == null)
+ {
+ log.warn("Could not locate control '" + messagesForKey.getKey() + "' when registering JSF message. A global message will be created as a fallback.");
+ }
+ for (StatusMessage statusMessage : messagesForKey.getValue())
+ {
+ facesContext.addMessage(clientId, toFacesMessage(statusMessage));
+ }
+ }
+ clear();
+ }
+
+ /**
+ * Convert a StatusMessage to a FacesMessage
+ */
+ private FacesMessage toFacesMessage(StatusMessage statusMessage)
+ {
+ if (statusMessage.getSummary() != null && statusMessage.getSummary().length() > 0)
+ {
+ return new FacesMessage(toFacesSeverity(statusMessage.getSeverity()), statusMessage.getSummary(), statusMessage.getDetail());
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Convert a FacesMessage.Severity to a StatusMessage.Severity
+ */
+ private static StatusMessage.Severity toSeverity(FacesMessage.Severity severity)
+ {
+ if (FacesMessage.SEVERITY_ERROR.equals(severity))
+ {
+ return StatusMessage.Severity.ERROR;
+ }
+ else if (FacesMessage.SEVERITY_FATAL.equals(severity))
+ {
+ return StatusMessage.Severity.FATAL;
+ }
+ else if (FacesMessage.SEVERITY_WARN.equals(severity))
+ {
+ return StatusMessage.Severity.WARN;
+ }
+ else
+ {
+ return StatusMessage.Severity.INFO;
+ }
+ }
+
+ /**
+ * Convert a StatusMessage.Severity to a FacesMessage.Severity
+ */
+ private FacesMessage.Severity toFacesSeverity(StatusMessage.Severity severity)
+ {
+ switch (severity)
+ {
+ case ERROR:
+ return FacesMessage.SEVERITY_ERROR;
+ case FATAL:
+ return FacesMessage.SEVERITY_FATAL;
+ case WARN:
+ return FacesMessage.SEVERITY_WARN;
+ case INFO:
+ default:
+ return FacesMessage.SEVERITY_INFO;
+ }
+ }
+
+ /**
+ * Calculate the JSF client ID from the provided widget ID.
+ * TODO It would be great if this could do suffix maching.
+ */
+ private String getClientId(String targetId, FacesContext facesContext)
+ {
+ if (isAbsoluteClientIdPresent(targetId, facesContext))
+ {
+ return targetId;
+ }
+ else
+ {
+ return getClientId(facesContext.getViewRoot(), targetId, facesContext);
+ }
+ }
+
+ /**
+ * FIXME does not work if element is inside of form with prependId="false"
+ */
+ private boolean isAbsoluteClientIdPresent(String targetId, FacesContext facesContext)
+ {
+ return facesContext.getViewRoot().findComponent(targetId) != null;
+ }
+
+ private String getClientId(UIComponent component, String targetLocalId, FacesContext facesContext)
+ {
+ String currentLocalId = component.getId();
+ if (currentLocalId != null && currentLocalId.equals(targetLocalId))
+ {
+ return component.getClientId(facesContext);
+ }
+ else
+ {
+ Iterator<UIComponent> iter = component.getFacetsAndChildren();
+ while (iter.hasNext())
+ {
+ String clientId = getClientId(iter.next(), targetLocalId, facesContext);
+ if (clientId != null)
+ {
+ return clientId;
+ }
+ }
+ return null;
+ }
+ }
+
+}
Added: modules/trunk/faces/src/main/java/org/jboss/seam/faces/resources/FacesResourceLoader.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/resources/FacesResourceLoader.java (rev 0)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/resources/FacesResourceLoader.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,77 @@
+package org.jboss.seam.faces.resources;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import javax.enterprise.inject.Current;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.beans.RuntimeSelected;
+import org.jboss.seam.beans.RuntimeSelectedBean;
+import org.jboss.seam.resources.DefaultResourceLoader;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ * Extend the {@link DefaultResourceLoader} in the JSF environment to first
+ * attempt to locate the resource in the web root.
+ *
+ * @author Dan Allen
+ */
+public
+@RuntimeSelected
+class FacesResourceLoader extends DefaultResourceLoader implements RuntimeSelectedBean
+{
+ private static final LogProvider log = Logging.getLogProvider(FacesResourceLoader.class);
+
+ @Current FacesContext facesContext;
+ @Current Locale locale;
+
+ public boolean isActive()
+ {
+ // FIXME temporary hack since facesContext is not injecting correctly into this class
+ facesContext = FacesContext.getCurrentInstance();
+ return facesContext != null && facesContext.getCurrentPhaseId() != null && facesContext.getExternalContext() != null;
+ }
+
+ @Override
+ protected ResourceBundle loadBundleInternal(String bundleName)
+ {
+ return ResourceBundle.getBundle(bundleName, locale, Thread.currentThread().getContextClassLoader());
+ }
+
+ @Override
+ protected URL getResourceInternal(String absolutePath, String relativePath)
+ {
+ URL url = null;
+ try
+ {
+ url = facesContext.getExternalContext().getResource(absolutePath);
+ }
+ catch (MalformedURLException e) {}
+
+ if (url != null)
+ {
+ log.debug("Loaded resource from servlet context: " + url);
+ return url;
+ }
+
+ return super.getResourceInternal(absolutePath, relativePath);
+ }
+
+ @Override
+ protected InputStream getResourceAsStreamInternal(String absolutePath, String relativePath)
+ {
+ InputStream stream = facesContext.getExternalContext().getResourceAsStream(absolutePath);
+ if (stream != null)
+ {
+ log.debug("Loaded resource stream from servlet context: " + absolutePath);
+ }
+
+ return super.getResourceAsStreamInternal(absolutePath, relativePath);
+ }
+
+}
Modified: modules/trunk/faces/src/main/resources/META-INF/seam-faces.taglib.xml
===================================================================
--- modules/trunk/faces/src/main/resources/META-INF/seam-faces.taglib.xml 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/faces/src/main/resources/META-INF/seam-faces.taglib.xml 2009-05-28 19:13:06 UTC (rev 11026)
@@ -8,7 +8,7 @@
<tag-name>restrictView</tag-name>
<component>
<component-type>org.jboss.seam.faces.RestrictView</component-type>
- <handler-class>org.jboss.seam.faces.component.DeferredValueExpressionHandler</handler-class>
+ <handler-class>org.jboss.seam.faces.facelets.DeferredValueExpressionHandler</handler-class>
</component>
</tag>
@@ -16,7 +16,7 @@
<tag-name>viewAction</tag-name>
<component>
<component-type>org.jboss.seam.faces.ViewAction</component-type>
- <handler-class>org.jboss.seam.faces.component.ActionSourceHandler</handler-class>
+ <handler-class>org.jboss.seam.faces.facelets.ActionSourceHandler</handler-class>
</component>
</tag>
Deleted: modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesContextProducerTest.java
===================================================================
--- modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesContextProducerTest.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesContextProducerTest.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,50 +0,0 @@
-package org.jboss.seam.faces;
-
-import javax.faces.context.FacesContext;
-import org.jboss.seam.mock.faces.MockFacesContext;
-import static org.testng.Assert.*;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Classes;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
-import org.testng.annotations.Test;
-
-/**
- * Verify that the FacesContextProducer produces the same FacesContext
- * as returned by FacesContext#getCurrentInstance().
- *
- * @author Dan Allen
- */
-@Artifact(addCurrentPackage = false)
-(a)Classes(FacesContextProducer.class)
-public class FacesContextProducerTest extends AbstractWebBeansTest
-{
- @Override
- public void beforeMethod()
- {
- super.beforeMethod();
- installFacesContext();
- }
-
- @Test
- public void testProduceCurrentFacesContext()
- {
- FacesContext actualFacesContext = FacesContext.getCurrentInstance();
- FacesContextProducer standaloneProducer = new FacesContextProducer();
- assertSame(standaloneProducer.getFacesContext(), actualFacesContext);
- assertSame(getFacesContextInstance(), actualFacesContext);
- }
-
- private void installFacesContext()
- {
- new MockFacesContext().setCurrent();
- }
-
- /**
- * Retrieve the FacesContextProducer instance
- */
- private FacesContext getFacesContextInstance()
- {
- return getCurrentManager().getInstanceByType(FacesContext.class);
- }
-}
Deleted: modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesExpressionsTest.java
===================================================================
--- modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesExpressionsTest.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesExpressionsTest.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,62 +0,0 @@
-package org.jboss.seam.faces;
-
-import static org.testng.Assert.assertSame;
-import static org.testng.Assert.assertTrue;
-
-import javax.el.CompositeELResolver;
-import javax.faces.context.FacesContext;
-import javax.faces.event.PhaseId;
-
-import org.jboss.seam.el.Expressions;
-import org.jboss.seam.el.ExpressionsProducer;
-import org.jboss.seam.el.SeamEL;
-import org.jboss.seam.mock.faces.MockFacesContext;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Classes;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
-import org.testng.annotations.Test;
-
-/**
- * First and foremost, ensure that FacesExpressions is configured properly
- * to specialize Expressions and will thus load successfully. Once loaded,
- * verify that Expressions adds the appropriate JSF-specific functionality.
- *
- * @author Dan Allen
- */
-@Artifact(addCurrentPackage = false)
-@Classes(
-{
- FacesExpressions.class, Expressions.class, ExpressionsProducer.class
-})
-public class FacesExpressionsTest extends AbstractWebBeansTest
-{
- @Override
- public void beforeMethod()
- {
- super.beforeMethod();
- installMockFacesContext();
- }
-
- @Test
- public void testUsesELFromFacesContext()
- {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
- Expressions expressions = getExpressionInstance();
- assertSame(expressions.getELContext(), facesContext.getELContext());
- }
-
- private Expressions getExpressionInstance()
- {
- Expressions expressions = getCurrentManager().getInstanceByType(Expressions.class);
- assertTrue(expressions instanceof FacesExpressions);
- return expressions;
- }
-
- private void installMockFacesContext()
- {
- MockFacesContext facesContext = new MockFacesContext();
- facesContext.setELContext(SeamEL.createELContext(new CompositeELResolver()));
- facesContext.setCurrent();
- }
-}
Deleted: modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesMessagesTest.java
===================================================================
--- modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesMessagesTest.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesMessagesTest.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,152 +0,0 @@
-package org.jboss.seam.faces;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertSame;
-
-import java.util.List;
-
-import javax.enterprise.inject.AnnotationLiteral;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.component.UINamingContainer;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.faces.event.PhaseId;
-
-import org.jboss.seam.el.Expressions;
-import org.jboss.seam.el.ExpressionsProducer;
-import org.jboss.seam.international.Interpolator;
-import org.jboss.seam.international.LocaleProducer;
-import org.jboss.seam.international.StatusMessage;
-import org.jboss.seam.international.StatusMessages;
-import org.jboss.seam.mock.faces.MockApplication;
-import org.jboss.seam.mock.faces.MockFacesContext;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Classes;
-import org.jboss.webbeans.context.ConversationContext;
-import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
-import org.jboss.webbeans.test.AbstractWebBeansTest;
-import org.testng.annotations.Test;
-
-/**
- * First and foremost, ensure that FacesMessage is configured properly to wrap
- * the StatusMessages component. Once loaded, verify that FacesMessages adds the
- * appropriate JSF-specific functionality to the conversation-scoped
- * StatusMessages repository.
- *
- * @author Dan Allen
- *
- * @see FacesMessages
- * @see StatusMessages
- */
-@Artifact(addCurrentPackage = false)
-@Classes(
-{
- FacesMessages.class, StatusMessages.class, Interpolator.class, Expressions.class, ExpressionsProducer.class, LocaleProducer.class
-})
-public class FacesMessagesTest extends AbstractWebBeansTest
-{
- @Override
- public void beforeMethod()
- {
- super.beforeMethod();
- activateConversationContext();
- installMockFacesContext();
- }
-
- /**
- * Test that the StatusMessage objects properly tranfer to FacesMessage objects
- * upon the call to FacesMessages#onBeforeRender().
- */
- @Test
- public void testGlobalStatusMessagesGetTransferedToFacesMessages()
- {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION);
- StatusMessages statusMessages = getStatusMessagesInstance();
-
- statusMessages.add("You've booked a night at {0}. Bon chance!", "Mandalay Bay");
-
- assertEquals(statusMessages.getGlobalMessages().size(), 1);
- assertEquals(facesContext.getMessageList().size(), 0);
-
- facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
- statusMessages.onBeforeRender();
-
- assertEquals(statusMessages.getGlobalMessages().size(), 0);
- assertEquals(facesContext.getMessageList().size(), 1);
- assertEquals(facesContext.getMessageList(null).size(), 1);
- FacesMessage facesMessage = facesContext.getMessageList().get(0);
- assertEquals(facesMessage.getSeverity(), FacesMessage.SEVERITY_INFO);
- assertEquals(facesMessage.getSummary(), "You've booked a night at Mandalay Bay. Bon chance!");
- // NOTE this assignment happens inside the FacesMessage implementation
- assertEquals(facesMessage.getSummary(), facesMessage.getDetail());
- }
-
- /**
- * Verify that a message can be added to a control based on either it's absolute client id
- * or it's local id. Verify that if the component cannot be found, a global message is created.
- */
- @Test
- public void testStatusMessagesForControlGetTransferedToFacesMessages()
- {
- FacesContext facesContext = FacesContext.getCurrentInstance();
-
- facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
- UIViewRoot viewRoot = new UIViewRoot();
- UIComponent form = new UINamingContainer();
- form.setId("form");
- UIComponent input = new UIInput();
- input.setId("input");
- form.getChildren().add(input);
- viewRoot.getChildren().add(form);
- facesContext.setViewRoot(viewRoot);
-
- facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION);
- StatusMessages statusMessages = getStatusMessagesInstance();
- statusMessages.addToControl("input", StatusMessage.Severity.WARN, "First validation message for input");
- statusMessages.addToControl("form:input", StatusMessage.Severity.WARN, "Second validation message for input");
- statusMessages.addToControl("NO_SUCH_ID", StatusMessage.Severity.WARN, "Validation message that becomes global");
-
- assertEquals(statusMessages.getKeyedMessages().size(), 3);
- assertEquals(facesContext.getMessageList().size(), 0);
-
- facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
- statusMessages.onBeforeRender();
-
- assertEquals(statusMessages.getGlobalMessages().size(), 0);
- assertEquals(facesContext.getMessageList().size(), 3);
- assertEquals(facesContext.getMessageList(null).size(), 1);
- FacesMessage globalMessage = facesContext.getMessageList(null).get(0);
- assertSame(globalMessage.getSeverity(), FacesMessage.SEVERITY_WARN);
- assertEquals(globalMessage.getSummary(), "Validation message that becomes global");
- List<FacesMessage> messagesForInput = facesContext.getMessageList("form:input");
- assertEquals(messagesForInput.size(), 2);
- assertEquals(messagesForInput.get(0).getSummary(), "First validation message for input");
- assertEquals(messagesForInput.get(1).getSummary(), "Second validation message for input");
- }
-
- // TODO either test TransferStatusMessagesListener here or create a dedicated test for it; to test lookup of StatusMessages from listener
-
- private void installMockFacesContext()
- {
- new MockFacesContext(new MockApplication(), true).setCurrent();
- }
-
- private void activateConversationContext()
- {
- ConversationContext.instance().setBeanStore(new ConcurrentHashMapBeanStore());
- ConversationContext.instance().setActive(true);
- }
-
- /**
- * Retrieve the StatusMessage instance, which is expected to be the type FacesMessages.
- */
- private StatusMessages getStatusMessagesInstance()
- {
- StatusMessages statusMessages = getCurrentManager().getInstanceByType(StatusMessages.class, new AnnotationLiteral<Faces>() {});
- assert statusMessages instanceof FacesMessages;
- return statusMessages;
- }
-}
Copied: modules/trunk/faces/src/test/java/org/jboss/seam/faces/context/FacesContextProducerTest.java (from rev 10994, modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesContextProducerTest.java)
===================================================================
--- modules/trunk/faces/src/test/java/org/jboss/seam/faces/context/FacesContextProducerTest.java (rev 0)
+++ modules/trunk/faces/src/test/java/org/jboss/seam/faces/context/FacesContextProducerTest.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,55 @@
+package org.jboss.seam.faces.context;
+
+import static org.testng.Assert.assertSame;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseId;
+
+import org.jboss.seam.mock.faces.MockFacesContext;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+/**
+ * Verify that the FacesContextProducer produces the same FacesContext
+ * as returned by FacesContext#getCurrentInstance().
+ *
+ * @author Dan Allen
+ */
+@Artifact(addCurrentPackage = false)
+(a)Classes(FacesContextProducer.class)
+public class FacesContextProducerTest extends AbstractWebBeansTest
+{
+ @Override
+ public void beforeMethod()
+ {
+ super.beforeMethod();
+ installFacesContext();
+ }
+
+ @Test
+ public void testProduceCurrentFacesContext()
+ {
+ FacesContext actualFacesContext = FacesContext.getCurrentInstance();
+ FacesContextProducer standaloneProducer = new FacesContextProducer();
+ assertSame(standaloneProducer.getFacesContext(), actualFacesContext);
+
+ FacesContext producedFacesContext = getFacesContextInstance();
+ assertSame(producedFacesContext, actualFacesContext);
+ assertSame(producedFacesContext.getCurrentPhaseId(), PhaseId.RENDER_RESPONSE);
+ }
+
+ private void installFacesContext()
+ {
+ new MockFacesContext().setCurrent().setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
+ }
+
+ /**
+ * Retrieve the FacesContextProducer instance
+ */
+ private FacesContext getFacesContextInstance()
+ {
+ return getCurrentManager().getInstanceByType(FacesContext.class);
+ }
+}
Copied: modules/trunk/faces/src/test/java/org/jboss/seam/faces/el/FacesExpressionsTest.java (from rev 11012, modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesExpressionsTest.java)
===================================================================
--- modules/trunk/faces/src/test/java/org/jboss/seam/faces/el/FacesExpressionsTest.java (rev 0)
+++ modules/trunk/faces/src/test/java/org/jboss/seam/faces/el/FacesExpressionsTest.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,61 @@
+package org.jboss.seam.faces.el;
+
+import static org.testng.Assert.assertSame;
+
+import javax.el.CompositeELResolver;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseId;
+
+import org.jboss.seam.el.Expressions;
+import org.jboss.seam.el.ExpressionsProducer;
+import org.jboss.seam.el.SeamEL;
+import org.jboss.seam.faces.context.FacesContextProducer;
+import org.jboss.seam.mock.faces.MockFacesContext;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+/**
+ * First and foremost, ensure that FacesExpressions is configured properly
+ * to specialize Expressions and will thus load successfully. Once loaded,
+ * verify that Expressions adds the appropriate JSF-specific functionality.
+ *
+ * @author Dan Allen
+ */
+@Artifact(addCurrentPackage = false)
+@Classes(
+{
+ FacesExpressions.class, Expressions.class, ExpressionsProducer.class, FacesContextProducer.class
+})
+public class FacesExpressionsTest extends AbstractWebBeansTest
+{
+ @Override
+ public void beforeMethod()
+ {
+ super.beforeMethod();
+ installMockFacesContext();
+ }
+
+ @Test
+ public void testUsesELFromFacesContext()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
+ Expressions expressions = getExpressionInstance();
+ assertSame(expressions.getELContext(), facesContext.getELContext());
+ }
+
+ private Expressions getExpressionInstance()
+ {
+ // we can't check that we have a FacesExpressions because it is hidden behind a proxy object
+ return getCurrentManager().getInstanceByType(Expressions.class);
+ }
+
+ private void installMockFacesContext()
+ {
+ MockFacesContext facesContext = new MockFacesContext();
+ facesContext.setELContext(SeamEL.createELContext(new CompositeELResolver()));
+ facesContext.setCurrent();
+ }
+}
Added: modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/FacesLocaleProducerTest.java
===================================================================
--- modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/FacesLocaleProducerTest.java (rev 0)
+++ modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/FacesLocaleProducerTest.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,53 @@
+package org.jboss.seam.faces.international;
+
+import static org.testng.Assert.assertSame;
+
+import java.util.Locale;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.event.PhaseId;
+
+import org.jboss.seam.el.SeamEL;
+import org.jboss.seam.faces.context.FacesContextProducer;
+import org.jboss.seam.international.LocaleProducer;
+import org.jboss.seam.international.LocaleResolver;
+import org.jboss.seam.international.LocaleResolverProducer;
+import org.jboss.seam.mock.faces.MockFacesContext;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+@Artifact(addCurrentPackage = false)
+(a)Classes({LocaleProducer.class, LocaleResolver.class, LocaleResolverProducer.class, FacesLocaleResolver.class, FacesContextProducer.class})
+public class FacesLocaleProducerTest extends AbstractWebBeansTest
+{
+ @Override
+ public void beforeMethod()
+ {
+ installMockFacesContext();
+ }
+
+ @Test
+ public void testGetLocaleFromViewRoot()
+ {
+ assertSame(getLocaleInstance(), Locale.FRANCE);
+ }
+
+ public Locale getLocaleInstance()
+ {
+ return getCurrentManager().getInstanceByType(Locale.class);
+ }
+
+ private void installMockFacesContext()
+ {
+ MockFacesContext facesContext = new MockFacesContext();
+ facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
+ facesContext.setCurrent();
+ // must have ELContext set to set the locale on the UIViewRoot
+ facesContext.setELContext(SeamEL.createELContext());
+ UIViewRoot viewRoot = new UIViewRoot();
+ viewRoot.setLocale(Locale.FRANCE);
+ facesContext.setViewRoot(viewRoot);
+ }
+}
Copied: modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/FacesMessagesTest.java (from rev 11012, modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesMessagesTest.java)
===================================================================
--- modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/FacesMessagesTest.java (rev 0)
+++ modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/FacesMessagesTest.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,156 @@
+package org.jboss.seam.faces.international;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertSame;
+
+import java.util.List;
+
+import javax.enterprise.inject.AnnotationLiteral;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.component.UINamingContainer;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseId;
+
+import org.jboss.seam.el.Expressions;
+import org.jboss.seam.el.ExpressionsProducer;
+import org.jboss.seam.faces.Faces;
+import org.jboss.seam.international.Interpolator;
+import org.jboss.seam.international.LocaleProducer;
+import org.jboss.seam.international.LocaleResolver;
+import org.jboss.seam.international.LocaleResolverProducer;
+import org.jboss.seam.international.StatusMessage;
+import org.jboss.seam.international.StatusMessages;
+import org.jboss.seam.mock.faces.MockApplication;
+import org.jboss.seam.mock.faces.MockFacesContext;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.webbeans.context.ConversationContext;
+import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+/**
+ * First and foremost, ensure that FacesMessage is configured properly to wrap
+ * the StatusMessages component. Once loaded, verify that FacesMessages adds the
+ * appropriate JSF-specific functionality to the conversation-scoped
+ * StatusMessages repository.
+ *
+ * @author Dan Allen
+ *
+ * @see FacesMessages
+ * @see StatusMessages
+ */
+@Artifact(addCurrentPackage = false)
+@Classes(
+{
+ FacesMessages.class, StatusMessages.class, Interpolator.class, Expressions.class, ExpressionsProducer.class,
+ LocaleProducer.class, LocaleResolver.class, LocaleResolverProducer.class
+})
+public class FacesMessagesTest extends AbstractWebBeansTest
+{
+ @Override
+ public void beforeMethod()
+ {
+ super.beforeMethod();
+ activateConversationContext();
+ installMockFacesContext();
+ }
+
+ /**
+ * Test that the StatusMessage objects properly tranfer to FacesMessage objects
+ * upon the call to FacesMessages#onBeforeRender().
+ */
+ @Test
+ public void testGlobalStatusMessagesGetTransferedToFacesMessages()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION);
+ StatusMessages statusMessages = getStatusMessagesInstance();
+
+ statusMessages.add("You've booked a night at {0}. Bon chance!", "Mandalay Bay");
+
+ assertEquals(statusMessages.getGlobalMessages().size(), 1);
+ assertEquals(facesContext.getMessageList().size(), 0);
+
+ facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
+ statusMessages.onBeforeRender();
+
+ assertEquals(statusMessages.getGlobalMessages().size(), 0);
+ assertEquals(facesContext.getMessageList().size(), 1);
+ assertEquals(facesContext.getMessageList(null).size(), 1);
+ FacesMessage facesMessage = facesContext.getMessageList().get(0);
+ assertEquals(facesMessage.getSeverity(), FacesMessage.SEVERITY_INFO);
+ assertEquals(facesMessage.getSummary(), "You've booked a night at Mandalay Bay. Bon chance!");
+ // NOTE this assignment happens inside the FacesMessage implementation
+ assertEquals(facesMessage.getSummary(), facesMessage.getDetail());
+ }
+
+ /**
+ * Verify that a message can be added to a control based on either it's absolute client id
+ * or it's local id. Verify that if the component cannot be found, a global message is created.
+ */
+ @Test
+ public void testStatusMessagesForControlGetTransferedToFacesMessages()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
+ UIViewRoot viewRoot = new UIViewRoot();
+ UIComponent form = new UINamingContainer();
+ form.setId("form");
+ UIComponent input = new UIInput();
+ input.setId("input");
+ form.getChildren().add(input);
+ viewRoot.getChildren().add(form);
+ facesContext.setViewRoot(viewRoot);
+
+ facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION);
+ StatusMessages statusMessages = getStatusMessagesInstance();
+ statusMessages.addToControl("input", StatusMessage.Severity.WARN, "First validation message for input");
+ statusMessages.addToControl("form:input", StatusMessage.Severity.WARN, "Second validation message for input");
+ statusMessages.addToControl("NO_SUCH_ID", StatusMessage.Severity.WARN, "Validation message that becomes global");
+
+ assertEquals(statusMessages.getKeyedMessages().size(), 3);
+ assertEquals(facesContext.getMessageList().size(), 0);
+
+ facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
+ statusMessages.onBeforeRender();
+
+ assertEquals(statusMessages.getGlobalMessages().size(), 0);
+ assertEquals(facesContext.getMessageList().size(), 3);
+ assertEquals(facesContext.getMessageList(null).size(), 1);
+ FacesMessage globalMessage = facesContext.getMessageList(null).get(0);
+ assertSame(globalMessage.getSeverity(), FacesMessage.SEVERITY_WARN);
+ assertEquals(globalMessage.getSummary(), "Validation message that becomes global");
+ List<FacesMessage> messagesForInput = facesContext.getMessageList("form:input");
+ assertEquals(messagesForInput.size(), 2);
+ assertEquals(messagesForInput.get(0).getSummary(), "First validation message for input");
+ assertEquals(messagesForInput.get(1).getSummary(), "Second validation message for input");
+ }
+
+ // TODO either test TransferStatusMessagesListener here or create a dedicated test for it; to test lookup of StatusMessages from listener
+
+ private void installMockFacesContext()
+ {
+ new MockFacesContext(new MockApplication(), true).setCurrent();
+ }
+
+ private void activateConversationContext()
+ {
+ ConversationContext.instance().setBeanStore(new ConcurrentHashMapBeanStore());
+ ConversationContext.instance().setActive(true);
+ }
+
+ /**
+ * Retrieve the StatusMessage instance, which is expected to be the type FacesMessages.
+ */
+ private StatusMessages getStatusMessagesInstance()
+ {
+ StatusMessages statusMessages = getCurrentManager().getInstanceByType(StatusMessages.class, new AnnotationLiteral<Faces>() {});
+ assert statusMessages instanceof FacesMessages;
+ return statusMessages;
+ }
+}
Modified: modules/trunk/faces/src/test/resources/test-suite.xml
===================================================================
--- modules/trunk/faces/src/test/resources/test-suite.xml 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/faces/src/test/resources/test-suite.xml 2009-05-28 19:13:06 UTC (rev 11026)
@@ -9,7 +9,7 @@
</method-selectors>
-->
<packages>
- <package name="org.jboss.seam.faces"/>
+ <package name="org.jboss.seam.faces.*"/>
</packages>
</test>
</suite>
Modified: modules/trunk/international/pom.xml
===================================================================
--- modules/trunk/international/pom.xml 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/international/pom.xml 2009-05-28 19:13:06 UTC (rev 11026)
@@ -34,10 +34,20 @@
<dependency>
<groupId>${seam.groupId}</groupId>
+ <artifactId>seam-bridge-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${seam.groupId}</groupId>
<artifactId>seam-el</artifactId>
</dependency>
<dependency>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-resources</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>${webbeans.groupId}</groupId>
<artifactId>jsr299-api</artifactId>
<scope>provided</scope>
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/AutoInterpolatedMessages.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/AutoInterpolatedMessages.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/AutoInterpolatedMessages.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,28 @@
+package org.jboss.seam.international;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+/**
+ * Binding type for messages
+ *
+ * @author Shane Bryzak
+ */
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@Inherited
+public @interface AutoInterpolatedMessages
+{
+}
Copied: modules/trunk/international/src/main/java/org/jboss/seam/international/AutoInterpolatedMessagesProducer.java (from rev 10996, modules/trunk/international/src/main/java/org/jboss/seam/international/MessagesProducer.java)
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/AutoInterpolatedMessagesProducer.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/AutoInterpolatedMessagesProducer.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,19 @@
+package org.jboss.seam.international;
+
+import java.util.ResourceBundle;
+
+import javax.enterprise.inject.Named;
+import javax.enterprise.inject.Produces;
+
+public class AutoInterpolatedMessagesProducer
+{
+ public
+ @Produces
+ @Named("org.jboss.seam.international.messages")
+ //@RequestScoped
+ @AutoInterpolatedMessages
+ ResourceBundle getMessages(@Messages ResourceBundle messages, Interpolator interpolator)
+ {
+ return new InterpolatingResourceBundle(messages, interpolator);
+ }
+}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/InterpolatingResourceBundle.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/InterpolatingResourceBundle.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/InterpolatingResourceBundle.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,58 @@
+package org.jboss.seam.international;
+
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class InterpolatingResourceBundle extends ResourceBundle
+{
+ private ResourceBundle delegate;
+ private Interpolator interpolator;
+
+ public InterpolatingResourceBundle(ResourceBundle delegate, Interpolator interpolator)
+ {
+ this.delegate = delegate;
+ this.interpolator = interpolator;
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ return delegate.getLocale();
+ }
+
+ @Override
+ public Enumeration<String> getKeys()
+ {
+ return delegate.getKeys();
+ }
+
+ @Override
+ protected Object handleGetObject(String key)
+ {
+ try
+ {
+ return interpolate(delegate.getObject(key));
+ }
+ catch (MissingResourceException mre)
+ {
+ // superclass will throw MissingResourceException if null is returned
+ }
+
+ return null;
+ }
+
+ protected Object interpolate(Object message)
+ {
+ if (message != null && message instanceof String)
+ {
+ return interpolator.interpolate((String) message);
+ }
+ else
+ {
+ return message;
+ }
+ }
+
+}
Modified: modules/trunk/international/src/main/java/org/jboss/seam/international/Interpolator.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/Interpolator.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/Interpolator.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -5,7 +5,7 @@
import java.util.Locale;
import java.util.StringTokenizer;
-import javax.enterprise.inject.Current;
+import javax.enterprise.inject.Initializer;
import org.jboss.seam.el.Expressions;
import org.jboss.webbeans.log.LogProvider;
@@ -19,9 +19,19 @@
public class Interpolator implements Serializable
{
private static final LogProvider log = Logging.getLogProvider(Interpolator.class);
+
+ private Expressions expressions;
+ private Locale locale;
- @Current Expressions expressions;
- @Current Locale locale;
+ public Interpolator() {}
+
+ public
+ @Initializer
+ Interpolator(Expressions expressions, Locale locale)
+ {
+ this.expressions = expressions;
+ this.locale = locale;
+ }
/**
* Replace all EL expressions in the form #{...} with their evaluated
Modified: modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleProducer.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleProducer.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleProducer.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,5 +1,7 @@
package org.jboss.seam.international;
+import java.util.Locale;
+
import javax.enterprise.inject.Named;
import javax.enterprise.inject.Produces;
@@ -15,8 +17,8 @@
public
@Produces
@Named("org.jboss.seam.international.locale")
- java.util.Locale getLocale()
+ Locale getLocale(LocaleResolver localeResolver)
{
- return java.util.Locale.getDefault();
+ return localeResolver.getLocale();
}
}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleResolver.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleResolver.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleResolver.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,15 @@
+package org.jboss.seam.international;
+
+import java.util.Locale;
+
+import org.jboss.seam.beans.Default;
+
+public
+@Default
+class LocaleResolver
+{
+ public Locale getLocale()
+ {
+ return Locale.getDefault();
+ }
+}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleResolverProducer.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleResolverProducer.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleResolverProducer.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,32 @@
+package org.jboss.seam.international;
+
+import javax.enterprise.inject.Initializer;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.seam.beans.RuntimeBeanSelector;
+
+public class LocaleResolverProducer extends RuntimeBeanSelector<LocaleResolver>
+{
+ LocaleResolverProducer() {}
+
+ public @Initializer LocaleResolverProducer(BeanManager manager)
+ {
+ super(manager);
+ }
+
+ @Override
+ public Class<LocaleResolver> getType()
+ {
+ return LocaleResolver.class;
+ }
+
+ @Override
+ public
+ @Produces
+ LocaleResolver selectImplementation()
+ {
+ return super.selectImplementation();
+ }
+
+}
Modified: modules/trunk/international/src/main/java/org/jboss/seam/international/MessagesProducer.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/MessagesProducer.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/MessagesProducer.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,117 +1,21 @@
package org.jboss.seam.international;
-import java.util.AbstractMap;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.Set;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Named;
import javax.enterprise.inject.Produces;
-/**
- * Factory for a Map that contains interpolated messages defined in the
- * Seam ResourceBundle.
- *
- * @see SeamResourceBundle
- *
- * @author Gavin King
- */
+import org.jboss.seam.resources.ResourceLoader;
+
public class MessagesProducer
{
- //TODO: now we have ELResolver, it doesn't *have* to be a Map...
+ private String bundleName = "messages";
- //@Current
- ResourceBundle bundle;
-
- protected Map createMap()
- {
- // AbstractMap uses the implementation of entrySet to perform all its
- // operations - for a resource bundle this is very inefficient for keys
- return new AbstractMap<String, String>()
- {
- // FIXME disable temporarily
- //private java.util.ResourceBundle bundle = ResourceBundleProducer.getBundle();
- private java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("messages");
-
- @Override
- public String get(Object key)
- {
- if (key instanceof String)
- {
- String resourceKey = (String) key;
- String resource=null;
- if (bundle!=null)
- {
- try
- {
- resource = bundle.getString(resourceKey);
- }
- catch (MissingResourceException mre)
- {
- //Just swallow
- }
- }
- return resource==null ? resourceKey : resource;
- }
- else
- {
- return null;
- }
- }
-
- @Override
- public Set<Map.Entry<String, String>> entrySet()
- {
- Enumeration<String> keys = bundle.getKeys();
- Map<String, String> map = new HashMap<String, String>();
- while ( keys.hasMoreElements() )
- {
- String key = keys.nextElement();
- map.put( key, get(key) );
- }
- return Collections.unmodifiableSet(map.entrySet());
- }
-
- @Override
- public boolean containsKey(Object key)
- {
- return get(key) != null;
- }
-
- @Override
- public Set<String> keySet()
- {
- Enumeration<String> keys = bundle.getKeys();
- return new HashSet<String>(Collections.list(keys));
- }
-
- @Override
- public int size()
- {
- return keySet().size();
- }
-
- };
- }
-
- /**
- * Create the Map and cache it in the request scope. No need to cache
- * it in the session scope, since it is inexpensive to create.
- *
- * @return a Map that interpolates messages in the Seam ResourceBundle
- */
+ public
@Produces
- @Named("org.jboss.seam.international.messages")
- @RequestScoped
- @Messages public Map<String, String> getMessages()
+ //@RequestScoped
+ @Messages
+ ResourceBundle getResourceBundle(ResourceLoader resourceLoader)
{
- return createMap();
+ return resourceLoader.loadBundle(bundleName);
}
-
}
Deleted: modules/trunk/international/src/main/java/org/jboss/seam/international/ResourceBundle.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/ResourceBundle.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/ResourceBundle.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,28 +0,0 @@
-package org.jboss.seam.international;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.enterprise.inject.BindingType;
-
-/**
- * The binding type for the Seam resource bundle.
- *
- * @author Dan Allen
- */
-public
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@BindingType
-@Inherited
-@interface ResourceBundle {
-}
Deleted: modules/trunk/international/src/main/java/org/jboss/seam/international/ResourceLoader.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/ResourceLoader.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/ResourceLoader.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,186 +0,0 @@
-package org.jboss.seam.international;
-
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Locale;
-import java.util.MissingResourceException;
-
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-
-/**
- * Access to application resources and resource bundles.
- *
- * @author Gavin King
- */
-public class ResourceLoader
-{
- private static final LogProvider log = Logging.getLogProvider(ResourceLoader.class);
-
- private String[] bundleNames = { "messages" };
-
- //@Current
- BeanManager manager;
-
- /**
- * The configurable list of delegate resource bundle names
- *
- * @return an array of resource bundle names
- */
- public String[] getBundleNames()
- {
- return bundleNames;
- }
-
- public void setBundleNames(String[] bundleNames)
- {
- this.bundleNames = bundleNames;
- }
-
- public InputStream getResourceAsStream(String resource)
- {
- String relativePath = resource;
- if (resource.startsWith("/"))
- {
- relativePath = resource.substring(1);
- }
- else
- {
- resource = "/" + resource;
- }
-
- return getResourceAsStream(resource, relativePath);
- }
-
- public URL getResource(String resource)
- {
- String relativePath = resource;
- if (resource.startsWith("/"))
- {
- relativePath = resource.substring(1);
- }
- else
- {
- resource = "/" + resource;
- }
-
- return getResource(resource, relativePath);
- }
-
- /**
- * Load a resource bundle by name (may be overridden by subclasses
- * who want to use non-standard resource bundle types).
- *
- * @param bundleName the name of the resource bundle
- * @return an instance of java.util.ResourceBundle
- */
- public java.util.ResourceBundle loadBundle(String bundleName)
- {
- try
- {
- java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle(
- bundleName,
- manager.getInstanceByType(Locale.class),
- Thread.currentThread().getContextClassLoader()
- );
- log.debug("loaded resource bundle: " + bundleName);
- return bundle;
- }
- catch (MissingResourceException mre)
- {
- log.debug("resource bundle missing: " + bundleName);
- return null;
- }
- }
-
- @Override
- public String toString()
- {
- StringBuilder report = new StringBuilder("bundleNames = {");
- boolean first = true;
- if (bundleNames != null)
- {
- for (Object bundleName : bundleNames)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- report.append(", ");
- }
- report.append(bundleName);
- }
- }
- report.append("}");
-
- return "ResourceBundle(" + report + ")";
- }
-
- protected InputStream getResourceAsStream(String path, String relativePath)
- {
- InputStream stream = null;
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- if (classLoader != null)
- {
- stream = classLoader.getResourceAsStream(relativePath);
- if (stream != null)
- {
- log.debug("Loaded resource from context classloader: " + relativePath);
- return stream;
- }
- }
-
- stream = getClass().getResourceAsStream(path);
- if (stream != null)
- {
- log.debug("Loaded resource from Seam classloader: " + path);
- return stream;
- }
-
- stream = getClass().getClassLoader().getResourceAsStream(relativePath);
- if (stream != null)
- {
- log.debug("Loaded resource from Seam classloader: " + relativePath);
- return stream;
- }
-
- return stream;
- }
-
- protected URL getResource(String path, String relativePath)
- {
- URL url = null;
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- if (classLoader != null)
- {
- url = classLoader.getResource(relativePath);
- if (url != null)
- {
- log.debug("Loaded resource from context classloader: " + url);
- return url;
- }
- }
-
- url = getClass().getResource(path);
- if (url != null)
- {
- log.debug("Loaded resource from Seam classloader: " + url);
- return url;
- }
-
- url = getClass().getClassLoader().getResource(relativePath);
- if (url != null)
- {
- log.debug("Loaded resource from Seam classloader: " + url);
- return url;
- }
-
- return url;
- }
-
-}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/SeamResourceBundleAdapter.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/SeamResourceBundleAdapter.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/SeamResourceBundleAdapter.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,44 @@
+package org.jboss.seam.international;
+
+import java.util.Enumeration;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.enterprise.inject.AnnotationLiteral;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.seam.bridge.ManagerBridge;
+
+public class SeamResourceBundleAdapter extends ResourceBundle
+{
+ @Override
+ public Enumeration<String> getKeys()
+ {
+ return getMessages().getKeys();
+ }
+
+ @Override
+ protected Object handleGetObject(String key)
+ {
+ try
+ {
+ return getMessages().getObject(key);
+ }
+ catch (MissingResourceException mre)
+ {
+ // superclass will throw MissingResourceException if null is returned
+ }
+
+ return null;
+ }
+
+ protected ResourceBundle getMessages()
+ {
+ return getCurrentManager().getInstanceByType(ResourceBundle.class, new AnnotationLiteral<AutoInterpolatedMessages>(){});
+ }
+
+ protected BeanManager getCurrentManager()
+ {
+ return ManagerBridge.getProvider().getCurrentManager();
+ }
+}
Modified: modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessage.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessage.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessage.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,4 +1,4 @@
-/*
+/*
* JBoss, Home of Professional Open Source
* Copyright 2009, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
@@ -39,7 +39,6 @@
{
/**
* The severity of the status message
- *
*/
public enum Severity
{
@@ -48,6 +47,7 @@
ERROR,
FATAL;
}
+
private String summaryTemplate;
private String summary;
private String detailTemplate;
@@ -55,20 +55,31 @@
private Severity severity = Severity.INFO;
/**
- * Create a status message, looking up the message in the resource bundle
- * using the provided key. If the message is found, it is used, otherwise,
- * the defaultMessageTemplate will be used.
- *
+ * Create a status message using the provided summary and detail templates.
+ * The severity is only assigned if a summary is provided. Note that te
+ * StatusMessages component is responsible for resolving templates from the
+ * message bundle.
*/
- public StatusMessage(Severity severity, String key, String detailKey, String defaultMessageTemplate, String defaultMessageDetailTemplate)
+ public StatusMessage(Severity severity, String summaryTemplate, String detailTemplate)
{
- this.summaryTemplate = getBundleMessage(key, defaultMessageTemplate);
- this.detailTemplate = getBundleMessage(detailKey, defaultMessageDetailTemplate);
+ this.summaryTemplate = summaryTemplate;
+ this.detailTemplate = detailTemplate;
if (!Strings.isEmpty(summaryTemplate))
{
this.severity = severity;
}
}
+
+ /**
+ * Create a status message using the summary template and a null detail
+ * template. The severity is only assigned if a summary is provided. Note
+ * that te StatusMessages component is responsible for resolving templates
+ * from the message bundle.
+ */
+ public StatusMessage(Severity severity, String template)
+ {
+ this(severity, template, null);
+ }
public boolean isEmpty()
{
Modified: modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -31,13 +31,20 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.inject.AnnotationLiteral;
+import javax.enterprise.inject.Current;
import javax.enterprise.inject.Initializer;
import javax.enterprise.inject.Named;
+import javax.enterprise.inject.spi.BeanManager;
import javax.validation.ConstraintViolation;
import org.jboss.seam.international.StatusMessage.Severity;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
/**
* <p>{@link StatusMessages} is a technology agnostic repository for holding
@@ -68,6 +75,8 @@
{
private static final long serialVersionUID = -5396789975397138270L;
+ private static final LogProvider log = Logging.getLogProvider(StatusMessages.class);
+
private List<StatusMessage> messages = new ArrayList<StatusMessage>();
private Map<String, List<StatusMessage>> keyedMessages = new HashMap<String, List<StatusMessage>>();
@@ -75,12 +84,17 @@
private transient List<Runnable> tasks;
private Interpolator interpolator;
+
+ // FIXME the scoping may not be right unless resourceBundle updates internal (for instance per request)
+ //private ResourceBundle resourceBundle;
+ @Current BeanManager manager;
public StatusMessages() {}
- public @Initializer StatusMessages(Interpolator interpolator)
+ public @Initializer StatusMessages(Interpolator interpolator) //, @Messages ResourceBundle resourceBundle)
{
this.interpolator = interpolator;
+ //this.resourceBundle = resourceBundle;
}
/**
@@ -158,9 +172,9 @@
*
* You can also specify the severity, and parameters to be interpolated
*/
- public void add(Severity severity, String key, String detailKey, String messageTemplate, String messageDetailTemplate, final Object... params)
+ public void add(Severity severity, String summaryKey, String detailKey, String messageSummaryTemplate, String messageDetailTemplate, final Object... params)
{
- final StatusMessage message = new StatusMessage(severity, key, detailKey, messageTemplate, messageDetailTemplate);
+ final StatusMessage message = new StatusMessage(severity, getBundleMessage(summaryKey, messageSummaryTemplate), getBundleMessage(detailKey, messageDetailTemplate));
if (!message.isEmpty())
{
messages.add(message);
@@ -178,11 +192,10 @@
* layer implementation in use.
*
* You can also specify the severity, and parameters to be interpolated
- *
*/
public void addToControl(String id, Severity severity, String key, String messageTemplate, final Object... params)
{
- final StatusMessage message = new StatusMessage(severity, key, null, messageTemplate, null);
+ final StatusMessage message = new StatusMessage(severity, getBundleMessage(key, messageTemplate));
if (!message.isEmpty())
{
if (keyedMessages.containsKey(id))
@@ -214,7 +227,6 @@
* Create a new status message, with the messageTemplate is as the message.
*
* You can also specify the severity, and parameters to be interpolated
- *
*/
public void add(Severity severity, String messageTemplate, Object... params)
{
@@ -230,7 +242,6 @@
*
* A severity of WARN will be used, and you can specify parameters to be
* interpolated
- *
*/
public void addToControl(String id, String messageTemplate, Object... params)
{
@@ -270,7 +281,6 @@
* using the provided key.
*
* You can also specify the severity, and parameters to be interpolated
- *
*/
public void addFromResourceBundle(Severity severity, String key, Object... params)
{
@@ -284,7 +294,6 @@
*
* A severity of INFO will be used, and you can specify parameters to be
* interpolated
- *
*/
public void addFromResourceBundleOrDefault(String key, String defaultMessageTemplate, Object... params)
{
@@ -297,7 +306,6 @@
* the defaultMessageTemplate will be used.
*
* You can also specify the severity, and parameters to be interpolated
- *
*/
public void addFromResourceBundleOrDefault(Severity severity, String key, String defaultMessageTemplate, Object... params)
{
@@ -314,7 +322,6 @@
*
* A severity of WARN will be used, and you can specify parameters to be
* interpolated
- *
*/
public void addToControlFromResourceBundle(String id, String key, Object... params)
{
@@ -330,7 +337,6 @@
* layer implementation in use.
*
* You can also specify the severity, and parameters to be interpolated
- *
*/
public void addToControlFromResourceBundle(String id, Severity severity, String key, Object... params)
{
@@ -348,7 +354,6 @@
*
* A severity of WARN will be used, and you can specify parameters to be
* interpolated
- *
*/
public void addToControlFromResourceBundleOrDefault(String id, String key, String defaultMessageTemplate, Object... params)
{
@@ -365,7 +370,6 @@
* layer implementation in use.
*
* You can also specify the severity, and parameters to be interpolated
- *
*/
public void addToControlFromResourceBundleOrDefault(String id, Severity severity, String key, String defaultMessageTemplate, Object... params)
{
@@ -440,6 +444,37 @@
doRunTasks();
}
+ protected String getBundleMessage(String key)
+ {
+ return getBundleMessage(key, key);
+ }
+
+ protected String getBundleMessage(String key, String defaultMessageTemplate)
+ {
+ String messageTemplate = defaultMessageTemplate;
+ if (key != null)
+ {
+ // FIXME this is a hack because I can't inject it since ResourceBundle is not proxyable
+ if (manager.getBeans(ResourceBundle.class, new AnnotationLiteral<Messages>() {}).size() == 1)
+ {
+ ResourceBundle resourceBundle = manager.getInstanceByType(ResourceBundle.class, new AnnotationLiteral<Messages>() {});
+ try
+ {
+ String bundleMessage = resourceBundle.getString(key);
+ if (bundleMessage != null)
+ {
+ messageTemplate = bundleMessage;
+ }
+ }
+ catch (MissingResourceException mre)
+ {
+ log.trace("Message key " + key + " was not defined in the Seam resource bundle. Using default message template");
+ }
+ }
+ }
+ return messageTemplate;
+ }
+
private List<Runnable> getTasks()
{
if (tasks == null)
Deleted: modules/trunk/international/src/main/java/org/jboss/seam/international/util/Resources.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/util/Resources.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/util/Resources.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,177 +0,0 @@
-package org.jboss.seam.international.util;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.servlet.ServletContext;
-
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-
-public class Resources
-{
- private static final LogProvider log = Logging.getLogProvider(Resources.class);
-
- public static InputStream getResourceAsStream(String resource, ServletContext servletContext)
- {
- String stripped = resource.startsWith("/") ?
- resource.substring(1) : resource;
-
- InputStream stream = null;
-
- if (servletContext!=null) {
- try {
- stream = servletContext.getResourceAsStream(resource);
- if (stream!=null) {
- log.debug("Loaded resource from servlet context: " + resource);
- }
- } catch (Exception e) {
- //
- }
- }
-
- if (stream==null) {
- stream = getResourceAsStream(resource, stripped);
- }
-
- return stream;
- }
-
- public static URL getResource(String resource, ServletContext servletContext)
- {
- if (!resource.startsWith("/"))
- {
- resource = "/" + resource;
- }
-
- String stripped = resource.startsWith("/") ?
- resource.substring(1) : resource;
-
- URL url = null;
-
- if (servletContext!=null)
- {
- try {
- url = servletContext.getResource(resource);
- log.debug("Loaded resource from servlet context: " + url);
- } catch (Exception e) {
- //
- }
- }
-
- if (url==null)
- {
- url = getResource(resource, stripped);
- }
-
- return url;
- }
-
- static InputStream getResourceAsStream(String resource, String stripped)
- {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- InputStream stream = null;
- if (classLoader!=null) {
- stream = classLoader.getResourceAsStream(stripped);
- if (stream !=null) {
- log.debug("Loaded resource from context classloader: " + stripped);
- }
- }
-
- if (stream == null) {
- stream = Resources.class.getResourceAsStream(resource);
- if (stream !=null) {
- log.debug("Loaded resource from Seam classloader: " + resource);
- }
- }
-
- if (stream == null) {
- stream = Resources.class.getClassLoader().getResourceAsStream(stripped);
- if (stream!=null) {
- log.debug("Loaded resource from Seam classloader: " + stripped);
- }
- }
-
- return stream;
- }
-
- static URL getResource(String resource, String stripped)
- {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- URL url = null;
- if (classLoader!=null) {
- url = classLoader.getResource(stripped);
- if (url!=null) {
- log.debug("Loaded resource from context classloader: " + url);
- }
- }
-
- if (url == null) {
- url = Resources.class.getResource(resource);
- if (url!=null) {
- log.debug("Loaded resource from Seam classloader: " + url);
- }
- }
-
- if (url == null) {
- url = Resources.class.getClassLoader().getResource(stripped);
- if (url!=null) {
- log.debug("Loaded resource from Seam classloader: " + url);
- }
- }
-
- return url;
- }
-
- public static void closeStream(InputStream inputStream) {
- if (inputStream == null) {
- return;
- }
-
- try {
- inputStream.close();
- } catch (IOException e) {
- //
- }
- }
-
- public static File getRealFile(ServletContext servletContext, String path)
- {
- String realPath = servletContext.getRealPath(path);
- if (realPath==null) //WebLogic!
- {
- try
- {
- URL resourcePath = servletContext.getResource(path);
- if ((resourcePath != null) && (resourcePath.getProtocol().equals("file")))
- {
- realPath = resourcePath.getPath();
- }
- else
- {
- log.warn("Unable to determine real path from servlet context for \"" + path + "\" path does not exist.");
- }
- }
- catch (MalformedURLException e)
- {
- log.warn("Unable to determine real path from servlet context for : " + path);
- log.debug("Caused by MalformedURLException", e);
- }
-
- }
-
- if (realPath != null)
- {
- File file = new File(realPath);
- if (file.exists())
- {
- return file;
- }
- }
- return null;
- }
-
-}
\ No newline at end of file
Added: modules/trunk/international/src/test/java/org/jboss/seam/international/AutoInterpolatedMessagesTest.java
===================================================================
--- modules/trunk/international/src/test/java/org/jboss/seam/international/AutoInterpolatedMessagesTest.java (rev 0)
+++ modules/trunk/international/src/test/java/org/jboss/seam/international/AutoInterpolatedMessagesTest.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,56 @@
+package org.jboss.seam.international;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.ResourceBundle;
+
+import javax.el.CompositeELResolver;
+import javax.enterprise.inject.AnnotationLiteral;
+
+import org.jboss.seam.el.Expressions;
+import org.jboss.seam.el.ExpressionsProducer;
+import org.jboss.seam.resources.DefaultResourceLoader;
+import org.jboss.seam.resources.ResourceLoaderProducer;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.webbeans.el.WebBeansELResolver;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+@Artifact
+(a)Classes({DefaultResourceLoader.class, ResourceLoaderProducer.class, Expressions.class, ExpressionsProducer.class})
+public class AutoInterpolatedMessagesTest extends AbstractWebBeansTest
+{
+ private boolean elResolverInitialized = false;
+
+ @Override
+ public void beforeMethod()
+ {
+ super.beforeMethod();
+ if (!elResolverInitialized)
+ {
+ installWebBeansELResolver();
+ }
+ }
+
+ @Test
+ public void testLoadMessages()
+ {
+ ResourceBundle messages = getMessages();
+ assertEquals(messages.getString("title"), "Hello Seam!");
+ assertEquals(messages.getString("thing"), "It's called music");
+ }
+
+ private void installWebBeansELResolver()
+ {
+ Expressions expressions = getCurrentManager().getInstanceByType(Expressions.class);
+ // FIXME wow this is a hack
+ ((CompositeELResolver) expressions.getELContext().getELResolver()).add(new WebBeansELResolver());
+ elResolverInitialized = true;
+ }
+
+ private ResourceBundle getMessages()
+ {
+ return getCurrentManager().getInstanceByType(ResourceBundle.class, new AnnotationLiteral<AutoInterpolatedMessages>() {});
+ }
+}
Modified: modules/trunk/international/src/test/java/org/jboss/seam/international/InterpolatorTest.java
===================================================================
--- modules/trunk/international/src/test/java/org/jboss/seam/international/InterpolatorTest.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/international/src/test/java/org/jboss/seam/international/InterpolatorTest.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -29,14 +29,19 @@
* @see LocaleProducer
*/
@Artifact(addCurrentPackage = false)
-(a)Classes({Interpolator.class, Expressions.class, ExpressionsProducer.class, LocaleProducer.class})
+(a)Classes({Interpolator.class, Expressions.class, ExpressionsProducer.class, LocaleProducer.class, LocaleResolver.class, LocaleResolverProducer.class})
public class InterpolatorTest extends AbstractWebBeansTest
{
+ private boolean elResolverInitialized = false;
+
@Override
public void beforeMethod()
{
super.beforeMethod();
- installTestFixtureELResolver();
+ if (!elResolverInitialized)
+ {
+ installTestFixtureELResolver();
+ }
}
@Test
@@ -97,6 +102,7 @@
Expressions expressions = getCurrentManager().getInstanceByType(Expressions.class);
// FIXME wow this is a hack
((CompositeELResolver) expressions.getELContext().getELResolver()).add(new TestFixtureELResolver(fixture));
+ elResolverInitialized = true;
}
public class TestFixtureELResolver extends AbstractELResolver
Modified: modules/trunk/international/src/test/java/org/jboss/seam/international/LocaleProducerTest.java
===================================================================
--- modules/trunk/international/src/test/java/org/jboss/seam/international/LocaleProducerTest.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/international/src/test/java/org/jboss/seam/international/LocaleProducerTest.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -1,8 +1,11 @@
package org.jboss.seam.international;
-import static org.testng.Assert.*;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertSame;
import java.util.Locale;
+
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.webbeans.test.AbstractWebBeansTest;
@@ -16,7 +19,7 @@
* @author Dan Allen
*/
@Artifact(addCurrentPackage = false)
-(a)Classes(LocaleProducer.class)
+(a)Classes({LocaleProducer.class, LocaleResolver.class, LocaleResolverProducer.class})
public class LocaleProducerTest extends AbstractWebBeansTest
{
/**
@@ -26,10 +29,14 @@
@Test
public void testProducerMethodReturnsJvmDefault()
{
- LocaleProducer producer = new LocaleProducer();
- Locale result = producer.getLocale();
+ LocaleResolver resolver = new LocaleResolver();
+ Locale result = resolver.getLocale();
assertNotNull(result);
assertEquals(result.toString(), Locale.getDefault().toString());
+
+ LocaleProducer producer = new LocaleProducer();
+ Locale result2 = producer.getLocale(resolver);
+ assertSame(result2, result);
}
/**
Modified: modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesTest.java
===================================================================
--- modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesTest.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesTest.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -4,6 +4,8 @@
import org.jboss.seam.el.Expressions;
import org.jboss.seam.el.ExpressionsProducer;
+import org.jboss.seam.resources.DefaultResourceLoader;
+import org.jboss.seam.resources.ResourceLoaderProducer;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.webbeans.context.ConversationContext;
@@ -20,7 +22,9 @@
@Artifact(addCurrentPackage = false)
@Classes(
{
- StatusMessages.class, Interpolator.class, Expressions.class, ExpressionsProducer.class, LocaleProducer.class
+ StatusMessages.class, Interpolator.class, Expressions.class, ExpressionsProducer.class,
+ LocaleProducer.class, LocaleResolver.class, LocaleResolverProducer.class, MessagesProducer.class,
+ DefaultResourceLoader.class, ResourceLoaderProducer.class
})
public class StatusMessagesTest extends AbstractWebBeansTest
{
Added: modules/trunk/international/src/test/java/org/jboss/seam/international/Thing.java
===================================================================
--- modules/trunk/international/src/test/java/org/jboss/seam/international/Thing.java (rev 0)
+++ modules/trunk/international/src/test/java/org/jboss/seam/international/Thing.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,13 @@
+package org.jboss.seam.international;
+
+import javax.enterprise.inject.Named;
+
+public
+@Named
+class Thing
+{
+ public String getName()
+ {
+ return "music";
+ }
+}
Added: modules/trunk/international/src/test/resources/messages.properties
===================================================================
--- modules/trunk/international/src/test/resources/messages.properties (rev 0)
+++ modules/trunk/international/src/test/resources/messages.properties 2009-05-28 19:13:06 UTC (rev 11026)
@@ -0,0 +1,2 @@
+title=Hello Seam!
+thing=It's called #{thing.name}
Modified: modules/trunk/parent/pom.xml
===================================================================
--- modules/trunk/parent/pom.xml 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/parent/pom.xml 2009-05-28 19:13:06 UTC (rev 11026)
@@ -94,6 +94,7 @@
<module>../mock</module>
<module>../bridge-api</module>
<module>../beans</module>
+ <module>../resources</module>
<module>../el</module>
<module>../international</module>
<module>../web</module>
Modified: modules/trunk/resources/src/main/java/org/jboss/seam/resources/DefaultResourceLoader.java
===================================================================
--- modules/trunk/resources/src/main/java/org/jboss/seam/resources/DefaultResourceLoader.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/resources/src/main/java/org/jboss/seam/resources/DefaultResourceLoader.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -26,6 +26,7 @@
import java.util.List;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.ResourceBundle;
import org.jboss.seam.beans.Default;
import org.jboss.webbeans.log.LogProvider;
@@ -38,6 +39,7 @@
* Classloader isn't available
*
* @author Pete Muir
+ * @author Dan Allen
*/
public
@Default
@@ -75,17 +77,17 @@
* @param bundleName the name of the resource bundle
* @return an instance of java.util.ResourceBundle
*/
- public java.util.ResourceBundle loadBundle(String bundleName)
+ public ResourceBundle loadBundle(String bundleName)
{
try
{
- java.util.ResourceBundle bundle = loadBundleInternal(bundleName);
+ ResourceBundle bundle = loadBundleInternal(bundleName);
log.debug("loaded resource bundle: " + bundleName);
return bundle;
}
catch (MissingResourceException mre)
{
- log.debug("resource bundle missing: " + bundleName);
+ log.warn("resource bundle missing: " + bundleName);
return null;
}
}
@@ -112,9 +114,9 @@
}
}
- protected java.util.ResourceBundle loadBundleInternal(String bundleName)
+ protected ResourceBundle loadBundleInternal(String bundleName)
{
- return java.util.ResourceBundle.getBundle(bundleName, Locale.getDefault(), Thread.currentThread().getContextClassLoader());
+ return ResourceBundle.getBundle(bundleName, Locale.getDefault(), Thread.currentThread().getContextClassLoader());
}
protected InputStream getResourceAsStreamInternal(String absolutePath, String relativePath)
Modified: modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoader.java
===================================================================
--- modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoader.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoader.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -16,7 +16,9 @@
*/
package org.jboss.seam.resources;
+import java.io.InputStream;
import java.net.URL;
+import java.util.ResourceBundle;
/**
* Resource loading/class creation services for Seam. By default an
@@ -51,4 +53,21 @@
*/
public Iterable<URL> getResources(String name);
+ /**
+ * Gets a resource as an InputStream by name
+ *
+ * @param name The name of the resource
+ * @return An InputStream of the resource
+ */
+ public InputStream getResourceAsStream(String name);
+
+ /**
+ * Load a ResourceBundle for the given bundle name. The
+ * locale is detected automatically from the current Locale
+ * bean instance.
+ *
+ * @param bundleName The name of the resource bundle to load.
+ * @return A ResourceBundle for the bundle name
+ */
+ public ResourceBundle loadBundle(String bundleName);
}
Modified: modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoaderProducer.java
===================================================================
--- modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoaderProducer.java 2009-05-28 19:09:19 UTC (rev 11025)
+++ modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoaderProducer.java 2009-05-28 19:13:06 UTC (rev 11026)
@@ -32,5 +32,4 @@
{
return super.selectImplementation();
}
-
}
15 years, 6 months
Seam SVN: r11025 - modules/trunk/security/src/main/java/org/jboss/seam/security/management.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-28 15:09:19 -0400 (Thu, 28 May 2009)
New Revision: 11025
Modified:
modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStoreConfig.java
Log:
temporarily disable injection
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStoreConfig.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStoreConfig.java 2009-05-28 19:05:00 UTC (rev 11024)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStoreConfig.java 2009-05-28 19:09:19 UTC (rev 11025)
@@ -5,7 +5,6 @@
import java.util.Collection;
import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Current;
import javax.enterprise.inject.Initializer;
import org.jboss.seam.security.annotations.management.PasswordSalt;
@@ -46,7 +45,8 @@
private AnnotatedBeanProperty<RoleGroups> roleGroupsProperty;
private AnnotatedBeanProperty<RoleConditional> roleConditionalProperty;
- @Current IdentityStoreEntityClasses entityClasses;
+ //@Current // FIXME temporarily disable!!
+ IdentityStoreEntityClasses entityClasses;
@Initializer
public void initProperties()
15 years, 6 months
Seam SVN: r11024 - in modules/trunk/bridge-api/src: test/java/org/jboss/seam/bridge and 1 other directory.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-28 15:05:00 -0400 (Thu, 28 May 2009)
New Revision: 11024
Modified:
modules/trunk/bridge-api/src/main/java/org/jboss/seam/bridge/ManagerBridge.java
modules/trunk/bridge-api/src/test/java/org/jboss/seam/bridge/ManagerBridgeOverrideTest.java
modules/trunk/bridge-api/src/test/java/org/jboss/seam/bridge/ManagerBridgeTest.java
Log:
rename startup method
Modified: modules/trunk/bridge-api/src/main/java/org/jboss/seam/bridge/ManagerBridge.java
===================================================================
--- modules/trunk/bridge-api/src/main/java/org/jboss/seam/bridge/ManagerBridge.java 2009-05-28 15:36:40 UTC (rev 11023)
+++ modules/trunk/bridge-api/src/main/java/org/jboss/seam/bridge/ManagerBridge.java 2009-05-28 19:05:00 UTC (rev 11024)
@@ -89,7 +89,7 @@
*
* @param manager The deployed Manager instance
*/
- public void onManagerDeployed(@Observes @AfterBeanDiscovery BeanManager manager)
+ public void onStartup(@Observes @AfterBeanDiscovery BeanManager manager)
{
// intended for a mock environment, skip discovery
if (!discover)
Modified: modules/trunk/bridge-api/src/test/java/org/jboss/seam/bridge/ManagerBridgeOverrideTest.java
===================================================================
--- modules/trunk/bridge-api/src/test/java/org/jboss/seam/bridge/ManagerBridgeOverrideTest.java 2009-05-28 15:36:40 UTC (rev 11023)
+++ modules/trunk/bridge-api/src/test/java/org/jboss/seam/bridge/ManagerBridgeOverrideTest.java 2009-05-28 19:05:00 UTC (rev 11024)
@@ -26,7 +26,7 @@
ManagerBridge bridge = new ManagerBridge();
// no scanning should occur; ensure by forcing NullPointerException if it does
bridge.setResolverClass(null);
- bridge.onManagerDeployed(null);
+ bridge.onStartup(null);
assertSame(ManagerBridge.getProvider(), provider);
}
Modified: modules/trunk/bridge-api/src/test/java/org/jboss/seam/bridge/ManagerBridgeTest.java
===================================================================
--- modules/trunk/bridge-api/src/test/java/org/jboss/seam/bridge/ManagerBridgeTest.java 2009-05-28 15:36:40 UTC (rev 11023)
+++ modules/trunk/bridge-api/src/test/java/org/jboss/seam/bridge/ManagerBridgeTest.java 2009-05-28 19:05:00 UTC (rev 11024)
@@ -45,7 +45,7 @@
{
ManagerBridge bridge = new ManagerBridge();
bridge.setResolverClass(ManagerProviderResolverStub.class);
- bridge.onManagerDeployed(getCurrentManager());
+ bridge.onStartup(getCurrentManager());
ManagerProvider provider = ManagerBridge.getProvider();
assertTrue(provider instanceof ManagerProviderStub);
assertSame(provider.getCurrentManager(), getCurrentManager());
@@ -62,7 +62,7 @@
{
ManagerBridge bridge = new ManagerBridge();
bridge.setResolverClass(IncorrectManagerProviderResolverStub.class);
- bridge.onManagerDeployed(getCurrentManager());
+ bridge.onStartup(getCurrentManager());
ManagerBridge.getProvider();
}
15 years, 6 months
Seam SVN: r11023 - branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT.
by seam-commits@lists.jboss.org
Author: nico.ben
Date: 2009-05-28 11:36:40 -0400 (Thu, 28 May 2009)
New Revision: 11023
Modified:
branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT/Spring.po
Log:
JBSEAM-3767: Italian translation of Seam guide
Modified: branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT/Spring.po
===================================================================
--- branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT/Spring.po 2009-05-28 15:30:19 UTC (rev 11022)
+++ branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT/Spring.po 2009-05-28 15:36:40 UTC (rev 11023)
@@ -6,7 +6,7 @@
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-04-15 13:52+0000\n"
-"PO-Revision-Date: 2009-05-26 22:15+0100\n"
+"PO-Revision-Date: 2009-05-28 17:36+0100\n"
"Last-Translator: Nicola Benaglia <nico.benaz(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@ -224,7 +224,7 @@
#: Spring.xml:81
#, no-c-format
msgid "This example shows one way to use a Seam-managed persistence context from a Spring bean. (For a more robust way to use Seam-managed persistence contexts as a replacement for the Spring <literal>OpenEntityManagerInView</literal> filter see section on <link linkend=\"spring-persistence\">Using a Seam Managed Persistence Context in Spring</link>)"
-msgstr ""
+msgstr "Quest'esempio mostra una modalità d'uso del contesto di persistenza gestito da Seam da un bean di Spring. (Per vedere un modo più robusto di usare i contesti di persistenza gestiti da Seam in sostituzione del filtro <literal>OpenEntityManagerInView</literal> di Spring si veda la sezione <link linkend=\"spring-persistence\">Uso di un contesto di persistenza gestito da Seam in Spring</link>)"
#. Tag: title
#: Spring.xml:88
@@ -260,7 +260,7 @@
#: Spring.xml:105
#, no-c-format
msgid "The Spring <literal>DelegatingVariableResolver</literal> is an integration point Spring provides for integrating Spring with JSF. This <literal>VariableResolver</literal> makes all Spring beans available in EL by their bean id. You'll need to add the <literal>DelegatingVariableResolver</literal> to <literal>faces-config.xml</literal>:"
-msgstr ""
+msgstr "<literal>DelegatingVariableResolver</literal> di Spring è un punto di integrazione che Spring fornisce per integrarsi con JSF. Questo <literal>VariableResolver</literal> rende disponibili in EL tutti i bean di Spring tramite il loro id bean. Occorrerà aggiungere <literal>DelegatingVariableResolver</literal> a <literal>faces-config.xml</literal>:"
#. Tag: programlisting
#: Spring.xml:110
@@ -328,13 +328,13 @@
#: Spring.xml:130
#, no-c-format
msgid "By default, <literal><seam:component/></literal> will create a <literal>STATELESS</literal> Seam component with class and name provided in the bean definition. Occasionally, such as when a <literal>FactoryBean</literal> is used, the class of the Spring bean may not be the class appearing in the bean definition. In such cases the <literal>class</literal> should be explicitly specified. A Seam component name may be explicitly specified in cases where there is potential for a naming conflict."
-msgstr ""
+msgstr "Di default, <literal><seam:component/></literal> creerà un componente Seam <literal>STATELESS</literal> con classe e nome forniti nella definizione del bean. Occasionalmente, come ad esempio quando viene usato un <literal>FactoryBean</literal>, la classe del bean di Spring potrebbe non essere la classe che appare nella definizione del bean. In tali casi la <literal>class</literal> deve essere specificata esplicitamente. Un nome di un componente Seam può essere specificato esplicitamente nei casi in cui c'è un potenziale conflitto di nomi."
#. Tag: para
#: Spring.xml:136
#, no-c-format
msgid "The <literal>scope</literal> attribute of <literal><seam:component/></literal> may be used if you wish the Spring bean to be managed in a particular Seam scope. The Spring bean must be scoped to <literal>prototype</literal> if the Seam scope specified is anything other than <literal>STATELESS</literal>. Pre-existing Spring beans usually have a fundamentally stateless character, so this attribute is not usually needed."
-msgstr ""
+msgstr "L'attributo <literal>scope</literal> di <literal><seam:component/></literal> può essere impiegato se si vuole che un bean Spring venga gestito in un particolare scope di Seam. Il bean di Spring deve avere scope <literal>prototype</literal> se lo scope di Seam specificato è diverso da <literal>STATELESS</literal>. I bean di Spring preesistenti hanno di solito un carattere fondamentalmente stateless, quindi quest'attributo non è di solito necessario."
#. Tag: title
#: Spring.xml:145
@@ -346,13 +346,13 @@
#: Spring.xml:147
#, no-c-format
msgid "The Seam integration package also lets you use Seam's contexts as Spring 2.0 style custom scopes. This lets you declare any Spring bean in any of Seam's contexts. However, note once again that Spring's component model was never architected to support statefulness, so please use this feature with great care. In particular, clustering of session or conversation scoped Spring beans is deeply problematic, and care must be taken when injecting a bean or component from a wider scope into a bean of a narrower scope."
-msgstr ""
+msgstr "Il pacchetto di integrazione di Seam consente di usare i contesti Seam come scope personalizzati di Spring 2.0. Questo permette di dichiarare un bean Spring in un qualsiasi contesto di Seam. Comunque, si noti nuovamente che il modello a componenti di Spring non è stato progettato per supportare la modalità stateful, quindi si usi questa funzionalità con molta attenzione. In particolare il clustering dei bean di Spring con scope sessione o conversazione è molto problematico e deve esserci molta attenzione quando si inietta un bean o un componente da uno scope più ampio in un bean con scope più piccolo."
#. Tag: para
#: Spring.xml:153
#, no-c-format
msgid "By specifying <literal><seam:configure-scopes/></literal> once in a Spring bean factory configuration, all of the Seam scopes will be available to Spring beans as custom scopes. To associate a Spring bean with a particular Seam scope, specify the Seam scope in the <literal>scope</literal> attribute of the bean definition."
-msgstr ""
+msgstr "Specificando una sola volta <literal><seam:configure-scopes/></literal> nella configurazione di un bean factory di Bean, tutti gli scope di Seam saranno disponibili ai bean di Spring come scope personalizzati. Per associare un bean di Spring con un particolare scope di Seam, occorre specificare lo scope di Seam nell'attributo <literal>scope</literal> della definizione del bean."
#. Tag: programlisting
#: Spring.xml:158
@@ -382,13 +382,13 @@
#: Spring.xml:163
#, no-c-format
msgid "By default an instance of a Spring Component registered in this way is not automatically created when referenced using <literal>@In</literal>. To have an instance auto-created you must either specify <literal>@In(create=true)</literal> at the injection point to identify a specific bean to be auto created or you can use the <literal>default-auto-create</literal> attribute of <literal>configure-scopes</literal> to make all spring beans who use a seam scope auto created."
-msgstr ""
+msgstr "Di default un'istanza di un componente Spring registrato in questo modo non viene automaticamente creato quando viene referenziato usando <literal>@In</literal>. Per avere un'istanza auto-creata si deve o specificare <literal>@In(create=true)</literal> nel punto di iniezione per identificare un bean specifico da autocreare oppure si può usare l'attributo <literal>default-auto-create</literal> di <literal>configure-scopes</literal> per rendere auto-creati tutti i bean di Spring che usano uno scope di Seam."
#. Tag: para
#: Spring.xml:168
#, no-c-format
msgid "Seam-scoped Spring beans defined this way can be injected into other Spring beans without the use of <literal><seam:instance/></literal>. However, care must be taken to ensure scope impedance is maintained. The normal approach used in Spring is to specify <literal><aop:scoped-proxy/></literal> in the bean definition. However, Seam-scoped Spring beans are <emphasis>not</emphasis> compatible with <literal><aop:scoped-proxy/></literal>. So if you need to inject a Seam-scoped Spring bean into a singleton, <literal><seam:instance/></literal> must be used:"
-msgstr ""
+msgstr "I bean di Spring con scope Seam definiti in questo modo possono essere iniettati in altri bean di Spring senza l'uso di <literal><seam:instance/></literal>. Comunque si presti molta attenzione affinché venga mantenuta la impedenza di scope. L'approccio normale usato in Spring è quello di specificare <literal><aop:scoped-proxy/></literal> nella definizione del bean. Comunque i bean di Spring con scope Seam <emphasis>non</emphasis> compatibili con <literal><aop:scoped-proxy/></literal>. Quindi se occorre iniettare un bean di Spring con scope Seam in un singleton, deve essere usato <literal><seam:instance/></literal>:"
#. Tag: programlisting
#: Spring.xml:176
@@ -424,7 +424,7 @@
#: Spring.xml:182
#, no-c-format
msgid "Spring provides an extensible transaction management abstraction with support for many transaction APIs (JPA, Hibernate, JDO, and JTA) Spring also provides tight integrations with many application server TransactionManagers such as Websphere and Weblogic. Spring transaction management exposes support for many advanced features such as nested transactions and supports full Java EE transaction propagation rules like REQUIRES_NEW and NOT_SUPPORTED. For more information see the spring documentation <ulink url=\"http://static.springframework.org/spring/docs/2.0.x/reference/transaction...">here</ulink>."
-msgstr ""
+msgstr "Spring fornisce un'astrazione estensibile della gestione delle transazioni con supporto a molte API per le transazioni (JPA, Hibernate, JDO e JTA). Spring fornisce anche una stretta integrazione con molti TransactionManagers degli application server quali Websphere e Weblogic. La gestione delle transazioni di Spring espone il supporto a funzionalità avanzate quali transazioni innestate e supporto alle regole di propagazione delle transazioni Java EE come REQUIRES_NEW e NOT_SUPPORTED. Per maggiori informazioni guardare <ulink url=\"http://static.springframework.org/spring/docs/2.0.x/reference/transaction...">here</ulink>."
#. Tag: para
#: Spring.xml:190
@@ -454,7 +454,7 @@
#: Spring.xml:202
#, no-c-format
msgid "One of the most powerful features of Seam is its conversation scope and the ability to have an EntityManager open for the life of a conversation. This eliminates many of the problems associated with the detachment and re-attachment of entities as well as mitigates occurrences of the dreaded <literal>LazyInitializationException</literal>. Spring does not provide a way to manage an persistence context beyond the scope of a single web request (<literal>OpenEntityManagerInViewFilter</literal>). So, it would be nice if Spring developers could have access to a Seam managed persistence context using all of the same tools Spring provides for integration with JPA(e.g. <literal>PersistenceAnnotationBeanPostProcessor</literal>, <literal>JpaTemplate</literal>, etc.)"
-msgstr ""
+msgstr "Una delle caratteristiche più potenti di Seam è lo scope conversazione e la possibilità di avere un EntityManager aperto per l'intera vita di una conversazione. Questo elimina i problemi associati al detach e re-attach degli entity così come vengono mitigate le apparizioni della temuta <literal>LazyInitializationException</literal>. Spring non fornisce un modo per gestire un contesto di persistenza oltre lo scope di una singola richiesta web (<literal>OpenEntityManagerInViewFilter</literal>). Quindi sarebbe bello se gli sviluppatori di Spring potessero avere accesso al contesto di persistenza gestito da Seam usando tutti gli stessi tool che Spring fornisce per l'integrazione con JPA (es. <literal>PersistenceAnnotationBeanPostProcessor</literal>, <literal>JpaTemplate</literal>, ecc.)"
#. Tag: para
#: Spring.xml:212
@@ -508,7 +508,7 @@
#: Spring.xml:238
#, no-c-format
msgid "Where 'persistenceContextName' is the name of the Seam managed persistence context component. By default this EntityManagerFactory has a unitName equal to the Seam component name or in this case 'entityManager'. If you wish to provide a different unitName you can do so by providing a persistenceUnitName like so:"
-msgstr ""
+msgstr "dove 'persistenceContextName' è il nome del componente con contesto di persistenza gestito da Seam. Di default questo EntityManagerFactory ha un unitName uguale al nome del componente Seam o in questo caso 'entityManager'. Se si vuole fornire un unitName diverso, si può fornire un persistenceUnitName così:"
#. Tag: programlisting
#: Spring.xml:243
@@ -528,7 +528,7 @@
#: Spring.xml:245
#, no-c-format
msgid "This EntityManagerFactory can then be used in any Spring provided tools. For example, using Spring's <literal>PersistenceAnnotationBeanPostProcessor</literal> is the exact same as before."
-msgstr ""
+msgstr "EntityManagerFactory può essere usata in un qualsiasi tool fornito da Spring. Per esempio, l'uso di <literal>PersistenceAnnotationBeanPostProcessor</literal> di Spring è lo stesso di prima."
#. Tag: programlisting
#: Spring.xml:248
@@ -540,7 +540,7 @@
#: Spring.xml:250
#, no-c-format
msgid "If you define your real EntityManagerFactory in Spring but wish to use a Seam managed persistence context you can tell the <literal>PersistenceAnnotationBeanPostProcessor</literal> which persistenctUnitName you wish to use by default by specifying the <literal>defaultPersistenceUnitName</literal> property."
-msgstr ""
+msgstr "Se si definisce in Spring un EntityManagerFactory ma si vuole usare un contesto di persistenza gestito da Seam, si può dire al <literal>PersistenceAnnotationBeanPostProcessor</literal> quale persistenctUnitName si desidera usare come default specificando la proprietà <literal>defaultPersistenceUnitName</literal>."
#. Tag: para
#: Spring.xml:255
@@ -590,11 +590,12 @@
"<![CDATA[<persistence:managed-persistence-context name=\"entityManager\"\n"
" auto-create=\"true\" entity-manager-factory=\"#{entityManagerFactory}\"/>]]>"
+# rivedere la frase
#. Tag: para
#: Spring.xml:262
#, no-c-format
msgid "<literal>JpaTemplate</literal> and <literal>JpaDaoSupport</literal> are configured the same way for a Seam managed persistence context as they would be fore a Seam managed persistence context."
-msgstr ""
+msgstr "<literal>JpaTemplate</literal> e <literal>JpaDaoSupport</literal> sono configurati allo stesso modo per un contesto di persistenza gestito da Seam."
#. Tag: programlisting
#: Spring.xml:265
@@ -624,7 +625,7 @@
#: Spring.xml:273
#, no-c-format
msgid "Like Spring's JPA integration spring's propagation model allows only one open EntityManager per EntityManagerFactory per transaction??? to be available to spring tools. So, the Seam Session integration works by wrapping a proxy SessionFactory around a Seam managed Hibernate session context."
-msgstr ""
+msgstr "Come per l'integrazione JPA di Spring, il modello di propagazione di Spring consente di avere aperto solo un EntityManager per EntityManagerFactory per transazione disponibile ai tool di Spring. Quindi , l'integrazione della Sessione di Seam funziona solo con il wrap di un proxy SessionFactory attorno al contesto sessione di Hibernate gestito da Seam."
#. Tag: programlisting
#: Spring.xml:278
@@ -642,7 +643,7 @@
#: Spring.xml:280
#, no-c-format
msgid "Where 'sessionName' is the name of the <literal>persistence:managed-hibernate-session</literal> component. This SessionFactory can then be used in any Spring provided tools. The integration also provides support for calls to <literal>SessionFactory.getCurrentInstance()</literal> as long as you call getCurrentInstance() on the <literal>SeamManagedSessionFactory</literal>."
-msgstr ""
+msgstr "dove 'sessionName' è il nome del componente <literal>persistence:managed-hibernate-session</literal>. Questo SessionFactory può essere allora usato in un qualsiasi tool fornito da Spring. L'integrazione fornisce anche supporto alle chiamare a <literal>SessionFactory.getCurrentInstance()</literal> finché si chiama getCurrentInstance() su <literal>SeamManagedSessionFactory</literal>."
#. Tag: title
#: Spring.xml:286
@@ -672,7 +673,7 @@
#: Spring.xml:302
#, no-c-format
msgid "To overcome these two limitations the Spring integration includes a Seam component that will start a Spring ApplicationContext. To use this Seam component place the <literal><spring:context-loader/></literal> definition in the <literal>components.xml</literal>. Specify your Spring context file location in the <literal>config-locations</literal> attribute. If more than one config file is needed you can place them in the nested <literal><spring:config-locations/></literal> element following standard <literal>components.xml</literal> multi value practices."
-msgstr ""
+msgstr "Per superare queste due limitazioni, l'integrazione di Spring include un componente di Seam che avvia un ApplicationContext di Spring. Per usare questo componente di Seam si collochi la definizione <literal><spring:context-loader/></literal> in <literal>components.xml</literal>. Si specifichi la posizione del file col contesto di Spring nell'attributo <literal>config-locations</literal>. Se sono presenti più di un file si possono posizionare nell'elemento <literal><spring:config-locations/></literal> seguendo le practice multi-value di <literal>components.xml</literal>."
#. Tag: programlisting
#: Spring.xml:310
@@ -712,7 +713,7 @@
#: Spring.xml:315
#, no-c-format
msgid "Spring provides an abstraction for executing code asynchronously called a <literal>TaskExecutor</literal>. The Spring Seam integration allows for the use of a Spring <literal>TaskExecutor</literal> for executing immediate <literal>@Asynchronous</literal> method calls. To enable this functionality install the <literal>SpringTaskExecutorDispatchor</literal> and provide a spring bean defined taskExecutor like so:"
-msgstr ""
+msgstr "Spring fornisce un'astrazione per eseguire codice in modo asincrono chiamata <literal>TaskExecutor</literal>. L'integrazione con Seam consente di usare un <literal>TaskExecutor</literal> di Spring per eseguire chiamate immediate di metodi <literal>@Asynchronous</literal>. Per abilitare questa funzionalità si installi <literal>SpringTaskExecutorDispatchor</literal> e si fornisca un bean di Spring definito taskExecutor in questo modo:"
#. Tag: programlisting
#: Spring.xml:320
15 years, 6 months
Seam SVN: r11022 - tags/JBoss_Seam_2_1_2/build.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-05-28 11:30:19 -0400 (Thu, 28 May 2009)
New Revision: 11022
Modified:
tags/JBoss_Seam_2_1_2/build/default.build.properties
Log:
for release
Modified: tags/JBoss_Seam_2_1_2/build/default.build.properties
===================================================================
--- tags/JBoss_Seam_2_1_2/build/default.build.properties 2009-05-28 15:19:23 UTC (rev 11021)
+++ tags/JBoss_Seam_2_1_2/build/default.build.properties 2009-05-28 15:30:19 UTC (rev 11022)
@@ -8,7 +8,7 @@
major.version 2
minor.version .1
patchlevel .2
-qualifier -SNAPSHOT
+qualifier
#
# Other program locations
# -----------------------
15 years, 6 months
Seam SVN: r11021 - tags.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-05-28 11:19:23 -0400 (Thu, 28 May 2009)
New Revision: 11021
Added:
tags/JBoss_Seam_2_1_2/
Log:
tag for release
Copied: tags/JBoss_Seam_2_1_2 (from rev 11020, branches/community/Seam_2_1)
15 years, 6 months
Seam SVN: r11020 - branches/community/Seam_2_1.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-05-28 10:58:42 -0400 (Thu, 28 May 2009)
New Revision: 11020
Modified:
branches/community/Seam_2_1/changelog.txt
branches/community/Seam_2_1/readme.txt
Log:
prepare for release
Modified: branches/community/Seam_2_1/changelog.txt
===================================================================
--- branches/community/Seam_2_1/changelog.txt 2009-05-28 14:10:39 UTC (rev 11019)
+++ branches/community/Seam_2_1/changelog.txt 2009-05-28 14:58:42 UTC (rev 11020)
@@ -1,6 +1,28 @@
JBoss Seam Changelog
====================
+Release Notes - Seam - Version 2.1.2
+
+** Bug
+ * [JBSEAM-2690] - Websphere on Windows JPA reference guide example throws a ClassCastException
+ * [JBSEAM-3603] - Progressbar example is broken
+ * [JBSEAM-3648] - Several source file reference a copyright.txt in the distribution that is nonexistent
+ * [JBSEAM-4152] - HTTP BASIC authentication fails with exception during embedded container testing
+ * [JBSEAM-4169] - Enum converter does not handle inner anonymous enums
+ * [JBSEAM-4173] - Wicket instrumentation results in incorrect disinjection when invoking superclass methods from a subclass constructor
+ * [JBSEAM-4199] - Blog directory plugin shows duplicate attachments
+
+** Feature Request
+ * [JBSEAM-4090] - EntityTest testStale failing
+
+** Task
+ * [JBSEAM-2232] - Full review of Seam's log levels
+ * [JBSEAM-3264] - REST requests create anemic HttpSessions
+ * [JBSEAM-4010] - Document various approaches to Wicket instrumentation
+ * [JBSEAM-4135] - Upload selenium libs to jboss maven repository
+ * [JBSEAM-4193] - Document attributes "color" of tag "p:font" and "scaleToFit" of tag "p:image"
+
+
Release Notes - Seam - Version 2.1.2.CR2
** Bug
Modified: branches/community/Seam_2_1/readme.txt
===================================================================
--- branches/community/Seam_2_1/readme.txt 2009-05-28 14:10:39 UTC (rev 11019)
+++ branches/community/Seam_2_1/readme.txt 2009-05-28 14:58:42 UTC (rev 11020)
@@ -1,7 +1,7 @@
JBoss Seam - Contextual Component framework for Java EE 5
=========================================================
-version 2.1.2.CR2, April 2009
+version 2.1.2, May 2009
This software is distributed under the terms of the FSF Lesser Gnu
Public License (see lgpl.txt).
15 years, 6 months
Seam SVN: r11018 - branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT.
by seam-commits@lists.jboss.org
Author: nico.ben
Date: 2009-05-28 05:27:27 -0400 (Thu, 28 May 2009)
New Revision: 11018
Modified:
branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT/Security.po
Log:
JBSEAM-3767: Italian translation of Seam guide
Modified: branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT/Security.po
===================================================================
--- branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT/Security.po 2009-05-28 08:54:09 UTC (rev 11017)
+++ branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT/Security.po 2009-05-28 09:27:27 UTC (rev 11018)
@@ -6,13 +6,13 @@
"Project-Id-Version: Security\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-04-29 12:40+0000\n"
-"PO-Revision-Date: 2009-05-17 22:21+0100\n"
-"Last-Translator: Nicola Benaglia <nico.benaz(a)gmail.com>\n"
-"Language-Team: Italian <stefano.travelli(a)gmail.com>\n"
+"PO-Revision-Date: 2009-05-28 01:27+0200\n"
+"Last-Translator: \n"
+"Language-Team: it <stefano.travelli(a)gmail.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: Lokalize 0.2\n"
+"X-Generator: Lokalize 0.3\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. Tag: title
@@ -3629,7 +3629,7 @@
#: Security.xml:2809
#, no-c-format
msgid "As they are cached in the user's session, any custom <literal>PermissionResolver</literal> implementations must adhere to a couple of restrictions. Firstly, they may not contain any state that is finer-grained than session scope (and the scope of the component itself should either be application or session). Secondly, they must not use dependency injection as they may be accessed from multiple threads simultaneously. In fact, for performance reasons it is recommended that they are annotated with <literal>@BypassInterceptors</literal> to bypass Seam's interceptor stack altogether."
-msgstr ""
+msgstr "Essendo conservati nella sessione dell'utente, ogni implementazione di <literal>PermissionResolver</literal> deve aderire ad un paio di restrizioni. In primo luogo, non possono contenere alcuna informazione di stato che abbia una visibilità inferiore a session (e la visibilità del componente stesso deve essere o application oppure session). In secondo luogo, non devono usare la dependency injection poiché ci potrebbero essere accessi da più thread contemporaneamente. Infatti, per ragioni di prestazioni, è raccomandabile annotare con <literal>@BypassInterceptors</literal> per evitare del tutto l'insieme degli intercettori Seam."
#. Tag: title
#: Security.xml:2824
@@ -3647,7 +3647,7 @@
#: Security.xml:2831
#, no-c-format
msgid "The default <literal>ResolverChain</literal> consists of all permission resolvers discovered during application deployment. The <literal>org.jboss.seam.security.defaultResolverChainCreated</literal> event is raised (and the <literal>ResolverChain</literal> instance passed as an event parameter) when the default <literal>ResolverChain</literal> is created. This allows additional resolvers that for some reason were not discovered during deployment to be added, or for resolvers that are in the chain to be re-ordered or removed."
-msgstr ""
+msgstr "La <literal>ResolverChain</literal> di default consiste di tutti i risolutori di permessi rilevati durante l'avvio dell'applicazione. L'evento <literal>org.jboss.seam.security.defaultResolverChainCreated</literal> viene lanciato (e l'istanza di <literal>ResolverChain</literal> viene passata come parametro dell'evento) quando il <literal>ResolverChain</literal> di default viene creato. Questo consente di aggiungere ulteriori risolutori che per qualche ragione non erano stati rilevati durante l'avvio, oppure di riordinare o rimuovere i risolutori che sono nell'elenco."
#. Tag: para
#: Security.xml:2840
@@ -4050,7 +4050,7 @@
#: Security.xml:3130
#, no-c-format
msgid "Before it can be used, <literal>PersistentPermissionResolver</literal> must be configured with a valid <literal>PermissionStore</literal> in <literal>components.xml</literal>. If not configured, it will attempt to use the default permission store, <literal>JpaIdentityStore</literal> (see section further down for details). To use a permission store other than the default, configure the <literal>permission-store</literal> property as follows:"
-msgstr ""
+msgstr "Prima di essere usato il <literal>PersistentPermissionResolver</literal> deve essere configurato con un <literal>PermissionStore</literal> valido in <literal>components.xml</literal>. Se non è configurato, proverà ad usare il permission store di default, <literal>JpaIdentityStore</literal> (vedi il paragrafo successivo per i dettagli). Per usare un permission store diverso da quello di default, occorre configurare la proprietà <literal>permission-store</literal> in questo modo:"
#. Tag: programlisting
#: Security.xml:3138
@@ -4062,19 +4062,19 @@
#: Security.xml:3143
#, no-c-format
msgid "Permission Stores"
-msgstr ""
+msgstr "I Permission Store"
#. Tag: para
#: Security.xml:3145
#, no-c-format
msgid "A permission store is required for <literal>PersistentPermissionResolver</literal> to connect to the backend storage where permissions are persisted. Seam provides one <literal>PermissionStore</literal> implementation out of the box, <literal>JpaPermissionStore</literal>, which is used to store permissions inside a relational database. It is possible to write your own permission store by implementing the <literal>PermissionStore</literal> interface, which defines the following methods:"
-msgstr ""
+msgstr "Il <literal>PersistentPermissionManager</literal> richiede un permission store per connettersi al dispositivo di memorizzazione dove sono registrati i permessi. Seam fornisce una implementazione di <literal>PermissionStore</literal> già fatta, <literal>JpaPermissionStore</literal>, che viene usata per memorizzare i permessi in un database relazionale. E' possibile scrivere il proprio permission store implementando l'interfaccia <literal>PermissionStore</literal>, che definisce i seguenti metodi:"
#. Tag: title
#: Security.xml:3155
#, no-c-format
msgid "PermissionStore interface"
-msgstr ""
+msgstr "Interfaccia PermissionStore"
#. Tag: literal
#: Security.xml:3181
@@ -4097,7 +4097,7 @@
#: Security.xml:3190
#, no-c-format
msgid "This method should return a <literal>List</literal> of <literal>Permission</literal> objects representing all the permissions granted for the specified target object."
-msgstr ""
+msgstr "Questo metodo deve restituire una <literal>List</literal> di oggetti <literal>Permission</literal> che rappresenti tutti i permessi concessi per l'oggetto indicato come obiettivo."
#. Tag: literal
#: Security.xml:3205
@@ -4110,7 +4110,7 @@
#: Security.xml:3209
#, no-c-format
msgid "This method should return a <literal>List</literal> of <literal>Permission</literal> objects representing all the permissions with the specified action, granted for the specified target object."
-msgstr ""
+msgstr "Questo metodo deve restituire una <literal>List</literal> di oggetti <literal>Permission</literal> che rappresenti tutti i permessi sull'azione specificata, concessi per l'oggetto indicato come obiettivo."
#. Tag: literal
#: Security.xml:3224
@@ -4122,7 +4122,7 @@
#: Security.xml:3228
#, no-c-format
msgid "This method should return a <literal>List</literal> of <literal>Permission</literal> objects representing all the permissions with the specified action, granted for the specified set of target objects."
-msgstr ""
+msgstr "Questo metodo deve restituire una <literal>List</literal> di oggetti <literal>Permission</literal> che rappresenti tutti i permessi sull'azione specificata concessi per l'insieme di oggetti indicati come obiettivi."
#. Tag: literal
#: Security.xml:3244
@@ -4134,7 +4134,7 @@
#: Security.xml:3248
#, no-c-format
msgid "This method should persist the specified <literal>Permission</literal> object to the backend storage, returning true if successful."
-msgstr ""
+msgstr "Questo metodo deve rendere persistente l'oggetto <literal>Permission</literal> specificato nel dispositivo di memorizzazione, restituendo vero se l'operazione si conclude senza errori."
#. Tag: literal
#: Security.xml:3263
@@ -4147,7 +4147,7 @@
#: Security.xml:3267
#, no-c-format
msgid "This method should persist all of the <literal>Permission</literal> objects contained in the specified <literal>List</literal>, returning true if successful."
-msgstr ""
+msgstr "Questo metodo deve rendere persisistenti tutti gli oggetti <literal>Permission</literal> contenuti nella <literal>List</literal> specificata, restituendo vero se l'operazione si conclude senza errori."
#. Tag: literal
#: Security.xml:3282
@@ -4160,7 +4160,7 @@
#: Security.xml:3286
#, no-c-format
msgid "This method should remove the specified <literal>Permission</literal> object from persistent storage."
-msgstr ""
+msgstr "Questo metodo deve rimuove l'oggetto <literal>Permission</literal> specificato dal dispositivo di memorizzazione."
#. Tag: literal
#: Security.xml:3300
@@ -4173,7 +4173,7 @@
#: Security.xml:3304
#, no-c-format
msgid "This method should remove all of the <literal>Permission</literal> objects in the specified list from persistent storage."
-msgstr ""
+msgstr "Questo metodo deve rimuovere dal dispositivo di memorizzazione tutti gli oggetti <literal>Permission</literal> specificati nella lista."
#. Tag: literal
#: Security.xml:3314
@@ -4193,7 +4193,7 @@
#: Security.xml:3323
#, no-c-format
msgid "This method should return a list of all the available actions (as Strings) for the class of the specified target object. It is used in conjunction with permission management to build the user interface for granting specific class permissions (see section further down)."
-msgstr ""
+msgstr "Questo metodo deve restituire una lista di tutte le azioni disponibili (sotto forma di String) per la classe dell'oggetto specificato. Viene usato dalla gestione dei permessi per costruire l'interfaccia utente con cui si concedono i permessi sulle varie classi (vedi il paragrafo più avanti)."
#. Tag: title
#: Security.xml:3337
@@ -4205,19 +4205,19 @@
#: Security.xml:3339
#, no-c-format
msgid "This is the default <literal>PermissionStore</literal> implementation (and the only one provided by Seam), which uses a relational database to store permissions. Before it can be used it must be configured with either one or two entity classes for storing user and role permissions. These entity classes must be annotated with a special set of security annotations to configure which properties of the entity correspond to various aspects of the permissions being stored."
-msgstr ""
+msgstr "E' l'implementazione di default di <literal>PermissionStore</literal> (e l'unica fornita da Seam), che usa un database relazionale per memorizzare i permessi. Prima di poter essere usata deve essere configurata con una o due classi per la memorizzazione dei permessi su utenti e ruoli. Queste classi entità devono essere annotate con uno speciale insieme di annotazioni relative alla sicurezza per configurare quali proprietà dell'entità corrispondono alle diverse caratteristiche dei permessi che devono essere memorizzati."
#. Tag: para
#: Security.xml:3347
#, no-c-format
msgid "If you wish to use the same entity (i.e. a single database table) to store both user and role permissions, then only the <literal>user-permission-class</literal> property is required to be configured. If you wish to use separate tables for storing user and role permissions, then in addition to the <literal>user-permission-class</literal> property you must also configure the <literal>role-permission-class</literal> property."
-msgstr ""
+msgstr "Se si vuole usare la stessa entità (cioè una sola tabella sul database) per memorizzare sia i permessi degli utenti che quelli dei ruoli, allora è necessario configurare solo la proprietà <literal>user-permission-class</literal>. Se si vogliono usare due tabelle distinte per memorizzare i permessi degli utenti e quelli dei ruoli, allora in aggiunta alla proprietà <literal>user-permission-class</literal> si dovrà configurare anche la proprietà <literal>role-permission-class</literal>."
#. Tag: para
#: Security.xml:3354
#, no-c-format
msgid "For example, to configure a single entity class to store both user and role permissions:"
-msgstr ""
+msgstr "Ad esempio, per configurare una sola classe entità per memorizzare sia i permessi degli utenti che quelli dei ruoli:"
#. Tag: programlisting
#: Security.xml:3356
@@ -4229,7 +4229,7 @@
#: Security.xml:3358
#, no-c-format
msgid "To configure separate entity classes for storing user and role permissions:"
-msgstr ""
+msgstr "Per configurare classi entità separate per la memorizzazione dei permessi di utenti e ruoli:"
#. Tag: programlisting
#: Security.xml:3360
@@ -4245,26 +4245,26 @@
#: Security.xml:3363
#, no-c-format
msgid "Permission annotations"
-msgstr ""
+msgstr "Annotazioni relative ai permessi"
#. Tag: para
#: Security.xml:3365
#, no-c-format
msgid "As mentioned, the entity classes that contain the user and role permissions must be configured with a special set of annotations, contained within the <literal>org.jboss.seam.annotations.security.permission</literal> package. The following table lists each of these annotations along with a description of how they are used:"
-msgstr ""
+msgstr "Come già detto, le classi entità che contengono i permessi degli utenti e dei ruoli devono essere configurate con uno speciale insieme di annotazioni contenute nel package <literal>org.jboss.seam.annotations.security.permission</literal>. La seguente tabella elenca queste annotazioni insieme ad una descrizione su come sono usate:"
#. Tag: title
#: Security.xml:3372
#, no-c-format
msgid "Entity Permission annotations"
-msgstr ""
+msgstr "Annotazioni per le entità dei permessi"
#. Tag: para
#: Security.xml:3385
#: Security.xml:3548
#, no-c-format
msgid "Target"
-msgstr "Target"
+msgstr "Obiettivo"
#. Tag: literal
#: Security.xml:3398
@@ -4286,7 +4286,7 @@
#: Security.xml:3407
#, no-c-format
msgid "This annotation identifies the property of the entity that will contain the permission target. The property should be of type <literal>java.lang.String</literal>."
-msgstr ""
+msgstr "Questa annotazione identifica la proprietà dell'entità che contiene l'obiettivo del permesso. La proprietà deve essere di tipo <literal>java.lang.Sting</literal>."
#. Tag: literal
#: Security.xml:3417
@@ -4298,7 +4298,7 @@
#: Security.xml:3426
#, no-c-format
msgid "This annotation identifies the property of the entity that will contain the permission action. The property should be of type <literal>java.lang.String</literal>."
-msgstr ""
+msgstr "Questa annotazione identifica la proprietà dell'entità che contiene l'azione. La proprietà deve essere di tipo <literal>java.lang.String</literal>."
#. Tag: literal
#: Security.xml:3436
@@ -4310,7 +4310,7 @@
#: Security.xml:3445
#, no-c-format
msgid "This annotation identifies the property of the entity that will contain the recipient user for the permission. It should be of type <literal>java.lang.String</literal> and contain the user's username."
-msgstr ""
+msgstr "Questa annotazione identifica la proprietà dell'entità che contiene l'utente a cui viene concesso il permesso. Deve essere di tipo <literal>java.lang.String</literal> e contenere la username dell'utente."
#. Tag: literal
#: Security.xml:3455
@@ -4322,7 +4322,7 @@
#: Security.xml:3464
#, no-c-format
msgid "This annotation identifies the property of the entity that will contain the recipient role for the permission. It should be of type <literal>java.lang.String</literal> and contain the role name."
-msgstr ""
+msgstr "Questa annotazione identifica la proprietà dell'entità che contiene il ruolo a cui viene concesso il premesso. Deve essere di tipo <literal>java.lang.String</literal> e contenere i nome del ruolo."
#. Tag: literal
#: Security.xml:3474
@@ -4334,7 +4334,7 @@
#: Security.xml:3483
#, no-c-format
msgid "This annotation should be used when the same entity/table is used to store both user and role permissions. It identifies the property of the entity that is used to discriminate between user and role permissions. By default, if the column value contains the string literal <literal>user</literal>, then the record will be treated as a user permission. If it contains the string literal <literal>role</literal>, then it will be treated as a role permission. It is also possible to override these defaults by specifying the <literal>userValue</literal> and <literal>roleValue</literal> properties within the annotation. For example, to use <literal>u</literal> and <literal>r</literal> instead of <literal>user</literal> and <literal>role</literal>, the annotation would be written like this:"
-msgstr ""
+msgstr "Questa annotazione deve essere usata quando la stessa entità/tabella viene usata per memorizzare sia i permessi degli utenti che quelli dei ruoli. Essa identifica la proprietà dell'entità che è usata per discriminare tra i permessi degli utenti e quelli dei ruoli. Per default, se il valore della colonna contiene la stringa <literal>user</literal>, allora il record sarà trattato come un permesso utente. Se contiene la stringa <literal>role</literal>, allora sarà trattato come un permesso del ruolo. E' anche possibile sovrascrivere questi valori specificando le proprietà <literal>userValue</literal> e <literal>roleValue</literal> all'interno delle annotazioni. Ad esempio, per usere <literal>u</literal> e <literal>r</literal> invece di <literali>user</literal> e <literali>role</literal>, le annotazioni dovranno essere scritte in questo modo:"
#. Tag: programlisting
#: Security.xml:3493
@@ -4346,13 +4346,13 @@
#: Security.xml:3504
#, no-c-format
msgid "Example Entity"
-msgstr ""
+msgstr "Esempio di entità"
#. Tag: para
#: Security.xml:3506
#, no-c-format
msgid "Here is an example of an entity class that is used to store both user and role permissions. The following class can be found inside the SeamSpace example:"
-msgstr ""
+msgstr "Ecco un esempio di una classe entità che viene usata per memorizzare sia i permessi degli utenti che quelli dei ruoli. La seguente classe si trova nell'applicazione di esempio SeamSpace:"
#. Tag: programlisting
#: Security.xml:3511
@@ -4474,25 +4474,25 @@
#: Security.xml:3513
#, no-c-format
msgid "As can be seen in the above example, the <literal>getDiscriminator()</literal> method has been annotated with the <literal>@PermissionDiscriminator</literal> annotation, to allow <literal>JpaPermissionStore</literal> to determine which records represent user permissions and which represent role permissions. In addition, it can also be seen that the <literal>getRecipient()</literal> method is annotated with both <literal>@PermissionUser</literal> and <literal>@PermissionRole</literal> annotations. This is perfectly valid, and simply means that the <literal>recipient</literal> property of the entity will either contain the name of the user or the name of the role, depending on the value of the <literal>discriminator</literal> property."
-msgstr ""
+msgstr "Come si vede dall'esempio precedente, il metodo <literal>getDiscriminator()</literal> è stato annotato con l'annotazione <literal>@PermissionDiscriminator</literal> per consentire a <literal>JpaPermissionStore</literal> di determinare quali record rappresentano i permessi degli utenti e quali rappresentano i permessi dei ruoli. Inoltre si può vedere che il metodo <literal>getRecipient()</literal> è annotato sia con l'annotazione <literal>@PermissionUser</literal> che con <literal>@PermissionRole</literal>. Ciò è perfettamente valido e significa semplicemente che la proprietà <literal>recipient</literal> dell'entità conterrà sia il nome dell'utente che quello del ruolo, in funzione del valore della proprietà <literal>discriminator</literal>."
#. Tag: title
#: Security.xml:3526
#, no-c-format
msgid "Class-specific Permission Configuration"
-msgstr ""
+msgstr "Configurazioni dei permessi specifiche per le classi"
#. Tag: para
#: Security.xml:3528
#, no-c-format
msgid "A further set of class-specific annotations can be used to configure a specific set of allowable permissions for a target class. These permissions can be found in the <literal>org.jboss.seam.annotation.security.permission</literal> package:"
-msgstr ""
+msgstr "Un ulteriore insieme di annotazioni specifiche per le classi può essere usato per specificare i permessi consentiti per una determinata classe obiettivo. Questi permessi si possono trovare nel package <literal>org.jboss.seam.annotation.security.permission</literal>:"
#. Tag: title
#: Security.xml:3535
#, no-c-format
msgid "Class Permission Annotations"
-msgstr ""
+msgstr "Annotazioni per i permessi sulle classi"
#. Tag: literal
#: Security.xml:3561
@@ -4511,7 +4511,7 @@
#: Security.xml:3570
#, no-c-format
msgid "A container annotation, this annotation may contain an array of <literal>@Permission</literal> annotations."
-msgstr ""
+msgstr "E' una annotazione contenitore, che può contenere un elenco di annotazioni <literal>@Permission</literal>."
#. Tag: literal
#: Security.xml:3579
@@ -4523,13 +4523,13 @@
#: Security.xml:3588
#, no-c-format
msgid "This annotation defines a single allowable permission action for the target class. Its <literal>action</literal> property must be specified, and an optional <literal>mask</literal> property may also be specified if permission actions are to be persisted as bitmasked values (see next section)."
-msgstr ""
+msgstr "Questa annotazione definisce una singola azione regolata da un permesso per la classe obiettivo. La sua proprietà <literal>action</literal> deve essere specificata e una proprietà opzionale <literal>mask</literal> può essere specificata se le azioni regolate da un permesso devono essere memorizzate come valori di una maschera di bit (vedi il paragrafo seguente)."
#. Tag: para
#: Security.xml:3600
#, no-c-format
msgid "Here's an example of the above annotations in action. The following class can also be found in the SeamSpace example:"
-msgstr ""
+msgstr "Ecco un esempio di queste annotazioni al lavoro. La seguente classe si trova anch'essa nell'applicazione di esempio SeamSpace:"
#. Tag: programlisting
#: Security.xml:3604
@@ -4553,25 +4553,25 @@
#: Security.xml:3606
#, no-c-format
msgid "This example demonstrates how two allowable permission actions, <literal>view</literal> and <literal>comment</literal> can be declared for the entity class <literal>MemberImage</literal>."
-msgstr ""
+msgstr "Questo esempio dimostra come due possibili azioni regolate da permesso, <literal>view</literal> e <literal>comment</literal> possono essere dichiarate per la classe entità <literal>MemberImage</literal>."
#. Tag: title
#: Security.xml:3614
#, no-c-format
msgid "Permission masks"
-msgstr ""
+msgstr "Maschere di bit per i permessi"
#. Tag: para
#: Security.xml:3616
#, no-c-format
msgid "By default, multiple permissions for the same target object and recipient will be persisted as a single database record, with the <literal>action</literal> property/column containing a comma-separated list of the granted actions. To reduce the amount of physical storage required to persist a large number of permissions, it is possible to use a bitmasked integer value (instead of a comma-separated list) to store the list of permission actions."
-msgstr ""
+msgstr "Per default più permessi per lo stesso obbiettivo e destinatario vengono memorizzati un singolo record sul database, con la proprietà/colonna <literal>action</literal> contenente un elenco delle azioni concesse separate da una virgola. Per ridurre la quantità di spazio fisico richiesto per memorizzare un numero elevato di permessi è possibile usare un valore intero come maschera di bit (al posto di un elenco di valori separati da virgole) per memorizzare l'elenco delle azioni consentite."
#. Tag: para
#: Security.xml:3623
#, no-c-format
msgid "For example, if recipient \"Bob\" is granted both the <literal>view</literal> and <literal>comment</literal> permissions for a particular <literal>MemberImage</literal> (an entity bean) instance, then by default the <literal>action</literal> property of the permission entity will contain \"<literal>view,comment</literal>\", representing the two granted permission actions. Alternatively, if using bitmasked values for the permission actions, as defined like so:"
-msgstr ""
+msgstr "Ad esempio, se al destinatario \"Pippo\" è concesso sia il permesso <literal>view</literal> che il permesso <literal>comment</literal> per una particolare istanza di <literal>MemberImage</literal> (un entity bean), allora per default la proprietà dell'entità permesso conterrà \"<literal>view,comment</literal>\", che rappresenta la concessione di due azioni. In alternativa, usando i valori di una maschera di bit per le azioni, si può definire in questo modo:"
#. Tag: programlisting
#: Security.xml:3630
@@ -4595,31 +4595,31 @@
#: Security.xml:3632
#, no-c-format
msgid "The <literal>action</literal> property will instead simply contain \"3\" (with both the 1 bit and 2 bit switched on). Obviously for a large number of allowable actions for any particular target class, the storage required for the permission records is greatly reduced by using bitmasked actions."
-msgstr ""
+msgstr "La proprietà <literal>action</literal> conterrà semplicemente \"3\" (con sia il bit 1 che il bit 2 alzati). Ovviamente per un numero elevato di azioni da consentire per una particolare classe obiettivo, lo spazio richiesto per memorizzare i record dei permessi si riduce grandemente usando le azioni con la maschera di bit."
#. Tag: para
#: Security.xml:3638
#, no-c-format
msgid "Obviously, it is very important that the <literal>mask</literal> values specified are powers of 2."
-msgstr ""
+msgstr "E' molto importante che i valori assegnati a <literal>mask</litera> siano specificati come potenze di 2."
#. Tag: title
#: Security.xml:3644
#, no-c-format
msgid "Identifier Policy"
-msgstr ""
+msgstr "Risoluzione dell'identificatore"
#. Tag: para
#: Security.xml:3646
#, no-c-format
msgid "When storing or looking up permissions, <literal>JpaPermissionStore</literal> must be able to uniquely identify specific object instances to effectively operate on its permissions. To achieve this, an <emphasis>identifier strategy</emphasis> may be assigned to each target class for the generation of unique identifier values. Each identifier strategy implementation knows how to generate unique identifiers for a particular type of class, and it is a simple matter to create new identifier strategies."
-msgstr ""
+msgstr "Quando <literal>JpaPermissionStore</literal> memorizza o cerca un permesso deve essere in grado di identificare univocamente le istanze degli oggetti sui cui permessi deve operare. Per ottenere questo occorre assegnare una <emphasis>stragegia di risoluzione dell'identificatore</emphasis> per ciascuna classe obiettivo, in modo da generare i valori identificativi univoci. Ciascuna implementazione della strategia di risoluzione sa come genere gli identificativi univoci per un particolare tipo di classe ed è solo questione di creare nuove strategia di risoluzione."
#. Tag: para
#: Security.xml:3654
#, no-c-format
msgid "The <literal>IdentifierStrategy</literal> interface is very simple, declaring only two methods:"
-msgstr ""
+msgstr "L'interfaccia <literal>IdentifierStrategy</literal> è molto semplice e dichiara solo due metodi:"
#. Tag: programlisting
#: Security.xml:3658
@@ -4639,19 +4639,19 @@
#: Security.xml:3660
#, no-c-format
msgid "The first method, <literal>canIdentify()</literal> simply returns <literal>true</literal> if the identifier strategy is capable of generating a unique identifier for the specified target class. The second method, <literal>getIdentifier()</literal> returns the unique identifier value for the specified target object."
-msgstr ""
+msgstr "Il primo metodo, <literal>canIdentify()</literal> restituisce semplicemente <literal>true</literal> se la strategia di risoluzione è in grado di generare un identificativo univoco per la classe obiettivo specificata. Il secondo metodo, <literal>getIdentifier()</literal> restituisce il valore dell'identificativo univoco per l'oggetto obiettivo specificato."
#. Tag: para
#: Security.xml:3666
#, no-c-format
msgid "Seam provides two <literal>IdentifierStrategy</literal> implementations, <literal>ClassIdentifierStrategy</literal> and <literal>EntityIdentifierStrategy</literal> (see next sections for details)."
-msgstr ""
+msgstr "Seam fornisce due implementazioni di <literal>IdentifierStrategy</literal>, <literal>ClassIdentifierStrategy</literal> e <literal>EntityIdentifierStrategy</literal> (vedi i prossimi paragrafi per i dettagli)."
#. Tag: para
#: Security.xml:3671
#, no-c-format
msgid "To explicitly configure a specific identifier strategy to use for a particular class, it should be annotated with <literal>org.jboss.seam.annotations.security.permission.Identifier</literal>, and the value should be set to a concrete implementation of the <literal>IdentifierStrategy</literal> interface. An optional <literal>name</literal> property can also be specified, the effect of which is dependent upon the actual <literal>IdentifierStrategy</literal> implementation used."
-msgstr ""
+msgstr "Per configurare esplicitamente la strategia di risoluzione da usare per una particolare classe, essa deve essere annotata con <literal>org.jboss.seam.annotations.security.permission.Identifier</literal>, e il valore deve essere impostato a una implementazione dell'interfaccia <literal>IdentifierStrategy</literal>. Una proprietà facoltativa <literal>name</literal> può essere specificata, e il suo effetto dipende dall'implementazione di <literal>IdentifierStrategy</literal> usata."
#. Tag: title
#: Security.xml:3681
@@ -4663,7 +4663,7 @@
#: Security.xml:3683
#, no-c-format
msgid "This identifier strategy is used to generate unique identifiers for classes, and will use the value of the <literal>name</literal> (if specified) in the <literal>@Identifier</literal> annotation. If there is no <literal>name</literal> property provided, then it will attempt to use the component name of the class (if the class is a Seam component), or as a last resort it will create an identifier based on the name of the class (excluding the package name). For example, the identifier for the following class will be \"<literal>customer</literal>\":"
-msgstr ""
+msgstr "Questa strategia di risoluzione degli identificatori è usata per generare gli identificatori univoci per le classi e userà il valore della proprietà <literal>name</literal> (se indicato) nell'annotazione <literal>@Identifier</literal>. Se la proprietà <literal>name</literal> non è indicata, allora tenterà di usare il nome del componente della classe (se la classe è un componente Seam), oppure, come ultima risorsa creerà un identificatore basato sul nome della classe (escludendo il nome del package). Ad esempio, l'identificatore per la seguente classe sarà \"<literal>customr</literal>\":"
#. Tag: programlisting
#: Security.xml:3692
@@ -4679,7 +4679,7 @@
#: Security.xml:3694
#, no-c-format
msgid "The identifier for the following class will be \"<literal>customerAction</literal>\":"
-msgstr ""
+msgstr "L'identificatore per la seguente classe sarà \"<literal>customerAction</literal>\":"
#. Tag: programlisting
#: Security.xml:3698
@@ -4695,7 +4695,7 @@
#: Security.xml:3700
#, no-c-format
msgid "Finally, the identifier for the following class will be \"<literal>Customer</literal>\":"
-msgstr ""
+msgstr "Infine, l'identificatore per la seguente classe sarà \"<literal>Customer</literal>\":"
#. Tag: programlisting
#: Security.xml:3704
@@ -4713,7 +4713,7 @@
#: Security.xml:3711
#, no-c-format
msgid "This identifier strategy is used to generate unique identifiers for entity beans. It does so by concatenating the entity name (or otherwise configured name) with a string representation of the primary key value of the entity. The rules for generating the name section of the identifier are similar to <literal>ClassIdentifierStrategy</literal>. The primary key value (i.e. the <emphasis>id</emphasis> of the entity) is obtained using the <literal>PersistenceProvider</literal> component, which is able to correctly determine the value regardless of which persistence implementation is used within the Seam application. For entities not annotated with <literal>@Entity</literal>, it is necessary to explicitly configure the identifier strategy on the entity class itself, for example:"
-msgstr ""
+msgstr "Questa strategia di risoluzione è usata per generare valori di identificatori univoci per gli entity bean. Quello che fa è concatenare il nome dell'entità (o un nome configurato in altro modo) con una stringa che rappresenta la chiave primaria dell'entità. Le regole per generare la parte nome dell'identificatore sono simili a <literal>ClassIdentifierStrategy</literal>. La chiave primaria (cioè l'<emphasis>id</emphasis> dell'entità) viene ottenuto usando il componente <literal>PersistenceProvider</literal>, che è in grado di determinarne il valore a prescindere dall'implementazione della persistenza utilizzata dall'applicazione Seam. Per le entità non annotate con <literal>@Entity</literal> è necessario configurare esplicitamente la strategia di risoluzione dell'identificatore nella classe entità stessa, ad esempio:"
#. Tag: programlisting
#: Security.xml:3722
@@ -4729,7 +4729,7 @@
#: Security.xml:3724
#, no-c-format
msgid "For an example of the type of identifier values generated, assume we have the following entity class:"
-msgstr ""
+msgstr "Per avere un esempio del tipo di valori di identificatore generati, supponiamo di avere la seguente classe entità:"
#. Tag: programlisting
#: Security.xml:3728
@@ -4773,7 +4773,7 @@
#: Security.xml:3730
#, no-c-format
msgid "For a <literal>Customer</literal> instance with an <literal>id</literal> value of <literal>1</literal>, the value of the identifier would be \"<literal>Customer:1</literal>\". If the entity class is annotated with an explicit identifier name, like so:"
-msgstr ""
+msgstr "Per una istanza di <literal>Customer</literal> con un valore di <literal>id</literal> pari a <literal>1</literal>, il valore dell'identificatore sarà \"<literal>Customer:1</literal>\". Se l'entità è annotata con un nome esplicito di identificatore, come questo:"
#. Tag: programlisting
#: Security.xml:3736
@@ -4791,19 +4791,19 @@
#: Security.xml:3738
#, no-c-format
msgid "Then a <literal>Customer</literal> with an <literal>id</literal> value of <literal>123</literal> would have an identifier value of \"<literal>cust:123</literal>\"."
-msgstr ""
+msgstr "Allora un <literal>Customer</literal> con un <literal>id</literal> pari a <literal>123</literal> avrà come identificatore \"<literal>cust:123</literal>\"."
#. Tag: title
#: Security.xml:3751
#, no-c-format
msgid "Permission Management"
-msgstr ""
+msgstr "Gestione dei permessi"
#. Tag: para
#: Security.xml:3753
#, no-c-format
msgid "In much the same way that Seam Security provides an Identity Management API for the management of users and roles, it also provides a Permissions Management API for the management of persistent user permissions, via the <literal>PermissionManager</literal> component."
-msgstr ""
+msgstr "In modo del tutto simile a come la sicurezza di Seam fornisce una API per la gestione delle identità per gestire utenti e ruoli, essa fornisce anche una API per la gestione dei permessi, tramite il componente <literal>PermissionManager</literal>."
#. Tag: title
#: Security.xml:3760
@@ -4815,7 +4815,7 @@
#: Security.xml:3762
#, no-c-format
msgid "The <literal>PermissionManager</literal> component is an application-scoped Seam component that provides a number of methods for managing permissions. Before it can be used, it must be configured with a permission store (although by default it will attempt to use <literal>JpaPermissionStore</literal> if it is available). To explicitly configure a custom permission store, specify the <literal>permission-store</literal> property in components.xml:"
-msgstr ""
+msgstr "Il componente <literal>PermissionManager</literal> è un componente Seam registrato a livello application che fornisce una serie di metodi per gestire i permessi. Prima di poter essere usato deve essere configurato con un permission store (benché per default tenterà di usare il <literal>JpaPermissionStore</literal> se disponibile). Per configurare esplicitamente un permission store personalizzato, occore specificare la proprietà <literal>permission-store</literal> in components.xml:"
#. Tag: programlisting
#: Security.xml:3769
@@ -4833,20 +4833,20 @@
#: Security.xml:3771
#, no-c-format
msgid "The following table describes each of the available methods provided by <literal>PermissionManager</literal>:"
-msgstr ""
+msgstr "La seguente tabella descrive ciascuno dei metodi disponibili forniti da <literal>PermissionManager</literal>:"
#. Tag: title
#: Security.xml:3776
#, no-c-format
msgid "PermissionManager API methods"
-msgstr ""
+msgstr "Metodi della API PermissionManager"
#. Tag: para
#: Security.xml:3811
#: Security.xml:3830
#, no-c-format
msgid "Returns a list of <literal>Permission</literal> objects representing all of the permissions that have been granted for the specified target and action."
-msgstr ""
+msgstr "Restituisce un elenco di oggetti <literal>Permession</literal> che rappresenta tutti i permessi che sono stati concessi all'obiettivo e all'azione specificata."
#. Tag: literal
#: Security.xml:3845
@@ -4858,49 +4858,49 @@
#: Security.xml:3849
#, no-c-format
msgid "Persists (grants) the specified <literal>Permission</literal> to the backend permission store. Returns true if the operation was successful."
-msgstr ""
+msgstr "Memorizza (concede) il <literal>Permission</literal> specificato nel permission store sottostante. Restituisce true se l'operazione si è conclusa con esito positivo."
#. Tag: para
#: Security.xml:3868
#, no-c-format
msgid "Persists (grants) the specified list of <literal>Permission</literal>s to the backend permission store. Returns true if the operation was successful."
-msgstr ""
+msgstr "Memorizza (concede) l'elenco di <literal>Permission</literal> specificato nel permission store sottostante. Restiuisce true se l'operazione si è conclusa con esito positivo."
#. Tag: para
#: Security.xml:3887
#, no-c-format
msgid "Removes (revokes) the specified <literal>Permission</literal> from the backend permission store. Returns true if the operation was successful."
-msgstr ""
+msgstr "Rimuove (revoca) il <literal>Permission</literal> specificato dal permission store sottostante. Restituisce true se l'operazione si è conclusa con esito positivo."
#. Tag: para
#: Security.xml:3906
#, no-c-format
msgid "Removes (revokes) the specified list of <literal>Permission</literal>s from the backend permission store. Returns true if the operation was successful."
-msgstr ""
+msgstr "Rimuove (revoca) l'elenco di <literal>Permission</literal> specificato dal permission store sottostante. Restituisce true se l'operazione si è conclusa con esito positivo."
#. Tag: para
#: Security.xml:3925
#, no-c-format
msgid "Returns a list of the available actions for the specified target object. The actions that this method returns are dependent on the <literal>@Permission</literal> annotations configured on the target object's class."
-msgstr ""
+msgstr "Restituisce un elenco delle azioni disponibili per l'oggetto obiettivo specificato. Le azioni che questo metodo restituisce dipendono dall'annotazione <literal>@Permission</literal> configurata nella classe dell'oggetto obiettivo."
#. Tag: title
#: Security.xml:3940
#, no-c-format
msgid "Permission checks for PermissionManager operations"
-msgstr ""
+msgstr "Verifica dei permessi sulle operazioni di PermissionManager"
#. Tag: para
#: Security.xml:3942
#, no-c-format
msgid "Invoking the methods of <literal>PermissionManager</literal> requires that the currently-authenticated user has the appropriate authorization to perform that management operation. The following table lists the required permissions that the current user must have."
-msgstr ""
+msgstr "Per chiamare un metodo di <literal>PermissionManager</literal> è richiesto che l'utente correntemente autenticato abbia le autorizzazioni appropriate per eseguire quella operazione di gestione. La seguente tabella elenca i permessi richiesti che l'utente corrente deve avere."
#. Tag: title
#: Security.xml:3949
#, no-c-format
msgid "Permission Management Security Permissions"
-msgstr ""
+msgstr "Permessi per la gestione dei permessi"
#. Tag: literal
#: Security.xml:3973
@@ -4912,7 +4912,7 @@
#: Security.xml:3977
#, no-c-format
msgid "The specified <literal>target</literal>"
-msgstr ""
+msgstr "L'<literal>obiettivo</literal> specificato"
#. Tag: literal
#: Security.xml:3983
@@ -4931,7 +4931,7 @@
#: Security.xml:3995
#, no-c-format
msgid "The target of the specified <literal>Permission</literal>, or each of the targets for the specified list of <literal>Permission</literal>s (depending on which method is called)."
-msgstr ""
+msgstr "L'obiettivo del <literal>Permission</literal> specificato, oppure ciascuno degli obiettivi dell'elenco specificato di <literal>Permission</literal> (in funzione di quale metodo viene chiamato)."
#. Tag: literal
#: Security.xml:4003
@@ -4946,7 +4946,7 @@
#: Security.xml:4051
#, no-c-format
msgid "The target of the specified <literal>Permission</literal>."
-msgstr ""
+msgstr "L'obiettivo del <literal>Permission</literal> specificato."
#. Tag: literal
#: Security.xml:4029
@@ -4959,7 +4959,7 @@
#: Security.xml:4069
#, no-c-format
msgid "Each of the targets of the specified list of <literal>Permission</literal>s."
-msgstr ""
+msgstr "Ciascuno degli obiettivi dell'elenco di <literal>Permission</literal> specificato."
#. Tag: literal
#: Security.xml:4047
@@ -4984,13 +4984,13 @@
#: Security.xml:4088
#, no-c-format
msgid "SSL Security"
-msgstr "SSL Security"
+msgstr "Sicurezza SSL"
#. Tag: para
#: Security.xml:4090
#, no-c-format
msgid "Seam includes basic support for serving sensitive pages via the HTTPS protocol. This is easily configured by specifying a <literal>scheme</literal> for the page in <literal>pages.xml</literal>. The following example shows how the view <literal>/login.xhtml</literal> is configured to use HTTPS:"
-msgstr ""
+msgstr "Seam include un supporto di base per servire le pagine sensibili tramite il protocollo HTTPS. Si configura facilmente specificando uno <literal>scheme</literal> per la pagina in <literal>pages.xml</literal>. Il seguente esempio mostra come la pagina <literal>/login.xhtml</literal> è configurata per usare HTTPS:"
#. Tag: programlisting
#: Security.xml:4097
@@ -5002,7 +5002,7 @@
#: Security.xml:4099
#, no-c-format
msgid "This configuration is automatically extended to both <literal>s:link</literal> and <literal>s:button</literal> JSF controls, which (when specifying the <literal>view</literal>) will also render the link using the correct protocol. Based on the previous example, the following link will use the HTTPS protocol because <literal>/login.xhtml</literal> is configured to use it:"
-msgstr ""
+msgstr "Questa configurazione viene automaticamente estesa ai controlli JSF <literal>s:link</literal> e <literal>s:button</literal>, i quali (quando viene specificata la <literal>view</literal>) faranno in modo che venga prodotto il link usando il protocollo corretto. In base al precedente esempio, il seguente link userà il protocollo HTTPS, perché <literal>/login.xhtml</literal> è configurata per usarlo:"
#. Tag: programlisting
#: Security.xml:4106
@@ -5014,13 +5014,13 @@
#: Security.xml:4108
#, no-c-format
msgid "Browsing directly to a view when using the <emphasis>incorrect</emphasis> protocol will cause a redirect to the same view using the <emphasis>correct</emphasis> protocol. For example, browsing to a page that has <literal>scheme=\"https\"</literal> using HTTP will cause a redirect to the same page using HTTPS."
-msgstr ""
+msgstr "Navigando direttamente sulla pagina mentre si usa il protocollo <emphasis>non corretto</emphasis> causerà una redirezione alla stessa pagina usando il protocollo <emphasis>corretto</emphasis>. Ad esempio, navigando su una pagina che ha <literal>scheme=\"https\"</literal> usando HTTP causerà una redirezione alla stessa pagina usando HTTPS."
#. Tag: para
#: Security.xml:4115
#, no-c-format
msgid "It is also possible to configure a <emphasis>default scheme</emphasis> for all pages. This is useful if you wish to use HTTPS for a only few pages. If no default scheme is specified then the normal behavior is to continue use the current scheme. So once the user accessed a page that required HTTPS, then HTTPS would continue to be used after the user navigated away to other non-HTTPS pages. (While this is good for security, it is not so great for performance!). To define HTTP as the default <literal>scheme</literal>, add this line to <literal>pages.xml</literal>:"
-msgstr ""
+msgstr "E' anche possibile configurare un <emphasis>default scheme</emphasis> per tutte le pagine. Questo è utile se si vuole usare HTTPS solo per alcune pagine. Se non è indicato un default scheme, allora il comportamento normale è di continuare ad usare lo schema correntemente usato. Perciò una volta che l'utente ha fatto l'accesso ad una pagina che richiede HTTPS, allora HTTPS continuerà ad essere usato dopo che l'utente si sposta su altre pagine non HTTPS. (Mentre questo è buono per la sicurezza, non lo è per le prestazioni!). Per definire HTTP come <literal>default scheme</literal>, aggiungere questa riga a <literal>pages.xml</literal>:"
#. Tag: programlisting
#: Security.xml:4124
@@ -5032,13 +5032,13 @@
#: Security.xml:4126
#, no-c-format
msgid "Of course, if <emphasis>none</emphasis> of the pages in your application use HTTPS then it is not required to specify a default scheme."
-msgstr ""
+msgstr "Chiaramente, se <emphasis>nessuna</emphasis> delle pagine dell'applicazione usa HTTPS allora non è richiesto di specificare alcun default scheme."
#. Tag: para
#: Security.xml:4131
#, no-c-format
msgid "You may configure Seam to automatically invalidate the current HTTP session each time the scheme changes. Just add this line to <literal>components.xml</literal>:"
-msgstr ""
+msgstr "E' possibile configurare Seam per invalidare automaticamente la sessione HTTP ogni volta che lo schema cambia. Basta aggiungere questa riga a <literal>components.xml</literal>:"
#. Tag: programlisting
#: Security.xml:4136
@@ -5050,19 +5050,19 @@
#: Security.xml:4138
#, no-c-format
msgid "This option helps make your system less vulnerable to sniffing of the session id or leakage of sensitive data from pages using HTTPS to other pages using HTTP."
-msgstr ""
+msgstr "Questa opzione aiuta nel rendere il sistema meno vulnerabile alle intromissioni che rilevano l'id di sessione o alla mancanza di protezione su dati sensibili dalle pagine che usano HTTPS ad altre che usano HTTP."
#. Tag: title
#: Security.xml:4144
#, no-c-format
msgid "Overriding the default ports"
-msgstr ""
+msgstr "Modificare le porte di default"
#. Tag: para
#: Security.xml:4146
#, no-c-format
msgid "If you wish to configure the HTTP and HTTPS ports manually, they may be configured in <literal>pages.xml</literal> by specifying the <literal>http-port</literal> and <literal>https-port</literal> attributes on the <literal>pages</literal> element:"
-msgstr ""
+msgstr "Se si vogliono configurare manualmente le porte HTTP e HTTPS, queste possono essere configurate in <literal>pages.xml</literal> specificando gli attributi <literal>http-port</literal> e <literal>https-port</literal> nell'elemento <literal>pages</literal>:"
#. Tag: programlisting
#: Security.xml:4152
@@ -5098,19 +5098,19 @@
#: Security.xml:4160
#, no-c-format
msgid "Though strictly not part of the security API, Seam provides a built-in CAPTCHA (<emphasis>C</emphasis>ompletely <emphasis>A</emphasis>utomated <emphasis>P</emphasis>ublic <emphasis>T</emphasis>uring test to tell <emphasis>C</emphasis>omputers and <emphasis>H</emphasis>umans <emphasis>A</emphasis>part) algorithm to prevent automated processes from interacting with your application."
-msgstr ""
+msgstr "Sebbene non faccia strettamente parte delle API di sicurezza, Seam fornisce un algoritmo CAPTCHA (<emphasis>C</emphasis>ompletely <emphasis>A</emphasis>utomated <emphasis>P</emphasis>ublic <emphasis>T</emphasis>uring test to tell <emphasis>C</emphasis>omputer and <emphasis>H</emphasis>umans <emphasis>A</emphasis>part, test di Turing publico completamente automatico per distinguere gli umani dalle macchine) già fatto per prevenire l'interazione con l'applicazione da parte di procedure automatiche."
#. Tag: title
#: Security.xml:4168
#, no-c-format
msgid "Configuring the CAPTCHA Servlet"
-msgstr ""
+msgstr "Configurare la servlet CAPTCHA"
#. Tag: para
#: Security.xml:4169
#, no-c-format
msgid "To get up and running, it is necessary to configure the Seam Resource Servlet, which will provide the Captcha challenge images to your pages. This requires the following entry in <literal>web.xml</literal>:"
-msgstr ""
+msgstr "Per partire è necessario configurare la Seam Resource Servlet, che fornirà l'immagine CAPTCHA da risolvere nella pagina. Questo richiede la seguente voce in <literal>web.xml</literal>:"
#. Tag: programlisting
#: Security.xml:4174
@@ -5140,13 +5140,13 @@
#: Security.xml:4179
#, no-c-format
msgid "Adding a CAPTCHA to a form"
-msgstr ""
+msgstr "Aggiungere un CAPTCHA ad una form"
#. Tag: para
#: Security.xml:4181
#, no-c-format
msgid "Adding a CAPTCHA challenge to a form is extremely easy. Here's an example:"
-msgstr ""
+msgstr "Aggiungere una verifica CAPTCHA ad una form è estremamente facile. Ecco un esempio:"
#. Tag: programlisting
#: Security.xml:4185
@@ -5168,19 +5168,19 @@
#: Security.xml:4187
#, no-c-format
msgid "That's all there is to it. The <literal>graphicImage</literal> control displays the CAPTCHA challenge, and the <literal>inputText</literal> receives the user's response. The response is automatically validated against the CAPTCHA when the form is submitted."
-msgstr ""
+msgstr "Questo è tutto. Il controllo <literal>graphicImage</literal> mostra l'immagine CAPTCHA e <literal>inputText</literal> riceve la risposta dell'utente. La risposta viene automaticamente validata con il CAPTCHA quando la form viene inviata."
#. Tag: title
#: Security.xml:4196
#, no-c-format
msgid "Customising the CAPTCHA algorithm"
-msgstr ""
+msgstr "Personalizzare l'algoritmo CAPTCHA"
#. Tag: para
#: Security.xml:4198
#, no-c-format
msgid "You may customize the CAPTCHA algorithm by overriding the built-in component:"
-msgstr ""
+msgstr "E' possibile personalizzare l'algoritmo CAPTCHA sovrascrivendo il componente già fatto:"
#. Tag: programlisting
#: Security.xml:4202
@@ -5213,7 +5213,7 @@
" @Override @Create\n"
" public void init()\n"
" {\n"
-" setChallenge(\"What is the answer to life, the universe and everything?\");\n"
+" setChallenge(\"Qual è la risposta alla vita, all'universo e a tutto il resto?\");\n"
" setCorrectResponse(\"42\");\n"
" }\n"
"\n"
@@ -5221,7 +5221,7 @@
" public BufferedImage renderChallenge()\n"
" {\n"
" BufferedImage img = super.renderChallenge();\n"
-" img.getGraphics().drawOval(5, 3, 60, 14); //add an obscuring decoration\n"
+" img.getGraphics().drawOval(5, 3, 60, 14); //aggiungi qualche oscura decorazione\n"
" return img;\n"
" }\n"
"}]]>"
@@ -5231,19 +5231,19 @@
#: Security.xml:4217
#, no-c-format
msgid "Security Events"
-msgstr ""
+msgstr "Eventi della sicurezza"
#. Tag: para
#: Security.xml:4211
#, no-c-format
msgid "The following table describes a number of events (see <xref linkend=\"events\"/>) raised by Seam Security in response to certain security-related events."
-msgstr ""
+msgstr "La seguente tabella descrive una serie di eventi (vedi <xref linkend=\"events\"/>) lanciati dalla sicurezza di Seam in corrispondenza di determinati eventi relativi alla sicurezza."
#. Tag: para
#: Security.xml:4226
#, no-c-format
msgid "Event Key"
-msgstr ""
+msgstr "Nome dell'evento"
#. Tag: literal
#: Security.xml:4239
@@ -5255,7 +5255,7 @@
#: Security.xml:4243
#, no-c-format
msgid "Raised when a login attempt is successful."
-msgstr ""
+msgstr "Lanciato quando un tentativo di login è stato completato con esito positivo."
#. Tag: literal
#: Security.xml:4251
@@ -5267,7 +5267,7 @@
#: Security.xml:4255
#, no-c-format
msgid "Raised when a login attempt fails."
-msgstr ""
+msgstr "Lanciato quando un tentativo di login è fallito."
#. Tag: literal
#: Security.xml:4263
@@ -5279,7 +5279,7 @@
#: Security.xml:4267
#, no-c-format
msgid "Raised when a user that is already authenticated attempts to log in again."
-msgstr ""
+msgstr "Lanciato quando un utente che ha già fatto il login, tenta di fare il login di nuovo."
#. Tag: literal
#: Security.xml:4275
@@ -5291,7 +5291,7 @@
#: Security.xml:4279
#, no-c-format
msgid "Raised when a security check fails when the user is not logged in."
-msgstr ""
+msgstr "Lanciato quando una verifica di sicurezza fallisce in quanto l'utente non ha fatto il login."
#. Tag: literal
#: Security.xml:4287
@@ -5303,7 +5303,7 @@
#: Security.xml:4291
#, no-c-format
msgid "Raised when a security check fails when the user is logged in however doesn't have sufficient privileges."
-msgstr ""
+msgstr "Lanciato quando una verifica di sicurezza fallisce in quanto l'utente ha fatto il login ma non ha i privilegi richiesti."
#. Tag: literal
#: Security.xml:4299
@@ -5315,7 +5315,7 @@
#: Security.xml:4303
#, no-c-format
msgid "Raised just prior to user authentication."
-msgstr ""
+msgstr "Lanciato subito prima l'autenticazione dell'utente."
#. Tag: literal
#: Security.xml:4311
@@ -5327,7 +5327,7 @@
#: Security.xml:4315
#, no-c-format
msgid "Raised just after user authentication."
-msgstr ""
+msgstr "Lanciato subito dopo l'autenticazione dell'utente."
#. Tag: literal
#: Security.xml:4323
@@ -5339,7 +5339,7 @@
#: Security.xml:4327
#, no-c-format
msgid "Raised after the user has logged out."
-msgstr ""
+msgstr "Lanciato dopo che l'utente ha fatto un logout."
#. Tag: literal
#: Security.xml:4335
@@ -5351,7 +5351,7 @@
#: Security.xml:4339
#, no-c-format
msgid "Raised when the user's credentials have been changed."
-msgstr ""
+msgstr "Lanciato quando le credenziali dell'utente vengono cambiate."
#. Tag: literal
#: Security.xml:4347
@@ -5363,25 +5363,25 @@
#: Security.xml:4351
#, no-c-format
msgid "Raised when the Identity's rememberMe property is changed."
-msgstr ""
+msgstr "Lanciato quando la proprietà RememberMe di Identity viene modificata."
#. Tag: title
#: Security.xml:4364
#, no-c-format
msgid "Run As"
-msgstr ""
+msgstr "Run As"
#. Tag: para
#: Security.xml:4366
#, no-c-format
msgid "Sometimes it may be necessary to perform certain operations with elevated privileges, such as creating a new user account as an unauthenticated user. Seam Security supports such a mechanism via the <literal>RunAsOperation</literal> class. This class allows either the <literal>Principal</literal> or <literal>Subject</literal>, or the user's roles to be overridden for a single set of operations."
-msgstr ""
+msgstr "A volte può essere necessario eseguire determinate operazioni con dei privilegi più elevati, come creare un nuovo utente da parte di un utente non autenticato. La sicurezza di Seam gestisce un tale meccanismo tramite la classe <literal>RunAsOperation</literal>. Questa classe consente sia al <literal>Principal</literal> o al <literal>Subject</literal>, che ai ruoli dell'utente di essere sovrascritti per un singolo insieme di operazioni."
#. Tag: para
#: Security.xml:4374
#, no-c-format
msgid "The following code example demonstrates how <literal>RunAsOperation</literal> is used, by calling its <literal>addRole()</literal> method to provide a set of roles to masquerade as for the duration of the operation. The <literal>execute()</literal> method contains the code that will be executed with the elevated privileges."
-msgstr ""
+msgstr "Il seguente codice di esempio mostra come viene usato <literal>RunAsOperation</literal>, chiamando il suo metodo <literal>addRole()</literal> per fornire un insieme di ruoli fittizi solo per la durata dell'operazione. Il metodo <literal>execute()</literal> contiene il codice che verrà eseguito con i privilegi aggiuntivi."
#. Tag: programlisting
#: Security.xml:4381
@@ -5405,19 +5405,21 @@
#: Security.xml:4383
#, no-c-format
msgid "In a similar way, the <literal>getPrincipal()</literal> or <literal>getSubject()</literal> methods can also be overriden to specify the <literal>Principal</literal> and <literal>Subject</literal> instances to use for the duration of the operation. Finally, the <literal>run()</literal> method is used to carry out the <literal>RunAsOperation</literal>."
-msgstr ""
+msgstr "In modo analogo, i metodi <literal>getPrincipal()</literal> o <literal>getSubject()</literal> possono anch'essi essere sovrascritti per specificare le istanze di <literal>Principal</literal> e <literal>Subject</literal> da usare per la durata dell'operazione. Infine, il metodo <literal>run()</literal> è usato per eseguire la <literal>RunAsOperation</literal>."
#. Tag: title
#: Security.xml:4394
#, no-c-format
msgid "Extending the Identity component"
-msgstr ""
+msgstr "Estendere il componente Identity"
#. Tag: para
#: Security.xml:4396
#, no-c-format
msgid "Sometimes it might be necessary to extend the Identity component if your application has special security requirements. The following example (contrived, as credentials would normally be handled by the <literal>Credentials</literal> component instead) shows an extended Identity component with an additional <literal>companyCode</literal> field. The install precendence of <literal>APPLICATION</literal> ensures that this extended Identity gets installed in preference to the built-in Identity."
msgstr ""
+"A volte può essere necessario estendere il componente Identity se l'applicazione ha particolari requisiti di sicurezza. "
+"Il seguente esempio (fatto di proposito, dato che le credenziali sarebbero normalmente gestite dal componente <literal>Credentials</literal>) mostra un componente Identity esteso con un campo <literal>companyCode</literal> aggiuntivo. La precendenza di installazione impostata a <literal>APPLICATION</literal> assicura che questo Identity esteso venga installato al posto dell'Identity originale."
#. Tag: programlisting
#: Security.xml:4404
@@ -5485,7 +5487,7 @@
#: Security.xml:4407
#, no-c-format
msgid "Note that an <literal>Identity</literal> component must be marked <literal>@Startup</literal>, so that it is available immediately after the <literal>SESSION</literal> context begins. Failing to do this may render certain Seam functionality inoperable in your application."
-msgstr ""
+msgstr "Notare che un componente <literal>Identity</literal> deve essere marcato <literal>@Startup</literal>, in modo che sia disponibile immediatamente dopo l'inizio del contesto <literal>SESSION</literal>. La mancanza di questo dettaglio renderebbe non utilizzabili determinate funzionalità di Seam nell'applicazione."
#. Tag: title
#: Security.xml:4419
@@ -5497,37 +5499,37 @@
#: Security.xml:4421
#, no-c-format
msgid "OpenID is a community standard for external web-based authentication. The basic idea is that any web application can supplement (or replace) its local handling of authentication by delegating responsibility to an external OpenID server of the user's chosing. This benefits the user, who no longer has to remember a name and password for every web application he uses, and the developer, who is relieved of some of the burden of maintaining a complex authentication system."
-msgstr ""
+msgstr "OpenID è un standard comune per l'autenticazione esterna sul web. L'idea fondamentale è che qualsiasi applicazione web possa integrare (o sostituire) la sua gestione locale dell'autenticazione delegandone la responsabilità ad un server OpenID esterno scelto dall'utente. Questo va a beneficio dell'utente che non deve più ricordare un nome e una password per ogni applicazione web che usa, e dello sviluppatore, che viene sollevato di un po' di problemi nel manutenere un complesso sistema di autenticazione."
#. Tag: para
#: Security.xml:4430
#, no-c-format
msgid "When using OpenID, the user selects an OpenID provider, and the provider assigns the user an OpenID. The id will take the form of a URL, for example <literal>http://maximoburrito.myopenid.com</literal> however, it's acceptable to leave off the <literal>http://</literal> part of the identifier when logging into a site. The web application (known as a relying party in OpenID-speak) determines which OpenID server to contact and redirects the user to the remote site for authentication. Upon successful authentication the user is given the (cryptographically secure) token proving his identity and is redirected back to the original web application.The local web application can then be sure the user accessing the application controls the OpenID he presented."
-msgstr ""
+msgstr "Quando si usa OpenID, l'utente sceglie un fornitore OpenID, e il fornitore OpenID assegna all'utente un OpenID. Questo id prende la forma di un URL, ad esempio <literal>http://grandepizza.myopenid.com</literal>, comunque è accettabile trascurare la parte <literal>http://</literal> dell'identificativo quando si fa il login ad un sito. L'applicazione web (detta relying party in termini OpenID) determina quale server OpenID deve contattare e redirige l'utente a quel sito per l'autenticazione. Dopo essersi autenticato con esito positivo, all'utente viene fornito un codice (crittograficamente sicuro) che prova la sua identità e viene rediretto di nuovo all'applicazione web originale. L'applicazione web locale può essere quindi sicura che l'utente che sta accedendo è il proprietario dell'OpenID che aveva fornito."
#. Tag: para
#: Security.xml:4439
#, no-c-format
msgid "It's important to realize at this point that authentication does not imply authorization. The web application still needs to make a determination of how to use that information. The web application could treat the user as instantly logged in and give full access to the system or it could try and map the presented OpenID to a local user account, prompting the user to register if he hasn't already. The choice of how to handle the OpenID is left as a design decision for the local application."
-msgstr ""
+msgstr "E' importante rendersi conto, a questo punto, che l'autenticazione non implica l'autorizzazione. L'applicazione web ha ancora bisogno di fare delle determinazioni su come usare quell'informazione. L'applicazione web potrebbe trattare l'utente come immediatamente autenticato e dargli/le pieno accesso al sistema, oppure potrebbe tentare di associare l'OpenID fornito ad un utente locale, chiedendo all'utente di registrarsi se non l'ha già fatto. La scelta su come gestire l'OpenID è lasciata ad una decisione progettuale dell'applicazione locale."
#. Tag: title
#: Security.xml:4449
#, no-c-format
msgid "Configuring OpenID"
-msgstr ""
+msgstr "Configurare OpenID"
#. Tag: para
#: Security.xml:4450
#, no-c-format
msgid "Seam uses the openid4java package and requires four additional JARs to make use of the Seam integration. These are: <literal>htmlparser.jar</literal>, <literal>openid4java.jar</literal>, <literal>openxri-client.jar</literal> and <literal>openxri-syntax.jar</literal>."
-msgstr ""
+msgstr "Seam usa il pacchetto openid4java e richiede quattro JAR aggiuntivi per usare l'integrazione Seam. Essi sono: <literal>htmlparser.jar</literal>, <literal>openid4java.jar</literal>, <literal>openxri-client.jar</literal> e <literal>openxri-syntax.jar</literal>."
#. Tag: para
#: Security.xml:4456
#, no-c-format
msgid "OpenID processing requires the use of the <literal>OpenIdPhaseListener</literal>, which should be added to your <literal>faces-config.xml</literal> file. The phase listener processes the callback from the OpenID provider, allowing re-entry into the local application."
-msgstr ""
+msgstr "L'elaborazione di OpenID richiede l'uso di <literal>OpenIdPhaseListener</literal>, che deve essere aggiunto al file <literal>faces-config.xml</literal>. Il phase listener elabora le chiamate dal fornitore OpenID, consentendo di rientrare nell'applicazione locale."
#. Tag: programlisting
#: Security.xml:4462
@@ -5545,19 +5547,19 @@
#: Security.xml:4465
#, no-c-format
msgid "With this configuration, OpenID support is available to your application. The OpenID support component, <literal>org.jboss.seam.security.openid.openid</literal>, is installed automatically if the openid4java classes are on the classpath."
-msgstr ""
+msgstr "Con questa configurazione il supporto OpenID è disponibile nell'applicazione. Il componente per il supporto OpenID, <literal>org.jboss.seam.security.openid.openid</literal>, viene installato automaticamente se le classi openid4java sono nel classpath."
#. Tag: title
#: Security.xml:4473
#, no-c-format
msgid "Presenting an OpenIdDLogin form"
-msgstr ""
+msgstr "Persentare una form di login OpenID"
#. Tag: para
#: Security.xml:4475
#, no-c-format
msgid "To initiate an OpenID login, you can present a simply form to the user asking for the user's OpenID. The <literal>#{openid.id}</literal> value accepts the user's OpenID and the <literal>#{openid.login}</literal> action initiates an authentication request."
-msgstr ""
+msgstr "Per iniziare un login con OpenID occorre presentare una semplice form che chieda all'utente il suo OpenID. Il valore <literal>#{openid.id}</literal> accetta l'OpenID dell'utente e l'azione <literal>#{openid.login]</literal> inizia la richiesta di autenticazione."
#. Tag: programlisting
#: Security.xml:4480
@@ -5577,19 +5579,19 @@
#: Security.xml:4482
#, no-c-format
msgid "When the user submits the login form, he will be redirected to his OpenID provider. The user will eventually return to your application through the Seam pseudo-view <literal>/openid.xhtml</literal>, which is provided by the <literal>OpenIdPhaseListener</literal>. Your application can handle the OpenID response by means of a <literal>pages.xml</literal> navigation from that view, just as if the user had never left your application."
-msgstr ""
+msgstr "Quando l'utente invia la form di login, viene rediretto al suo fornitore OpenID. L'utente torna infine all'applicazione tramite la pseudo pagina Seam <literal>/openid.xhtml</literal>, che è fornita dal <literal>OpenIdPhaseListener</literal>. L'applicazione può gestire la risposta OpenID per mezzo della navigazione indicata in <literal>pages.xml</literal> per quella pagina, proprio come se l'utente non avesse mai lasciato l'applicazione."
#. Tag: title
#: Security.xml:4491
#, no-c-format
msgid "Logging in immediately"
-msgstr ""
+msgstr "Eseguire il login immediatamente"
#. Tag: para
#: Security.xml:4493
#, no-c-format
msgid "The simplest strategy is to simply login the user immediately. The following navigation rule shows how to handle this using the <literal>#{openid.loginImmediately()}</literal> action."
-msgstr ""
+msgstr "La strategia più semplice è di eseguire immediatamente il login dell'utente. La seguente regola di navigazione mostra come gestire questa modalità usando l'azione <literal>#{openid.loginImmediately()}</literal>."
#. Tag: programlisting
#: Security.xml:4497
@@ -5614,12 +5616,12 @@
" <navigation evaluate="#{openid.loginImmediately()}">\n"
" <rule if-outcome="true">\n"
" <redirect view-id="/main.xhtml">\n"
-" <message>OpenID login successful...</message>\n"
+" <message>OpenID login completato con esito positivo...</message>\n"
" </redirect>\n"
" </rule>\n"
" <rule if-outcome="false">\n"
" <redirect view-id="/main.xhtml">\n"
-" <message>OpenID login rejected...</message>\n"
+" <message>OpenID login rifiutato...</message>\n"
" </redirect>\n"
" </rule>\n"
" </navigation>\n"
@@ -5629,31 +5631,31 @@
#: Security.xml:4499
#, no-c-format
msgid "Thie <literal>loginImmediately()</literal> action checks to see if the OpenID is valid. If it is valid, it adds an OpenIDPrincipal to the identity component, marks the user as logged in (i.e. <literal>#{identity.loggedIn}</literal> will be true) and returns true. If the OpenID was not validated, the method returns false, and the user re-enters the application un-authenticated. If the user's OpenID is valid, it will be accessible using the expression <literal>#{openid.validatedId}</literal> and <literal>#{openid.valid}</literal> will be true."
-msgstr ""
+msgstr "L'azione <literal>loginImmediately()</literal> controlla per vedere se l'OpenID è valido. Se è valido, aggiunge un OpenIDPrincipal al componente identity, marca l'utente come loggedin (cioè <literal>#{identity.loggedIn}</literal> sarà true) e restituisce true. Se l'OpenID non è stato validato, il metodo restituisce false, e l'utente rientra nell'applicazione non autenticato. se l'OpenID dell'utente è valido, esso sarà accessibile usando l'espressione <literal>#{openid.validatedId}</literal> e <literal>#{openid.valid}</literal> sarà true."
#. Tag: title
#: Security.xml:4510
#, no-c-format
msgid "Deferring login"
-msgstr ""
+msgstr "Rimandare il login"
#. Tag: para
#: Security.xml:4512
#, no-c-format
msgid "You may not want the user to be immediately logged in to your application. In that case, your navigation should check the <literal>#{openid.valid}</literal> property and redirect the user to a local registration or processing page. Actions you might take would be asking for more information and creating a local user account or presenting a captcha to avoid programmatic registrations. When you are done processing, if you want to log the user in, you can call the <literal>loginImmediately</literal> method, either through EL as shown previously or by directly interaction with the <literal>org.jboss.seam.security.openid.OpenId</literal> component. Of course, nothing prevents you from writing custom code to interact with the Seam identity component on your own for even more customized behaviour."
-msgstr ""
+msgstr "Si può desiderare di non autenticare immediatamente l'utente nell'applicazione. In questo caso la navigazione dovrò controllare la proprietà <literal>#{openid.valid}</literal> e redirigere l'utente ad una pagina per la registrazione o l'elaborazione dell'utente. Le azioni che si possono prendere sono di chiedere maggiori informazioni e creare un utente locale, oppure presentare un CAPTCHA per evitare registrazioni da programmi automatici. Quando questa elaborazione è terminata, se si vuole autenticare l'utente è possibile chiamare il metodo <literal>loginImmediately</literal>, sia tramite EL come mostrato in precedenza, sia interagendo direttamento con il componente <literal>org.jboss.seam.security.openid.OpenId</literal>. Ovviamente niente impedisce di scrivere da soli del codice personalizzato per interagire con il componente Seam Identity per avere un comportamento più personalizzato."
#. Tag: title
#: Security.xml:4526
#, no-c-format
msgid "Logging out"
-msgstr ""
+msgstr "Log out"
#. Tag: para
#: Security.xml:4528
#, no-c-format
msgid "Logging out (forgetting an OpenID association) is done by calling <literal>#{openid.logout}</literal>. If you are not using Seam security, you can call this method directly. If you are using Seam security, you should continue to use <literal>#{identity.logout}</literal> and install an event handler to capture the logout event, calling the OpenID logout method."
-msgstr ""
+msgstr "Il log out (dimenticando l'associazione OpenID) viene fatto chiamando <literal>#{openid.logout}</literal>. Se non si sta usando la sicurezza Seam è possibile chiamare questo metodo direttamente. Se si sta usando la sicurezza Seam occorre continuare ad usare <literal>#{identity.logout}</literal> e installare un gestore di eventi per catturare l'evento logout, chiamando il metodo logout di OpenID."
#. Tag: programlisting
#: Security.xml:4535
@@ -5671,5 +5673,6 @@
#: Security.xml:4537
#, no-c-format
msgid "It's important that you do not leave this out or the user will not be able to login again in the same session."
-msgstr ""
+msgstr "E' importante non trascurare questo punto altrimenti l'utente non sarà più in grado di eseguire nuovamente il login nella stessa sessione."
+
15 years, 6 months