Seam SVN: r11017 - in branches/community/Seam_2_1/examples/wiki: src/main/org/jboss/seam/wiki/core/wikitext/renderer and 9 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2009-05-28 04:54:09 -0400 (Thu, 28 May 2009)
New Revision: 11017
Modified:
branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiLink.java
branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiTextParser.java
branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/DefaultWikiTextRenderer.java
branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/jsf/UIWikiFormattedText.java
branches/community/Seam_2_1/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/templates/blogDirectory.xhtml
branches/community/Seam_2_1/examples/wiki/view/docDisplay_m.xhtml
branches/community/Seam_2_1/examples/wiki/view/includes/admin/sessionManager.xhtml
branches/community/Seam_2_1/examples/wiki/view/includes/attachmentDisplay.xhtml
branches/community/Seam_2_1/examples/wiki/view/themes/default/js/lacewiki.js
branches/community/Seam_2_1/examples/wiki/view/themes/inrelationto/js/lacewiki.js
branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/css/sfwk.css
branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/js/lacewiki.js
Log:
JBSEAM-4199, minor wiki bugfixes
Modified: branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiLink.java
===================================================================
--- branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiLink.java 2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiLink.java 2009-05-28 08:54:09 UTC (rev 11017)
@@ -25,9 +25,6 @@
this.external = external;
}
- public int getIdentifier() { return identifier; }
- public void setIdentifier(int identifier) { this.identifier = identifier; }
-
public WikiFile getFile() { return file; }
public void setFile(WikiFile file) { this.file = file; }
Modified: branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiTextParser.java
===================================================================
--- branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiTextParser.java 2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiTextParser.java 2009-05-28 08:54:09 UTC (rev 11017)
@@ -38,7 +38,6 @@
public class WikiTextParser extends SeamTextParser {
private int macroPosition = 0;
- private int linkCounter = 0;
private WikiTextRenderer renderer;
@@ -130,9 +129,6 @@
WikiLink link = resolvedLinks.get((linkText));
if (link == null) return "";
- // Set an internal identifier, used for attachments and external links we later push into a hashmap into the contexts
- link.setIdentifier(linkCounter++);
-
// Override the description of the WikiLink with description found in tag
String finalDescriptionText =
(descriptionText!=null && descriptionText.length() > 0 ? descriptionText : link.getDescription());
Modified: branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/DefaultWikiTextRenderer.java
===================================================================
--- branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/DefaultWikiTextRenderer.java 2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/DefaultWikiTextRenderer.java 2009-05-28 08:54:09 UTC (rev 11017)
@@ -1,6 +1,5 @@
package org.jboss.seam.wiki.core.wikitext.renderer;
-import org.jboss.seam.wiki.core.wikitext.renderer.WikiTextRenderer;
import org.jboss.seam.wiki.core.wikitext.engine.WikiLink;
import org.jboss.seam.wiki.core.model.WikiTextMacro;
import org.jboss.seam.wiki.core.ui.WikiURLRenderer;
@@ -89,7 +88,6 @@
+ "</h4>";
}
-
public String renderOrderedListOpenTag() {
return "<ol class=\"wikiOrderedList\">\n";
}
Modified: branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/jsf/UIWikiFormattedText.java
===================================================================
--- branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/jsf/UIWikiFormattedText.java 2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/jsf/UIWikiFormattedText.java 2009-05-28 08:54:09 UTC (rev 11017)
@@ -226,32 +226,39 @@
@Override
public void setAttachmentLinks(List<WikiLink> attachmentLinks) {
// Put attachments (wiki links...) into the event context for later rendering
- setLinks("wikiTextAttachments", attachmentLinks);
+ String contextVariable = "attachmentLinksByWikiFile";
+
+ // We need to key them by WikiFile identifier, so we put a map in the context
+ Map<Long, List<WikiLink>> linksByFile;
+ if ((linksByFile = (Map)Contexts.getEventContext().get(contextVariable)) == null) {
+ linksByFile = new HashMap();
+ }
+
+ // This method may be called multiple times when we render a "base file", e.g. header, content, footer, comments
+ List<WikiLink> linksForBaseFile;
+ if ((linksForBaseFile = linksByFile.get(baseFile.getId())) != null) {
+ // Aggregate all links for a base file, don't reset them on each render pass for the same base file
+ linksForBaseFile.addAll(attachmentLinks);
+ } else {
+ linksForBaseFile = attachmentLinks;
+ }
+
+ linksByFile.put(baseFile.getId(), linksForBaseFile);
+
+ Contexts.getEventContext().set(contextVariable, linksByFile);
}
@Override
public void setExternalLinks(List<WikiLink> externalLinks) {
// Put external links (to targets not on this wiki) into the event context for later rendering
- setLinks("wikiTextExternalLinks", externalLinks);
- }
-
- private void setLinks(String contextVariable, List<WikiLink> links) {
- // TODO: Need some tricks here with link identifiers and attachment numbers, right now we just skip this if it's already set
- /// ... hoping that the first caller was the document renderer and not the comment renderer - that means comment attachments are broken
+ // TODO: This is actually never used anywhere... nobody is rendering a list of "external links"
+ // We COULD use this to render a list of links in a print view (like coWiki)
+ /*
+ String contextVariable = "wikiTextExternalLinks";
List<WikiLink> contextLinks = (List<WikiLink>)Contexts.getEventContext().get(contextVariable);
if (contextLinks == null || contextLinks.size()==0) {
- Contexts.getEventContext().set(contextVariable, links);
+ Contexts.getEventContext().set(contextVariable, externalLinks);
}
- /*
- Map<Integer, WikiLink> contextLinks =
- (Map<Integer,WikiLink>)Contexts.getEventContext().get(contextVariable);
- if (contextLinks == null) {
- contextLinks = new HashMap<Integer, WikiLink>();
- }
- for (WikiLink link : links) {
- contextLinks.put(link.getIdentifier(), link);
- }
- Contexts.getEventContext().set(contextVariable, contextLinks);
*/
}
Modified: branches/community/Seam_2_1/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/templates/blogDirectory.xhtml
===================================================================
--- branches/community/Seam_2_1/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/templates/blogDirectory.xhtml 2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/templates/blogDirectory.xhtml 2009-05-28 08:54:09 UTC (rev 11017)
@@ -91,11 +91,11 @@
</h:outputLink>
</s:div>
<s:div styleClass="blogEntryAttachmentsLink undecoratedLink"
- rendered="#{wiki:sizeOf(wikiTextAttachments) > 0}">
+ rendered="#{wiki:sizeOf(attachmentLinksByWikiFile[blogEntry.entryDocument.id]) > 0}">
<h:outputLink value="#{wikiURLRenderer.renderPermURL(blogEntry.entryDocument)}#attachments" target="_top">
<span class="blogEntryAttachmentsLinkText">
- <h:outputText value="#{wiki:sizeOf(wikiTextAttachments)} "/>
- <h:outputText value="#{wiki:sizeOf(wikiTextAttachments)>1
+ <h:outputText value="#{wiki:sizeOf(attachmentLinksByWikiFile[blogEntry.entryDocument.id])} "/>
+ <h:outputText value="#{wiki:sizeOf(attachmentLinksByWikiFile[blogEntry.entryDocument.id])>1
? messages['blog.directory.label.Attachments']
: messages['blog.directory.label.Attachment']}"/>
</span>
Modified: branches/community/Seam_2_1/examples/wiki/view/docDisplay_m.xhtml
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/docDisplay_m.xhtml 2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/docDisplay_m.xhtml 2009-05-28 08:54:09 UTC (rev 11017)
@@ -151,13 +151,13 @@
</s:div>
- <s:div styleClass="box" rendered="#{wikiTextAttachments.size() > 0}">
+ <s:div styleClass="box" rendered="#{wiki:sizeOf(attachmentLinksByWikiFile[documentHome.instance.id]) > 0}">
<h3>
<h:outputText value="#{messages['lacewiki.label.attachmentDisplay.Attachments']}:"/>
</h3>
- <h:dataTable value="#{wikiTextAttachments}" var="link"
+ <h:dataTable value="#{attachmentLinksByWikiFile[documentHome.instance.id]}" var="link"
id="attachmentTable"
rowClasses="rowOdd,rowEven">
<h:column>
Modified: branches/community/Seam_2_1/examples/wiki/view/includes/admin/sessionManager.xhtml
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/includes/admin/sessionManager.xhtml 2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/includes/admin/sessionManager.xhtml 2009-05-28 08:54:09 UTC (rev 11017)
@@ -122,6 +122,8 @@
<h:outputText value="User"/>
</f:facet>
<h:outputText value="#{wikiHttpSessionManager.getUsername(s.id)}"/>
+ <br/>
+ <h:outputText value="[ID: #{s.id}]"/>
</h:column>
<h:column>
Modified: branches/community/Seam_2_1/examples/wiki/view/includes/attachmentDisplay.xhtml
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/includes/attachmentDisplay.xhtml 2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/includes/attachmentDisplay.xhtml 2009-05-28 08:54:09 UTC (rev 11017)
@@ -1,5 +1,5 @@
<s:div styleClass="attachmentDisplay box"
- rendered="#{wikiTextAttachments.size() > 0}"
+ rendered="#{wiki:sizeOf(attachmentLinksByWikiFile[documentHome.instance.id]) > 0}"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
@@ -7,7 +7,7 @@
xmlns:a="https://ajax4jsf.dev.java.net/ajax"
xmlns:s="http://jboss.com/products/seam/taglib">
- <h:dataTable value="#{wikiTextAttachments}" var="link"
+ <h:dataTable value="#{attachmentLinksByWikiFile[documentHome.instance.id]}" var="link"
id="attachmentTable"
styleClass="datatable rightBorder leftBorder topBorder bottomBorder"
headerClass="regularHeader alignLeft"
Modified: branches/community/Seam_2_1/examples/wiki/view/themes/default/js/lacewiki.js
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/themes/default/js/lacewiki.js 2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/themes/default/js/lacewiki.js 2009-05-28 08:54:09 UTC (rev 11017)
@@ -99,8 +99,8 @@
var prefix = formatString.substring(0, formatString.indexOf(inline ? inlinePlaceholder : blockPlaceholder));
var suffix = formatString.substring(formatString.indexOf(inline ? inlinePlaceholder : blockPlaceholder)+3, formatString.length);
if (block) {
- prefix = "\n" + prefix;
- suffix = suffix + "\n";
+ prefix = "\n\n" + prefix;
+ suffix = suffix + "\n\n";
}
if (typeof(textArea.caretPos) != "undefined" && textArea.createTextRange) {
Modified: branches/community/Seam_2_1/examples/wiki/view/themes/inrelationto/js/lacewiki.js
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/themes/inrelationto/js/lacewiki.js 2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/themes/inrelationto/js/lacewiki.js 2009-05-28 08:54:09 UTC (rev 11017)
@@ -99,8 +99,8 @@
var prefix = formatString.substring(0, formatString.indexOf(inline ? inlinePlaceholder : blockPlaceholder));
var suffix = formatString.substring(formatString.indexOf(inline ? inlinePlaceholder : blockPlaceholder)+3, formatString.length);
if (block) {
- prefix = "\n" + prefix;
- suffix = suffix + "\n";
+ prefix = "\n\n" + prefix;
+ suffix = suffix + "\n\n";
}
if (typeof(textArea.caretPos) != "undefined" && textArea.createTextRange) {
Modified: branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/css/sfwk.css
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2009-05-28 08:54:09 UTC (rev 11017)
@@ -122,6 +122,7 @@
font-family: Andale Mono, Courier New, monospace;
font-size: 90%;
overflow-x: auto;
+ max-width: 950px;
}
/* ---- Fonts ----- */
Modified: branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/js/lacewiki.js
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/js/lacewiki.js 2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/js/lacewiki.js 2009-05-28 08:54:09 UTC (rev 11017)
@@ -99,8 +99,8 @@
var prefix = formatString.substring(0, formatString.indexOf(inline ? inlinePlaceholder : blockPlaceholder));
var suffix = formatString.substring(formatString.indexOf(inline ? inlinePlaceholder : blockPlaceholder)+3, formatString.length);
if (block) {
- prefix = "\n" + prefix;
- suffix = suffix + "\n";
+ prefix = "\n\n" + prefix;
+ suffix = suffix + "\n\n";
}
if (typeof(textArea.caretPos) != "undefined" && textArea.createTextRange) {
15 years, 6 months
Seam SVN: r11016 - in modules/trunk: resources and 24 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-27 16:44:49 -0400 (Wed, 27 May 2009)
New Revision: 11016
Added:
modules/trunk/resources/
modules/trunk/resources/pom.xml
modules/trunk/resources/src/
modules/trunk/resources/src/main/
modules/trunk/resources/src/main/java/
modules/trunk/resources/src/main/java/org/
modules/trunk/resources/src/main/java/org/jboss/
modules/trunk/resources/src/main/java/org/jboss/seam/
modules/trunk/resources/src/main/java/org/jboss/seam/resources/
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
modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoadingException.java
modules/trunk/resources/src/main/resources/
modules/trunk/resources/src/main/resources/META-INF/
modules/trunk/resources/src/main/resources/META-INF/beans.xml
modules/trunk/resources/src/test/
modules/trunk/resources/src/test/java/
modules/trunk/resources/src/test/java/org/
modules/trunk/resources/src/test/java/org/jboss/
modules/trunk/resources/src/test/java/org/jboss/seam/
modules/trunk/resources/src/test/java/org/jboss/seam/resources/
modules/trunk/resources/src/test/java/org/jboss/seam/resources/DefaultResourceLoaderTest.java
modules/trunk/resources/src/test/resources/
modules/trunk/resources/src/test/resources/org/
modules/trunk/resources/src/test/resources/org/jboss/
modules/trunk/resources/src/test/resources/org/jboss/testharness/
modules/trunk/resources/src/test/resources/org/jboss/testharness/impl/
modules/trunk/resources/src/test/resources/org/jboss/testharness/impl/packaging/
modules/trunk/resources/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/
modules/trunk/resources/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/
modules/trunk/resources/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/beans.xml
Modified:
modules/trunk/version-matrix/pom.xml
Log:
add a resources module
Property changes on: modules/trunk/resources
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
attic
target
temp-testng-customsuite.xml
test-output
Added: modules/trunk/resources/pom.xml
===================================================================
--- modules/trunk/resources/pom.xml (rev 0)
+++ modules/trunk/resources/pom.xml 2009-05-27 20:44:49 UTC (rev 11016)
@@ -0,0 +1,58 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>seam-parent</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>seam-resources</artifactId>
+ <packaging>jar</packaging>
+ <version>3.0.0-SNAPSHOT</version>
+ <name>Seam Resources Module</name>
+ <description>A shared module which provides services for loading resources from the classpath.</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-beans</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>jsr299-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logging</artifactId>
+ <!-- assumes use of Web Beans impl -->
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <!--
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>src/test/resources/unit-test-suite.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ </configuration>
+ </plugin>
+ -->
+
+ </plugins>
+ </build>
+
+</project>
Added: modules/trunk/resources/src/main/java/org/jboss/seam/resources/DefaultResourceLoader.java
===================================================================
--- modules/trunk/resources/src/main/java/org/jboss/seam/resources/DefaultResourceLoader.java (rev 0)
+++ modules/trunk/resources/src/main/java/org/jboss/seam/resources/DefaultResourceLoader.java 2009-05-27 20:44:49 UTC (rev 11016)
@@ -0,0 +1,245 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.seam.resources;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+
+import org.jboss.seam.beans.Default;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ * A simple resource loader.
+ *
+ * Uses {@link DefaultResourceLoader}'s classloader if the Thread Context
+ * Classloader isn't available
+ *
+ * @author Pete Muir
+ */
+public
+@Default
+class DefaultResourceLoader implements ResourceLoader
+{
+ private static final LogProvider log = Logging.getLogProvider(DefaultResourceLoader.class);
+
+ public Class<?> getClassForName(String name)
+ {
+ try
+ {
+ if (Thread.currentThread().getContextClassLoader() != null)
+ {
+ return Thread.currentThread().getContextClassLoader().loadClass(name);
+ }
+ else
+ {
+ return Class.forName(name);
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new ResourceLoadingException(e);
+ }
+ catch (NoClassDefFoundError e)
+ {
+ throw new ResourceLoadingException(e);
+ }
+ }
+
+ /**
+ * 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 = loadBundleInternal(bundleName);
+ log.debug("loaded resource bundle: " + bundleName);
+ return bundle;
+ }
+ catch (MissingResourceException mre)
+ {
+ log.debug("resource bundle missing: " + bundleName);
+ return null;
+ }
+ }
+
+ public URL getResource(String name)
+ {
+ return getResourceInternal(toAbsolutePath(name), toRelativePath(name));
+ }
+
+ public InputStream getResourceAsStream(String name)
+ {
+ return getResourceAsStreamInternal(toAbsolutePath(name), toRelativePath(name));
+ }
+
+ public Iterable<URL> getResources(String name)
+ {
+ try
+ {
+ return new EnumerationIterable<URL>(getResourcesInternal(toAbsolutePath(name), toRelativePath(name)));
+ }
+ catch (IOException e)
+ {
+ throw new ResourceLoadingException(e);
+ }
+ }
+
+ protected java.util.ResourceBundle loadBundleInternal(String bundleName)
+ {
+ return java.util.ResourceBundle.getBundle(bundleName, Locale.getDefault(), Thread.currentThread().getContextClassLoader());
+ }
+
+ protected InputStream getResourceAsStreamInternal(String absolutePath, 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(absolutePath);
+ if (stream != null)
+ {
+ log.debug("Loaded resource from Seam classloader: " + absolutePath);
+ return stream;
+ }
+
+ stream = getClass().getClassLoader().getResourceAsStream(relativePath);
+ if (stream != null)
+ {
+ log.debug("Loaded resource from Seam classloader: " + relativePath);
+ return stream;
+ }
+
+ return stream;
+ }
+
+ protected URL getResourceInternal(String absolutePath, 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(absolutePath);
+ if (url != null)
+ {
+ log.debug("Loaded resource from " + getClass() + " classloader: " + url);
+ return url;
+ }
+
+ url = getClass().getClassLoader().getResource(relativePath);
+ if (url != null)
+ {
+ log.debug("Loaded resource from " + getClass() + " classloader: " + url);
+ return url;
+ }
+
+ return url;
+ }
+
+
+ protected Enumeration<URL> getResourcesInternal(String absolutePath, String relativePath) throws IOException
+ {
+ Enumeration<URL> urls = null;
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ if (classLoader != null)
+ {
+ urls = classLoader.getResources(relativePath);
+ if (urls != null && urls.hasMoreElements())
+ {
+ log.debug("Loaded resources from context classloader: " + urls);
+ return urls;
+ }
+ }
+
+ urls = getClass().getClassLoader().getResources(relativePath);
+ if (urls != null)
+ {
+ log.debug("Loaded resources from " + getClass() + " classloader: " + urls);
+ return urls;
+ }
+
+ return urls;
+ }
+
+ protected String toAbsolutePath(String name)
+ {
+ return name.startsWith("/") ? name : "/" + name;
+ }
+
+ protected String toRelativePath(String name)
+ {
+ return name.startsWith("/") ? name.substring(1) : name;
+ }
+
+ private class EnumerationIterable<T> implements Iterable<T>
+ {
+ // The enumeration as a list
+ private final List<T> list = new ArrayList<T>();
+
+ /**
+ * Constructor
+ *
+ * @param enumeration The enumeration
+ */
+ public EnumerationIterable(Enumeration<T> enumeration)
+ {
+ while (enumeration.hasMoreElements())
+ {
+ list.add(enumeration.nextElement());
+ }
+ }
+
+ /**
+ * Gets an iterator
+ *
+ * @return The iterator
+ */
+ public Iterator<T> iterator()
+ {
+ return Collections.unmodifiableList(list).iterator();
+ }
+ }
+}
Added: modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoader.java
===================================================================
--- modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoader.java (rev 0)
+++ modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoader.java 2009-05-27 20:44:49 UTC (rev 11016)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.seam.resources;
+
+import java.net.URL;
+
+/**
+ * Resource loading/class creation services for Seam. By default an
+ * implementation which uses the Thread Context ClassLoader if available,
+ * otherwise the classloading of the implementation is used
+ *
+ * @author Pete Muir
+ */
+public interface ResourceLoader
+{
+ /**
+ * Creates a class from a given FQCN
+ *
+ * @param name The name of the clsas
+ * @return The class
+ */
+ public Class<?> getClassForName(String name);
+
+ /**
+ * Gets a resource as a URL by name
+ *
+ * @param name The name of the resource
+ * @return An URL to the resource
+ */
+ public URL getResource(String name);
+
+ /**
+ * Gets resources as URLs by name
+ *
+ * @param name The name of the resource
+ * @return An iterable reference to the URLS
+ */
+ public Iterable<URL> getResources(String name);
+
+}
Added: modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoaderProducer.java
===================================================================
--- modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoaderProducer.java (rev 0)
+++ modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoaderProducer.java 2009-05-27 20:44:49 UTC (rev 11016)
@@ -0,0 +1,36 @@
+package org.jboss.seam.resources;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Initializer;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.seam.beans.RuntimeBeanSelector;
+
+public
+@ApplicationScoped
+class ResourceLoaderProducer extends RuntimeBeanSelector<ResourceLoader>
+{
+ ResourceLoaderProducer() {}
+
+ public @Initializer ResourceLoaderProducer(BeanManager manager)
+ {
+ super(manager);
+ }
+
+ @Override
+ public Class<ResourceLoader> getType()
+ {
+ return ResourceLoader.class;
+ }
+
+ @Override
+ public
+ @Produces
+ //@RequestScoped
+ ResourceLoader selectImplementation()
+ {
+ return super.selectImplementation();
+ }
+
+}
Added: modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoadingException.java
===================================================================
--- modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoadingException.java (rev 0)
+++ modules/trunk/resources/src/main/java/org/jboss/seam/resources/ResourceLoadingException.java 2009-05-27 20:44:49 UTC (rev 11016)
@@ -0,0 +1,56 @@
+/**
+ *
+ */
+package org.jboss.seam.resources;
+
+import javax.inject.ExecutionException;
+
+/**
+ * Exception thrown when errors occur while loading resource
+ *
+ * @author Pete Muir
+ */
+public class ResourceLoadingException extends ExecutionException
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor
+ */
+ public ResourceLoadingException()
+ {
+ super();
+ }
+
+ /**
+ * Constructor
+ *
+ * @param message The message
+ * @param throwable The exception
+ */
+ public ResourceLoadingException(String message, Throwable throwable)
+ {
+ super(message, throwable);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param message The message
+ */
+ public ResourceLoadingException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param throwable The exception
+ */
+ public ResourceLoadingException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+}
\ No newline at end of file
Added: modules/trunk/resources/src/main/resources/META-INF/beans.xml
===================================================================
Added: modules/trunk/resources/src/test/java/org/jboss/seam/resources/DefaultResourceLoaderTest.java
===================================================================
--- modules/trunk/resources/src/test/java/org/jboss/seam/resources/DefaultResourceLoaderTest.java (rev 0)
+++ modules/trunk/resources/src/test/java/org/jboss/seam/resources/DefaultResourceLoaderTest.java 2009-05-27 20:44:49 UTC (rev 11016)
@@ -0,0 +1,45 @@
+package org.jboss.seam.resources;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.JSR299ArtifactDescriptor;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+@Artifact
+public class DefaultResourceLoaderTest extends AbstractWebBeansTest
+{
+ @Test
+ public void testGetClassForName()
+ {
+ assertSame(DefaultResourceLoader.class, getResourceLoaderInstance().getClassForName(DefaultResourceLoader.class.getName()));
+ }
+
+ @Test
+ public void testGetResourceFromRelativePath()
+ {
+ URL beansXml = getResourceLoaderInstance().getResource(JSR299ArtifactDescriptor.STANDARD_BEANS_XML_FILE_NAME);
+ assertNotNull(beansXml);
+ assertTrue(beansXml.toString().endsWith(JSR299ArtifactDescriptor.STANDARD_BEANS_XML_FILE_NAME));
+ }
+
+ @Test
+ public void testGetResourceFromAbsolutePath()
+ {
+ URL beansXml = getResourceLoaderInstance().getResource("/" + JSR299ArtifactDescriptor.STANDARD_BEANS_XML_FILE_NAME);
+ assertNotNull(beansXml);
+ assertTrue(beansXml.toString().endsWith(JSR299ArtifactDescriptor.STANDARD_BEANS_XML_FILE_NAME));
+ }
+
+ private ResourceLoader getResourceLoaderInstance()
+ {
+ ResourceLoader resourceLoader = getCurrentManager().getInstanceByType(ResourceLoader.class);
+ assertNotNull(resourceLoader);
+ return resourceLoader;
+ }
+}
Added: modules/trunk/resources/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/beans.xml
===================================================================
Modified: modules/trunk/version-matrix/pom.xml
===================================================================
--- modules/trunk/version-matrix/pom.xml 2009-05-27 13:30:16 UTC (rev 11015)
+++ modules/trunk/version-matrix/pom.xml 2009-05-27 20:44:49 UTC (rev 11016)
@@ -306,6 +306,12 @@
<artifactId>seam-security</artifactId>
<version>${seam.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-resources</artifactId>
+ <version>${seam.version}</version>
+ </dependency>
<dependency>
<groupId>${seam.groupId}</groupId>
15 years, 6 months
Seam SVN: r11015 - in branches/community/Seam_2_1: examples and 1 other directory.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2009-05-27 09:30:16 -0400 (Wed, 27 May 2009)
New Revision: 11015
Modified:
branches/community/Seam_2_1/build.xml
branches/community/Seam_2_1/examples/readme.txt
Log:
adding Seam Tasks example to dist
Modified: branches/community/Seam_2_1/build.xml
===================================================================
--- branches/community/Seam_2_1/build.xml 2009-05-27 08:25:44 UTC (rev 11014)
+++ branches/community/Seam_2_1/build.xml 2009-05-27 13:30:16 UTC (rev 11015)
@@ -463,6 +463,7 @@
<cleanexample name="nestedbooking" />
<cleanexample name="wicket" />
<cleanexample name="guice" />
+ <cleanexample name="tasks" />
</target>
<target name="undeployexamples" description="Undeploy all examples">
@@ -499,6 +500,7 @@
<undeployexample name="nestedbooking" />
<undeployexample name="wicket" />
<undeployexample name="guice" />
+ <undeployexample name="tasks" />
</target>
<target name="testexamples" description="Run the example tests">
@@ -568,6 +570,7 @@
<ant dir="examples/seamdiscs" target="validateConfiguration" inheritall="false" />
<!--<ant dir="examples/seampay" target="validateConfiguration" inheritall="false" />-->
<ant dir="examples/seamspace" target="validateConfiguration" inheritall="false" />
+ <ant dir="examples/tasks" target="validateConfiguration" inheritall="false" />
<ant dir="examples/todo" target="validateConfiguration" inheritall="false" />
<ant dir="examples/ui" target="validateConfiguration" inheritall="false" />
<ant dir="examples/wicket" target="validateConfiguration" inheritall="false" />
@@ -680,6 +683,7 @@
<include name="drools/**/*" />
<include name="nestedbooking/**/*" />
<include name="metawidget/**/*" />
+ <include name="tasks/**/*" />
<include name="wicket/**/*" />
<include name="remoting/chatroom/**/*" />
<include name="remoting/helloworld/**/*" />
Modified: branches/community/Seam_2_1/examples/readme.txt
===================================================================
--- branches/community/Seam_2_1/examples/readme.txt 2009-05-27 08:25:44 UTC (rev 11014)
+++ branches/community/Seam_2_1/examples/readme.txt 2009-05-27 13:30:16 UTC (rev 11015)
@@ -86,6 +86,8 @@
spring/ Demonstrates Spring framework integration.
+tasks/ Demonstrates RESTEasy integration.
+
todo/ The Seam todo list example demonstrating
jBPM business process management.
15 years, 6 months
Seam SVN: r11014 - in branches/community/Seam_2_1: src/resteasy/org/jboss/seam/resteasy/testfwk and 1 other directory.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2009-05-27 04:25:44 -0400 (Wed, 27 May 2009)
New Revision: 11014
Modified:
branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Webservices.xml
branches/community/Seam_2_1/src/resteasy/org/jboss/seam/resteasy/testfwk/ResourceSeamTest.java
Log:
Documented latest REST features
Modified: branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Webservices.xml
===================================================================
--- branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Webservices.xml 2009-05-27 04:54:23 UTC (rev 11013)
+++ branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Webservices.xml 2009-05-27 08:25:44 UTC (rev 11014)
@@ -426,19 +426,49 @@
<para>
An instance of <literal>customerResource</literal> is now handled by Seam when a request hits the
server. This is a Seam JavaBean component that is <literal>EVENT</literal>-scoped, hence no different
- than the default JAX-RS lifecycle. You get full Seam injection support and all other Seam
+ than the default JAX-RS lifecycle. You get full Seam injection and interception support, and all other Seam
components and contexts are available to you. Currently also supported are <literal>APPLICATION</literal>
- and <literal>STATELESS</literal> resource Seam components. These scopes allow you to create an effectively
+ and <literal>STATELESS</literal> resource Seam components. These three scopes allow you to create an effectively
stateless Seam middle-tier HTTP request-processing application.
</para>
<para>
+ You can annotate an interface and keep the implementation free from JAX-RS annotations:
+ </para>
+
+ <programlisting role="JAVA"><![CDATA[@Path("/customer")
+public interface MyCustomerResource {
+
+ @GET
+ @Path("/{customerId}")
+ @Produces("text/plain")
+ public String getCustomer(@PathParam("customerId") int id);
+
+}]]></programlisting>
+
+ <programlisting role="JAVA"><![CDATA[@Name("customerResource")
+(a)Scope(ScopeType.STATELESS)
+public class MyCustomerResourceBean implements MyCustomerResource {
+
+ @In
+ CustomerDAO customerDAO;
+
+ public String getCustomer(int id) {
+ return customerDAO.find(id).getName();
+ }
+
+}]]></programlisting>
+
+ <para>
You can use <literal>SESSION</literal>-scoped Seam components. By default, the session will however be shortened
to a single request. In other words, when an HTTP request is being processed by the RESTEasy integration code,
an HTTP session will be created so that Seam components can utilize that context. When the request has
been processed, Seam will look at the session and decide if the session was created only to serve that
single request (no session identifier has been provided with the request, or no session existed for the request).
If the session has been created only to serve this request, the session will be destroyed after the request!
+ </para>
+
+ <para>
Assuming that your Seam application only uses event, application, or stateless components, this procedure
prevents exhaustion of available HTTP sessions on the server. The RESTEasy integration with Seam assumes
by default that sessions are not used, hence anemic sessions would add up as every REST request would start
@@ -453,7 +483,7 @@
<programlisting role="XML"><![CDATA[<resteasy:application destroy-session-after-request="false"/>]]></programlisting>
<para>
- Every RESTful HTTP request will now create a new session that will only be removed by timeout or explicit
+ Every REST HTTP request will now create a new session that will only be removed by timeout or explicit
invalidation in your code through <literal>Session.instance().invalidate()</literal>.
It is your responsibility to pass a valid session identifier along with your HTTP requests, if you want
to utilize the session context across requests.
@@ -465,18 +495,42 @@
</para>
<para>
- EJB Seam components are currently <emphasis>NOT</emphasis> supported! However, as explained above, you
- can map plain stateless EJBs (with no Seam lifecycle or injection) as REST resources.
+ EJB Seam components are supported. Always annotate the local business interface, not the EJB implementation
+ class, with JAX-RS annotations. The EJB has to be <literal>STATELESS</literal>.
</para>
<para>
- Provider classes can also be Seam components, currently only <literal>APPLICATION</literal>-scoped
- provider components are supported.
+ Provider classes can also be Seam components, only <literal>APPLICATION</literal>-scoped
+ provider components are supported. You can annotate the bean interface or implementation with JAX-RS annotations.
+ EJB Seam components as providers are currently <emphasis>NOT</emphasis> supported, only POJOs!
</para>
</sect2>
<sect2>
+ <title>Securing resources</title>
+
+ <para>
+ You can enable the Seam authentication filter for HTTP Basic and Digest authentication in
+ <literal>components.xml</literal>:
+ </para>
+
+ <programlisting role="XML"><![CDATA[<web:authentication-filter url-pattern="/seam/resource/rest/*" auth-type="basic"/>]]></programlisting>
+
+ <para>
+ See the Seam security chapter on how to write an authentication routine.
+ </para>
+
+ <para>
+ After successful authentication, authorization rules with the common
+ <literal>@Restrict</literal> and <literal>@PermissionCheck</literal> annotations are in effect. You can
+ also access the client <literal>Identity</literal>, work with permission mapping, and so on. All
+ regular Seam security features for authorization are available.
+ </para>
+
+ </sect2>
+
+ <sect2>
<title>Mapping exceptions to HTTP responses</title>
<para>
@@ -541,6 +595,77 @@
</sect2>
+ <sect2>
+ <title>Testing resources and providers</title>
+
+ <para>
+ Seam includes an extended unit testing superclass that helps you in creating unit tests for a RESTful
+ architecture. Extend the <literal>ResourceSeamTest</literal> class to emulate HTTP requests/response cycles:
+ </para>
+
+ <programlisting role="JAVA"><![CDATA[import org.jboss.seam.resteasy.testfwk.ResourceSeamTest;
+import org.jboss.seam.resteasy.testfwk.MockHttpServletResponse;
+import org.jboss.seam.resteasy.testfwk.MockHttpServletRequest;
+
+public class MyTest extends ResourceSeamTest {
+
+ @Override
+ public Map<String, Object> getDefaultHeaders()
+ {
+ return new HashMap<String, Object>()
+ {{
+ put("Accept", "text/plain");
+ }};
+ }
+
+ @Test
+ public void test() throws Exception
+ {
+ new ResourceRequest(Method.GET, "/my/relative/uri)
+ {
+
+ @Override
+ protected void prepareRequest(MockHttpServletRequest request)
+ {
+ request.addQueryParameter("foo", "123");
+ request.addHeader("Accept-Language", "en_US, de");
+ }
+
+ @Override
+ protected void onResponse(MockHttpServletResponse response)
+ {
+ assert response.getStatus() == 200;
+ assert response.getContentAsString().equals("foobar");
+ }
+
+ }.run();
+ }
+
+}]]></programlisting>
+
+ <para>
+ This test only executes local calls, it does not communicate with the <literal>SeamResourceServlet</literal>
+ through TCP. The mock request is passed through the Seam servlet and filters and the response is then
+ available for test assertions. Overriding the <literal>getDefaultHeaders()</literal> method allows you
+ to set request headers for every test method in the test class.
+ </para>
+
+ <para>
+ Note that a <literal>ResourceRequest</literal> has to be executed in a <literal>@Test</literal> method
+ or in a <literal>@BeforeMethod</literal> callback. You can and should not execute it in any other callback,
+ such as <literal>@BeforeClass</literal>. (This is an implementation limitation we will remove in a future
+ update.)
+ </para>
+
+ <para>
+ Also note that the imported mock objects are not the same as the mock objects you use in other Seam unit
+ tests, which are in the package <literal>org.jboss.seam.mock</literal>. The
+ <literal>org.jboss.seam.resteasy.testfwk</literal> variations mimic real requests and responses much
+ more closely.
+ </para>
+
+ </sect2>
+
</sect1>
</chapter>
Modified: branches/community/Seam_2_1/src/resteasy/org/jboss/seam/resteasy/testfwk/ResourceSeamTest.java
===================================================================
--- branches/community/Seam_2_1/src/resteasy/org/jboss/seam/resteasy/testfwk/ResourceSeamTest.java 2009-05-27 04:54:23 UTC (rev 11013)
+++ branches/community/Seam_2_1/src/resteasy/org/jboss/seam/resteasy/testfwk/ResourceSeamTest.java 2009-05-27 08:25:44 UTC (rev 11014)
@@ -22,12 +22,6 @@
* public class MyTest extends ResourceSeamTest {
*
* @Override
- * public String getServletPath()
- * {
- * return "/seam/resource/.../is/not/my/web.xml/configured/path/for/SeamResourceServlet";
- * }
- *
- * @Override
* public Map<String, Object> getDefaultHeaders()
* {
* return new HashMap<String, Object>()
15 years, 6 months
Seam SVN: r11013 - in modules/trunk: international/src/main/java/org/jboss/seam/international and 1 other directory.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-27 00:54:23 -0400 (Wed, 27 May 2009)
New Revision: 11013
Added:
modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesDelegate.java
Removed:
modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesWrapper.java
Modified:
modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesMessages.java
Log:
rename wrapper to delegate
Modified: 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-27 04:22:02 UTC (rev 11012)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesMessages.java 2009-05-27 04:54:23 UTC (rev 11013)
@@ -11,7 +11,7 @@
import org.jboss.seam.international.StatusMessage;
import org.jboss.seam.international.StatusMessages;
-import org.jboss.seam.international.StatusMessagesWrapper;
+import org.jboss.seam.international.StatusMessagesDelegate;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -57,7 +57,7 @@
*/
public
@Faces
-class FacesMessages extends StatusMessagesWrapper
+class FacesMessages extends StatusMessagesDelegate
{
private static final LogProvider log = Logging.getLogProvider(FacesMessages.class);
@@ -111,7 +111,7 @@
@Override
public void onBeforeRender()
{
- getStatusMessages().onBeforeRender();
+ super.onBeforeRender();
FacesContext facesContext = FacesContext.getCurrentInstance();
for (StatusMessage statusMessage : getGlobalMessages())
{
Copied: modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesDelegate.java (from rev 11012, modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesWrapper.java)
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesDelegate.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesDelegate.java 2009-05-27 04:54:23 UTC (rev 11013)
@@ -0,0 +1,184 @@
+package org.jboss.seam.international;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.validation.ConstraintViolation;
+
+import org.jboss.seam.international.StatusMessage.Severity;
+
+/**
+ * A abstract wrapper class that delegates all operations to the StatusMessages
+ * instance. It's up to the implementation to provide access to the
+ * StatusMessages instance, preferably obtained through constructor injection.
+ * The intent is for this class to be extended to wrap view layer specific
+ * functionality around the StatusMessages component.
+ *
+ * @author Dan Allen
+ */
+public abstract class StatusMessagesDelegate extends StatusMessages
+{
+ public abstract StatusMessages getStatusMessages();
+
+ @Override
+ public void onBeforeRender()
+ {
+ getStatusMessages().onBeforeRender();
+ }
+
+ @Override
+ public void add(ConstraintViolation<?> cv)
+ {
+ getStatusMessages().add(cv);
+ }
+
+ @Override
+ public void add(ConstraintViolation<?>[] cvs)
+ {
+ getStatusMessages().add(cvs);
+ }
+
+ @Override
+ public void add(Severity severity, String messageTemplate, Object... params)
+ {
+ getStatusMessages().add(severity, messageTemplate, params);
+ }
+
+ @Override
+ public void add(Severity severity, String key, String detailKey, String messageTemplate, String messageDetailTemplate, Object... params)
+ {
+ getStatusMessages().add(severity, key, detailKey, messageTemplate, messageDetailTemplate, params);
+ }
+
+ @Override
+ public void add(String messageTemplate, Object... params)
+ {
+ getStatusMessages().add(messageTemplate, params);
+ }
+
+ @Override
+ public void addFromResourceBundle(Severity severity, String key, Object... params)
+ {
+ getStatusMessages().addFromResourceBundle(severity, key, params);
+ }
+
+ @Override
+ public void addFromResourceBundle(String key, Object... params)
+ {
+ getStatusMessages().addFromResourceBundle(key, params);
+ }
+
+ @Override
+ public void addFromResourceBundleOrDefault(Severity severity, String key, String defaultMessageTemplate, Object... params)
+ {
+ getStatusMessages().addFromResourceBundleOrDefault(severity, key, defaultMessageTemplate, params);
+ }
+
+ @Override
+ public void addFromResourceBundleOrDefault(String key, String defaultMessageTemplate, Object... params)
+ {
+ getStatusMessages().addFromResourceBundleOrDefault(key, defaultMessageTemplate, params);
+ }
+
+ @Override
+ public void addToControl(ConstraintViolation<?> cv)
+ {
+ getStatusMessages().addToControl(cv);
+ }
+
+ @Override
+ public void addToControl(String id, ConstraintViolation<?> cv)
+ {
+ getStatusMessages().addToControl(id, cv);
+ }
+
+ @Override
+ public void addToControl(String id, Severity severity, String messageTemplate, Object... params)
+ {
+ getStatusMessages().addToControl(id, severity, messageTemplate, params);
+ }
+
+ @Override
+ public void addToControl(String id, Severity severity, String key, String messageTemplate, Object... params)
+ {
+ getStatusMessages().addToControl(id, severity, key, messageTemplate, params);
+ }
+
+ @Override
+ public void addToControl(String id, String messageTemplate, Object... params)
+ {
+ getStatusMessages().addToControl(id, messageTemplate, params);
+ }
+
+ @Override
+ public void addToControlFromResourceBundle(String id, Severity severity, String key, Object... params)
+ {
+ getStatusMessages().addToControlFromResourceBundle(id, severity, key, params);
+ }
+
+ @Override
+ public void addToControlFromResourceBundle(String id, String key, Object... params)
+ {
+ getStatusMessages().addToControlFromResourceBundle(id, key, params);
+ }
+
+ @Override
+ public void addToControlFromResourceBundleOrDefault(String id, Severity severity, String key, String defaultMessageTemplate, Object... params)
+ {
+ getStatusMessages().addToControlFromResourceBundleOrDefault(id, severity, key, defaultMessageTemplate, params);
+ }
+
+ @Override
+ public void addToControlFromResourceBundleOrDefault(String id, String key, String defaultMessageTemplate, Object... params)
+ {
+ getStatusMessages().addToControlFromResourceBundleOrDefault(id, key, defaultMessageTemplate, params);
+ }
+
+ @Override
+ public void addToControls(ConstraintViolation<?>[] cvs)
+ {
+ getStatusMessages().addToControls(cvs);
+ }
+
+ @Override
+ public void clear()
+ {
+ getStatusMessages().clear();
+ }
+
+ @Override
+ public void clearGlobalMessages()
+ {
+ getStatusMessages().clearGlobalMessages();
+ }
+
+ @Override
+ public void clearKeyedMessages()
+ {
+ getStatusMessages().clearKeyedMessages();
+ }
+
+ @Override
+ public void clearKeyedMessages(String id)
+ {
+ getStatusMessages().clearKeyedMessages(id);
+ }
+
+ @Override
+ public List<StatusMessage> getGlobalMessages()
+ {
+ return getStatusMessages().getGlobalMessages();
+ }
+
+ @Override
+ public Map<String, List<StatusMessage>> getKeyedMessages()
+ {
+ return getStatusMessages().getKeyedMessages();
+ }
+
+ @Override
+ public List<StatusMessage> getKeyedMessages(String id)
+ {
+ return getStatusMessages().getKeyedMessages(id);
+ }
+}
Deleted: modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesWrapper.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesWrapper.java 2009-05-27 04:22:02 UTC (rev 11012)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesWrapper.java 2009-05-27 04:54:23 UTC (rev 11013)
@@ -1,181 +0,0 @@
-package org.jboss.seam.international;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.validation.ConstraintViolation;
-
-import org.jboss.seam.international.StatusMessage.Severity;
-
-/**
- * A abstract wrapper class that delegates all operations to the StatusMessages
- * instance. It's up to the implementation to provide access to the
- * StatusMessages instance, preferably obtained through constructor injection.
- * The intent is for this class to be extended to wrap view layer specific
- * functionality around the StatusMessages component.
- *
- * @author Dan Allen
- */
-public abstract class StatusMessagesWrapper extends StatusMessages
-{
- public abstract StatusMessages getStatusMessages();
-
- @Override
- public abstract void onBeforeRender();
-
- @Override
- public void add(ConstraintViolation<?> cv)
- {
- getStatusMessages().add(cv);
- }
-
- @Override
- public void add(ConstraintViolation<?>[] cvs)
- {
- getStatusMessages().add(cvs);
- }
-
- @Override
- public void add(Severity severity, String messageTemplate, Object... params)
- {
- getStatusMessages().add(severity, messageTemplate, params);
- }
-
- @Override
- public void add(Severity severity, String key, String detailKey, String messageTemplate, String messageDetailTemplate, Object... params)
- {
- getStatusMessages().add(severity, key, detailKey, messageTemplate, messageDetailTemplate, params);
- }
-
- @Override
- public void add(String messageTemplate, Object... params)
- {
- getStatusMessages().add(messageTemplate, params);
- }
-
- @Override
- public void addFromResourceBundle(Severity severity, String key, Object... params)
- {
- getStatusMessages().addFromResourceBundle(severity, key, params);
- }
-
- @Override
- public void addFromResourceBundle(String key, Object... params)
- {
- getStatusMessages().addFromResourceBundle(key, params);
- }
-
- @Override
- public void addFromResourceBundleOrDefault(Severity severity, String key, String defaultMessageTemplate, Object... params)
- {
- getStatusMessages().addFromResourceBundleOrDefault(severity, key, defaultMessageTemplate, params);
- }
-
- @Override
- public void addFromResourceBundleOrDefault(String key, String defaultMessageTemplate, Object... params)
- {
- getStatusMessages().addFromResourceBundleOrDefault(key, defaultMessageTemplate, params);
- }
-
- @Override
- public void addToControl(ConstraintViolation<?> cv)
- {
- getStatusMessages().addToControl(cv);
- }
-
- @Override
- public void addToControl(String id, ConstraintViolation<?> cv)
- {
- getStatusMessages().addToControl(id, cv);
- }
-
- @Override
- public void addToControl(String id, Severity severity, String messageTemplate, Object... params)
- {
- getStatusMessages().addToControl(id, severity, messageTemplate, params);
- }
-
- @Override
- public void addToControl(String id, Severity severity, String key, String messageTemplate, Object... params)
- {
- getStatusMessages().addToControl(id, severity, key, messageTemplate, params);
- }
-
- @Override
- public void addToControl(String id, String messageTemplate, Object... params)
- {
- getStatusMessages().addToControl(id, messageTemplate, params);
- }
-
- @Override
- public void addToControlFromResourceBundle(String id, Severity severity, String key, Object... params)
- {
- getStatusMessages().addToControlFromResourceBundle(id, severity, key, params);
- }
-
- @Override
- public void addToControlFromResourceBundle(String id, String key, Object... params)
- {
- getStatusMessages().addToControlFromResourceBundle(id, key, params);
- }
-
- @Override
- public void addToControlFromResourceBundleOrDefault(String id, Severity severity, String key, String defaultMessageTemplate, Object... params)
- {
- getStatusMessages().addToControlFromResourceBundleOrDefault(id, severity, key, defaultMessageTemplate, params);
- }
-
- @Override
- public void addToControlFromResourceBundleOrDefault(String id, String key, String defaultMessageTemplate, Object... params)
- {
- getStatusMessages().addToControlFromResourceBundleOrDefault(id, key, defaultMessageTemplate, params);
- }
-
- @Override
- public void addToControls(ConstraintViolation<?>[] cvs)
- {
- getStatusMessages().addToControls(cvs);
- }
-
- @Override
- public void clear()
- {
- getStatusMessages().clear();
- }
-
- @Override
- public void clearGlobalMessages()
- {
- getStatusMessages().clearGlobalMessages();
- }
-
- @Override
- public void clearKeyedMessages()
- {
- getStatusMessages().clearKeyedMessages();
- }
-
- @Override
- public void clearKeyedMessages(String id)
- {
- getStatusMessages().clearKeyedMessages(id);
- }
-
- @Override
- public List<StatusMessage> getGlobalMessages()
- {
- return getStatusMessages().getGlobalMessages();
- }
-
- @Override
- public Map<String, List<StatusMessage>> getKeyedMessages()
- {
- return getStatusMessages().getKeyedMessages();
- }
-
- @Override
- public List<StatusMessage> getKeyedMessages(String id)
- {
- return getStatusMessages().getKeyedMessages(id);
- }
-}
15 years, 6 months
Seam SVN: r11012 - in modules/trunk: beans and 29 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-27 00:22:02 -0400 (Wed, 27 May 2009)
New Revision: 11012
Added:
modules/trunk/beans/
modules/trunk/beans/pom.xml
modules/trunk/beans/src/
modules/trunk/beans/src/main/
modules/trunk/beans/src/main/java/
modules/trunk/beans/src/main/java/org/
modules/trunk/beans/src/main/java/org/jboss/
modules/trunk/beans/src/main/java/org/jboss/seam/
modules/trunk/beans/src/main/java/org/jboss/seam/beans/
modules/trunk/beans/src/main/java/org/jboss/seam/beans/Default.java
modules/trunk/beans/src/main/java/org/jboss/seam/beans/RuntimeBeanSelector.java
modules/trunk/beans/src/main/java/org/jboss/seam/beans/RuntimeSelected.java
modules/trunk/beans/src/main/java/org/jboss/seam/beans/RuntimeSelectedBean.java
modules/trunk/beans/src/main/resources/
modules/trunk/beans/src/main/resources/META-INF/
modules/trunk/beans/src/main/resources/META-INF/beans.xml
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/el/src/test/resources/org/
modules/trunk/el/src/test/resources/org/jboss/
modules/trunk/el/src/test/resources/org/jboss/testharness/
modules/trunk/el/src/test/resources/org/jboss/testharness/impl/
modules/trunk/el/src/test/resources/org/jboss/testharness/impl/packaging/
modules/trunk/el/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/
modules/trunk/el/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/
modules/trunk/el/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/beans.xml
modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesMessages.java
modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesMessagesTest.java
modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesWrapper.java
Removed:
modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesStatusMessages.java
modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesStatusMessagesTest.java
modules/trunk/faces/src/test/resources/org/jboss/seam/
Modified:
modules/trunk/el/
modules/trunk/el/pom.xml
modules/trunk/el/src/main/java/org/jboss/seam/el/Expressions.java
modules/trunk/faces/pom.xml
modules/trunk/faces/src/main/java/org/jboss/seam/faces/Faces.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesExpressions.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/application/SeamViewHandler.java
modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesExpressionsTest.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/StatusMessagesTest.java
modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesUnitTest.java
modules/trunk/parent/pom.xml
modules/trunk/version-matrix/pom.xml
Log:
implement runtime selection of Expressions type
use a delegation-based specialization strategy for StatusMessages
Property changes on: modules/trunk/beans
___________________________________________________________________
Name: svn:ignore
+ target
.classpath
.project
.settings
Added: modules/trunk/beans/pom.xml
===================================================================
--- modules/trunk/beans/pom.xml (rev 0)
+++ modules/trunk/beans/pom.xml 2009-05-27 04:22:02 UTC (rev 11012)
@@ -0,0 +1,53 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>seam-parent</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>seam-beans</artifactId>
+ <packaging>jar</packaging>
+ <version>3.0.0-SNAPSHOT</version>
+ <name>Seam Beans Module</name>
+ <description>A support module for performing bean resolution, such as runtime selection of a bean based on active framework.</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>jsr299-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logging</artifactId>
+ <!-- assumes use of Web Beans impl -->
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <!--
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>src/test/resources/unit-test-suite.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ </configuration>
+ </plugin>
+ -->
+
+ </plugins>
+ </build>
+
+</project>
Added: modules/trunk/beans/src/main/java/org/jboss/seam/beans/Default.java
===================================================================
--- modules/trunk/beans/src/main/java/org/jboss/seam/beans/Default.java (rev 0)
+++ modules/trunk/beans/src/main/java/org/jboss/seam/beans/Default.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -0,0 +1,31 @@
+package org.jboss.seam.beans;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+/**
+ * A binding type for the default implementation. This binding
+ * type is placed on the default implementation and a producer
+ * is responsible for selecting this type in the case that
+ * no other types are defined. Note that this binding type
+ * is not inherited, since it should resolve to exactly
+ * one bean and thus explicitly stated.
+ *
+ * @author Dan Allen
+ */
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+public @interface Default
+{
+}
Added: modules/trunk/beans/src/main/java/org/jboss/seam/beans/RuntimeBeanSelector.java
===================================================================
--- modules/trunk/beans/src/main/java/org/jboss/seam/beans/RuntimeBeanSelector.java (rev 0)
+++ modules/trunk/beans/src/main/java/org/jboss/seam/beans/RuntimeBeanSelector.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -0,0 +1,72 @@
+package org.jboss.seam.beans;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.AmbiguousResolutionException;
+import javax.enterprise.inject.AnnotationLiteral;
+import javax.enterprise.inject.Initializer;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+public
+abstract
+class RuntimeBeanSelector<T>
+{
+ private BeanManager manager;
+
+ private T defaultInstance;
+
+ private List<T> instances = new ArrayList<T>();
+
+ public RuntimeBeanSelector() {}
+
+ public @Initializer
+ RuntimeBeanSelector(BeanManager manager)
+ {
+ this.manager = manager;
+ registerImplementations();
+ }
+
+ public abstract Class<T> getType();
+
+ public T selectImplementation()
+ {
+ List<T> selected = new ArrayList<T>();
+ for (T candidate : instances)
+ {
+ if (((RuntimeSelectedBean) candidate).isActive())
+ {
+ selected.add(candidate);
+ }
+ }
+
+ if (selected.size() == 0)
+ {
+ return defaultInstance;
+ }
+ else if (selected.size() == 1)
+ {
+ return selected.iterator().next();
+ }
+ else
+ {
+ throw new AmbiguousResolutionException("Too many instances active for type " + getType().getTypeParameters()[0]);
+ }
+ }
+
+ protected void registerImplementations()
+ {
+ defaultInstance = manager.getInstanceByType(getType(), new AnnotationLiteral<Default>() {});
+
+ Set<Bean<T>> implementations = manager.getBeans(getType(), new AnnotationLiteral<RuntimeSelected>() {});
+ for (Bean<T> candidate : implementations)
+ {
+ if (candidate.getTypes().contains(RuntimeSelectedBean.class))
+ {
+ instances.add(manager.getInstance(candidate));
+ }
+ }
+ }
+}
Added: modules/trunk/beans/src/main/java/org/jboss/seam/beans/RuntimeSelected.java
===================================================================
--- modules/trunk/beans/src/main/java/org/jboss/seam/beans/RuntimeSelected.java (rev 0)
+++ modules/trunk/beans/src/main/java/org/jboss/seam/beans/RuntimeSelected.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -0,0 +1,28 @@
+package org.jboss.seam.beans;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+/**
+ * A binding type which marks one of any number of
+ * bean implementations that can be selected at
+ * runtime. The first bean which indicates that
+ * it is active is selected.
+ *
+ * @author Dan Allen
+ */
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+public @interface RuntimeSelected
+{
+}
Added: modules/trunk/beans/src/main/java/org/jboss/seam/beans/RuntimeSelectedBean.java
===================================================================
--- modules/trunk/beans/src/main/java/org/jboss/seam/beans/RuntimeSelectedBean.java (rev 0)
+++ modules/trunk/beans/src/main/java/org/jboss/seam/beans/RuntimeSelectedBean.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -0,0 +1,21 @@
+package org.jboss.seam.beans;
+
+/**
+ * An interface which indicates that the instance of this bean class that is
+ * appropriate for the current thread is selected at runtime. This allows
+ * for an implementation to be matched with the framework serving the
+ * request (e.g., JSF, Wicket, etc).
+ *
+ * @author Dan Allen
+ */
+public interface RuntimeSelectedBean
+{
+ /**
+ * Report whether this implementation is active for the current thread. If
+ * the implementation is annotated with @Default and no other implementation
+ * is active, this instance will still be selected.
+ *
+ * @return Whether the implementation is active for the current thread
+ */
+ public boolean isActive();
+}
Added: modules/trunk/beans/src/main/resources/META-INF/beans.xml
===================================================================
Property changes on: modules/trunk/el
___________________________________________________________________
Name: svn:ignore
- .classpath
.project
.settings
nb-configuration.xml
target
+ .classpath
.project
.settings
attic
nb-configuration.xml
target
temp-testng-customsuite.xml
test-output
Modified: modules/trunk/el/pom.xml
===================================================================
--- modules/trunk/el/pom.xml 2009-05-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/el/pom.xml 2009-05-27 04:22:02 UTC (rev 11012)
@@ -59,6 +59,11 @@
<artifactId>jboss-el</artifactId>
</dependency>
+ <dependency>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-beans</artifactId>
+ </dependency>
+
</dependencies>
</project>
Modified: modules/trunk/el/src/main/java/org/jboss/seam/el/Expressions.java
===================================================================
--- modules/trunk/el/src/main/java/org/jboss/seam/el/Expressions.java 2009-05-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/el/src/main/java/org/jboss/seam/el/Expressions.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -27,8 +27,9 @@
import javax.el.ELContext;
import javax.el.ExpressionFactory;
-import javax.enterprise.context.ApplicationScoped;
+import org.jboss.seam.beans.Default;
+
/**
* Factory for EL method and value expressions.
*
@@ -37,7 +38,7 @@
* @author Gavin King
*/
public
-@ApplicationScoped
+@Default
class Expressions implements Serializable
{
private static final long serialVersionUID = 7420955152664486125L;
@@ -49,13 +50,14 @@
{
return SeamExpressionFactory.INSTANCE;
}
-
+
/**
- * Get an appropriate ELContext. If there is an active JSF request,
- * use JSF's ELContext. Otherwise, use one that we create.
+ * Get an appropriate ELContext. If there is an active JSF request, use JSF's
+ * ELContext. Otherwise, use one that we create.
*/
- public ELContext getELContext() {
- return SeamEL.createELContext();
+ public ELContext getELContext()
+ {
+ return SeamEL.createELContext();
}
/**
@@ -67,7 +69,7 @@
{
return createValueExpression(expression, Object.class);
}
-
+
/**
* Create a method expression.
*
@@ -77,9 +79,10 @@
{
return createMethodExpression(expression, Object.class);
}
-
+
/**
- * Get the value of a unified ValueExpression, coercing it to the expected type.
+ * Get the value of a unified ValueExpression, coercing it to the expected
+ * type.
*
* @param expression a unified ValueExpression
* @param type the expected value type
@@ -91,7 +94,7 @@
{
return (T) expression.getValue(getELContext());
}
-
+
/**
* Inspect the unified ValueExpression and return the value's expected type.
*
@@ -114,22 +117,24 @@
{
expression.setValue(getELContext(), value);
}
-
+
/**
- * Invoke the unified MethodExpression, coercing the result to the expected return type.
+ * Invoke the unified MethodExpression, coercing the result to the expected
+ * return type.
*
* @param expression a unified MethodExpression
* @param returnType the expected return type
* @param args method arguments
*
- * @return the return value of the underlying method represented by the unified MethodExpression
+ * @return the return value of the underlying method represented by the
+ * unified MethodExpression
*/
@SuppressWarnings("unchecked")
public <T> T invoke(javax.el.MethodExpression expression, Class<T> returnType, Object... args)
{
return (T) expression.invoke(getELContext(), args);
}
-
+
/**
* Create a value expression.
*
@@ -138,63 +143,51 @@
*/
public <T> ValueExpression<T> createValueExpression(final String expression, final Class<T> type)
{
-
+
return new ValueExpression<T>()
{
- private javax.el.ValueExpression facesValueExpression;
- private javax.el.ValueExpression seamValueExpression;
-
+ private javax.el.ValueExpression unifiedValueExpression;
+
public javax.el.ValueExpression toUnifiedValueExpression()
{
- if ( isFacesContextActive() )
+ if (unifiedValueExpression == null)
{
- if (facesValueExpression==null)
- {
- facesValueExpression = createExpression();
- }
- return facesValueExpression;
+ unifiedValueExpression = createExpression();
}
- else
- {
- if (seamValueExpression==null)
- {
- seamValueExpression = createExpression();
- }
- return seamValueExpression;
- }
+ return unifiedValueExpression;
}
-
+
private javax.el.ValueExpression createExpression()
{
- return getExpressionFactory().createValueExpression( getELContext(), expression, type );
+ return getExpressionFactory().createValueExpression(getELContext(), expression, type);
}
-
+
@SuppressWarnings("unchecked")
public T getValue()
{
- return (T) toUnifiedValueExpression().getValue( getELContext() );
+ return (T) toUnifiedValueExpression().getValue(getELContext());
}
- public void setValue(T value)
+ public void setValue(T value)
{
- toUnifiedValueExpression().setValue( getELContext(), value );
+ toUnifiedValueExpression().setValue(getELContext(), value);
}
-
+
public String getExpressionString()
{
return expression;
}
-
+
@SuppressWarnings("unchecked")
public Class<T> getType()
{
// QUESTION shouldn't we use the type provided in the constructor?
- return toUnifiedValueExpression().getType( getELContext() );
+ return toUnifiedValueExpression().getType(getELContext());
}
-
+
};
}
-
+
/**
* Create a method expression.
*
@@ -202,94 +195,83 @@
* @param type the method return type
* @param argTypes the method parameter types
*/
- public <T> MethodExpression<T> createMethodExpression(final String expression, final Class<T> type, final Class... argTypes)
+ public <T> MethodExpression<T> createMethodExpression(final String expression, final Class<T> type, final Class<?>... argTypes)
{
return new MethodExpression<T>()
{
- private javax.el.MethodExpression facesMethodExpression;
- private javax.el.MethodExpression seamMethodExpression;
-
+ private javax.el.MethodExpression unifiedMethodExpression;
+
public javax.el.MethodExpression toUnifiedMethodExpression()
{
- if ( isFacesContextActive() )
+ if (unifiedMethodExpression == null)
{
- if (facesMethodExpression==null)
- {
- facesMethodExpression = createExpression();
- }
- return facesMethodExpression;
+ unifiedMethodExpression = createExpression();
}
- else
- {
- if (seamMethodExpression==null)
- {
- seamMethodExpression = createExpression();
- }
- return seamMethodExpression;
- }
+ return unifiedMethodExpression;
}
-
+
private javax.el.MethodExpression createExpression()
{
- return getExpressionFactory().createMethodExpression( getELContext(), expression, type, argTypes );
+ return getExpressionFactory().createMethodExpression(getELContext(), expression, type, argTypes);
}
-
+
+ @SuppressWarnings("unchecked")
public T invoke(Object... args)
{
- return (T) toUnifiedMethodExpression().invoke( getELContext(), args );
+ return (T) toUnifiedMethodExpression().invoke(getELContext(), args);
}
-
+
public String getExpressionString()
{
return expression;
}
-
+
};
}
-
+
/**
- * A value expression - an EL expression that evaluates to
- * an attribute getter or get/set pair. This interface
- * is just a genericized version of the Unified EL ValueExpression
- * interface.
+ * A value expression - an EL expression that evaluates to an attribute
+ * getter or get/set pair. This interface is just a genericized version of
+ * the Unified EL ValueExpression interface.
*
* @author Gavin King
- *
+ *
* @param <T> the type of the value
*/
public static interface ValueExpression<T> extends Serializable
{
public T getValue();
+
public void setValue(T value);
+
public String getExpressionString();
+
public Class<T> getType();
+
/**
* @return the underlying Unified EL ValueExpression
*/
public javax.el.ValueExpression toUnifiedValueExpression();
}
-
+
/**
- * A method expression - an EL expression that evaluates to
- * a method. This interface is just a genericized version of
- * the Unified EL ValueExpression interface.
+ * A method expression - an EL expression that evaluates to a method. This
+ * interface is just a genericized version of the Unified EL ValueExpression
+ * interface.
*
* @author Gavin King
- *
+ *
* @param <T> the method return type
*/
public static interface MethodExpression<T> extends Serializable
{
public T invoke(Object... args);
+
public String getExpressionString();
+
/**
* @return the underlying Unified EL MethodExpression
*/
public javax.el.MethodExpression toUnifiedMethodExpression();
}
-
- protected boolean isFacesContextActive()
- {
- return false;
- }
}
Added: modules/trunk/el/src/main/java/org/jboss/seam/el/ExpressionsProducer.java
===================================================================
--- modules/trunk/el/src/main/java/org/jboss/seam/el/ExpressionsProducer.java (rev 0)
+++ modules/trunk/el/src/main/java/org/jboss/seam/el/ExpressionsProducer.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -0,0 +1,35 @@
+package org.jboss.seam.el;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Initializer;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.seam.beans.RuntimeBeanSelector;
+
+public
+@ApplicationScoped
+class ExpressionsProducer extends RuntimeBeanSelector<Expressions>
+{
+ ExpressionsProducer() {}
+
+ public @Initializer ExpressionsProducer(BeanManager manager)
+ {
+ super(manager);
+ }
+
+ @Override
+ public Class<Expressions> getType()
+ {
+ return Expressions.class;
+ }
+
+ @Override
+ public
+ @Produces
+ Expressions selectImplementation()
+ {
+ return super.selectImplementation();
+ }
+
+}
Added: modules/trunk/el/src/test/java/org/jboss/seam/el/ExpressionsProducerTest.java
===================================================================
--- modules/trunk/el/src/test/java/org/jboss/seam/el/ExpressionsProducerTest.java (rev 0)
+++ modules/trunk/el/src/test/java/org/jboss/seam/el/ExpressionsProducerTest.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -0,0 +1,20 @@
+package org.jboss.seam.el;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertSame;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+@Artifact
+public class ExpressionsProducerTest extends AbstractWebBeansTest
+{
+ @Test
+ public void testExpressionsProducer()
+ {
+ Expressions expressions = getCurrentManager().getInstanceByType(Expressions.class);
+ assertNotNull(expressions);
+ assertSame(expressions.getClass(), Expressions.class);
+ }
+}
Added: modules/trunk/el/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/beans.xml
===================================================================
Modified: modules/trunk/faces/pom.xml
===================================================================
--- modules/trunk/faces/pom.xml 2009-05-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/faces/pom.xml 2009-05-27 04:22:02 UTC (rev 11012)
@@ -42,7 +42,7 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
- <scope>test</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
Modified: modules/trunk/faces/src/main/java/org/jboss/seam/faces/Faces.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/Faces.java 2009-05-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/Faces.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -1,28 +1,28 @@
-package org.jboss.seam.faces;
-
-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.deployment.DeploymentType;
-
-/**
- * A binding type used on a JSF-specific implementation
- * that specializes Seam's standard implementation.
- *
- * @author Dan Allen
- */
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@DeploymentType
-@Inherited
-public @interface Faces {
-}
+package org.jboss.seam.faces;
+
+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 JSF-specific beans.
+ *
+ * @author Dan Allen
+ */
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@Inherited
+public @interface Faces
+{
+}
Modified: 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-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesExpressions.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -2,37 +2,34 @@
package org.jboss.seam.faces;
import javax.el.ELContext;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.deployment.Specializes;
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
-@Faces
-@Specializes
-@ApplicationScoped
-class FacesExpressions extends Expressions
+@RuntimeSelected
+class FacesExpressions extends Expressions implements RuntimeSelectedBean
{
+ public boolean isActive()
+ {
+ return FacesContext.getCurrentInstance() != null && FacesContext.getCurrentInstance().getCurrentPhaseId() != null;
+ }
+
/**
- * Get an appropriate ELContext. If there is an active JSF request,
- * use JSF's ELContext. Otherwise, use one that we created.
+ * @return the JSF ELContext
*/
@Override
public ELContext getELContext()
{
- return isFacesContextActive() ? FacesContext.getCurrentInstance().getELContext() : super.getELContext();
+ return FacesContext.getCurrentInstance().getELContext();
}
-
- @Override
- protected boolean isFacesContextActive()
- {
- return FacesContext.getCurrentInstance() != null && FacesContext.getCurrentInstance().getCurrentPhaseId() != null;
- }
}
\ No newline at end of file
Added: modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesMessages.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesMessages.java (rev 0)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesMessages.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -0,0 +1,238 @@
+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.StatusMessagesWrapper;
+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 StatusMessagesWrapper
+{
+ 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()
+ {
+ getStatusMessages().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/FacesStatusMessages.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesStatusMessages.java 2009-05-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/FacesStatusMessages.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -1,173 +0,0 @@
-package org.jboss.seam.faces;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.enterprise.context.ConversationScoped;
-import javax.enterprise.inject.Initializer;
-import javax.enterprise.inject.deployment.Specializes;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.jboss.seam.international.Interpolator;
-import org.jboss.seam.international.StatusMessage;
-import org.jboss.seam.international.StatusMessages;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-
-/**
- * <p>A bean which specializes StatusMessage to provide support for
- * JSF. Generic StatusMessage objects are translated into JSF
- * FacesMessage objects just prior to when the view is rendered.</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>
- *
- * QUESTION: should we set Flash#setKeepMessages(boolean)?
- *
- * @author Gavin King
- * @author Pete Muir
- */
-public
-@Faces
-@Specializes
-@ConversationScoped
-class FacesStatusMessages extends StatusMessages
-{
- private static final LogProvider log = Logging.getLogProvider(FacesStatusMessages.class);
-
- public FacesStatusMessages()
- {
- super();
- }
-
- public @Initializer FacesStatusMessages(Interpolator interpolator)
- {
- super(interpolator);
- }
-
- /**
- * 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 StatusMessage.Severity to a FacesMessage.Severity
- */
- private javax.faces.application.FacesMessage.Severity toFacesSeverity(org.jboss.seam.international.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 iter = component.getFacetsAndChildren();
- while (iter.hasNext())
- {
- UIComponent child = (UIComponent) iter.next();
- String clientId = getClientId(child, targetLocalId, facesContext);
- if (clientId != null)
- {
- return clientId;
- }
- }
- return null;
- }
- }
-}
Modified: modules/trunk/faces/src/main/java/org/jboss/seam/faces/application/SeamViewHandler.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/application/SeamViewHandler.java 2009-05-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/application/SeamViewHandler.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -5,7 +5,7 @@
import javax.faces.application.ViewHandler;
import javax.faces.application.ViewHandlerWrapper;
import javax.faces.context.FacesContext;
-import org.jboss.seam.faces.lifecycle.TransferStatusMessagesListener;
+import org.jboss.seam.faces.lifecycle.ConvertStatusMessagesListener;
/**
* Wrap the standard JSF view handler to capture the
@@ -43,7 +43,7 @@
if (context.getExternalContext().getSession(false) != null)
{
// QUESTION hmmm, we have to convert to faces messages now to leverage JSF's flash feature...I suppose that is okay
- new TransferStatusMessagesListener().execute();
+ new ConvertStatusMessagesListener().execute();
// should I move this next step into TransferStatusMessagesListener?
if (context.getMessages().hasNext())
{
Modified: 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-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesExpressionsTest.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -1,17 +1,18 @@
package org.jboss.seam.faces;
-import static org.testng.Assert.*;
+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.testharness.impl.packaging.jsr299.BeansXml;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
@@ -23,10 +24,9 @@
* @author Dan Allen
*/
@Artifact(addCurrentPackage = false)
-@BeansXml("beans.xml")
@Classes(
{
- FacesExpressions.class, Expressions.class
+ FacesExpressions.class, Expressions.class, ExpressionsProducer.class
})
public class FacesExpressionsTest extends AbstractWebBeansTest
{
@@ -40,16 +40,16 @@
@Test
public void testUsesELFromFacesContext()
{
- Expressions expressions = getExpressionInstance();
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);
- assert expressions instanceof FacesExpressions;
+ assertTrue(expressions instanceof FacesExpressions);
return expressions;
}
Copied: modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesMessagesTest.java (from rev 10994, modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesStatusMessagesTest.java)
===================================================================
--- modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesMessagesTest.java (rev 0)
+++ modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesMessagesTest.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -0,0 +1,152 @@
+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;
+ }
+}
Deleted: modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesStatusMessagesTest.java
===================================================================
--- modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesStatusMessagesTest.java 2009-05-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/faces/src/test/java/org/jboss/seam/faces/FacesStatusMessagesTest.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -1,149 +0,0 @@
-package org.jboss.seam.faces;
-
-import java.util.List;
-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 static org.testng.Assert.*;
-
-import javax.faces.context.FacesContext;
-import javax.faces.event.PhaseId;
-import org.jboss.seam.el.Expressions;
-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.testharness.impl.packaging.jsr299.BeansXml;
-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 FacesStatusMessage is configured properly
- * to specialize StatusMessage and will thus load successfully. Once loaded,
- * verify that FacesStatusMessage adds the appropriate JSF-specific functionality
- * to the status message repository.
- *
- * @author Dan Allen
- *
- * @see FacesStatusMessages
- * @see StatusMessages
- */
-@Artifact(addCurrentPackage = false)
-@BeansXml("beans.xml")
-@Classes(
-{
- FacesStatusMessages.class, StatusMessages.class, Interpolator.class, Expressions.class, LocaleProducer.class
-})
-public class FacesStatusMessagesTest extends AbstractWebBeansTest
-{
- @Override
- public void beforeMethod()
- {
- super.beforeMethod();
- activateConversationContext();
- installMockFacesContext();
- }
-
- /**
- * Test that the StatusMessage objects properly tranfer to FacesMessage objects
- * upon the call to 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);
- assert statusMessages instanceof FacesStatusMessages;
- return statusMessages;
- }
-}
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-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -376,9 +376,9 @@
* Add an array of {@link ConstraintViolation} objects from Bean Validation. Each message will
* be added with a severity of WARN.
*/
- public void add(ConstraintViolation[] cvs)
+ public void add(ConstraintViolation<?>[] cvs)
{
- for (ConstraintViolation cv : cvs)
+ for (ConstraintViolation<?> cv : cvs)
{
add(cv);
}
@@ -390,9 +390,9 @@
*
* The name of the property that was validated will be used as the widget ID
*/
- public void addToControls(ConstraintViolation[] cvs)
+ public void addToControls(ConstraintViolation<?>[] cvs)
{
- for (ConstraintViolation cv : cvs)
+ for (ConstraintViolation<?> cv : cvs)
{
addToControl(cv);
}
@@ -402,7 +402,7 @@
* Add a {@link ConstraintViolation} from Bean Validation. The message will
* be added with a severity of WARN.
*/
- public void add(ConstraintViolation cv)
+ public void add(ConstraintViolation<?> cv)
{
add(WARN, cv.getMessage());
}
@@ -413,7 +413,7 @@
*
* The name of the property that was validated will be used as the widget ID
*/
- public void addToControl(ConstraintViolation cv)
+ public void addToControl(ConstraintViolation<?> cv)
{
String propertyName = cv.getPropertyPath().substring(cv.getPropertyPath().lastIndexOf(".") + 1);
addToControl(propertyName, cv);
@@ -425,7 +425,7 @@
*
* You can also specify the id of the widget to add the message to
*/
- public void addToControl(String id, ConstraintViolation cv)
+ public void addToControl(String id, ConstraintViolation<?> cv)
{
addToControl(id, WARN, cv.getMessage());
}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesWrapper.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesWrapper.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessagesWrapper.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -0,0 +1,181 @@
+package org.jboss.seam.international;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.validation.ConstraintViolation;
+
+import org.jboss.seam.international.StatusMessage.Severity;
+
+/**
+ * A abstract wrapper class that delegates all operations to the StatusMessages
+ * instance. It's up to the implementation to provide access to the
+ * StatusMessages instance, preferably obtained through constructor injection.
+ * The intent is for this class to be extended to wrap view layer specific
+ * functionality around the StatusMessages component.
+ *
+ * @author Dan Allen
+ */
+public abstract class StatusMessagesWrapper extends StatusMessages
+{
+ public abstract StatusMessages getStatusMessages();
+
+ @Override
+ public abstract void onBeforeRender();
+
+ @Override
+ public void add(ConstraintViolation<?> cv)
+ {
+ getStatusMessages().add(cv);
+ }
+
+ @Override
+ public void add(ConstraintViolation<?>[] cvs)
+ {
+ getStatusMessages().add(cvs);
+ }
+
+ @Override
+ public void add(Severity severity, String messageTemplate, Object... params)
+ {
+ getStatusMessages().add(severity, messageTemplate, params);
+ }
+
+ @Override
+ public void add(Severity severity, String key, String detailKey, String messageTemplate, String messageDetailTemplate, Object... params)
+ {
+ getStatusMessages().add(severity, key, detailKey, messageTemplate, messageDetailTemplate, params);
+ }
+
+ @Override
+ public void add(String messageTemplate, Object... params)
+ {
+ getStatusMessages().add(messageTemplate, params);
+ }
+
+ @Override
+ public void addFromResourceBundle(Severity severity, String key, Object... params)
+ {
+ getStatusMessages().addFromResourceBundle(severity, key, params);
+ }
+
+ @Override
+ public void addFromResourceBundle(String key, Object... params)
+ {
+ getStatusMessages().addFromResourceBundle(key, params);
+ }
+
+ @Override
+ public void addFromResourceBundleOrDefault(Severity severity, String key, String defaultMessageTemplate, Object... params)
+ {
+ getStatusMessages().addFromResourceBundleOrDefault(severity, key, defaultMessageTemplate, params);
+ }
+
+ @Override
+ public void addFromResourceBundleOrDefault(String key, String defaultMessageTemplate, Object... params)
+ {
+ getStatusMessages().addFromResourceBundleOrDefault(key, defaultMessageTemplate, params);
+ }
+
+ @Override
+ public void addToControl(ConstraintViolation<?> cv)
+ {
+ getStatusMessages().addToControl(cv);
+ }
+
+ @Override
+ public void addToControl(String id, ConstraintViolation<?> cv)
+ {
+ getStatusMessages().addToControl(id, cv);
+ }
+
+ @Override
+ public void addToControl(String id, Severity severity, String messageTemplate, Object... params)
+ {
+ getStatusMessages().addToControl(id, severity, messageTemplate, params);
+ }
+
+ @Override
+ public void addToControl(String id, Severity severity, String key, String messageTemplate, Object... params)
+ {
+ getStatusMessages().addToControl(id, severity, key, messageTemplate, params);
+ }
+
+ @Override
+ public void addToControl(String id, String messageTemplate, Object... params)
+ {
+ getStatusMessages().addToControl(id, messageTemplate, params);
+ }
+
+ @Override
+ public void addToControlFromResourceBundle(String id, Severity severity, String key, Object... params)
+ {
+ getStatusMessages().addToControlFromResourceBundle(id, severity, key, params);
+ }
+
+ @Override
+ public void addToControlFromResourceBundle(String id, String key, Object... params)
+ {
+ getStatusMessages().addToControlFromResourceBundle(id, key, params);
+ }
+
+ @Override
+ public void addToControlFromResourceBundleOrDefault(String id, Severity severity, String key, String defaultMessageTemplate, Object... params)
+ {
+ getStatusMessages().addToControlFromResourceBundleOrDefault(id, severity, key, defaultMessageTemplate, params);
+ }
+
+ @Override
+ public void addToControlFromResourceBundleOrDefault(String id, String key, String defaultMessageTemplate, Object... params)
+ {
+ getStatusMessages().addToControlFromResourceBundleOrDefault(id, key, defaultMessageTemplate, params);
+ }
+
+ @Override
+ public void addToControls(ConstraintViolation<?>[] cvs)
+ {
+ getStatusMessages().addToControls(cvs);
+ }
+
+ @Override
+ public void clear()
+ {
+ getStatusMessages().clear();
+ }
+
+ @Override
+ public void clearGlobalMessages()
+ {
+ getStatusMessages().clearGlobalMessages();
+ }
+
+ @Override
+ public void clearKeyedMessages()
+ {
+ getStatusMessages().clearKeyedMessages();
+ }
+
+ @Override
+ public void clearKeyedMessages(String id)
+ {
+ getStatusMessages().clearKeyedMessages(id);
+ }
+
+ @Override
+ public List<StatusMessage> getGlobalMessages()
+ {
+ return getStatusMessages().getGlobalMessages();
+ }
+
+ @Override
+ public Map<String, List<StatusMessage>> getKeyedMessages()
+ {
+ return getStatusMessages().getKeyedMessages();
+ }
+
+ @Override
+ public List<StatusMessage> getKeyedMessages(String id)
+ {
+ return getStatusMessages().getKeyedMessages(id);
+ }
+}
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-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/international/src/test/java/org/jboss/seam/international/InterpolatorTest.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -1,15 +1,18 @@
package org.jboss.seam.international;
+import static org.testng.Assert.assertEquals;
+
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
+
import javax.el.CompositeELResolver;
import javax.el.ELContext;
+
import org.jboss.seam.el.AbstractELResolver;
-import static org.testng.Assert.*;
-
import org.jboss.seam.el.Expressions;
+import org.jboss.seam.el.ExpressionsProducer;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.webbeans.test.AbstractWebBeansTest;
@@ -26,7 +29,7 @@
* @see LocaleProducer
*/
@Artifact(addCurrentPackage = false)
-(a)Classes({Interpolator.class, Expressions.class, LocaleProducer.class})
+(a)Classes({Interpolator.class, Expressions.class, ExpressionsProducer.class, LocaleProducer.class})
public class InterpolatorTest extends AbstractWebBeansTest
{
@Override
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-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesTest.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -1,12 +1,14 @@
package org.jboss.seam.international;
+import static org.testng.Assert.assertEquals;
+
import org.jboss.seam.el.Expressions;
+import org.jboss.seam.el.ExpressionsProducer;
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 static org.testng.Assert.*;
import org.testng.annotations.Test;
/**
@@ -18,7 +20,7 @@
@Artifact(addCurrentPackage = false)
@Classes(
{
- StatusMessages.class, Interpolator.class, Expressions.class, LocaleProducer.class
+ StatusMessages.class, Interpolator.class, Expressions.class, ExpressionsProducer.class, LocaleProducer.class
})
public class StatusMessagesTest extends AbstractWebBeansTest
{
Modified: modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesUnitTest.java
===================================================================
--- modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesUnitTest.java 2009-05-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesUnitTest.java 2009-05-27 04:22:02 UTC (rev 11012)
@@ -1,9 +1,16 @@
package org.jboss.seam.international;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertSame;
+
import java.util.List;
+
import javax.validation.ConstraintDescriptor;
import javax.validation.ConstraintViolation;
-import static org.testng.Assert.*;
+
import org.testng.annotations.Test;
/**
@@ -93,7 +100,7 @@
public void testAddGlobalMessageFromConstraintViolation()
{
StatusMessages statusMessages = getStatusMessagesInstance();
- ConstraintViolation violation = new ConstraintViolationStub("Invalid number", "creditCardNumber");
+ ConstraintViolation<Object> violation = new ConstraintViolationStub("Invalid number", "creditCardNumber");
statusMessages.add(violation);
assertEquals(statusMessages.getGlobalMessages().size(), 1);
assertEquals(statusMessages.getKeyedMessages().size(), 0);
@@ -111,9 +118,9 @@
public void testAddMessageToControlsDynamicallyFromConstraintViolation()
{
StatusMessages statusMessages = getStatusMessagesInstance();
- ConstraintViolation firstNameViolation = new ConstraintViolationStub("Too short", "firstName");
- ConstraintViolation lastNameViolation = new ConstraintViolationStub("Too long", "lastName");
- ConstraintViolation usernameViolation = new ConstraintViolationStub("Already taken", "account.username");
+ ConstraintViolation<Object> firstNameViolation = new ConstraintViolationStub("Too short", "firstName");
+ ConstraintViolation<Object> lastNameViolation = new ConstraintViolationStub("Too long", "lastName");
+ ConstraintViolation<Object> usernameViolation = new ConstraintViolationStub("Already taken", "account.username");
statusMessages.addToControl(firstNameViolation);
statusMessages.addToControls(new ConstraintViolation[] { lastNameViolation, usernameViolation });
assertEquals(statusMessages.getGlobalMessages().size(), 0);
@@ -198,7 +205,7 @@
}
}
- private class ConstraintViolationStub implements ConstraintViolation
+ private class ConstraintViolationStub implements ConstraintViolation<Object>
{
private String message;
private String propertyPath;
@@ -239,12 +246,12 @@
throw new UnsupportedOperationException("Not supported by stub.");
}
- public ConstraintDescriptor getConstraintDescriptor()
+ public ConstraintDescriptor<?> getConstraintDescriptor()
{
throw new UnsupportedOperationException("Not supported by stub.");
}
- public Class getRootBeanClass()
+ public Class<Object> getRootBeanClass()
{
throw new UnsupportedOperationException("Not supported by stub.");
}
Modified: modules/trunk/parent/pom.xml
===================================================================
--- modules/trunk/parent/pom.xml 2009-05-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/parent/pom.xml 2009-05-27 04:22:02 UTC (rev 11012)
@@ -93,6 +93,7 @@
<module>../version-matrix</module>
<module>../mock</module>
<module>../bridge-api</module>
+ <module>../beans</module>
<module>../el</module>
<module>../international</module>
<module>../web</module>
Modified: modules/trunk/version-matrix/pom.xml
===================================================================
--- modules/trunk/version-matrix/pom.xml 2009-05-27 04:21:11 UTC (rev 11011)
+++ modules/trunk/version-matrix/pom.xml 2009-05-27 04:22:02 UTC (rev 11012)
@@ -246,6 +246,12 @@
<artifactId>jbpm-jpdl</artifactId>
<version>3.2.2</version>
</dependency>
+
+ <dependency>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-beans</artifactId>
+ <version>${seam.version}</version>
+ </dependency>
<dependency>
<groupId>${seam.groupId}</groupId>
15 years, 6 months
Seam SVN: r11011 - modules/trunk/faces/src/main/resources/META-INF.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-27 00:21:11 -0400 (Wed, 27 May 2009)
New Revision: 11011
Modified:
modules/trunk/faces/src/main/resources/META-INF/faces-config.xml
Log:
rename
Modified: modules/trunk/faces/src/main/resources/META-INF/faces-config.xml
===================================================================
--- modules/trunk/faces/src/main/resources/META-INF/faces-config.xml 2009-05-27 04:20:51 UTC (rev 11010)
+++ modules/trunk/faces/src/main/resources/META-INF/faces-config.xml 2009-05-27 04:21:11 UTC (rev 11011)
@@ -22,11 +22,11 @@
<el-resolver>org.jboss.seam.el.SeamELResolver</el-resolver>
<el-resolver>org.jboss.seam.faces.el.SeamFacesELResolver</el-resolver>
<system-event-listener>
- <system-event-listener-class>org.jboss.seam.faces.lifecycle.ViewActionExecutor</system-event-listener-class>
+ <system-event-listener-class>org.jboss.seam.faces.lifecycle.ExecuteViewActionsListener</system-event-listener-class>
<system-event-class>javax.faces.event.PreRenderViewEvent</system-event-class>
</system-event-listener>
<system-event-listener>
- <system-event-listener-class>org.jboss.seam.faces.lifecycle.TransferStatusMessagesListener</system-event-listener-class>
+ <system-event-listener-class>org.jboss.seam.faces.lifecycle.ConvertStatusMessagesListener</system-event-listener-class>
<system-event-class>javax.faces.event.PreRenderViewEvent</system-event-class>
</system-event-listener>
</application>
15 years, 6 months
Seam SVN: r11010 - modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-27 00:20:51 -0400 (Wed, 27 May 2009)
New Revision: 11010
Added:
modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ConvertStatusMessagesListener.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ExecuteViewActionsListener.java
Removed:
modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/TransferStatusMessagesListener.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ViewActionExecutor.java
Log:
rename
Copied: modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ConvertStatusMessagesListener.java (from rev 10994, modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/TransferStatusMessagesListener.java)
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ConvertStatusMessagesListener.java (rev 0)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ConvertStatusMessagesListener.java 2009-05-27 04:20:51 UTC (rev 11010)
@@ -0,0 +1,57 @@
+package org.jboss.seam.faces.lifecycle;
+
+import javax.enterprise.inject.AnnotationLiteral;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.faces.component.UIViewRoot;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+import org.jboss.seam.bridge.ManagerBridge;
+import org.jboss.seam.faces.Faces;
+import org.jboss.seam.international.StatusMessages;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ * <p>A {@link SystemEventListener} that observes the PreRenderViewEvent or
+ * a redirect navigation event (via SeamViewHandler) and transposes Seam
+ * StatusMessage objects into FacesMessage objects and transfers them to the FacesContext.</p>
+ *
+ * <p>FIXME the messages are going to get dropped if a view action causes a navigation event followed by a redirect event</p>
+ *
+ * @author Dan Allen
+ */
+//@ListenerFor(systemEventClass = PreRenderViewEvent.class, sourceClass = UIViewRoot.class)
+public class ConvertStatusMessagesListener implements SystemEventListener
+{
+ private static final LogProvider log = Logging.getLogProvider(ConvertStatusMessagesListener.class);
+
+ public boolean isListenerForSource(Object source)
+ {
+ return source instanceof UIViewRoot;
+ }
+
+ public void processEvent(SystemEvent preRenderViewEvent)
+ {
+ execute();
+ }
+
+ public void execute()
+ {
+ try
+ {
+ BeanManager manager = ManagerBridge.getProvider().getCurrentManager();
+ // tests
+ if (manager != null)
+ {
+ manager.getInstanceByType(StatusMessages.class, new AnnotationLiteral<Faces>() {}).onBeforeRender();
+ }
+ }
+ catch (UnsatisfiedResolutionException e)
+ {
+ log.warn("Could not locate the StatusMessages bean. Status messages will not be transfered to the FacesContext.");
+ }
+
+ }
+}
Copied: modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ExecuteViewActionsListener.java (from rev 10994, modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ViewActionExecutor.java)
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ExecuteViewActionsListener.java (rev 0)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ExecuteViewActionsListener.java 2009-05-27 04:20:51 UTC (rev 11010)
@@ -0,0 +1,228 @@
+package org.jboss.seam.faces.lifecycle;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.faces.FacesException;
+import javax.faces.application.NavigationHandler;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ExceptionQueuedEvent;
+import javax.faces.event.ExceptionQueuedEventContext;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+import org.jboss.seam.bridge.ManagerBridge;
+import org.jboss.seam.faces.component.UIRestrictView;
+import org.jboss.seam.faces.component.UIViewAction;
+import org.jboss.seam.security.Identity;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
+
+//@ListenerFor(systemEventClass = PreRenderViewEvent.class, sourceClass = UIViewRoot.class)
+public class ExecuteViewActionsListener implements SystemEventListener
+{
+ private static final Log log = Logging.getLog(ExecuteViewActionsListener.class);
+
+ public boolean isListenerForSource(Object source)
+ {
+ return source instanceof UIViewRoot;
+ }
+
+ public void processEvent(SystemEvent event) throws AbortProcessingException
+ {
+ execute();
+ }
+
+ protected void execute()
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ UIViewRoot initialViewRoot = context.getViewRoot();
+
+ // TEMPORARY needs to be organized better
+
+ // collect first so as not to introduce a hard dependency on Identity if tag is not in use
+ Collection<UIRestrictView> restrictions = collectionViewRestrictions(initialViewRoot);
+ if (!restrictions.isEmpty())
+ {
+ if (Identity.isSecurityEnabled())
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Processing view restrictions before render view");
+ }
+
+ Identity identity = ManagerBridge.getProvider().getCurrentManager().getInstanceByType(Identity.class);
+ try
+ {
+ for (UIRestrictView restriction : restrictions)
+ {
+ if (restriction.getRequire() != null)
+ {
+ identity.checkRestriction(restriction.getRequire());
+ }
+ else
+ {
+ identity.checkPermission(initialViewRoot.getViewId(), "render");
+ }
+ }
+ }
+ // FIXME damn this is ugly, but JCDI is wrapping exceptions
+ catch (Exception e)
+ {
+ Throwable cause = e;
+ if (e instanceof InvocationTargetException)
+ {
+ cause = e.getCause();
+ }
+
+ context.getApplication().publishEvent(context, ExceptionQueuedEvent.class, new ExceptionQueuedEventContext(context, cause));
+ // FIXME this is lame; there should be some other way to stop view rendering
+ context.getViewRoot().setRendered(false);
+ throw new AbortProcessingException("View restriction criteria was not met.");
+ //return;
+ }
+ }
+ }
+ // END TEMPORARY
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("Processing view actions before render view");
+ }
+
+ NavigationHandler navHandler = context.getApplication().getNavigationHandler();
+ boolean postback = context.isPostback();
+
+ if (!postback && context.isValidationFailed())
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Validation flagged as failed. Calling navigation handler without executing view actions.");
+ }
+ navHandler.handleNavigation(context, null, null);
+ return;
+ }
+
+ Collection<UIViewAction> actions = collectViewActions(initialViewRoot, postback);
+ for (UIViewAction action : actions)
+ {
+ String outcome = null;
+ String fromAction = null;
+
+ MethodExpression execute = action.getExecute();
+ // QUESTION shouldn't this be an illegal state otherwise??
+ if (execute != null)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Executing view action expression {0}", execute.getExpressionString());
+ }
+ try
+ {
+ Object returnVal = execute.invoke(context.getELContext(), null);
+ outcome = (returnVal != null ? returnVal.toString() : null);
+ fromAction = execute.getExpressionString();
+ }
+ catch (ELException e)
+ {
+ if (log.isErrorEnabled())
+ {
+ log.error(e.getMessage(), e);
+ }
+ throw new FacesException(execute.getExpressionString() + ": " + e.getMessage(), e);
+ }
+ }
+
+ navHandler.handleNavigation(context, fromAction, outcome);
+
+ // QUESTION In either of these two cases, should an AbortProcessingEvent exception be thrown?
+ if (context.getResponseComplete())
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Response marked as complete during view action processing. Short-circuiting remaining actions.");
+ }
+ // FIXME this is lame; there should be some other way to stop view rendering
+ context.getViewRoot().setRendered(false);
+ break;
+ }
+ else if (!initialViewRoot.getViewId().equals(context.getViewRoot().getViewId()))
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Detected change in view ID during view action processing. Short-circuiting remaining actions.");
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * Pick out the UIRestrictView components from the metadata facet's children. If no
+ * matches are found, an unmodifiable empty list is returned.
+ */
+ protected Collection<UIRestrictView> collectionViewRestrictions(UIViewRoot viewRoot)
+ {
+ return collectMetadataComponents(viewRoot, new UIComponentFilter<UIRestrictView>() {
+
+ @Override
+ public boolean accepts(UIComponent candidate)
+ {
+ return candidate instanceof UIRestrictView;
+ }
+
+ });
+ }
+
+ /**
+ * Pick out the UIViewAction components from the metadata facet's children. If this is a postback,
+ * only select UIViewAction components that are to be executed on a postback. If no matches
+ * are found, an unmodifiable empty list is returned.
+ */
+ protected Collection<UIViewAction> collectViewActions(UIViewRoot viewRoot, final boolean postback)
+ {
+ return collectMetadataComponents(viewRoot, new UIComponentFilter<UIViewAction>() {
+
+ @Override
+ public boolean accepts(UIComponent candidate)
+ {
+ return candidate instanceof UIViewAction && (!postback || ((UIViewAction) candidate).isOnPostback());
+ }
+
+ });
+ }
+
+ protected <C extends UIComponent> Collection<C> collectMetadataComponents(UIViewRoot viewRoot, UIComponentFilter<C> componentFilter)
+ {
+ UIComponent metadataFacet = viewRoot.getFacet(UIViewRoot.METADATA_FACET_NAME);
+
+ if (metadataFacet == null)
+ {
+ return Collections.<C>emptyList();
+ }
+
+ Collection<C> matches = new ArrayList<C>();
+ for (UIComponent candidate : metadataFacet.getChildren())
+ {
+ if (componentFilter.accepts(candidate))
+ {
+ matches.add((C) candidate);
+ }
+ }
+
+ return matches;
+ }
+
+ protected abstract class UIComponentFilter<C extends UIComponent>
+ {
+ public abstract boolean accepts(UIComponent candidate);
+ }
+
+}
Deleted: modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/TransferStatusMessagesListener.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/TransferStatusMessagesListener.java 2009-05-26 23:01:28 UTC (rev 11009)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/TransferStatusMessagesListener.java 2009-05-27 04:20:51 UTC (rev 11010)
@@ -1,55 +0,0 @@
-package org.jboss.seam.faces.lifecycle;
-
-import javax.enterprise.inject.UnsatisfiedResolutionException;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.faces.component.UIViewRoot;
-import javax.faces.event.SystemEvent;
-import javax.faces.event.SystemEventListener;
-
-import org.jboss.seam.bridge.ManagerBridge;
-import org.jboss.seam.international.StatusMessages;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-
-/**
- * A {@link SystemEventListener} that observes the PreRenderViewEvent or
- * a redirect navigation event (via SeamViewHandler) and transposes Seam
- * StatusMessage objects into FacesMessage objects and transfers them to the FacesContext.
- *
- * FIXME this is going to be a problem if a view action causes a navigation event followed by a redirect event
- *
- * @author Dan Allen
- */
-//@ListenerFor(systemEventClass = PreRenderViewEvent.class, sourceClass = UIViewRoot.class)
-public class TransferStatusMessagesListener implements SystemEventListener
-{
- private static final LogProvider log = Logging.getLogProvider(TransferStatusMessagesListener.class);
-
- public boolean isListenerForSource(Object source)
- {
- return source instanceof UIViewRoot;
- }
-
- public void processEvent(SystemEvent preRenderViewEvent)
- {
- execute();
- }
-
- public void execute()
- {
- try
- {
- BeanManager manager = ManagerBridge.getProvider().getCurrentManager();
- // tests
- if (manager != null)
- {
- manager.getInstanceByType(StatusMessages.class).onBeforeRender();
- }
- }
- catch (UnsatisfiedResolutionException e)
- {
- log.warn("Could not locate the StatusMessages bean. Status messages will not be transfered to the FacesContext.");
- }
-
- }
-}
Deleted: modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ViewActionExecutor.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ViewActionExecutor.java 2009-05-26 23:01:28 UTC (rev 11009)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/ViewActionExecutor.java 2009-05-27 04:20:51 UTC (rev 11010)
@@ -1,228 +0,0 @@
-package org.jboss.seam.faces.lifecycle;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-import javax.el.ELException;
-import javax.el.MethodExpression;
-import javax.faces.FacesException;
-import javax.faces.application.NavigationHandler;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.ExceptionQueuedEvent;
-import javax.faces.event.ExceptionQueuedEventContext;
-import javax.faces.event.SystemEvent;
-import javax.faces.event.SystemEventListener;
-
-import org.jboss.seam.bridge.ManagerBridge;
-import org.jboss.seam.faces.component.UIRestrictView;
-import org.jboss.seam.faces.component.UIViewAction;
-import org.jboss.seam.security.Identity;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-
-//@ListenerFor(systemEventClass = PreRenderViewEvent.class, sourceClass = UIViewRoot.class)
-public class ViewActionExecutor implements SystemEventListener
-{
- private static final Log log = Logging.getLog(ViewActionExecutor.class);
-
- public boolean isListenerForSource(Object source)
- {
- return source instanceof UIViewRoot;
- }
-
- public void processEvent(SystemEvent event) throws AbortProcessingException
- {
- processViewActions();
- }
-
- protected void processViewActions()
- {
- FacesContext context = FacesContext.getCurrentInstance();
- UIViewRoot initialViewRoot = context.getViewRoot();
-
- // TEMPORARY needs to be organized better
-
- // collect first so as not to introduce a hard dependency on Identity if tag is not in use
- Collection<UIRestrictView> restrictions = collectionViewRestrictions(initialViewRoot);
- if (!restrictions.isEmpty())
- {
- if (Identity.isSecurityEnabled())
- {
- if (log.isTraceEnabled())
- {
- log.trace("Processing view restrictions before render view");
- }
-
- Identity identity = ManagerBridge.getProvider().getCurrentManager().getInstanceByType(Identity.class);
- try
- {
- for (UIRestrictView restriction : restrictions)
- {
- if (restriction.getRequire() != null)
- {
- identity.checkRestriction(restriction.getRequire());
- }
- else
- {
- identity.checkPermission(initialViewRoot.getViewId(), "render");
- }
- }
- }
- // FIXME damn this is ugly, but JCDI is wrapping exceptions
- catch (Exception e)
- {
- Throwable cause = e;
- if (e instanceof InvocationTargetException)
- {
- cause = e.getCause();
- }
-
- context.getApplication().publishEvent(context, ExceptionQueuedEvent.class, new ExceptionQueuedEventContext(context, cause));
- // FIXME this is lame; there should be some other way to stop view rendering
- context.getViewRoot().setRendered(false);
- throw new AbortProcessingException("View restriction criteria was not met.");
- //return;
- }
- }
- }
- // END TEMPORARY
-
- if (log.isTraceEnabled())
- {
- log.trace("Processing view actions before render view");
- }
-
- NavigationHandler navHandler = context.getApplication().getNavigationHandler();
- boolean postback = context.isPostback();
-
- if (!postback && context.isValidationFailed())
- {
- if (log.isTraceEnabled())
- {
- log.trace("Validation flagged as failed. Calling navigation handler without executing view actions.");
- }
- navHandler.handleNavigation(context, null, null);
- return;
- }
-
- Collection<UIViewAction> actions = collectViewActions(initialViewRoot, postback);
- for (UIViewAction action : actions)
- {
- String outcome = null;
- String fromAction = null;
-
- MethodExpression execute = action.getExecute();
- // QUESTION shouldn't this be an illegal state otherwise??
- if (execute != null)
- {
- if (log.isDebugEnabled())
- {
- log.debug("Executing view action expression {0}", execute.getExpressionString());
- }
- try
- {
- Object returnVal = execute.invoke(context.getELContext(), null);
- outcome = (returnVal != null ? returnVal.toString() : null);
- fromAction = execute.getExpressionString();
- }
- catch (ELException e)
- {
- if (log.isErrorEnabled())
- {
- log.error(e.getMessage(), e);
- }
- throw new FacesException(execute.getExpressionString() + ": " + e.getMessage(), e);
- }
- }
-
- navHandler.handleNavigation(context, fromAction, outcome);
-
- // QUESTION In either of these two cases, should an AbortProcessingEvent exception be thrown?
- if (context.getResponseComplete())
- {
- if (log.isDebugEnabled())
- {
- log.debug("Response marked as complete during view action processing. Short-circuiting remaining actions.");
- }
- // FIXME this is lame; there should be some other way to stop view rendering
- context.getViewRoot().setRendered(false);
- break;
- }
- else if (!initialViewRoot.getViewId().equals(context.getViewRoot().getViewId()))
- {
- if (log.isDebugEnabled())
- {
- log.debug("Detected change in view ID during view action processing. Short-circuiting remaining actions.");
- }
- break;
- }
- }
- }
-
- /**
- * Pick out the UIRestrictView components from the metadata facet's children. If no
- * matches are found, an unmodifiable empty list is returned.
- */
- protected Collection<UIRestrictView> collectionViewRestrictions(UIViewRoot viewRoot)
- {
- return collectMetadataComponents(viewRoot, new UIComponentFilter<UIRestrictView>() {
-
- @Override
- public boolean accept(UIComponent candidate)
- {
- return candidate instanceof UIRestrictView;
- }
-
- });
- }
-
- /**
- * Pick out the UIViewAction components from the metadata facet's children. If this is a postback,
- * only select UIViewAction components that are to be executed on a postback. If no matches
- * are found, an unmodifiable empty list is returned.
- */
- protected Collection<UIViewAction> collectViewActions(UIViewRoot viewRoot, final boolean postback)
- {
- return collectMetadataComponents(viewRoot, new UIComponentFilter<UIViewAction>() {
-
- @Override
- public boolean accept(UIComponent candidate)
- {
- return candidate instanceof UIViewAction && (!postback || ((UIViewAction) candidate).isOnPostback());
- }
-
- });
- }
-
- protected <C extends UIComponent> Collection<C> collectMetadataComponents(UIViewRoot viewRoot, UIComponentFilter<C> componentFilter)
- {
- UIComponent metadataFacet = viewRoot.getFacet(UIViewRoot.METADATA_FACET_NAME);
-
- if (metadataFacet == null)
- {
- return Collections.<C>emptyList();
- }
-
- Collection<C> matches = new ArrayList<C>();
- for (UIComponent candidate : metadataFacet.getChildren())
- {
- if (componentFilter.accept(candidate))
- {
- matches.add((C) candidate);
- }
- }
-
- return matches;
- }
-
- protected abstract class UIComponentFilter<C extends UIComponent>
- {
- public abstract boolean accept(UIComponent candidate);
- }
-
-}
15 years, 6 months
Seam SVN: r11009 - branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-05-26 19:01:28 -0400 (Tue, 26 May 2009)
New Revision: 11009
Modified:
branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Itext.xml
Log:
JBSEAM-4193
Modified: branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Itext.xml
===================================================================
--- branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Itext.xml 2009-05-26 20:17:36 UTC (rev 11008)
+++ branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Itext.xml 2009-05-26 23:01:28 UTC (rev 11009)
@@ -369,6 +369,10 @@
<literal>UNDERLINE</literal>, <literal>LINE-THROUGH</literal></para>
</listitem>
+
+ <listitem>
+ <para><literal>color</literal> — The font color. (see <xref linkend="itext.colors"/> for color values)</para>
+ </listitem>
<listitem>
<para><literal>encoding</literal> — The character set encoding.</para>
@@ -517,6 +521,12 @@
</listitem>
<listitem>
<para>
+ <literal>scaleToFit</literal> — Specifies the X any Y
+ size to scale the image to. The image will be scale to fit those dimensions
+ as closely as possible while preserving the XY ratio of the image.</para>
+ </listitem>
+ <listitem>
+ <para>
<literal>wrap</literal>
</para>
</listitem>
@@ -1328,12 +1338,17 @@
<section id="itext.colors">
<title>Color Values</title>
- <para>Seam documents do not yet support a full color specification. Currently, only named colors are
- supported. They are: <literal>white</literal>, <literal>gray</literal>,
+ <para>Several ways of specifying colors are provided. A limited number of colors are
+ supported by name. They are: <literal>white</literal>, <literal>gray</literal>,
<literal>lightgray</literal>, <literal>darkgray</literal>, <literal>black</literal>,
<literal>red</literal>, <literal>pink</literal>, <literal>yellow</literal>,
<literal>green</literal>, <literal>magenta</literal>, <literal>cyan</literal> and
- <literal>blue</literal>. </para>
+ <literal>blue</literal>. Colors can be specified as an integer value, as
+ definied by <literal>java.awt.Color</literal>. Finally a color value may be specified
+ as <literal>rgb(r,g,b)</literal> or <literal>rgb(r,g,b,a)</literal> with the red, green, blue
+ alpha values specified as an integer between 0 and 255 or as a floating point percentages
+ followed by a '%' sign.
+ </para>
</section>
15 years, 6 months
Seam SVN: r11008 - branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT.
by seam-commits@lists.jboss.org
Author: nico.ben
Date: 2009-05-26 16:17:36 -0400 (Tue, 26 May 2009)
New Revision: 11008
Modified:
branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT/Oc4j.po
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/Oc4j.po
===================================================================
--- branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT/Oc4j.po 2009-05-26 20:09:24 UTC (rev 11007)
+++ branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT/Oc4j.po 2009-05-26 20:17:36 UTC (rev 11008)
@@ -6,7 +6,7 @@
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-11-06 00:23+0000\n"
-"PO-Revision-Date: 2009-05-25 21:29+0100\n"
+"PO-Revision-Date: 2009-05-26 22:17+0100\n"
"Last-Translator: Nicola Benaglia <nico.benaz(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@ -29,7 +29,7 @@
#: Oc4j.xml:17
#, no-c-format
msgid "Installation and operation of OC4J"
-msgstr ""
+msgstr "Installazione ed operazione di OC4J"
#. Tag: para
#: Oc4j.xml:18
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-26 20:09:24 UTC (rev 11007)
+++ branches/community/Seam_2_1/doc/Seam_Reference_Guide/it-IT/Spring.po 2009-05-26 20:17:36 UTC (rev 11008)
@@ -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-24 19:21+0100\n"
+"PO-Revision-Date: 2009-05-26 22:15+0100\n"
"Last-Translator: Nicola Benaglia <nico.benaz(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@ -95,7 +95,7 @@
#: Spring.xml:47
#, no-c-format
msgid "Injecting Seam component instances into Spring beans is accomplished using the <literal><seam:instance/></literal> namespace handler. To enable the Seam namespace handler, the Seam namespace must be added to the Spring beans definition file:"
-msgstr ""
+msgstr "L'iniezione di istanze di componenti Seam nei bean Spring viene compiuto usando l'handler di namespace <literal><seam:instance/></literal>. Per abilitare questo handler occorre aggiungere il namespace di Seam al file di definizione dei bean Spring:"
#. Tag: programlisting
#: Spring.xml:51
@@ -121,7 +121,7 @@
#: Spring.xml:53
#, no-c-format
msgid "Now any Seam component may be injected into any Spring bean:"
-msgstr ""
+msgstr "Ora ciascuno componente di Seam può essere iniettato in un bean Spring:"
#. Tag: programlisting
#: Spring.xml:55
@@ -143,7 +143,7 @@
#: Spring.xml:57
#, no-c-format
msgid "An EL expression may be used instead of a component name:"
-msgstr ""
+msgstr "Un'espressione EL può essere usata al posto del nome del componente:"
#. Tag: programlisting
#: Spring.xml:59
@@ -165,7 +165,7 @@
#: Spring.xml:61
#, no-c-format
msgid "Seam component instances may even be made available for injection into Spring beans by a Spring bean id."
-msgstr ""
+msgstr "Le istanze dei componenti Seam possono essere disponibili anche per l'iniezione nei bean Spring tramite l'id del bean."
#. Tag: programlisting
#: Spring.xml:63
@@ -195,13 +195,14 @@
#: Spring.xml:67
#, no-c-format
msgid "Seam was designed from the ground up to support a stateful component model with multiple contexts. Spring was not. Unlike Seam bijection, Spring injection does not occur at method invocation time. Instead, injection happens only when the Spring bean is instantiated. So the instance available when the bean is instantiated will be the same instance that the bean uses for the entire life of the bean. For example, if a Seam <literal>CONVERSATION</literal>-scoped component instance is directly injected into a singleton Spring bean, that singleton will hold a reference to the same instance long after the conversation is over! We call this problem <emphasis>scope impedance</emphasis>. Seam bijection ensures that scope impedance is maintained naturally as an invocation flows through the system. In Spring, we need to inject a proxy of the Seam component, and resolve the reference when the proxy is invoked."
-msgstr ""
+msgstr "Seam è stato progettato da principio per supportare un modello a componenti stateful con contesti multipli. Spring no. A differenza della bijection di Seam, l'iniezionedi Spring non avviene al momento dell'invocazione del metodo. Invece avviene solo quando viene istanziato il bean Spring. Quindi quando viene istanziato il bean l'istanza disponibile sarà la stessa istanza che il bean usa per l'intera vita del bean. Per esempio, se un'istanza di un componente con scope <literal>CONVERSATION</literal> viene direttamente iniettata in un bean singleton di Spring, tale singleton manterrà un riferimento alla stessa istanza anche quando la conversazioneè terminata! Questo problema viene chiamato <emphasis>impedenza di scope</emphasis>. La bijection di Seam assicura che l'impedenza di scope sia naturalmente mantenuta quando un'invocazione attraversa il sistema. In Spring occorre iniettare un proxy del componente Seam e risolvere il riferimento quando il proxy viene invoc!
ato."
+# creare automaticamente il componente proxy???
#. Tag: para
#: Spring.xml:77
#, no-c-format
msgid "The <literal><seam:instance/></literal> tag lets us automatically proxy the Seam component."
-msgstr ""
+msgstr "Il tag <literal><seam:instance/></literal> consente di creare automaticamente il componente proxy del componente Seam."
#. Tag: programlisting
#: Spring.xml:79
@@ -253,7 +254,7 @@
#: Spring.xml:102
#, no-c-format
msgid "We'll discuss the second option in the next section. The easiest approach is to access the Spring beans via EL."
-msgstr ""
+msgstr "Si discuterà la seconda opzione nella prossima sezione. L'approccio più facile è accedere ai bean Spring via EL."
#. Tag: para
#: Spring.xml:105
@@ -281,7 +282,7 @@
#: Spring.xml:112
#, no-c-format
msgid "Then you can inject Spring beans using <literal>@In</literal>:"
-msgstr ""
+msgstr "Poi si possono iniettare i bean Spring usando <literal>@In</literal>:"
#. Tag: programlisting
#: Spring.xml:114
@@ -297,19 +298,19 @@
#: Spring.xml:116
#, no-c-format
msgid "The use of Spring beans in EL is not limited to injection. Spring beans may be used anywhere that EL expressions are used in Seam: process and pageflow definitions, working memory assertions, etc..."
-msgstr ""
+msgstr "L'uso dei bean Spring in EL non è limitato all'iniezione. I bean Spring possono essere usati ovunque sono usate le espressioni EL in Seam: definizioni di processo e pageflow, asserzioni nella working memory, ecc."
#. Tag: title
#: Spring.xml:122
#, no-c-format
msgid "Making a Spring bean into a Seam component"
-msgstr ""
+msgstr "Inserire un bean Spring in un componente Seam"
#. Tag: para
#: Spring.xml:124
#, no-c-format
msgid "The <literal><seam:component/></literal> namespace handler can be used to make any Spring bean a Seam component. Just place the <literal><seam:component/></literal> tag within the declaration of the bean that you wish to be a Seam component:"
-msgstr ""
+msgstr "L'handler namespace <literal><seam:component/></literal> può essere usato per far diventare un bean Spring un componente Seam. Si collochi il tag <literal><seam:component/></literal> dentro la dichiarazione del bean che si vuole rendere componente Seam:"
#. Tag: programlisting
#: Spring.xml:128
@@ -375,7 +376,7 @@
#: Spring.xml:160
#, no-c-format
msgid "The prefix of the scope name may be changed by specifying the <literal>prefix</literal> attribute in the <literal>configure-scopes</literal> definition. (The default prefix is <literal>seam.</literal>)"
-msgstr ""
+msgstr "Il prefisso del nome dello scope può essere cambiato specificando l'attributo <literal>prefix</literal> nella definizione di <literal>configure-scopes</literal>. (Il prefisso di default è <literal>seam.</literal>)"
#. Tag: para
#: Spring.xml:163
@@ -417,7 +418,7 @@
#: Spring.xml:180
#, no-c-format
msgid "Using Spring PlatformTransactionManagement"
-msgstr ""
+msgstr "Uso di Spring PlatformTransactionManagement"
#. Tag: para
#: Spring.xml:182
@@ -429,7 +430,7 @@
#: Spring.xml:190
#, no-c-format
msgid "To configure Seam to use Spring transactions enable the SpringTransaction component like so:"
-msgstr ""
+msgstr "Per configurare Seam ad usare le transazioni di Spring abilitare il componente SpringTransaction in queso modo:"
#. Tag: programlisting
#: Spring.xml:192
@@ -441,13 +442,13 @@
#: Spring.xml:194
#, no-c-format
msgid "The <literal>spring:spring-transaction</literal> component will utilize Springs transaction synchronization capabilities for synchronization callbacks."
-msgstr ""
+msgstr "Il componente <literal>spring:spring-transaction</literal> utilizzerà le capacità di sincronizzazione delle transazioni di Spring per le callback di sincronizzazione."
#. Tag: title
#: Spring.xml:200
#, no-c-format
msgid "Using a Seam Managed Persistence Context in Spring"
-msgstr ""
+msgstr "Uso del contesto di persistenza gestito da Seam in Spring"
#. Tag: para
#: Spring.xml:202
@@ -459,37 +460,37 @@
#: Spring.xml:212
#, no-c-format
msgid "Seam provides a way for Spring to access a Seam managed persistence context with Spring's provided JPA tools bringing conversation scoped persistence context capabilities to Spring applications."
-msgstr ""
+msgstr "Seam fornisce un modo per far accedere Spring ad un contesto di persistenza gestito da Seam con i tool JPA forniti da Spring che portano nelle applicazioni Seam le capacità del contesto di persistenza con scope conversazione."
#. Tag: para
#: Spring.xml:216
#, no-c-format
msgid "This integration work provides the following functionality:"
-msgstr ""
+msgstr "Questo lavoro di integrazione fornisce la seguente funzionalità:"
#. Tag: para
#: Spring.xml:220
#, no-c-format
msgid "transparent access to a Seam managed persistence context using Spring provided tools"
-msgstr ""
+msgstr "accesso trasparente al contesto di persistenza gestito da Seam usando i tool forniti da Spring"
#. Tag: para
#: Spring.xml:223
#, no-c-format
msgid "access to Seam conversation scoped persistence contexts in a non web request (e.g. asynchronous quartz job)"
-msgstr ""
+msgstr "accesso ai contesti di persistenza con scope conversazione di Seam in una richiesta non web (es. job asincrono di quartz)"
#. Tag: para
#: Spring.xml:227
#, no-c-format
msgid "allows for using Seam managed persistence contexts with Spring managed transactions (will need to flush the persistence context manually)"
-msgstr ""
+msgstr "consente l'uso dei contesti di persistenza gestiti da Seam con le transazioni gestite da Spring (occorrerà eseguire manualmente il flush del contesto di persistenza)"
#. Tag: para
#: Spring.xml:232
#, no-c-format
msgid "Spring's persistence context propagation model allows only one open EntityManager per EntityManagerFactory so the Seam integration works by wrapping an EntityManagerFactory around a Seam managed persistence context."
-msgstr ""
+msgstr "Il modello di propagazione del contesto di persistenza di Spring consente solo un EntityManager aperto per EntityManagerFactory, quindi l'integrazione con Seam funziona facendo il wrapping dell'EntityManagerFactory attorno al contesto di persistenza gestito da Seam."
#. Tag: programlisting
#: Spring.xml:236
@@ -617,7 +618,7 @@
#: Spring.xml:270
#, no-c-format
msgid "The Seam Spring integration also provides support for complete access to a Seam managed Hibernate session using spring's tools. This integration is very similar to the <link linkend=\"spring-persistence\">JPA integration</link>."
-msgstr ""
+msgstr "L'integrazione di Spring con Seam fornisce anche il supporto al completo accesso alla sessione Hibernate gestita da Seam usando i tool di Spring. Quest'integrazione è molto simile all'<link linkend=\"spring-persistence\">integrazione JPA</link>."
#. Tag: para
#: Spring.xml:273
@@ -647,25 +648,25 @@
#: Spring.xml:286
#, no-c-format
msgid "Spring Application Context as a Seam Component"
-msgstr ""
+msgstr "Contesto Applicazione di Spring come componente Seam"
#. Tag: para
#: Spring.xml:288
#, no-c-format
msgid "Although it is possible to use the Spring <literal>ContextLoaderListener</literal> to start your application's Spring ApplicationContext there are a couple of limitations."
-msgstr ""
+msgstr "Sebbene sia possibile usare il <literal>ContextLoaderListener</literal> di Spring per avviare l'ApplicationContext di Spring della propria applicazione, ci sono un paio di limitazioni."
#. Tag: para
#: Spring.xml:293
#, no-c-format
msgid "the Spring ApplicationContext must be started <emphasis>after</emphasis> the <literal>SeamListener</literal>"
-msgstr ""
+msgstr "L'ApplicationContext di Spring deve essere avviato <emphasis>dopo</emphasis> <literal>SeamListener</literal>"
#. Tag: para
#: Spring.xml:297
#, no-c-format
msgid "it can be tricky starting a Spring ApplicationContext for use in Seam unit and integration tests"
-msgstr ""
+msgstr "può essere insidioso avviare un ApplicationContext di Spring da usarsi nei test d'unità e di integrazionedi Seam"
#. Tag: para
#: Spring.xml:302
15 years, 6 months