You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2007/09/06 11:35:28 UTC
svn commit: r573199 - in /myfaces/orchestra/trunk: ./ core/
core/src/main/java/org/apache/myfaces/orchestra/lib/jsf/ core15/ examples/
sandbox/
Author: imario
Date: Thu Sep 6 02:35:27 2007
New Revision: 573199
URL: http://svn.apache.org/viewvc?rev=573199&view=rev
Log:
reverted OrchestraApplication from proxy based solution to simple inheritance, moved Orchestra building from JSF 1.1 to JSF 1.2 to avoid inheritance problems with the JSF Application class.
Notice: The examples still run with JSF 1.1
Modified:
myfaces/orchestra/trunk/core/pom.xml
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/lib/jsf/OrchestraApplication.java
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/lib/jsf/OrchestraApplicationFactory.java
myfaces/orchestra/trunk/core15/pom.xml
myfaces/orchestra/trunk/examples/pom.xml
myfaces/orchestra/trunk/pom.xml
myfaces/orchestra/trunk/sandbox/pom.xml
Modified: myfaces/orchestra/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/pom.xml?rev=573199&r1=573198&r2=573199&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/pom.xml (original)
+++ myfaces/orchestra/trunk/core/pom.xml Thu Sep 6 02:35:27 2007
@@ -49,6 +49,12 @@
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.3</version>
+ </dependency>
+
<!-- provided dependencies -->
<dependency>
@@ -65,9 +71,9 @@
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
- <version>2.0</version>
+ <version>2.1</version>
<scope>provided</scope>
</dependency>
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/lib/jsf/OrchestraApplication.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/lib/jsf/OrchestraApplication.java?rev=573199&r1=573198&r2=573199&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/lib/jsf/OrchestraApplication.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/lib/jsf/OrchestraApplication.java Thu Sep 6 02:35:27 2007
@@ -35,9 +35,15 @@
import javax.faces.el.VariableResolver;
import javax.faces.event.ActionListener;
import javax.faces.validator.Validator;
+import javax.el.ELResolver;
+import javax.el.ValueExpression;
+import javax.el.ExpressionFactory;
+import javax.el.ELContextListener;
+import javax.el.ELException;
import java.util.Collection;
import java.util.Iterator;
import java.util.Locale;
+import java.util.ResourceBundle;
/**
* Allows a better spring configuration, currently it allows one to:
@@ -54,198 +60,246 @@
this.original = original;
}
- public ActionListener getActionListener()
+ public Converter createConverter(String converterId)
{
- return original.getActionListener();
+ try
+ {
+ return original.createConverter(converterId);
+ }
+ catch (FacesException e)
+ {
+ // looks like there is no converter configured, try to find a spring-configured one
+ Converter converter = (Converter) FrameworkAdapter.getInstance().getBean(converterId);
+ if (converter == null)
+ {
+ // no spring converter ... now re-throw the exception
+ throw e;
+ }
+
+ return new SerializableConverter(converterId, converter);
+ }
}
- public void setActionListener(ActionListener listener)
+ public Converter createConverter(Class aClass)
{
- original.setActionListener(listener);
+ return original.createConverter(aClass);
}
- public Locale getDefaultLocale()
+ public Iterator getConverterIds()
{
- return original.getDefaultLocale();
+ return original.getConverterIds();
}
- public void setDefaultLocale(Locale locale)
+ public Iterator getConverterTypes()
{
- original.setDefaultLocale(locale);
+ return original.getConverterTypes();
}
- public String getDefaultRenderKitId()
+ public MethodBinding createMethodBinding(String s, Class[] classes)
+ throws ReferenceSyntaxException
{
- return original.getDefaultRenderKitId();
+ return original.createMethodBinding(s, classes);
}
- public void setDefaultRenderKitId(String renderKitId)
+ public Iterator getSupportedLocales()
{
- original.setDefaultRenderKitId(renderKitId);
+ return original.getSupportedLocales();
}
- public String getMessageBundle()
+ public void setSupportedLocales(Collection locales)
{
- return original.getMessageBundle();
+ original.setSupportedLocales(locales);
}
- public void setMessageBundle(String bundle)
+ public void addValidator(String s, String s1)
{
- original.setMessageBundle(bundle);
+ original.addValidator(s, s1);
}
- public NavigationHandler getNavigationHandler()
+ public Validator createValidator(String s)
+ throws FacesException
{
- return original.getNavigationHandler();
+ return original.createValidator(s);
}
- public void setNavigationHandler(NavigationHandler handler)
+ public Iterator getValidatorIds()
{
- original.setNavigationHandler(handler);
+ return original.getValidatorIds();
}
- public PropertyResolver getPropertyResolver()
+ public ValueBinding createValueBinding(String s)
+ throws ReferenceSyntaxException
{
- return original.getPropertyResolver();
+ return original.createValueBinding(s);
}
- public void setPropertyResolver(PropertyResolver resolver)
+ public void addELResolver(ELResolver elResolver)
{
- original.setPropertyResolver(resolver);
+ original.addELResolver(elResolver);
}
- public VariableResolver getVariableResolver()
+ public ELResolver getELResolver()
{
- return original.getVariableResolver();
+ return original.getELResolver();
}
- public void setVariableResolver(VariableResolver resolver)
+ public ResourceBundle getResourceBundle(FacesContext facesContext, String s)
+ throws FacesException, NullPointerException
{
- original.setVariableResolver(resolver);
+ return original.getResourceBundle(facesContext, s);
}
- public ViewHandler getViewHandler()
+ public UIComponent createComponent(ValueExpression valueExpression, FacesContext facesContext, String s)
+ throws FacesException, NullPointerException
{
- return original.getViewHandler();
+ return original.createComponent(valueExpression, facesContext, s);
}
- public void setViewHandler(ViewHandler handler)
+ public ExpressionFactory getExpressionFactory()
{
- original.setViewHandler(handler);
+ return original.getExpressionFactory();
}
- public StateManager getStateManager()
+ public void addELContextListener(ELContextListener elContextListener)
{
- return original.getStateManager();
+ original.addELContextListener(elContextListener);
}
- public void setStateManager(StateManager manager)
+ public void removeELContextListener(ELContextListener elContextListener)
{
- original.setStateManager(manager);
+ original.removeELContextListener(elContextListener);
}
- public void addComponent(String componentType, String componentClass)
+ public ELContextListener[] getELContextListeners()
{
- original.addComponent(componentType, componentClass);
+ return original.getELContextListeners();
}
- public UIComponent createComponent(String componentType)
- throws FacesException
+ public Object evaluateExpressionGet(FacesContext facesContext, String s, Class aClass)
+ throws ELException
{
- return original.createComponent(componentType);
+ return original.evaluateExpressionGet(facesContext, s, aClass);
}
- public UIComponent createComponent(ValueBinding componentBinding, FacesContext context, String componentType)
- throws FacesException
+ public ActionListener getActionListener()
{
- return original.createComponent(componentBinding, context, componentType);
+ return original.getActionListener();
}
- public Iterator getComponentTypes()
+ public void setActionListener(ActionListener actionListener)
{
- return original.getComponentTypes();
+ original.setActionListener(actionListener);
}
- public void addConverter(String converterId, String converterClass)
+ public Locale getDefaultLocale()
{
- original.addConverter(converterId, converterClass);
+ return original.getDefaultLocale();
}
- public void addConverter(Class targetClass, String converterClass)
+ public void setDefaultLocale(Locale locale)
{
- original.addConverter(targetClass, converterClass);
+ original.setDefaultLocale(locale);
}
- public Converter createConverter(String converterId)
+ public String getDefaultRenderKitId()
{
- try
- {
- return original.createConverter(converterId);
- }
- catch (FacesException e)
- {
- // looks like there is no converter configured, try to find a spring-configured one
- Converter converter = (Converter) FrameworkAdapter.getInstance().getBean(converterId);
- if (converter == null)
- {
- // no spring converter ... now re-throw the exception
- throw e;
- }
+ return original.getDefaultRenderKitId();
+ }
- return new SerializableConverter(converterId, converter);
- }
+ public void setDefaultRenderKitId(String s)
+ {
+ original.setDefaultRenderKitId(s);
}
- public Converter createConverter(Class targetClass)
+ public String getMessageBundle()
{
- return original.createConverter(targetClass);
+ return original.getMessageBundle();
}
- public Iterator getConverterIds()
+ public void setMessageBundle(String s)
{
- return original.getConverterIds();
+ original.setMessageBundle(s);
}
- public Iterator getConverterTypes()
+ public NavigationHandler getNavigationHandler()
{
- return original.getConverterTypes();
+ return original.getNavigationHandler();
}
- public MethodBinding createMethodBinding(String ref, Class[] params)
- throws ReferenceSyntaxException
+ public void setNavigationHandler(NavigationHandler navigationHandler)
{
- return original.createMethodBinding(ref, params);
+ original.setNavigationHandler(navigationHandler);
}
- public Iterator getSupportedLocales()
+ public PropertyResolver getPropertyResolver()
{
- return original.getSupportedLocales();
+ return original.getPropertyResolver();
}
- public void setSupportedLocales(Collection locales)
+ public void setPropertyResolver(PropertyResolver propertyResolver)
{
- original.setSupportedLocales(locales);
+ original.setPropertyResolver(propertyResolver);
}
- public void addValidator(String validatorId, String validatorClass)
+ public VariableResolver getVariableResolver()
{
- original.addValidator(validatorId, validatorClass);
+ return original.getVariableResolver();
}
- public Validator createValidator(String validatorId)
+ public void setVariableResolver(VariableResolver variableResolver)
+ {
+ original.setVariableResolver(variableResolver);
+ }
+
+ public ViewHandler getViewHandler()
+ {
+ return original.getViewHandler();
+ }
+
+ public void setViewHandler(ViewHandler viewHandler)
+ {
+ original.setViewHandler(viewHandler);
+ }
+
+ public StateManager getStateManager()
+ {
+ return original.getStateManager();
+ }
+
+ public void setStateManager(StateManager stateManager)
+ {
+ original.setStateManager(stateManager);
+ }
+
+ public void addComponent(String s, String s1)
+ {
+ original.addComponent(s, s1);
+ }
+
+ public UIComponent createComponent(String s)
throws FacesException
{
- return original.createValidator(validatorId);
+ return original.createComponent(s);
}
- public Iterator getValidatorIds()
+ public UIComponent createComponent(ValueBinding valueBinding, FacesContext facesContext, String s)
+ throws FacesException
{
- return original.getValidatorIds();
+ return original.createComponent(valueBinding, facesContext, s);
}
- public ValueBinding createValueBinding(String ref)
- throws ReferenceSyntaxException
+ public Iterator getComponentTypes()
+ {
+ return original.getComponentTypes();
+ }
+
+ public void addConverter(String s, String s1)
+ {
+ original.addConverter(s, s1);
+ }
+
+ public void addConverter(Class aClass, String s)
{
- return original.createValueBinding(ref);
+ original.addConverter(aClass, s);
}
}
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/lib/jsf/OrchestraApplicationFactory.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/lib/jsf/OrchestraApplicationFactory.java?rev=573199&r1=573198&r2=573199&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/lib/jsf/OrchestraApplicationFactory.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/lib/jsf/OrchestraApplicationFactory.java Thu Sep 6 02:35:27 2007
@@ -18,10 +18,8 @@
*/
package org.apache.myfaces.orchestra.lib.jsf;
-import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
-import org.springframework.aop.framework.ProxyFactory;
import javax.faces.FacesException;
import javax.faces.application.Application;
@@ -29,55 +27,29 @@
import javax.faces.convert.Converter;
/**
- * Proxy the orignial application and provide the following enhancements:
- * <ul>
- * <li>Create a converter based on a spring configuration.
- * <br />
- * This allows you to use the spring dependency mechanism and thus get in touch to e.g. the
- * persistence context.
- * </li>
- * </ul>
+ * Decorate the orignial application and provide an Orchestra enhanced version.
*
- * Notice: we use a proxy here to be compatible with JSF 1.1 and 1.2.
+ * @see OrchestraApplication
*/
public class OrchestraApplicationFactory extends ApplicationFactory
{
private final ApplicationFactory original;
+ private Application application;
+
public OrchestraApplicationFactory(ApplicationFactory original)
{
this.original = original;
-
- Application application = original.getApplication();
-
- ProxyFactory factory = new ProxyFactory(application);
- factory.setProxyTargetClass(true);
- factory.addAdvice(new MethodInterceptor()
- {
- public Object invoke(MethodInvocation methodInvocation) throws Throwable
- {
- Object[] arguments = methodInvocation.getArguments();
- String methodName = methodInvocation.getMethod().getName();
- if ("createConverter".equals(methodName) &&
- arguments != null && arguments.length == 1 &&
- arguments[0] instanceof String)
- {
- String converterId = (String) arguments[0];
-
- return createConverter(converterId, methodInvocation);
- }
-
- return methodInvocation.proceed();
- }
- });
- Application orchestraApplication = (Application) factory.getProxy();
-
- original.setApplication(orchestraApplication);
}
public Application getApplication()
{
- return original.getApplication();
+ if (application == null)
+ {
+ application = new OrchestraApplication(original.getApplication());
+ }
+
+ return application;
}
public void setApplication(Application application)
@@ -85,7 +57,7 @@
original.setApplication(application);
}
- private Converter createConverter(String converterId, MethodInvocation methodInvocation) throws Throwable
+ public Converter createConverter(String converterId, MethodInvocation methodInvocation) throws Throwable
{
try
{
@@ -104,4 +76,4 @@
return new SerializableConverter(converterId, converter);
}
}
-}
+}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/core15/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/pom.xml?rev=573199&r1=573198&r2=573199&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/pom.xml (original)
+++ myfaces/orchestra/trunk/core15/pom.xml Thu Sep 6 02:35:27 2007
@@ -77,9 +77,9 @@
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
- <version>2.0</version>
+ <version>2.1</version>
<scope>provided</scope>
</dependency>
Modified: myfaces/orchestra/trunk/examples/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/pom.xml?rev=573199&r1=573198&r2=573199&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/pom.xml (original)
+++ myfaces/orchestra/trunk/examples/pom.xml Thu Sep 6 02:35:27 2007
@@ -46,6 +46,143 @@
</pluginRepository>
</pluginRepositories>
+ <profiles>
+ <!-- By default, use the JSF 1.1 version of MyFaces -->
+ <profile>
+ <id>myfaces-default</id>
+ <activation>
+ <property>
+ <name>!jsf</name>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>1.1.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>1.1.5</version>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <!-- Use the version used to compile Orchestra : -Djsf=c -->
+ <profile>
+ <id>myfaces-compiled</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>c</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <!-- To use the examples using the MyFaces JSF Implementation 1.2 : -Djsf=12 -->
+ <profile>
+ <id>myfaces-1.2</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>12</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>1.2.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>1.2.0</version>
+ <!-- Tomahawk examples must only have runtime dependency to myfaces-impl
+ so that it will be automatically added to war. But there must not be
+ any compile dependency on impl so that is is always possible to use
+ other JSF implementations. -->
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>jstl</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>taglibs</groupId>
+ <artifactId>standard</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_1.0_spec</artifactId>
+ <version>1.0-M1</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <jsf_implementation>MyFaces 1.2</jsf_implementation>
+ </properties>
+ </profile>
+
+
+ <!-- To use the examples using the Sun's JSF Reference Implementation 1.2 : -Djsf=ri12 -->
+ <profile>
+ <id>jsfri</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>ri12</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2_04-p02</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>1.2_04-p02</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_1.0_spec</artifactId>
+ <version>1.0-M1</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>java.net</id>
+ <name>java.net Maven 1 Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <properties>
+ <jsf_implementation>JSF-RI 1.2</jsf_implementation>
+ </properties>
+ </profile>
+ </profiles>
+
<dependencies>
<dependency>
<groupId>org.apache.myfaces.orchestra</groupId>
@@ -61,14 +198,6 @@
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-impl</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.myfaces.tomahawk</groupId>
<artifactId>tomahawk</artifactId>
<version>${tomahawk.version}</version>
@@ -116,47 +245,6 @@
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
- </dependency>
-
- <!-- jetty -->
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jsp-api</artifactId>
- <version>2.0</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>jasper-compiler</artifactId>
- <version>5.5.9</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>jasper-runtime</artifactId>
- <version>5.5.9</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>jasper-compiler-jdt</artifactId>
- <version>5.5.9</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>el-impl</groupId>
- <artifactId>el-impl</artifactId>
- <version>1.0</version>
</dependency>
</dependencies>
Modified: myfaces/orchestra/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/pom.xml?rev=573199&r1=573198&r2=573199&view=diff
==============================================================================
--- myfaces/orchestra/trunk/pom.xml (original)
+++ myfaces/orchestra/trunk/pom.xml Thu Sep 6 02:35:27 2007
@@ -173,7 +173,7 @@
<properties>
<!-- ensure to not to point to a snapshot version during release -->
- <myfaces.version>1.1.5</myfaces.version>
+ <myfaces.version>1.2.0</myfaces.version>
<tomahawk.version>1.1.6</tomahawk.version>
<myfaces-orchestra-shared.version>2.0.6-SNAPSHOT</myfaces-orchestra-shared.version>
</properties>
Modified: myfaces/orchestra/trunk/sandbox/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/pom.xml?rev=573199&r1=573198&r2=573199&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/pom.xml (original)
+++ myfaces/orchestra/trunk/sandbox/pom.xml Thu Sep 6 02:35:27 2007
@@ -86,9 +86,9 @@
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
- <version>2.0</version>
+ <version>2.1</version>
<scope>provided</scope>
</dependency>