FAQ
Modified: myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml?rev=933379&r1=933378&r2=933379&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml Mon Apr 12 19:43:30 2010
@@ -28,7 +28,7 @@
Initializes the plugins for our groovy handlers
</description>
<param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
- <param-value>org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
+ <param-value>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
</context-param>


@@ -37,7 +37,7 @@
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
- <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
<param-value>
/Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/groovy
</param-value>
@@ -48,7 +48,7 @@
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
- <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
<param-value>
/Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java
</param-value>
@@ -56,7 +56,7 @@

<context-param>
<description>resource paths for our custom JSF2 resource resolver</description>
- <param-name>org.apache.myfaces.scripting.resources.LOADER_PATHS</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.resources.LOADER_PATHS</param-name>
<param-value>
/Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces20-example/src/main/webapp
</param-value>
@@ -67,7 +67,7 @@
source dir
</description>
<param-name>facelets.RESOURCE_RESOLVER</param-name>
- <param-value>org.apache.myfaces.scripting.facelet.ReroutingResourceResolver</param-value>
+ <param-value>org.apache.myfaces.extensions.scripting.facelet.ReroutingResourceResolver</param-value>
</context-param>
-->
<!--
@@ -75,7 +75,7 @@
<description>a comma separated whitelist of root packages which are compiled those and nothing else
will be compiled during all compile stages, all other files stay permanently as they are
</description>
- <param-name>org.apache.myfaces.scripting.PGK_WHITELIST</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.PGK_WHITELIST</param-name>
<param-value>org.apache.myfaces.groovyloader.blog</param-value>
</context-param>
-->
@@ -86,7 +86,7 @@
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
- <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
<param-value>D:/dev/work/ideaprojects/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/groovy</param-value>
</context-param>

@@ -95,7 +95,7 @@
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
- <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
<param-value>D:/dev/work/ideaprojects/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/java</param-value>
</context-param>

@@ -130,7 +130,7 @@

<filter>
<filter-name>scriptingFilter</filter-name>
- <filter-class>org.apache.myfaces.scripting.servlet.ScriptingServletFilter</filter-class>
+ <filter-class>org.apache.myfaces.extensions.scripting.servlet.ScriptingServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>scriptingFilter</filter-name>

Modified: myfaces/extensions/scripting/trunk/extscript-examples/spring-example/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/spring-example/src/main/webapp/WEB-INF/web.xml?rev=933379&r1=933378&r2=933379&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-examples/spring-example/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/extensions/scripting/trunk/extscript-examples/spring-example/src/main/webapp/WEB-INF/web.xml Mon Apr 12 19:43:30 2010
@@ -53,14 +53,14 @@
Initializes the plugins for our groovy handlers
</description>
<param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
- <param-value>org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
+ <param-value>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
</context-param>

<context-param>
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
- <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
<param-value>D:/dev/work/ideaprojects/threads/extscript/examples/spring-example/src/main/webapp/WEB-INF/groovy
</param-value>
</context-param>
@@ -69,7 +69,7 @@
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
- <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
<param-value>D:/dev/work/ideaprojects/threads/extscript/examples/spring-example/src/main/webapp/WEB-INF/java
</param-value>
</context-param>
@@ -253,7 +253,7 @@

<filter>
<filter-name>scriptingFilter</filter-name>
- <filter-class>org.apache.myfaces.scripting.servlet.ScriptingServletFilter</filter-class>
+ <filter-class>org.apache.myfaces.extensions.scripting.servlet.ScriptingServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>scriptingFilter</filter-name>

Modified: myfaces/extensions/scripting/trunk/src/site/xdoc/configentries.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/src/site/xdoc/configentries.xml?rev=933379&r1=933378&r2=933379&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/src/site/xdoc/configentries.xml (original)
+++ myfaces/extensions/scripting/trunk/src/site/xdoc/configentries.xml Mon Apr 12 19:43:30 2010
@@ -45,7 +45,7 @@
<tr>
<td>org.apache.myfaces.FACES_INIT_PLUGINS</td>
<td>YES</td>
- <td>org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader</td>
+ <td>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader</td>
<td>MyFaces Extension Point Setup</td>
</tr>
<tr>
@@ -57,7 +57,7 @@


<tr>
- <td>org.apache.myfaces.scripting.groovy.LOADER_PATHS</td>
+ <td>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</td>
<td>NO</td>
<td>comma separate list of paths</td>
<td>Additional comma separated loader paths to allow direct editing of groovy files on the sources
@@ -65,7 +65,7 @@
</td>
</tr>
<tr>
- <td>org.apache.myfaces.scripting.java.LOADER_PATHS</td>
+ <td>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</td>
<td>NO</td>
<td>comma separate list of paths</td>
<td>Additional comma separated loader paths to allow direct editing of java files on the sources
@@ -73,7 +73,7 @@
</td>
</tr>
<tr>
- <td>org.apache.myfaces.scripting.resource.LOADER_PATHS</td>
+ <td>org.apache.myfaces.extensions.scripting.resource.LOADER_PATHS</td>
<td>NO</td>
<td>comma separate list of paths</td>
<td>Additional comma separated loader paths to allow direct editing of resources on the sources
@@ -83,9 +83,9 @@
<tr>
<td>facelets.RESOURCE_RESOLVER</td>
<td>NO</td>
- <td>org.apache.myfaces.scripting.facelet.ReroutingResourceResolver</td>
+ <td>org.apache.myfaces.extensions.scripting.facelet.ReroutingResourceResolver</td>
<td>Enables the loading of xhtml facelet pages from your sourcedir if
- org.apache.myfaces.scripting.resource.LOADER_PATHS is set properly
+ org.apache.myfaces.extensions.scripting.resource.LOADER_PATHS is set properly
</td>
</tr>
<tr>
@@ -97,7 +97,7 @@
</td>
</tr>
<tr>
- <td>org.apache.myfaces.scripting.PGK_ADDITIONAL_CLASSPATH</td>
+ <td>org.apache.myfaces.extensions.scripting.PGK_ADDITIONAL_CLASSPATH</td>
<td>NO</td>
<td>a comma separate list of additional classpaths</td>
<td>enables additional classpaths for the compile time</td>

Modified: myfaces/extensions/scripting/trunk/src/site/xdoc/exampleconfig.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/src/site/xdoc/exampleconfig.xml?rev=933379&r1=933378&r2=933379&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/src/site/xdoc/exampleconfig.xml (original)
+++ myfaces/extensions/scripting/trunk/src/site/xdoc/exampleconfig.xml Mon Apr 12 19:43:30 2010
@@ -49,7 +49,7 @@
Initializes the plugins for our scripting support
</description>
<param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
- <param-value>org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
+ <param-value>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
</context-param>

<!-- ======================================================================================
@@ -58,7 +58,7 @@
====================================================================================== -->
<filter>
<filter-name>scriptingFilter</filter-name>
- <filter-class>org.apache.myfaces.scripting.servlet.ScriptingServletFilter</filter-class>
+ <filter-class>org.apache.myfaces.extensions.scripting.servlet.ScriptingServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>scriptingFilter</filter-name>
@@ -109,7 +109,7 @@
Initializes the plugins for our groovy handlers
</description>
<param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
- <param-value>org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
+ <param-value>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
</context-param>


@@ -121,7 +121,7 @@
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
- <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
<param-value>
/Users/werpu2/development/workspace/extensions-scripting3/examples/myfaces20-example/src/main/webapp/WEB-INF/groovy
</param-value>
@@ -134,7 +134,7 @@
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
- <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
<param-value>
/Users/werpu2/development/workspace/extensions-scripting3/examples/myfaces20-example/src/main/webapp/WEB-INF/java
</param-value>
@@ -145,7 +145,7 @@
====================================================================================== -->
<context-param>
<description>resource paths for our custom JSF2 resource resolver</description>
- <param-name>org.apache.myfaces.scripting.resources.LOADER_PATHS</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.resources.LOADER_PATHS</param-name>
<param-value>
/Users/werpu2/development/workspace/extensions-scripting3/examples/myfaces20-example/src/main/webapp
</param-value>
@@ -159,7 +159,7 @@
source dir
</description>
<param-name>facelets.RESOURCE_RESOLVER</param-name>
- <param-value>org.apache.myfaces.scripting.facelet.ReroutingResourceResolver</param-value>
+ <param-value>org.apache.myfaces.extensions.scripting.facelet.ReroutingResourceResolver</param-value>
</context-param>

<!-- ======================================================================================
@@ -169,7 +169,7 @@
<description>a comma separated whitelist of root packages which are compiled those and nothing else
will be compiled during all compile stages, all other files stay permanently as they are
</description>
- <param-name>org.apache.myfaces.scripting.PGK_WHITELIST</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.PGK_WHITELIST</param-name>
<param-value>org.apache.myfaces.groovyloader.blog,org.apache.myfaces.javaloader.blog</param-value>
</context-param>

@@ -180,7 +180,7 @@
<description>
Additional Classpaths which will be added to the compilers classpath
</description>
- <param-name>org.apache.myfaces.scripting.PGK_ADDITIONAL_CLASSPATH</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.PGK_ADDITIONAL_CLASSPATH</param-name>
<param-value>/usr/lib/java/myjar.jar,/usr/lib/java/myjar2.jar</param-value>
</context-param>

@@ -191,7 +191,7 @@

<filter>
<filter-name>scriptingFilter</filter-name>
- <filter-class>org.apache.myfaces.scripting.servlet.ScriptingServletFilter</filter-class>
+ <filter-class>org.apache.myfaces.extensions.scripting.servlet.ScriptingServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>scriptingFilter</filter-name>

Modified: myfaces/extensions/scripting/trunk/src/site/xdoc/installation.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/src/site/xdoc/installation.xml?rev=933379&r1=933378&r2=933379&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/src/site/xdoc/installation.xml (original)
+++ myfaces/extensions/scripting/trunk/src/site/xdoc/installation.xml Mon Apr 12 19:43:30 2010
@@ -129,7 +129,7 @@
</description>
<param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
<param-value>
- org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader
+ org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader
</param-value>
</context-param>]]></source>
<h4>Second Step</h4>
@@ -137,7 +137,7 @@
<source><![CDATA[
<filter>
<filter-name>scriptingFilter</filter-name>
- <filter-class>org.apache.myfaces.scripting.servlet.ScriptingServletFilter</filter-class>
+ <filter-class>org.apache.myfaces.extensions.scripting.servlet.ScriptingServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>scriptingFilter</filter-name>
@@ -192,7 +192,7 @@
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
- <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
<param-value>
<some project path>/src/main/webapp/WEB-INF/groovy
</param-value>
@@ -201,7 +201,7 @@
<description>Additional comma separated loader paths to allow direct editing on the sources directory instead
of the deployment dir
</description>
- <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
+ <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
<param-value>
<some project path>/src/main/webapp/WEB-INF/java
</param-value>
@@ -209,11 +209,11 @@
]]></source>
<ul>
<li>
- <b>org.apache.myfaces.scripting.groovy.LOADER_PATHS</b>
+ <b>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</b>
can be a comma separated list of paths which point to the actual Groovy sources.
</li>
<li>
- <b>org.apache.myfaces.scripting.java.LOADER_PATHS</b>
+ <b>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</b>
does the same for Java sources..
</li>
</ul>

Modified: myfaces/extensions/scripting/trunk/src/site/xdoc/using_eclipse_.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/src/site/xdoc/using_eclipse_.xml?rev=933379&r1=933378&r2=933379&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/src/site/xdoc/using_eclipse_.xml (original)
+++ myfaces/extensions/scripting/trunk/src/site/xdoc/using_eclipse_.xml Mon Apr 12 19:43:30 2010
@@ -73,9 +73,9 @@
</p>
<p>
If you prefer your own source paths to be the sources of everything set the
- <b>org.apache.myfaces.scripting.java.LOADER_PATHS</b>
+ <b>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</b>
or
- <b>org.apache.myfaces.scripting.groovy.LOADER_PATHS</b>
+ <b>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</b>
accordingly in your web.xml the same goes for the resource roots.
</p>


Modified: myfaces/extensions/scripting/trunk/src/site/xdoc/using_intellij.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/src/site/xdoc/using_intellij.xml?rev=933379&r1=933378&r2=933379&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/src/site/xdoc/using_intellij.xml (original)
+++ myfaces/extensions/scripting/trunk/src/site/xdoc/using_intellij.xml Mon Apr 12 19:43:30 2010
@@ -81,9 +81,9 @@
</p>
<p>
If you prefer your own source paths to be the sources of everything set the
- <b>org.apache.myfaces.scripting.java.LOADER_PATHS</b>
+ <b>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</b>
or
- <b>org.apache.myfaces.scripting.groovy.LOADER_PATHS</b>
+ <b>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</b>
accordingly in your web.xml the same goes for the resource roots.
</p>


Modified: myfaces/extensions/scripting/trunk/src/site/xdoc/using_netbeans.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/src/site/xdoc/using_netbeans.xml?rev=933379&r1=933378&r2=933379&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/src/site/xdoc/using_netbeans.xml (original)
+++ myfaces/extensions/scripting/trunk/src/site/xdoc/using_netbeans.xml Mon Apr 12 19:43:30 2010
@@ -87,9 +87,9 @@
</p>
<p>
If you prefer your own source paths to be the sources of everything set the
- <b>org.apache.myfaces.scripting.java.LOADER_PATHS</b>
+ <b>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</b>
or
- <b>org.apache.myfaces.scripting.groovy.LOADER_PATHS</b>
+ <b>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</b>
accordingly in your web.xml the same goes for the resource roots.
</p>

Search Discussions

  • Werpu at Apr 12, 2010 at 7:44 pm
    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/ComponentRule.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/ComponentRule.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/ComponentRule.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/ComponentRule.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,84 @@
    +package org.apache.myfaces.extensions.scripting.facelet.support;
    +
    +import javax.faces.component.UIComponent;
    +import javax.faces.view.facelets.*;
    +import java.util.logging.Level;
    +import java.util.logging.Logger;
    +
    +/**
    + * we have to re implement the component rule class here
    + * because it is declared private in the original
    + * implementation
    + */
    +public final class ComponentRule extends MetaRule {
    +
    + final class LiteralAttributeMetadata extends Metadata {
    + private final String _name;
    + private final String _value;
    +
    + public LiteralAttributeMetadata(String name, String value) {
    + _name = name;
    + _value = value;
    + }
    +
    + public void applyMetadata(FaceletContext ctx, Object instance) {
    + ((UIComponent) instance).getAttributes().put(_name, _value);
    + }
    + }
    +
    + 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) {
    + ((UIComponent) instance).setValueExpression(_name, _attr.getValueExpression(ctx, _type));
    + }
    + }
    +
    + //private final static Logger log = Logger.getLogger("facelets.tag.component");
    + private final static Logger log = Logger.getLogger(ComponentRule.class.getName());
    +
    + public final static ComponentRule Instance = new ComponentRule();
    +
    + public ComponentRule() {
    + super();
    + }
    +
    + public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
    + if (meta.isTargetInstanceOf(UIComponent.class)) {
    + // if component and dynamic, then must set expression
    + if (!attribute.isLiteral()) {
    + Class<?> type = meta.getPropertyType(name);
    + if (type == null) {
    + type = Object.class;
    + }
    +
    + return new ValueExpressionMetadata(name, type, attribute);
    + } else if (meta.getWriteMethod(name) == null) {
    +
    + // this was an attribute literal, but not property
    + warnAttr(attribute, meta.getTargetClass(), name);
    +
    + return new LiteralAttributeMetadata(name, attribute.getValue());
    + }
    + }
    + return null;
    + }
    +
    + private static void warnAttr(TagAttribute attr, Class<?> type, String n) {
    + if (log.isLoggable(Level.FINER)) {
    + log.finer(attr + " Property '" + n + "' is not on type: " + type.getName());
    + }
    + }
    +
    +}
    +

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/InvokeDynamicBeanPropertyTagRule.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/InvokeDynamicBeanPropertyTagRule.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/InvokeDynamicBeanPropertyTagRule.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/InvokeDynamicBeanPropertyTagRule.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,88 @@
    +package org.apache.myfaces.extensions.scripting.facelet.support;
    +
    +import org.apache.myfaces.extensions.scripting.core.util.ReflectUtil;
    +
    +import javax.faces.view.facelets.FaceletContext;
    +import javax.faces.view.facelets.Metadata;
    +import javax.faces.view.facelets.MetadataTarget;
    +import javax.faces.view.facelets.TagAttribute;
    +import java.lang.reflect.Method;
    +
    +/**
    + * We have to introduce a BeanPropertyTagRule
    + * which calls the setter of a given component
    + * on a weaker base than the original facelets component
    + * property tag rule does.
    + * By not enforcing a strict per object/class policy on calling
    + * the setter we are able to reload the classes on the fly
    + * <p/>
    + * the original approach was to cache the classes, and then
    + * call the invoke method on the existing class
    + * if we now exchange the classes we have a problem...
    + * By making the invocation of the method independend from the underlying
    + * class (sort of calling an invokedynamic) we can bypass this problem
    + * on facelets level.
    + */
    +public class InvokeDynamicBeanPropertyTagRule {
    + public final static InvokeDynamicBeanPropertyTagRule Instance = new InvokeDynamicBeanPropertyTagRule();
    +
    + public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
    + Method m = meta.getWriteMethod(name);
    +
    + // if the property is writable
    + if (m != null) {
    + if (attribute.isLiteral()) {
    + return new LiteralPropertyMetadata(m, attribute);
    + } else {
    + return new DynamicPropertyMetadata(m, attribute);
    + }
    + }
    +
    + return null;
    + }
    +
    + final static class LiteralPropertyMetadata extends Metadata {
    +
    + private final Method method;
    +
    + private final TagAttribute attribute;
    +
    + private Object[] value;
    +
    + public LiteralPropertyMetadata(Method method, TagAttribute attribute) {
    + this.method = method;
    + this.attribute = attribute;
    + }
    +
    + public void applyMetadata(FaceletContext ctx, Object instance) {
    + if (value == null) {
    + String str = this.attribute.getValue();
    + value = new Object[]{ctx.getExpressionFactory().coerceToType(str, method.getParameterTypes()[0])};
    + }
    + //What we do here is simply to call an invoke dynamic on the method with the same name
    + //but on the new instance of, that way we can bypass class problems
    + //because the method reference has stored the old class in our case
    + ReflectUtil.executeMethod(instance, method.getName(), this.value);
    + }
    +
    + }
    +
    + final static class DynamicPropertyMetadata extends Metadata {
    +
    + private final Method method;
    +
    + private final TagAttribute attribute;
    +
    + private final Class<?> type;
    +
    + public DynamicPropertyMetadata(Method method, TagAttribute attribute) {
    + this.method = method;
    + this.type = method.getParameterTypes()[0];
    + this.attribute = attribute;
    + }
    +
    + public void applyMetadata(FaceletContext ctx, Object instance) {
    + ReflectUtil.executeMethod(instance, method.getName(), new Object[]{attribute.getObject(ctx, type)});
    + }
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/SwitchingBeanPropertyTagRule.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/SwitchingBeanPropertyTagRule.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/SwitchingBeanPropertyTagRule.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/SwitchingBeanPropertyTagRule.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,33 @@
    +package org.apache.myfaces.extensions.scripting.facelet.support;
    +
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.view.facelets.tag.BeanPropertyTagRule;
    +
    +import javax.faces.view.facelets.MetaRule;
    +import javax.faces.view.facelets.Metadata;
    +import javax.faces.view.facelets.MetadataTarget;
    +import javax.faces.view.facelets.TagAttribute;
    +
    +/**
    + * Bean property tag rule
    + * which switches between the fast static
    + * version and the slower invoke dynamic
    + * version depending on the class type of
    + * the incoming instance
    + */
    +public class SwitchingBeanPropertyTagRule extends MetaRule {
    +
    + InvokeDynamicBeanPropertyTagRule _invokeDynamic = InvokeDynamicBeanPropertyTagRule.Instance;
    + BeanPropertyTagRule _invokeStatic = BeanPropertyTagRule.Instance;
    +
    + public static volatile SwitchingBeanPropertyTagRule Instance = new SwitchingBeanPropertyTagRule();
    +
    + @Override
    + public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
    + if (WeavingContext.isDynamic(meta.getTargetClass())) {
    + return _invokeDynamic.applyRule(name, attribute, meta);
    + } else {
    + return _invokeStatic.applyRule(name, attribute, meta);
    + }
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/SwitchingMetarulesetImpl.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/SwitchingMetarulesetImpl.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/SwitchingMetarulesetImpl.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/support/SwitchingMetarulesetImpl.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,161 @@
    +package org.apache.myfaces.extensions.scripting.facelet.support;
    +
    +import org.apache.myfaces.view.facelets.tag.MetaRulesetImpl;
    +import org.apache.myfaces.view.facelets.tag.MetadataImpl;
    +import org.apache.myfaces.view.facelets.tag.MetadataTargetImpl;
    +import org.apache.myfaces.view.facelets.util.ParameterCheck;
    +
    +import javax.faces.view.facelets.*;
    +import java.beans.IntrospectionException;
    +import java.util.*;
    +import java.util.logging.Level;
    +import java.util.logging.Logger;
    +
    +/**
    + * we have to to do a full reimplementation of the rule set
    + * because otherwise we could not plant the switching bean reloading
    + * rule due to private props in the original code
    + */
    +public class SwitchingMetarulesetImpl extends MetaRuleset {
    + private final static Metadata NONE = new NullMetadata();
    +
    + //private final static Logger log = Logger.getLogger("facelets.tag.meta");
    + private final static Logger log = Logger.getLogger(MetaRulesetImpl.class.getName());
    +
    + private final static WeakHashMap<String, MetadataTarget> _metadata = new WeakHashMap<String, MetadataTarget>();
    +
    + private final Map<String, TagAttribute> _attributes;
    +
    + private final List<Metadata> _mappers;
    +
    + private final List<MetaRule> _rules;
    +
    + private final Tag _tag;
    +
    + private final Class<?> _type;
    +
    + public SwitchingMetarulesetImpl(Tag tag, Class<?> type) {
    + _tag = tag;
    + _type = type;
    + _attributes = new HashMap<String, TagAttribute>();
    + _mappers = new ArrayList<Metadata>();
    + _rules = new ArrayList<MetaRule>();
    +
    + // setup attributes
    + for (TagAttribute attribute : _tag.getAttributes().getAll()) {
    + _attributes.put(attribute.getLocalName(), attribute);
    + }
    +
    + // add default rules
    + _rules.add(SwitchingBeanPropertyTagRule.Instance);
    + }
    +
    + public MetaRuleset add(Metadata mapper) {
    + ParameterCheck.notNull("mapper", mapper);
    +
    + if (!_mappers.contains(mapper)) {
    + _mappers.add(mapper);
    + }
    +
    + return this;
    + }
    +
    + public MetaRuleset addRule(MetaRule rule) {
    + ParameterCheck.notNull("rule", rule);
    +
    + _rules.add(rule);
    +
    + return this;
    + }
    +
    + public MetaRuleset alias(String attribute, String property) {
    + ParameterCheck.notNull("attribute", attribute);
    + ParameterCheck.notNull("property", property);
    +
    + TagAttribute attr = (TagAttribute) _attributes.remove(attribute);
    + if (attr != null) {
    + _attributes.put(property, attr);
    + }
    +
    + return this;
    + }
    +
    + public Metadata finish() {
    + assert !_rules.isEmpty();
    +
    + if (!_attributes.isEmpty()) {
    + MetadataTarget target = this._getMetadataTarget();
    + int ruleEnd = _rules.size() - 1;
    +
    + // now iterate over attributes
    + for (Map.Entry<String, TagAttribute> entry : _attributes.entrySet()) {
    + Metadata data = null;
    +
    + int i = ruleEnd;
    +
    + // First loop is always safe
    + do {
    + MetaRule rule = _rules.get(i);
    + data = rule.applyRule(entry.getKey(), entry.getValue(), target);
    + i--;
    + } while (data == null && i >= 0);
    +
    + if (data == null) {
    + if (log.isLoggable(Level.SEVERE)) {
    + log.severe(entry.getValue() + " Unhandled by MetaTagHandler for type " + _type.getName());
    + }
    + } else {
    + _mappers.add(data);
    + }
    + }
    + }
    +
    + if (_mappers.isEmpty()) {
    + return NONE;
    + } else {
    + return new MetadataImpl(_mappers.toArray(new Metadata[_mappers.size()]));
    + }
    + }
    +
    + public MetaRuleset ignore(String attribute) {
    + ParameterCheck.notNull("attribute", attribute);
    +
    + _attributes.remove(attribute);
    +
    + return this;
    + }
    +
    + public MetaRuleset ignoreAll() {
    + _attributes.clear();
    +
    + return this;
    + }
    +
    + private final MetadataTarget _getMetadataTarget() {
    + String key = _type.getName();
    +
    + MetadataTarget meta = _metadata.get(key);
    + if (meta == null) {
    + try {
    + meta = new MetadataTargetImpl(_type);
    + }
    + catch (IntrospectionException e) {
    + throw new TagException(_tag, "Error Creating TargetMetadata", e);
    + }
    +
    + _metadata.put(key, meta);
    + }
    +
    + return meta;
    + }
    +
    + private static class NullMetadata extends Metadata {
    + /**
    + * {@inheritDoc}
    + */
    + @Override
    + public void applyMetadata(FaceletContext ctx, Object instance) {
    + // do nothing
    + }
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingApplicationFactory.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingApplicationFactory.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingApplicationFactory.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingApplicationFactory.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,77 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.factories;
    +
    +import org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.implemetations.ApplicationProxy;
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.application.ApplicationFactory;
    +import javax.faces.application.Application;
    +
    +/**
    + * Application factory which introduces
    + * scripting proxies for their artefacts
    + * <p/>
    + * We use a mix of AOP and helper constructs
    + * to reach the goal to be dynamic.
    + * For most artefacts we just need to
    + * check if the object is a Groovy object
    + * and then reload at their connection interfaces
    + * <p/>
    + * Some artefacts have a longer lifespan and/or are stateless
    + * for those we have to work with reloading AOP
    + *
    + * @author Werner Punz
    + */
    +public class ScriptingApplicationFactory extends ApplicationFactory implements Decorated {
    +
    + ApplicationFactory _delegate;
    +
    +
    + public ScriptingApplicationFactory(ApplicationFactory delegate) {
    + _delegate = delegate;
    +
    + }
    +
    + public Application getApplication() {
    + Application retVal = _delegate.getApplication(); //To change body of implemented methods use File | Settings | File Templates.
    +
    + if (WeavingContext.isScriptingEnabled() && !(retVal instanceof ApplicationProxy))
    + retVal = new ApplicationProxy(retVal);
    +
    + return retVal;
    + }
    +
    + public void setApplication(Application application) {
    + if (WeavingContext.isScriptingEnabled() && !(application instanceof ApplicationProxy))
    + application = new ApplicationProxy(application);
    +
    + _delegate.setApplication(application);
    + }
    +
    + @Override
    + public ApplicationFactory getWrapped() {
    + return _delegate.getWrapped();
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingFacesContextFactory.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingFacesContextFactory.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingFacesContextFactory.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingFacesContextFactory.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,64 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.factories;
    +
    +import org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.implemetations.FacesContextProxy;
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.context.FacesContext;
    +import javax.faces.context.FacesContextFactory;
    +import javax.faces.lifecycle.Lifecycle;
    +import javax.faces.FacesException;
    +
    +/**
    + * Faces context weaver which builds
    + * our reloading proxy around the current faces context
    + *
    + * @author Werner Punz
    + */
    +public class ScriptingFacesContextFactory extends javax.faces.context.FacesContextFactory implements Decorated {
    +
    + public FacesContextFactory _delegate;
    +
    + public ScriptingFacesContextFactory(FacesContextFactory delegate) {
    + _delegate = delegate;
    + }
    +
    + public void setDelegate(FacesContextFactory delegate) {
    + _delegate = delegate;
    + }
    +
    + public FacesContext getFacesContext(Object o, Object o1, Object o2, Lifecycle lifecycle) throws FacesException {
    + FacesContext retVal = _delegate.getFacesContext(o, o1, o2, lifecycle); //To change body of implemented methods use File | Settings | File Templates.
    +
    + if (WeavingContext.isScriptingEnabled() && !(retVal instanceof FacesContextProxy))
    + return new FacesContextProxy(retVal);
    + return retVal;
    + }
    +
    + @Override
    + public FacesContextFactory getWrapped() {
    + return _delegate.getWrapped();
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingLifecycleFactory.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingLifecycleFactory.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingLifecycleFactory.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingLifecycleFactory.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,74 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.factories;
    +
    +import org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.implemetations.LifefcycleProxy;
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.lifecycle.LifecycleFactory;
    +import javax.faces.lifecycle.Lifecycle;
    +import java.util.Iterator;
    +
    +/**
    + * Lifecyclefactory which introduces scripting proxies
    + * for their artefacts
    + *
    + * @author Werner Punz
    + */
    +public class ScriptingLifecycleFactory extends LifecycleFactory implements Decorated {
    +
    + LifecycleFactory _delegate;
    +
    +
    + public ScriptingLifecycleFactory(LifecycleFactory delegate) {
    + _delegate = delegate;
    + }
    +
    + public void addLifecycle(String s, Lifecycle lifecycle) {
    + if (WeavingContext.isScriptingEnabled() && !(lifecycle instanceof LifefcycleProxy))
    + lifecycle = new LifefcycleProxy(lifecycle);
    + _delegate.addLifecycle(s, lifecycle);
    + }
    +
    + public Lifecycle getLifecycle(String s) {
    + Lifecycle retVal = _delegate.getLifecycle(s);
    + if (WeavingContext.isScriptingEnabled() && !(retVal instanceof LifefcycleProxy))
    + retVal = new LifefcycleProxy(retVal);
    +
    + return retVal;
    + }
    +
    + public Iterator getLifecycleIds() {
    + return _delegate.getLifecycleIds();
    + }
    +
    + public void setDelegate(LifecycleFactory delegate) {
    + this._delegate = delegate;
    + }
    +
    + @Override
    + public LifecycleFactory getWrapped() {
    + return _delegate.getWrapped();
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingRenderkitFactory.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingRenderkitFactory.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingRenderkitFactory.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingRenderkitFactory.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,74 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.factories;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.implemetations.RenderkitProxy;
    +
    +import javax.faces.render.RenderKitFactory;
    +import javax.faces.render.RenderKit;
    +import javax.faces.context.FacesContext;
    +import java.util.Iterator;
    +
    +/**
    + * Scripting enabled renderkit factory
    + *
    + * @author Werner Punz
    + */
    +public class ScriptingRenderkitFactory extends RenderKitFactory implements Decorated {
    +
    +
    + public ScriptingRenderkitFactory(RenderKitFactory delegate) {
    + _delegate = delegate;
    + }
    +
    + public void addRenderKit(String s, RenderKit renderKit) {
    + if (WeavingContext.isScriptingEnabled() && renderKit != null && !(renderKit instanceof RenderkitProxy))
    + renderKit = new RenderkitProxy(renderKit);
    +
    + _delegate.addRenderKit(s, renderKit);
    + }
    +
    + public RenderKit getRenderKit(FacesContext facesContext, String s) {
    + RenderKit retVal = _delegate.getRenderKit(facesContext, s);
    + if (WeavingContext.isScriptingEnabled() && retVal != null && !(retVal instanceof RenderkitProxy))
    + retVal = new RenderkitProxy(retVal);
    + return retVal;
    + }
    +
    + public Iterator getRenderKitIds() {
    + return _delegate.getRenderKitIds();
    + }
    +
    + public void setDelegate(RenderKitFactory delegate) {
    + _delegate = delegate;
    + }
    +
    + @Override
    + public RenderKitFactory getWrapped() {
    + return _delegate.getWrapped();
    + }
    +
    + RenderKitFactory _delegate = null;
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,840 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.extensions.scripting.jsf2.annotation.purged.*;
    +
    +import javax.el.*;
    +import javax.faces.FacesException;
    +import javax.faces.application.*;
    +import javax.faces.component.UIComponent;
    +import javax.faces.component.behavior.Behavior;
    +import javax.faces.context.FacesContext;
    +import javax.faces.convert.Converter;
    +import javax.faces.el.*;
    +import javax.faces.event.*;
    +import javax.faces.validator.Validator;
    +import java.util.*;
    +import java.util.concurrent.ConcurrentHashMap;
    +
    +/**
    + * @author Werner Punz
    + * <p/>
    + * our decorating applicstion
    + * which should resolve our bean issues within a central
    + * bean processing interceptor
    + */
    +public class ApplicationProxy extends Application implements Decorated {
    +
    + Application _delegate = null;
    +
    + /*
    + * separate map needed for the behavior ids, because
    + * the original is immutable
    + * we have to do a double bookkeeping
    + * here
    + */
    + Map<String, String> _behaviors = new ConcurrentHashMap<String, String>();
    +
    + /**
    + * special data structure to save our
    + * object -> proxy references
    + */
    + class EventHandlerProxyEntry {
    + Class event;
    + Decorated proxy;
    +
    + EventHandlerProxyEntry(Class event, Decorated proxy) {
    + this.event = event;
    + this.proxy = proxy;
    + }
    +
    + @SuppressWarnings("unused")
    + public Class getEvent() {
    + return event;
    + }
    +
    + @SuppressWarnings("unused")
    + public void setEvent(Class event) {
    + this.event = event;
    + }
    +
    + public Decorated getProxy() {
    + return proxy;
    + }
    +
    + @SuppressWarnings("unused")
    + public void setProxy(Decorated proxy) {
    + this.proxy = proxy;
    + }
    +
    + @Override
    + public boolean equals(Object o) {
    + if (this == o) return true;
    + if (o == null || getClass() != o.getClass()) return false;
    +
    + EventHandlerProxyEntry that = (EventHandlerProxyEntry) o;
    +
    + return !(event != null ? !event.equals(that.event) : that.event != null) && !(proxy != null ? !proxy.getDelegate().getClass().getName().equals(that.proxy.getDelegate().getClass().getName()) : that.proxy != null);
    +
    + }
    +
    + @Override
    + public int hashCode() {
    + int result = event.hashCode();
    + result = 31 * result + proxy.getDelegate().getClass().getName().hashCode();
    + return result;
    + }
    + }
    +
    + /**
    + * now at the first look this looks like a weird construct
    + * but the standard java set imposes this limit since
    + * we have to iterate over the entire set to reach the correct element
    + * the trick is to save the same object in as both key and value
    + * and now if we generate a new key on an object
    + * we can fetch our proxy which might already contain
    + * the same object in a refreshed state from the value
    + * part of the set, in our case
    + * using hash maps should speed things up
    + * <p/>
    + * since we only have few write operations but access
    + * the map multithreaded we use concurrentHashMap here
    + */
    + Map<EventHandlerProxyEntry, EventHandlerProxyEntry> _eventHandlerIdx = new ConcurrentHashMap<EventHandlerProxyEntry, EventHandlerProxyEntry>();
    +
    + public ApplicationProxy(Application delegate) {
    + _delegate = delegate;
    + }
    +
    + public void addELResolver(ELResolver elResolver) {
    + weaveDelegate();
    + //This can be problematic if several libraries add their own proxies
    + // that way then might get get a cyclic stack
    + //under normal circumstances this should not happen
    + //because addElResolver is called once and getElResolver
    + //does not change the stack afterwards in the worst case
    + //we might get 2 of our proxies in the delegate stack
    +
    + //the same goes for the rest of the factory stuff
    + if (!(elResolver instanceof ELResolverProxy))
    + elResolver = new ELResolverProxy(elResolver);
    + _delegate.addELResolver(elResolver);
    + }
    +
    + private void weaveDelegate() {
    + if (_delegate != null) {
    + _delegate = (Application) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_APPLICATION);
    + }
    + }
    +
    + public ELResolver getELResolver() {
    + weaveDelegate();
    + ELResolver retVal = _delegate.getELResolver();
    + if (!(retVal instanceof ELResolverProxy)) {
    + retVal = new ELResolverProxy(retVal);
    + }
    + return retVal;
    +
    + }
    +
    + //TOD add a weaving for resource bundles
    +
    + public ResourceBundle getResourceBundle(FacesContext facesContext, String s) throws FacesException, NullPointerException {
    + weaveDelegate();
    + return _delegate.getResourceBundle(facesContext, s);
    + }
    +
    + public UIComponent createComponent(ValueExpression valueExpression, FacesContext facesContext, String componentType) throws FacesException, NullPointerException {
    + weaveDelegate();
    + UIComponent component = _delegate.createComponent(valueExpression, facesContext, componentType);
    + UIComponent oldComponent = component;
    + //We can replace annotated components on the fly via
    + //ApplicationImpl.addComponent(final String componentType, final String componentClassName)
    +
    + /*we are reweaving on the fly because we cannot be sure if
    + * the class is not recycled all the time in the creation
    + * code, in the renderer we do it on method base
    + * due to the fact that our renderers are recycled via
    + * a flyweight pattern
    + *
    + *
    + * Also we cannot proxy here because there is no UIComponent interface
    + * maybe in the long run we can make a decorator here instead
    + * but for now lets try it this way
    + */
    + component = (UIComponent) reloadInstance(component, ScriptingConst.ARTIFACT_TYPE_COMPONENT);
    +
    + //we now have to check for an annotation change, but only in case a reload has happened
    + if (component.getClass().hashCode() != oldComponent.getClass().hashCode()) {
    + return handleAnnotationChange(component, valueExpression, facesContext, componentType);
    + }
    +
    + return component;
    +
    + }
    +
    + public ExpressionFactory getExpressionFactory() {
    + weaveDelegate();
    + return _delegate.getExpressionFactory();
    + }
    +
    + public void addELContextListener(ELContextListener elContextListener) {
    + weaveDelegate();
    + if (WeavingContext.isDynamic(elContextListener.getClass()))
    + elContextListener = (ELContextListener) WeavingContext.createMethodReloadingProxyFromObject(elContextListener, ELContextListener.class, ScriptingConst.ARTIFACT_TYPE_ELCONTEXTLISTENER);
    + _delegate.addELContextListener(elContextListener);
    + }
    +
    + public void removeELContextListener(ELContextListener elContextListener) {
    + weaveDelegate();
    + _delegate.removeELContextListener(elContextListener);
    + }
    +
    + public ELContextListener[] getELContextListeners() {
    + weaveDelegate();
    + return _delegate.getELContextListeners();
    + }
    +
    + public ActionListener getActionListener() {
    + weaveDelegate();
    + ActionListener retVal = _delegate.getActionListener();
    + if (WeavingContext.isDynamic(retVal.getClass()))
    + retVal = (ActionListener) WeavingContext.createMethodReloadingProxyFromObject(retVal, ActionListener.class, ScriptingConst.ARTIFACT_TYPE_ACTIONLISTENER);
    + return retVal;
    + }
    +
    + public void setActionListener(ActionListener actionListener) {
    + weaveDelegate();
    + if (WeavingContext.isDynamic(actionListener.getClass()))
    + actionListener = (ActionListener) WeavingContext.createMethodReloadingProxyFromObject(actionListener, ActionListener.class, ScriptingConst.ARTIFACT_TYPE_ACTIONLISTENER);
    + _delegate.setActionListener(actionListener);
    + }
    +
    + public Locale getDefaultLocale() {
    + weaveDelegate();
    + return _delegate.getDefaultLocale();
    + }
    +
    + public void setDefaultLocale(Locale locale) {
    + weaveDelegate();
    + _delegate.setDefaultLocale(locale);
    + }
    +
    + public String getDefaultRenderKitId() {
    + weaveDelegate();
    + return _delegate.getDefaultRenderKitId();
    + }
    +
    + public void setDefaultRenderKitId(String s) {
    + weaveDelegate();
    + _delegate.setDefaultRenderKitId(s);
    + }
    +
    + public String getMessageBundle() {
    + weaveDelegate();
    + return _delegate.getMessageBundle();
    + }
    +
    + public void setMessageBundle(String s) {
    + weaveDelegate();
    + _delegate.setMessageBundle(s);
    + }
    +
    + public NavigationHandler getNavigationHandler() {
    + weaveDelegate();
    + //defined in the setter to speed things up a little
    + NavigationHandler retVal = _delegate.getNavigationHandler();
    +
    + if (retVal != null && WeavingContext.isDynamic(retVal.getClass()))
    + retVal = new NavigationHandlerProxy(retVal);
    + return retVal;
    + }
    +
    + public void setNavigationHandler(NavigationHandler navigationHandler) {
    + weaveDelegate();
    +
    + if (navigationHandler != null && WeavingContext.isDynamic(navigationHandler.getClass()))
    + navigationHandler = new NavigationHandlerProxy(navigationHandler);
    + _delegate.setNavigationHandler(navigationHandler);
    + }
    +
    + @SuppressWarnings("deprecation")
    + public PropertyResolver getPropertyResolver() {
    + weaveDelegate();
    + return _delegate.getPropertyResolver();
    + }
    +
    + @SuppressWarnings("deprecation")
    + public void setPropertyResolver(PropertyResolver propertyResolver) {
    + weaveDelegate();
    + _delegate.setPropertyResolver(propertyResolver);
    + }
    +
    + @SuppressWarnings("deprecation")
    + public VariableResolver getVariableResolver() {
    + weaveDelegate();
    + VariableResolver variableResolver = _delegate.getVariableResolver();
    + if (!(variableResolver instanceof VariableResolverProxy))
    + variableResolver = new VariableResolverProxy(variableResolver);
    + return variableResolver;
    + }
    +
    + @SuppressWarnings("deprecation")
    + public void setVariableResolver(VariableResolver variableResolver) {
    + weaveDelegate();
    + if (!(variableResolver instanceof VariableResolverProxy))
    + variableResolver = new VariableResolverProxy(variableResolver);
    +
    + _delegate.setVariableResolver(variableResolver);
    + }
    +
    + public ViewHandler getViewHandler() {
    + weaveDelegate();
    + ViewHandler handler = _delegate.getViewHandler();
    +
    + /*
    + We proxy here to enable dynamic reloading for
    + methods in the long run, as soon as we hit
    + java all our groovy reloading code is lost
    + hence we have to work with proxies here
    + */
    + if (WeavingContext.isDynamic(handler.getClass()))
    + handler = new ViewHandlerProxy(handler);
    + return handler;
    + }
    +
    + public void setViewHandler(ViewHandler viewHandler) {
    + weaveDelegate();
    + /*make sure you have the delegates as well in properties*/
    + if (WeavingContext.isDynamic(viewHandler.getClass()))
    + viewHandler = new ViewHandlerProxy(viewHandler);
    +
    + _delegate.setViewHandler(viewHandler);
    + }
    +
    + public StateManager getStateManager() {
    + weaveDelegate();
    + return _delegate.getStateManager();
    + }
    +
    + public void setStateManager(StateManager stateManager) {
    + weaveDelegate();
    + _delegate.setStateManager(stateManager);
    + }
    +
    + public void addComponent(String componentType, String componentClass) {
    + weaveDelegate();
    + _delegate.addComponent(componentType, componentClass);
    + }
    +
    + public UIComponent createComponent(String componentType) throws FacesException {
    + weaveDelegate();
    + //the components are generated anew very often
    + //we cannot do an on object weaving here
    + UIComponent oldComponent = _delegate.createComponent(componentType);
    +
    + /*we are reweaving on the fly because we cannot be sure if
    + * the class is not recycled all the time in the creation
    + * code, in the renderer we do it on method base
    + * due to the fact that our renderers are recycled via
    + * a flyweight pattern*/
    + UIComponent component = (UIComponent) reloadInstance(oldComponent, ScriptingConst.ARTIFACT_TYPE_COMPONENT);
    +
    + //we now have to check for an annotation change, but only in case a reload has happened
    + if (component.getClass().hashCode() != oldComponent.getClass().hashCode()) {
    + return handleAnnotationChange(component, componentType);
    + }
    +
    + return component;
    +
    + }
    +
    + @SuppressWarnings("deprecation")
    + public UIComponent createComponent(ValueBinding valueBinding, FacesContext facesContext, String componentType) throws FacesException {
    + weaveDelegate();
    + UIComponent oldComponent = _delegate.createComponent(valueBinding, facesContext, componentType);
    +
    + /*we are reweaving on the fly because we cannot be sure if
    + * the class is not recycled all the time in the creation
    + * code, in the renderer we do it on method base
    + * due to the fact that our renderers are recycled via
    + * a flyweight pattern*/
    + UIComponent component = (UIComponent) reloadInstance(oldComponent, ScriptingConst.ARTIFACT_TYPE_COMPONENT);
    +
    + //we now have to check for an annotation change, but only in case a reload has happened
    + if (component.getClass().hashCode() != oldComponent.getClass().hashCode()) {
    + return handleAnnotationChange(component, valueBinding, facesContext, componentType);
    + }
    +
    + return component;
    + }
    +
    + public Iterator<String> getComponentTypes() {
    + weaveDelegate();
    + return _delegate.getComponentTypes();
    + }
    +
    + public void addConverter(String converterId, String converterClass) {
    + weaveDelegate();
    + /* if (converterClass.equals(PurgedConverter.class.getName())) {
    + //purged case we do a full rescan
    + WeavingContext.getWeaver().fullClassScan();
    + Converter componentToChange = _delegate.createConverter(converterId);
    + if (componentToChange instanceof PurgedConverter) {
    + //Null not allowed here, but we set a purted converter to make
    + //sure that we get errors on the proper level
    + _delegate.addConverter(converterId, PurgedConverter.class.getName());
    + }
    + return;
    + }*/
    +
    + _delegate.addConverter(converterId, converterClass);
    + }
    +
    + public void addConverter(Class targetClass, String converterClass) {
    + weaveDelegate();
    + _delegate.addConverter(targetClass, converterClass);
    + }
    +
    + public Converter createConverter(String converterId) {
    + weaveDelegate();
    + Converter retVal = _delegate.createConverter(converterId);
    +
    + /**
    + * since createConverter is called only once
    + * we have to work with method reloading proxies
    + * we cannot use this technique extensively for speed reasons
    + * most of the time it is fine just to work with
    + *
    + * reloading objects at their interception points
    + */
    + Converter newRetVal = (Converter) reloadInstance(retVal, ScriptingConst.ARTIFACT_TYPE_CONVERTER);
    + if (newRetVal != retVal) {
    + return _delegate.createConverter(converterId);
    + }
    +
    + return retVal;
    + }
    +
    + public Converter createConverter(Class aClass) {
    + weaveDelegate();
    + Converter retVal = _delegate.createConverter(aClass);
    + Converter newRetVal = (Converter) reloadInstance(retVal, ScriptingConst.ARTIFACT_TYPE_CONVERTER);
    + if (newRetVal != retVal) {
    + return _delegate.createConverter(aClass);
    + }
    +
    + return retVal;
    + }
    +
    + public Iterator<String> getConverterIds() {
    + weaveDelegate();
    + return _delegate.getConverterIds();
    + }
    +
    + public Iterator<Class<?>> getConverterTypes() {
    + weaveDelegate();
    + return _delegate.getConverterTypes();
    + }
    +
    + @SuppressWarnings("deprecation")
    + public MethodBinding createMethodBinding(String s, Class[] classes) throws ReferenceSyntaxException {
    + weaveDelegate();
    + return _delegate.createMethodBinding(s, classes);
    + }
    +
    + public Iterator<Locale> getSupportedLocales() {
    + weaveDelegate();
    + return _delegate.getSupportedLocales();
    + }
    +
    + public void setSupportedLocales(Collection<Locale> locales) {
    + weaveDelegate();
    + _delegate.setSupportedLocales(locales);
    + }
    +
    + public void addValidator(String validatorId, String validatorClass) {
    + weaveDelegate();
    +/* if (validatorClass.equals(PurgedValidator.class.getName())) {
    + //purged case we do a full rescane
    + WeavingContext.getWeaver().fullClassScan();
    + Validator componentToChange = _delegate.createValidator(validatorId);
    + if (componentToChange instanceof PurgedValidator) {
    + //Null not allowed here, but we set a purted validator to make
    + //sure that we get errors on the proper level
    + _delegate.addValidator(validatorId, PurgedValidator.class.getName());
    +
    + }
    + return;
    + } */
    + _delegate.addValidator(validatorId, validatorClass);
    + }
    +
    + public Validator createValidator(String validatorId) throws FacesException {
    + weaveDelegate();
    +
    + Validator retVal = _delegate.createValidator(validatorId);
    +
    + //the validators are recreated every request we do not have to deal with them on method level
    + Validator newRetVal = (Validator) reloadInstance(retVal, ScriptingConst.ARTIFACT_TYPE_VALIDATOR);
    + if (newRetVal != retVal) {
    + _delegate.createValidator(validatorId);
    + }
    + return retVal;
    + }
    +
    + public Iterator<String> getValidatorIds() {
    + weaveDelegate();
    + return _delegate.getValidatorIds();
    + }
    +
    + @SuppressWarnings("deprecation")
    + public ValueBinding createValueBinding(String s) throws ReferenceSyntaxException {
    + weaveDelegate();
    + return _delegate.createValueBinding(s);
    + }
    +
    + @Override
    + public void addBehavior(String behaviorId, String behaviorClass) {
    + weaveDelegate();
    +
    + if (behaviorClass.equals(PurgedValidator.class.getName())) {
    + //purged case we do a full rescan
    + WeavingContext.getWeaver().fullClassScan();
    + Behavior behavior = _delegate.createBehavior(behaviorId);
    + _behaviors.put(behaviorId, behaviorClass);
    + if (behavior instanceof PurgedBehavior) {
    + //Null not allowed here, but we set a purged validator to make
    + //sure that we get errors on the proper level
    + _delegate.addBehavior(behaviorId, PurgedBehavior.class.getName());
    + _behaviors.remove(behaviorId);
    +
    + }
    + return;
    + }
    +
    + _delegate.addBehavior(behaviorId, behaviorClass);
    + }
    +
    + @Override
    + public void addDefaultValidatorId(String validatorId) {
    + weaveDelegate();
    + _delegate.addDefaultValidatorId(validatorId);
    + }
    +
    + @Override
    + public Behavior createBehavior(String behaviorId) throws FacesException {
    + weaveDelegate();
    + Behavior retVal = _delegate.createBehavior(behaviorId);
    +
    + //we might have casts here against one of the parents
    + //of this object
    + Behavior newBehavior = (Behavior) reloadInstance(retVal, ScriptingConst.ARTIFACT_TYPE_BEHAVIOR);
    + if (newBehavior != retVal) {
    + return _delegate.createBehavior(behaviorId);
    + }
    +
    + return retVal;
    + }
    +
    + @Override
    + public UIComponent createComponent(FacesContext facesContext, Resource resource) {
    + weaveDelegate();
    +
    + UIComponent oldComponent = _delegate.createComponent(facesContext, resource);
    +
    + /*we are reweaving on the fly because we cannot be sure if
    + * the class is not recycled all the time in the creation
    + * code, in the renderer we do it on method base
    + * due to the fact that our renderers are recycled via
    + * a flyweight pattern*/
    + UIComponent component = (UIComponent) reloadInstance(oldComponent, ScriptingConst.ARTIFACT_TYPE_COMPONENT);
    +
    + //we now have to check for an annotation change, but only in case a reload has happened
    + if (component.getClass().hashCode() != oldComponent.getClass().hashCode()) {
    + return handleAnnotationChange(component, facesContext, resource);
    + }
    +
    + return component;
    +
    + }
    +
    + @Override
    + public UIComponent createComponent(FacesContext facesContext, String componentType, String rendererType) {
    + weaveDelegate();
    + UIComponent oldComponent = _delegate.createComponent(facesContext, componentType, rendererType);
    +
    + /*we are reweaving on the fly because we cannot be sure if
    + * the class is not recycled all the time in the creation
    + * code, in the renderer we do it on method base
    + * due to the fact that our renderers are recycled via
    + * a flyweight pattern*/
    + UIComponent component = (UIComponent) reloadInstance(oldComponent, ScriptingConst.ARTIFACT_TYPE_COMPONENT);
    +
    + //we now have to check for an annotation change, but only in case a reload has happened
    + if (component.getClass().hashCode() != oldComponent.getClass().hashCode()) {
    + return handleAnnotationChange(component, facesContext, componentType, rendererType);
    + }
    +
    + return component;
    + }
    +
    + @Override
    + public UIComponent createComponent(ValueExpression valueExpression, FacesContext facesContext, String s, String s1) {
    + weaveDelegate();
    + UIComponent oldComponent = _delegate.createComponent(valueExpression, facesContext, s, s1);
    +
    + /*we are reweaving on the fly because we cannot be sure if
    + * the class is not recycled all the time in the creation
    + * code, in the renderer we do it on method base
    + * due to the fact that our renderers are recycled via
    + * a flyweight pattern*/
    + UIComponent component = (UIComponent) reloadInstance(oldComponent, ScriptingConst.ARTIFACT_TYPE_COMPONENT);
    +
    + //we now have to check for an annotation change, but only in case a reload has happened
    + if (component.getClass().hashCode() != oldComponent.getClass().hashCode()) {
    + return handleAnnotationChange(component, valueExpression, facesContext, s, s1);
    + }
    +
    + return component;
    + }
    +
    + @Override
    + @SuppressWarnings("unchecked")
    + public <T> T evaluateExpressionGet(FacesContext facesContext, String s, Class<? extends T> aClass) throws ELException {
    + weaveDelegate();
    + //good place for a dynamic reloading check as well
    + T retVal = _delegate.evaluateExpressionGet(facesContext, s, aClass);
    + if (WeavingContext.isDynamic(retVal.getClass()))
    + retVal = (T) WeavingContext.getWeaver().reloadScriptingInstance(retVal, ScriptingConst.ARTIFACT_TYPE_MANAGEDBEAN);
    + return retVal;
    + }
    +
    + @Override
    + public Iterator<String> getBehaviorIds() {
    + weaveDelegate();
    + return _behaviors.keySet().iterator();
    + //return _delegate.getBehaviorIds();
    + }
    +
    + @Override
    + public Map<String, String> getDefaultValidatorInfo() {
    + weaveDelegate();
    + return _delegate.getDefaultValidatorInfo();
    + }
    +
    + @Override
    + public ProjectStage getProjectStage() {
    + weaveDelegate();
    + return _delegate.getProjectStage();
    + }
    +
    + @Override
    + public ResourceHandler getResourceHandler() {
    + weaveDelegate();
    + ResourceHandler retVal = _delegate.getResourceHandler();
    + ResourceHandler newHandler = (ResourceHandler) reloadInstance(retVal, ScriptingConst.ARTIFACT_TYPE_RESOURCEHANDLER);
    + if (newHandler != retVal) {
    + return _delegate.getResourceHandler();
    + }
    + return retVal;
    + }
    +
    + @Override
    + public void publishEvent(FacesContext facesContext, Class<? extends SystemEvent> eventClass, Class<?> sourceBaseTye, Object source) {
    + weaveDelegate();
    + _delegate.publishEvent(facesContext, eventClass, sourceBaseTye, source);
    + }
    +
    + @Override
    + public void publishEvent(FacesContext facesContext, Class<? extends SystemEvent> eventClass, Object source) {
    + weaveDelegate();
    + _delegate.publishEvent(facesContext, eventClass, source);
    + }
    +
    + @Override
    + public void setResourceHandler(ResourceHandler resourceHandler) {
    + weaveDelegate();
    + _delegate.setResourceHandler(resourceHandler);
    + ResourceHandler handler = _delegate.getResourceHandler();
    + if (handler instanceof PurgedResourceHandler) {
    + WeavingContext.getWeaver().fullClassScan();
    + }
    + }
    +
    + @Override
    + public void subscribeToEvent(Class<? extends SystemEvent> eventClass, Class<?> aClass, SystemEventListener systemEventListener) {
    + weaveDelegate();
    + systemEventListener = makeEventProxy(eventClass, systemEventListener);
    + _delegate.subscribeToEvent(eventClass, aClass, systemEventListener);
    + }
    +
    + private SystemEventListener makeEventProxy(Class<? extends SystemEvent> eventClass, SystemEventListener systemEventListener) {
    + if (WeavingContext.isDynamic(systemEventListener.getClass())) {
    + systemEventListener = new SystemEventListenerProxy(systemEventListener);
    + EventHandlerProxyEntry entry = new EventHandlerProxyEntry(eventClass, (Decorated) systemEventListener);
    + _eventHandlerIdx.put(entry, entry);
    + }
    + return systemEventListener;
    + }
    +
    + @Override
    + public void subscribeToEvent(Class<? extends SystemEvent> eventClass, SystemEventListener systemEventListener) {
    + weaveDelegate();
    + systemEventListener = makeEventProxy(eventClass, systemEventListener);
    + _delegate.subscribeToEvent(eventClass, systemEventListener);
    + }
    +
    + @Override
    + public void unsubscribeFromEvent(Class<? extends SystemEvent> eventClass, Class<?> aClass, SystemEventListener systemEventListener) {
    + weaveDelegate();
    + systemEventListener = resolveEventProxy(eventClass, systemEventListener);
    + _delegate.unsubscribeFromEvent(eventClass, aClass, systemEventListener);
    + }
    +
    + private SystemEventListener resolveEventProxy(Class<? extends SystemEvent> eventClass, SystemEventListener systemEventListener) {
    + if (WeavingContext.isDynamic(systemEventListener.getClass())) {
    + systemEventListener = new SystemEventListenerProxy(systemEventListener);
    + EventHandlerProxyEntry entry = new EventHandlerProxyEntry(eventClass, (Decorated) systemEventListener);
    + entry = _eventHandlerIdx.remove(entry);
    + if (entry != null) {
    + systemEventListener = (SystemEventListener) entry.getProxy().getDelegate();
    + }
    + }
    + return systemEventListener;
    + }
    +
    + @Override
    + public void unsubscribeFromEvent(Class<? extends SystemEvent> eventClass, SystemEventListener systemEventListener) {
    + weaveDelegate();
    + systemEventListener = resolveEventProxy(eventClass, systemEventListener);
    + _delegate.unsubscribeFromEvent(eventClass, systemEventListener);
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +
    + private Object reloadInstance(Object instance, int artifactType) {
    + if (instance == null) {
    + return null;
    + }
    + if (WeavingContext.isDynamic(instance.getClass()) && !alreadyWovenInRequest(instance.getClass().getName())) {
    + instance = WeavingContext.getWeaver().reloadScriptingInstance(instance, artifactType);
    + alreadyWovenInRequest(instance.getClass().getName());
    + }
    + return instance;
    + }
    +
    + private boolean alreadyWovenInRequest(String clazz) {
    + //portlets now can be enabled thanks to the jsf2 indirections regarding the external context
    + Map<String, Object> req = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
    + if (req.get(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz) == null) {
    + req.put(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz, "");
    + return false;
    + }
    + return true;
    + }
    +
    + private UIComponent handleAnnotationChange(UIComponent oldComponent, ValueExpression valueExpression, FacesContext facesContext, String componentType) {
    + UIComponent componentToChange = _delegate.createComponent(valueExpression, facesContext, componentType);
    + if (componentToChange instanceof PurgedComponent) {
    + WeavingContext.getWeaver().fullClassScan();
    + //via an additional create component we can check whether a purged component
    + //was registered after the reload because the annotation has been removed
    + componentToChange = _delegate.createComponent(valueExpression, facesContext, componentType);
    +
    + return componentToChange;
    + }
    + return oldComponent;
    + }
    +
    + private UIComponent handleAnnotationChange(UIComponent oldComponent, String componentType) {
    + UIComponent componentToChange = _delegate.createComponent(componentType);
    + if (componentToChange instanceof PurgedComponent) {
    + WeavingContext.getWeaver().fullClassScan();
    + //via an additional create component we can check whether a purged component
    + //was registered after the reload because the annotation has been removed
    + componentToChange = _delegate.createComponent(componentType);
    +
    + return componentToChange;
    + }
    + return oldComponent;
    + }
    +
    + @SuppressWarnings("deprecation")
    + private UIComponent handleAnnotationChange(UIComponent oldComponent, ValueBinding valueBinding, FacesContext context, String componentType) {
    + UIComponent componentToChange = _delegate.createComponent(valueBinding, context, componentType);
    + if (componentToChange instanceof PurgedComponent) {
    + WeavingContext.getWeaver().fullClassScan();
    + //via an additional create component we can check whether a purged component
    + //was registered after the reload because the annotation has been removed
    + componentToChange = _delegate.createComponent(valueBinding, context, componentType);
    +
    + return componentToChange;
    + }
    + return oldComponent;
    + }
    +
    + private UIComponent handleAnnotationChange(UIComponent oldComponent, FacesContext context, Resource resource) {
    + UIComponent componentToChange = _delegate.createComponent(context, resource);
    + if (componentToChange instanceof PurgedComponent) {
    + WeavingContext.getWeaver().fullClassScan();
    + //via an additional create component we can check whether a purged component
    + //was registered after the reload because the annotation has been removed
    + componentToChange = _delegate.createComponent(context, resource);
    +
    + return componentToChange;
    + }
    + return oldComponent;
    + }
    +
    + private UIComponent handleAnnotationChange(UIComponent oldComponent, FacesContext context, String componentType, String rendererType) {
    + UIComponent componentToChange = _delegate.createComponent(context, componentType, rendererType);
    + if (componentToChange instanceof PurgedComponent) {
    + WeavingContext.getWeaver().fullClassScan();
    + //via an additional create component we can check whether a purged component
    + //was registered after the reload because the annotation has been removed
    + componentToChange = _delegate.createComponent(context, componentType, rendererType);
    +
    + return componentToChange;
    + }
    + return oldComponent;
    + }
    +
    + private UIComponent handleAnnotationChange(UIComponent oldComponent, ValueExpression valueExpression, FacesContext facesContext, String s, String s1) {
    + UIComponent componentToChange = _delegate.createComponent(valueExpression, facesContext, s, s1);
    + if (componentToChange instanceof PurgedComponent) {
    + WeavingContext.getWeaver().fullClassScan();
    +
    + //via an additional create component we can check whether a purged component
    + //was registered after the reload because the annotation has been removed
    +
    + componentToChange = _delegate.createComponent(valueExpression, facesContext, s, s1);
    +
    + return componentToChange;
    + }
    + return oldComponent;
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,136 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.config.RuntimeConfig;
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.el.ELContext;
    +import javax.el.ELException;
    +import javax.el.ELResolver;
    +import javax.faces.context.FacesContext;
    +import java.util.Iterator;
    +import java.util.Map;
    +import java.util.logging.Level;
    +import java.util.logging.Logger;
    +
    +/**
    + * EL Resolver which is scripting enabled
    + *
    + * @author Werner Punz
    + */
    +public class ELResolverProxy extends ELResolver implements Decorated {
    +
    + Logger log = Logger.getLogger(ELResolverProxy.class.getName());
    + ELResolver _delegate = null;
    +
    + static ThreadLocal<Boolean> _getValue = new ThreadLocal<Boolean>();
    +
    + public Object getValue(ELContext elContext, final Object base, final Object property) throws NullPointerException, ELException {
    +
    + Object retVal = _delegate.getValue(elContext, base, property);
    +
    + Object newRetVal;
    +
    + if (retVal != null && WeavingContext.isDynamic(retVal.getClass())) {
    +
    + newRetVal = WeavingContext.getWeaver().reloadScriptingInstance(retVal, ScriptingConst.ARTIFACT_TYPE_MANAGEDBEAN);
    +
    + if (newRetVal != retVal) {
    + setValue(elContext, base, property, newRetVal);
    + }
    +
    + return newRetVal;
    +
    + } else if (retVal == null) {
    + retVal = reloadAnnotatedBean(elContext, base, property, null);
    + }
    +
    + return retVal;
    + }
    +
    + private Object reloadAnnotatedBean(ELContext elContext, Object base, Object property, Object newRetVal) {
    + //Avoid recursive calls into ourselfs here
    +
    + try {
    + if (_getValue.get() != null && _getValue.get().equals(Boolean.TRUE)) {
    + return newRetVal;
    + }
    + _getValue.set(Boolean.TRUE);
    + //base == null means bean el
    + if (base == null) {
    + final FacesContext facesContext = FacesContext.getCurrentInstance();
    + RuntimeConfig config = RuntimeConfig.getCurrentInstance(facesContext.getExternalContext());
    + Map<String, org.apache.myfaces.config.element.ManagedBean> mbeans = config.getManagedBeans();
    + if (!mbeans.containsKey(property.toString())) {
    + if (log.isLoggable(Level.FINE)) {
    + log.log(Level.FINE, "[EXT-SCRIPTING] ElResolverProxy.getValue old bean not existing we have to perform a full annotation scan");
    + }
    + setValue(elContext, base, property, null);
    +
    + //we only trigger this if the bean was deregistered, we now can reregister it again
    + WeavingContext.getWeaver().fullClassScan();
    + newRetVal = _delegate.getValue(elContext, base, property);
    + }
    + }
    + } finally {
    + _getValue.set(Boolean.FALSE);
    + }
    + return newRetVal;
    + }
    +
    + public Class<?> getType(ELContext elContext, Object o, Object o1) throws NullPointerException, ELException {
    + Class<?> retVal = _delegate.getType(elContext, o, o1);
    + if (retVal != null && WeavingContext.isDynamic(retVal)) {
    + return WeavingContext.getWeaver().reloadScriptingClass(retVal);
    + }
    + return retVal;
    + }
    +
    + public void setValue(ELContext elContext, Object base, Object property, Object value) throws NullPointerException, ELException {
    + //now to more complex relations...
    + if (base != null) {
    + WeavingContext.getRefreshContext().getDependencyRegistry().addDependency(ScriptingConst.ENGINE_TYPE_JSF_ALL, base.getClass().getName(), base.getClass().getName(), value.getClass().getName());
    + }
    + _delegate.setValue(elContext, base, property, value);
    + }
    +
    + public boolean isReadOnly(ELContext elContext, Object o, Object o1) throws NullPointerException, ELException {
    + return _delegate.isReadOnly(elContext, o, o1);
    + }
    +
    + public Iterator getFeatureDescriptors(ELContext elContext, Object o) {
    + return _delegate.getFeatureDescriptors(elContext, o);
    + }
    +
    + public Class<?> getCommonPropertyType(ELContext elContext, Object o) {
    + return _delegate.getCommonPropertyType(elContext, o);
    + }
    +
    + public ELResolverProxy(ELResolver delegate) {
    + _delegate = delegate;
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,216 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.context.*;
    +import javax.faces.application.Application;
    +import javax.faces.application.FacesMessage;
    +import javax.faces.application.ProjectStage;
    +import javax.faces.render.RenderKit;
    +import javax.faces.component.UIViewRoot;
    +import javax.faces.event.PhaseId;
    +import javax.el.ELContext;
    +import java.util.Iterator;
    +import java.util.Map;
    +import java.util.List;
    +
    +/**
    + * A reloading, weaving faces context
    + * this is needed because groovy fails on
    + * the introspection of the standard java myfaces
    + * faces context due to pending references
    + * of the _impl into the portlet context
    + * not sure if this works in portlets
    + * though
    + *
    + * @author Werner Punz
    + */
    +public class FacesContextProxy extends FacesContext implements Decorated {
    +
    + public FacesContext _delegate = null;
    +
    + private void weaveDelegate() {
    + if (_delegate != null)
    + _delegate = (FacesContext) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_FACESCONTEXT);
    + }
    +
    + public ELContext getELContext() {
    + return _delegate.getELContext();
    + }
    +
    + public Application getApplication() {
    + return _delegate.getApplication();
    + }
    +
    + public Iterator<String> getClientIdsWithMessages() {
    + return _delegate.getClientIdsWithMessages();
    + }
    +
    + public ExternalContext getExternalContext() {
    + return _delegate.getExternalContext();
    + }
    +
    + public FacesMessage.Severity getMaximumSeverity() {
    + return _delegate.getMaximumSeverity();
    + }
    +
    + public Iterator<FacesMessage> getMessages() {
    + return _delegate.getMessages();
    + }
    +
    + public Iterator<FacesMessage> getMessages(String s) {
    + return _delegate.getMessages(s);
    + }
    +
    + public RenderKit getRenderKit() {
    + return _delegate.getRenderKit();
    + }
    +
    + public boolean getRenderResponse() {
    + return _delegate.getRenderResponse();
    + }
    +
    + public boolean getResponseComplete() {
    + return _delegate.getResponseComplete();
    + }
    +
    + public ResponseStream getResponseStream() {
    + return _delegate.getResponseStream();
    + }
    +
    + public void setResponseStream(ResponseStream responseStream) {
    + _delegate.setResponseStream(responseStream);
    + }
    +
    + public ResponseWriter getResponseWriter() {
    + return _delegate.getResponseWriter();
    + }
    +
    + public void setResponseWriter(ResponseWriter responseWriter) {
    + _delegate.setResponseWriter(responseWriter);
    + }
    +
    + public UIViewRoot getViewRoot() {
    + return _delegate.getViewRoot();
    + }
    +
    + public void setViewRoot(UIViewRoot uiViewRoot) {
    + weaveDelegate();//perfect place no matter what the viewRoot is about once per request set
    + _delegate.setViewRoot(uiViewRoot);
    + }
    +
    + public void addMessage(String s, FacesMessage facesMessage) {
    + _delegate.addMessage(s, facesMessage);
    + }
    +
    + public void release() {
    + _delegate.release();
    + }
    +
    + public void renderResponse() {
    + _delegate.renderResponse();
    + }
    +
    + public void responseComplete() {
    + _delegate.responseComplete();
    + }
    +
    + public FacesContextProxy(FacesContext delegate) {
    + _delegate = delegate;
    + weaveDelegate();
    + }
    +
    + @Override
    + public Map<Object, Object> getAttributes() {
    + return _delegate.getAttributes();
    + }
    +
    + @Override
    + public PhaseId getCurrentPhaseId() {
    + return _delegate.getCurrentPhaseId();
    + }
    +
    + @Override
    + public ExceptionHandler getExceptionHandler() {
    + return _delegate.getExceptionHandler();
    + }
    +
    + @Override
    + public List<FacesMessage> getMessageList() {
    + return _delegate.getMessageList();
    + }
    +
    + @Override
    + public List<FacesMessage> getMessageList(String s) {
    + return _delegate.getMessageList(s);
    + }
    +
    + @Override
    + public PartialViewContext getPartialViewContext() {
    + return _delegate.getPartialViewContext();
    + }
    +
    + @Override
    + public boolean isValidationFailed() {
    + return _delegate.isValidationFailed();
    + }
    +
    + @Override
    + public boolean isPostback() {
    + return _delegate.isPostback();
    + }
    +
    + @Override
    + public boolean isProcessingEvents() {
    + return _delegate.isProcessingEvents();
    + }
    +
    + @Override
    + public void setCurrentPhaseId(PhaseId phaseId) {
    + _delegate.setCurrentPhaseId(phaseId);
    + }
    +
    + @Override
    + public void setExceptionHandler(ExceptionHandler exceptionHandler) {
    + _delegate.setExceptionHandler(exceptionHandler);
    + }
    +
    + @Override
    + public void setProcessingEvents(boolean b) {
    + _delegate.setProcessingEvents(b);
    + }
    +
    + @Override
    + public void validationFailed() {
    + _delegate.validationFailed();
    + }
    +
    + @Override
    + public boolean isProjectStage(ProjectStage projectStage) {
    + return _delegate.isProjectStage(projectStage);
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,80 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.lifecycle.Lifecycle;
    +import javax.faces.event.PhaseListener;
    +import javax.faces.context.FacesContext;
    +import javax.faces.FacesException;
    +
    +/**
    + * Scripting enabled lifecycle
    + *
    + * @author Werner Punz
    + */
    +public class LifefcycleProxy extends Lifecycle implements Decorated {
    +
    + Lifecycle _delegate = null;
    +
    + private void weaveDelegate() {
    + if (_delegate != null)
    + _delegate = (Lifecycle) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_LIFECYCLE);
    + }
    +
    + public LifefcycleProxy(Lifecycle delegate) {
    + _delegate = delegate;
    + }
    +
    + public void addPhaseListener(PhaseListener phaseListener) {
    + weaveDelegate();
    + /*we can put our object weaving code into the add here*/
    + if (WeavingContext.isDynamic(phaseListener.getClass()))
    + phaseListener = (PhaseListener) WeavingContext.createMethodReloadingProxyFromObject(phaseListener, PhaseListener.class, ScriptingConst.ARTIFACT_TYPE_PHASELISTENER);
    +
    + _delegate.addPhaseListener(phaseListener);
    + }
    +
    + public void execute(FacesContext facesContext) throws FacesException {
    + weaveDelegate();
    + _delegate.execute(facesContext);
    + }
    +
    + public PhaseListener[] getPhaseListeners() {
    + weaveDelegate();
    + return _delegate.getPhaseListeners();
    + }
    +
    + public void removePhaseListener(PhaseListener phaseListener) {
    + weaveDelegate();
    + _delegate.removePhaseListener(phaseListener);
    + }
    +
    + public void render(FacesContext facesContext) throws FacesException {
    + weaveDelegate();
    + _delegate.render(facesContext);
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/NavigationHandlerProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/NavigationHandlerProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/NavigationHandlerProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/NavigationHandlerProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,54 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.application.NavigationHandler;
    +import javax.faces.context.FacesContext;
    +
    +/**
    + * A reloading navigation handler
    + *
    + * @author Werner Punz
    + */
    +public class NavigationHandlerProxy extends NavigationHandler implements Decorated {
    +
    + NavigationHandler _delegate;
    +
    + private void weaveDelegate() {
    + _delegate = (NavigationHandler) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_NAVIGATIONHANDLER);
    + }
    +
    + public NavigationHandlerProxy(NavigationHandler delegate) {
    + super();
    + _delegate = delegate;
    + }
    +
    + public void handleNavigation(FacesContext facesContext, String s, String s1) {
    + weaveDelegate();
    + _delegate.handleNavigation(facesContext, s, s1);
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}
  • Werpu at Apr 12, 2010 at 7:44 pm
    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ValidatorImplementationListener.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ValidatorImplementationListener.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ValidatorImplementationListener.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ValidatorImplementationListener.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,157 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +import org.apache.myfaces.extensions.scripting.api.AnnotationScanListener;
    +import org.apache.myfaces.extensions.scripting.jsf2.annotation.purged.PurgedValidator;
    +
    +import javax.faces.validator.FacesValidator;
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class ValidatorImplementationListener extends MapEntityAnnotationScanner implements AnnotationScanListener {
    +
    + private static final String PAR_VALUE = "value";
    + private static final String PAR_DEFAULT = "isDefault";
    +
    + Map<AnnotationEntry, String> _inverseIndex = new HashMap<AnnotationEntry, String>();
    +
    + public ValidatorImplementationListener() {
    + /*supported annotation parameters rendererType and default*/
    + super(PAR_VALUE, PAR_DEFAULT);
    + }
    +
    + class AnnotationEntry {
    + String value;
    + Boolean theDefault;
    +
    + AnnotationEntry(String value, Boolean theDefault) {
    + this.value = value;
    + this.theDefault = theDefault;
    + }
    +
    + public boolean equals(Object incoming) {
    + if (!(incoming instanceof AnnotationEntry)) {
    + return false;
    + }
    + AnnotationEntry toCompare = (AnnotationEntry) incoming;
    +
    + if (incoming == null) {
    + return false;
    + }
    +
    + boolean firstEquals = compareValuePair(value, toCompare.getValue());
    + boolean secondEquals = compareValuePair(theDefault, toCompare.getTheDefault());
    +
    + return firstEquals && secondEquals;
    + }
    +
    + @Override
    + public int hashCode() {
    + String retVal = checkForNull(value) + "_" + checkForNull(theDefault);
    + return retVal.hashCode();
    + }
    +
    + private String checkForNull(String in) {
    + return (in == null) ? "" : in;
    + }
    +
    + private String checkForNull(Boolean in) {
    + return (in == null) ? "" : String.valueOf(in.booleanValue());
    + }
    +
    + protected boolean compareValuePair(Object val1, Object val2) {
    + boolean retVal = false;
    + if (val1 == null) {
    + if (val2 != null) retVal = false;
    + if (val2 == null) {
    + retVal = true;
    + }
    + } else {
    + retVal = val1.equals(val2);
    + }
    + return retVal;
    + }
    +
    + public String getValue() {
    + return value;
    + }
    +
    + public Boolean getTheDefault() {
    + return theDefault;
    + }
    + }
    +
    + public boolean supportsAnnotation(String annotation) {
    + return annotation.equals(FacesValidator.class.getName());
    + }
    +
    + public boolean supportsAnnotation(Class annotation) {
    + return annotation.equals(FacesValidator.class);
    + }
    +
    +
    + @Override
    + protected void addEntity(Class clazz, Map<String, Object> params) {
    + String value = (String) params.get(PAR_VALUE);
    + Boolean theDefault = (Boolean) params.get(PAR_DEFAULT);
    +
    + AnnotationEntry entry = new AnnotationEntry(value, theDefault);
    + _alreadyRegistered.put(clazz.getName(), entry);
    + _inverseIndex.put(entry, clazz.getName());
    +
    + getApplication().addValidator(entry.getValue(), clazz.getName());
    + }
    +
    + @Override
    + protected boolean hasToReregister(Map params, Class clazz) {
    + String value = (String) params.get(PAR_VALUE);
    + Boolean theDefault = (Boolean) params.get(PAR_DEFAULT);
    +
    + AnnotationEntry entry = new AnnotationEntry(value, theDefault);
    +
    + AnnotationEntry alreadyRegistered = (AnnotationEntry) _alreadyRegistered.get(clazz.getName());
    + if (alreadyRegistered == null) {
    + return true;
    + }
    +
    + return alreadyRegistered.equals(entry);
    + }
    +
    + @Override
    + public void purge(String className) {
    + super.purge(className);
    + AnnotationEntry entry = (AnnotationEntry) _alreadyRegistered.get(className);
    + if (entry == null) {
    + return;
    + }
    +
    + String oldValidator = _inverseIndex.get(entry);
    + if (oldValidator.equals(className)) {
    + _alreadyRegistered.remove(className);
    + getApplication().addValidator(entry.getValue(), PurgedValidator.class.getName());
    + _inverseIndex.put(entry, PurgedValidator.class.getName());
    + }
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedBehavior.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedBehavior.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedBehavior.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedBehavior.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,33 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation.purged;
    +
    +import javax.faces.component.behavior.Behavior;
    +import javax.faces.event.BehaviorEvent;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class PurgedBehavior implements Behavior {
    + public void broadcast(BehaviorEvent event) {
    + throw new RuntimeException("Behavior does not exist");
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedClientBehaviorRenderer.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedClientBehaviorRenderer.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedClientBehaviorRenderer.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedClientBehaviorRenderer.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,30 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation.purged;
    +
    +import javax.faces.render.ClientBehaviorRenderer;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class PurgedClientBehaviorRenderer extends ClientBehaviorRenderer {
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedComponent.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedComponent.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedComponent.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedComponent.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,37 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation.purged;
    +
    +import javax.faces.component.UIOutput;
    +
    +/**
    + * We override the component from a real family so that
    + * so that myfaces can handle it in a decent way
    + * directly from UIComponent it would fail
    + * unless we implement everything family etc... all by our own
    + *
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class PurgedComponent extends UIOutput {
    + public PurgedComponent() {
    + super();
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedConverter.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedConverter.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedConverter.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedConverter.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,41 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation.purged;
    +
    +import javax.faces.convert.Converter;
    +import javax.faces.convert.ConverterException;
    +import javax.faces.context.FacesContext;
    +import javax.faces.component.UIComponent;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class PurgedConverter implements Converter {
    + private static final String DOES_NOT_EXIST = "Converter does not exist";
    +
    + public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + public String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedELResolver.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedELResolver.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedELResolver.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedELResolver.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,75 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation.purged;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +
    +import javax.el.ELResolver;
    +import javax.el.ELContext;
    +import java.util.Iterator;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class PurgedELResolver extends ELResolver implements Decorated {
    +
    + private final String DOES_NOT_EXIST = "EL Resolver does not exist";
    +
    + ELResolver _delegate;
    +
    + public PurgedELResolver(ELResolver delegate) {
    + _delegate = delegate;
    + }
    +
    + @Override
    + public Object getValue(ELContext elContext, Object o, Object o1) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public Class getType(ELContext elContext, Object o, Object o1) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public void setValue(ELContext elContext, Object o, Object o1, Object o2) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public boolean isReadOnly(ELContext elContext, Object o, Object o1) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public Iterator getFeatureDescriptors(ELContext elContext, Object o) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public Class getCommonPropertyType(ELContext elContext, Object o) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + public ELResolver getDelegate() {
    + return _delegate;
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedLifecycle.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedLifecycle.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedLifecycle.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedLifecycle.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,71 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation.purged;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +
    +import javax.faces.lifecycle.Lifecycle;
    +import javax.faces.event.PhaseListener;
    +import javax.faces.context.FacesContext;
    +import javax.faces.FacesException;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class PurgedLifecycle extends Lifecycle implements Decorated {
    +
    + private static final String DOES_NOT_EXIST = "Lifecycle does not exist";
    +
    + Lifecycle _delegate;
    +
    + public PurgedLifecycle(Lifecycle delegate) {
    + _delegate = delegate;
    + }
    +
    + @Override
    + public void addPhaseListener(PhaseListener listener) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public void execute(FacesContext context) throws FacesException {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public PhaseListener[] getPhaseListeners() {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public void removePhaseListener(PhaseListener listener) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public void render(FacesContext context) throws FacesException {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + public Object getDelegate() {
    + return _delegate;
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedNavigationHandler.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedNavigationHandler.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedNavigationHandler.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedNavigationHandler.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,51 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation.purged;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +
    +import javax.faces.application.NavigationHandler;
    +import javax.faces.context.FacesContext;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class PurgedNavigationHandler extends NavigationHandler implements Decorated {
    +
    + NavigationHandler _delegate;
    +
    + public PurgedNavigationHandler(NavigationHandler delegate) {
    + _delegate = delegate;
    + }
    +
    + @Override
    + public void handleNavigation(FacesContext context, String fromAction, String outcome) {
    + throw new RuntimeException("Navigation handler does not exist");
    + }
    +
    + public NavigationHandler getDelegate() {
    + return _delegate;
    + }
    +
    + public void setDelegate(NavigationHandler delegate) {
    + _delegate = delegate;
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedRenderer.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedRenderer.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedRenderer.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedRenderer.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,73 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation.purged;
    +
    +import javax.faces.render.Renderer;
    +import javax.faces.context.FacesContext;
    +import javax.faces.component.UIComponent;
    +import javax.faces.convert.ConverterException;
    +import java.io.IOException;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class PurgedRenderer extends Renderer {
    + private static final String DOES_NOT_EXIST = "Renderer does not exist";
    +
    + public PurgedRenderer() {
    + super();
    + }
    +
    + @Override
    + public void decode(FacesContext context, UIComponent component) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public String convertClientId(FacesContext context, String clientId) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public boolean getRendersChildren() {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedRenderkit.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedRenderkit.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedRenderkit.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedRenderkit.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,78 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation.purged;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +
    +import javax.faces.render.RenderKit;
    +import javax.faces.render.Renderer;
    +import javax.faces.render.ResponseStateManager;
    +import javax.faces.context.ResponseStream;
    +import javax.faces.context.ResponseWriter;
    +import java.io.OutputStream;
    +import java.io.Writer;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class PurgedRenderkit extends RenderKit implements Decorated {
    +
    + private static final String DOES_NOT_EXIST = "Renderkit does not exist";
    +
    + RenderKit _delegate;
    +
    + public PurgedRenderkit(RenderKit delegate) {
    + _delegate = delegate;
    + }
    +
    + @Override
    + public void addRenderer(String family, String rendererType, Renderer renderer) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public ResponseStream createResponseStream(OutputStream out) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public ResponseWriter createResponseWriter(Writer writer, String contentTypeList, String characterEncoding) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public Renderer getRenderer(String family, String rendererType) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public ResponseStateManager getResponseStateManager() {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + public RenderKit getDelegate() {
    + return _delegate;
    + }
    +
    + public void setDelegate(RenderKit delegate) {
    + _delegate = delegate;
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedResourceHandler.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedResourceHandler.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedResourceHandler.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedResourceHandler.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,84 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation.purged;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +
    +import javax.faces.application.ResourceHandler;
    +import javax.faces.application.Resource;
    +import javax.faces.context.FacesContext;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class PurgedResourceHandler extends ResourceHandler implements Decorated {
    +
    + private static final String DOES_NOT_EXIST = "Resource Handler does not exist";
    +
    + ResourceHandler _delegate;
    +
    + public PurgedResourceHandler(ResourceHandler delegate) {
    + _delegate = delegate;
    + }
    +
    + @Override
    + public Resource createResource(String resourceName) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public Resource createResource(String resourceName, String libraryName) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public Resource createResource(String resourceName, String libraryName, String contentType) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public String getRendererTypeForResourceName(String resourceName) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public void handleResourceRequest(FacesContext context) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public boolean isResourceRequest(FacesContext context) {
    + throw new RuntimeException(DOES_NOT_EXIST);
    + }
    +
    + @Override
    + public boolean libraryExists(String libraryName) {
    + return false; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +
    + public ResourceHandler getDelegate() {
    + return _delegate;
    + }
    +
    + public void setDelegate(ResourceHandler delegate) {
    + _delegate = delegate;
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedValidator.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedValidator.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedValidator.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/purged/PurgedValidator.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,41 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation.purged;
    +
    +import javax.faces.component.UIComponent;
    +import javax.faces.context.FacesContext;
    +import javax.faces.validator.Validator;
    +import javax.faces.validator.ValidatorException;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + * <p/>
    + * Purged validator class to enable validator
    + * purging despite the fact
    + * that the original code does not allow it
    + */
    +
    +public class PurgedValidator implements Validator {
    +
    + public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
    + throw new RuntimeException("Validator does not exist");
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/resources/SourceResourceHandler.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/resources/SourceResourceHandler.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/resources/SourceResourceHandler.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/resources/SourceResourceHandler.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,211 @@
    +/*
    + * 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.extensions.scripting.jsf2.resources;
    +
    +import org.apache.myfaces.application.ResourceHandlerImpl;
    +import org.apache.myfaces.application.ResourceHandlerSupport;
    +import org.apache.myfaces.resource.ResourceLoader;
    +import org.apache.myfaces.resource.ResourceMeta;
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +
    +import javax.faces.application.Resource;
    +import javax.faces.application.ResourceHandler;
    +import javax.faces.context.FacesContext;
    +import java.io.IOException;
    +import java.net.URL;
    +
    +/**
    + * A simple delegating resource handler
    + * which is supposed to pick up resources from a
    + * given location if the Weaving configuration
    + * has the parameter present
    + */
    +public class SourceResourceHandler extends ResourceHandlerImpl implements Decorated {
    +
    + ResourceHandler _delegate = null;
    + ResourceHandlerSupport _sourceHandlerSupport = null;
    +
    + public SourceResourceHandler(ResourceHandler delegate) {
    + _delegate = delegate;
    + }
    +
    + public Resource createResource(String resourceName) {
    + Resource retVal = super.createResource(resourceName);
    + if (retVal != null)
    + return retVal;
    +
    + return _delegate.createResource(resourceName);
    + }
    +
    + public Resource createResource(String resourceName, String libraryName) {
    + Resource retVal = super.createResource(resourceName, libraryName);
    + if (retVal != null)
    + return retVal;
    +
    + return _delegate.createResource(resourceName, libraryName);
    + }
    +
    + public Resource createResource(String resourceName, String libraryName, String contentType) {
    + Resource retVal = super.createResource(resourceName, libraryName, contentType);
    +
    + if (retVal != null)
    + return retVal;
    +
    + return _delegate.createResource(resourceName, libraryName, contentType);
    + }
    +
    + public String getRendererTypeForResourceName(String resourceName) {
    +
    + String retVal = super.getRendererTypeForResourceName(resourceName);
    + if (retVal != null)
    + return retVal;
    +
    + return _delegate.getRendererTypeForResourceName(resourceName);
    + }
    +
    + public void handleResourceRequest(FacesContext context) throws IOException {
    + super.handleResourceRequest(context);
    + }
    +
    + public boolean isResourceRequest(FacesContext context) {
    + return _delegate.isResourceRequest(context);
    + }
    +
    + public boolean libraryExists(String libraryName) {
    + return _delegate.libraryExists(libraryName);
    + }
    +
    + public ResourceHandler getDelegate() {
    + return _delegate;
    + }
    +
    + @Override
    + /**
    + * central override of this class it provides a new handler
    + * support class which allows source pickups after the
    + * JSF2 specified restful algorithms
    + *
    + * @return A support instance which allows also source pickups from resources additionally to the
    + * default deployment and jar pickups
    + */
    + protected ResourceHandlerSupport getResourceHandlerSupport() {
    + if (_sourceHandlerSupport == null) {
    + _sourceHandlerSupport = new SourceResourceHandlerSupport();
    + }
    + return _sourceHandlerSupport;
    + }
    +
    + protected ResourceMeta deriveResourceMeta(ResourceLoader resourceLoader,
    + String resourceName, String libraryName) {
    + String localePrefix = getLocalePrefixForLocateResource();
    + String resourceVersion = null;
    + String libraryVersion = null;
    + ResourceMeta resourceId = null;
    +
    + //1. Try to locate resource in a localized path
    + if (localePrefix != null) {
    + if (null != libraryName) {
    + String pathToLib = localePrefix + '/' + libraryName;
    + libraryVersion = resourceLoader.getLibraryVersion(pathToLib);
    +
    + if (null != libraryVersion) {
    + String pathToResource = localePrefix + '/'
    + + libraryName + '/' + libraryVersion + '/'
    + + resourceName;
    + resourceVersion = resourceLoader
    + .getResourceVersion(pathToResource);
    + } else {
    + String pathToResource = localePrefix + '/'
    + + libraryName + '/' + resourceName;
    + resourceVersion = resourceLoader
    + .getResourceVersion(pathToResource);
    + }
    +
    + if (!(resourceVersion != null && ResourceLoader.VERSION_INVALID.equals(resourceVersion))) {
    + resourceId = resourceLoader.createResourceMeta(localePrefix, libraryName,
    + libraryVersion, resourceName, resourceVersion);
    + }
    + } else {
    + resourceVersion = resourceLoader
    + .getResourceVersion(localePrefix + '/' + resourceName);
    + if (!(resourceVersion != null && ResourceLoader.VERSION_INVALID.equals(resourceVersion))) {
    + resourceId = resourceLoader.createResourceMeta(localePrefix, null, null,
    + resourceName, resourceVersion);
    + } else if (resourceVersion == ResourceLoader.VERSION_INVALID) {
    + resourceId = resourceLoader.createResourceMeta(null, libraryName,
    + null, resourceName, null);
    + }
    + }
    +
    + if (resourceId != null) {
    + URL url = resourceLoader.getResourceURL(resourceId);
    + if (url == null) {
    + resourceId = null;
    + }
    + }
    + }
    +
    + //2. Try to localize resource in a non localized path
    + if (resourceId == null) {
    + if (null != libraryName) {
    + libraryVersion = resourceLoader.getLibraryVersion(libraryName);
    +
    + if (null != libraryVersion) {
    + String pathToResource = (libraryName + '/' + libraryVersion
    + + '/' + resourceName);
    + resourceVersion = resourceLoader
    + .getResourceVersion(pathToResource);
    + } else {
    + String pathToResource = (libraryName + '/'
    + + resourceName);
    + resourceVersion = resourceLoader
    + .getResourceVersion(pathToResource);
    + }
    +
    + if (!(resourceVersion != null && ResourceLoader.VERSION_INVALID.equals(resourceVersion))) {
    + resourceId = resourceLoader.createResourceMeta(null, libraryName,
    + libraryVersion, resourceName, resourceVersion);
    + } else if (resourceVersion == ResourceLoader.VERSION_INVALID) {
    + resourceId = resourceLoader.createResourceMeta(null, libraryName,
    + libraryVersion, resourceName, null);
    + }
    + } else {
    + resourceVersion = resourceLoader
    + .getResourceVersion(resourceName);
    +
    + if (!(resourceVersion != null && ResourceLoader.VERSION_INVALID.equals(resourceVersion))) {
    + resourceId = resourceLoader.createResourceMeta(null, null, null,
    + resourceName, resourceVersion);
    + } else if (resourceVersion == ResourceLoader.VERSION_INVALID) {
    + resourceId = resourceLoader.createResourceMeta(null, null,
    + null, resourceName, null);
    + }
    + }
    +
    + if (resourceId != null) {
    + URL url = resourceLoader.getResourceURL(resourceId);
    + if (url == null) {
    + resourceId = null;
    + }
    + }
    + }
    +
    + return resourceId;
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/resources/SourceResourceHandlerSupport.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/resources/SourceResourceHandlerSupport.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/resources/SourceResourceHandlerSupport.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/resources/SourceResourceHandlerSupport.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,88 @@
    +/*
    + * 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.extensions.scripting.jsf2.resources;
    +
    +import org.apache.myfaces.application.DefaultResourceHandlerSupport;
    +import org.apache.myfaces.application.ResourceHandlerSupport;
    +import org.apache.myfaces.resource.ClassLoaderResourceLoader;
    +import org.apache.myfaces.resource.ExternalContextResourceLoader;
    +import org.apache.myfaces.resource.ResourceLoader;
    +
    +import javax.faces.context.FacesContext;
    +
    +/**
    + * impl specific handler support which attaches
    + * the source resource loader upfront before
    + * checking the other ones
    + * <p/>
    + * a delegate is used to limit the binding between
    + * the "parent" class and the child class
    + * in this case it simply makes sense to avoid any internal sideeffects
    + * between getResourceLoaders and the other methods
    + */
    +public class SourceResourceHandlerSupport implements ResourceHandlerSupport {
    +
    + private ResourceLoader[] _supportResourceLoaders;
    + private ResourceHandlerSupport _defaultSupport = new DefaultResourceHandlerSupport();
    +
    + @Override
    + /**
    + * Delivers a list of resource loaders in a binding order
    + * of the resource lookup algorithms
    + *
    + * @return a list of resource loaders with following order,
    + * <ul>
    + * <li>source lookup paths if present</li>
    + * <li>/resources directory</li>
    + * <li>META-INF/resources directory</li>
    + * </ul>
    + */
    + public ResourceLoader[] getResourceLoaders() {
    + if (_supportResourceLoaders == null) {
    + //The ExternalContextResourceLoader has precedence over
    + //ClassLoaderResourceLoader, so it goes first.
    + _supportResourceLoaders = new ResourceLoader[]{
    + new SourceResourceLoader("/resources"),
    + new ExternalContextResourceLoader("/resources"),
    + new ClassLoaderResourceLoader("META-INF/resources")
    + };
    + }
    + return _supportResourceLoaders;
    + }
    +
    + public String calculateResourceBasePath(FacesContext facesContext) {
    + return _defaultSupport.calculateResourceBasePath(facesContext);
    + }
    +
    + public boolean isExtensionMapping() {
    + return _defaultSupport.isExtensionMapping();
    + }
    +
    + public String getMapping() {
    + return _defaultSupport.getMapping();
    + }
    +
    + public long getStartupTime() {
    + return _defaultSupport.getStartupTime();
    + }
    +
    + public long getMaxTimeExpires() {
    + return _defaultSupport.getMaxTimeExpires();
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/resources/SourceResourceLoader.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/resources/SourceResourceLoader.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/resources/SourceResourceLoader.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/resources/SourceResourceLoader.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,107 @@
    +/*
    + * 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.extensions.scripting.jsf2.resources;
    +
    +import org.apache.myfaces.resource.ExternalContextResourceLoader;
    +import org.apache.myfaces.resource.ResourceLoader;
    +import org.apache.myfaces.resource.ResourceMeta;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.context.FacesContext;
    +import java.io.File;
    +import java.io.FileInputStream;
    +import java.io.IOException;
    +import java.io.InputStream;
    +import java.net.MalformedURLException;
    +import java.net.URL;
    +import java.util.Collections;
    +import java.util.HashSet;
    +import java.util.List;
    +import java.util.Set;
    +
    +/**
    + * internal resource loader to be used with our custom resource handler
    + * the resource loader is added to the list of available loaders
    + * so that the resource gets loaded properly from our source path
    + * instead of the web context if present, the source paths as usual
    + * are picked up by our context params.
    + */
    +public class SourceResourceLoader extends ExternalContextResourceLoader {
    +
    + public SourceResourceLoader(String prefix) {
    + super(prefix);
    + }
    +
    + @Override
    + protected Set<String> getResourcePaths(String path) {
    + List<String> resourceRoots = WeavingContext.getConfiguration().getResourceDirs();
    + if (resourceRoots == null || resourceRoots.isEmpty()) {
    + return Collections.EMPTY_SET;
    + }
    + Set<String> retVals = new HashSet<String>(resourceRoots.size());
    + //for (String resourceRoot : resourceRoots) {
    + retVals.add(getPrefix() + "/" + path);
    + //}
    + return retVals;
    + }
    +
    + @Override
    + public URL getResourceURL(ResourceMeta resourceMeta) {
    + try {
    + List<String> resourceRoots = WeavingContext.getConfiguration().getResourceDirs();
    + if (resourceRoots == null || resourceRoots.isEmpty()) {
    + return super.getResourceURL(resourceMeta);
    + }
    +
    + for (String resourceRoot : resourceRoots) {
    + File resourceFile = new File(resourceRoot + getPrefix() + "/" + resourceMeta.toString());
    + if (resourceFile.exists()) {
    + return resourceFile.toURI().toURL();
    + }
    + }
    +
    + return super.getResourceURL(resourceMeta);
    + }
    + catch (MalformedURLException e) {
    + return null;
    + }
    + }
    +
    + @Override
    + public InputStream getResourceInputStream(ResourceMeta resourceMeta) {
    + try {
    + List<String> resourceRoots = WeavingContext.getConfiguration().getResourceDirs();
    + if (resourceRoots == null || resourceRoots.isEmpty()) {
    + return super.getResourceInputStream(resourceMeta);
    + }
    +
    + for (String resourceRoot : resourceRoots) {
    + File resourceFile = new File(resourceRoot + getPrefix() + "/" + resourceMeta.toString());
    + if (resourceFile.exists()) {
    + return new FileInputStream(resourceFile);
    + }
    + }
    +
    + return super.getResourceInputStream(resourceMeta);
    + }
    + catch (IOException e) {
    + return null;
    + }
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/startup/IntialScanAnnotationListener.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/startup/IntialScanAnnotationListener.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/startup/IntialScanAnnotationListener.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/startup/IntialScanAnnotationListener.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,59 @@
    +/*
    + * 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.extensions.scripting.startup;
    +
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingWeaver;
    +
    +import javax.faces.event.SystemEventListener;
    +import javax.faces.event.SystemEvent;
    +import javax.faces.event.PostConstructApplicationEvent;
    +import javax.faces.application.Application;
    +import javax.servlet.ServletContext;
    +import java.util.concurrent.atomic.AtomicBoolean;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + * <p/>
    + * we do the initial source scan after the entire application has started up
    + * we now can reuse our jsf2 system event faclities by placing
    + * a listener to the application startup
    + */
    +
    +public class IntialScanAnnotationListener implements SystemEventListener {
    + public boolean isListenerForSource(Object source) {
    + return source instanceof Application; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +
    + public void processEvent(SystemEvent event) {
    + if (!event.getClass().equals(PostConstructApplicationEvent.class)) {
    + return;
    + }
    + //we can rely on being in the same thread as the original
    + //startup context listener, so the initial weaver still is activated
    + ScriptingWeaver weaver = WeavingContext.getWeaver();
    +
    + weaver.fullRecompile();
    + //we now do a full source or precompiled annotation scan
    + //the entire scripting subsystem should be initialized by now
    + weaver.fullClassScan();
    + }
    +}

    Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/resources/META-INF/faces-config.xml
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/resources/META-INF/faces-config.xml?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/resources/META-INF/faces-config.xml (original)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/resources/META-INF/faces-config.xml Mon Apr 12 19:43:30 2010
    @@ -24,30 +24,30 @@
    -->

    <lifecycle>
    - <phase-listener>org.apache.myfaces.scripting.jsf.RefreshPhaseListener</phase-listener>
    + <phase-listener>org.apache.myfaces.extensions.scripting.jsf.RefreshPhaseListener</phase-listener>
    </lifecycle>

    <component>
    - <component-type>org.apache.myfaces.scripting.components.CompilerComponent</component-type>
    - <component-class>org.apache.myfaces.scripting.components.CompilerComponent</component-class>
    + <component-type>org.apache.myfaces.extensions.scripting.components.CompilerComponent</component-type>
    + <component-class>org.apache.myfaces.extensions.scripting.components.CompilerComponent</component-class>
    </component>

    <component>
    - <component-type>org.apache.myfaces.scripting.components.TaintHistory</component-type>
    - <component-class>org.apache.myfaces.scripting.components.TaintHistory</component-class>
    + <component-type>org.apache.myfaces.extensions.scripting.components.TaintHistory</component-type>
    + <component-class>org.apache.myfaces.extensions.scripting.components.TaintHistory</component-class>
    </component>


    <render-kit>
    <renderer>
    <component-family>javax.faces.Output</component-family>
    - <renderer-type>org.apache.myfaces.scripting.components.CompilerComponentRenderer</renderer-type>
    - <renderer-class>org.apache.myfaces.scripting.components.CompilerComponentRenderer</renderer-class>
    + <renderer-type>org.apache.myfaces.extensions.scripting.components.CompilerComponentRenderer</renderer-type>
    + <renderer-class>org.apache.myfaces.extensions.scripting.components.CompilerComponentRenderer</renderer-class>
    </renderer>
    <renderer>
    <component-family>javax.faces.Output</component-family>
    - <renderer-type>org.apache.myfaces.scripting.components.TaintHistoryRenderer</renderer-type>
    - <renderer-class>org.apache.myfaces.scripting.components.TaintHistoryRenderer</renderer-class>
    + <renderer-type>org.apache.myfaces.extensions.scripting.components.TaintHistoryRenderer</renderer-type>
    + <renderer-class>org.apache.myfaces.extensions.scripting.components.TaintHistoryRenderer</renderer-class>
    </renderer>

    </render-kit>
    @@ -59,19 +59,19 @@
    issue is we have to make a codeweaving for every bean created
    -->
    <application-factory>
    - org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingApplicationFactory
    + org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.factories.ScriptingApplicationFactory
    </application-factory>
    <faces-context-factory>
    - org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingFacesContextFactory
    + org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.factories.ScriptingFacesContextFactory
    </faces-context-factory>
    <lifecycle-factory>
    - org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingLifecycleFactory
    + org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.factories.ScriptingLifecycleFactory
    </lifecycle-factory>
    <render-kit-factory>
    - org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingRenderkitFactory
    + org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.factories.ScriptingRenderkitFactory
    </render-kit-factory>
    <tag-handler-delegate-factory>
    - org.apache.myfaces.scripting.facelet.TagHandlerDelegateFactoryImpl
    + org.apache.myfaces.extensions.scripting.facelet.TagHandlerDelegateFactoryImpl
    </tag-handler-delegate-factory>


    @@ -79,7 +79,7 @@

    <application>
    <system-event-listener>
    - <system-event-listener-class>org.apache.myfaces.scripting.startup.IntialScanAnnotationListener
    + <system-event-listener-class>org.apache.myfaces.extensions.scripting.startup.IntialScanAnnotationListener
    </system-event-listener-class>
    <system-event-class>javax.faces.event.PostConstructApplicationEvent</system-event-class>
    </system-event-listener>

    Modified: myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/conf/dev/web.xml
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/conf/dev/web.xml?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/conf/dev/web.xml (original)
    +++ myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/conf/dev/web.xml Mon Apr 12 19:43:30 2010
    @@ -49,14 +49,14 @@ of a development profile being set!
    Initializes the plugins for our groovy handlers
    </description>
    <param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
    - <param-value>org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
    + <param-value>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
    </context-param>

    <context-param>
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
    <param-value>
    /Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/groovy
    </param-value>
    @@ -66,7 +66,7 @@ of a development profile being set!
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
    <param-value>
    /Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/java
    </param-value>
    @@ -75,7 +75,7 @@ of a development profile being set!

    <context-param>
    <description>resource paths for our custom JSF2 resource resolver</description>
    - <param-name>org.apache.myfaces.scripting.resources.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.resources.LOADER_PATHS</param-name>
    <param-value>
    /Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces12-example/src/main/webapp
    </param-value>
    @@ -86,7 +86,7 @@ of a development profile being set!
    source dir
    </description>
    <param-name>facelets.RESOURCE_RESOLVER</param-name>
    - <param-value>org.apache.myfaces.scripting.facelet.ReroutingResourceResolver</param-value>
    + <param-value>org.apache.myfaces.extensions.scripting.facelet.ReroutingResourceResolver</param-value>
    </context-param>


    @@ -268,7 +268,7 @@ of a development profile being set!

    <filter>
    <filter-name>scriptingFilter</filter-name>
    - <filter-class>org.apache.myfaces.scripting.servlet.ScriptingServletFilter</filter-class>
    + <filter-class>org.apache.myfaces.extensions.scripting.servlet.ScriptingServletFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>scriptingFilter</filter-name>

    Modified: myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/blog/Blog.groovy
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/blog/Blog.groovy?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/blog/Blog.groovy (original)
    +++ myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/blog/Blog.groovy Mon Apr 12 19:43:30 2010
    @@ -27,7 +27,7 @@ import java.util.logging.Logger;
    public class Blog {
    //bug application and session scoped beans are not refreshed structurally yet

    - Logger log = Logger.getLogger(Blog.class.getName())
    + Logger log = Logger.getLogger("Blog")

    String title = "Hello to the myfaces dynamic blogging Groovy JSF 1.2 Blog "
    String title1 = """\
    @@ -67,7 +67,7 @@ public class Blog {
    service.addEntry2(entry)

    //we stay on the same page
    - return null;
    + return "blog";
    }

    }
    \ No newline at end of file

    Modified: myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/blog/BlogService.groovy
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/blog/BlogService.groovy?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/blog/BlogService.groovy (original)
    +++ myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/blog/BlogService.groovy Mon Apr 12 19:43:30 2010
    @@ -28,9 +28,14 @@ public class BlogService {
    List blogEntries = new ArrayList()

    public void addEntry2(BlogEntry entry) {
    - Logger log = Logger.getLogger(BlogService.class)
    - log.info("(BlogService.addEntry2): Adding entry")
    + Logger log = Logger.getLogger(BlogService.class.getName())
    + log.info("(BlogService.addEntry2) from groovy blogservice: Adding entry")
    blogEntries << entry
    + log.info("(BlogService.addEntry2) from groovy blogservice: Adding entry"+blogEntries.size())
    +
    }

    + public List getBlogEntries() {
    + return blogEntries
    + }
    }
    \ No newline at end of file

    Modified: myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/JSFUtil.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/JSFUtil.java?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/JSFUtil.java (original)
    +++ myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/JSFUtil.java Mon Apr 12 19:43:30 2010
    @@ -21,7 +21,7 @@ package org.apache.myfaces.javaloader.bl
    import javax.faces.context.FacesContext;
    import java.util.logging.Logger;

    -import static org.apache.myfaces.scripting.core.util.ReflectUtil.executeMethod;
    +import static org.apache.myfaces.extensions.scripting.core.util.ReflectUtil.executeMethod;

    /**
    * @author werpu2
    @@ -49,7 +49,7 @@ public class JSFUtil {

    /*
    if you want to enable this then use
    - org.apache.myfaces.scripting.java.JAR_PATHS
    + org.apache.myfaces.extensions.scripting.java.JAR_PATHS
    pointing towards the lingering jars
    The compiler cannot pick up the implicit containers classpaths
    */

    Modified: myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/web.xml
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/web.xml?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/web.xml (original)
    +++ myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/web.xml Mon Apr 12 19:43:30 2010
    @@ -42,7 +42,7 @@
    Initializes the plugins for our groovy handlers
    </description>
    <param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
    - <param-value>org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
    + <param-value>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
    </context-param>

    <!--
    @@ -50,7 +50,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
    <param-value>
    /Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/groovy
    </param-value>
    @@ -60,7 +60,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
    <param-value>
    /Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces12-example/src/main/webapp/WEB-INF/java
    </param-value>
    @@ -69,7 +69,7 @@

    <context-param>
    <description>resource paths for our custom JSF2 resource resolver</description>
    - <param-name>org.apache.myfaces.scripting.resources.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.resources.LOADER_PATHS</param-name>
    <param-value>
    /Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces12-example/src/main/webapp
    </param-value>
    @@ -80,7 +80,7 @@
    source dir
    </description>
    <param-name>facelets.RESOURCE_RESOLVER</param-name>
    - <param-value>org.apache.myfaces.scripting.facelet.ReroutingResourceResolver</param-value>
    + <param-value>org.apache.myfaces.extensions.scripting.facelet.ReroutingResourceResolver</param-value>
    </context-param>
    -->
    <!--
    @@ -88,7 +88,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
    <param-value>D:/dev/work/ideaprojects/threads/extscript/examples/myfaces12-example/src/main/webapp/WEB-INF/groovy</param-value>
    </context-param>

    @@ -97,7 +97,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
    <param-value>D:/dev/work/ideaprojects/threads/extscript/examples/myfaces12-example/src/main/webapp/WEB-INF/java</param-value>
    </context-param>
    -->
    @@ -279,7 +279,7 @@

    <filter>
    <filter-name>scriptingFilter</filter-name>
    - <filter-class>org.apache.myfaces.scripting.servlet.ScriptingServletFilter</filter-class>
    + <filter-class>org.apache.myfaces.extensions.scripting.servlet.ScriptingServletFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>scriptingFilter</filter-name>

    Modified: myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/blog.xhtml
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/blog.xhtml?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/blog.xhtml (original)
    +++ myfaces/extensions/scripting/trunk/extscript-examples/myfaces12-example/src/main/webapp/blog.xhtml Mon Apr 12 19:43:30 2010
    @@ -10,6 +10,7 @@
    <ui:composition template="/template.xhtml">

    <ui:define name="body">
    + <h:messages />
    <h:form id="form">
    <h:panelGrid id="grid" columns="1">
    <h:outputText id="title1" styleClass="title" value="#{blogView.title}"/>

    Modified: myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/conf/dev/web.xml
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/conf/dev/web.xml?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/conf/dev/web.xml (original)
    +++ myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/conf/dev/web.xml Mon Apr 12 19:43:30 2010
    @@ -28,7 +28,7 @@
    Initializes the plugins for our groovy handlers
    </description>
    <param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
    - <param-value>org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
    + <param-value>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
    </context-param>


    @@ -37,7 +37,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
    <param-value>
    /Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/groovy
    </param-value>
    @@ -48,7 +48,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
    <param-value>
    /Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java
    </param-value>
    @@ -56,7 +56,7 @@

    <context-param>
    <description>resource paths for our custom JSF2 resource resolver</description>
    - <param-name>org.apache.myfaces.scripting.resources.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.resources.LOADER_PATHS</param-name>
    <param-value>
    /Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces20-example/src/main/webapp
    </param-value>
    @@ -67,7 +67,7 @@
    source dir
    </description>
    <param-name>facelets.RESOURCE_RESOLVER</param-name>
    - <param-value>org.apache.myfaces.scripting.facelet.ReroutingResourceResolver</param-value>
    + <param-value>org.apache.myfaces.extensions.scripting.facelet.ReroutingResourceResolver</param-value>
    </context-param>

    <!--
    @@ -75,7 +75,7 @@
    <description>a comma separated whitelist of root packages which are compiled those and nothing else
    will be compiled during all compile stages, all other files stay permanently as they are
    </description>
    - <param-name>org.apache.myfaces.scripting.PGK_WHITELIST</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.PGK_WHITELIST</param-name>
    <param-value>org.apache.myfaces.groovyloader.blog</param-value>
    </context-param>
    -->
    @@ -86,7 +86,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
    <param-value>D:/dev/work/ideaprojects/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/groovy</param-value>
    </context-param>

    @@ -95,7 +95,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
    <param-value>D:/dev/work/ideaprojects/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/java</param-value>
    </context-param>

    @@ -130,7 +130,7 @@

    <filter>
    <filter-name>scriptingFilter</filter-name>
    - <filter-class>org.apache.myfaces.scripting.servlet.ScriptingServletFilter</filter-class>
    + <filter-class>org.apache.myfaces.extensions.scripting.servlet.ScriptingServletFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>scriptingFilter</filter-name>

    Modified: myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/facelets/groovy-taglib.xml
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/facelets/groovy-taglib.xml?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/facelets/groovy-taglib.xml (original)
    +++ myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/facelets/groovy-taglib.xml Mon Apr 12 19:43:30 2010
    @@ -28,8 +28,8 @@ http://java.sun.com/xml/ns/javaee/web-fa
    <tag>
    <tag-name>compilerOutput</tag-name>
    <component>
    - <component-type>org.apache.myfaces.scripting.components.CompilerComponent</component-type>
    - <renderer-type>org.apache.myfaces.scripting.components.CompilerComponentRenderer</renderer-type>
    + <component-type>org.apache.myfaces.extensions.scripting.components.CompilerComponent</component-type>
    + <renderer-type>org.apache.myfaces.extensions.scripting.components.CompilerComponentRenderer</renderer-type>
    </component>
    </tag>


    Modified: myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml (original)
    +++ myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml Mon Apr 12 19:43:30 2010
    @@ -61,7 +61,7 @@
    org.apache.myfaces.groovyloader.test.TestNavigationHandler
    </navigation-handler>
    <resource-handler>
    - org.apache.myfaces.scripting.jsf2.resources.SourceResourceHandler
    + org.apache.myfaces.extensions.scripting.jsf2.resources.SourceResourceHandler
    </resource-handler>

    </application>

    Modified: myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BaseInterface.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BaseInterface.java?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BaseInterface.java (original)
    +++ myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BaseInterface.java Mon Apr 12 19:43:30 2010
    @@ -26,6 +26,4 @@ package org.apache.myfaces.javaloader.bl
    */

    public interface BaseInterface {
    -
    -
    }

    Modified: myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/componentTest/JavaTestRenderer2.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/componentTest/JavaTestRenderer2.java?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/componentTest/JavaTestRenderer2.java (original)
    +++ myfaces/extensions/scripting/trunk/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/componentTest/JavaTestRenderer2.java Mon Apr 12 19:43:30 2010
    @@ -25,7 +25,7 @@ import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    import javax.faces.render.FacesRenderer;

    -import org.apache.myfaces.scripting.core.util.ReflectUtil;
    +import org.apache.myfaces.extensions.scripting.core.util.ReflectUtil;
    import org.apache.myfaces.shared_impl.renderkit.html.HtmlTextareaRendererBase;

    /**
  • Werpu at Apr 12, 2010 at 7:44 pm
    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/AbstractJavaCompilerTestCase.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/AbstractJavaCompilerTestCase.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/AbstractJavaCompilerTestCase.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/AbstractJavaCompilerTestCase.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,162 @@
    +/*
    + * 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.extensions.scripting.sandbox;
    +
    +import java.io.File;
    +
    +import org.apache.myfaces.extensions.scripting.core.support.AbstractGeneratorTestCase;
    +import org.apache.myfaces.extensions.scripting.api.CompilationResult;
    +import org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler;
    +import org.junit.Ignore;
    +
    +/**
    + * <p>Test class for all Java implementations of
    + * <code>org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler</code>.</p>
    + */
    +@Ignore
    +public abstract class AbstractJavaCompilerTestCase extends AbstractGeneratorTestCase {
    +
    + // ------------------------------------------ Test methods
    +
    + public void testCompileGeneratedFile() throws Exception {
    + writeFile("/src/main/java/org/apache/myfaces/extensions/scripting/HelloWorld.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "public class HelloWorld { ",
    + " ",
    + " public static void main(String[] args) { ",
    + " System.out.println(\"Hello World\"); ",
    + " } ",
    + "} "
    + });
    +
    + org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler compiler = createCompiler();
    + CompilationResult result = compiler.compile(
    + new File(buildAbsolutePath("/src/main/java")),
    + new File(buildAbsolutePath("/target/test-classes")),
    + "org/apache/myfaces/extensions/scripting/HelloWorld.java", getCurrentClassLoader());
    +
    + assertFalse(result.hasErrors());
    + assertTrue(new File(
    + buildAbsolutePath("/target/test-classes/"), "org/apache/myfaces/extensions/scripting/HelloWorld.class").exists());
    + }
    +
    + public void testCompileGeneratedFileWithError() throws Exception {
    + writeFile("/src/main/java/org/apache/myfaces/extensions/scripting/HelloWorld.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "public class HelloWorld { ",
    + " ",
    + " public static void main(String[] args) { ",
    + " System.println(\"Hello World\"); ",
    + " } ",
    + "} "
    + });
    +
    + Compiler compiler = createCompiler();
    + CompilationResult result = compiler.compile(
    + new File(buildAbsolutePath("/src/main/java")),
    + new File(buildAbsolutePath("/target/test-classes")),
    + "org/apache/myfaces/extensions/scripting/HelloWorld.java", getCurrentClassLoader());
    +
    + assertTrue(result.hasErrors());
    + assertFalse(new File(
    + buildAbsolutePath("/target/test-classes/"), "org/apache/myfaces/extensions/scripting/HelloWorld.class").exists());
    + }
    +
    + public void testCompileFileWithDependencies() throws Exception {
    + writeFile("/src/main/java/org/apache/myfaces/extensions/scripting/DummyCompiler.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "import java.io.File; ",
    + "import org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler; ",
    + "import org.apache.myfaces.extensions.scripting.api.CompilationResult; ",
    + " ",
    + "public class DummyCompiler implements Compiler { ",
    + " ",
    + " public CompilationResult compile(File s, File t, String f, ClassLoader c) { ",
    + " return null; ",
    + " } ",
    + " ",
    + " public CompilationResult compile(File s, File t, File f, ClassLoader c) { ",
    + " return null; ",
    + " } ",
    + "} "
    +
    + });
    +
    + Compiler compiler = createCompiler();
    + CompilationResult result = compiler.compile(
    + new File(buildAbsolutePath("/src/main/java")),
    + new File(buildAbsolutePath("/target/test-classes")),
    + "org/apache/myfaces/extensions/scripting/DummyCompiler.java", getCurrentClassLoader());
    +
    + assertFalse(result.hasErrors());
    + assertTrue(new File(
    + buildAbsolutePath("/target/test-classes/"), "org/apache/myfaces/extensions/scripting/DummyCompiler.class").exists());
    + }
    +
    + public void testCompileFileWithDependenciesWithoutClassloader() throws Exception {
    + writeFile("/src/main/java/org/apache/myfaces/extensions/scripting/DummyCompiler.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "import java.io.File; ",
    + "import org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler; ",
    + "import org.apache.myfaces.extensions.scripting.api.CompilationResult; ",
    + " ",
    + "public class DummyCompiler implements Compiler { ",
    + " ",
    + " public CompilationResult compile(File s, File t, String f, ClassLoader c) { ",
    + " return null; ",
    + " } ",
    + " ",
    + " public CompilationResult compile(File s, File t, File f, ClassLoader c) { ",
    + " return null; ",
    + " } ",
    + "} "
    +
    + });
    +
    + Compiler compiler = createCompiler();
    + CompilationResult result = compiler.compile(
    + new File(buildAbsolutePath("/src/main/java")),
    + new File(buildAbsolutePath("/target/test-classes")),
    + "aorg/apache/myfaces/extensions/scripting/DummyCompiler.java", null);
    +
    + assertTrue(result.hasErrors());
    + assertFalse(new File(
    + buildAbsolutePath("/target/test-classes/"), "org/apache/myfaces/extensions/scripting/DummyCompiler.class").exists());
    + }
    +
    + // ------------------------------------------ Utility methods
    +
    + protected ClassLoader getCurrentClassLoader() {
    + return getClass().getClassLoader();
    + }
    +
    + // ------------------------------------------ Template methods
    +
    + /**
    + * <p>Creates a new instance of the compiler implementation that this class should test.</p>
    + *
    + * @return a new instance of the compiler implementation that this class should test
    + */
    + protected abstract Compiler createCompiler();
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/DefaultGreeter.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/DefaultGreeter.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/DefaultGreeter.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/DefaultGreeter.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,31 @@
    +/*
    + * 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.extensions.scripting.sandbox;
    +
    +/**
    + *
    + *
    + */
    +public class DefaultGreeter implements Greeter {
    +
    + public String sayHello() {
    + return "Hello";
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/DefaultPersonGreeter.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/DefaultPersonGreeter.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/DefaultPersonGreeter.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/DefaultPersonGreeter.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,33 @@
    +/*
    + * 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.extensions.scripting.sandbox;
    +
    +/**
    + *
    + *
    + */
    +public class DefaultPersonGreeter implements PersonGreeter {
    +
    + private DefaultGreeter greeter = new DefaultGreeter();
    +
    + public String sayHello(String name) {
    + return greeter.sayHello() + " " + name + "!";
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/Greeter.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/Greeter.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/Greeter.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/Greeter.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,29 @@
    +/*
    + * 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.extensions.scripting.sandbox;
    +
    +/**
    + *
    + *
    + */
    +public interface Greeter {
    +
    + public String sayHello();
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/GroovyCompilerTest.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/GroovyCompilerTest.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/GroovyCompilerTest.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/GroovyCompilerTest.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,150 @@
    +/*
    + * 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.extensions.scripting.sandbox;
    +
    +import org.apache.myfaces.extensions.scripting.sandbox.compiler.GroovyCompiler;
    +import org.apache.myfaces.extensions.scripting.core.support.AbstractGeneratorTestCase;
    +import org.apache.myfaces.extensions.scripting.api.CompilationResult;
    +import org.apache.myfaces.extensions.scripting.api.Configuration;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.extensions.scripting.sandbox.compiler.*;
    +import org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler;
    +
    +import java.io.File;
    +
    +/**
    + * <p>Test class for
    + * <code>org.apache.myfaces.extensions.scripting.sandbox.compiler.GroovyCompiler</code></p>
    + */
    +
    +public class GroovyCompilerTest extends AbstractGeneratorTestCase {
    +
    + // ------------------------------------------ Test methods
    +
    + @Override
    + public void setUp() throws Exception {
    + super.setUp();
    + WeavingContext.setConfiguration(new Configuration());
    + }
    +
    + /**
    + * <p>Tests whether it is possible to compile a dynamically generated Groovy source file.</p>
    + *
    + * @throws Exception if an error occurs
    + */
    + public void testCompileGeneratedFile() throws Exception {
    + writeFile("/src/main/groovy/org/apache/myfaces/extensions/scripting/HelloWorld.groovy", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "def class HelloWorld { ",
    + " ",
    + " def static main(String[] args) { ",
    + " println(\"Hello World\"); ",
    + " } ",
    + "} "
    + });
    +
    + org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler compiler = new GroovyCompiler();
    + CompilationResult result = compiler.compile(
    + new File(buildAbsolutePath("/src/main/groovy")),
    + new File(buildAbsolutePath("/target/test-classes")),
    + "org/apache/myfaces/extensions/scripting/HelloWorld.groovy", getCurrentClassLoader());
    +
    + assertFalse(result.hasErrors());
    + assertTrue(new File(
    + buildAbsolutePath("/target/test-classes/"), "org/apache/myfaces/extensions/scripting/HelloWorld.class").exists());
    + }
    +
    + /**
    + * <p>Tests whether compilation fails in case of an invalid Groovy source file.</p>
    + *
    + * @throws Exception if an error occurs
    + */
    + public void testCompileGeneratedFileWithError() throws Exception {
    + writeFile("/src/main/groovy/org/apache/myfaces/extensions/scripting/HelloWorld.groovy", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "def class HelloWorld { ",
    + " ",
    + " def static main(String[] args) { ",
    + " System2.out.println(\"Hello World\"); ",
    + " } ",
    + "} "
    + });
    +
    + Compiler compiler = new GroovyCompiler();
    + CompilationResult result = compiler.compile(
    + new File(buildAbsolutePath("/src/main/groovy")),
    + new File(buildAbsolutePath("/target/test-classes")),
    + "org/apache/myfaces/extensions/scripting/HelloWorld.groovy", getCurrentClassLoader());
    +
    + assertTrue(result.hasErrors());
    + assertFalse(new File(
    + buildAbsolutePath("/target/test-classes/"), "org/apache/myfaces/extensions/scripting/HelloWorld.class").exists());
    + }
    +
    + /**
    + * <p>Tests whether it is possible to reference dependencies in the Groovy
    + * source files that have to be resolved using the supplied class loader.</p>
    + *
    + * @throws Exception if an error occurs
    + */
    + public void testCompileFileWithDependencies() throws Exception {
    + writeFile("/src/main/groovy/org/apache/myfaces/extensions/scripting/DummyCompiler.groovy", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "import java.io.File; ",
    + "import org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler; ",
    + "import org.apache.myfaces.extensions.scripting.api.CompilationResult; ",
    + " ",
    + "def class DummyCompiler implements Compiler { ",
    + " ",
    + " def CompilationResult compile(File s, File t, String f, ClassLoader c) { ",
    + " return null; ",
    + " } ",
    + " ",
    + " def CompilationResult compile(File s, File t, File f, ClassLoader c) { ",
    + " return null; ",
    + " } ",
    + "} "
    + });
    +
    + Compiler compiler = new GroovyCompiler();
    + CompilationResult result = compiler.compile(
    + new File(buildAbsolutePath("/src/main/groovy")),
    + new File(buildAbsolutePath("/target/test-classes")),
    + "org/apache/myfaces/extensions/scripting/DummyCompiler.groovy", getCurrentClassLoader());
    +
    + assertFalse(result.hasErrors());
    + assertTrue(new File(
    + buildAbsolutePath("/target/test-classes/"), "org/apache/myfaces/extensions/scripting/DummyCompiler.class").exists());
    + }
    +
    + // ------------------------------------------ Utility methods
    +
    + /**
    + * <p>Returns the class loader that has loaded this class.</p>
    + *
    + * @return the class loader that has loaded this class
    + */
    + protected ClassLoader getCurrentClassLoader() {
    + return getClass().getClassLoader();
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/JavacCompilerTest.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/JavacCompilerTest.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/JavacCompilerTest.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/JavacCompilerTest.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,38 @@
    +/*
    + * 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.extensions.scripting.sandbox;
    +
    +import org.apache.myfaces.extensions.scripting.sandbox.compiler.JavacCompiler;
    +import org.apache.myfaces.extensions.scripting.sandbox.compiler.*;
    +import org.junit.Ignore;
    +
    +/**
    + * <p>Test class for
    + * <code>org.apache.myfaces.extensions.scripting.sandbox.compiler.JavacCompiler</code></p>
    + */
    +@Ignore
    +public class JavacCompilerTest extends AbstractJavaCompilerTestCase {
    +
    + // ------------------------------------------ AbstractJavaCompilerTestCase methods
    +
    + protected org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler createCompiler() {
    + return new JavacCompiler();
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/Jsr199CompilerTest.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/Jsr199CompilerTest.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/Jsr199CompilerTest.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/Jsr199CompilerTest.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,37 @@
    +/*
    + * 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.extensions.scripting.sandbox;
    +
    +import org.junit.Ignore;
    +
    +/**
    + * <p>Test class for
    + * <code>org.apache.myfaces.extensions.scripting.loaders.java.compiler.Jsr199Compiler</code></p>
    + */
    +@Ignore
    +public class Jsr199CompilerTest extends AbstractJavaCompilerTestCase {
    +
    + // ------------------------------------------ AbstractJavaCompilerTestCase methods
    +
    + protected org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler createCompiler() {
    + //return new Jsr199Compiler();
    + return null;
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/OverridingClassLoaderTest.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/OverridingClassLoaderTest.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/OverridingClassLoaderTest.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/OverridingClassLoaderTest.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,77 @@
    +/*
    + * 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.extensions.scripting.sandbox;
    +
    +import junit.framework.TestCase;
    +import org.apache.myfaces.extensions.scripting.sandbox.loader.support.OverridingClassLoader;
    +
    +/**
    + * <p>Test class for the class
    + * <code>org.apache.myfaces.extensions.scripting.sandbox.loader.support.OverridingClassLoader</code></p>
    + */
    +public class OverridingClassLoaderTest extends TestCase {
    +
    + // ------------------------------------------ Test methods
    +
    + /**
    + * <p>Tests whether it is possible to override class definitions using the OverridingClassLoader,
    + * i.e. it tests if you can produce multiple different Class objects using different class loaders
    + * (which is not really a surprising thing at all).</p>
    + *
    + * @throws Exception if an unexpected error occurs
    + */
    + public void testOverrideClass() throws Exception {
    + ClassLoader classLoader = new OverridingClassLoader(
    + Dummy.class.getName(), OverridingClassLoaderTest.class.getClassLoader());
    +
    + Class dummyClass = classLoader.loadClass(Dummy.class.getName());
    + assertNotSame("The OverridingClassLoader didn't return a different Class instance.",
    + Dummy.class, dummyClass);
    +
    + // .. and another time
    + classLoader = new OverridingClassLoader(Dummy.class.getName(), classLoader);
    + Class secondDummyClass = classLoader.loadClass(Dummy.class.getName());
    + assertNotSame("The OverridingClassLoader didn't return a different Class instance.",
    + Dummy.class, secondDummyClass);
    + assertNotSame("The OverridingClassLoader didn't return a different Class instance.",
    + dummyClass, secondDummyClass);
    + }
    +
    + /**
    + * <p>Tests whether the OverridingClassLoader delegates the parent class loader correctly.</p>
    + *
    + * @throws Exception if an unexpected error occurs
    + */
    + public void testOverrideDifferentClass() throws Exception {
    + ClassLoader classLoader = new OverridingClassLoader(
    + Dummy.class.getName(), OverridingClassLoaderTest.class.getClassLoader());
    + assertSame("The OverridingClassLoader replaced a Class instance that he wasn't supposed to replace.",
    + Object.class, classLoader.loadClass("java.lang.Object"));
    + }
    +
    + // ------------------------------------------ Dummy classes
    +
    + /**
    + * <p>This class will be reloaded in some test cases.</p>
    + */
    + private static class Dummy {
    +
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/PersonGreeter.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/PersonGreeter.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/PersonGreeter.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/PersonGreeter.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,29 @@
    +/*
    + * 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.extensions.scripting.sandbox;
    +
    +/**
    + *
    + *
    + */
    +public interface PersonGreeter {
    +
    + public String sayHello(String name);
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/ReloadingClassLoaderTest.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/ReloadingClassLoaderTest.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/ReloadingClassLoaderTest.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/extensions/scripting/sandbox/ReloadingClassLoaderTest.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,278 @@
    +/*
    + * 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.extensions.scripting.sandbox;
    +
    +import org.apache.myfaces.extensions.scripting.core.support.AbstractGeneratorTestCase;
    +import org.apache.myfaces.extensions.scripting.sandbox.loader.ReloadingClassLoader;
    +import org.junit.Ignore;
    +
    +import java.io.File;
    +
    +/**
    + * <p>Test class for
    + * <code>org.apache.myfaces.extensions.scripting.sandbox.loader.ReloadingClassLoader</code></p>
    + */
    +@Ignore
    +public class ReloadingClassLoaderTest extends AbstractGeneratorTestCase {
    +
    + // ------------------------------------------ Test methods
    +
    + public void testCompileAndLoadFile() throws Exception {
    + // Compile a dynamically generated class ..
    + compileFile("/src/main/java", "/target/test-classes", "org/apache/myfaces/extensions/scripting/Greeter.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "public class Greeter { ",
    + " ",
    + " public String sayHello() { ",
    + " return \"Hello World\"; ",
    + " } ",
    + "} "
    + });
    +
    + ClassLoader classLoader = buildClassLoader("/target/test-classes");
    +
    + // .. and try to load it afterwards.
    + Class greeterClass = classLoader.loadClass("org.apache.myfaces.extensions.scripting.Greeter");
    + assertNotNull(greeterClass);
    + assertEquals("org.apache.myfaces.extensions.scripting.Greeter", greeterClass.getName());
    +
    + Object greeter = greeterClass.newInstance();
    + String greeting = (String) greeter.getClass().getMethod("sayHello").invoke(greeter);
    + assertEquals("Hello World", greeting);
    + }
    +
    + public void testCompileAndLoadFileMultipleTimes() throws Exception {
    + // Compile a dynamically generated class ..
    + compileFile("/src/main/java", "/target/test-classes", "org/apache/myfaces/extensions/scripting/Greeter.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "public class Greeter { ",
    + " ",
    + " public String sayHello() { ",
    + " return \"Hello World\"; ",
    + " } ",
    + "} "
    + });
    +
    + ClassLoader classLoader = buildClassLoader("/target/test-classes");
    +
    + // .. and try to load it afterwards ..
    + Class firstGreeterClass = classLoader.loadClass("org.apache.myfaces.extensions.scripting.Greeter");
    + assertNotNull(firstGreeterClass);
    + assertEquals("org.apache.myfaces.extensions.scripting.Greeter", firstGreeterClass.getName());
    +
    + // .. more than once using the same classloader.
    + Class secondGreeterClass = classLoader.loadClass("org.apache.myfaces.extensions.scripting.Greeter");
    + assertNotNull(secondGreeterClass);
    + assertEquals("org.apache.myfaces.extensions.scripting.Greeter", secondGreeterClass.getName());
    +
    + assertSame(firstGreeterClass, secondGreeterClass);
    + }
    +
    + public void testRecompileAndLoadFile() throws Exception {
    + // Compile a dynamically generated class.
    + compileFile("/src/main/java", "/target/test-classes", "org/apache/myfaces/extensions/scripting/Greeter.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "public class Greeter { ",
    + " ",
    + " public String sayHello() { ",
    + " return \"Hello World\"; ",
    + " } ",
    + "} "
    + });
    +
    + ClassLoader classLoader = buildClassLoader("/target/test-classes");
    +
    + Class firstGreeterClass = classLoader.loadClass("org.apache.myfaces.extensions.scripting.Greeter");
    + assertNotNull(firstGreeterClass);
    + assertEquals("org.apache.myfaces.extensions.scripting.Greeter", firstGreeterClass.getName());
    +
    + Object firstGreeter = firstGreeterClass.newInstance();
    + String greeting = (String) firstGreeterClass.getMethod("sayHello").invoke(firstGreeter);
    + assertEquals("Hello World", greeting);
    +
    + Thread.sleep(1000);
    +
    + // Modify the source code
    + // Compile a dynamically generated class ..
    + compileFile("/src/main/java", "/target/test-classes", "org/apache/myfaces/extensions/scripting/Greeter.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "public class Greeter { ",
    + " ",
    + " public String sayHello() { ",
    + " return \"Hello Universe\"; ",
    + " } ",
    + "} "
    + });
    +
    + // Reload the class and verify it again
    + Class secondGreeterClass = classLoader.loadClass("org.apache.myfaces.extensions.scripting.Greeter");
    + assertNotNull(secondGreeterClass);
    + assertEquals("org.apache.myfaces.extensions.scripting.Greeter", secondGreeterClass.getName());
    +
    + // However, it has to be a new Class object
    + assertNotSame(firstGreeterClass, secondGreeterClass);
    +
    + Object secondGreeter = secondGreeterClass.newInstance();
    + greeting = (String) secondGreeterClass.getMethod("sayHello").invoke(secondGreeter);
    + assertEquals("Hello Universe", greeting);
    + }
    +
    + public void testOverrideFile() throws Exception {
    + ClassLoader classLoader = buildClassLoader("/target/test-classes");
    + Greeter greeter = (Greeter) classLoader.loadClass(
    + "org.apache.myfaces.extensions.scripting.sandbox.DefaultGreeter").newInstance();
    + assertEquals("Hello", greeter.sayHello());
    +
    + // Compile a dynamically generated class.
    + compileFile("/src/main/java", "/target/test-classes", "org/apache/myfaces/extensions/scripting/loader/DefaultGreeter.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting.sandbox.loader; ",
    + " ",
    + "public class DefaultGreeter implements Greeter { ",
    + " ",
    + " public String sayHello() { ",
    + " return \"Hi\"; ",
    + " } ",
    + "} "
    + });
    +
    + greeter = (Greeter) classLoader.loadClass(
    + "org.apache.myfaces.extensions.scripting.sandbox.DefaultGreeter").newInstance();
    + assertEquals("Hi", greeter.sayHello());
    + }
    +
    + public void testOverrideFileAndCheckDependentClass() throws Exception {
    + ReloadingClassLoader classLoader = buildClassLoader("/target/test-classes");
    + PersonGreeter greeter = (PersonGreeter) classLoader.loadClass(
    + "org.apache.myfaces.extensions.scripting.sandbox.DefaultPersonGreeter").newInstance();
    + assertEquals("Hello John Doe!", greeter.sayHello("John Doe"));
    +
    + // Compile a dynamically generated class.
    + compileFile("/src/main/java", "/target/test-classes", "org/apache/myfaces/extensions/scripting/loader/DefaultGreeter.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting.sandbox.loader; ",
    + " ",
    + "public class DefaultGreeter implements Greeter { ",
    + " ",
    + " public String sayHello() { ",
    + " return \"Hi\"; ",
    + " } ",
    + "} "
    + });
    +
    + // Note that the person greeter still uses the outdated version of the class file.
    + greeter = (PersonGreeter) classLoader.loadClass(
    + "org.apache.myfaces.extensions.scripting.sandbox.DefaultPersonGreeter").newInstance();
    + assertEquals("Hello John Doe!", greeter.sayHello("John Doe"));
    +
    + // However, now we're forcefully reloading this class in order to reflect the changes.
    + classLoader.reloadClass("org.apache.myfaces.extensions.scripting.sandbox.DefaultPersonGreeter");
    +
    + // Note that the person greeter still uses the outdated version of the class file.
    + greeter = (PersonGreeter) classLoader.loadClass(
    + "org.apache.myfaces.extensions.scripting.sandbox.DefaultPersonGreeter").newInstance();
    + assertEquals("Hi John Doe!", greeter.sayHello("John Doe"));
    + }
    +
    + public void testCompileAndLoadFileWithDependencies() throws Exception {
    + compileFile("/src/main/java", "/target/test-classes", "org/apache/myfaces/extensions/scripting/DummyCompiler.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "import java.io.File; ",
    + "import org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler; ",
    + "import org.apache.myfaces.extensions.scripting.api.CompilationResult; ",
    + " ",
    + "public class DummyCompiler implements Compiler { ",
    + " ",
    + " public CompilationResult compile(File s, File t, String f, ClassLoader c) { ",
    + " return null; ",
    + " } ",
    + " ",
    + " public CompilationResult compile(File s, File t, File f, ClassLoader c) { ",
    + " return null; ",
    + " } ",
    + "} "
    + });
    +
    + // Create a new class loader to load the dynamically compiled class
    + ClassLoader classLoader = buildClassLoader("/target/test-classes");
    +
    + // Load the dynamically compiled class
    + Class dummyCompilerClass = classLoader.loadClass("org.apache.myfaces.extensions.scripting.DummyCompiler");
    + assertNotNull(dummyCompilerClass);
    + assertEquals("org.apache.myfaces.extensions.scripting.DummyCompiler", dummyCompilerClass.getName());
    + }
    +
    + public void testLoadParentClassFile() throws Exception {
    + ClassLoader classLoader = buildClassLoader("/target/test-classes");
    +
    + Class compilerInterface = classLoader.loadClass("org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler");
    + assertNotNull(compilerInterface);
    + assertEquals("org.apache.myfaces.extensions.scripting.sandbox.compiler.Compiler", compilerInterface.getName());
    + }
    +
    + public void testOutdatedCheck() throws Exception {
    + // Compile a dynamically generated class ..
    + compileFile("/src/main/java", "/target/test-classes", "org/apache/myfaces/extensions/scripting/Greeter.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "public class Greeter { ",
    + " ",
    + " public String sayHello() { ",
    + " return \"Hello World\"; ",
    + " } ",
    + "} "
    + });
    +
    + ReloadingClassLoader classLoader = buildClassLoader("/target/test-classes");
    +
    + Class firstGreeterClass = classLoader.loadClass("org.apache.myfaces.extensions.scripting.Greeter");
    + assertNotNull(firstGreeterClass);
    + assertEquals("org.apache.myfaces.extensions.scripting.Greeter", firstGreeterClass.getName());
    +
    + assertFalse(classLoader.isOutdated(firstGreeterClass));
    +
    + Thread.sleep(1000);
    +
    + // Modify the source code ..
    + compileFile("/src/main/java", "/target/test-classes", "org/apache/myfaces/extensions/scripting/Greeter.java", new String[]{
    + "package org.apache.myfaces.extensions.scripting; ",
    + " ",
    + "public class Greeter { ",
    + " ",
    + " public String sayHello() { ",
    + " return \"Hello Universe\"; ",
    + " } ",
    + "} "
    + });
    +
    + // .. and test whether the classloader recognizes that we've got an outdated Class reference here.
    + assertTrue(classLoader.isOutdated(firstGreeterClass));
    + }
    +
    + // ------------------------------------------ Utility methods
    +
    + protected ReloadingClassLoader buildClassLoader(String compilationDirectory) {
    + return new ReloadingClassLoader(getClass().getClassLoader(),
    + new File(buildAbsolutePath(compilationDirectory)));
    + }
    +
    +}
    \ No newline at end of file

    Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/resources/brokenwebapp/WEB-INF/web.xml
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/resources/brokenwebapp/WEB-INF/web.xml?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/resources/brokenwebapp/WEB-INF/web.xml (original)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/resources/brokenwebapp/WEB-INF/web.xml Mon Apr 12 19:43:30 2010
    @@ -29,7 +29,7 @@
    <description>a comma separated whitelist of root packages which are compiled those and nothing else
    will be compiled during all compile stages, all other files stay permanently as they are
    </description>
    - <param-name>org.apache.myfaces.scripting.PGK_WHITELIST</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.PGK_WHITELIST</param-name>
    <param-value>org.apache.myfaces.groovyloader.blog</param-value>
    </context-param>
    -->
    @@ -40,7 +40,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
    <param-value>D:/dev/work/ideaprojects/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/groovy</param-value>
    </context-param>

    @@ -49,7 +49,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
    <param-value>D:/dev/work/ideaprojects/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/java</param-value>
    </context-param>


    Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/resources/webapp/WEB-INF/web.xml
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/resources/webapp/WEB-INF/web.xml?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/resources/webapp/WEB-INF/web.xml (original)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/resources/webapp/WEB-INF/web.xml Mon Apr 12 19:43:30 2010
    @@ -28,7 +28,7 @@
    Initializes the plugins for our groovy handlers
    </description>
    <param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
    - <param-value>org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
    + <param-value>org.apache.myfaces.extensions.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
    </context-param>


    @@ -36,7 +36,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
    <param-value>
    /Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/groovy
    </param-value>
    @@ -47,7 +47,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
    <param-value>
    /Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java
    </param-value>
    @@ -55,7 +55,7 @@

    <context-param>
    <description>resource paths for our custom JSF2 resource resolver</description>
    - <param-name>org.apache.myfaces.scripting.resources.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.resources.LOADER_PATHS</param-name>
    <param-value>
    /Users/werpu2/development/workspace/extensions-scripting3/extscript-examples/myfaces20-example/src/main/webapp
    </param-value>
    @@ -66,7 +66,7 @@
    source dir
    </description>
    <param-name>facelets.RESOURCE_RESOLVER</param-name>
    - <param-value>org.apache.myfaces.scripting.facelet.ReroutingResourceResolver</param-value>
    + <param-value>org.apache.myfaces.extensions.scripting.facelet.ReroutingResourceResolver</param-value>
    </context-param>

    <!--
    @@ -74,7 +74,7 @@
    <description>a comma separated whitelist of root packages which are compiled those and nothing else
    will be compiled during all compile stages, all other files stay permanently as they are
    </description>
    - <param-name>org.apache.myfaces.scripting.PGK_WHITELIST</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.PGK_WHITELIST</param-name>
    <param-value>org.apache.myfaces.groovyloader.blog</param-value>
    </context-param>
    -->
    @@ -85,7 +85,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.groovy.LOADER_PATHS</param-name>
    <param-value>D:/dev/work/ideaprojects/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/groovy</param-value>
    </context-param>

    @@ -94,7 +94,7 @@
    <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
    of the deployment dir
    </description>
    - <param-name>org.apache.myfaces.scripting.java.LOADER_PATHS</param-name>
    + <param-name>org.apache.myfaces.extensions.scripting.java.LOADER_PATHS</param-name>
    <param-value>D:/dev/work/ideaprojects/threads/extscript/examples/myfaces20-example/src/main/webapp/WEB-INF/java</param-value>
    </context-param>

    @@ -125,7 +125,7 @@

    <filter>
    <filter-name>scriptingFilter</filter-name>
    - <filter-class>org.apache.myfaces.scripting.servlet.ScriptingServletFilter</filter-class>
    + <filter-class>org.apache.myfaces.extensions.scripting.servlet.ScriptingServletFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>scriptingFilter</filter-name>

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/faces-config.NavData
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/faces-config.NavData?rev=933379&view=auto
    ==============================================================================
    (empty)

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReroutingResourceResolver.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReroutingResourceResolver.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReroutingResourceResolver.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReroutingResourceResolver.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,65 @@
    +/*
    + * 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.extensions.scripting.facelet;
    +
    +import com.sun.facelets.impl.DefaultResourceResolver;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import java.io.File;
    +import java.net.MalformedURLException;
    +import java.net.URL;
    +import java.util.List;
    +import java.util.logging.Level;
    +import java.util.logging.Logger;
    +
    +/**
    + * decorated Facelet resource resolver to reroute
    + * the resource requests to our source path if possible
    + */
    +public class ReroutingResourceResolver extends DefaultResourceResolver {
    +
    + DefaultResourceResolver _delegate = new DefaultResourceResolver();
    + volatile boolean _initiated = false;
    + List<String> _resourceDirs = null;
    +
    + Logger log = Logger.getLogger(this.getClass().getName());
    +
    + @Override
    + public URL resolveUrl(String path) {
    +
    + if (!_initiated) {
    + _resourceDirs = WeavingContext.getConfiguration().getResourceDirs();
    + _initiated = true;
    + }
    +
    + if (_resourceDirs != null && !_resourceDirs.isEmpty()) {
    + for (String resourceDir : _resourceDirs) {
    + File resource = new File(resourceDir + path);
    + if (resource.exists()) try {
    + return resource.toURI().toURL();
    + } catch (MalformedURLException e) {
    + log.log(Level.SEVERE,"", e);
    + }
    + }
    + }
    +
    + return _delegate.resolveUrl(path);
    + }
    +}
    +

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingApplicationFactory.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingApplicationFactory.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingApplicationFactory.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingApplicationFactory.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,71 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.factories;
    +
    +import org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.implemetations.ApplicationProxy;
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.application.ApplicationFactory;
    +import javax.faces.application.Application;
    +
    +/**
    + * Application factory which introduces
    + * scripting proxies for their artefacts
    + * <p/>
    + * We use a mix of AOP and helper constructs
    + * to reach the goal to be dynamic.
    + * For most artefacts we just need to
    + * check if the object is a Groovy object
    + * and then reload at their connection interfaces
    + * <p/>
    + * Some artefacts have a longer lifespan and/or are stateless
    + * for those we have to work with reloading AOP
    + *
    + * @author Werner Punz
    + */
    +public class ScriptingApplicationFactory extends ApplicationFactory implements Decorated {
    +
    + ApplicationFactory _delegate;
    + boolean scriptingEnabled = false;
    +
    + public ScriptingApplicationFactory(ApplicationFactory delegate) {
    + _delegate = delegate;
    + }
    +
    + public Application getApplication() {
    + Application retVal = _delegate.getApplication(); //To change body of implemented methods use File | Settings | File Templates.
    +
    + if (WeavingContext.isScriptingEnabled() && !(retVal instanceof ApplicationProxy))
    + retVal = new ApplicationProxy(retVal);
    +
    + return retVal;
    + }
    +
    + public void setApplication(Application application) {
    + if (WeavingContext.isScriptingEnabled() && !(application instanceof ApplicationProxy))
    + application = new ApplicationProxy(application);
    +
    + _delegate.setApplication(application);
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingFacesContextFactory.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingFacesContextFactory.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingFacesContextFactory.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingFacesContextFactory.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,60 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.factories;
    +
    +import org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.implemetations.FacesContextProxy;
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.context.FacesContext;
    +import javax.faces.context.FacesContextFactory;
    +import javax.faces.lifecycle.Lifecycle;
    +import javax.faces.FacesException;
    +
    +/**
    + * Faces context weaver which builds
    + * our reloading proxy around the current faces context
    + *
    + * @author Werner Punz
    + */
    +public class ScriptingFacesContextFactory extends javax.faces.context.FacesContextFactory implements Decorated {
    +
    + public FacesContextFactory _delegate;
    + boolean scriptingEnabled = false;
    +
    + public ScriptingFacesContextFactory(FacesContextFactory delegate) {
    + _delegate = delegate;
    + }
    +
    + public void setDelegate(FacesContextFactory delegate) {
    + _delegate = delegate;
    + }
    +
    + public FacesContext getFacesContext(Object o, Object o1, Object o2, Lifecycle lifecycle) throws FacesException {
    + FacesContext retVal = _delegate.getFacesContext(o, o1, o2, lifecycle); //To change body of implemented methods use File | Settings | File Templates.
    +
    + if (WeavingContext.isScriptingEnabled() && !(retVal instanceof FacesContextProxy))
    + return new FacesContextProxy(retVal);
    + return retVal;
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingLifecycleFactory.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingLifecycleFactory.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingLifecycleFactory.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingLifecycleFactory.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,69 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.factories;
    +
    +import org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.implemetations.LifefcycleProxy;
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.lifecycle.LifecycleFactory;
    +import javax.faces.lifecycle.Lifecycle;
    +import java.util.Iterator;
    +
    +/**
    + * Lifecyclefactory which introduces scripting proxies
    + * for their artefacts
    + *
    + * @author Werner Punz
    + */
    +public class ScriptingLifecycleFactory extends LifecycleFactory implements Decorated {
    +
    + LifecycleFactory _delegate;
    + boolean scriptingEnabled = false;
    +
    + public ScriptingLifecycleFactory(LifecycleFactory delegate) {
    + _delegate = delegate;
    + }
    +
    + public void addLifecycle(String s, Lifecycle lifecycle) {
    + if (scriptingEnabled && !(lifecycle instanceof LifefcycleProxy))
    + lifecycle = new LifefcycleProxy(lifecycle);
    + _delegate.addLifecycle(s, lifecycle);
    + }
    +
    + public Lifecycle getLifecycle(String s) {
    + Lifecycle retVal = _delegate.getLifecycle(s);
    + if (WeavingContext.isScriptingEnabled() && !(retVal instanceof LifefcycleProxy))
    + retVal = new LifefcycleProxy(retVal);
    +
    + return retVal;
    + }
    +
    + public Iterator getLifecycleIds() {
    + return _delegate.getLifecycleIds();
    + }
    +
    + public void setDelegate(LifecycleFactory delegate) {
    + this._delegate = delegate;
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingRenderkitFactory.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingRenderkitFactory.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingRenderkitFactory.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/factories/ScriptingRenderkitFactory.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,71 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.factories;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.implemetations.RenderkitProxy;
    +
    +import javax.faces.render.RenderKitFactory;
    +import javax.faces.render.RenderKit;
    +import javax.faces.context.FacesContext;
    +import java.util.Iterator;
    +
    +/**
    + * Scripting enabled renderkit factory
    + *
    + * @author Werner Punz
    + */
    +public class ScriptingRenderkitFactory extends RenderKitFactory implements Decorated {
    +
    + boolean scriptingEnabled = false;
    +
    + public ScriptingRenderkitFactory(RenderKitFactory delegate) {
    + _delegate = delegate;
    +
    + }
    +
    + public void addRenderKit(String s, RenderKit renderKit) {
    + if (WeavingContext.isScriptingEnabled() && renderKit != null && !(renderKit instanceof RenderkitProxy))
    + renderKit = new RenderkitProxy(renderKit);
    +
    + _delegate.addRenderKit(s, renderKit);
    + }
    +
    + public RenderKit getRenderKit(FacesContext facesContext, String s) {
    + RenderKit retVal = _delegate.getRenderKit(facesContext, s);
    + if (WeavingContext.isScriptingEnabled() && retVal != null && !(retVal instanceof RenderkitProxy))
    + retVal = new RenderkitProxy(retVal);
    + return retVal;
    + }
    +
    + public Iterator getRenderKitIds() {
    + return _delegate.getRenderKitIds();
    + }
    +
    + public void setDelegate(RenderKitFactory delegate) {
    + _delegate = delegate;
    + }
    +
    + RenderKitFactory _delegate = null;
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}
  • Werpu at Apr 12, 2010 at 7:44 pm
    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,423 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.el.*;
    +import javax.faces.FacesException;
    +import javax.faces.application.Application;
    +import javax.faces.application.NavigationHandler;
    +import javax.faces.application.StateManager;
    +import javax.faces.application.ViewHandler;
    +import javax.faces.component.UIComponent;
    +import javax.faces.context.FacesContext;
    +import javax.faces.convert.Converter;
    +import javax.faces.el.*;
    +import javax.faces.event.ActionListener;
    +import javax.faces.validator.Validator;
    +import java.lang.reflect.Proxy;
    +import java.util.*;
    +
    +/**
    + * our decorating application
    + * which should resolve our bean issues within a central
    + * bean processing interceptor
    + * <p/>
    + *
    + * @author Werner Punz
    + */
    +@SuppressWarnings({"deprecation", "deprecation"})
    +public class ApplicationProxy extends Application implements Decorated {
    +
    + volatile Application _delegate;
    +
    + public ApplicationProxy(Application delegate) {
    + _delegate = delegate;
    + }
    +
    +
    + public void addELResolver(ELResolver elResolver) {
    + weaveDelegate();
    +
    + //the same goes for the rest of the factory stuff
    + if (!(elResolver instanceof ELResolverProxy))
    + elResolver = new ELResolverProxy(elResolver);
    + _delegate.addELResolver(elResolver);
    + }
    +
    + private void weaveDelegate() {
    + if (_delegate != null) {
    + _delegate = (Application) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_APPLICATION);
    + }
    + }
    +
    + public ELResolver getELResolver() {
    + weaveDelegate();
    + ELResolver retVal = _delegate.getELResolver();
    + if (!(retVal instanceof ELResolverProxy))
    + retVal = new ELResolverProxy(retVal);
    + return retVal;
    +
    + }
    +
    + //TOD add a weaving for resource bundles
    +
    + public ResourceBundle getResourceBundle(FacesContext facesContext, String s) throws FacesException, NullPointerException {
    + weaveDelegate();
    + return _delegate.getResourceBundle(facesContext, s);
    + }
    +
    + public UIComponent createComponent(ValueExpression valueExpression, FacesContext facesContext, String s) throws FacesException, NullPointerException {
    + weaveDelegate();
    + System.out.println("create1");
    + UIComponent component = _delegate.createComponent(valueExpression, facesContext, s);
    +
    + /*we are reweaving on the fly because we cannot be sure if
    + * the class is not recycled all the time in the creation
    + * code, in the renderer we do it on method base
    + * due to the fact that our renderers are recycled via
    + * a flyweight pattern
    + *
    + *
    + * Also we cannot proxy here because there is no UIComponent interface
    + * maybe in the long run we can make a decorator here instead
    + * but for now lets try it this way
    + */
    + if (WeavingContext.isDynamic(component.getClass()) && !alreadyWovenInRequest(component.getClass().getName())) {
    + /*once it was tainted we have to recreate all the time*/
    + component = (UIComponent) WeavingContext.getWeaver().reloadScriptingInstance(component, ScriptingConst.ARTIFACT_TYPE_COMPONENT);
    + alreadyWovenInRequest(component.getClass().getName());
    + }
    + return component;
    +
    + }
    +
    + public ExpressionFactory getExpressionFactory() {
    + weaveDelegate();
    + return _delegate.getExpressionFactory();
    + }
    +
    + public void addELContextListener(ELContextListener elContextListener) {
    + weaveDelegate();
    + if (WeavingContext.isDynamic(elContextListener.getClass()))
    + elContextListener = (ELContextListener) WeavingContext.createMethodReloadingProxyFromObject(elContextListener, ELContextListener.class, ScriptingConst.ARTIFACT_TYPE_ELCONTEXTLISTENER);
    + _delegate.addELContextListener(elContextListener);
    + }
    +
    + public void removeELContextListener(ELContextListener elContextListener) {
    + weaveDelegate();
    + _delegate.removeELContextListener(elContextListener);
    + }
    +
    + public ELContextListener[] getELContextListeners() {
    + weaveDelegate();
    + return _delegate.getELContextListeners();
    + }
    +
    + public Object evaluateExpressionGet(FacesContext facesContext, String s, Class aClass) throws ELException {
    + weaveDelegate();
    + //good place for a dynamic reloading check as well
    + Object retVal = _delegate.evaluateExpressionGet(facesContext, s, aClass);
    + if (WeavingContext.isDynamic(retVal.getClass()))
    + retVal = WeavingContext.getWeaver().reloadScriptingInstance(retVal, ScriptingConst.ARTIFACT_TYPE_MANAGEDBEAN);
    + return retVal;
    + }
    +
    + public ActionListener getActionListener() {
    + weaveDelegate();
    + ActionListener retVal = _delegate.getActionListener();
    + if (WeavingContext.isDynamic(retVal.getClass()))
    + retVal = (ActionListener) WeavingContext.createMethodReloadingProxyFromObject(retVal, ActionListener.class, ScriptingConst.ARTIFACT_TYPE_ACTIONLISTENER);
    + return retVal;
    + }
    +
    + public void setActionListener(ActionListener actionListener) {
    + weaveDelegate();
    + if (WeavingContext.isDynamic(actionListener.getClass()))
    + actionListener = (ActionListener) WeavingContext.createMethodReloadingProxyFromObject(actionListener, ActionListener.class, ScriptingConst.ARTIFACT_TYPE_ACTIONLISTENER);
    + _delegate.setActionListener(actionListener);
    + }
    +
    + public Locale getDefaultLocale() {
    + weaveDelegate();
    + return _delegate.getDefaultLocale();
    + }
    +
    + public void setDefaultLocale(Locale locale) {
    + weaveDelegate();
    + _delegate.setDefaultLocale(locale);
    + }
    +
    + public String getDefaultRenderKitId() {
    + weaveDelegate();
    + return _delegate.getDefaultRenderKitId();
    + }
    +
    + public void setDefaultRenderKitId(String s) {
    + weaveDelegate();
    + _delegate.setDefaultRenderKitId(s);
    + }
    +
    + public String getMessageBundle() {
    + weaveDelegate();
    + return _delegate.getMessageBundle();
    + }
    +
    + public void setMessageBundle(String s) {
    + weaveDelegate();
    + _delegate.setMessageBundle(s);
    + }
    +
    + public NavigationHandler getNavigationHandler() {
    + weaveDelegate();
    + //defined in the setter to speed things up a little
    + NavigationHandler retVal = _delegate.getNavigationHandler();
    + if (retVal != null && WeavingContext.isDynamic(retVal.getClass()))
    + retVal = new NavigationHandlerProxy(retVal);
    + return retVal;
    + }
    +
    + public void setNavigationHandler(NavigationHandler navigationHandler) {
    + weaveDelegate();
    + if (navigationHandler != null && WeavingContext.isDynamic(navigationHandler.getClass()))
    + navigationHandler = new NavigationHandlerProxy(navigationHandler);
    + _delegate.setNavigationHandler(navigationHandler);
    + }
    +
    + @SuppressWarnings("deprecation")
    + public PropertyResolver getPropertyResolver() {
    + weaveDelegate();
    + return _delegate.getPropertyResolver();
    + }
    +
    + @SuppressWarnings("deprecation")
    + public void setPropertyResolver(PropertyResolver propertyResolver) {
    + weaveDelegate();
    + _delegate.setPropertyResolver(propertyResolver);
    + }
    +
    + @SuppressWarnings("deprecation")
    + public VariableResolver getVariableResolver() {
    + weaveDelegate();
    + VariableResolver variableResolver = _delegate.getVariableResolver();
    + if (!(variableResolver instanceof VariableResolverProxy))
    + variableResolver = new VariableResolverProxy(variableResolver);
    + return variableResolver;
    + }
    +
    + @SuppressWarnings("deprecation")
    + public void setVariableResolver(VariableResolver variableResolver) {
    + weaveDelegate();
    + if (!(variableResolver instanceof VariableResolverProxy))
    + variableResolver = new VariableResolverProxy(variableResolver);
    +
    + _delegate.setVariableResolver(variableResolver);
    + }
    +
    + public ViewHandler getViewHandler() {
    + weaveDelegate();
    + ViewHandler handler = _delegate.getViewHandler();
    +
    + /*
    + We proxy here to emable dynamic reloading for
    + methods in the long run, as soon as we hit
    + java all our groovy reloading code is lost
    + hence we have to work with proxies here
    + */
    + if (WeavingContext.isDynamic(handler.getClass()))
    + handler = new ViewHandlerProxy(handler);
    + return handler;
    + }
    +
    + public void setViewHandler(ViewHandler viewHandler) {
    + weaveDelegate();
    + /*make sure you have the delegates as well in properties*/
    + if (WeavingContext.isDynamic(viewHandler.getClass()))
    + viewHandler = new ViewHandlerProxy(viewHandler);
    +
    + _delegate.setViewHandler(viewHandler);
    + }
    +
    + public StateManager getStateManager() {
    + weaveDelegate();
    + return _delegate.getStateManager();
    + }
    +
    + public void setStateManager(StateManager stateManager) {
    + weaveDelegate();
    + _delegate.setStateManager(stateManager);
    + }
    +
    + public void addComponent(String componentType, String componentClass) {
    + weaveDelegate();
    + _delegate.addComponent(componentType, componentClass);
    + }
    +
    + public UIComponent createComponent(String s) throws FacesException {
    + weaveDelegate();
    + //the components are generated anew very often
    + //we cannot do an on object weaving here
    + UIComponent component = _delegate.createComponent(s);
    +
    + /*we are reweaving on the fly because we cannot be sure if
    + * the class is not recycled all the time in the creation
    + * code, in the renderer we do it on method base
    + * due to the fact that our renderers are recycled via
    + * a flyweight pattern*/
    + return (UIComponent) reloadInstance(component, ScriptingConst.ARTIFACT_TYPE_COMPONENT);
    + }
    +
    + @SuppressWarnings("deprecation")
    + public UIComponent createComponent(ValueBinding valueBinding, FacesContext facesContext, String s) throws FacesException {
    + weaveDelegate();
    + UIComponent component = _delegate.createComponent(valueBinding, facesContext, s);
    +
    + /*we are reweaving on the fly because we cannot be sure if
    + * the class is not recycled all the time in the creation
    + * code, in the renderer we do it on method base
    + * due to the fact that our renderers are recycled via
    + * a flyweight pattern*/
    + return (UIComponent) reloadInstance(component, ScriptingConst.ARTIFACT_TYPE_COMPONENT);
    + }
    +
    + public Iterator<String> getComponentTypes() {
    + weaveDelegate();
    + return _delegate.getComponentTypes();
    + }
    +
    + public void addConverter(String s, String s1) {
    + weaveDelegate();
    + _delegate.addConverter(s, s1);
    + }
    +
    + public void addConverter(Class aClass, String s) {
    + weaveDelegate();
    + _delegate.addConverter(aClass, s);
    + }
    +
    + public Converter createConverter(String s) {
    + weaveDelegate();
    + Converter retVal = _delegate.createConverter(s);
    + /**
    + * since createConverter is called only once
    + * we have to work with method reloading proxies
    + * we cannot use this technique extensively for speed reasons
    + * most of the time it is fine just to work with
    + *
    + * reloading objects at their interception points
    + */
    + if (WeavingContext.isDynamic(retVal.getClass())) {
    + retVal = (Converter) WeavingContext.createMethodReloadingProxyFromObject(retVal, Converter.class, ScriptingConst.ARTIFACT_TYPE_CONVERTER);
    +
    + }
    +
    + return retVal;
    + }
    +
    + public Converter createConverter(Class aClass) {
    + weaveDelegate();
    + Converter retVal = _delegate.createConverter(aClass);
    + if (retVal != null && WeavingContext.isDynamic(retVal.getClass())) {
    + retVal = (Converter) WeavingContext.createMethodReloadingProxyFromObject(retVal, Converter.class, ScriptingConst.ARTIFACT_TYPE_CONVERTER);
    + }
    +
    + return retVal;
    + }
    +
    + public Iterator<String> getConverterIds() {
    + weaveDelegate();
    + return _delegate.getConverterIds();
    + }
    +
    + public Iterator<Class> getConverterTypes() {
    + weaveDelegate();
    + return _delegate.getConverterTypes();
    + }
    +
    + @SuppressWarnings("deprecation")
    + public MethodBinding createMethodBinding(String s, Class[] classes) throws ReferenceSyntaxException {
    + weaveDelegate();
    + return _delegate.createMethodBinding(s, classes);
    + }
    +
    + public Iterator<Locale> getSupportedLocales() {
    + weaveDelegate();
    + return _delegate.getSupportedLocales();
    + }
    +
    + public void setSupportedLocales(Collection<Locale> locales) {
    + weaveDelegate();
    + _delegate.setSupportedLocales(locales);
    + }
    +
    + public void addValidator(String s, String s1) {
    + weaveDelegate();
    + _delegate.addValidator(s, s1);
    + }
    +
    + public Validator createValidator(String s) throws FacesException {
    + weaveDelegate();
    +
    + Validator retVal = _delegate.createValidator(s);
    + if (WeavingContext.isDynamic(retVal.getClass()) && !Proxy.isProxyClass(retVal.getClass())) {
    + retVal = (Validator) reloadInstance(retVal, ScriptingConst.ARTIFACT_TYPE_VALIDATOR);
    + }
    + return retVal;
    + }
    +
    + public Iterator<String> getValidatorIds() {
    + weaveDelegate();
    + return _delegate.getValidatorIds();
    + }
    +
    + @SuppressWarnings("deprecation")
    + public ValueBinding createValueBinding(String s) throws ReferenceSyntaxException {
    + weaveDelegate();
    + return _delegate.createValueBinding(s);
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +
    + private Object reloadInstance(Object instance, int artefactType) {
    + if (instance == null) {
    + return null;
    + }
    + if (WeavingContext.isDynamic(instance.getClass()) && !alreadyWovenInRequest(instance.getClass().getName())) {
    + instance = WeavingContext.getWeaver().reloadScriptingInstance(instance, artefactType);
    + alreadyWovenInRequest(instance.getClass().getName());
    + }
    + return instance;
    + }
    +
    + private boolean alreadyWovenInRequest(String clazz) {
    + //portlets now can be enabled thanks to the jsf2 indirections regarding the external context
    + Map<String,Object> reqMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
    + if (reqMap.get(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz) == null) {
    + reqMap.put(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz, "");
    + return false;
    + }
    + return true;
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,102 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.el.ELContext;
    +import javax.el.ELException;
    +import javax.el.ELResolver;
    +import java.util.Iterator;
    +
    +/**
    + * EL Resolver which is scripting enabled
    + *
    + * @author Werner Punz
    + */
    +public class ELResolverProxy extends ELResolver implements Decorated {
    +
    + ELResolver _delegate = null;
    +
    + public Object getValue(ELContext elContext, final Object base, final Object property) throws NullPointerException, ELException {
    + //request, class is loaded anew hence we already have picked up the new code
    +
    + Object retVal = _delegate.getValue(elContext, base, property);
    +
    + if (retVal != null && WeavingContext.isDynamic(retVal.getClass())) {
    + //now here we have something special which is implicit
    + //if the bean is only request scoped we dont have to reload anything
    + //so just run through this code without having anything happening here
    + //reloadScriptingInstance will return the same object we already had before
    + //the reason is for request or none scoped beans we get a new
    + //freshly reloaded and compiled instance on every request
    + //the problem starts with session application or custom scoped beans
    + //There nothing is compiled and we have to do the further bean processing
    +
    + Object newRetVal = WeavingContext.getWeaver().reloadScriptingInstance(retVal, ScriptingConst.ARTIFACT_TYPE_MANAGEDBEAN); /*once it was tainted or loaded by
    + our classloader we have to recreate all the time to avoid classloader issues*/
    + if (newRetVal != retVal) {
    + setValue(elContext, base, property, newRetVal);
    + }
    + return newRetVal;
    + }
    +
    + return retVal;
    +
    + }
    +
    + public Class<?> getType(ELContext elContext, Object o, Object o1) throws NullPointerException, ELException {
    + Class<?> retVal = _delegate.getType(elContext, o, o1);
    + if (retVal != null && WeavingContext.isDynamic(retVal)) {
    + return WeavingContext.getWeaver().reloadScriptingClass(retVal);
    + }
    + return retVal;
    + }
    +
    + public void setValue(ELContext elContext, Object base, Object property, Object newRetVal) throws NullPointerException, ELException {
    + //now to more complex relations...
    + if (base != null) {
    + WeavingContext.getRefreshContext().getDependencyRegistry().addDependency(ScriptingConst.ENGINE_TYPE_JSF_ALL, base.getClass().getName(), base.getClass().getName(), newRetVal.getClass().getName());
    + }
    + _delegate.setValue(elContext, base, property, newRetVal);
    + }
    +
    + public boolean isReadOnly(ELContext elContext, Object o, Object o1) throws NullPointerException, ELException {
    + return _delegate.isReadOnly(elContext, o, o1);
    + }
    +
    + public Iterator getFeatureDescriptors(ELContext elContext, Object o) {
    + return _delegate.getFeatureDescriptors(elContext, o);
    + }
    +
    + public Class<?> getCommonPropertyType(ELContext elContext, Object o) {
    + return _delegate.getCommonPropertyType(elContext, o);
    + }
    +
    + public ELResolverProxy(ELResolver delegate) {
    + _delegate = delegate;
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,145 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.context.FacesContext;
    +import javax.faces.context.ExternalContext;
    +import javax.faces.context.ResponseStream;
    +import javax.faces.context.ResponseWriter;
    +import javax.faces.application.Application;
    +import javax.faces.application.FacesMessage;
    +import javax.faces.render.RenderKit;
    +import javax.faces.component.UIViewRoot;
    +import javax.el.ELContext;
    +import java.util.Iterator;
    +
    +/**
    + * A reloading, weaving faces context
    + * this is needed because groovy fails on
    + * the introspection of the standard java myfaces
    + * faces context due to pending references
    + * of the _impl into the portlet context
    + * not sure if this works in portlets
    + * though
    + *
    + * @author Werner Punz
    + */
    +public class FacesContextProxy extends FacesContext implements Decorated {
    +
    + public FacesContext _delegate = null;
    +
    + private void weaveDelegate() {
    + if (_delegate != null)
    + _delegate = (FacesContext) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_FACESCONTEXT);
    + }
    +
    + public ELContext getELContext() {
    + return _delegate.getELContext();
    + }
    +
    + public Application getApplication() {
    + return _delegate.getApplication();
    + }
    +
    + public Iterator<String> getClientIdsWithMessages() {
    + return _delegate.getClientIdsWithMessages();
    + }
    +
    + public ExternalContext getExternalContext() {
    + return _delegate.getExternalContext();
    + }
    +
    + public FacesMessage.Severity getMaximumSeverity() {
    + return _delegate.getMaximumSeverity();
    + }
    +
    + public Iterator<FacesMessage> getMessages() {
    + return _delegate.getMessages();
    + }
    +
    + public Iterator<FacesMessage> getMessages(String s) {
    + return _delegate.getMessages(s);
    + }
    +
    + public RenderKit getRenderKit() {
    + return _delegate.getRenderKit();
    + }
    +
    + public boolean getRenderResponse() {
    + return _delegate.getRenderResponse();
    + }
    +
    + public boolean getResponseComplete() {
    + return _delegate.getResponseComplete();
    + }
    +
    + public ResponseStream getResponseStream() {
    + return _delegate.getResponseStream();
    + }
    +
    + public void setResponseStream(ResponseStream responseStream) {
    + _delegate.setResponseStream(responseStream);
    + }
    +
    + public ResponseWriter getResponseWriter() {
    + return _delegate.getResponseWriter();
    + }
    +
    + public void setResponseWriter(ResponseWriter responseWriter) {
    + _delegate.setResponseWriter(responseWriter);
    + }
    +
    + public UIViewRoot getViewRoot() {
    + return _delegate.getViewRoot();
    + }
    +
    + public void setViewRoot(UIViewRoot uiViewRoot) {
    + weaveDelegate();//perfect place no matter what the viewRoot is about once per request set
    + _delegate.setViewRoot(uiViewRoot);
    + }
    +
    + public void addMessage(String s, FacesMessage facesMessage) {
    + _delegate.addMessage(s, facesMessage);
    + }
    +
    + public void release() {
    + _delegate.release();
    + }
    +
    + public void renderResponse() {
    + _delegate.renderResponse();
    + }
    +
    + public void responseComplete() {
    + _delegate.responseComplete();
    + }
    +
    + public FacesContextProxy(FacesContext delegate) {
    + _delegate = delegate;
    + weaveDelegate();
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,80 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.lifecycle.Lifecycle;
    +import javax.faces.event.PhaseListener;
    +import javax.faces.context.FacesContext;
    +import javax.faces.FacesException;
    +
    +/**
    + * Scripting enabled lifecycle
    + *
    + * @author Werner Punz
    + */
    +public class LifefcycleProxy extends Lifecycle implements Decorated {
    +
    + private void weaveDelegate() {
    + if (_delegate != null)
    + _delegate = (Lifecycle) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_LIFECYCLE);
    + }
    +
    + public LifefcycleProxy(Lifecycle delegate) {
    + _delegate = delegate;
    + }
    +
    + public void addPhaseListener(PhaseListener phaseListener) {
    + weaveDelegate();
    + /*we can put our object weaving code into the add here*/
    + if (WeavingContext.isDynamic(phaseListener.getClass()))
    + phaseListener = (PhaseListener) WeavingContext.createMethodReloadingProxyFromObject(phaseListener, PhaseListener.class, ScriptingConst.ARTIFACT_TYPE_PHASELISTENER);
    +
    + _delegate.addPhaseListener(phaseListener);
    + }
    +
    + public void execute(FacesContext facesContext) throws FacesException {
    + weaveDelegate();
    + _delegate.execute(facesContext);
    + }
    +
    + public PhaseListener[] getPhaseListeners() {
    + weaveDelegate();
    + return _delegate.getPhaseListeners();
    + }
    +
    + public void removePhaseListener(PhaseListener phaseListener) {
    + weaveDelegate();
    + _delegate.removePhaseListener(phaseListener);
    + }
    +
    + public void render(FacesContext facesContext) throws FacesException {
    + weaveDelegate();
    + _delegate.render(facesContext);
    + }
    +
    + Lifecycle _delegate = null;
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/NavigationHandlerProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/NavigationHandlerProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/NavigationHandlerProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/NavigationHandlerProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,54 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.application.NavigationHandler;
    +import javax.faces.context.FacesContext;
    +
    +/**
    + * A reloading navigation handler
    + *
    + * @author Werner Punz
    + */
    +public class NavigationHandlerProxy extends NavigationHandler implements Decorated {
    +
    + private void weaveDelegate() {
    + _delegate = (NavigationHandler) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_NAVIGATIONHANDLER);
    + }
    +
    + public NavigationHandlerProxy(NavigationHandler delegate) {
    + super();
    + _delegate = delegate;
    + }
    +
    + public void handleNavigation(FacesContext facesContext, String s, String s1) {
    + weaveDelegate();
    + _delegate.handleNavigation(facesContext, s, s1);
    + }
    +
    + NavigationHandler _delegate;
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,107 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.context.FacesContext;
    +import javax.faces.context.ResponseStream;
    +import javax.faces.context.ResponseWriter;
    +import javax.faces.render.RenderKit;
    +import javax.faces.render.Renderer;
    +import javax.faces.render.ResponseStateManager;
    +import javax.servlet.ServletRequest;
    +import java.io.OutputStream;
    +import java.io.Writer;
    +
    +/**
    + * Weaving renderkit which
    + * acts as a proxy factory for
    + * our internal reloading referers
    + *
    + * @author Werner Punz
    + */
    +public class RenderkitProxy extends RenderKit implements Decorated {
    +
    + RenderKit _delegate = null;
    +
    + public RenderkitProxy(RenderKit delegate) {
    + _delegate = delegate;
    + }
    +
    + public void addRenderer(String componentFamily, String rendererType, Renderer renderer) {
    + weaveDelegate();
    + //wo do it brute force here because we have sometimes casts and hence cannot rely on proxies
    + //renderers itself are flyweight patterns which means they are shared over objects
    + renderer = (Renderer) reloadInstance(renderer, ScriptingConst.ARTIFACT_TYPE_RENDERER);
    + _delegate.addRenderer(componentFamily, rendererType, renderer);
    + }
    +
    + public Renderer getRenderer(String componentFamily, String rendererType) {
    + weaveDelegate();
    + return (Renderer) reloadInstance(_delegate.getRenderer(componentFamily, rendererType), ScriptingConst.ARTIFACT_TYPE_RENDERER);
    + }
    +
    + public ResponseStateManager getResponseStateManager() {
    + weaveDelegate();
    + return _delegate.getResponseStateManager();
    + }
    +
    + public ResponseWriter createResponseWriter(Writer writer, String s, String s1) {
    + weaveDelegate();
    + return (ResponseWriter) reloadInstance(_delegate.createResponseWriter(writer, s, s1), ScriptingConst.ARTIFACT_TYPE_RESPONSEWRITER);
    + }
    +
    + public ResponseStream createResponseStream(OutputStream outputStream) {
    + weaveDelegate();
    + return (ResponseStream) reloadInstance(_delegate.createResponseStream(outputStream), ScriptingConst.ARTIFACT_TYPE_RESPONSESTREAM);
    + }
    +
    + public Object getDelegate() {
    + return _delegate;
    + }
    +
    + private final void weaveDelegate() {
    + _delegate = (RenderKit) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_RENDERKIT);
    + }
    +
    + private final Object reloadInstance(Object instance, int artefactType) {
    + if (instance == null) {
    + return null;
    + }
    + if (WeavingContext.isDynamic(instance.getClass()) && !alreadyWovenInRequest(instance.getClass().getName())) {
    + instance = WeavingContext.getWeaver().reloadScriptingInstance(instance, artefactType);
    + alreadyWovenInRequest(instance.getClass().getName());
    + }
    + return instance;
    + }
    +
    + private final boolean alreadyWovenInRequest(String clazz) {
    + //portlets now can be enabled thanks to the jsf2 indirections regarding the external context
    + ServletRequest req = (ServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
    + if (req.getAttribute(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz) == null) {
    + req.setAttribute(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz, "");
    + return false;
    + }
    + return true;
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,53 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.el.*;
    +
    +import javax.faces.context.FacesContext;
    +
    +/**
    + * objects loaded must
    + * be checked if a reloading is needed
    + *
    + * @author Werner Punz
    + */
    +@SuppressWarnings("deprecation")
    +public class VariableResolverProxy extends VariableResolver implements Decorated {
    + VariableResolver _delegate;
    +
    + public VariableResolverProxy(VariableResolver delegate) {
    + _delegate = delegate;
    + }
    +
    + public Object resolveVariable(FacesContext facesContext, String s) throws EvaluationException {
    + Object variable = _delegate.resolveVariable(facesContext, s);
    + if (variable != null && WeavingContext.isDynamic(variable.getClass()))
    + variable = WeavingContext.getWeaver().reloadScriptingInstance(variable, ScriptingConst.ARTIFACT_TYPE_MANAGEDBEAN);
    + return variable;
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,104 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.application.ViewHandler;
    +import javax.faces.context.FacesContext;
    +import javax.faces.component.UIViewRoot;
    +import javax.faces.FacesException;
    +import java.util.Locale;
    +import java.io.IOException;
    +
    +/**
    + * Scripting enabled View Handler
    + *
    + * @author Werner Punz
    + */
    +public class ViewHandlerProxy extends ViewHandler implements Decorated {
    +
    + ViewHandler _delegate = null;
    +
    + private void weaveDelegate() {
    + if (_delegate != null) {
    + _delegate = (ViewHandler) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_VIEWHANDLER);
    + }
    + }
    +
    + public ViewHandlerProxy(ViewHandler delegate) {
    + _delegate = delegate;
    + }
    +
    + public String calculateCharacterEncoding(FacesContext facesContext) {
    + weaveDelegate();
    + return _delegate.calculateCharacterEncoding(facesContext);
    + }
    +
    + public Locale calculateLocale(FacesContext facesContext) {
    + weaveDelegate();
    + return _delegate.calculateLocale(facesContext);
    + }
    +
    + public String calculateRenderKitId(FacesContext facesContext) {
    + weaveDelegate();
    + return _delegate.calculateRenderKitId(facesContext);
    + }
    +
    + public UIViewRoot createView(FacesContext facesContext, String s) {
    + weaveDelegate();
    + return _delegate.createView(facesContext, s);
    + }
    +
    + public String getActionURL(FacesContext facesContext, String s) {
    + weaveDelegate();
    + return _delegate.getActionURL(facesContext, s);
    + }
    +
    + public String getResourceURL(FacesContext facesContext, String s) {
    + weaveDelegate();
    + return _delegate.getResourceURL(facesContext, s);
    + }
    +
    + public void initView(FacesContext facesContext) throws FacesException {
    + weaveDelegate();
    + _delegate.initView(facesContext);
    + }
    +
    + public void renderView(FacesContext facesContext, UIViewRoot uiViewRoot) throws IOException, FacesException {
    + weaveDelegate();
    + _delegate.renderView(facesContext, uiViewRoot);
    + }
    +
    + public UIViewRoot restoreView(FacesContext facesContext, String s) {
    + weaveDelegate();
    + return _delegate.restoreView(facesContext, s);
    + }
    +
    + public void writeState(FacesContext facesContext) throws IOException {
    + weaveDelegate();
    + _delegate.writeState(facesContext);
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/resources/META-INF/faces-config.xml
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/resources/META-INF/faces-config.xml?rev=933379&r1=933378&r2=933379&view=diff
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/resources/META-INF/faces-config.xml (original)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/resources/META-INF/faces-config.xml Mon Apr 12 19:43:30 2010
    @@ -29,44 +29,44 @@
    issue is we have to make a codeweaving for every bean created
    -->
    <application-factory>
    - org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingApplicationFactory
    + org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.factories.ScriptingApplicationFactory
    </application-factory>
    <faces-context-factory>
    - org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingFacesContextFactory
    + org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.factories.ScriptingFacesContextFactory
    </faces-context-factory>
    <lifecycle-factory>
    - org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingLifecycleFactory
    + org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.factories.ScriptingLifecycleFactory
    </lifecycle-factory>
    <render-kit-factory>
    - org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingRenderkitFactory
    + org.apache.myfaces.extensions.scripting.jsf.dynamicdecorators.factories.ScriptingRenderkitFactory
    </render-kit-factory>
    </factory>

    <lifecycle>
    - <phase-listener>org.apache.myfaces.scripting.jsf.RefreshPhaseListener</phase-listener>
    + <phase-listener>org.apache.myfaces.extensions.scripting.jsf.RefreshPhaseListener</phase-listener>
    </lifecycle>

    <component>
    - <component-type>org.apache.myfaces.scripting.components.CompilerComponent</component-type>
    - <component-class>org.apache.myfaces.scripting.components.CompilerComponent</component-class>
    + <component-type>org.apache.myfaces.extensions.scripting.components.CompilerComponent</component-type>
    + <component-class>org.apache.myfaces.extensions.scripting.components.CompilerComponent</component-class>
    </component>

    <component>
    - <component-type>org.apache.myfaces.scripting.components.TaintHistory</component-type>
    - <component-class>org.apache.myfaces.scripting.components.TaintHistory</component-class>
    + <component-type>org.apache.myfaces.extensions.scripting.components.TaintHistory</component-type>
    + <component-class>org.apache.myfaces.extensions.scripting.components.TaintHistory</component-class>
    </component>


    <render-kit>
    <renderer>
    <component-family>javax.faces.Output</component-family>
    - <renderer-type>org.apache.myfaces.scripting.components.CompilerComponentRenderer</renderer-type>
    - <renderer-class>org.apache.myfaces.scripting.components.CompilerComponentRenderer</renderer-class>
    + <renderer-type>org.apache.myfaces.extensions.scripting.components.CompilerComponentRenderer</renderer-type>
    + <renderer-class>org.apache.myfaces.extensions.scripting.components.CompilerComponentRenderer</renderer-class>
    </renderer>
    <renderer>
    <component-family>javax.faces.Output</component-family>
    - <renderer-type>org.apache.myfaces.scripting.components.TaintHistoryRenderer</renderer-type>
    - <renderer-class>org.apache.myfaces.scripting.components.TaintHistoryRenderer</renderer-class>
    + <renderer-type>org.apache.myfaces.extensions.scripting.components.TaintHistoryRenderer</renderer-type>
    + <renderer-class>org.apache.myfaces.extensions.scripting.components.TaintHistoryRenderer</renderer-class>
    </renderer>

    </render-kit>

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/faces-config.NavData
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/faces-config.NavData?rev=933379&view=auto
    ==============================================================================
    (empty)

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/BehaviorHandlerReloadingStrategy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/BehaviorHandlerReloadingStrategy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/BehaviorHandlerReloadingStrategy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/BehaviorHandlerReloadingStrategy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,68 @@
    +/*
    + * 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.extensions.scripting.facelet;
    +
    +import org.apache.myfaces.extensions.scripting.api.ScriptingWeaver;
    +import org.apache.myfaces.extensions.scripting.core.reloading.SimpleReloadingStrategy;
    +import org.apache.myfaces.extensions.scripting.core.util.Cast;
    +import org.apache.myfaces.extensions.scripting.core.util.ReflectUtil;
    +
    +import javax.faces.view.facelets.BehaviorConfig;
    +import javax.faces.view.facelets.BehaviorHandler;
    +import javax.faces.view.facelets.ComponentHandler;
    +
    +/**
    + * The reloading strategy for our behavior tag handlers
    + * note since we do not have an official api we must
    + * enforce a getConverterConfig() method to allow
    + * the reloading of converter tag handlers
    + *
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class BehaviorHandlerReloadingStrategy extends SimpleReloadingStrategy {
    + public BehaviorHandlerReloadingStrategy(ScriptingWeaver weaver) {
    + super(weaver);
    + }
    +
    + @Override
    + public Object reload(Object scriptingInstance, int artifactType) {
    + if (!(scriptingInstance instanceof ComponentHandler)) return scriptingInstance;
    + Class aclass = _weaver.reloadScriptingClass(scriptingInstance.getClass());
    + if (aclass.hashCode() == scriptingInstance.getClass().hashCode()) {
    + //class of this object has not changed although
    + // reload is enabled we can skip the rest now
    + return scriptingInstance;
    + }
    + BehaviorHandler oldHandler = (BehaviorHandler) scriptingInstance;
    + /**
    + *
    + */
    + BehaviorConfig config = (BehaviorConfig) ReflectUtil.executeMethod(oldHandler, "getBehaviorConfig");
    + BehaviorHandler newHandler = (BehaviorHandler) ReflectUtil.instantiate(aclass, new Cast(BehaviorConfig.class, config));
    +
    + //save all pending non config related properties wherever possible
    + super.mapProperties(newHandler, oldHandler);
    +
    + return newHandler;
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ComponentHandlerReloadingStrategy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ComponentHandlerReloadingStrategy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ComponentHandlerReloadingStrategy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ComponentHandlerReloadingStrategy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,60 @@
    +/*
    + * 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.extensions.scripting.facelet;
    +
    +import org.apache.myfaces.extensions.scripting.api.ScriptingWeaver;
    +import org.apache.myfaces.extensions.scripting.core.reloading.SimpleReloadingStrategy;
    +import org.apache.myfaces.extensions.scripting.core.util.Cast;
    +import org.apache.myfaces.extensions.scripting.core.util.ReflectUtil;
    +
    +import javax.faces.view.facelets.ComponentConfig;
    +import javax.faces.view.facelets.ComponentHandler;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class ComponentHandlerReloadingStrategy extends SimpleReloadingStrategy {
    +
    + public ComponentHandlerReloadingStrategy(ScriptingWeaver weaver) {
    + super(weaver);
    + }
    +
    + @Override
    + public Object reload(Object scriptingInstance, int artifactType) {
    + if (!(scriptingInstance instanceof ComponentHandler)) return scriptingInstance;
    + Class aclass = _weaver.reloadScriptingClass(scriptingInstance.getClass());
    + if (aclass.hashCode() == scriptingInstance.getClass().hashCode()) {
    + //class of this object has not changed although
    + // reload is enabled we can skip the rest now
    + return scriptingInstance;
    + }
    + ComponentHandler oldHandler = (ComponentHandler) scriptingInstance;
    + ComponentConfig config = oldHandler.getComponentConfig();
    + ComponentHandler newHandler = (ComponentHandler) ReflectUtil.instantiate(aclass, new Cast(ComponentConfig.class, config));
    +
    + //save all pending non config related properties wherever possible
    + super.mapProperties(newHandler, oldHandler);
    +
    + return newHandler;
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ConverterHandlerReloadingStrategy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ConverterHandlerReloadingStrategy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ConverterHandlerReloadingStrategy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ConverterHandlerReloadingStrategy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,67 @@
    +/*
    + * 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.extensions.scripting.facelet;
    +
    +import org.apache.myfaces.extensions.scripting.api.ScriptingWeaver;
    +import org.apache.myfaces.extensions.scripting.core.reloading.SimpleReloadingStrategy;
    +import org.apache.myfaces.extensions.scripting.core.util.Cast;
    +import org.apache.myfaces.extensions.scripting.core.util.ReflectUtil;
    +
    +import javax.faces.view.facelets.*;
    +
    +/**
    + * The reloading strategy for our converter tag handlers
    + * note since we do not have an official api we must
    + * enforce a getConverterConfig() method to allow
    + * the reloading of converter tag handlers
    + *
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +@SuppressWarnings("unused")//used dynamically
    +public class ConverterHandlerReloadingStrategy extends SimpleReloadingStrategy {
    +
    + public ConverterHandlerReloadingStrategy(ScriptingWeaver weaver) {
    + super(weaver);
    + }
    +
    + @Override
    + public Object reload(Object scriptingInstance, int artifactType) {
    + if (!(scriptingInstance instanceof ComponentHandler)) return scriptingInstance;
    + Class aclass = _weaver.reloadScriptingClass(scriptingInstance.getClass());
    + if (aclass.hashCode() == scriptingInstance.getClass().hashCode()) {
    + //class of this object has not changed although
    + // reload is enabled we can skip the rest now
    + return scriptingInstance;
    + }
    + ConverterHandler oldHandler = (ConverterHandler) scriptingInstance;
    + /**
    + *
    + */
    + ConverterConfig config = (ConverterConfig) ReflectUtil.executeMethod(oldHandler, "getConverterConfig");
    + ConverterHandler newHandler = (ConverterHandler) ReflectUtil.instantiate(aclass, new Cast(ConverterConfig.class, config));
    +
    + //save all pending non config related properties wherever possible
    + super.mapProperties(newHandler, oldHandler);
    +
    + return newHandler;
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingBehaviorTagHandlerDelegate.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingBehaviorTagHandlerDelegate.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingBehaviorTagHandlerDelegate.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingBehaviorTagHandlerDelegate.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,67 @@
    +/*
    + * 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.extensions.scripting.facelet;
    +
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.view.facelets.tag.jsf.BehaviorTagHandlerDelegate;
    +
    +import javax.faces.component.UIComponent;
    +import javax.faces.view.facelets.*;
    +import java.io.IOException;
    +
    +/**
    + * Behavior Tag Handler which introduces reloading behavior
    + *
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class ReloadingBehaviorTagHandlerDelegate extends TagHandlerDelegate {
    +
    + BehaviorHandler _owner;
    + TagHandlerDelegate _delegate;
    +
    + public ReloadingBehaviorTagHandlerDelegate(BehaviorHandler owner) {
    + applyOwner(owner);
    + }
    +
    + private void applyOwner(BehaviorHandler owner) {
    + _owner = owner;
    + _delegate = new BehaviorTagHandlerDelegate(_owner);
    + }
    +
    + @Override
    + public void apply(FaceletContext ctx, UIComponent comp) throws IOException {
    + if (WeavingContext.isDynamic(_owner.getClass())) {
    + BehaviorHandler newOwner = (BehaviorHandler) WeavingContext.getWeaver().reloadScriptingInstance(_owner, ScriptingConst.ARTIFACT_TYPE_BEHAVIOR_HANDLER);
    + if (!newOwner.getClass().equals(_owner.getClass())) {
    + applyOwner(newOwner);
    + }
    + }
    + _owner.apply(ctx, comp);
    + }
    +
    + @Override
    + public MetaRuleset createMetaRuleset(Class type) {
    + return _delegate.createMetaRuleset(type);
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingComponentTagHandlerDelegate.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingComponentTagHandlerDelegate.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingComponentTagHandlerDelegate.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingComponentTagHandlerDelegate.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,104 @@
    +/*
    + * 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.extensions.scripting.facelet;
    +
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.extensions.scripting.facelet.support.ComponentRule;
    +import org.apache.myfaces.extensions.scripting.facelet.support.SwitchingMetarulesetImpl;
    +import org.apache.myfaces.view.facelets.tag.jsf.*;
    +
    +import javax.faces.component.ActionSource;
    +import javax.faces.component.EditableValueHolder;
    +import javax.faces.component.UIComponent;
    +import javax.faces.component.ValueHolder;
    +import javax.faces.view.facelets.*;
    +import javax.faces.view.facelets.ComponentHandler;
    +import java.io.IOException;
    +
    +/**
    + * we provide our own component tag handler factory impl
    + * so that we can deal with refreshing of components
    + * on Facelets level without running into
    + * nasty type exceptions
    + */
    +public class ReloadingComponentTagHandlerDelegate extends TagHandlerDelegate {
    +
    + ComponentHandler _owner;
    + TagHandlerDelegate _delegate;
    +
    + public ReloadingComponentTagHandlerDelegate(ComponentHandler owner) {
    + applyOwner(owner);
    + }
    +
    + private void applyOwner(ComponentHandler owner) {
    + _owner = owner;
    + _delegate = new ComponentTagHandlerDelegate(_owner);
    + }
    +
    + @Override
    + public void apply(FaceletContext ctx, UIComponent comp) throws IOException {
    + if (WeavingContext.isDynamic(_owner.getClass())) {
    + ComponentHandler newOwner = (ComponentHandler) WeavingContext.getWeaver().reloadScriptingInstance(_owner, ScriptingConst.ARTIFACT_TYPE_COMPONENT_HANDLER);
    + if (!newOwner.getClass().equals(_owner.getClass())) {
    + applyOwner(newOwner);
    + }
    + }
    + _delegate.apply(ctx, comp);
    + }
    +
    + public MetaRuleset createMetaRuleset(Class type) {
    + //We have to create a different meta rule set for dynamic classes
    + //which have weaver instantiation criteria, the original meta rule set
    + //first applies the attributes and then calls BeanPropertyTagRule
    + //that one however caches the current method and does not take into consideration
    + //that classes can be changed on the fly
    +
    + // if (WeavingContext.isDynamic(type)) {
    + MetaRuleset m = new SwitchingMetarulesetImpl(_owner.getTag(), type);
    + // ignore standard component attributes
    + m.ignore("binding").ignore("id");
    +
    + // add auto wiring for attributes
    + m.addRule(ComponentRule.Instance);
    +
    + // if it's an ActionSource
    + if (ActionSource.class.isAssignableFrom(type)) {
    + m.addRule(ActionSourceRule.Instance);
    + }
    +
    + // if it's a ValueHolder
    + if (ValueHolder.class.isAssignableFrom(type)) {
    + m.addRule(ValueHolderRule.Instance);
    +
    + // if it's an EditableValueHolder
    + if (EditableValueHolder.class.isAssignableFrom(type)) {
    + m.ignore("submittedValue");
    + m.ignore("valid");
    + m.addRule(EditableValueHolderRule.Instance);
    + }
    + }
    +
    + return m;
    + //}
    +
    + //return _delegate.createMetaRuleset(type);
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingConverterTagHandlerDelegate.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingConverterTagHandlerDelegate.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingConverterTagHandlerDelegate.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingConverterTagHandlerDelegate.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,65 @@
    +/*
    + * 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.extensions.scripting.facelet;
    +
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.view.facelets.tag.jsf.ConverterTagHandlerDelegate;
    +
    +import javax.faces.component.UIComponent;
    +import javax.faces.view.facelets.*;
    +import java.io.IOException;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class ReloadingConverterTagHandlerDelegate extends TagHandlerDelegate {
    +
    + ConverterHandler _owner;
    + TagHandlerDelegate _delegate;
    +
    + public ReloadingConverterTagHandlerDelegate(ConverterHandler owner) {
    + applyOwner(owner);
    + }
    +
    + private void applyOwner(ConverterHandler owner) {
    + _owner = owner;
    + _delegate = new ConverterTagHandlerDelegate(_owner);
    + }
    +
    + @Override
    + public void apply(FaceletContext ctx, UIComponent comp) throws IOException {
    + if (WeavingContext.isDynamic(_owner.getClass())) {
    + ConverterHandler newOwner = (ConverterHandler) WeavingContext.getWeaver().reloadScriptingInstance(_owner, ScriptingConst.ARTIFACT_TYPE_CONVERTER_HANDLER);
    + if(!newOwner.getClass().equals(_owner.getClass())) {
    + applyOwner(newOwner);
    + }
    + }
    + _delegate.apply(ctx, comp);
    + }
    +
    + @Override
    + public MetaRuleset createMetaRuleset(Class type) {
    + return _delegate.createMetaRuleset(type);
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingValidatorTagHandlerDelegate.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingValidatorTagHandlerDelegate.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingValidatorTagHandlerDelegate.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReloadingValidatorTagHandlerDelegate.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,67 @@
    +/*
    + * 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.extensions.scripting.facelet;
    +
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.view.facelets.tag.jsf.ValidatorTagHandlerDelegate;
    +
    +import javax.faces.component.UIComponent;
    +import javax.faces.view.facelets.FaceletContext;
    +import javax.faces.view.facelets.MetaRuleset;
    +import javax.faces.view.facelets.TagHandlerDelegate;
    +import javax.faces.view.facelets.ValidatorHandler;
    +import java.io.IOException;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class ReloadingValidatorTagHandlerDelegate extends TagHandlerDelegate {
    +
    + ValidatorHandler _owner;
    + TagHandlerDelegate _delegate;
    +
    + public ReloadingValidatorTagHandlerDelegate(ValidatorHandler owner) {
    + applyOwner(owner);
    + }
    +
    + private void applyOwner(ValidatorHandler owner) {
    + _owner = owner;
    + _delegate = new ValidatorTagHandlerDelegate(_owner);
    + }
    +
    + @Override
    + public void apply(FaceletContext ctx, UIComponent comp) throws IOException {
    + if (WeavingContext.isDynamic(_owner.getClass())) {
    + ValidatorHandler newOwner = (ValidatorHandler) WeavingContext.getWeaver().reloadScriptingInstance(_owner, ScriptingConst.ARTIFACT_TYPE_VALIDATOR_HANDLER);
    + if (!newOwner.getClass().equals(_owner.getClass())) {
    + applyOwner(newOwner);
    + }
    + }
    + _owner.apply(ctx, comp);
    + }
    +
    + @Override
    + public MetaRuleset createMetaRuleset(Class type) {
    + return _delegate.createMetaRuleset(type);
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReroutingResourceResolver.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReroutingResourceResolver.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReroutingResourceResolver.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ReroutingResourceResolver.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,46 @@
    +package org.apache.myfaces.extensions.scripting.facelet;
    +
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.view.facelets.impl.DefaultResourceResolver;
    +
    +import java.io.File;
    +import java.net.MalformedURLException;
    +import java.net.URL;
    +import java.util.List;
    +import java.util.logging.Level;
    +import java.util.logging.Logger;
    +
    +/**
    + * decorated Facelet resource resolver to reroute
    + * the resource requests to our source path if possible
    + */
    +public class ReroutingResourceResolver extends DefaultResourceResolver {
    +
    + DefaultResourceResolver _delegate = new DefaultResourceResolver();
    + volatile boolean _initiated = false;
    + List<String> _resourceDirs = null;
    +
    + Logger log = Logger.getLogger(this.getClass().getName());
    +
    + @Override
    + public URL resolveUrl(String path) {
    +
    + if (!_initiated) {
    + _resourceDirs = WeavingContext.getConfiguration().getResourceDirs();
    + _initiated = true;
    + }
    +
    + if (_resourceDirs != null && !_resourceDirs.isEmpty()) {
    + for (String resourceDir : _resourceDirs) {
    + File resource = new File(resourceDir + path);
    + if (resource.exists()) try {
    + return resource.toURI().toURL();
    + } catch (MalformedURLException e) {
    + log.log(Level.SEVERE, "",e);
    + }
    + }
    + }
    +
    + return _delegate.resolveUrl(path);
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/TagHandlerDelegateFactoryImpl.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/TagHandlerDelegateFactoryImpl.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/TagHandlerDelegateFactoryImpl.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/TagHandlerDelegateFactoryImpl.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,72 @@
    +/*
    + * 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.extensions.scripting.facelet;
    +
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.view.facelets.tag.jsf.BehaviorTagHandlerDelegate;
    +import org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate;
    +import org.apache.myfaces.view.facelets.tag.jsf.ConverterTagHandlerDelegate;
    +import org.apache.myfaces.view.facelets.tag.jsf.ValidatorTagHandlerDelegate;
    +
    +import javax.faces.view.facelets.*;
    +
    +/**
    + * Tag handler delegate factory which injects reloading
    + * proxies for our facelet artifacts
    + */
    +public class TagHandlerDelegateFactoryImpl extends TagHandlerDelegateFactory {
    +
    + @Override
    + public TagHandlerDelegate createBehaviorHandlerDelegate(
    + BehaviorHandler owner) {
    + if (WeavingContext.isDynamic(owner.getClass())) {
    + return new ReloadingBehaviorTagHandlerDelegate(owner);
    + } else {
    + return new BehaviorTagHandlerDelegate(owner);
    + }
    + }
    +
    + @Override
    + public TagHandlerDelegate createComponentHandlerDelegate(
    + ComponentHandler owner) {
    + return new ReloadingComponentTagHandlerDelegate(owner);
    + }
    +
    + @Override
    + public TagHandlerDelegate createConverterHandlerDelegate(
    + ConverterHandler owner) {
    + if (WeavingContext.isDynamic(owner.getClass())) {
    + return new ReloadingConverterTagHandlerDelegate(owner);
    + } else {
    + return new ConverterTagHandlerDelegate(owner);
    + }
    + }
    +
    + @Override
    + public TagHandlerDelegate createValidatorHandlerDelegate(
    + ValidatorHandler owner) {
    + if (WeavingContext.isDynamic(owner.getClass())) {
    + return new ReloadingValidatorTagHandlerDelegate(owner);
    + } else {
    + return new ValidatorTagHandlerDelegate(owner);
    + }
    + }
    +}
    +

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ValidatorHandlerReloadingStrategy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ValidatorHandlerReloadingStrategy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ValidatorHandlerReloadingStrategy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/facelet/ValidatorHandlerReloadingStrategy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,60 @@
    +/*
    + * 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.extensions.scripting.facelet;
    +
    +import org.apache.myfaces.extensions.scripting.api.ScriptingWeaver;
    +import org.apache.myfaces.extensions.scripting.core.reloading.SimpleReloadingStrategy;
    +import org.apache.myfaces.extensions.scripting.core.util.Cast;
    +import org.apache.myfaces.extensions.scripting.core.util.ReflectUtil;
    +
    +import javax.faces.view.facelets.*;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class ValidatorHandlerReloadingStrategy extends SimpleReloadingStrategy {
    +
    + public ValidatorHandlerReloadingStrategy(ScriptingWeaver weaver) {
    + super(weaver);
    + }
    +
    + @Override
    + public Object reload(Object scriptingInstance, int artifactType) {
    + if (!(scriptingInstance instanceof ComponentHandler)) return scriptingInstance;
    + Class aclass = _weaver.reloadScriptingClass(scriptingInstance.getClass());
    + if (aclass.hashCode() == scriptingInstance.getClass().hashCode()) {
    + //class of this object has not changed although
    + // reload is enabled we can skip the rest now
    + return scriptingInstance;
    + }
    + ValidatorHandler oldHandler = (ValidatorHandler) scriptingInstance;
    + ValidatorConfig config = oldHandler.getValidatorConfig();
    + ValidatorHandler newHandler = (ValidatorHandler) ReflectUtil.instantiate(aclass, new Cast(ValidatorConfig.class, config));
    +
    + //save all pending non config related properties wherever possible
    + super.mapProperties(newHandler, oldHandler);
    +
    + return newHandler;
    + }
    +
    +}
    +
  • Werpu at Apr 12, 2010 at 7:44 pm
    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,194 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.extensions.scripting.jsf2.annotation.purged.PurgedRenderer;
    +import org.apache.myfaces.extensions.scripting.jsf2.annotation.purged.PurgedClientBehaviorRenderer;
    +
    +import javax.faces.context.FacesContext;
    +import javax.faces.render.RenderKit;
    +import javax.faces.render.Renderer;
    +import javax.faces.render.ResponseStateManager;
    +import javax.faces.render.ClientBehaviorRenderer;
    +import javax.faces.context.ResponseWriter;
    +import javax.faces.context.ResponseStream;
    +import javax.faces.FacesException;
    +import java.io.Writer;
    +import java.io.OutputStream;
    +import java.util.Iterator;
    +import java.util.Map;
    +
    +/**
    + * Weaving renderkit which
    + * acts as a proxy factory for
    + * our internal reloading referers
    + *
    + * @author Werner Punz
    + */
    +public class RenderkitProxy extends RenderKit implements Decorated {
    +
    + RenderKit _delegate = null;
    +
    + public RenderkitProxy(RenderKit delegate) {
    + _delegate = delegate;
    + }
    +
    + public void addRenderer(String componentFamily, String rendererType, Renderer renderer) {
    + weaveDelegate();
    + //wo do it brute force here because we have sometimes casts and hence cannot rely on proxies
    + //renderers itself are flyweight patterns which means they are shared over objects
    +
    + renderer = (Renderer) reloadInstance(renderer, ScriptingConst.ARTIFACT_TYPE_RENDERER);
    +
    + _delegate.addRenderer(componentFamily, rendererType, renderer);
    + }
    +
    + public Renderer getRenderer(String componentFamily, String rendererType) {
    + weaveDelegate();
    + Renderer rendr = _delegate.getRenderer(componentFamily, rendererType);
    + Renderer rendr2 = (Renderer) reloadInstance(rendr, ScriptingConst.ARTIFACT_TYPE_RENDERER);
    + if (rendr != rendr2) {
    + Renderer tempRenderer = _delegate.getRenderer(componentFamily, rendererType);
    + if (tempRenderer instanceof PurgedRenderer) {
    + return handleAnnotationChange(componentFamily, rendererType);
    + }
    +
    + _delegate.addRenderer(componentFamily, rendererType, rendr2);
    + return rendr2;
    + }
    + return rendr;
    + }
    +
    +
    + private ClientBehaviorRenderer handleAnnotationChangeBehaviorRenderer(String s) {
    + ClientBehaviorRenderer rendr2;
    +
    + rendr2 = _delegate.getClientBehaviorRenderer(s);
    + if (rendr2 instanceof PurgedClientBehaviorRenderer) {
    + throw new FacesException("Renderer not found");
    + }
    + rendr2 = _delegate.getClientBehaviorRenderer(s);
    + return rendr2;
    + }
    +
    + private Renderer handleAnnotationChange(String s, String s1) {
    + Renderer rendr2;
    +
    + //WeavingContext.getWeaver().fullClassScan();
    + rendr2 = _delegate.getRenderer(s, s1);
    + if (rendr2 instanceof PurgedRenderer) {
    + throw new FacesException("Renderer not found");
    + }
    + rendr2 = _delegate.getRenderer(s, s1);
    + return rendr2;
    + }
    +
    + public ResponseStateManager getResponseStateManager() {
    + weaveDelegate();
    + return _delegate.getResponseStateManager();
    + }
    +
    + public ResponseWriter createResponseWriter(Writer writer, String s, String s1) {
    + weaveDelegate();
    + return (ResponseWriter) reloadInstance(_delegate.createResponseWriter(writer, s, s1), ScriptingConst.ARTIFACT_TYPE_RESPONSEWRITER);
    + }
    +
    + public ResponseStream createResponseStream(OutputStream outputStream) {
    + weaveDelegate();
    + return (ResponseStream) reloadInstance(_delegate.createResponseStream(outputStream), ScriptingConst.ARTIFACT_TYPE_RESPONSESTREAM);
    + }
    +
    +
    + @Override
    + public void addClientBehaviorRenderer(String s, ClientBehaviorRenderer renderer) {
    +
    + weaveDelegate();
    + renderer = (ClientBehaviorRenderer) reloadInstance(renderer, ScriptingConst.ARTIFACT_TYPE_CLIENTBEHAVIORRENDERER);
    + _delegate.addClientBehaviorRenderer(s, renderer);
    + }
    +
    + @Override
    + public ClientBehaviorRenderer getClientBehaviorRenderer(String s) {
    + weaveDelegate();
    + ClientBehaviorRenderer rendr = _delegate.getClientBehaviorRenderer(s);
    + ClientBehaviorRenderer rendr2 = (ClientBehaviorRenderer) reloadInstance(rendr, ScriptingConst.ARTIFACT_TYPE_CLIENTBEHAVIORRENDERER);
    + if (rendr != rendr2) {
    +
    + rendr2 = _delegate.getClientBehaviorRenderer(s);
    + if (rendr2 instanceof PurgedClientBehaviorRenderer) {
    + return handleAnnotationChangeBehaviorRenderer(s);
    + }
    + return rendr2;
    + }
    + return rendr;
    + }
    +
    + @Override
    + public Iterator<String> getClientBehaviorRendererTypes() {
    + weaveDelegate();
    + return _delegate.getClientBehaviorRendererTypes();
    + }
    +
    + @Override
    + public Iterator<String> getComponentFamilies() {
    + weaveDelegate();
    + return _delegate.getComponentFamilies();
    + }
    +
    + @Override
    + public Iterator<String> getRendererTypes(String s) {
    + weaveDelegate();
    + return _delegate.getRendererTypes(s);
    + }
    +
    + public Object getDelegate() {
    + return _delegate;
    + }
    +
    + private void weaveDelegate() {
    + _delegate = (RenderKit) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_RENDERKIT);
    + }
    +
    + private Object reloadInstance(Object instance, int artefactType) {
    + if (instance == null) {
    + return null;
    + }
    + if (WeavingContext.isDynamic(instance.getClass()) && !alreadyWovenInRequest(instance.getClass().getName())) {
    + alreadyWovenInRequest(instance.getClass().getName());
    + instance = WeavingContext.getWeaver().reloadScriptingInstance(instance, artefactType);
    +
    + //now the add should be done properly if possible
    + }
    + return instance;
    + }
    +
    + private boolean alreadyWovenInRequest(String clazz) {
    + //portlets now can be enabled thanks to the jsf2 indirections regarding the external context
    + Map<String, Object> req = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
    + if (req.get(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz) == null) {
    + req.put(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz, "");
    + return false;
    + }
    + return true;
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ResourceHandlerProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ResourceHandlerProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ResourceHandlerProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ResourceHandlerProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,76 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +
    +import javax.faces.application.Resource;
    +import javax.faces.application.ResourceHandler;
    +import javax.faces.context.FacesContext;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class ResourceHandlerProxy extends ResourceHandler {
    + private ResourceHandler _delegate;
    +
    + public ResourceHandlerProxy(ResourceHandler delegate) {
    + _delegate = delegate;
    + }
    +
    + public Resource createResource(String resourceName) {
    + weaveDelegate();
    + return _delegate.createResource(resourceName);
    + }
    +
    + public Resource createResource(String resourceName, String libraryName) {
    + weaveDelegate();
    + return _delegate.createResource(resourceName, libraryName);
    + }
    +
    + public Resource createResource(String resourceName, String libraryName, String contentType) {
    + weaveDelegate();
    + return _delegate.createResource(resourceName, libraryName, contentType);
    + }
    +
    + public String getRendererTypeForResourceName(String resourceName) {
    + weaveDelegate();
    + return _delegate.getRendererTypeForResourceName(resourceName);
    + }
    +
    + public void handleResourceRequest(FacesContext context) throws java.io.IOException {
    + weaveDelegate();
    + _delegate.handleResourceRequest(context);
    + }
    +
    + public boolean isResourceRequest(FacesContext context) {
    + return _delegate.isResourceRequest(context);
    + }
    +
    + public boolean libraryExists(String libraryName) {
    + return _delegate.libraryExists(libraryName);
    + }
    +
    + private final void weaveDelegate() {
    + _delegate = (ResourceHandler) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_RESOURCEHANDLER);
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/SystemEventListenerProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/SystemEventListenerProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/SystemEventListenerProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/SystemEventListenerProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,68 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.event.SystemEvent;
    +import javax.faces.event.SystemEventListener;
    +
    +/**
    + * a method level reloading proxy class
    + * we do not use auto proxies here because
    + * this class needs special treatment
    + * over our decorated interface
    + *
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class SystemEventListenerProxy implements Decorated, SystemEventListener {
    +
    + SystemEventListener _delegate;
    +
    + public SystemEventListenerProxy(SystemEventListener delegate) {
    + _delegate = delegate;
    + }
    +
    + public boolean isListenerForSource(Object source) {
    + weaveDelegate();
    + return _delegate.isListenerForSource(source);
    + }
    +
    + public void processEvent(SystemEvent event) {
    + weaveDelegate();
    + _delegate.processEvent(event);
    + }
    +
    + @Override
    + public Object getDelegate() {
    + return _delegate;
    + }
    +
    + private void weaveDelegate() {
    + //TODO (1.1) add a speed optimization here by pushing something in the request map
    + if (_delegate != null) {
    + _delegate = (SystemEventListener) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_SYSTEMEVENTLISTENER);
    + }
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,53 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.context.FacesContext;
    +import javax.faces.el.*;
    +
    +
    +/**
    + * objects loaded must
    + * be checked if a reloading is needed
    + *
    + * @author Werner Punz
    + */
    +@SuppressWarnings("deprecation") //we must suppress it here
    +public class VariableResolverProxy extends VariableResolver implements Decorated {
    + VariableResolver _delegate;
    +
    + public VariableResolverProxy(VariableResolver delegate) {
    + _delegate = delegate;
    + }
    +
    + public Object resolveVariable(FacesContext facesContext, String s) throws EvaluationException {
    + Object variable = _delegate.resolveVariable(facesContext, s);
    + if (variable != null && WeavingContext.isDynamic(variable.getClass()))
    + variable = WeavingContext.getWeaver().reloadScriptingInstance(variable, ScriptingConst.ARTIFACT_TYPE_MANAGEDBEAN);
    + return variable;
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,131 @@
    +/*
    + * 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.extensions.scripting.jsf.dynamicdecorators.implemetations;
    +
    +import org.apache.myfaces.extensions.scripting.api.Decorated;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingConst;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +
    +import javax.faces.application.ViewHandler;
    +import javax.faces.context.FacesContext;
    +import javax.faces.component.UIViewRoot;
    +import javax.faces.FacesException;
    +import javax.faces.view.ViewDeclarationLanguage;
    +import java.util.Locale;
    +import java.util.Map;
    +import java.util.List;
    +import java.io.IOException;
    +
    +/**
    + * Scripting enabled View Handler
    + *
    + * @author Werner Punz
    + */
    +public class ViewHandlerProxy extends ViewHandler implements Decorated {
    +
    + ViewHandler _delegate = null;
    +
    + private void weaveDelegate() {
    + if (_delegate != null) {
    + _delegate = (ViewHandler) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_VIEWHANDLER);
    + }
    + }
    +
    + public ViewHandlerProxy(ViewHandler delegate) {
    + _delegate = delegate;
    + }
    +
    + public String calculateCharacterEncoding(FacesContext facesContext) {
    + weaveDelegate();
    + return _delegate.calculateCharacterEncoding(facesContext);
    + }
    +
    + public Locale calculateLocale(FacesContext facesContext) {
    + weaveDelegate();
    + return _delegate.calculateLocale(facesContext);
    + }
    +
    + public String calculateRenderKitId(FacesContext facesContext) {
    + weaveDelegate();
    + return _delegate.calculateRenderKitId(facesContext);
    + }
    +
    + public UIViewRoot createView(FacesContext facesContext, String s) {
    + weaveDelegate();
    + return _delegate.createView(facesContext, s);
    + }
    +
    + public String getActionURL(FacesContext facesContext, String s) {
    + weaveDelegate();
    + return _delegate.getActionURL(facesContext, s);
    + }
    +
    + public String getResourceURL(FacesContext facesContext, String s) {
    + weaveDelegate();
    + return _delegate.getResourceURL(facesContext, s);
    + }
    +
    + public void initView(FacesContext facesContext) throws FacesException {
    + weaveDelegate();
    + _delegate.initView(facesContext);
    + }
    +
    + public void renderView(FacesContext facesContext, UIViewRoot uiViewRoot) throws IOException, FacesException {
    + weaveDelegate();
    + _delegate.renderView(facesContext, uiViewRoot);
    + }
    +
    + public UIViewRoot restoreView(FacesContext facesContext, String s) {
    + weaveDelegate();
    + return _delegate.restoreView(facesContext, s);
    + }
    +
    + public void writeState(FacesContext facesContext) throws IOException {
    + weaveDelegate();
    + _delegate.writeState(facesContext);
    + }
    +
    +
    + @Override
    + public String deriveViewId(FacesContext facesContext, String s) {
    + weaveDelegate();
    + return _delegate.deriveViewId(facesContext, s);
    + }
    +
    + @Override
    + public String getBookmarkableURL(FacesContext facesContext, String s, Map<String, List<String>> stringListMap, boolean b) {
    + return super.getBookmarkableURL(facesContext, s, stringListMap, b);
    + }
    +
    + @Override
    + public ViewDeclarationLanguage getViewDeclarationLanguage(FacesContext facesContext, String s) {
    + weaveDelegate();
    + return _delegate.getViewDeclarationLanguage(facesContext, s);
    + }
    +
    + @Override
    + public String getRedirectURL(FacesContext facesContext, String s, Map<String, List<String>> stringListMap, boolean b) {
    + weaveDelegate();
    + return _delegate.getRedirectURL(facesContext, s, stringListMap, b);
    + }
    +
    + public Object getDelegate() {
    + return _delegate; //To change body of implemented methods use File | Settings | File Templates.
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BaseAnnotationScanListener.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BaseAnnotationScanListener.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BaseAnnotationScanListener.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BaseAnnotationScanListener.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,61 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +import org.apache.myfaces.config.RuntimeConfig;
    +
    +import javax.faces.application.Application;
    +import javax.faces.context.FacesContext;
    +import java.util.Map;
    +import java.util.concurrent.ConcurrentHashMap;
    +import java.util.logging.Logger;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class BaseAnnotationScanListener {
    + Logger log = Logger.getLogger(this.getClass().getName());
    + static Map<String, Object> _alreadyRegistered = new ConcurrentHashMap<String, Object>(8, 0.75f, 1);
    +
    + protected RuntimeConfig getRuntimeConfig() {
    + final FacesContext facesContext = FacesContext.getCurrentInstance();
    + //runtime config not started
    + if (facesContext == null) {
    + return null;
    + }
    + return RuntimeConfig.getCurrentInstance(facesContext.getExternalContext());
    + }
    +
    + protected Application getApplication() {
    + return FacesContext.getCurrentInstance().getApplication();
    + }
    +
    + /**
    + * unregisters this class in the central registry
    + * is triggered if the class itself has been registered previously
    + *
    + * @param className
    + * @return
    + */
    + public void purge(String className) {
    +
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BeanImplementationListener.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BeanImplementationListener.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BeanImplementationListener.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BeanImplementationListener.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,204 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +import org.apache.myfaces.config.RuntimeConfig;
    +import org.apache.myfaces.config.element.NavigationRule;
    +import org.apache.myfaces.config.impl.digester.elements.ManagedBean;
    +import org.apache.myfaces.extensions.scripting.api.AnnotationScanListener;
    +import org.apache.myfaces.extensions.scripting.core.util.StringUtils;
    +
    +import javax.faces.bean.*;
    +import java.lang.reflect.Field;
    +import java.util.*;
    +import java.util.logging.Level;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + * <p/>
    + * bean implementation listener which registers new java sources
    + * into the runtime config, note this class is not thread safe
    + * it is only allowed to be called from a single thread
    + */
    +
    +public class BeanImplementationListener extends BaseAnnotationScanListener implements AnnotationScanListener {
    +
    + public boolean supportsAnnotation(String annotation) {
    + return annotation.equals(javax.faces.bean.ManagedBean.class.getName());
    + }
    +
    + public boolean supportsAnnotation(Class annotation) {
    + return annotation.equals(javax.faces.bean.ManagedBean.class);
    + }
    +
    + public void register(Class clazz, java.lang.annotation.Annotation ann) {
    +
    + RuntimeConfig config = getRuntimeConfig();
    +
    + javax.faces.bean.ManagedBean annCasted = (javax.faces.bean.ManagedBean) ann;
    +
    + String beanName = annCasted.name();
    + if (StringUtils.isBlank(beanName)) {
    + beanName = normalizeName(clazz.getName());
    + }
    +
    + beanName = beanName.replaceAll("\"", "");
    + //we need to reregister for every bean due to possible managed prop
    + //and scope changes
    + ManagedBean mbean;
    + if (!hasToReregister(beanName, clazz)) {
    + mbean = (ManagedBean) _alreadyRegistered.get(beanName);
    + //return;
    + } else {
    + mbean = new ManagedBean();
    + }
    +
    + mbean.setBeanClass(clazz.getName());
    + mbean.setName(beanName);
    + handleManagedpropertiesCompiled(mbean, fields(clazz));
    + resolveScope(clazz, mbean);
    +
    + _alreadyRegistered.put(beanName, mbean);
    + config.addManagedBean(beanName, mbean);
    +
    + }
    +
    + private void resolveScope(Class clazz, ManagedBean mbean) {
    + //now lets resolve the scope
    + String scope = "none";
    + if (clazz.isAnnotationPresent(RequestScoped.class)) {
    + scope = "request";
    + } else if (clazz.isAnnotationPresent(SessionScoped.class)) {
    + scope = "session";
    + } else if (clazz.isAnnotationPresent(ApplicationScoped.class)) {
    + scope = "application";
    + } else if (clazz.isAnnotationPresent(NoneScoped.class)) {
    + scope = "none";
    + } else if (clazz.isAnnotationPresent(CustomScoped.class)) {
    + scope = "custom";
    + }
    + mbean.setScope(scope);
    + }
    +
    + private void handleManagedpropertiesCompiled(ManagedBean mbean, Field[] fields) {
    + for (Field field : fields) {
    + if (log.isLoggable(Level.FINEST)) {
    + log.log(Level.FINEST, " Scanning field '" + field.getName() + "'");
    + }
    + javax.faces.bean.ManagedProperty property = field
    + .getAnnotation(ManagedProperty.class);
    + if (property != null) {
    + if (log.isLoggable(Level.FINE)) {
    + log.log(Level.FINE, " Field '" + field.getName()
    + + "' has a @ManagedProperty annotation");
    + }
    +
    + org.apache.myfaces.config.impl.digester.elements.ManagedProperty mpc =
    + new org.apache.myfaces.config.impl.digester.elements.ManagedProperty();
    + String name = property.name();
    + if ((name == null) || "".equals(name)) {
    + name = field.getName();
    + }
    + mpc.setPropertyName(name);
    + mpc.setPropertyClass(field.getType().getName()); // FIXME - primitives, arrays, etc.
    + mpc.setValue(property.value());
    + mbean.addProperty(mpc);
    + }
    + }
    + }
    +
    + /**
    + * <p>Return an array of all <code>Field</code>s reflecting declared
    + * fields in this class, or in any superclass other than
    + * <code>java.lang.Object</code>.</p>
    + *
    + * @param clazz Class to be analyzed
    + * @return the array of fields
    + */
    + private Field[] fields(Class clazz) {
    +
    + Map<String, Field> fields = new HashMap<String, Field>();
    + do {
    + for (Field field : clazz.getDeclaredFields()) {
    + if (!fields.containsKey(field.getName())) {
    + fields.put(field.getName(), field);
    + }
    + }
    + } while ((clazz = clazz.getSuperclass()) != Object.class);
    + return fields.values().toArray(new Field[fields.size()]);
    + }
    +
    + protected boolean hasToReregister(String name, Class clazz) {
    + ManagedBean mbean = (ManagedBean) _alreadyRegistered.get(name);
    + return mbean == null || !mbean.getManagedBeanClassName().equals(clazz.getName());
    + }
    +
    + /**
    + * name normalizer for automated name mapping
    + * (aka if no name attribute is given in the annotation)
    + *
    + * @param className the classname to be mapped (can be with package=
    + * @return the normalized jsf bean name
    + */
    + private String normalizeName(String className) {
    + String name = className.substring(className.lastIndexOf(".") + 1);
    +
    + return name.substring(0, 1).toLowerCase() + name.substring(1);
    + }
    +
    + @SuppressWarnings("unchecked")
    + public void purge(String className) {
    + RuntimeConfig config = getRuntimeConfig();
    + //We have to purge and readd our managed beans, unfortunatly the myfaces impl enforces
    + //us to do the same for the nav rules after purge
    + //we cannot purge the managed beans and nav rules separately
    + Collection<NavigationRule> navigationRules = new ArrayList<NavigationRule>();
    + Map<String, org.apache.myfaces.config.element.ManagedBean> managedBeans = new HashMap<String, org.apache.myfaces.config.element.ManagedBean>();
    +
    + navigationRules.addAll(config.getNavigationRules());
    + managedBeans.putAll(config.getManagedBeans());
    +
    + config.purge();
    +
    + for (NavigationRule navRule : navigationRules) {
    + config.addNavigationRule(navRule);
    + }
    +
    + //We refresh the managed beans, dead references still can cause
    + //runtime errors but in this case we cannot do anything
    + org.apache.myfaces.config.element.ManagedBean mbeanFound = null;
    + List<String> mbeanKey = new LinkedList<String>();
    +
    + for (Map.Entry mbean : managedBeans.entrySet()) {
    + org.apache.myfaces.config.element.ManagedBean bean = (org.apache.myfaces.config.element.ManagedBean) mbean.getValue();
    + if (!bean.getManagedBeanClass().getName().equals(className)) {
    + config.addManagedBean((String) mbean.getKey(), (org.apache.myfaces.config.element.ManagedBean) mbean.getValue());
    + } else {
    + mbeanFound = (org.apache.myfaces.config.element.ManagedBean) mbean.getValue();
    + mbeanKey.add(mbeanFound.getManagedBeanName());
    + }
    + }
    + if (mbeanFound != null) {
    + for (String toRemove : mbeanKey) {
    + _alreadyRegistered.remove(toRemove);
    + }
    + }
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BehaviorImplementationListener.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BehaviorImplementationListener.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BehaviorImplementationListener.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BehaviorImplementationListener.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,70 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +import org.apache.myfaces.extensions.scripting.api.AnnotationScanListener;
    +import org.apache.myfaces.extensions.scripting.jsf2.annotation.purged.PurgedComponent;
    +import org.apache.myfaces.extensions.scripting.jsf2.annotation.purged.PurgedBehavior;
    +
    +import javax.faces.component.behavior.FacesBehavior;
    +import java.util.logging.Level;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class BehaviorImplementationListener extends SingleEntityAnnotationListener implements AnnotationScanListener {
    +
    + public BehaviorImplementationListener() {
    + super();
    + _entityParamValue = "value";
    + }
    +
    + public boolean supportsAnnotation(String annotation) {
    + return annotation.equals(FacesBehavior.class.getName()); //To change body of implemented methods use File | Settings | File Templates.
    + }
    +
    + public boolean supportsAnnotation(Class annotation) {
    + return annotation.equals(FacesBehavior.class); //To change body of implemented methods use File | Settings | File Templates.
    + }
    +
    +
    + protected void addEntity(Class clazz, String val) {
    + if (log.isLoggable(Level.FINEST)) {
    + log.log(Level.FINEST, "addBehavior(" + val + ","
    + + clazz.getName() + ")");
    + }
    + getApplication().addBehavior(val, clazz.getName());
    + }
    +
    + @Override
    + public void purge(String className) {
    + super.purge(className);
    + if (!_alreadyRegistered.containsKey(className)) {
    + return;
    + }
    +
    + String val = (String) _alreadyRegistered.remove(className);
    + if (val != null) {
    + getApplication().addBehavior(val, PurgedBehavior.class.getName());
    + }
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BehaviorRendererImplementationListener.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BehaviorRendererImplementationListener.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BehaviorRendererImplementationListener.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/BehaviorRendererImplementationListener.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,175 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +import org.apache.myfaces.extensions.scripting.jsf2.annotation.purged.PurgedClientBehaviorRenderer;
    +import org.apache.myfaces.extensions.scripting.jsf2.annotation.purged.PurgedRenderer;
    +
    +import javax.faces.FactoryFinder;
    +import javax.faces.context.FacesContext;
    +import javax.faces.render.FacesBehaviorRenderer;
    +import javax.faces.render.RenderKit;
    +import javax.faces.render.RenderKitFactory;
    +import java.util.HashMap;
    +import java.util.Map;
    +import java.util.logging.Level;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + * <p/>
    + * Implementation listener for the FacesBehaviorRenderer annotation
    + */
    +
    +public class BehaviorRendererImplementationListener extends MapEntityAnnotationScanner {
    +
    + private static final String PAR_RENDERERTYPE = "rendererType";
    + private static final String PAR_RENDERKITID = "renderKitId";
    +
    + Map<AnnotationEntry, String> _inverseIndex = new HashMap<AnnotationEntry, String>();
    +
    + class AnnotationEntry {
    + String rendererType;
    + String renderKitId;
    +
    + AnnotationEntry(String rendererType, String renderKitId) {
    + this.rendererType = rendererType;
    + this.renderKitId = renderKitId;
    + }
    +
    + public boolean equals(Object incoming) {
    + if (!(incoming instanceof AnnotationEntry)) {
    + return false;
    + }
    + AnnotationEntry toCompare = (AnnotationEntry) incoming;
    +
    + if (incoming == null) {
    + return false;
    + }
    +
    + boolean firstEquals = compareValuePair(rendererType, toCompare.getRendererType());
    + boolean secondEquals = compareValuePair(renderKitId, toCompare.getRenderKitId());
    +
    + return firstEquals && secondEquals;
    + }
    +
    + @Override
    + public int hashCode() {
    + return (checkForNull(rendererType) + "_" + checkForNull(renderKitId)).hashCode(); //To change body of overridden methods use File | Settings | File Templates.
    + }
    +
    + private String checkForNull(String in) {
    + return (in == null) ? "" : in;
    + }
    +
    + protected boolean compareValuePair(Object val1, Object val2) {
    + boolean retVal = false;
    + if (val1 == null) {
    + if (val2 != null) retVal = false;
    + if (val2 == null) {
    + retVal = true;
    + }
    + } else {
    + retVal = val1.equals(val2);
    + }
    + return retVal;
    + }
    +
    + public String getRendererType() {
    + return rendererType;
    + }
    +
    + public String getRenderKitId() {
    + return renderKitId;
    + }
    + }
    +
    + public BehaviorRendererImplementationListener() {
    + super();
    + }
    +
    + @Override
    + protected void addEntity(Class clazz, Map<String, Object> params) {
    + String value = (String) params.get(PAR_RENDERERTYPE);
    + String renderKitId = (String) params.get(PAR_RENDERKITID);
    +
    + AnnotationEntry entry = new AnnotationEntry(value, renderKitId);
    + _alreadyRegistered.put(clazz.getName(), entry);
    + _inverseIndex.put(entry, clazz.getName());
    +
    + getApplication().addConverter(entry.getRendererType(), clazz.getName());
    + }
    +
    + @Override
    + protected boolean hasToReregister(Map params, Class clazz) {
    + String value = (String) params.get(PAR_RENDERERTYPE);
    + String renderKitId = (String) params.get(PAR_RENDERKITID);
    +
    + AnnotationEntry entry = new AnnotationEntry(value, renderKitId);
    +
    + AnnotationEntry alreadyRegistered = (AnnotationEntry) _alreadyRegistered.get(clazz.getName());
    + if (alreadyRegistered == null) {
    + return true;
    + }
    +
    + return alreadyRegistered.equals(entry);
    + }
    +
    + public boolean supportsAnnotation(String annotation) {
    + return annotation.equals(FacesBehaviorRenderer.class.getName());
    + }
    +
    + public boolean supportsAnnotation(Class annotation) {
    + return annotation.equals(FacesBehaviorRenderer.class);
    + }
    +
    +
    + private RenderKitFactory getRenderKitFactory() {
    + return (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
    + }
    +
    + private RenderKit getRenderkit(String renderKitId) {
    + RenderKitFactory factory = getRenderKitFactory();
    + RenderKit renderKit = factory.getRenderKit(FacesContext.getCurrentInstance(), renderKitId);
    + return renderKit;
    + }
    +
    + @Override
    + public void purge(String className) {
    + super.purge(className);
    + AnnotationEntry entry = (AnnotationEntry) _alreadyRegistered.remove(className);
    + if (entry == null) {
    + return;
    + }
    +
    + RenderKit renderKit = getRenderkit(entry.getRenderKitId());
    + try {
    + String rendererClass = _inverseIndex.get(entry);
    + if (rendererClass != null && rendererClass.equals(className)) {
    + _inverseIndex.put(entry, PurgedClientBehaviorRenderer.class.getName());
    + renderKit.addClientBehaviorRenderer(entry.getRendererType(), PurgedClientBehaviorRenderer.class.newInstance());
    + }
    + } catch (InstantiationException e) {
    + log.log(Level.SEVERE, "", e);
    + } catch (IllegalAccessException e) {
    + log.log(Level.SEVERE, "", e);
    + }
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ComponentImplementationListener.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ComponentImplementationListener.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ComponentImplementationListener.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ComponentImplementationListener.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,72 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +import org.apache.myfaces.extensions.scripting.api.AnnotationScanListener;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.extensions.scripting.jsf2.annotation.purged.PurgedComponent;
    +
    +import javax.faces.component.FacesComponent;
    +import java.util.logging.Level;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class ComponentImplementationListener extends SingleEntityAnnotationListener implements AnnotationScanListener {
    +
    + public ComponentImplementationListener() {
    + super();
    + _entityParamValue = "value";
    + }
    +
    + public boolean supportsAnnotation(String annotation) {
    + return annotation.equals(FacesComponent.class.getName()); //To change body of implemented methods use File | Settings | File Templates.
    + }
    +
    + public boolean supportsAnnotation(Class annotation) {
    + return annotation.equals(FacesComponent.class); //To change body of implemented methods use File | Settings | File Templates.
    + }
    +
    +
    + protected void addEntity(Class clazz, String val) {
    + if (log.isLoggable(Level.FINEST)) {
    + log.log(Level.FINEST, "addComponent(" + val + "," + clazz.getName() + ")");
    + }
    + getApplication().addComponent(val, clazz.getName());
    + //register the renderer if not registered
    +
    + _alreadyRegistered.put(clazz.getName(), val);
    + }
    +
    + @Override
    + public void purge(String className) {
    + super.purge(className);
    + //no purge needed we already have a different class
    + //registered
    + if (!_alreadyRegistered.containsKey(className)) {
    + return;
    + }
    + String val = (String) _alreadyRegistered.remove(className);
    + if (val != null) {
    + getApplication().addComponent(val, PurgedComponent.class.getName());
    + }
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ConverterImplementationListener.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ConverterImplementationListener.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ConverterImplementationListener.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ConverterImplementationListener.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,152 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +import org.apache.myfaces.extensions.scripting.api.AnnotationScanListener;
    +import org.apache.myfaces.extensions.scripting.jsf2.annotation.purged.PurgedConverter;
    +
    +import javax.faces.application.Application;
    +import javax.faces.convert.FacesConverter;
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class ConverterImplementationListener extends MapEntityAnnotationScanner implements AnnotationScanListener {
    +
    + private static final String PAR_VALUE = "value";
    + private static final String PAR_DEFAULT = "forClass";
    +
    + Map<AnnotationEntry, String> _inverseIndex = new HashMap<AnnotationEntry, String>();
    +
    + class AnnotationEntry {
    + String value;
    + Class forClass;
    +
    + AnnotationEntry(String value, Class forClass) {
    +
    + this.value = value;
    + this.forClass = forClass;
    + }
    +
    + public boolean equals(Object incoming) {
    + if (incoming == null) {
    + return false;
    + }
    +
    + if (!(incoming instanceof AnnotationEntry)) {
    + return false;
    + }
    + AnnotationEntry toCompare = (AnnotationEntry) incoming;
    +
    + boolean firstEquals = compareValuePair(value, toCompare.getValue());
    + boolean secondEquals = compareValuePair(forClass, toCompare.getForClass());
    +
    + return firstEquals && secondEquals;
    + }
    +
    + @Override
    + public int hashCode() {
    + String retVal = checkForNull(value) + "_";
    + retVal += ((forClass != null) ? forClass.getName() : "");
    + return retVal.hashCode();
    + }
    +
    + private String checkForNull(String in) {
    + return (in == null) ? "" : in;
    + }
    +
    + protected boolean compareValuePair(Object val1, Object val2) {
    + boolean retVal = false;
    + if (val1 == null) {
    + if (val2 != null) retVal = false;
    + if (val2 == null) {
    + retVal = true;
    + }
    + } else {
    + retVal = val1.equals(val2);
    + }
    + return retVal;
    + }
    +
    + public String getValue() {
    + return value;
    + }
    +
    + public Class getForClass() {
    + return forClass;
    + }
    + }
    +
    + public ConverterImplementationListener() {
    + super(PAR_VALUE, PAR_DEFAULT);
    + }
    +
    + @Override
    + protected void addEntity(Class clazz, Map<String, Object> params) {
    + String value = (String) params.get(PAR_VALUE);
    + Class forClass = (Class) params.get(PAR_DEFAULT);
    +
    + AnnotationEntry entry = new AnnotationEntry(value, forClass);
    + _alreadyRegistered.put(clazz.getName(), entry);
    + _inverseIndex.put(entry, clazz.getName());
    +
    + getApplication().addConverter(entry.getValue(), clazz.getName());
    + }
    +
    + @Override
    + protected boolean hasToReregister(Map params, Class clazz) {
    + String value = (String) params.get(PAR_VALUE);
    + Class forClass = (Class) params.get(PAR_DEFAULT);
    +
    + AnnotationEntry entry = new AnnotationEntry(value, forClass);
    +
    + AnnotationEntry alreadyRegistered = (AnnotationEntry) _alreadyRegistered.get(clazz.getName());
    +
    + return (alreadyRegistered == null) || alreadyRegistered.equals(entry);
    + }
    +
    + public boolean supportsAnnotation(String annotation) {
    + return annotation.equals(FacesConverter.class.getName());
    + }
    +
    + public boolean supportsAnnotation(Class annotation) {
    + return annotation.equals(FacesConverter.class);
    + }
    +
    +
    + @Override
    + public void purge(String className) {
    + super.purge(className);
    + AnnotationEntry entry = (AnnotationEntry) _alreadyRegistered.remove(className);
    + if (entry == null) {
    + return;
    + }
    + String _oldConverterClass = _inverseIndex.get(entry);
    + if (_oldConverterClass.equals(className)) {
    + Application application = getApplication();
    + application.addConverter(entry.getValue(), PurgedConverter.class.getName());
    + _inverseIndex.put(entry, className);
    + }
    + }
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/GenericAnnotationScanner.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/GenericAnnotationScanner.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/GenericAnnotationScanner.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/GenericAnnotationScanner.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,204 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +import org.apache.myfaces.extensions.scripting.api.AnnotationScanListener;
    +import org.apache.myfaces.extensions.scripting.api.ClassScanListener;
    +import org.apache.myfaces.extensions.scripting.api.ClassScanner;
    +import org.apache.myfaces.extensions.scripting.api.ScriptingWeaver;
    +import org.apache.myfaces.extensions.scripting.core.util.WeavingContext;
    +import org.apache.myfaces.extensions.scripting.loaders.java.ScannerClassloader;
    +import org.apache.myfaces.extensions.scripting.refresh.ReloadingMetadata;
    +
    +import javax.faces.context.FacesContext;
    +import java.util.*;
    +import java.util.logging.Level;
    +import java.util.logging.Logger;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + * <p/>
    + * Source path annotation scanner for java it scans all sources in the specified source paths
    + * recursively for additional information
    + * and then adds the id/name -> class binding information to the correct factory locations,
    + * wherever possible
    + */
    +@SuppressWarnings("unused")
    +public class GenericAnnotationScanner extends BaseAnnotationScanListener implements ClassScanner {
    +
    + List<ClassScanListener> _listeners = new LinkedList<ClassScanListener>();
    +
    + Map<String, String> _registeredAnnotations = new HashMap<String, String>();
    + LinkedList<String> _sourcePaths = new LinkedList<String>();
    + private static final String JAVAX_FACES = "javax.faces";
    +
    + ScriptingWeaver _weaver = null;
    +
    + public GenericAnnotationScanner() {
    + initDefaultListeners();
    + }
    +
    + public GenericAnnotationScanner(ScriptingWeaver weaver) {
    + _weaver = weaver;
    + initDefaultListeners();
    + }
    +
    + public void addScanPath(String sourcePath) {
    + _sourcePaths.addFirst(sourcePath);
    + }
    +
    + Collection<java.lang.annotation.Annotation> filterAnnotations(java.lang.annotation.Annotation[] annotations) {
    + List<java.lang.annotation.Annotation> retVal = new ArrayList<java.lang.annotation.Annotation>(annotations.length);
    +
    + for (java.lang.annotation.Annotation annotation : annotations) {
    + if (annotation.annotationType().getName().startsWith(JAVAX_FACES)) {
    + retVal.add(annotation);
    + }
    +
    + }
    + return retVal;
    + }
    +
    + public void scanClass(Class clazz) {
    + java.lang.annotation.Annotation[] annotations = clazz.getAnnotations();
    +
    + Collection<java.lang.annotation.Annotation> annCol = filterAnnotations(annotations);
    + if (!annCol.isEmpty()) {
    + addOrMoveAnnotations(clazz);
    + } else {
    + removeAnnotations(clazz);
    + }
    + }
    +
    + private void initDefaultListeners() {
    + _listeners.add(new BeanImplementationListener());
    + _listeners.add(new BehaviorImplementationListener());
    + _listeners.add(new ComponentImplementationListener());
    + _listeners.add(new ConverterImplementationListener());
    + _listeners.add(new RendererImplementationListener());
    + _listeners.add(new ValidatorImplementationListener());
    + }
    +
    + /**
    + * builds up the parsing chain and then notifies its observers
    + * on the found data
    + */
    + public void scanPaths() {
    + //https://issues.apache.org/jira/browse/EXTSCRIPT-33
    +
    + //check if the faces config is already available otherwise we cannot scan yet
    + final FacesContext facesContext = FacesContext.getCurrentInstance();
    + //runtime config not started
    + //for now we only can reach the runtime config in the referenced BaseAnnotatonScanListener
    + //if we have a facesContext reachable.
    + if (facesContext == null) {
    + //TODO (1.1) decouple the scan in the BaseAnnotationScanListener from the facesConfig
    + //to get the runtime config
    + return;
    + }
    +
    + for (String className : _weaver.loadPossibleDynamicClasses()) {
    + try {
    + ScannerClassloader loader = new ScannerClassloader(Thread.currentThread().getContextClassLoader(), -1, null, WeavingContext.getConfiguration().getCompileTarget());
    +
    + Class clazz;
    + //in case the class does not exist we have to load it from our weavingcontext
    + //otherwise we do just a scan on the class to avoid side behavior
    + if (WeavingContext.getFileChangedDaemon().getClassMap().get(className) == null) {
    + clazz = _weaver.loadScriptingClassFromName(className);
    + } else {
    + clazz = loader.loadClass(className);
    + }
    +
    + if (clazz != null) {
    + java.lang.annotation.Annotation[] anns = clazz.getAnnotations();
    + if (anns != null && anns.length > 0) {
    + addOrMoveAnnotations(clazz);
    + } else {
    + removeAnnotations(clazz);
    + }
    + }
    + } catch (ClassNotFoundException e) {
    + Logger _logger = Logger.getLogger(this.getClass().getName());
    + _logger.log(Level.WARNING, "", e);
    + }
    + }
    +
    + }
    +
    + /**
    + * add or moves a class level annotation
    + * to a new place
    + *
    + * @param clazz the class to have the annotation moved or added
    + */
    + private void addOrMoveAnnotations(Class clazz) {
    + java.lang.annotation.Annotation[] anns = clazz.getAnnotations();
    + for (java.lang.annotation.Annotation ann : anns) {
    + for (ClassScanListener cListener : _listeners) {
    + AnnotationScanListener listener = (AnnotationScanListener) cListener;
    + if (listener.supportsAnnotation(ann.annotationType())) {
    + listener.register(clazz, ann);
    +
    + _registeredAnnotations.put(clazz.getName(), ann.annotationType().getName());
    +
    + ReloadingMetadata metaData = WeavingContext.getFileChangedDaemon().getClassMap().get(clazz.getName());
    + if (metaData != null) {
    + metaData.setAnnotated(true);
    + }
    + }
    + }
    + }
    + }
    +
    + /**
    + * use case annotation removed
    + * we have to entirely remove the annotation
    + * from our internal registry and the myfaces registry
    + *
    + * @param clazz the class to have the annotation removed
    + */
    + private void removeAnnotations(Class clazz) {
    + String registeredAnnotation = _registeredAnnotations.get(clazz.getName());
    + if (registeredAnnotation != null) {
    + for (ClassScanListener cListener : _listeners) {
    + AnnotationScanListener listener = (AnnotationScanListener) cListener;
    + if (listener.supportsAnnotation(registeredAnnotation)) {
    + listener.purge(clazz.getName());
    + _registeredAnnotations.remove(clazz.getName());
    + WeavingContext.getFileChangedDaemon().getClassMap().remove(clazz.getName());
    + }
    + }
    + }
    + }
    +
    + public void clearListeners() {
    + _listeners.clear();
    + }
    +
    + public void addListener(ClassScanListener listener) {
    + _listeners.add(listener);
    + }
    +
    + @Override
    + public void scanAndMarkChange() {
    + //do nothing here
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/IOCResolver.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/IOCResolver.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/IOCResolver.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/IOCResolver.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,35 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + * <p/>
    + * parses an existing object
    + * and resolves its ioc patterns
    + * and triggers the reloading of its managed beans
    + * wherever needed
    + * <p/>
    + * <p/>
    + * TODO implement this
    + */
    +
    +public class IOCResolver {
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ListenerForAnnotationHandler.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ListenerForAnnotationHandler.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ListenerForAnnotationHandler.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/ListenerForAnnotationHandler.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,31 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +/**
    + * A generic system event listener which makes the system event
    + * annotations dynamic
    + *
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class ListenerForAnnotationHandler {
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/MapEntityAnnotationScanner.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/MapEntityAnnotationScanner.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/MapEntityAnnotationScanner.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/MapEntityAnnotationScanner.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,59 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +import org.apache.myfaces.extensions.scripting.api.AnnotationScanListener;
    +import org.apache.myfaces.extensions.scripting.core.util.ReflectUtil;
    +
    +import javax.faces.component.behavior.FacesBehavior;
    +import java.util.Map;
    +import java.util.HashMap;
    +import java.lang.annotation.Annotation;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public abstract class MapEntityAnnotationScanner extends BaseAnnotationScanListener implements AnnotationScanListener {
    +
    + String[] _annotationParms = null;
    +
    + public MapEntityAnnotationScanner(String... annotationParms) {
    + _annotationParms = annotationParms;
    + }
    +
    + public void register(Class clazz, Annotation annotation) {
    +
    + Map<String, Object> parms = new HashMap<String, Object>(_annotationParms.length);
    +
    + for (String accessor : _annotationParms) {
    + parms.put(accessor, ReflectUtil.fastExecuteMethod(annotation, accessor, new Object[0]));
    + }
    +
    + if (hasToReregister(parms, clazz)) {
    + addEntity(clazz, parms);
    + }
    + }
    +
    + protected abstract void addEntity(Class clazz, Map<String, Object> params);
    +
    + protected abstract boolean hasToReregister(Map params, Class clazz);
    +
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/RendererImplementationListener.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/RendererImplementationListener.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/RendererImplementationListener.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/RendererImplementationListener.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,201 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +import org.apache.myfaces.extensions.scripting.api.AnnotationScanListener;
    +import org.apache.myfaces.extensions.scripting.jsf2.annotation.purged.PurgedRenderer;
    +
    +import javax.faces.FactoryFinder;
    +import javax.faces.context.FacesContext;
    +import javax.faces.render.FacesRenderer;
    +import javax.faces.render.RenderKit;
    +import javax.faces.render.RenderKitFactory;
    +import javax.faces.render.Renderer;
    +import java.util.HashMap;
    +import java.util.Map;
    +import java.util.TreeMap;
    +import java.util.logging.Level;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public class RendererImplementationListener extends MapEntityAnnotationScanner implements AnnotationScanListener {
    + private static final String PAR_FAMILY = "componentFamily";
    + private static final String PAR_RENDERERTYPE = "rendererType";
    + private static final String PAR_RENDERKITID = "renderKitId";
    +
    + Map<AnnotationEntry, String> _inverseIndex = new HashMap<AnnotationEntry, String>();
    +
    + public RendererImplementationListener() {
    + super(PAR_FAMILY, PAR_RENDERERTYPE, PAR_RENDERKITID);
    + }
    +
    + class AnnotationEntry {
    + String componentFamily;
    + String rendererType;
    + String renderKitId;
    +
    + AnnotationEntry(String componentFamily, String rendererType, String renderKitId) {
    + this.componentFamily = componentFamily;
    + this.rendererType = rendererType;
    + this.renderKitId = renderKitId;
    + }
    +
    + public boolean equals(Object incoming) {
    + if (!(incoming instanceof AnnotationEntry)) {
    + return false;
    + }
    + AnnotationEntry toCompare = (AnnotationEntry) incoming;
    + //handle null cases
    + if ((componentFamily == null && toCompare.getComponentFamily() != null) ||
    + (componentFamily != null && toCompare.getComponentFamily() == null) ||
    + (rendererType == null && toCompare.getRendererType() != null) ||
    + (rendererType != null && toCompare.getRendererType() == null) ||
    + (renderKitId == null && toCompare.getRenderKitId() != null) ||
    + (renderKitId != null && toCompare.getRenderKitId() == null)) {
    +
    + return false;
    + } else if (componentFamily == null && toCompare.getComponentFamily() == null &&
    + rendererType == null && toCompare.getRendererType() == null &&
    + renderKitId == null && toCompare.getRenderKitId() == null) {
    + return true;
    + }
    + //TODO a simple hash compare should be enough for almost if not all cases since the hashes have a very low propability to be the same
    + return componentFamily.equals(toCompare.getComponentFamily()) &&
    + rendererType.equals(toCompare.getRendererType()) &&
    + renderKitId.equals(toCompare.getRenderKitId());
    + }
    +
    + @Override
    + public int hashCode() {
    + /*we calculate the hashcoide to avoid double entries*/
    + return (((componentFamily != null) ? componentFamily : "")
    + + "_" +
    + ((rendererType != null) ? rendererType : "")
    + + "_" +
    + ((renderKitId != null) ? renderKitId : "")
    +
    + ).hashCode();
    + }
    +
    + public String getComponentFamily() {
    + return componentFamily;
    + }
    +
    + public String getRendererType() {
    + return rendererType;
    + }
    +
    + public String getRenderKitId() {
    + return renderKitId;
    + }
    + }
    +
    + public boolean supportsAnnotation(String annotation) {
    + return annotation.equals(FacesRenderer.class.getName());
    + }
    +
    + public boolean supportsAnnotation(Class annotation) {
    + return annotation.equals(FacesRenderer.class);
    + }
    +
    + @Override
    + protected void addEntity(Class clazz, Map<String, Object> params) {
    + String value = (String) params.get(PAR_FAMILY);
    + String theDefault = (String) params.get(PAR_RENDERERTYPE);
    +
    + String renderKitId = getRenderKitId(params);
    + RenderKit renderKit = getRenderkit(renderKitId);
    +
    + AnnotationEntry entry = new AnnotationEntry(value, theDefault, renderKitId);
    + _inverseIndex.put(entry, clazz.getName());
    + _alreadyRegistered.put(clazz.getName(), entry);
    +
    + if (log.isLoggable(Level.FINEST)) {
    + log.log(Level.FINEST, "addRenderer(" + renderKitId + ", "
    + + entry.getComponentFamily() + ", " + entry.getRendererType()
    + + ", " + clazz.getName() + ")");
    + }
    +
    + try {
    + renderKit.addRenderer(entry.getComponentFamily(), entry.getRendererType(), (Renderer) clazz.newInstance());
    + } catch (InstantiationException e) {
    + log.log(Level.SEVERE, "", e);
    + } catch (IllegalAccessException e) {
    + log.log(Level.SEVERE, "", e);
    + }
    + }
    +
    + private RenderKitFactory getRenderKitFactory() {
    + return (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
    + }
    +
    + @Override
    + protected boolean hasToReregister(Map params, Class clazz) {
    + String value = (String) params.get(PAR_FAMILY);
    + String theDefault = (String) params.get(PAR_RENDERERTYPE);
    + String renderKitId = (String) params.get(PAR_RENDERKITID);
    +
    + AnnotationEntry entry = new AnnotationEntry(value, theDefault, renderKitId);
    +
    + AnnotationEntry alreadyRegistered = (AnnotationEntry) _alreadyRegistered.get(clazz.getName());
    + if (alreadyRegistered == null) {
    + return true;
    + }
    + //here the check if the new class is the same as the old one
    + return alreadyRegistered.equals(entry);
    + }
    +
    + private String getRenderKitId(Map<String, Object> params) {
    + String renderKitId = (String) params.get(PAR_RENDERKITID);
    + renderKitId = (renderKitId == null) ? getApplication().getDefaultRenderKitId() : renderKitId;
    + return renderKitId;
    + }
    +
    + private RenderKit getRenderkit(String renderKitId) {
    + RenderKitFactory factory = getRenderKitFactory();
    + RenderKit renderKit = factory.getRenderKit(FacesContext.getCurrentInstance(), renderKitId);
    + return renderKit;
    + }
    +
    + @Override
    + public void purge(String className) {
    + super.purge(className);
    + AnnotationEntry entry = (AnnotationEntry) _alreadyRegistered.remove(className);
    + if (entry == null) {
    + return;
    + }
    +
    + RenderKit renderKit = getRenderkit(entry.getRenderKitId());
    + try {
    + //by fetching the changed renderer we save a full rescan
    + String rendererClass = _inverseIndex.get(entry);
    + if (rendererClass != null && rendererClass.equals(className)) {
    + _inverseIndex.put(entry, PurgedRenderer.class.getName());
    + renderKit.addRenderer(entry.getComponentFamily(), entry.getRendererType(), PurgedRenderer.class.newInstance());
    + }
    + } catch (InstantiationException e) {
    + log.log(Level.SEVERE, "", e);
    + } catch (IllegalAccessException e) {
    + log.log(Level.SEVERE, "", e);
    + }
    + }
    +}

    Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/SingleEntityAnnotationListener.java
    URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/SingleEntityAnnotationListener.java?rev=933379&view=auto
    ==============================================================================
    --- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/SingleEntityAnnotationListener.java (added)
    +++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/extensions/scripting/jsf2/annotation/SingleEntityAnnotationListener.java Mon Apr 12 19:43:30 2010
    @@ -0,0 +1,50 @@
    +/*
    + * 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.extensions.scripting.jsf2.annotation;
    +
    +import org.apache.myfaces.extensions.scripting.api.AnnotationScanListener;
    +import org.apache.myfaces.extensions.scripting.core.util.ReflectUtil;
    +
    +import java.util.Map;
    +import java.lang.annotation.Annotation;
    +
    +/**
    + * @author Werner Punz (latest modification by $Author$)
    + * @version $Revision$ $Date$
    + */
    +
    +public abstract class SingleEntityAnnotationListener extends BaseAnnotationScanListener implements AnnotationScanListener {
    + String _entityParamValue = null;
    +
    + public void register(Class clazz, Annotation annotation) {
    +
    + String val = (String) ReflectUtil.executeMethod(annotation, _entityParamValue);
    + if (hasToReregister(val, clazz)) {
    + addEntity(clazz, val);
    + }
    + }
    +
    + protected abstract void addEntity(Class clazz, String val);
    +
    + protected boolean hasToReregister(String name, Class clazz) {
    + String componentClass = (String) _alreadyRegistered.get(name);
    + return componentClass == null || !componentClass.equals(clazz.getName());
    + }
    +
    +}

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categoriesmyfaces
postedApr 12, '10 at 7:44p
activeApr 12, '10 at 7:44p
posts6
users1
websitemyfaces.apache.org

1 user in discussion

Werpu: 6 posts

People

Translate

site design / logo © 2019 Grokbase