You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mb...@apache.org on 2007/02/21 17:08:18 UTC
svn commit: r510079 - in /myfaces/core/branches/jsf12/api: ./
src/main/java-templates/javax/faces/component/
src/main/java/javax/faces/webapp/
Author: mbr
Date: Wed Feb 21 08:08:17 2007
New Revision: 510079
URL: http://svn.apache.org/viewvc?view=rev&rev=510079
Log:
make 1.2 api binary compatible with the ri
Modified:
myfaces/core/branches/jsf12/api/pom.xml
myfaces/core/branches/jsf12/api/src/main/java-templates/javax/faces/component/UIViewRootTemplate.java
myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java
myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentELTag.java
myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentTag.java
myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentTagBase.java
myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/ValidatorTag.java
Modified: myfaces/core/branches/jsf12/api/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/pom.xml?view=diff&rev=510079&r1=510078&r2=510079
==============================================================================
--- myfaces/core/branches/jsf12/api/pom.xml (original)
+++ myfaces/core/branches/jsf12/api/pom.xml Wed Feb 21 08:08:17 2007
@@ -111,6 +111,40 @@
</plugins>
</build>
</profile>
+ <profile>
+ <!-- This plugin verifies the binary compablity with the jsf api of the RI
+ TODO: add this to the normal build if 2.1 (or higher) of clirr-maven-plugin is released
+ In the meantime to use this plugin it must be installed manually from
+ https://svn.codehaus.org/mojo/trunk/mojo/clirr-maven-plugin
+ There is also a pending bug. Due to a jira problem (02/21/2007) there is no issue yet. Ask mbroekelmann@googlemail.com for the patch -->
+ <id>checkCompability</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>clirr-maven-plugin</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <configuration>
+ <comparisonArtifacts>
+ <comparisonArtifact>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2_03</version>
+ </comparisonArtifact>
+ </comparisonArtifacts>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <phase>test</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
<dependencies>
<dependency>
Modified: myfaces/core/branches/jsf12/api/src/main/java-templates/javax/faces/component/UIViewRootTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/main/java-templates/javax/faces/component/UIViewRootTemplate.java?view=diff&rev=510079&r1=510078&r2=510079
==============================================================================
--- myfaces/core/branches/jsf12/api/src/main/java-templates/javax/faces/component/UIViewRootTemplate.java (original)
+++ myfaces/core/branches/jsf12/api/src/main/java-templates/javax/faces/component/UIViewRootTemplate.java Wed Feb 21 08:08:17 2007
@@ -37,7 +37,7 @@
extends UIComponentBase
{
private static final int ANY_PHASE_ORDINAL = PhaseId.ANY_PHASE.getOrdinal();
- public static final String UNIQUE_ID_PREFIX = "_id";
+ public static final String UNIQUE_ID_PREFIX = "j_id";
// todo: is it right to save the state of _events and _phaseListeners?
/**/ // removes the generated methods so only state saving stays
Modified: myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java?view=diff&rev=510079&r1=510078&r2=510079
==============================================================================
--- myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java (original)
+++ myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentClassicTagBase.java Wed Feb 21 08:08:17 2007
@@ -15,8 +15,16 @@
*/
package javax.faces.webapp;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Stack;
+import java.util.logging.Level;
import javax.faces.FacesException;
import javax.faces.component.NamingContainer;
@@ -33,15 +41,6 @@
import javax.servlet.jsp.tagext.BodyTag;
import javax.servlet.jsp.tagext.JspIdConsumer;
import javax.servlet.jsp.tagext.Tag;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
/**
* @author Bruno Aranda (latest modification by $Author: baranda $)
@@ -55,8 +54,6 @@
public abstract class UIComponentClassicTagBase extends UIComponentTagBase
implements BodyTag, JspIdConsumer
{
- private static Log log = LogFactory.getLog(UIComponentClassicTagBase.class);
-
// do not change this w/out doing likewise in UIComponentTag
private static final String COMPONENT_STACK_ATTR = "org.apache.myfaces.COMPONENT_STACK";
@@ -95,28 +92,6 @@
private FacesContext _facesContext = null;
- /**
- * Specify the "component type name" used together with the component's
- * family and the Application object to create a UIComponent instance for
- * this tag. This method is called by other methods in this class, and is
- * intended to be overridden in subclasses to specify the actual component
- * type to be created.
- *
- * @return a registered component type name, never null.
- */
- public abstract String getComponentType();
-
- /**
- * Specify the "renderer type name" used together with the current
- * renderKit to get a Renderer instance for the corresponding UIComponent.
- * <p>
- * A JSP tag can return null here to use the default renderer type string.
- * If non-null is returned, then the UIComponent's setRendererType method
- * will be called passing this value, and this will later affect the
- * type of renderer object returned by UIComponent.getRenderer().
- */
- public abstract String getRendererType();
-
protected abstract void setProperties(UIComponent component);
protected abstract UIComponent createComponent(FacesContext context,
@@ -748,11 +723,11 @@
protected void encodeBegin()
throws IOException
{
- if (log.isDebugEnabled())
- log.debug("Entered encodeBegin for client-Id: " + _componentInstance.getClientId(getFacesContext()));
+ if (log.isLoggable(Level.FINE))
+ log.fine("Entered encodeBegin for client-Id: " + _componentInstance.getClientId(getFacesContext()));
_componentInstance.encodeBegin(getFacesContext());
- if (log.isDebugEnabled())
- log.debug("Exited encodeBegin");
+ if (log.isLoggable(Level.FINE))
+ log.fine("Exited encodeBegin");
}
/**
@@ -764,11 +739,11 @@
protected void encodeChildren()
throws IOException
{
- if (log.isDebugEnabled())
- log.debug("Entered encodeChildren for client-Id: " + _componentInstance.getClientId(getFacesContext()));
+ if (log.isLoggable(Level.FINE))
+ log.fine("Entered encodeChildren for client-Id: " + _componentInstance.getClientId(getFacesContext()));
_componentInstance.encodeChildren(getFacesContext());
- if (log.isDebugEnabled())
- log.debug("Exited encodeChildren for client-Id: " + _componentInstance.getClientId(getFacesContext()));
+ if (log.isLoggable(Level.FINE))
+ log.fine("Exited encodeChildren for client-Id: " + _componentInstance.getClientId(getFacesContext()));
}
/**
@@ -779,11 +754,11 @@
protected void encodeEnd()
throws IOException
{
- if (log.isDebugEnabled())
- log.debug("Entered encodeEnd for client-Id: " + _componentInstance.getClientId(getFacesContext()));
+ if (log.isLoggable(Level.FINE))
+ log.fine("Entered encodeEnd for client-Id: " + _componentInstance.getClientId(getFacesContext()));
_componentInstance.encodeEnd(getFacesContext());
- if (log.isDebugEnabled())
- log.debug("Exited encodeEnd for client-Id: " + _componentInstance.getClientId(getFacesContext()));
+ if (log.isLoggable(Level.FINE))
+ log.fine("Exited encodeEnd for client-Id: " + _componentInstance.getClientId(getFacesContext()));
}
@@ -1103,8 +1078,8 @@
// Sun RI just issues a warning...
if(parentTag._childrenAdded != null && parentTag._childrenAdded.contains(id))
{
- if(log.isWarnEnabled())
- log.warn("There is more than one JSF tag with an id : " + id);
+ if(log.isLoggable(Level.WARNING))
+ log.warning("There is more than one JSF tag with an id : " + id);
}
_componentInstance = findComponent(parent,id);
@@ -1338,6 +1313,10 @@
}
return buf.toString();
}
-
-
+
+ protected abstract boolean hasBinding();
+
+ public JspWriter getPreviousOut() {
+ return bodyContent.getEnclosingWriter();
+ }
}
Modified: myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentELTag.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentELTag.java?view=diff&rev=510079&r1=510078&r2=510079
==============================================================================
--- myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentELTag.java (original)
+++ myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentELTag.java Wed Feb 21 08:08:17 2007
@@ -15,30 +15,11 @@
*/
package javax.faces.webapp;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.servlet.jsp.tagext.Tag;
-import javax.servlet.jsp.PageContext;
-import javax.servlet.jsp.JspException;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.context.ExternalContext;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.FacesException;
-import javax.faces.FactoryFinder;
-import javax.faces.render.RenderKitFactory;
-import javax.faces.render.RenderKit;
-import javax.faces.el.ValueBinding;
-import javax.faces.application.Application;
import javax.el.ValueExpression;
-import java.util.Set;
-import java.util.Stack;
-import java.util.Iterator;
-import java.util.List;
-import java.util.HashSet;
-import java.io.IOException;
+import javax.faces.application.Application;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.servlet.jsp.tagext.Tag;
/**
* Base class for all JSP tags that represent a JSF UIComponent.
@@ -62,8 +43,6 @@
implements Tag
{
- private static Log log = LogFactory.getLog(UIComponentELTag.class);
-
private ValueExpression _binding = null;
private ValueExpression _rendered = null;
@@ -121,5 +100,19 @@
return component;
}
-
+
+ public void setBinding(ValueExpression binding)
+ {
+ _binding = binding;
+ }
+
+ protected boolean hasBinding()
+ {
+ return _binding != null;
+ }
+
+ public void setRendered(ValueExpression rendered)
+ {
+ _rendered = rendered;
+ }
}
Modified: myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentTag.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentTag.java?view=diff&rev=510079&r1=510078&r2=510079
==============================================================================
--- myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentTag.java (original)
+++ myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentTag.java Wed Feb 21 08:08:17 2007
@@ -68,9 +68,6 @@
private Boolean _suppressed = null;
private ResponseWriter _writer = null;
- private static Log log = LogFactory.getLog(UIComponentTag.class);
-
-
public UIComponentTag()
{
@@ -285,6 +282,12 @@
}
+ }
+
+ @Override
+ protected boolean hasBinding()
+ {
+ return _binding != null;
}
}
Modified: myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentTagBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentTagBase.java?view=diff&rev=510079&r1=510078&r2=510079
==============================================================================
--- myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentTagBase.java (original)
+++ myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/UIComponentTagBase.java Wed Feb 21 08:08:17 2007
@@ -16,6 +16,8 @@
package javax.faces.webapp;
+import java.util.logging.Logger;
+
import javax.el.ELContext;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -29,6 +31,8 @@
public abstract class UIComponentTagBase extends Object implements JspTag
{
+ protected static Logger log = Logger.getLogger("javax.faces.webapp");
+
/**
* @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#addChild(javax.faces.component.UIComponent)
* @param child
@@ -51,8 +55,14 @@
public abstract UIComponent getComponentInstance();
/**
+ * Specify the "component type name" used together with the component's
+ * family and the Application object to create a UIComponent instance for
+ * this tag. This method is called by other methods in this class, and is
+ * intended to be overridden in subclasses to specify the actual component
+ * type to be created.
+ *
* @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getComponentType()
- * @return
+ * @return a registered component type name, never null.
*/
public abstract String getComponentType();
@@ -95,10 +105,17 @@
protected abstract int getIndexOfNextChildTag();
/**
+ * Specify the "renderer type name" used together with the current
+ * renderKit to get a Renderer instance for the corresponding UIComponent.
+ * <p>
+ * A JSP tag can return null here to use the default renderer type string.
+ * If non-null is returned, then the UIComponent's setRendererType method
+ * will be called passing this value, and this will later affect the
+ * type of renderer object returned by UIComponent.getRenderer().
+ *
* @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getRendererType()
* @return
*/
-
public abstract String getRendererType();
/**
Modified: myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/ValidatorTag.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/ValidatorTag.java?view=diff&rev=510079&r1=510078&r2=510079
==============================================================================
--- myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/ValidatorTag.java (original)
+++ myfaces/core/branches/jsf12/api/src/main/java/javax/faces/webapp/ValidatorTag.java Wed Feb 21 08:08:17 2007
@@ -15,6 +15,7 @@
*/
package javax.faces.webapp;
+import javax.el.ValueExpression;
import javax.faces.application.Application;
import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
@@ -38,6 +39,7 @@
{
private static final long serialVersionUID = 8794036166323016663L;
private String _validatorId;
+ private String _binding;
public void setValidatorId(String validatorId)
{
@@ -77,6 +79,7 @@
{
super.release();
_validatorId = null;
+ _binding = null;
}
protected Validator createValidator()
@@ -84,6 +87,17 @@
{
FacesContext facesContext = FacesContext.getCurrentInstance();
Application application = facesContext.getApplication();
+
+ if(_binding != null) {
+ ValueBinding vb = application.createValueBinding(_binding);
+ if(vb != null) {
+ Validator validator = (Validator) vb.getValue(facesContext);
+ if(validator != null) {
+ return validator;
+ }
+ }
+ }
+
if (UIComponentTag.isValueReference(_validatorId))
{
ValueBinding vb = facesContext.getApplication().createValueBinding(_validatorId);
@@ -93,5 +107,22 @@
{
return application.createValidator(_validatorId);
}
+ }
+
+ /**
+ *
+ * @param binding
+ * @throws javax.servlet.jsp.JspException
+ *
+ * @deprecated
+ */
+ public void setBinding(java.lang.String binding)
+ throws javax.servlet.jsp.JspException
+ {
+ if (binding != null && !UIComponentTag.isValueReference(binding))
+ {
+ throw new IllegalArgumentException("not a valid binding: " + binding);
+ }
+ _binding = binding;
}
}