You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2017/09/17 12:29:56 UTC
[myfaces-trinidad] 02/06: Backport of JSF 2.0 changes (minues the
Facelets) for JSP compatibility testing
This is an automated email from the ASF dual-hosted git repository.
deki pushed a commit to branch 1.2.12.1-sanity-jsf2
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git
commit 8bb67f02546466ccfc345e421ed11049701c5fe9
Author: Max Starets <ms...@apache.org>
AuthorDate: Mon Nov 30 19:51:30 2009 +0000
Backport of JSF 2.0 changes (minues the Facelets) for JSP compatibility testing
---
pom.xml | 50 ++--
trinidad-api/pom.xml | 16 +-
.../trinidad/context/ExternalContextDecorator.java | 267 +--------------------
.../myfaces/trinidad/convert/NumberConverter.java | 10 +-
.../trinidad/component/FindComponentTest.java | 7 +-
.../trinidad/convert/NumberConverterTestCase.java | 25 +-
.../trinidad/util/FindRelativeComponentTest.java | 4 +-
.../trinidadbuild/test/MockFacesContext12.java | 115 ++++++++-
trinidad-examples/pom.xml | 18 +-
trinidad-impl/pom.xml | 20 +-
.../application/StateManagerImpl.java | 8 +-
.../application/ViewHandlerImpl.java | 19 +-
.../context/FacesContextFactoryImpl.java | 17 ++
.../trinidadinternal/convert/NumberConverter.java | 2 +-
.../facelets/AccessKeyPropertyTagRule.java | 163 -------------
.../facelets/DatePropertyTagRule.java | 154 ------------
.../facelets/FileDownloadActionListenerTag.java | 103 --------
.../facelets/LocalePropertyTagRule.java | 94 --------
.../facelets/ResetActionListenerTag.java | 57 -----
.../facelets/ReturnActionListenerTag.java | 70 ------
.../facelets/SetActionListenerTag.java | 68 ------
.../facelets/StringArrayPropertyTagRule.java | 116 ---------
.../facelets/TrinidadComponentHandler.java | 94 --------
.../facelets/TrinidadConverterHandler.java | 42 ----
.../facelets/TrinidadFaceletViewHandler.java | 262 --------------------
.../facelets/TrinidadListenersTagRule.java | 187 ---------------
.../facelets/TrinidadValidatorHandler.java | 42 ----
.../facelets/ValueExpressionTagRule.java | 99 --------
.../context/PartialTriggersTest.java | 4 +-
.../trinidadinternal/renderkit/MApplication.java | 20 +-
30 files changed, 264 insertions(+), 1889 deletions(-)
diff --git a/pom.xml b/pom.xml
index 764606d..ec82df3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,8 +20,8 @@
<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>
- <name>Apache MyFaces Trinidad 1.2</name>
- <description>Apache MyFaces Trinidad for JSF 1.2</description>
+ <name>Apache MyFaces Trinidad 2.0</name>
+ <description>Apache MyFaces Trinidad for JSF 2.0</description>
<url>http://myfaces.apache.org/trinidad/trinidad-1_2</url>
<inceptionYear>2001</inceptionYear>
@@ -38,15 +38,17 @@
<properties>
<!-- Standards -->
- <jdk.version>1.5</jdk.version>
+ <jdk.version>1.6</jdk.version>
<servlet.version>2.5</servlet.version>
<portlet.version>2.0</portlet.version>
+ <validation.version>1.0.0.GA</validation.version>
<jsp.version>2.1</jsp.version>
<jstl.version>1.2</jstl.version>
<jsf-spec.version>1.2</jsf-spec.version>
- <jsf-ri.version>1.2_09</jsf-ri.version>
- <jsf-myfaces.version>1.2.4</jsf-myfaces.version>
- <jsf-facelets.version>1.1.14</jsf-facelets.version>
+ <jsf-ri.version>2.0.1</jsf-ri.version>
+ <!--jsf-ri.version>2.0.0-b22</jsf-ri.version-->
+ <!--jsf-myfaces.version>1.2.4</jsf-myfaces.version>
+ <jsf-facelets.version>1.1.14</jsf-facelets.version-->
<portlet-bridge.version>1.0.0-beta</portlet-bridge.version>
<commons-lang.version>2.4</commons-lang.version>
<pluto-embedded.version>1.0.1</pluto-embedded.version>
@@ -136,9 +138,9 @@
</mailingLists>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/trinidad/tags/trinidad-1.2.12</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/trinidad/tags/trinidad-1.2.12</developerConnection>
- <url>http://svn.apache.org/viewcvs.cgi/myfaces/trinidad/tags/trinidad-1.2.12</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/trinidad/trunk/</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/trinidad/trunk/</developerConnection>
+ <url>http://svn.apache.org/viewcvs.cgi/myfaces/trinidad/trunk/</url>
</scm>
<repositories>
@@ -153,6 +155,13 @@
<name>Apache Snapshot Repository</name>
<url>http://people.apache.org/repo/m2-snapshot-repository</url>
</repository>
+ <!-- needed for Bean Validation API -->
+ <repository>
+ <id>jboss releases</id>
+ <name>JBoss Releases</name>
+ <url>http://repository.jboss.org/maven2/</url>
+ <layout>default</layout>
+ </repository>
</repositories>
<pluginRepositories>
@@ -208,20 +217,28 @@
</dependency>
<dependency>
- <groupId>javax.faces</groupId>
+ <groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${jsf-ri.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>javax.faces</groupId>
+ <groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>${jsf-ri.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <version>${validation.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+<!-- for now we just use the RI, b/c nothing around for MyFaces 2.0 -->
+ <!--dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>${jsf-myfaces.version}</version>
@@ -233,7 +250,7 @@
<artifactId>myfaces-impl</artifactId>
<version>${jsf-myfaces.version}</version>
<scope>provided</scope>
- </dependency>
+ </dependency-->
<dependency>
<groupId>org.apache.myfaces.portlet-bridge</groupId>
@@ -250,12 +267,12 @@
<scope>provided</scope>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
<version>${jsf-facelets.version}</version>
<scope>provided</scope>
- </dependency>
+ </dependency-->
<dependency>
<groupId>commons-lang</groupId>
@@ -721,7 +738,7 @@
<scope>runtime</scope>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>${jsf-myfaces.version}</version>
@@ -733,7 +750,7 @@
<artifactId>myfaces-impl</artifactId>
<version>${jsf-myfaces.version}</version>
<scope>runtime</scope>
- </dependency>
+ </dependency-->
</dependencies>
</dependencyManagement>
</profile>
@@ -807,6 +824,5 @@
</profiles>
</settings>
-->
-
</profiles>
</project>
diff --git a/trinidad-api/pom.xml b/trinidad-api/pom.xml
index 0b3f7db..e0a8f2b 100644
--- a/trinidad-api/pom.xml
+++ b/trinidad-api/pom.xml
@@ -56,14 +56,26 @@
</dependency>
<dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ </dependency>
+
+
+ <dependency>
<groupId>org.apache.myfaces.portlet-bridge</groupId>
<artifactId>portlet-bridge-api</artifactId>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
- <scope>provided</scope> <!-- force provided scope here -->
+ <scope>provided</scope>
+ </dependency-->
+
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
</dependency>
<!-- "test" scope dependencies -->
diff --git a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ExternalContextDecorator.java b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ExternalContextDecorator.java
index 1ed0234..69cbc8b 100644
--- a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ExternalContextDecorator.java
+++ b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ExternalContextDecorator.java
@@ -30,277 +30,18 @@ import java.util.Set;
import java.util.Map;
import javax.faces.context.ExternalContext;
+import javax.faces.context.ExternalContextWrapper;
/**
* Base class for decorating ExternalContexts.
*
*/
-abstract public class ExternalContextDecorator extends ExternalContext
+abstract public class ExternalContextDecorator extends ExternalContextWrapper
{
- @Override
- public void dispatch(String path) throws IOException
+ public ExternalContext getWrapped()
{
- getExternalContext().dispatch(path);
- }
-
- @Override
- public Object getContext()
- {
- return getExternalContext().getContext();
- }
-
- @Override
- public Object getRequest()
- {
- return getExternalContext().getRequest();
- }
-
- @Override
- public String getRequestCharacterEncoding()
- {
- return getExternalContext().getRequestCharacterEncoding();
- }
-
- @Override
- public String getRequestContentType()
- {
- return getExternalContext().getRequestContentType();
- }
-
- @Override
- public Object getResponse()
- {
- return getExternalContext().getResponse();
- }
-
- @Override
- public String getResponseCharacterEncoding()
- {
- return getExternalContext().getResponseCharacterEncoding();
- }
-
- @Override
- public String getResponseContentType()
- {
- return getExternalContext().getResponseContentType();
- }
-
- @Override
- public Object getSession(boolean create)
- {
- return getExternalContext().getSession(create);
- }
-
- @Override
- public String getRequestContextPath()
- {
- return getExternalContext().getRequestContextPath();
- }
-
- @Override
- public String getRequestPathInfo()
- {
- return getExternalContext().getRequestPathInfo();
- }
-
- @Override
- public String getRequestServletPath()
- {
- return getExternalContext().getRequestServletPath();
- }
-
- @Override
- public String getInitParameter(String name)
- {
- return getExternalContext().getInitParameter(name);
- }
-
- @Override
- public String encodeResourceURL(String url)
- {
- return getExternalContext().encodeResourceURL(url);
- }
-
- @Override
- public String encodeActionURL(String url)
- {
- return getExternalContext().encodeActionURL(url);
- }
-
- @Override
- public String encodeNamespace(String ns)
- {
- return getExternalContext().encodeNamespace(ns);
- }
-
- @Override
- public String getAuthType()
- {
- return getExternalContext().getAuthType();
- }
-
- @Override
- public String getRemoteUser()
- {
- return getExternalContext().getRemoteUser();
- }
-
- @Override
- public Principal getUserPrincipal()
- {
- return getExternalContext().getUserPrincipal();
- }
-
- @Override
- public boolean isUserInRole(String role)
- {
- return getExternalContext().isUserInRole(role);
- }
-
- @Override
- public URL getResource(String path) throws MalformedURLException
- {
- return getExternalContext().getResource(path);
- }
-
- @Override
- public InputStream getResourceAsStream(String path)
- {
- return getExternalContext().getResourceAsStream(path);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Set getResourcePaths(String path)
- {
- return getExternalContext().getResourcePaths(path);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map getRequestParameterMap()
- {
- return getExternalContext().getRequestParameterMap();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map getRequestParameterValuesMap()
- {
- return getExternalContext().getRequestParameterValuesMap();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Iterator getRequestParameterNames()
- {
- return getExternalContext().getRequestParameterNames();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map getRequestCookieMap()
- {
- return getExternalContext().getRequestCookieMap();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map getRequestHeaderMap()
- {
- return getExternalContext().getRequestHeaderMap();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map getRequestHeaderValuesMap()
- {
- return getExternalContext().getRequestHeaderValuesMap();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map getInitParameterMap()
- {
- return getExternalContext().getInitParameterMap();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map getApplicationMap()
- {
- return getExternalContext().getApplicationMap();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map getSessionMap()
- {
- return getExternalContext().getSessionMap();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map getRequestMap()
- {
- return getExternalContext().getRequestMap();
- }
-
- @Override
- public Locale getRequestLocale()
- {
- return getExternalContext().getRequestLocale();
- }
-
- @Override
- public void setRequest(Object request)
- {
- getExternalContext().setRequest(request);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void setRequestCharacterEncoding(String encoding) throws UnsupportedEncodingException
- {
- getExternalContext().setRequestCharacterEncoding(encoding);
- }
-
- @Override
- public void setResponse(Object response)
- {
- getExternalContext().setResponse(response);
- }
-
- @Override
- public void setResponseCharacterEncoding(String encoding)
- {
- getExternalContext().setResponseCharacterEncoding(encoding);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Iterator getRequestLocales()
- {
- return getExternalContext().getRequestLocales();
- }
-
- @Override
- public void log(String message)
- {
- getExternalContext().log(message);
- }
-
- @Override
- public void log(String message, Throwable t)
- {
- getExternalContext().log(message, t);
- }
-
- @Override
- public void redirect(String url) throws IOException
- {
- getExternalContext().redirect(url);
+ return getExternalContext();
}
abstract protected ExternalContext getExternalContext();
diff --git a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java
index 27b395b..561fb7d 100644
--- a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java
+++ b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/NumberConverter.java
@@ -282,7 +282,7 @@ public class NumberConverter extends javax.faces.convert.NumberConverter
if (typeIdx == _PATTERN_TYPE)
{
- // We call this since the pattern may contain the generic currency sign '�', which we don't
+ // We call this since the pattern may contain the generic currency sign, which we don't
// want to display to the user.
pattern = getLocalizedPattern(context, pattern, dfs);
@@ -750,7 +750,7 @@ public class NumberConverter extends javax.faces.convert.NumberConverter
}
/**
- * If <code>pattern</code> contains the generic currency sign '�', this method will replace it
+ * If <code>pattern</code> contains the generic currency sign, this method will replace it
* with the localized currency symbol (if one exists).
* @param context the FacesContext
* @param pattern the pattern to be localized
@@ -762,13 +762,13 @@ public class NumberConverter extends javax.faces.convert.NumberConverter
if (pattern == null)
return null;
- // If the pattern contains the generic currency sign '�', replace it with the localized
+ // If the pattern contains the generic currency sign, replace it with the localized
// currency symbol (if one exists), so that when the pattern is displayed (such as in an error
// message), it is more meaningful to the user.
- // If the pattern contains '��', replace it with the international currency symbol.
+ // If the pattern contains double international currency symbol, replace it with the international currency symbol.
// For an explanation of this behavior, see section "Special Pattern Characters" at:
// http://java.sun.com/javase/6/docs/api/java/text/DecimalFormat.html
- // The unicode for '�' is: \u00A4
+ // The unicode for the international currency symbol is: \u00A4
// The xml hex is : ¤
int idx = pattern.indexOf('\u00A4');
if (idx == -1)
diff --git a/trinidad-api/src/test/java/org/apache/myfaces/trinidad/component/FindComponentTest.java b/trinidad-api/src/test/java/org/apache/myfaces/trinidad/component/FindComponentTest.java
index eda3aac..8fd1773 100644
--- a/trinidad-api/src/test/java/org/apache/myfaces/trinidad/component/FindComponentTest.java
+++ b/trinidad-api/src/test/java/org/apache/myfaces/trinidad/component/FindComponentTest.java
@@ -23,13 +23,15 @@ import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.myfaces.trinidad.component.UIXPanel;
+import org.apache.myfaces.trinidadbuild.test.FacesTestCase;
-public class FindComponentTest extends TestCase
+public class FindComponentTest extends FacesTestCase
{
public static final Test suite()
{
@@ -156,6 +158,7 @@ public class FindComponentTest extends TestCase
UIXPanel g = new UIXPanel(); g.setId("g");
UIXPanel h = new UIXPanel(); h.setId("h");
UIXPanel i = new UIXPanel(); i.setId("i");
+
a.getChildren().add(b);
a.getChildren().add(c);
b.getChildren().add(d);
diff --git a/trinidad-api/src/test/java/org/apache/myfaces/trinidad/convert/NumberConverterTestCase.java b/trinidad-api/src/test/java/org/apache/myfaces/trinidad/convert/NumberConverterTestCase.java
index 535f40a..e875c1e 100644
--- a/trinidad-api/src/test/java/org/apache/myfaces/trinidad/convert/NumberConverterTestCase.java
+++ b/trinidad-api/src/test/java/org/apache/myfaces/trinidad/convert/NumberConverterTestCase.java
@@ -217,28 +217,7 @@ public abstract class NumberConverterTestCase extends ConverterTestCase
}
}
-// public void testFranceLocale()
-// {
-// NumberConverter converter = getNumberConverter();
-// Mock mock = mock(UIComponent.class);
-// UIComponent comp = (UIComponent) mock.proxy();
-//
-// converter.setLocale(Locale.FRANCE);
-// converter.setType("currency");
-// Double d = new Double(12345.68d);
-//
-// setFacesContext(facesContext);
-// try
-// {
-// String convertedString = converter.getAsString(facesContext, comp, d);
-// assertEquals("12�345,68 �", convertedString);
-// }
-// finally
-// {
-// setFacesContext(null);
-// }
-// mock.verify();
-// }
+
public void testCurrencyCodeIsHonoured()
{
@@ -579,4 +558,4 @@ public abstract class NumberConverterTestCase extends ConverterTestCase
// Pattern tested
// Type tested
// GroupingUsed tested
-// IntegerOnly tested // only while parsing
\ No newline at end of file
+// IntegerOnly tested // only while parsing
diff --git a/trinidad-api/src/test/java/org/apache/myfaces/trinidad/util/FindRelativeComponentTest.java b/trinidad-api/src/test/java/org/apache/myfaces/trinidad/util/FindRelativeComponentTest.java
index 12f80a5..535c330 100644
--- a/trinidad-api/src/test/java/org/apache/myfaces/trinidad/util/FindRelativeComponentTest.java
+++ b/trinidad-api/src/test/java/org/apache/myfaces/trinidad/util/FindRelativeComponentTest.java
@@ -18,7 +18,6 @@
*/
package org.apache.myfaces.trinidad.util;
-import junit.framework.TestCase;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
@@ -31,8 +30,9 @@ import org.apache.myfaces.trinidad.component.UIXCommand;
import org.apache.myfaces.trinidad.component.UIXInput;
import org.apache.myfaces.trinidad.component.UIXPanel;
import org.apache.myfaces.trinidad.component.UIXTable;
+import org.apache.myfaces.trinidadbuild.test.FacesTestCase;
-public class FindRelativeComponentTest extends TestCase
+public class FindRelativeComponentTest extends FacesTestCase
{
public static final Test suite()
{
diff --git a/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MockFacesContext12.java b/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MockFacesContext12.java
index 1888b7a..b823ade 100644
--- a/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MockFacesContext12.java
+++ b/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MockFacesContext12.java
@@ -18,14 +18,27 @@
*/
package org.apache.myfaces.trinidadbuild.test;
+import java.util.Collection;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
import javax.el.ELContext;
import javax.faces.application.Application;
+import javax.faces.application.ApplicationWrapper;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.faces.context.PartialResponseWriter;
+import javax.faces.context.PartialViewContext;
+import javax.faces.event.PhaseId;
+import javax.faces.event.SystemEvent;
import javax.faces.lifecycle.Lifecycle;
import org.apache.shale.test.mock.MockFacesContext;
+import org.apache.shale.test.mock.MockApplication12;
+
public class MockFacesContext12 extends MockFacesContext
{
@@ -36,12 +49,14 @@ public class MockFacesContext12 extends MockFacesContext
super(ec, lifecycle);
elContext = createELContext(application);
elContext.putContext(FacesContext.class, this);
+ _app = application;
}
public MockFacesContext12(Application application)
{
elContext = createELContext(application);
elContext.putContext(FacesContext.class, this);
+ _app = application;
}
public ELContext getELContext()
@@ -53,6 +68,104 @@ public class MockFacesContext12 extends MockFacesContext
{
return new MockELContext(application);
}
+
+ public Map<Object,Object> getAttributes()
+ {
+ return _attrs;
+ }
+
+ public PartialViewContext getPartialViewContext()
+ {
+ return _mockPartialContext;
+ }
+
+ public Application getApplication()
+ {
+ return new ApplicationWrapper()
+ {
+ public Application getWrapped()
+ {
+ return _app;
+ }
+ public void publishEvent(FacesContext context,
+ Class<? extends SystemEvent> systemEventClass,
+ Class<?> sourceBaseType,
+ Object source)
+ {
+ // do nothing
+ }
+
+ public void publishEvent(FacesContext context,
+ Class<? extends SystemEvent> systemEventClass,
+ Object source)
+ {
+ //do nothing
+ }
+ };
+ }
protected MockELContext elContext;
-}
\ No newline at end of file
+
+
+ private final PartialViewContext _mockPartialContext = new MockPartialViewContext();
+ private final Map<Object, Object> _attrs = new HashMap<Object, Object>();
+ private Application _app;
+
+ private static class MockPartialViewContext extends PartialViewContext
+ {
+ public Collection<String> getExecuteIds()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Collection<String> getRenderIds()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PartialResponseWriter getPartialResponseWriter()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isAjaxRequest()
+ {
+ return false;
+ }
+
+ public boolean isPartialRequest()
+ {
+ return false;
+ }
+
+ public boolean isExecuteAll()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isRenderAll()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setRenderAll(boolean renderAll)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setPartialRequest(boolean isPartialRequest)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void release()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void processPartial(PhaseId phaseId)
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
diff --git a/trinidad-examples/pom.xml b/trinidad-examples/pom.xml
index dfe8766..af3077a 100644
--- a/trinidad-examples/pom.xml
+++ b/trinidad-examples/pom.xml
@@ -129,7 +129,7 @@
<scope>runtime</scope>
</dependency-->
- <dependency>
+ <!--dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<scope>compile</scope>
@@ -139,7 +139,8 @@
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<scope>runtime</scope>
- </dependency>
+ </dependency-->
+
</dependencies>
</dependencyManagement>
</profile>
@@ -150,13 +151,16 @@
flag. To invoke this profile, simply do not include a -Djsf= property on your maven
command line. Execute this profile like this:
+ mstarets - The default has been temporarily changed to JSF RI
+ TODO: Restore old profile activation rules after we can build with myfaces
+
mvn -PjettyConfig jetty:run
-->
<profile>
<id>myfaces</id>
<activation>
<property>
- <name>!jsf</name>
+ <name>myfaces</name>
</property>
</activation>
<dependencies>
@@ -169,6 +173,7 @@
<artifactId>myfaces-impl</artifactId>
</dependency>
</dependencies>
+
</profile>
<!--
@@ -183,17 +188,16 @@
<id>jsfri</id>
<activation>
<property>
- <name>jsf</name>
- <value>ri</value>
+ <name>!myfaces</name>
</property>
</activation>
<dependencies>
<dependency>
- <groupId>javax.faces</groupId>
+ <groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
</dependency>
<dependency>
- <groupId>javax.faces</groupId>
+ <groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
</dependency>
</dependencies>
diff --git a/trinidad-impl/pom.xml b/trinidad-impl/pom.xml
index b616218..c1e4c56 100644
--- a/trinidad-impl/pom.xml
+++ b/trinidad-impl/pom.xml
@@ -60,10 +60,16 @@
<artifactId>jstl</artifactId>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
- <scope>provided</scope> <!-- force provided scope here -->
+ <scope>provided</scope>
+ </dependency-->
+
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -76,10 +82,10 @@
<artifactId>trinidad-api</artifactId>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
- </dependency>
+ </dependency-->
<!-- "test" scope dependencies -->
<dependency>
@@ -115,11 +121,11 @@
<scope>test</scope>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
- <scope>test</scope> <!-- getting web-facesconfig dtd from myfaces impl for unit tests -->
- </dependency>
+ <scope>test</scope>
+ </dependency-->
</dependencies>
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java
index a249b92..5d63b15 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java
@@ -46,7 +46,6 @@ import org.apache.myfaces.trinidadinternal.util.LRUCache;
import org.apache.myfaces.trinidadinternal.util.SubKeyMap;
import org.apache.myfaces.trinidadinternal.util.TokenCache;
-import com.sun.facelets.FaceletViewHandler;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
@@ -132,7 +131,7 @@ public class StateManagerImpl extends StateManagerWrapper
}
@Override
- protected StateManager getWrapped()
+ public StateManager getWrapped()
{
return _delegate;
}
@@ -970,12 +969,13 @@ public class StateManagerImpl extends StateManagerWrapper
{
if (_structureGeneratedByTemplate == null)
{
+ // TODO: Partial State Saving
ExternalContext external = context.getExternalContext();
- String restoreMode = external.getInitParameter(
+ /*String restoreMode = external.getInitParameter(
FaceletViewHandler.PARAM_BUILD_BEFORE_RESTORE);
if ("true".equals(restoreMode))
_structureGeneratedByTemplate = Boolean.TRUE;
- else
+ else*/
_structureGeneratedByTemplate = Boolean.FALSE;
}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
index fbd69b2..027ca9d 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
@@ -42,6 +42,8 @@ import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.faces.view.ViewDeclarationLanguage;
+
import org.apache.myfaces.trinidad.context.RequestContext;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
@@ -77,10 +79,25 @@ public class ViewHandlerImpl extends ViewHandlerWrapper
_loadInternalViews();
}
- protected ViewHandler getWrapped()
+ public ViewHandler getWrapped()
{
return _delegate;
}
+
+ @Override
+ public ViewDeclarationLanguage getViewDeclarationLanguage(FacesContext context,
+ String viewId)
+ {
+ // InternalViews will not use ViewDeclarationLanguage processors,
+ // since they do essentially the same job themselves.
+ InternalView internal = _getInternalView(context, viewId);
+ if (internal != null)
+ {
+ return null;
+ }
+ return _delegate.getViewDeclarationLanguage(context, viewId);
+ }
+
@Override
public UIViewRoot createView(FacesContext context, String viewId)
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/FacesContextFactoryImpl.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/FacesContextFactoryImpl.java
index 65f634e..52e4999 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/FacesContextFactoryImpl.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/FacesContextFactoryImpl.java
@@ -19,6 +19,11 @@
package org.apache.myfaces.trinidadinternal.context;
import java.io.IOException;
+
+import java.net.MalformedURLException;
+
+import java.net.URL;
+
import java.util.Iterator;
import java.util.Map;
@@ -266,6 +271,18 @@ public class FacesContextFactoryImpl
super.dispatch(path);
}
+
+ @Override
+ public URL getResource(String path)
+ throws MalformedURLException
+ {
+ RequestContext afc = RequestContext.getCurrentInstance();
+ if (afc != null)
+ {
+ path = afc.getPageResolver().getPhysicalURI(path);
+ }
+ return super.getResource(path);
+ }
@Override
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/NumberConverter.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/NumberConverter.java
index 71df002..23dc026 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/NumberConverter.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/NumberConverter.java
@@ -147,7 +147,7 @@ public class NumberConverter extends org.apache.myfaces.trinidad.convert.NumberC
else
params = new Object[4];
- // We call this since the pattern may contain the generic currency sign '�', which we don't
+ // We call this since the pattern may contain the generic currency sign, which we don't
// want to display to the user.
params[0] = getLocalizedPattern(context, getPattern(), null);
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/AccessKeyPropertyTagRule.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/AccessKeyPropertyTagRule.java
index c804c6e..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/AccessKeyPropertyTagRule.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/AccessKeyPropertyTagRule.java
@@ -1,163 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagAttributeException;
-
-import javax.el.ValueExpression;
-
-import org.apache.myfaces.trinidad.bean.FacesBean;
-import org.apache.myfaces.trinidad.bean.PropertyKey;
-import org.apache.myfaces.trinidad.component.UIXComponent;
-import org.apache.myfaces.trinidadinternal.taglib.util.VirtualAttributeUtils;
-import org.apache.myfaces.trinidadinternal.util.nls.StringUtils;
-
-/**
- *
- * @version $Id: StringArrayPropertyTagRule.java,v 1.1 2005/08/23 05:54:54 adamwiner Exp $
- */
-final class AccessKeyPropertyTagRule extends MetaRule
-{
- public static final MetaRule Instance = new AccessKeyPropertyTagRule();
-
- /**
- * Metadata for non-literal "AndAccessKey" attributes
- */
- private static class AccessKeyMetadata extends Metadata
- {
- public AccessKeyMetadata(
- String mainMethodName,
- TagAttribute attribute)
- {
- _mainMethodName = mainMethodName;
- _attribute = attribute;
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public void applyMetadata(FaceletContext ctx, Object instance)
- {
- ValueExpression expr = _attribute.getValueExpression(ctx, String.class);
- UIXComponent uixcomp = (UIXComponent) instance;
- FacesBean bean = uixcomp.getFacesBean();
- PropertyKey mainKey = bean.getType().findKey(_mainMethodName);
- if (mainKey == null)
- throw new TagAttributeException(_attribute,
- "No support for '" + _mainMethodName +
- "' attribute on " + instance);
- PropertyKey accessKeyKey = bean.getType().findKey("accessKey");
- if (accessKeyKey == null)
- throw new TagAttributeException(_attribute,
- "No support for 'accessKey' attribute on " + instance);
- VirtualAttributeUtils.setAccessKeyAttribute(bean, expr, mainKey, accessKeyKey);
- }
-
- private final String _mainMethodName;
- private final TagAttribute _attribute;
- }
-
- /**
- * Metadata for literal (non-EL) "AndAccessKey" attributes
- */
- private static class LiteralAccessKeyMetadata extends Metadata
- {
- public LiteralAccessKeyMetadata(
- Method mainMethod,
- Method accessKeyMethod,
- TagAttribute attribute)
- {
- _mainMethod = mainMethod;
- _accessKeyMethod = accessKeyMethod;
-
- String text = attribute.getValue();
-
- int accessKeyIndex = StringUtils.getMnemonicIndex(text);
- if (accessKeyIndex != StringUtils.MNEMONIC_INDEX_NONE)
- {
- _accessKey = Character.valueOf(text.charAt(accessKeyIndex + 1));
- text = StringUtils.stripMnemonic(text);
- }
- else
- {
- _accessKey = null;
- }
-
- _text = text;
- _attribute = attribute;
- }
-
- @Override
- public void applyMetadata(FaceletContext ctx, Object instance)
- {
- try
- {
- if (_accessKey != null)
- _accessKeyMethod.invoke(instance, _accessKey);
- _mainMethod.invoke(instance, _text);
- }
- catch (InvocationTargetException e)
- {
- throw new TagAttributeException(_attribute, e.getCause());
- }
- catch (Exception e)
- {
- throw new TagAttributeException(_attribute, e);
- }
- }
-
- private final Method _mainMethod;
- private final Method _accessKeyMethod;
- private final TagAttribute _attribute;
- private final String _text;
- private final Character _accessKey;
- }
-
-
- @Override
- public Metadata applyRule(
- String name,
- TagAttribute attribute,
- MetadataTarget meta)
- {
- if (name.endsWith("AndAccessKey"))
- {
- String mainProperty = name.substring(0, name.length() - "AndAccessKey".length());
- Method mainM = meta.getWriteMethod(mainProperty);
- Method accessKeyM = meta.getWriteMethod("accessKey");
-
- // if the property is writable
- if ((mainM != null) && (accessKeyM != null))
- {
- if (attribute.isLiteral())
- return new LiteralAccessKeyMetadata(mainM, accessKeyM, attribute);
- else
- return new AccessKeyMetadata(mainProperty, attribute);
- }
- }
- return null;
- }
-}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/DatePropertyTagRule.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/DatePropertyTagRule.java
index 58701b2..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/DatePropertyTagRule.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/DatePropertyTagRule.java
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.TagAttribute;
-
-import com.sun.facelets.tag.TagAttributeException;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import java.text.DateFormat;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.TimeZone;
-
-
-import org.apache.myfaces.trinidad.context.RequestContext;
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-
-class DatePropertyTagRule
- extends MetaRule
-{
- static DatePropertyTagRule Instance = new DatePropertyTagRule();
-
- private static class LiteralPropertyMetadata extends Metadata
- {
- public LiteralPropertyMetadata(Method method, TagAttribute attribute,
- boolean adjustToEnd)
- {
- _method = method;
- _attribute = attribute;
- _adjustToEnd = adjustToEnd;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance)
- {
- if (_params == null)
- {
- Date date = _coerceToDate(_attribute.getValue(), _adjustToEnd);
- _params = new Object[]{date};
- }
- try
- {
- _method.invoke(instance, _params);
- }
- catch (InvocationTargetException e)
- {
- throw new TagAttributeException(_attribute, e.getCause());
- }
- catch (Exception e)
- {
- throw new TagAttributeException(_attribute, e);
- }
- }
-
- private final Method _method;
- private final TagAttribute _attribute;
- private final boolean _adjustToEnd;
- private Object[] _params;
- }
-
- public Metadata applyRule(String name, TagAttribute attribute,
- MetadataTarget meta)
- {
- if (meta.getPropertyType(name) == _DATE_TYPE && attribute.isLiteral())
- {
- Method m = meta.getWriteMethod(name);
-
- // if the property is writable
- if (m != null)
- {
- return new LiteralPropertyMetadata(m, attribute, _MAX_VALUE.equals(name));
- }
- }
-
- return null;
- }
-
- static private Date _coerceToDate(String str, boolean adjustToEnd)
- {
- if (str == null)
- return null;
-
- try
- {
- Date date = _getDateFormat().parse(str);
-
- // This code is taken from UIXComponentELTag
- // We should probably not do the ajustment here,
- // but instead be smarter when days are compared.
- if (adjustToEnd)
- {
- Calendar c = Calendar.getInstance();
- TimeZone tz = RequestContext.getCurrentInstance().getTimeZone();
- if (tz != null)
- c.setTimeZone(tz);
- c.setTime(date);
- // Original value had 00:00:00 for hours,mins, seconds now maximize those
- // to get the latest time value for the date supplied.
- c.set (Calendar.HOUR_OF_DAY, 23);
- c.set (Calendar.MINUTE, 59);
- c.set (Calendar.SECOND, 59);
- c.set (Calendar.MILLISECOND, 999);
- }
-
- return date;
- }
- catch (ParseException pe)
- {
- _LOG.info("CANNOT_PARSE_VALUE_INTO_DATE", str);
- return null;
- }
- }
-
- // We rely strictly on ISO 8601 formats
- private static DateFormat _getDateFormat()
- {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- TimeZone tz = RequestContext.getCurrentInstance().getTimeZone();
- if (tz != null)
- sdf.setTimeZone(tz);
- return sdf;
- }
-
- static private final Class<? extends Date> _DATE_TYPE = Date.class;
- static private final String _MAX_VALUE = "maxValue";
-
- static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(DatePropertyTagRule.class);
-}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/FileDownloadActionListenerTag.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/FileDownloadActionListenerTag.java
index 267bbb7..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/FileDownloadActionListenerTag.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/FileDownloadActionListenerTag.java
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.el.ELException;
-import javax.el.MethodExpression;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.component.ActionSource;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.apache.myfaces.trinidadinternal.taglib.listener.FileDownloadActionListener;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.FaceletException;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagConfig;
-import com.sun.facelets.tag.TagHandler;
-import com.sun.facelets.tag.jsf.ComponentSupport;
-
-/**
- *
- */
-public class FileDownloadActionListenerTag extends TagHandler
-{
-
- public FileDownloadActionListenerTag(TagConfig tagConfig)
- {
- super(tagConfig);
- _filename = getAttribute("filename");
- _contentType = getAttribute("contentType");
- _method = getRequiredAttribute("method");
- }
-
- public void apply(FaceletContext faceletContext,
- UIComponent parent) throws IOException, FacesException, FaceletException, ELException
- {
- if(ComponentSupport.isNew(parent))
- {
- FileDownloadActionListener listener = new FileDownloadActionListener();
- if (_filename != null)
- {
- if (_filename.isLiteral())
- listener.setFilename(_filename.getValue());
- else
- {
- ValueExpression valueExp = _filename.getValueExpression(faceletContext,
- Object.class);
- listener.setValueExpression(FileDownloadActionListener.FILENAME_KEY,
- valueExp);
- }
- }
-
- if (_contentType != null)
- {
- if (_contentType.isLiteral())
- listener.setContentType(_contentType.getValue());
- else
- {
- ValueExpression valueExp = _contentType.getValueExpression(faceletContext,
- Object.class);
- listener.setValueExpression(FileDownloadActionListener.CONTENT_TYPE_KEY,
- valueExp);
- }
- }
-
- MethodExpression me = _method.getMethodExpression(faceletContext,
- Object.class,
- _METHOD_PARAMS);
- listener.setMethod(me);
-
- ActionSource actionSource = (ActionSource)parent;
- actionSource.addActionListener(listener);
- }
- }
-
- static private final Class[] _METHOD_PARAMS =
- new Class[]{FacesContext.class, OutputStream.class};
-
- private final TagAttribute _method;
- private final TagAttribute _filename;
- private final TagAttribute _contentType;
-}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/LocalePropertyTagRule.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/LocalePropertyTagRule.java
index 0b65ce2..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/LocalePropertyTagRule.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/LocalePropertyTagRule.java
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.TagAttribute;
-
-import com.sun.facelets.tag.TagAttributeException;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import java.util.Locale;
-
-
-class LocalePropertyTagRule extends MetaRule
-{
- static LocalePropertyTagRule Instance = new LocalePropertyTagRule();
-
- private static class LiteralPropertyMetadata extends Metadata
- {
- public LiteralPropertyMetadata(Method method, TagAttribute attribute)
- {
- _method = method;
- _attribute = attribute;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance)
- {
- if (_params == null)
- {
- Locale loc = new Locale(_attribute.getValue(ctx));
- _params = new Object[]{loc};
- }
- try
- {
- _method.invoke(instance, _params);
- }
- catch (InvocationTargetException e)
- {
- throw new TagAttributeException(_attribute, e.getCause());
- }
- catch (Exception e)
- {
- throw new TagAttributeException(_attribute, e);
- }
- }
-
- private final Method _method;
- private final TagAttribute _attribute;
- private Object[] _params;
- }
-
- public Metadata applyRule(String name, TagAttribute attribute,
- MetadataTarget meta)
- {
- if (meta.getPropertyType(name) == _LOCALE_TYPE && attribute.isLiteral())
- {
- Method m = meta.getWriteMethod(name);
-
- // if the property is writable
- if (m != null)
- {
- return new LiteralPropertyMetadata(m, attribute);
- }
- }
-
- return null;
- }
-
-
-
- static private final Class<? extends Locale> _LOCALE_TYPE = Locale.class;
-
-}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ResetActionListenerTag.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ResetActionListenerTag.java
index 080ea88..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ResetActionListenerTag.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ResetActionListenerTag.java
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import java.io.IOException;
-
-import javax.el.ELException;
-import javax.faces.FacesException;
-import javax.faces.component.ActionSource;
-import javax.faces.component.UIComponent;
-
-import org.apache.myfaces.trinidadinternal.taglib.listener.ResetActionListener;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.FaceletException;
-import com.sun.facelets.tag.TagConfig;
-import com.sun.facelets.tag.TagHandler;
-import com.sun.facelets.tag.jsf.ComponentSupport;
-
-/**
- *
- */
-public class ResetActionListenerTag extends TagHandler
-{
-
- public ResetActionListenerTag(TagConfig tagConfig)
- {
- super(tagConfig);
- }
-
- public void apply(FaceletContext faceletContext,
- UIComponent parent) throws IOException, FacesException, FaceletException, ELException
- {
- if(ComponentSupport.isNew(parent))
- {
- ActionSource actionSource = (ActionSource)parent;
- ResetActionListener listener = new ResetActionListener();
- actionSource.addActionListener(listener);
- }
- }
-}
\ No newline at end of file
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java
index 41387a6..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ReturnActionListenerTag.java
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import java.io.IOException;
-
-import javax.el.ELException;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.component.ActionSource;
-import javax.faces.component.UIComponent;
-
-import org.apache.myfaces.trinidadinternal.taglib.listener.ReturnActionListener;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.FaceletException;
-import com.sun.facelets.el.LegacyValueBinding;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagConfig;
-import com.sun.facelets.tag.TagHandler;
-import com.sun.facelets.tag.jsf.ComponentSupport;
-
-/**
- *
- */
-public class ReturnActionListenerTag extends TagHandler
-{
-
- public ReturnActionListenerTag(TagConfig tagConfig)
- {
- super(tagConfig);
- _value = getAttribute("value");
- }
-
- @SuppressWarnings("deprecation")
- public void apply(FaceletContext faceletContext,
- UIComponent parent) throws IOException, FacesException, FaceletException, ELException
- {
- if(ComponentSupport.isNew(parent))
- {
- ActionSource actionSource = (ActionSource)parent;
- ReturnActionListener listener = new ReturnActionListener();
- if (_value != null)
- {
- ValueExpression valueExp = _value.getValueExpression(faceletContext, Object.class);
- listener.setValueExpression(ReturnActionListener.VALUE_KEY,valueExp);
- }
-
- actionSource.addActionListener(listener);
- }
- }
-
- private final TagAttribute _value;
-}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java
index 64ffb44..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/SetActionListenerTag.java
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import javax.el.ELException;
-import javax.el.ValueExpression;
-import javax.faces.component.ActionSource;
-import javax.faces.component.UIComponent;
-
-import org.apache.myfaces.trinidad.event.SetActionListener;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.FaceletException;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagConfig;
-import com.sun.facelets.tag.TagHandler;
-import com.sun.facelets.tag.jsf.ComponentSupport;
-
-/**
- */
-public class SetActionListenerTag extends TagHandler
-{
-
- public SetActionListenerTag(TagConfig tagConfig)
- {
- super(tagConfig);
- _from = getRequiredAttribute("from");
- _to = getRequiredAttribute("to");
- }
-
- public void apply(FaceletContext faceletContext,
- UIComponent parent) throws FaceletException, ELException
- {
- if (ComponentSupport.isNew(parent))
- {
- // =-=AEW Couldn't this be cached?
- ValueExpression fromExpression = _from.getValueExpression(faceletContext,
- Object.class);
- ValueExpression toExpression= _to.getValueExpression(faceletContext,
- Object.class);
- ActionSource actionSource= (ActionSource) parent;
- SetActionListener listener = new SetActionListener();
- listener.setValueExpression("from", fromExpression);
- listener.setValueExpression("to", toExpression);
- actionSource.addActionListener(listener);
- }
- }
-
- private final TagAttribute _from;
- private final TagAttribute _to;
-}
-
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/StringArrayPropertyTagRule.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/StringArrayPropertyTagRule.java
index d57d3cb..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/StringArrayPropertyTagRule.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/StringArrayPropertyTagRule.java
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagAttributeException;
-
-/**
- *
- * @version $Id: StringArrayPropertyTagRule.java,v 1.1 2005/08/23 05:54:54 adamwiner Exp $
- */
-final class StringArrayPropertyTagRule extends MetaRule
-{
- public static final MetaRule Instance = new StringArrayPropertyTagRule();
-
- private static class LiteralPropertyMetadata extends Metadata
- {
- public LiteralPropertyMetadata(Method method, TagAttribute attribute)
- {
- _method = method;
- _attribute = attribute;
- }
-
- @Override
- public void applyMetadata(FaceletContext ctx, Object instance)
- {
- if (_params == null)
- {
- String[] strArray = _coerceToStringArray(_attribute.getValue());
- _params = new Object[]{strArray};
- }
-
- try
- {
- _method.invoke(instance, _params);
- }
- catch (InvocationTargetException e)
- {
- throw new TagAttributeException(_attribute, e.getCause());
- }
- catch (Exception e)
- {
- throw new TagAttributeException(_attribute, e);
- }
- }
-
- private final Method _method;
- private final TagAttribute _attribute;
- private Object[] _params;
- }
-
-
- @Override
- public Metadata applyRule(
- String name,
- TagAttribute attribute,
- MetadataTarget meta)
- {
- // Leave expressions to the underlying code
- if ((meta.getPropertyType(name) == _STRING_ARRAY_TYPE) &&
- attribute.isLiteral())
- {
- Method m = meta.getWriteMethod(name);
-
- // if the property is writable
- if (m != null)
- {
- return new LiteralPropertyMetadata(m, attribute);
- }
- }
- return null;
- }
-
- static private String[] _coerceToStringArray(String str)
- {
- if (str == null)
- return null;
-
- ArrayList<String> list = new ArrayList<String>();
- StringTokenizer tokens = new StringTokenizer(str);
- while (tokens.hasMoreTokens())
- {
- list.add(tokens.nextToken());
- }
-
- return list.toArray(new String[list.size()]);
- }
-
- static private final Class<? extends String[]> _STRING_ARRAY_TYPE = (new String[0]).getClass();
-}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadComponentHandler.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadComponentHandler.java
index eac951f..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadComponentHandler.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadComponentHandler.java
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.FaceletViewHandler;
-import com.sun.facelets.tag.jsf.ComponentHandler;
-import com.sun.facelets.tag.jsf.ComponentConfig;
-
-import com.sun.facelets.tag.MetaRuleset;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
-import org.apache.myfaces.trinidad.component.UIXComponent;
-
-/**
- * TagLibrary implementation for Apache Trinidad core library.
- * @version
- */
-public class TrinidadComponentHandler extends ComponentHandler
-{
- public TrinidadComponentHandler(ComponentConfig config)
- {
- super(config);
- if (_markInitialState == null)
- {
- // Can't imagine why this wouldn't always run during
- // a Faces request...
- FacesContext context = FacesContext.getCurrentInstance();
- if (context != null)
- {
- ExternalContext external = context.getExternalContext();
- String restoreMode = external.getInitParameter(
- FaceletViewHandler.PARAM_BUILD_BEFORE_RESTORE);
- if ("true".equals(restoreMode))
- _markInitialState = Boolean.TRUE;
- else
- _markInitialState = Boolean.FALSE;
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected MetaRuleset createMetaRuleset(Class type)
- {
- MetaRuleset m = super.createMetaRuleset(type);
-
- m.addRule(StringArrayPropertyTagRule.Instance);
- m.addRule(TrinidadListenersTagRule.Instance);
- m.addRule(AccessKeyPropertyTagRule.Instance);
- m.addRule(DatePropertyTagRule.Instance);
-
- return m;
- }
-
- @Override
- protected void onComponentPopulated(FaceletContext context,
- UIComponent component,
- UIComponent parent)
- {
- assert (_markInitialState != null);
-
- if ((component instanceof UIXComponent) &&
- (_markInitialState == Boolean.TRUE))
- {
- if (component.getId() == null)
- component.setId(context.generateUniqueId(UIViewRoot.UNIQUE_ID_PREFIX));
-
- ((UIXComponent) component).markInitialState();
- }
- }
-
- static private Boolean _markInitialState;
-}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadConverterHandler.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadConverterHandler.java
index 4f99f04..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadConverterHandler.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadConverterHandler.java
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import com.sun.facelets.tag.MetaRuleset;
-import com.sun.facelets.tag.jsf.ConvertHandler;
-import com.sun.facelets.tag.jsf.ConverterConfig;
-
-public class TrinidadConverterHandler
- extends ConvertHandler
-{
- public TrinidadConverterHandler(ConverterConfig config)
- {
- super(config);
- }
-
- @Override
- protected MetaRuleset createMetaRuleset(Class type)
- {
- MetaRuleset m = super.createMetaRuleset(type);
- m.addRule(StringArrayPropertyTagRule.Instance);
- m.addRule(ValueExpressionTagRule.Instance);
- m.addRule(LocalePropertyTagRule.Instance);
- return m;
- }
-}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadFaceletViewHandler.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadFaceletViewHandler.java
index d42c52b..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadFaceletViewHandler.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadFaceletViewHandler.java
@@ -1,262 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-
-import com.sun.facelets.FaceletViewHandler;
-
-import java.io.IOException;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.faces.FacesException;
-import javax.faces.application.ViewHandler;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
-import org.apache.myfaces.trinidad.change.ChangeManager;
-import org.apache.myfaces.trinidad.context.PageResolver;
-import org.apache.myfaces.trinidad.context.RequestContext;
-
-/**
- * ViewHandler implementation for Trinidad in Facelets mode
- */
-public class TrinidadFaceletViewHandler
- extends FaceletViewHandler
-{
-
- // A context parameter for controlling which views should be handled by Facelets
- // based on the supplied extensions and prefixes.
- // We process this parameter exactly like Facelets does with "facelets.VIEW_MAPPINGS"
- // with the exception that we get a physical view Id from the PageResolver before checking
- // its extension/prefix.
- //
- // Unfortunately, Facelets provides no hook for plugging the PageResolver into the logic
- // handling "facelets.VIEW_MAPPINGS". We will recommend that our users leave "facelets.VIEW_MAPPINGS"
- // unset and use "org.apache.myfaces.trinidad.FACELETS_VIEW_MAPPINGS" instead.
- static public final String FACELETS_VIEW_MAPPINGS =
- "org.apache.myfaces.trinidad.FACELETS_VIEW_MAPPINGS";
-
- public TrinidadFaceletViewHandler(ViewHandler parent)
- {
- super(parent);
- _parent = parent;
- }
-
- /**
- * Overridden to apply changes from the ChangeManager
- */
- @Override
- protected void buildView(FacesContext context, UIViewRoot viewToRender)
- throws IOException, FacesException
- {
- super.buildView(context, viewToRender);
-
- // Apply changes once we have a stable view tree built. This is the earliest
- // opportunity, the document was just attached to the view root.
- ChangeManager cm = RequestContext.getCurrentInstance().getChangeManager();
- cm.applyComponentChangesForCurrentView(FacesContext.getCurrentInstance());
- }
-
-
- /**
- * Overridden to check wthether the physical viewId (as determined by PageResolver)
- * should be handled by Facelets
- */
- @Override
- public UIViewRoot restoreView(FacesContext context, String viewId)
- {
- _initMappings(context);
-
- if (_handledByFacelets(viewId))
- {
- return super.restoreView(context, viewId);
- }
- else
- {
- return _parent.restoreView(context, viewId);
- }
- }
-
- /**
- * Overridden to check wthether the physical viewId (as determined by PageResolver)
- * should be handled by Facelets
- */
- @Override
- public void renderView(FacesContext context, UIViewRoot viewToRender)
- throws IOException
- {
- if (!viewToRender.isRendered())
- {
- return;
- }
-
- _initMappings(context);
-
- if (_handledByFacelets(viewToRender.getViewId()))
- {
- super.renderView(context, viewToRender);
- }
- else
- {
- _parent.renderView(context, viewToRender);
- }
- }
-
- /**
- * Overridden to check wthether the physical viewId (as determined by PageResolver)
- * should be handled by Facelets
- */
- @Override
- public void writeState(FacesContext context)
- throws IOException
- {
- _initMappings(context);
-
- if (_handledByFacelets(context.getViewRoot().getViewId()))
- {
- super.writeState(context);
- }
- else
- {
- _parent.writeState(context);
- }
- }
-
- /**
- * This method uses double-check locking (DLC) to avoid synchronization
- * when accessing _extensionMappings and _prefixMappings
- * Note that _mappingsInitialized, _extensionMappings and _prefixMappings
- * are declared 'volatile', and _extensionMappings/_prefixMappings are not modified
- * since they are constructed.
- * JDK5 and later extends the semantics for volatile so
- * that the system will not allow a write of a volatile to be reordered with respect
- * to any previous read or write, and a read of a volatile cannot be reordered with
- * respect to any following read or write
- */
- private void _initMappings(FacesContext context)
- {
- if (_mappingsInitialized)
- {
- return;
- }
- synchronized(this)
- {
- if (!_mappingsInitialized)
- {
- ExternalContext external = context.getExternalContext();
- String viewMappings = external.getInitParameter(FACELETS_VIEW_MAPPINGS);
- if ((viewMappings != null) && (viewMappings.length() > 0))
- {
- String[] mappingsArray = viewMappings.split(";");
-
- Set<String> extensionMappings = new HashSet<String>(mappingsArray.length);
- Set<String> prefixMappings = new HashSet<String>(mappingsArray.length);
-
- for (int i = 0; i < mappingsArray.length; i++)
- {
- String mapping = mappingsArray[i].trim();
- int mappingLength = mapping.length();
- if (mappingLength <= 1)
- {
- continue;
- }
-
- if (mapping.charAt(0) == '*')
- {
- extensionMappings.add(mapping.substring(1));
- }
- else if (mapping.charAt(mappingLength - 1) == '*')
- {
- prefixMappings.add(mapping.substring(0, mappingLength - 1));
- }
- }
-
- if (extensionMappings.size() > 0)
- {
- _extensionMappings = new HashSet<String>(extensionMappings);
- }
-
- if (prefixMappings.size() > 0)
- {
- _prefixMappings = new HashSet<String>(prefixMappings);
- }
- }
-
- _mappingsInitialized = true;
- }
- }
- }
-
- private boolean _handledByFacelets(String viewId)
- {
- // If there's no extension or prefixe mappings, then
- // just make Facelets handle everything
- if ((_extensionMappings == null) && (_prefixMappings == null))
- {
- return true;
- }
-
- // Since extension/prefix mappings apply to physical URIs, we need
- // to get a physical viewId. It is assumed that getPhysicalURI() lookup is
- // relatively cheap
- RequestContext afc = RequestContext.getCurrentInstance();
- if (afc != null)
- {
- viewId = afc.getPageResolver().getPhysicalURI(viewId);
- }
-
- if (_extensionMappings != null)
- {
- for (String extension: _extensionMappings)
- {
- if (viewId.endsWith(extension))
- {
- return true;
- }
- }
- }
-
- if (_prefixMappings != null)
- {
- for (String prefix: _prefixMappings)
- {
- if (viewId.startsWith(prefix))
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
-
- private final ViewHandler _parent;
-
- // Set of viewId extensions that should be handled by Facelets
- private volatile Set<String> _extensionMappings;
-
- // Set of viewId prefixes that should be handled by Facelets
- private volatile Set<String> _prefixMappings;
-
- private volatile boolean _mappingsInitialized = false;
-}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java
index e54de31..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadListenersTagRule.java
@@ -1,187 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.el.MethodExpression;
-import javax.faces.el.MethodBinding;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.el.LegacyMethodBinding;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagAttributeException;
-
-/**
- *
- * =-=AEW REWRITE USING BEANINFO
- */
-final class TrinidadListenersTagRule extends MetaRule
-{
- public static final MetaRule Instance = new TrinidadListenersTagRule();
-
- private static class ListenerMBPropertyMetadata extends Metadata
- {
- public ListenerMBPropertyMetadata(Method method, TagAttribute attribute, Class[] paramList)
- {
- _method = method;
- _attribute = attribute;
- _paramList = paramList;
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public void applyMetadata(FaceletContext ctx, Object instance)
- {
- MethodExpression expr =
- _attribute.getMethodExpression(ctx, null, _paramList);
-
- try
- {
- _method.invoke(instance,
- new Object[]{new LegacyMethodBinding(expr)});
- }
- catch (InvocationTargetException e)
- {
- throw new TagAttributeException(_attribute, e.getCause());
- }
- catch (Exception e)
- {
- throw new TagAttributeException(_attribute, e);
- }
- }
-
- private final Method _method;
- private final TagAttribute _attribute;
- private Class[] _paramList;
- }
-
- private static class ListenerMEPropertyMetadata extends Metadata
- {
- public ListenerMEPropertyMetadata(Method method, TagAttribute attribute, Class[] paramList)
- {
- _method = method;
- _attribute = attribute;
- _paramList = paramList;
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public void applyMetadata(FaceletContext ctx, Object instance)
- {
- MethodExpression expr =
- _attribute.getMethodExpression(ctx, null, _paramList);
-
- try
- {
- _method.invoke(instance,
- new Object[]{expr});
- }
- catch (InvocationTargetException e)
- {
- throw new TagAttributeException(_attribute, e.getCause());
- }
- catch (Exception e)
- {
- throw new TagAttributeException(_attribute, e);
- }
- }
-
- private final Method _method;
- private final TagAttribute _attribute;
- private Class[] _paramList;
- }
-
-
- @Override
- public Metadata applyRule(
- String name,
- TagAttribute attribute,
- MetadataTarget meta)
- {
- Class metaType = meta.getPropertyType(name);
- boolean isMethodBinding = (metaType == MethodBinding.class);
- boolean isMethodExpression = (metaType == MethodExpression.class);
-
- if ((isMethodBinding || isMethodExpression) &&
- name.endsWith("Listener"))
- {
- // OK, we're trying to call setFooListener()
- Method m = meta.getWriteMethod(name);
- if (m != null)
- {
- // First, look for the getFooListeners() property
- PropertyDescriptor listeners = meta.getProperty(name + "s");
- if (listeners == null)
- return null;
-
- // It should return an array of FooListener objects
- Class<?> arrayType = listeners.getPropertyType();
- if (!arrayType.isArray())
- return null;
-
- // Ignore non-Trinidad types
- Class<?> listenerClass = arrayType.getComponentType();
- if (!listenerClass.getName().startsWith("org.apache.myfaces.trinidad."))
- return null;
-
- // Turn that into an Event to get the signature
- Class<?> eventClass = _getEventClass(listenerClass);
- if (eventClass == null)
- return null;
-
- // And go
- if (isMethodBinding)
- return new ListenerMBPropertyMetadata(m, attribute,
- new Class[]{eventClass});
- else
- return new ListenerMEPropertyMetadata(m, attribute,
- new Class[]{eventClass});
- }
- }
- return null;
- }
-
- static private Class<?> _getEventClass(Class<?> listenerClass)
- {
- String listenerName = listenerClass.getName();
- if (!listenerName.endsWith("Listener"))
- return null;
-
- String eventName = (listenerName.substring(0,
- listenerName.length() - "Listener".length()) +
- "Event");
-
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
-
- try
- {
- return Class.forName(eventName, true, loader);
- }
- catch (ClassNotFoundException cnfe)
- {
- return null;
- }
- }
-}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadValidatorHandler.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadValidatorHandler.java
index 81e48db..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadValidatorHandler.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/TrinidadValidatorHandler.java
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import com.sun.facelets.tag.MetaRuleset;
-import com.sun.facelets.tag.jsf.ValidateHandler;
-import com.sun.facelets.tag.jsf.ValidatorConfig;
-
-public class TrinidadValidatorHandler
- extends ValidateHandler
-{
- public TrinidadValidatorHandler(ValidatorConfig config)
- {
- super(config);
- }
-
- @Override
- protected MetaRuleset createMetaRuleset(Class type)
- {
- MetaRuleset m = super.createMetaRuleset(type);
- m.addRule(StringArrayPropertyTagRule.Instance);
- m.addRule(ValueExpressionTagRule.Instance);
- m.addRule(DatePropertyTagRule.Instance);
- return m;
- }
-}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ValueExpressionTagRule.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ValueExpressionTagRule.java
index 2a586a2..e69de29 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ValueExpressionTagRule.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/facelets/ValueExpressionTagRule.java
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.myfaces.trinidadinternal.facelets;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.TagAttribute;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.el.ValueExpression;
-
-
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-
-class ValueExpressionTagRule extends MetaRule
-{
-
- static ValueExpressionTagRule Instance = new ValueExpressionTagRule();
-
- public Metadata applyRule(String name, TagAttribute attribute,
- MetadataTarget meta)
- {
- // This rule should be used only for objects implementing setValueExpression().
-
- if (!attribute.isLiteral())
- {
- Class type = meta.getPropertyType(name);
- if (type == null) {
- type = Object.class;
- }
- return new ValueExpressionMetadata(name, type, attribute);
- }
-
- return null;
- }
-
- private final static class ValueExpressionMetadata extends Metadata
- {
- private final String _name;
- private final TagAttribute _attr;
- private final Class _type;
-
- public ValueExpressionMetadata(String name, Class type, TagAttribute attr)
- {
- _name = name;
- _attr = attr;
- _type = type;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance)
- {
- Class klass = instance.getClass();
- try
- {
- Method setter = klass.getMethod("setValueExpression", _SETTER_ARGS);
- setter.invoke(instance, new Object[]{_name, _attr.getValueExpression(ctx, _type)});
- }
- // No user-readable messages are needed since we should never install this rule
- // for objects not supportingg setvalueExpression()
- catch (NoSuchMethodException ncm)
- {
- _LOG.severe(ncm);
- }
- catch(IllegalAccessException iae)
- {
- _LOG.severe(iae);
- }
- catch(InvocationTargetException ite)
- {
- _LOG.severe(ite);
- }
- }
-
- private static final Class _SETTER_ARGS[] = {String.class, ValueExpression.class};
- }
-
- private static final TrinidadLogger _LOG =
- TrinidadLogger.createTrinidadLogger(ValueExpressionTagRule.class);
-}
diff --git a/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/PartialTriggersTest.java b/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/PartialTriggersTest.java
index 64ff6eb..481a09f 100644
--- a/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/PartialTriggersTest.java
+++ b/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/PartialTriggersTest.java
@@ -26,7 +26,6 @@ import javax.faces.component.UIForm;
import javax.faces.component.UIViewRoot;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.myfaces.trinidad.component.UIXCommand;
@@ -34,8 +33,9 @@ import org.apache.myfaces.trinidad.component.UIXInput;
import org.apache.myfaces.trinidad.component.UIXPanel;
import org.apache.myfaces.trinidad.component.UIXTable;
import org.apache.myfaces.trinidad.context.RequestContext;
+import org.apache.myfaces.trinidadbuild.test.FacesTestCase;
-public class PartialTriggersTest extends TestCase
+public class PartialTriggersTest extends FacesTestCase
{
public static final Test suite()
{
diff --git a/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java b/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java
index 77143f0..0ade1bd 100644
--- a/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java
+++ b/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MApplication.java
@@ -46,6 +46,7 @@ import javax.faces.el.PropertyResolver;
import javax.faces.el.ValueBinding;
import javax.faces.el.VariableResolver;
import javax.faces.event.ActionListener;
+import javax.faces.event.SystemEvent;
import javax.faces.validator.Validator;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -61,6 +62,23 @@ public class MApplication extends Application
private MApplication()
{
}
+
+ @Override
+ public void publishEvent(FacesContext context,
+ Class<? extends SystemEvent> systemEventClass,
+ Class<?> sourceBaseType,
+ Object source)
+ {
+ // do nothing
+ }
+
+ @Override
+ public void publishEvent(FacesContext context,
+ Class<? extends SystemEvent> systemEventClass,
+ Object source)
+ {
+ //do nothing
+ }
@Override
public ActionListener getActionListener()
@@ -306,7 +324,7 @@ public class MApplication extends Application
}
@Override
- public Iterator<Class> getConverterTypes()
+ public Iterator<Class<?>> getConverterTypes()
{
throw new UnsupportedOperationException("Should not be called during rendering");
}
--
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.