You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2009/08/17 19:52:34 UTC

svn commit: r805073 [1/4] - in /myfaces/extensions/scripting/trunk: ./ core/ core/src/ core/src/main/ core/src/main/groovy/ core/src/main/groovy/org/ core/src/main/groovy/org/apache/ core/src/main/groovy/org/apache/myfaces/ core/src/main/groovy/org/apa...

Author: werpu
Date: Mon Aug 17 17:52:31 2009
New Revision: 805073

URL: http://svn.apache.org/viewvc?rev=805073&view=rev
Log:
initial import of the scripting subproject

Added:
    myfaces/extensions/scripting/trunk/core/
    myfaces/extensions/scripting/trunk/core/myfaces-groovy-core.iml
    myfaces/extensions/scripting/trunk/core/pom.xml   (with props)
    myfaces/extensions/scripting/trunk/core/src/
    myfaces/extensions/scripting/trunk/core/src/main/
    myfaces/extensions/scripting/trunk/core/src/main/groovy/
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/HelloWorld.groovy
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/FileChangedDaemon.groovy
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/Groovy2GroovyObjectReloadingProxy.groovy
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/GroovyWeaver.groovy
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/ReloadingMetadata.groovy
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/readme.txt   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/jsf/
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/test/
    myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/test/TestClassloader.groovy
    myfaces/extensions/scripting/trunk/core/src/main/java/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/DelegatingGroovyClassloader.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/MetaclassStubcompilerFix.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Decorated.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Doable.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/ScriptingWeaver.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ConstructorLevelReloadingHandler.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/DynamicClassIdentifier.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/MethodLevelReloadingHandler.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/ScriptingConst.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextListener.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextPlugin.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/factories/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/factories/ScriptingApplicationFactory.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/factories/ScriptingFacesContextFactory.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/factories/ScriptingLifecycleFactory.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/factories/ScriptingRenderkitFactory.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/NavigationHandlerProxy.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/CustomChainLoader.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/ScriptingServletFilter.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/resources/
    myfaces/extensions/scripting/trunk/core/src/main/resources/META-INF/
    myfaces/extensions/scripting/trunk/core/src/main/resources/META-INF/faces-config.xml   (with props)
    myfaces/extensions/scripting/trunk/core/src/main/resources/META-INF/groovy-webapp.tld_
    myfaces/extensions/scripting/trunk/examples/
    myfaces/extensions/scripting/trunk/examples/myfaces-groovy-examples.iml
    myfaces/extensions/scripting/trunk/examples/pom.xml   (with props)
    myfaces/extensions/scripting/trunk/examples/src/
    myfaces/extensions/scripting/trunk/examples/src/main/
    myfaces/extensions/scripting/trunk/examples/src/main/java/
    myfaces/extensions/scripting/trunk/examples/src/main/java/org/
    myfaces/extensions/scripting/trunk/examples/src/main/java/org/apache/
    myfaces/extensions/scripting/trunk/examples/src/main/java/org/apache/myfaces/
    myfaces/extensions/scripting/trunk/examples/src/main/java/org/apache/myfaces/blank/
    myfaces/extensions/scripting/trunk/examples/src/main/java/org/apache/myfaces/blank/HelloWorldController.java   (with props)
    myfaces/extensions/scripting/trunk/examples/src/main/resources/
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml   (with props)
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy-taglib.xml   (with props)
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestActionListener.groovy
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestBean.groovy
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestComponent.groovy
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestConverter.groovy
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestNavigationHandler.groovy
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestPhaseListener.groovy
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestRenderer.groovy
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestValidator.groovy
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestViewHandler.groovy
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/tomahawk.taglib.xml   (with props)
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/web.xml   (with props)
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/helloWorld.jsp   (with props)
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/helloWorld.xhtml
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/index.jsp   (with props)
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/page2.jsp   (with props)
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/page2.xhtml
    myfaces/extensions/scripting/trunk/examples/src/main/webapp/template.xhtml
    myfaces/extensions/scripting/trunk/myfaces-groovy.iml
    myfaces/extensions/scripting/trunk/myfaces-groovy.ipr
    myfaces/extensions/scripting/trunk/pom.xml   (with props)

Added: myfaces/extensions/scripting/trunk/core/myfaces-groovy-core.iml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/myfaces-groovy-core.iml?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/myfaces-groovy-core.iml (added)
+++ myfaces/extensions/scripting/trunk/core/myfaces-groovy-core.iml Mon Aug 17 17:52:31 2009
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="true" MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="Maven: javax.el:el-api:1.0" level="project" />
+    <orderEntry type="library" exported="" name="Maven: commons-logging:commons-logging:1.0.4" level="project" />
+    <orderEntry type="library" exported="" name="Maven: commons-lang:commons-lang:2.1" level="project" />
+    <orderEntry type="library" exported="" name="Maven: commons-validator:commons-validator:1.2.0" level="project" />
+    <orderEntry type="library" exported="" name="Maven: commons-beanutils:commons-beanutils:1.7.0" level="project" />
+    <orderEntry type="library" exported="" name="Maven: commons-digester:commons-digester:1.6" level="project" />
+    <orderEntry type="library" exported="" name="Maven: commons-collections:commons-collections:3.1" level="project" />
+    <orderEntry type="library" exported="" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
+    <orderEntry type="library" exported="" name="Maven: oro:oro:2.0.8" level="project" />
+    <orderEntry type="library" exported="" name="Maven: commons-el:commons-el:1.0" level="project" />
+    <orderEntry type="library" exported="" name="Maven: commons-codec:commons-codec:1.3" level="project" />
+    <orderEntry type="library" name="Maven: javax.servlet:servlet-api:2.3" level="project" />
+    <orderEntry type="library" exported="" name="Maven: org.apache.myfaces.tomahawk:tomahawk:1.1.6" level="project" />
+    <orderEntry type="library" exported="" name="Maven: commons-fileupload:commons-fileupload:1.0" level="project" />
+    <orderEntry type="library" exported="" name="Maven: javax.servlet:jstl:1.1.0" level="project" />
+    <orderEntry type="library" name="Maven: junit:junit:3.8.2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.struts.shale:shale-test:1.0.2" level="project" />
+    <orderEntry type="library" exported="" name="Maven: org.codehaus.groovy:groovy-all:1.5.6" level="project" />
+    <orderEntry type="library" exported="" name="Maven: org.apache.ant:ant:1.7.0" level="project" />
+    <orderEntry type="library" exported="" name="Maven: org.apache.ant:ant-launcher:1.7.0" level="project" />
+    <orderEntry type="library" exported="" name="Maven: jline:jline:0.9.94" level="project" />
+    <orderEntry type="library" exported="" name="Maven: velocity:velocity:1.5" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.myfaces.core:myfaces-api:1.2.8-SNAPSHOT" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.myfaces.core:myfaces-impl:1.2.8-SNAPSHOT" level="project" />
+    <orderEntry type="library" name="Maven: commons-discovery:commons-discovery:0.4" level="project" />
+  </component>
+</module>
+

Added: myfaces/extensions/scripting/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/pom.xml?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/pom.xml (added)
+++ myfaces/extensions/scripting/trunk/core/pom.xml Mon Aug 17 17:52:31 2009
@@ -0,0 +1,179 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>myfaces-groovy-core</artifactId>
+    <packaging>jar</packaging>
+    <name>groovy core</name>
+
+    <description>
+        groovy myfaces core lib
+    </description>
+
+    <parent>
+        <groupId>org.apache.myfaces.extended</groupId>
+        <artifactId>myfaces-groovy</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <repositories>
+        <repository>
+            <id>maven2-repository.dev.java.net</id>
+            <name>Java.net Repository for Maven</name>
+            <url>http://download.java.net/maven/2/</url>
+            <layout>default</layout>
+        </repository>
+    </repositories>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-all</artifactId>
+            <version>1.5.6</version>
+        </dependency>
+          <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.3</version>
+            <scope>provided</scope>
+        </dependency>
+                <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-api</artifactId>
+            <version>1.2.8-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-impl</artifactId>
+            <version>1.2.8-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo.groovy</groupId>
+                <artifactId>groovy-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generateStubs</goal>
+                            <goal>compile</goal>
+                            <goal>generateTestStubs</goal>
+                            <goal>testCompile</goal>
+                        </goals>
+                    </execution>
+
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.codehaus.groovy</groupId>
+                        <artifactId>groovy-all</artifactId>
+                        <version>1.5.6</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>xslt-maven-plugin</artifactId>
+                <version>1.0</version>
+                <configuration>
+                    <xslFile>src/main/tld/misc/resolve_entities.xsl</xslFile>
+                    <srcIncludes>**/*.tld</srcIncludes>
+                    <srcDir>src/main/tld</srcDir>
+                    <destDir>target/classes/META-INF</destDir>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>transform</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <reporting>
+        <plugins>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>changelog-maven-plugin</artifactId>
+                <version>2.0-beta-1</version>
+                <reportSets>
+                    <reportSet>
+                        <id>dual-report</id>
+                        <configuration>
+                            <type>range</type>
+                            <range>30</range>
+                        </configuration>
+                        <reports>
+                            <report>changelog</report>
+                            <report>file-activity</report>
+                            <report>dev-activity</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.0-beta-3</version>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>jxr-maven-plugin</artifactId>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>taglist-maven-plugin</artifactId>
+                <version>2.0-beta-1</version>
+                <configuration>
+                    <tags>TODO, FIXME, XXX, @deprecated</tags>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>surefire-report-maven-plugin</artifactId>
+            </plugin>
+
+        </plugins>
+    </reporting>
+
+    <profiles>
+
+        <profile>
+            <id>generate-assembly</id>
+            <activation>
+                <property>
+                    <name>performRelease</name>
+                    <value>true</value>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-javadoc-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>attach-javadoc</id>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>

Propchange: myfaces/extensions/scripting/trunk/core/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/HelloWorld.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/HelloWorld.groovy?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/HelloWorld.groovy (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/HelloWorld.groovy Mon Aug 17 17:52:31 2009
@@ -0,0 +1,21 @@
+package org.apache.myfaces.groovyloader
+
+import org.apache.myfaces.scripting.api.Doable
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: werpu
+ * Date: 28.04.2008
+ * Time: 23:24:06
+ * /Users/werpu/Desktop/development/sparinvest/testgroovy/src/main/groovy/HelloWorld2.groovy
+ * To change this template use File | Settings | File Templates.
+ */
+public class HelloWorld implements Doable {
+
+    public void printIt() {
+        print "hello world  from bbb "
+
+
+    }
+
+}
\ No newline at end of file

Added: myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/FileChangedDaemon.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/FileChangedDaemon.groovy?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/FileChangedDaemon.groovy (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/FileChangedDaemon.groovy Mon Aug 17 17:52:31 2009
@@ -0,0 +1,61 @@
+package org.apache.myfaces.groovyloader.core
+
+import org.apache.myfaces.scripting.jsf.ScriptingConst
+import org.apache.commons.logging.Log
+import org.apache.commons.logging.LogFactory
+
+/**
+ * A worker daemon which
+ * marks files as changed
+ */
+public class FileChangedDaemon {
+    Map classMap
+
+    boolean running
+    Thread daemonThread
+
+    Log log = LogFactory.getLog(FileChangedDaemon.class)
+
+
+    public FileChangedDaemon(Map classMap) {
+        this.classMap = classMap
+    }
+
+    public start() {
+        if (daemonThread != null && daemonThread.alive) return;
+        running = true
+        daemonThread = Thread.startDaemon {
+            while (running) {
+                try {
+                    sleep ScriptingConst.TAINT_INTERVAL
+                    if (classMap == null || classMap.size() == 0)
+                        continue;
+                } catch (e) {
+                    //this looks weird at the first sight but we get a shutdown npe here
+                    //in caused by the groovy engine kickstarting  in case of an interruption we terminate the
+                    //thread, reinstantiation can happen if we are not in a shutdown phase
+                    return;
+                }
+
+                classMap.each {
+                    if (!it.value.tainted) {
+
+                        File proxyFile = new File(it.value.fileName)
+                        it.value.tainted = (proxyFile.lastModified() != it.value.timestamp);
+                        if (it.value.tainted) {
+                            it.value.taintedOnce = true;
+                            log.info("tainting $it.value.fileName")
+                        }
+                        it.value.timestamp = proxyFile.lastModified()
+                    }
+                }
+            }
+        }
+    }
+
+
+    public stop() {
+        running = false
+    }
+
+}
\ No newline at end of file

Added: myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/Groovy2GroovyObjectReloadingProxy.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/Groovy2GroovyObjectReloadingProxy.groovy?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/Groovy2GroovyObjectReloadingProxy.groovy (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/Groovy2GroovyObjectReloadingProxy.groovy Mon Aug 17 17:52:31 2009
@@ -0,0 +1,96 @@
+/*
+ * 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.groovyloader.core
+
+import org.apache.myfaces.groovyloader.core.GroovyWeaver
+import org.apache.myfaces.groovyloader.core.MetaclassStubcompilerFix
+import org.apache.myfaces.scripting.core.util.ProxyUtils
+import org.apache.myfaces.scripting.core.util.ProxyUtils
+
+/**
+ * A proxying class doing constructor interceoption
+ * to enable dynamic reload of groovy classes
+ * on constructor setup
+ *
+ * Every groovy class
+ * generated is marked with this
+ * procy on its metaclass
+ * however java omits the meta data
+ * this proxy is only used for groovy 2 groovy
+ * references and should allow code reloading
+ * on an instantiation level wherever possible
+ *
+ * This is a first attempt at
+ * reloading within groovy
+ * we might expand this later on
+ * for on the fly method replacement as well
+ *
+ * @author Werner Punz
+ *
+ */
+class Groovy2GroovyObjectReloadingProxy extends MetaclassStubcompilerFix {
+/*
+due to a bug in the groovy meta stub compiler
+we have to derive from our own object here
+*/
+
+    boolean tainted = false
+
+    GroovyWeaver weaver = null
+
+    Groovy2GroovyObjectReloadingProxy(Class aClass) {
+        super(aClass)
+        initialize()
+    }
+
+    public Groovy2GroovyObjectReloadingProxy(MetaClass metaClass) {
+        super(metaClass);    //To change body of overridden methods use File | Settings | File Templates.
+        // initialize()
+    }
+
+
+    protected Object addMethodProxy(Object a_object) {
+        //TODO isolate this so that we have a generic solution
+        //and a jsf solution
+
+    }
+
+
+    /**
+     * originally we tried invoke on method
+     * metaclass replacement
+     * that did not work out
+     * a new class is generated
+     * on every instance
+     * so we intercept simply the object
+     * creation and do the reloading there
+     */
+    public Object invokeConstructor(Object[] objects) {
+        Object a_object = super.invokeConstructor(objects);    //To change body of overridden methods use File | Settings | File Templates.
+
+        if (weaver == null)
+            weaver = ProxyUtils.getWeaver();
+
+        a_object = weaver.reloadScriptingInstance(a_object);
+
+        return a_object;
+
+    }
+
+}
\ No newline at end of file

Added: myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/GroovyWeaver.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/GroovyWeaver.groovy?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/GroovyWeaver.groovy (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/GroovyWeaver.groovy Mon Aug 17 17:52:31 2009
@@ -0,0 +1,232 @@
+/*
+ * 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.groovyloader.core
+
+import org.codehaus.groovy.runtime.InvokerHelper
+import org.apache.myfaces.groovyloader.core.ReloadingMetadata
+import org.apache.myfaces.groovyloader.core.Groovy2GroovyObjectReloadingProxy
+import org.apache.commons.logging.LogFactory
+import org.apache.commons.logging.Log
+import org.apache.myfaces.scripting.api.ScriptingWeaver
+
+/**
+ * Weaver  which does dynamic class reloading
+ * and in groovy2groovy encironments also adds
+ * a transparent reloading proxy
+ * that way we get a dynamic reloading
+ * upon file change
+ * what we do now is to get a reload
+ * interval working to improve performance
+ *
+ * this class is a singleton in the servlet context, and uses
+ * a daemon thread to check for changed files for speed reasons
+ *
+ *
+ * @author Werner Punz
+ */
+public class GroovyWeaver implements Serializable, ScriptingWeaver {
+
+    static def gcl = null
+    static Map classMap = Collections.synchronizedMap([:])
+
+    static Log log = LogFactory.getLog(GroovyWeaver.class)
+
+    public GroovyWeaver() {
+    }
+
+    /*
+    * we set a deamon to enable webapp artefact change tainting
+    * this should speed up operations because we do not have
+    * to check on the filesystem for every reload access
+    * (which happens a lot)
+    * the daemon does not block the shutdown, however we should be notified
+    * in case of a shutdown
+    */
+    static FileChangedDaemon changeWatcher = null;
+    /*synchronized???*/
+
+
+    private synchronized void startThread() {
+        if (changeWatcher == null) {
+            changeWatcher = new FileChangedDaemon(classMap)
+        }
+        changeWatcher.start()
+    }
+
+    private void stopThread() {
+        if (changeWatcher != null) {
+            changeWatcher.stop()
+        }
+    }
+
+    public boolean isTainted(Class aClass, boolean newTaintedValue) {
+        if (classMap.size() == 0) return false;
+
+        def classReloadingMetaData = classMap[aClass.name]
+
+
+        if (classReloadingMetaData == null) return false
+        def oldTainted = classReloadingMetaData.tainted
+        classReloadingMetaData.tainted = newTaintedValue
+        return oldTainted
+    }
+
+    /**
+     * recreates
+     * and ignores our tainted code
+     *
+     * */
+    public Object reloadScriptingInstance(Object o) {
+
+        if (classMap.size() == 0)
+            return o
+
+        def reloadMeta = classMap[o.getClass().getName()];
+
+        //This gives a minor speedup because we jump out as soon as possible
+        //files never changed do not even have to be considered
+        //not tained even once == not even considered to be reloaded
+        if (isReloadCandidate(reloadMeta)) {
+
+            //reload the class to get new static content if needed
+            def aclass = reloadScriptingClass(o.class)
+            if (aclass.hashCode().equals(o.class.hashCode())) {
+                //class of this object has not changed although
+                // reload is enabled we can skip the rest now
+                return o
+            }
+            log.info("possible reload for ${o.class.name}")
+            /*only recreation of empty constructor classes is possible*/
+            try {
+                //reload the object by instiating a new class and
+                // assigning the attributes properly
+                Object newObject = aclass.newInstance();
+
+                /*now we shuffle the properties between the objects*/
+                mapProperties(newObject, o)
+
+                return newObject
+            } catch (e) {
+                log.error(e)
+            }
+        }
+        return o;
+    }
+
+    /**
+     * condition which marks a metadata as reload candidate
+     */
+    private boolean isReloadCandidate(reloadMeta) {
+        return reloadMeta != null && reloadMeta.taintedOnce
+    }
+
+
+    /**
+     * central algorithm which determines which property values are overwritten and which are not
+     */
+    private void mapProperties(def target, def src) {
+        src.properties.each {property ->
+            //ok here is the algorithm, basic datatypes usually are not copied but read in anew and then overwritten
+            //later on
+            //all others can be manually overwritten by adding an attribute <attributename>_changed
+
+            try {
+                if (target.properties.containsKey(property.key)
+                    && !property.key.equals("metaClass")        //the class information and meta class information cannot be changed
+                    && !property.key.equals("class")            //otherwise we will get following error
+                                                                // java.lang.IllegalArgumentException: object is not an instance of declaring class
+                    && !(
+                    target.properties.containsKey(property.key + "_changed") //||
+                    //nothing further needed the phases take care of that
+                    )) {
+                    target.setProperty(property.key, property.value)
+                }
+            } catch (Exception e) {
+
+            }
+        }
+    }
+
+
+
+    /**
+     * reweaving of an existing woven class
+     * by reloading its file contents and then reweaving it
+     */
+    public Class reloadScriptingClass(Class aclass) {
+
+        ReloadingMetadata metadata = classMap[aclass.name]
+        if (metadata == null)
+            return aclass;
+        if (!metadata.tainted) {
+            //if not tained then we can recycle the last class loaded
+            return metadata.aClass;
+        }
+        return loadScriptingClassFromFile(metadata.getFileName())
+    }
+
+
+
+
+
+    public Class loadScriptingClassFromFile(String file) {
+        log.info("reloading $file")
+
+        File currentClassFile = new File(file)
+
+        //lazy instantiation for the gcl to eliminate a method
+        if (gcl == null) {
+            synchronized (this.class) {
+                if (gcl != null) {
+                    return;
+                }
+                gcl = new GroovyClassLoader(Thread.currentThread().contextClassLoader);
+            }
+        }
+
+        def aclass = gcl.parseClass(new FileInputStream(currentClassFile))
+
+        weaveGroovyReloadingCode(aclass)
+        ReloadingMetadata reloadingMetaData = new ReloadingMetadata()
+
+
+        reloadingMetaData.aClass = aclass;
+        reloadingMetaData.fileName = file;
+        reloadingMetaData.timestamp = currentClassFile.lastModified();
+        reloadingMetaData.tainted = false;
+
+        classMap.put(aclass.name, reloadingMetaData)
+        /*we start our thread as late as possible due to groovy bugs*/
+
+        startThread()
+        return aclass
+
+    }
+
+    private final void weaveGroovyReloadingCode(Class aclass) {
+        //TODO this only works in a groovy 2 groovy specific
+        //surrounding lets check if this is not obsolete
+
+        def myMetaClass = new Groovy2GroovyObjectReloadingProxy(aclass)
+        def invoker = InvokerHelper.instance
+        invoker.metaRegistry.setMetaClass(aclass, myMetaClass)
+    }
+
+}

Added: myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/ReloadingMetadata.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/ReloadingMetadata.groovy?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/ReloadingMetadata.groovy (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/ReloadingMetadata.groovy Mon Aug 17 17:52:31 2009
@@ -0,0 +1,36 @@
+/*
+ * 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.groovyloader.core
+
+/**
+ * data structure which holds the loaded data
+ * for our taint thread
+ *
+ * @author Werner Punz
+ */
+class ReloadingMetadata {
+
+    boolean tainted = false;
+    boolean taintedOnce = false;
+    String fileName = ""
+    Class aClass
+    long timestamp = 0l
+
+}
\ No newline at end of file

Added: myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/readme.txt
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/readme.txt?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/readme.txt (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/readme.txt Mon Aug 17 17:52:31 2009
@@ -0,0 +1,15 @@
+This is the core of the groovy loader
+we have two things in here
+a groovy proxy which allows the reloading
+of groovy objects loaded via our classloader under certain circumstances
+The proxy on the groovy side loads itself into the class metadata
+so that the objects under the best circumstances
+can run new code or run a new instance
+
+
+secondly our threaded filewatcher
+and object reloader
+which checks if files have changed and then reloads
+objects wherever possible
+
+

Propchange: myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/readme.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/readme.txt
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/test/TestClassloader.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/test/TestClassloader.groovy?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/test/TestClassloader.groovy (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/test/TestClassloader.groovy Mon Aug 17 17:52:31 2009
@@ -0,0 +1,60 @@
+import org.apache.myfaces.groovyloader.core.DelegatingGroovyClassloader
+import org.apache.myfaces.groovyloader.core.Groovy2GroovyObjectReloadingProxy
+import org.apache.myfaces.groovyloader.core.GroovyWeaver
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: werpu
+ * Date: 11.04.2008
+ * Time: 16:31:54
+ * To change this template use File | Settings | File Templates.
+ */
+class TestClassloader {
+
+    /**
+     * GroovyClassLoader gcl = new GroovyClassLoader(getClass().getClassLoader());
+     File currentClassFile = new File(fileName)
+     def aclass = gcl.parseClass(currentClassFile)
+     def myMetaClass = new org.apache.myfaces.groovyloader.core.Groovy2GroovyObjectReloadingProxy(aclass, currentClassFile)
+
+     def invoker = InvokerHelper.instance
+     invoker.metaRegistry.setMetaClass(aclass, this)
+     */
+    private replaceClass(String fileName) {
+        Class aclass = Groovy2GroovyObjectReloadingProxy.getClass(fileName);
+        return aclass
+    }
+
+    def doObjectWeaving() {
+
+        Class myClass = GroovyWeaver.instance.loadDynamicGroovyClass(
+                "/Users/werpu/Desktop/myfaces-groovy/core/src/main/groovy/HelloWorld.groovy"); //org.apache.myfaces.groovyloader.core.Groovy2GroovyObjectReloadingProxy.getClass("/Users/werpu/Desktop/development/sparinvest/testgroovy/src/main/groovy/org.apache.myfaces.groovyloader.HelloWorld.groovy")
+
+
+        def args = new Object[0]
+        def retVal = myClass.newInstance()
+        return retVal;
+    }
+
+    def sayHello() {
+
+    }
+
+    public static void main(String[] argv) {
+        DelegatingGroovyClassloader loader = new DelegatingGroovyClassloader();
+
+        loader.testRoot = "/Users/werpu/Desktop/myfaces-groovy/core/src/main/groovy/";
+        Thread.currentThread().setContextClassLoader(loader)
+        TestClassloader hello = new TestClassloader()
+        //def  myObj = hello.doObjectWeaving()
+        def myObj = loader.loadClass("org.apache.myfaces.groovloader.HelloWorld").newInstance()
+        myObj.printIt()
+        Thread.sleep 15000
+        myObj = myObj.class.newInstance()
+        myObj.printIt()
+        myObj = myObj.class.newInstance()
+        myObj.printIt()
+
+        //hello.doit()
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/DelegatingGroovyClassloader.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/DelegatingGroovyClassloader.java?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/DelegatingGroovyClassloader.java (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/DelegatingGroovyClassloader.java Mon Aug 17 17:52:31 2009
@@ -0,0 +1,172 @@
+/*
+ * 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.groovyloader.core;
+
+import org.apache.myfaces.groovyloader.core.GroovyWeaver;
+
+import javax.servlet.ServletContext;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.io.File;
+
+
+/**
+ * Groovy Classloader
+ * which does some delegating class loading on existing
+ * names
+ * it looks up for groovy files and if it finds them and no loads them in favor
+ * of existing classes
+ *
+ *
+ * TODO We can eliminate this class
+ * as soon as we have our extension points in place
+ *
+ * @author Werner Punz
+ */
+public class DelegatingGroovyClassloader extends URLClassLoader {
+
+    String _classRoot = "";
+    String _groovyRoot = "";
+    String _testRoot = "/Users/werpu/Desktop/myfaces-groovy/core/src/main/groovy/";
+    GroovyWeaver _groovyWeaver = null;
+
+    public GroovyWeaver getGroovyFactory() {
+        return _groovyWeaver;
+    }
+
+    public void setGroovyFactory(GroovyWeaver groovyWeaver) {
+        this._groovyWeaver = groovyWeaver;
+    }
+
+
+    public String getClassRoot() {
+        return _classRoot;
+    }
+
+    public void setClassRoot(String classRoot) {
+        this._classRoot = classRoot;
+    }
+
+    public String getGroovyRoot() {
+        return _groovyRoot;
+    }
+
+    public void setGroovyRoot(String groovyRoot) {
+        this._groovyRoot = groovyRoot;
+    }
+
+    public String getTestRoot() {
+        return _testRoot;
+    }
+
+    public void setTestRoot(String testRoot) {
+        this._testRoot = testRoot;
+    }
+
+
+    /**
+     * helper to determine the real context classloader
+     * some app servers switch the context classloaders relatively late
+     * while all being active, affected app servers, oc4j, was probably
+     * ever ear container, usually if no context classloader can be
+     * found a fallback to the classloader of the
+     * current class is safe, the jar however has to reside within the webapp
+     * (sorry no root jar is possible that way)
+     *
+     * @return
+     */
+    public static ClassLoader getRealContextClassloader() {
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+        String resource = DelegatingGroovyClassloader.class.getCanonicalName().replaceAll("\\.", "/") + ".class";
+        URL in = loader.getResource(resource);
+        if (in == null) { //we are in a different loader, some ear containers are at the ear level at this stage if it is a webapp context
+            loader = DelegatingGroovyClassloader.class.getClassLoader();
+            in = loader.getResource(resource);
+            if (in == null) {
+                return null;
+            }
+            return loader;
+
+        }
+        return loader;
+    }
+
+
+    public DelegatingGroovyClassloader(ServletContext servletContext) {
+        super(new URL[0], getRealContextClassloader());
+
+        this._groovyWeaver = new GroovyWeaver();;
+        String contextRoot = servletContext.getRealPath("/WEB-INF/groovy/");
+
+        contextRoot = contextRoot.trim();
+        if(!contextRoot.endsWith("/") && !contextRoot.endsWith("\\"))
+            contextRoot += "/";
+        _groovyRoot = contextRoot;
+
+    }
+
+    /**
+     * the loadclass is needed for the bean and artefact loading
+     * every class loaded must be processed at least once if present
+     * as groovy file so that we can mark it and have it checked for being
+     * tainted, also we need an initial load mechanism for uncompiled groovy files
+     * in our WEB-INF/classes dir so that we can load them properly
+     *
+     * TODO this applies mostly for beans we should check if we cannot
+     * simply do the loading from the el resolvers point of view in our case
+     * then we probably would have eliminated teh classloader entirely
+     *
+     * @param s
+     * @return
+     * @throws ClassNotFoundException
+     */
+    public Class loadClass(String s) throws ClassNotFoundException {
+       
+        if (s.startsWith("java.")) /*the entire java namespace is reserved so no use to do a specific classloading check here*/
+            return super.loadClass(s);
+        else if (s.startsWith("com.sun")) /*internal java specific namespace*/
+            return super.loadClass(s);
+
+        String groovyClass = s.replaceAll("\\.", "/") + ".groovy";
+        File classFile = new File(_groovyRoot + groovyClass);
+
+        if (classFile.exists()) /*we check the groovy subdir for our class*/
+            return (Class) _groovyWeaver.loadScriptingClassFromFile(_groovyRoot + groovyClass);
+
+        classFile = new File(_classRoot + groovyClass);
+        if (classFile.exists()) /*now lets check our class subdir for a groovy file to be loaded*/
+            return (Class) _groovyWeaver.loadScriptingClassFromFile(_classRoot + groovyClass);
+
+        /*standard testcase*/
+        classFile = new File(_testRoot + groovyClass);
+
+
+        if (classFile.exists()) /*now lets check our class subdir for a groovy file to be loaded*/
+            return _groovyWeaver.loadScriptingClassFromFile(_testRoot + groovyClass);
+
+        /**
+         * if no groovy source is found we delegate to our parent classloader for loading
+         * our classes on the fly
+         * */
+        return super.loadClass(s);
+
+    }
+
+
+}

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/DelegatingGroovyClassloader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/DelegatingGroovyClassloader.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/MetaclassStubcompilerFix.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/MetaclassStubcompilerFix.java?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/MetaclassStubcompilerFix.java (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/MetaclassStubcompilerFix.java Mon Aug 17 17:52:31 2009
@@ -0,0 +1,46 @@
+/*
+ * 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.groovyloader.core;
+
+import groovy.lang.DelegatingMetaClass;
+import groovy.lang.MetaClass;
+
+/**
+ * TODO check if this is deprecated
+ *
+ * @author Werner Punz
+ */
+public class MetaclassStubcompilerFix extends DelegatingMetaClass {
+
+    public MetaclassStubcompilerFix(Class aClass) {
+        super(aClass);
+        initialize();
+    }
+
+    public MetaclassStubcompilerFix(MetaClass metaClass) {
+        super(metaClass);    //To change body of overridden methods use File | Settings | File Templates.
+    }
+
+    /*dummy constructor do not use it it bypasses
+  * a bug in the maven-groovy stub compiler regarding
+  * base classes*/
+    public MetaclassStubcompilerFix() {
+        super(MetaclassStubcompilerFix.class);
+    }
+}

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/MetaclassStubcompilerFix.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/groovyloader/core/MetaclassStubcompilerFix.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Decorated.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Decorated.java?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Decorated.java (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Decorated.java Mon Aug 17 17:52:31 2009
@@ -0,0 +1,11 @@
+package org.apache.myfaces.scripting.api;
+
+/**
+ * General decoration interface
+ * for the Decorator pattern
+ *
+ * @author Werner Punz
+ */
+public interface Decorated {
+    public Object getDelegate();
+}

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Decorated.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Decorated.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Doable.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Doable.java?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Doable.java (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Doable.java Mon Aug 17 17:52:31 2009
@@ -0,0 +1,12 @@
+package org.apache.myfaces.scripting.api;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: werpu
+ * Date: 06.05.2008
+ * Time: 17:20:37
+ * To change this template use File | Settings | File Templates.
+ */
+public interface Doable {
+    public void printIt();
+}

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Doable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Doable.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/ScriptingWeaver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/ScriptingWeaver.java?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/ScriptingWeaver.java (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/ScriptingWeaver.java Mon Aug 17 17:52:31 2009
@@ -0,0 +1,14 @@
+package org.apache.myfaces.scripting.api;
+
+/**
+ * @author werpu
+ * @date: 15.08.2009
+ */
+public interface ScriptingWeaver {
+
+    public Object reloadScriptingInstance(Object o);
+
+    public Class reloadScriptingClass(Class aclass);
+
+    public Class loadScriptingClassFromFile(String file);
+}

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/ScriptingWeaver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/ScriptingWeaver.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ConstructorLevelReloadingHandler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ConstructorLevelReloadingHandler.java?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ConstructorLevelReloadingHandler.java (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ConstructorLevelReloadingHandler.java Mon Aug 17 17:52:31 2009
@@ -0,0 +1,96 @@
+/*
+ * 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.scripting.core.util;
+
+import org.apache.myfaces.scripting.core.util.ProxyUtils;
+import org.apache.myfaces.scripting.api.Decorated;
+import org.apache.myfaces.scripting.api.ScriptingWeaver;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+
+/**
+ * Reloading handler which
+ * tries to reload classes and objects
+ * on instantiation
+ *
+ * TODO check if this is still needed seems deprecated to me
+ *
+ * @author Werner Punz
+ */
+public class ConstructorLevelReloadingHandler implements InvocationHandler, Serializable, Decorated {
+
+    Class _loadedClass = null;
+    ScriptingWeaver _weaver = null;
+
+
+    public Object getDelegate() {
+        return _delegate;
+    }
+
+    transient Object _delegate = null;
+
+    public Class getLoadedClass() {
+        return _loadedClass;
+    }
+
+    public void setLoadedClass(Class loadedClass) {
+        _loadedClass = loadedClass;
+    }
+
+
+    public ConstructorLevelReloadingHandler(Object rootObject) {
+        _loadedClass = rootObject.getClass();
+        _delegate = rootObject;
+    }
+
+    public Object invoke(Object o, Method method, Object[] objects) throws Throwable {
+        return reloadInvoke(method, objects);
+    }
+
+
+    protected Object reloadInvoke(Method method, Object[] objects) throws InstantiationException, IllegalAccessException, InvocationTargetException {
+        if (_weaver == null)
+            _weaver = ProxyUtils.getWeaver();
+
+        if (_delegate == null) {
+            //stateless or lost state due to a lifecycle iteration we trigger anew
+            _delegate = (_weaver.reloadScriptingClass(_loadedClass)).newInstance();
+        }
+
+        //check for proxies and unproxy them before calling the methods
+        //to avoid unneccessary cast problems
+        //this is slow on long param lists but it is better
+        //to be slow than to have casts an calls in the code
+        //for production we can compile the classes anyway and avoid
+        //this
+        unmapProxies(objects);
+        return method.invoke(_delegate, objects);
+    }
+
+    private void unmapProxies(Object[] objects) {
+        for (int cnt = 0; cnt < objects.length; cnt++) {
+            objects[cnt] = ProxyUtils.getDelegateFromProxy(objects[cnt]);
+        }
+    }
+
+}

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ConstructorLevelReloadingHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ConstructorLevelReloadingHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/DynamicClassIdentifier.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/DynamicClassIdentifier.java?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/DynamicClassIdentifier.java (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/DynamicClassIdentifier.java Mon Aug 17 17:52:31 2009
@@ -0,0 +1,40 @@
+/*
+ * 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.scripting.core.util;
+
+/**
+ * This class checks for reloadable class patterns
+ * we do it on the java side although we have our tained
+ * map as well to speed things up
+ *
+ * TODO move this code into the proxy utils
+ *
+ *
+ * @author Werner Punz
+ */
+public class DynamicClassIdentifier {
+    public static boolean isDynamic(Class clazz) {
+        Class[] interfaces = clazz.getInterfaces();
+        for (int cnt = 0; cnt < interfaces.length; cnt++) {
+            if (interfaces[cnt].getName().startsWith("groovy.lang"))
+                return true;
+        }
+        return false;
+    }
+}

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/DynamicClassIdentifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/DynamicClassIdentifier.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/MethodLevelReloadingHandler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/MethodLevelReloadingHandler.java?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/MethodLevelReloadingHandler.java (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/MethodLevelReloadingHandler.java Mon Aug 17 17:52:31 2009
@@ -0,0 +1,105 @@
+package org.apache.myfaces.scripting.core.util;
+
+
+import org.apache.myfaces.scripting.api.Decorated;
+import org.apache.myfaces.scripting.api.ScriptingWeaver;
+import org.apache.myfaces.scripting.core.util.ProxyUtils;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Generic artefact invocation handler
+ * which should be able to cover
+ * all interfacable artefacts which
+ * only have reloading logic
+ * and can cope with reloading on method level
+ *
+ * @author Werner Punz
+ */
+public class MethodLevelReloadingHandler implements InvocationHandler, Serializable, Decorated {
+    Class _loadedClass = null;
+    transient Object _delegate = null;
+    ScriptingWeaver _weaver = null;
+
+    public MethodLevelReloadingHandler(Object rootObject) {
+        _loadedClass = rootObject.getClass();
+        _delegate = rootObject;
+    }
+
+
+    public Object getDelegate() {
+        return _delegate;
+    }
+
+    public Class getLoadedClass() {
+        return _loadedClass;
+    }
+
+    public void setLoadedClassName(Class loadedClass) {
+        this._loadedClass = loadedClass;
+    }
+
+    /**
+     * outside interface to the invoke method
+     * which gets called every time a method
+     * is called
+     *
+     * @param o
+     * @param method
+     * @param objects
+     * @return
+     * @throws Throwable
+     */
+    public Object invoke(Object o, Method method, Object[] objects) throws Throwable {
+        return reloadInvoke(method, objects);
+    }
+
+
+    /**
+     * invoke handler which is triggered
+     * by every method call which takes care of the reload
+     *
+     * @param method  the method to call
+     * @param objects the params
+     * @return
+     * @throws InstantiationException
+     * @throws IllegalAccessException
+     * @throws InvocationTargetException
+     */
+
+    protected Object reloadInvoke(Method method, Object[] objects) throws InstantiationException, IllegalAccessException, InvocationTargetException {
+        if (_weaver == null)
+            _weaver = ProxyUtils.getWeaver();
+
+        if (_delegate == null) {
+            //stateless or lost state due to a lifecycle iteration we trigger anew
+            _delegate = (_weaver.reloadScriptingClass(_loadedClass)).newInstance();
+        } else {
+            //if we are stateful only a tainted artefact is reloaded
+            _delegate = _weaver.reloadScriptingInstance(_delegate);
+        }
+        //check for proxies and unproxy them before calling the methods
+        //to avoid unneccessary cast problems
+        //this is slow on long param lists but it is better
+        //to be slow than to have casts an calls in the code
+        //for production we can compile the classes anyway and avoid
+        //this
+        unmapProxies(objects);
+        return method.invoke(_delegate, objects);
+    }
+
+    /**
+     * unmap proxied objects
+     *
+     * @param objects
+     */
+    private void unmapProxies(Object[] objects) {
+        if (objects == null) return;
+        for (int cnt = 0; cnt < objects.length; cnt++) {
+            objects[cnt] = ProxyUtils.getDelegateFromProxy(objects[cnt]);
+        }
+    }
+}

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/MethodLevelReloadingHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/MethodLevelReloadingHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java Mon Aug 17 17:52:31 2009
@@ -0,0 +1,124 @@
+package org.apache.myfaces.scripting.core.util;
+
+
+import org.apache.myfaces.groovyloader.core.DelegatingGroovyClassloader;
+import org.apache.myfaces.scripting.api.Decorated;
+import org.apache.myfaces.scripting.api.ScriptingWeaver;
+import org.apache.myfaces.scripting.core.util.MethodLevelReloadingHandler;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+
+/**
+ * A set of proxy utils called
+ * by the various subsystems
+ * 
+ * @author Werner Punz
+ */
+public class ProxyUtils {
+
+    /**
+     * we push our _weaver into the thread local
+     * to avoid too many calls into the
+     * context classloading hierarchy
+     * this should speed things up a little bit.
+     *
+     * Note we could work with this with static
+     * objects as well but since we also have to work with context
+     * reloading we probably are safer with filters
+     * a reference in the context and a threadLocal variable
+     * 
+     */
+    static ThreadLocal _weaverHolder = new ThreadLocal();
+
+
+    public static void init() {
+
+    }
+
+    public static void clean() {
+        _weaverHolder.set(null);
+    }
+
+    public static void setWeaver(Object weaver) {
+        _weaverHolder.set(weaver);
+    }
+
+    public static boolean isScriptingEnabled() {
+        if (_weaverHolder.get() != null) {
+            return true;
+        } else {
+            ClassLoader loader = Thread.currentThread().getContextClassLoader();
+            do {
+                if (loader instanceof DelegatingGroovyClassloader)
+                    return true;
+
+                loader = loader.getParent();
+            } while (loader != null);
+
+            return false;
+        }
+    }
+
+    public static ScriptingWeaver getWeaver() {
+        if (_weaverHolder.get() == null) {
+            ClassLoader loader = Thread.currentThread().getContextClassLoader();
+            while (loader != null && !(loader instanceof DelegatingGroovyClassloader)) {
+                loader = loader.getParent();
+            }
+            if (loader != null) {
+                _weaverHolder.set(((DelegatingGroovyClassloader) loader).getGroovyFactory());
+            }
+        }
+        return (ScriptingWeaver) _weaverHolder.get();
+    }
+
+    /**
+     * we create a proxy to an existing object
+     * which does reloading of the internal class
+     * on method level
+     * 
+     * @param o the source object to be proxied
+     * @param theInterface the proxying interface
+     * @return a proxied reloading object of type theInterface
+     */
+    public static Object createMethodReloadingProxyFromObject(Object o, Class theInterface) {
+        return Proxy.newProxyInstance(o.getClass().getClassLoader(),
+                                      new Class[]{theInterface},
+                                      new MethodLevelReloadingHandler(o));
+    }
+
+    /**
+     * we create a proxy to an existing object
+     * which does reloading of the internal class
+     * on newInstance level
+     *
+     * @param o
+     * @param theInterface
+     * @return
+     */
+    public static Object createConstructorReloadingProxyFromObject(Object o, Class theInterface) {
+        return Proxy.newProxyInstance(o.getClass().getClassLoader(),
+                                      new Class[]{theInterface},
+                                      new MethodLevelReloadingHandler(o));
+    }
+
+
+    /**
+     * unmapping of a proxied object
+     * 
+     * @param o the proxied object
+     * @return the unproxied object
+     */
+    public static Object getDelegateFromProxy(Object o) {
+        if (o instanceof Decorated)
+            return ((Decorated) o).getDelegate();
+
+        if (!Proxy.isProxyClass(o.getClass())) return o;
+        InvocationHandler handler = Proxy.getInvocationHandler(o);
+        if (handler instanceof Decorated) {
+            return ((Decorated) handler).getDelegate();
+        }
+        return o;
+    }
+}

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/ScriptingConst.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/ScriptingConst.java?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/ScriptingConst.java (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/ScriptingConst.java Mon Aug 17 17:52:31 2009
@@ -0,0 +1,34 @@
+/*
+ * 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.scripting.jsf;
+
+/**
+ * Various constants being used by the
+ * system
+ *
+ * @author Werner Punz
+ */
+public class ScriptingConst {
+    public static final String SCRIPTING_CLASSLOADER = "org.apache.myfaces.SCRIPTING_CLASSLOADER";
+    public static final String SCRIPTING_GROOVFACTORY = "org.apache.myfaces.SCRIPTING_GROOVYFACTORY";
+    public static final String SCRIPTING_REQUSINGLETON = "org.apache.myfaces.SCRIPTING_REQUSINGLETON";
+
+    public static final String RELOAD_MAP = "reloadMap";
+    public static final int TAINT_INTERVAL = 2000;
+}

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/ScriptingConst.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/ScriptingConst.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextListener.java?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextListener.java (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextListener.java Mon Aug 17 17:52:31 2009
@@ -0,0 +1,143 @@
+/*
+ * 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.scripting.jsf;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.config.FacesConfigValidator;
+import org.apache.myfaces.config.FacesConfigurator;
+import org.apache.myfaces.context.servlet.ServletExternalContextImpl;
+import org.apache.myfaces.shared_impl.util.StateUtils;
+import org.apache.myfaces.shared_impl.webapp.webxml.WebXml;
+import org.apache.myfaces.groovyloader.core.DelegatingGroovyClassloader;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.FactoryFinder;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a hack to get the plugin into myfaces
+ * in the long run we need an extension
+ *
+ * @author Werner Punz
+ */
+public class StartupServletContextListener
+        implements ServletContextListener {
+    private static final Log log = LogFactory.getLog(StartupServletContextListener.class);
+
+    //TODO fix this we have to reference the old one to avoid constand double inits
+    //instead if the new one
+    static final String FACES_INIT_DONE
+            = org.apache.myfaces.webapp.StartupServletContextListener.class.getName() + ".FACES_INIT_DONE";
+    static final String GROOVY_FACES_INIT_DONE
+            = StartupServletContextListener.class.getName() + ".GROOVY_FACES_INIT_DONE";
+
+    public void contextInitialized(ServletContextEvent event) {
+        initFaces(event.getServletContext());
+    }
+
+
+    //public static ClassLoader newLoader = null;
+
+
+    public static void initFaces(ServletContext servletContext) {
+
+        /**
+         * we have to reinstantiate with a new classloader
+         * to keep the factories intact
+         */
+        FactoryFinder.releaseFactories();
+
+
+        initClassloader(servletContext);
+
+
+        try {
+            Boolean b = (Boolean) servletContext.getAttribute(FACES_INIT_DONE);
+            Boolean g = (Boolean) servletContext.getAttribute(GROOVY_FACES_INIT_DONE);
+
+
+            if (b == null || b.booleanValue() == false || g == null || g.booleanValue() == false) {
+                log.trace("Initializing MyFaces with groovy extensions");
+
+                //Load the configuration
+                ExternalContext externalContext = new ServletExternalContextImpl(servletContext, null, null);
+
+                //And configure everything
+                new FacesConfigurator(externalContext).configure();
+
+
+                if ("true".equals(servletContext
+                        .getInitParameter(FacesConfigValidator.VALIDATE_CONTEXT_PARAM)) || "true".equals(servletContext
+                        .getInitParameter(FacesConfigValidator.VALIDATE_CONTEXT_PARAM.toLowerCase()))) {
+                    List list = FacesConfigValidator.validate(externalContext,
+                            servletContext.getRealPath("/"));
+
+                    Iterator iterator = list.iterator();
+
+                    while (iterator.hasNext())
+                        log.warn(iterator.next());
+
+                }
+
+                // parse web.xml
+                WebXml.init(externalContext);
+
+                //now we are done we have to set our method weaver
+                //to get a good proxy handling on our stateless objects
+
+                servletContext.setAttribute(FACES_INIT_DONE, Boolean.TRUE);
+                servletContext.setAttribute(GROOVY_FACES_INIT_DONE, Boolean.TRUE);
+            } else {
+                log.info("MyFaces already initialized");
+            }
+        }
+        catch (Exception ex) {
+            log.error("Error initializing ServletContext", ex);
+            ex.printStackTrace();
+        }
+        log.info("ServletContext '" + servletContext.getRealPath("/") + "' initialized.");
+
+        if (servletContext.getInitParameter(StateUtils.INIT_SECRET) != null
+                || servletContext.getInitParameter(StateUtils.INIT_SECRET.toLowerCase()) != null)
+            StateUtils.initSecret(servletContext);
+
+        //GroovyWeaver.servletContext;
+
+    }
+
+    private static void initClassloader(ServletContext servletContext) {
+        if (!(Thread.currentThread().getContextClassLoader() instanceof DelegatingGroovyClassloader)) {
+            ClassLoader newLoader = null;
+
+            newLoader = new DelegatingGroovyClassloader(servletContext);
+            Thread.currentThread().setContextClassLoader(newLoader);
+            servletContext.setAttribute(ScriptingConst.SCRIPTING_CLASSLOADER, newLoader);
+        }
+    }
+
+
+    public void contextDestroyed(ServletContextEvent e) {
+        FactoryFinder.releaseFactories();
+    }
+}
\ No newline at end of file

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextListener.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextPlugin.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextPlugin.java?rev=805073&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextPlugin.java (added)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextPlugin.java Mon Aug 17 17:52:31 2009
@@ -0,0 +1,41 @@
+package org.apache.myfaces.scripting.jsf;
+
+import org.apache.myfaces.groovyloader.core.DelegatingGroovyClassloader;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContext;
+
+/**
+ * Servlet context plugin which provides a cleaner initialisation
+ * than the standard servlet context
+ *
+ * @author Werner Punz
+ */
+public class StartupServletContextPlugin implements ServletContextListener {
+    public void contextInitialized(ServletContextEvent servletContextEvent) {
+        Log log = LogFactory.getLog(this.getClass());
+
+        log.info("Instantiating StartupServletContextPluginChainLoader");
+
+        ServletContext servletContext = servletContextEvent.getServletContext();
+        if (servletContext == null) return;
+
+
+
+        /*
+        if (!(Thread.currentThread().getContextClassLoader() instanceof DelegatingGroovyClassloader)) {
+            ClassLoader newLoader = null;
+
+            newLoader = new DelegatingGroovyClassloader(servletContext);
+            Thread.currentThread().setContextClassLoader(newLoader);
+            servletContext.setAttribute(ScriptingConst.SCRIPTING_CLASSLOADER, newLoader);
+        } */
+    }
+
+    public void contextDestroyed(ServletContextEvent servletContextEvent) {
+    }
+
+}

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextPlugin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextPlugin.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL