Author: gvanmatre
Date: Wed Jun 21 20:22:25 2006
New Revision: 416230
URL: http://svn.apache.org/viewvc?rev=416230&view=rev
Log:
Fix for JIRA issue SHALE-195 - clay incompatibility with myfaces 1.1.2 & 1.1.3.
Added:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/SequenceGenerator.java
(with props)
Modified:
struts/shale/trunk/shale-apps/shale-clay-usecases/src/main/webapp/WEB-INF/web.xml
struts/shale/trunk/shale-apps/shale-clay-usecases/src/main/webapp/symbols/home.html
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/LoadBundle.java
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionListenerCommand.java
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyConverterCommand.java
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValidatorCommand.java
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueChangeListenerCommand.java
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/Globals.java
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/utils/ClayAmalgam.java
struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/config/CommentTestCase.java
struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/config/SymbolsTestCase.java
struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/utils/ClayAmalgamTestCase.java
Modified:
struts/shale/trunk/shale-apps/shale-clay-usecases/src/main/webapp/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-apps/shale-clay-usecases/src/main/webapp/WEB-INF/web.xml?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-apps/shale-clay-usecases/src/main/webapp/WEB-INF/web.xml
(original)
+++
struts/shale/trunk/shale-apps/shale-clay-usecases/src/main/webapp/WEB-INF/web.xml
Wed Jun 21 20:22:25 2006
@@ -39,12 +39,6 @@
<param-value>client</param-value>
</context-param>
- <!-- JSF Configuration Resources (comma-separated list) -->
- <context-param>
- <param-name>javax.faces.CONFIG_FILES</param-name>
- <param-value>/WEB-INF/faces-config.xml</param-value>
- </context-param>
-
<!-- Commons Chain Configuration Resources -->
<context-param>
<param-name>
Modified:
struts/shale/trunk/shale-apps/shale-clay-usecases/src/main/webapp/symbols/home.html
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-apps/shale-clay-usecases/src/main/webapp/symbols/home.html?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-apps/shale-clay-usecases/src/main/webapp/symbols/home.html
(original)
+++
struts/shale/trunk/shale-apps/shale-clay-usecases/src/main/webapp/symbols/home.html
Wed Jun 21 20:22:25 2006
@@ -27,6 +27,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
+<h:form id="home">
<h:commandLink action="home" value="Home"/>
<h1>Managed Bean Aliasing</h1>
@@ -105,6 +106,7 @@
</h:outputLink>
<br />
+</h:form>
</body>
Modified:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/LoadBundle.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/LoadBundle.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/LoadBundle.java
(original)
+++
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/LoadBundle.java
Wed Jun 21 20:22:25 2006
@@ -31,7 +31,6 @@
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
-import org.apache.shale.faces.ShaleConstants;
import org.apache.shale.util.Tags;
/**
@@ -54,6 +53,14 @@
return null;
}
+
+ /**
+ * <p>Shale tag helper class that contains utility methods for setting
+ * component binding and method properties.</p>
+ */
+ private Tags tagUtils = new Tags();
+
+
/**
* Sets the base name of the resource bundle to be loaded.
*/
@@ -88,10 +95,6 @@
.getContextClassLoader();
if (classLoader == null)
classLoader = getClass().getClassLoader();
-
- // get the Tag Utilities
- Tags tagUtils = (Tags) context.getApplication().getVariableResolver()
- .resolveVariable(context, ShaleConstants.TAG_UTILITY_BEAN);
// evaluate any VB expression that we were passed
String resolvedBasename = tagUtils.evalString(basename);
Modified:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java
(original)
+++
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java
Wed Jun 21 20:22:25 2006
@@ -53,6 +53,43 @@
}
/**
+ * <p>Tests to see if myfaces runtime is installed by trying to load a
known class.</p>
+ */
+ private boolean isMyfacesRuntimeInstalled() {
+ try {
+
Class.forName("org.apache.myfaces.application.jsp.JspViewHandlerImpl");
+ return true;
+ } catch (ClassNotFoundException e) {
+ }
+
+ return false;
+ }
+
+
+ /**
+ * <p>Returns a unique component id for the request/response lifecycle.</p>
+ */
+ private String createUniqueId(FacesContext facesContext) {
+ String id = null;
+
+ if (isMyfacesRuntimeInstalled()) {
+ Map requestMap = facesContext.getExternalContext().getRequestMap();
+ SequenceGenerator generator = (SequenceGenerator)
requestMap.get(Globals.CLAY_SEQUENCE_GENERATOR);
+ if (generator == null) {
+
+ generator = new SequenceGenerator();
+ requestMap.put(Globals.CLAY_SEQUENCE_GENERATOR, generator);
+ }
+ id = generator.createUniqueId();
+ } else {
+ id = facesContext.getViewRoot().createUniqueId();
+ }
+
+ return id;
+ }
+
+
+ /**
* <p>
* Creates a new faces component from the component metadata.
* </p>
@@ -92,7 +129,7 @@
String id = null;
if ((id = displayElement.getId()) == null)
- id = facesContext.getViewRoot().createUniqueId();
+ id = createUniqueId(facesContext);
else
id = replaceMnemonic(clayContext, id);
Modified:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java
(original)
+++
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java
Wed Jun 21 20:22:25 2006
@@ -28,7 +28,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.shale.clay.config.beans.AttributeBean;
import org.apache.shale.clay.config.beans.ComponentBean;
-import org.apache.shale.faces.ShaleConstants;
import org.apache.shale.util.Tags;
/**
@@ -52,6 +51,13 @@
}
/**
+ * <p>Shale tag helper class that contains utility methods for setting
+ * component binding and method properties.</p>
+ */
+ private Tags tagUtils = new Tags();
+
+
+ /**
* <p>
* Looks to see if the [EMAIL PROTECTED] AttributeBean} on the [EMAIL
PROTECTED] ClayContext} is a
* <code>action</code> attribute. If it is, create a
@@ -77,12 +83,6 @@
FacesContext facesContext = clayContext.getFacesContext();
if (facesContext == null)
throw new
NullPointerException(messages.getMessage("clay.null.facesContext"));
-
- Tags tagUtils = (Tags) facesContext
- .getApplication()
- .getVariableResolver()
- .resolveVariable(facesContext,
- ShaleConstants.TAG_UTILITY_BEAN);
if (tagUtils == null)
throw new
NullPointerException(messages.getMessage("clay.null.tagUtils"));
Modified:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionListenerCommand.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionListenerCommand.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionListenerCommand.java
(original)
+++
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyActionListenerCommand.java
Wed Jun 21 20:22:25 2006
@@ -28,7 +28,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.shale.clay.config.beans.AttributeBean;
import org.apache.shale.clay.config.beans.ComponentBean;
-import org.apache.shale.faces.ShaleConstants;
import org.apache.shale.util.Tags;
/**
@@ -52,6 +51,12 @@
}
/**
+ * <p>Shale tag helper class that contains utility methods for setting
+ * component binding and method properties.</p>
+ */
+ private Tags tagUtils = new Tags();
+
+ /**
* <p>
* Looks to see if the [EMAIL PROTECTED] AttributeBean} on the [EMAIL
PROTECTED] ClayContext} is a
* <code>actionListener</code> attribute. If it is, create a
@@ -80,12 +85,7 @@
if (attributeBean.getName().equals("actionListener") &&
attributeBean.getValue() != null) {
isFinal = true;
-
- Tags tagUtils = (Tags)
facesContext.getApplication().getVariableResolver()
- .resolveVariable(facesContext,
ShaleConstants.TAG_UTILITY_BEAN);
- if (tagUtils == null)
- throw new
NullPointerException(messages.getMessage("clay.null.tagUtils"));
-
+
UIComponent child = (UIComponent) clayContext.getChild();
if (child == null)
throw new
NullPointerException(messages.getMessage("clay.null.childComponent"));
Modified:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyConverterCommand.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyConverterCommand.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyConverterCommand.java
(original)
+++
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyConverterCommand.java
Wed Jun 21 20:22:25 2006
@@ -30,7 +30,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.shale.clay.config.beans.AttributeBean;
import org.apache.shale.clay.config.beans.ComponentBean;
-import org.apache.shale.faces.ShaleConstants;
import org.apache.shale.util.Tags;
/**
@@ -54,6 +53,12 @@
}
/**
+ * <p>Shale tag helper class that contains utility methods for setting
+ * component binding and method properties.</p>
+ */
+ private Tags tagUtils = new Tags();
+
+ /**
* <p>
* Looks to see if the [EMAIL PROTECTED] AttributeBean} on the [EMAIL
PROTECTED] ClayContext} is a
* <code>converter</code> attribute. If it is, create a
@@ -79,15 +84,6 @@
FacesContext facesContext = clayContext.getFacesContext();
if (facesContext == null)
throw new
NullPointerException(messages.getMessage("clay.null.facesContext"));
-
- Tags tagUtils = (Tags) facesContext
- .getApplication()
- .getVariableResolver()
- .resolveVariable(facesContext,
- ShaleConstants.TAG_UTILITY_BEAN);
-
- if (tagUtils == null)
- throw new
NullPointerException(messages.getMessage("clay.null.tagUtils"));
if (attributeBean.getName().equals("converter") &&
attributeBean.getValue() != null) {
isFinal = true;
Modified:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValidatorCommand.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValidatorCommand.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValidatorCommand.java
(original)
+++
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValidatorCommand.java
Wed Jun 21 20:22:25 2006
@@ -28,7 +28,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.shale.clay.config.beans.AttributeBean;
import org.apache.shale.clay.config.beans.ComponentBean;
-import org.apache.shale.faces.ShaleConstants;
import org.apache.shale.util.Tags;
/**
@@ -53,6 +52,12 @@
}
/**
+ * <p>Shale tag helper class that contains utility methods for setting
+ * component binding and method properties.</p>
+ */
+ private Tags tagUtils = new Tags();
+
+ /**
* <p>
* Looks to see if the [EMAIL PROTECTED] AttributeBean} on the [EMAIL
PROTECTED] ClayContext} is a
* <code>validator</code> attribute. If it is, create a
@@ -79,12 +84,7 @@
throw new
NullPointerException(messages.getMessage("clay.null.facesContext"));
if (attributeBean.getName().equals("validator") &&
attributeBean.getValue() != null) {
isFinal = true;
-
- Tags tagUtils = (Tags)
facesContext.getApplication().getVariableResolver()
- .resolveVariable(facesContext,
ShaleConstants.TAG_UTILITY_BEAN);
- if (tagUtils == null)
- throw new
NullPointerException(messages.getMessage("clay.null.tagUtils"));
-
+
UIComponent child = (UIComponent) clayContext.getChild();
if (child == null)
throw new NullPointerException("child");
Modified:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueChangeListenerCommand.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueChangeListenerCommand.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueChangeListenerCommand.java
(original)
+++
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueChangeListenerCommand.java
Wed Jun 21 20:22:25 2006
@@ -28,7 +28,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.shale.clay.config.beans.AttributeBean;
import org.apache.shale.clay.config.beans.ComponentBean;
-import org.apache.shale.faces.ShaleConstants;
import org.apache.shale.util.Tags;
/**
@@ -53,6 +52,12 @@
}
/**
+ * <p>Shale tag helper class that contains utility methods for setting
+ * component binding and method properties.</p>
+ */
+ private Tags tagUtils = new Tags();
+
+ /**
* <p>
* Looks to see if the [EMAIL PROTECTED] AttributeBean} on the [EMAIL
PROTECTED] ClayContext} is a
* <code>valueChangeListener</code> attribute. If it is, create a
@@ -79,12 +84,7 @@
throw new
NullPointerException(messages.getMessage("clay.null.facesContext"));
if (attributeBean.getName().equals("valueChangeListener") &&
attributeBean.getValue() != null) {
isFinal = true;
-
- Tags tagUtils = (Tags)
facesContext.getApplication().getVariableResolver()
- .resolveVariable(facesContext,
ShaleConstants.TAG_UTILITY_BEAN);
- if (tagUtils == null)
- throw new
NullPointerException(messages.getMessage("clay.null.tagUtils"));
-
+
UIComponent child = (UIComponent) clayContext.getChild();
if (child == null)
throw new NullPointerException("child");
Modified:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java
(original)
+++
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java
Wed Jun 21 20:22:25 2006
@@ -27,7 +27,6 @@
import org.apache.commons.chain.Context;
import org.apache.shale.clay.config.beans.AttributeBean;
import org.apache.shale.clay.config.beans.ComponentBean;
-import org.apache.shale.faces.ShaleConstants;
import org.apache.shale.util.ConverterHelper;
import org.apache.shale.util.PropertyHelper;
import org.apache.shale.util.Tags;
@@ -53,6 +52,13 @@
*/
private ConverterHelper converterHelper = new ConverterHelper();
+
+ /**
+ * <p>Shale tag helper class that contains utility methods for setting
+ * component binding and method properties.</p>
+ */
+ private Tags tagUtils = new Tags();
+
/**
* <p>Sets a property value on the target component. If the data
* type of the target bean property is not a String and the property
@@ -121,11 +127,6 @@
if (facesContext == null)
throw new
NullPointerException(messages.getMessage("clay.null.facesContext"));
- Tags tagUtils = (Tags)
facesContext.getApplication().getVariableResolver()
- .resolveVariable(facesContext,
ShaleConstants.TAG_UTILITY_BEAN);
- if (tagUtils == null)
- throw new
NullPointerException(messages.getMessage("clay.null.tagUtils"));
-
// replace all symbols returning the target attribute value
String expr = replaceMnemonic(clayContext);
Added:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/SequenceGenerator.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/SequenceGenerator.java?rev=416230&view=auto
==============================================================================
---
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/SequenceGenerator.java
(added)
+++
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/SequenceGenerator.java
Wed Jun 21 20:22:25 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.clay.component.chain;
+
+/**
+ * <p>Generates a unique id used to identify each component in the component
tree.
+ * The id's will be prefixed with "_idsc" followed by a sequential incremented
+ * number. This class will be used outside of the implementation of the
+ * <code>UIViewRoot<code>'s createUniqueId method. This object will be cached
+ * in request scope each time the view is rendered and the component tree
contains
+ * one or more [EMAIL PROTECTED] org.apache.shale.clay.component.Clay}
components.<br/><br/>
+ * This class is only used with the myfaces implementation.</p>
+ *
+ * </p>
+ */
+public class SequenceGenerator {
+ private StringBuffer buff = new StringBuffer("_idsc");
+ private int uniqueId = 0;
+
+ /**
+ * <p>Returns a unique component id prefixed with "_idsc".</p>
+ */
+ public String createUniqueId() {
+ buff.setLength(5);
+ buff.append(uniqueId++);
+ return buff.toString();
+ }
+}
Propchange:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/SequenceGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/SequenceGenerator.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/Globals.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/Globals.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/Globals.java
(original)
+++
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/Globals.java
Wed Jun 21 20:22:25 2006
@@ -249,5 +249,10 @@
* of the subtree. The root is capture for enhanced error reporting.</p>
*/
public static final String CLAY_RESERVED_ATTRIBUTE =
"org.apache.shale.clay";
-
+
+ /**
+ * <p>The key value used to cache the [EMAIL PROTECTED]
org.apache.shale.clay.component.chain.SequenceGenerator}
+ * in request scope.</p>
+ */
+ public static final String CLAY_SEQUENCE_GENERATOR =
"org.apache.shale.clay.chain.SequenceGenerator";
}
Modified:
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/utils/ClayAmalgam.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/utils/ClayAmalgam.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/utils/ClayAmalgam.java
(original)
+++
struts/shale/trunk/shale-clay/src/main/java/org/apache/shale/clay/utils/ClayAmalgam.java
Wed Jun 21 20:22:25 2006
@@ -37,7 +37,6 @@
import org.apache.shale.clay.config.beans.ConfigBeanFactory;
import org.apache.shale.clay.config.beans.ElementBean;
import org.apache.shale.clay.config.beans.SymbolBean;
-import org.apache.shale.faces.ShaleConstants;
import org.apache.shale.util.Messages;
import org.apache.shale.util.Tags;
@@ -48,7 +47,7 @@
* the clay component's registration.</p>
*/
public class ClayAmalgam {
-
+
/**
* <p>Message resources for this class.</p>
*/
@@ -56,6 +55,13 @@
ClayConfigureListener.class.getClassLoader());
/**
+ * <p>Shale tag helper class that contains utility methods for setting
+ * component binding and method properties.</p>
+ */
+ private Tags tagUtils = new Tags();
+
+
+ /**
* <p>Replaces tokens in the <code>document</code> with
* matching tokens in the <code>context</code>.</p>
*/
@@ -145,12 +151,6 @@
javax.faces.component.UIComponent component,
java.lang.Object displayElementRoot) {
- Tags tagUtils = (Tags) context.getApplication().getVariableResolver()
- .resolveVariable(context,
ShaleConstants.TAG_UTILITY_BEAN);
- if (tagUtils == null)
- throw new
NullPointerException(messages.getMessage("clay.null.tagUtils"));
-
-
if (!(displayElementRoot instanceof ComponentBean) ||
!(component instanceof Clay)) {
throw new RuntimeException(messages.getMessage("invalid.binding",
new Object[] {"clayOut"}));
@@ -210,12 +210,7 @@
javax.faces.component.UIComponent component,
java.lang.Object displayElementRoot) {
- Tags tagUtils = (Tags) context.getApplication().getVariableResolver()
- .resolveVariable(context,
ShaleConstants.TAG_UTILITY_BEAN);
- if (tagUtils == null)
- throw new
NullPointerException(messages.getMessage("clay.null.tagUtils"));
-
if (!(displayElementRoot instanceof ComponentBean) ||
!(component instanceof Clay)) {
throw new RuntimeException(messages.getMessage("invalid.binding",
new Object[] {"clayImport"}));
@@ -327,12 +322,6 @@
public void clayForEach(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object displayElementRoot) {
-
- Tags tagUtils = (Tags) context.getApplication().getVariableResolver()
- .resolveVariable(context, ShaleConstants.TAG_UTILITY_BEAN);
- if (tagUtils == null)
- throw new NullPointerException(messages
- .getMessage("clay.null.tagUtils"));
if (!(displayElementRoot instanceof ComponentBean)
|| !(component instanceof Clay)) {
Modified:
struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/config/CommentTestCase.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/config/CommentTestCase.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/config/CommentTestCase.java
(original)
+++
struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/config/CommentTestCase.java
Wed Jun 21 20:22:25 2006
@@ -28,8 +28,6 @@
import org.apache.shale.clay.component.Clay;
import org.apache.shale.clay.parser.Node;
import org.apache.shale.clay.parser.Parser;
-import org.apache.shale.faces.ShaleConstants;
-import org.apache.shale.util.Tags;
// test processing comment blocks
public class CommentTestCase extends AbstractTestCaseConfig {
@@ -62,10 +60,7 @@
public void setUp() {
super.setUp();
-
- //Utility class is loaded as a managed bean in
shale_core/META-INF/faces-config.xml
- servletContext.setAttribute(ShaleConstants.TAG_UTILITY_BEAN, new
Tags());
-
+
//loads the RI or myfaces renderers from the RENDERERS static array.
for (int i = 0; i < RENDERERS.length; i++) {
Modified:
struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/config/SymbolsTestCase.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/config/SymbolsTestCase.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/config/SymbolsTestCase.java
(original)
+++
struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/config/SymbolsTestCase.java
Wed Jun 21 20:22:25 2006
@@ -30,8 +30,6 @@
import org.apache.shale.clay.config.beans.ComponentBean;
import org.apache.shale.clay.config.beans.ElementBean;
import org.apache.shale.clay.config.beans.SymbolBean;
-import org.apache.shale.faces.ShaleConstants;
-import org.apache.shale.util.Tags;
// tests properties and symbol evaluation
public class SymbolsTestCase extends AbstractTestCaseConfig {
@@ -72,10 +70,7 @@
clayContext.setChild(child);
clayContext.setAttribute(attr);
clayContext.setDisplayElement(displayElement);
-
- //shale core utility class
- servletContext.setAttribute(ShaleConstants.TAG_UTILITY_BEAN, new
Tags());
-
+
Command command = new PropertyValueCommand();
boolean isFinal = command.execute(clayContext);
assertEquals("command finished", true, isFinal);
@@ -158,9 +153,6 @@
clayContext.setDisplayElement(displayElement);
clayContext.setSymbols(displayElement.getSymbols());
- //shale core utility class
- servletContext.setAttribute(ShaleConstants.TAG_UTILITY_BEAN, new
Tags());
-
Command command = new PropertyValueCommand();
boolean isFinal = command.execute(clayContext);
assertEquals("command finished", true, isFinal);
@@ -285,10 +277,7 @@
clayContext.setParent(parent);
clayContext.setDisplayElement(displayElement);
clayContext.setSymbols(displayElement.getSymbols());
-
- // shale core utility class
- servletContext.setAttribute(ShaleConstants.TAG_UTILITY_BEAN, new
Tags());
-
+
Command command = new CreateComponentCommand();
boolean isFinal = command.execute(clayContext);
assertEquals("command finished", false, isFinal);
@@ -316,10 +305,7 @@
clayContext.setParent(parent);
clayContext.setDisplayElement(displayElement);
clayContext.setSymbols(displayElement.getSymbols());
-
-// shale core utility class
- servletContext.setAttribute(ShaleConstants.TAG_UTILITY_BEAN, new
Tags());
-
+
command = new CreateComponentCommand();
try {
isFinal = command.execute(clayContext);
@@ -345,10 +331,7 @@
clayContext.setParent(parent);
clayContext.setDisplayElement(displayElement);
clayContext.setSymbols(displayElement.getSymbols());
-
-// shale core utility class
- servletContext.setAttribute(ShaleConstants.TAG_UTILITY_BEAN, new
Tags());
-
+
command = new CreateComponentCommand();
try {
isFinal = command.execute(clayContext);
@@ -390,10 +373,7 @@
clayContext.setDisplayElement(displayElement);
// normally done in the AssignChildrenCommand
clayContext.setSymbols(displayElement.getSymbols());
-
- //shale core utility class
- servletContext.setAttribute(ShaleConstants.TAG_UTILITY_BEAN, new
Tags());
-
+
Command command = new PropertyValueCommand();
boolean isFinal = command.execute(clayContext);
assertEquals("command finished", true, isFinal);
Modified:
struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/utils/ClayAmalgamTestCase.java
URL:
http://svn.apache.org/viewvc/struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/utils/ClayAmalgamTestCase.java?rev=416230&r1=416229&r2=416230&view=diff
==============================================================================
---
struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/utils/ClayAmalgamTestCase.java
(original)
+++
struts/shale/trunk/shale-clay/src/test/java/org/apache/shale/clay/utils/ClayAmalgamTestCase.java
Wed Jun 21 20:22:25 2006
@@ -27,9 +27,7 @@
import org.apache.shale.clay.config.beans.AttributeBean;
import org.apache.shale.clay.config.beans.ComponentBean;
-import org.apache.shale.faces.ShaleConstants;
import org.apache.shale.test.base.AbstractViewControllerTestCase;
-import org.apache.shale.util.Tags;
public class ClayAmalgamTestCase extends AbstractViewControllerTestCase {
@@ -47,7 +45,6 @@
clayAmalgam = new ClayAmalgam();
application.addComponent("org.apache.shale.clay.component.Clay",
"org.apache.shale.clay.component.Clay");
- servletContext.setAttribute(ShaleConstants.TAG_UTILITY_BEAN, new
Tags());
}
// Construct a new instance of this test case.