myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhue...@apache.org
Subject svn commit: r910053 [1/2] - in /myfaces/extensions/scripting/branches/1_1/core: core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/ core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/ core/src/main/java/org/apach...
Date Sun, 14 Feb 2010 17:44:12 GMT
Author: bhuemer
Date: Sun Feb 14 17:44:11 2010
New Revision: 910053

URL: http://svn.apache.org/viewvc?rev=910053&view=rev
Log:
- Initial import of my merged state so far.

Added:
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationException.java   (contents, props changed)
      - copied, changed from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/api/CompilationException.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationResult.java   (contents, props changed)
      - copied, changed from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/CompilationResult.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/Compiler.java   (contents, props changed)
      - copied, changed from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/Compiler.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilerFactory.java   (contents, props changed)
      - copied, changed from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/CompilerFactory.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/GroovyCompiler.java   (contents, props changed)
      - copied, changed from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/GroovyCompiler.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/JavacCompiler.java   (contents, props changed)
      - copied, changed from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/JavacCompiler.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ClassLoaderUtils.java   (contents, props changed)
      - copied, changed from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/loader/ClassLoaderUtils.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ClassReloadingListener.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/DependencyAwareReloadingClassLoader.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ReloadingClassLoader.java   (contents, props changed)
      - copied, changed from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/loader/ReloadingClassLoader.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DefaultDependencyRegistry.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DependencyRegistry.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/ClassReadingDependencyScanner.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/DependencyScanner.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/adapter/
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/adapter/ClassVisitorAdapter.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/adapter/MethodVisitorAdapter.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/AbstractThrowAwayClassLoader.java   (with props)
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ClassFileLoader.java   (with props)
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/OverridingClassLoader.java   (with props)
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ThrowAwayClassLoader.java   (with props)
    myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/loader/dependencies/
    myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/
    myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DefaultDependencyRegistryTest.java
Removed:
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/components/
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/api/CompilationException.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/CompilationResult.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/Compiler.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/CompilerFactory.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/GroovyCompiler.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/JavacCompiler.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/loader/ClassLoaderUtils.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/loader/ReloadingClassLoader.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/loader/support/
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/test/
Modified:
    myfaces/extensions/scripting/branches/1_1/core/core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/JSR199Compiler.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/api/Compiler.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/components/CompilerComponentRenderer.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/ClassScanUtils.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/core/util/WeavingContext.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/groovy/compiler/GroovyCompiler.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/groovy/compiler/GroovyCompilerFacade.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/compiler/CompilerFacade.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/loaders/java/compiler/JavacCompiler.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/AbstractGeneratorTestCase.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/extensions/scripting/groovyCompiler/GroovyCompilerTest.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/core/classIdentifier/DynamicClassloader.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/AbstractJavaCompilerTestCase.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/GroovyCompilerTest.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/JavacCompilerTest.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/Jsr199CompilerTest.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/OverridingClassLoaderTest.java
    myfaces/extensions/scripting/branches/1_1/core/core/src/test/java/org/apache/myfaces/scripting/sandbox/ReloadingClassLoaderTest.java

Modified: myfaces/extensions/scripting/branches/1_1/core/core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/JSR199Compiler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/JSR199Compiler.java?rev=910053&r1=910052&r2=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/JSR199Compiler.java (original)
+++ myfaces/extensions/scripting/branches/1_1/core/core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/JSR199Compiler.java Sun Feb 14 17:44:11 2010
@@ -20,8 +20,8 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.scripting.sandbox.compiler.CompilationResult;
-import org.apache.myfaces.scripting.api.CompilationException;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationException;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationResult;
 import org.apache.myfaces.scripting.api.CompilerConst;
 import org.apache.myfaces.scripting.api.ScriptingConst;
 import org.apache.myfaces.scripting.core.util.FileUtils;
@@ -52,8 +52,8 @@
  * to use commons-jci so we rolled our own small specialized facade for this
  * </p>
  *
- * @author Werner Punz (latest modification by $Author: werpu $)
- * @version $Revision: 812255 $ $Date: 2009-09-07 20:51:39 +0200 (Mo, 07 Sep 2009) $
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
  */
 public class JSR199Compiler implements org.apache.myfaces.scripting.api.Compiler {
 

Copied: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationException.java (from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/api/CompilationException.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationException.java?p2=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationException.java&p1=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/api/CompilationException.java&r1=909599&r2=910053&rev=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/api/CompilationException.java (original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationException.java Sun Feb 14 17:44:11 2010
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.scripting.api;
+package org.apache.myfaces.extensions.scripting.compiler;
 
 /**
  * <p>This exception will usually be thrown if an error occurred while compiling a

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationException.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationResult.java (from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/CompilationResult.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationResult.java?p2=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationResult.java&p1=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/CompilationResult.java&r1=909599&r2=910053&rev=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/CompilationResult.java (original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationResult.java Sun Feb 14 17:44:11 2010
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.scripting.sandbox.compiler;
+package org.apache.myfaces.extensions.scripting.compiler;
 
 import java.util.ArrayList;
 import java.util.List;

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilationResult.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/Compiler.java (from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/Compiler.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/Compiler.java?p2=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/Compiler.java&p1=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/Compiler.java&r1=909599&r2=910053&rev=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/Compiler.java (original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/Compiler.java Sun Feb 14 17:44:11 2010
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.scripting.sandbox.compiler;
+package org.apache.myfaces.extensions.scripting.compiler;
 
-import org.apache.myfaces.scripting.api.CompilationException;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationException;
 
 import java.io.File;
 

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/Compiler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/Compiler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilerFactory.java (from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/CompilerFactory.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilerFactory.java?p2=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilerFactory.java&p1=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/CompilerFactory.java&r1=909599&r2=910053&rev=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/CompilerFactory.java (original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilerFactory.java Sun Feb 14 17:44:11 2010
@@ -1,4 +1,4 @@
-package org.apache.myfaces.scripting.sandbox.compiler;
+package org.apache.myfaces.extensions.scripting.compiler;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/CompilerFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/GroovyCompiler.java (from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/GroovyCompiler.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/GroovyCompiler.java?p2=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/GroovyCompiler.java&p1=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/GroovyCompiler.java&r1=909599&r2=910053&rev=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/GroovyCompiler.java (original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/GroovyCompiler.java Sun Feb 14 17:44:11 2010
@@ -16,15 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.scripting.sandbox.compiler;
+package org.apache.myfaces.extensions.scripting.compiler;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.scripting.sandbox.loader.ClassLoaderUtils;
-import org.apache.myfaces.scripting.api.CompilationException;
-import org.apache.myfaces.scripting.api.ScriptingConst;
-import org.apache.myfaces.scripting.core.util.FileUtils;
-import org.apache.myfaces.scripting.core.util.WeavingContext;
+import org.apache.myfaces.extensions.scripting.loader.ClassLoaderUtils;
 import org.codehaus.groovy.control.CompilationFailedException;
 import org.codehaus.groovy.control.CompilationUnit;
 import org.codehaus.groovy.control.CompilerConfiguration;
@@ -36,6 +32,7 @@
 import java.io.File;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.lang.*;
 import java.util.List;
 
 /**
@@ -64,46 +61,6 @@
         return compile(sourcePath, targetPath, new File(sourcePath, file), classLoader);
     }
 
-    public CompilationResult compile(File sourcePath, File targetPath, ClassLoader classLoader) {
-
-        List<File> sourceFiles = FileUtils.fetchSourceFiles(sourcePath, "*.groovy");
-
-        StringWriter compilerOutput = new StringWriter();
-
-        CompilationUnit compilationUnit = new CompilationUnit(
-                buildCompilerConfiguration(sourcePath, targetPath, classLoader));
-        compilationUnit.getConfiguration().setOutput(new PrintWriter(compilerOutput));
-
-        for (File sourceFile : sourceFiles) {
-            compilationUnit.addSource(sourceFile);
-        }
-
-        CompilationResult result;
-
-        try {
-            compilationUnit.compile();
-
-            result = new CompilationResult(compilerOutput.toString());
-            WeavingContext.setCompilationResult(ScriptingConst.ENGINE_TYPE_GROOVY, result);
-
-        } catch (CompilationFailedException ex) {
-            // Register all collected error messages from the Groovy compiler
-            result = new CompilationResult(compilerOutput.toString());
-            ErrorCollector collector = compilationUnit.getErrorCollector();
-            for (int i = 0; i < collector.getErrorCount(); ++i) {
-                result.registerError(convertMessage(collector.getError(i)));
-            }
-        }
-
-        // Register all collected warnings from the Groovy compiler
-        ErrorCollector collector = compilationUnit.getErrorCollector();
-        for (int i = 0; i < collector.getWarningCount(); ++i) {
-            result.registerWarning(convertMessage(collector.getWarning(i)));
-        }
-
-        return result;
-    }
-
     /**
      * <p>Compiles the given file and creates an according class file in the given target path.</p>
      *
@@ -128,8 +85,6 @@
             compilationUnit.compile();
 
             result = new CompilationResult(compilerOutput.toString());
-
-            WeavingContext.setCompilationResult(ScriptingConst.ENGINE_TYPE_GROOVY, result);
         } catch (CompilationFailedException ex) {
             // Register all collected error messages from the Groovy compiler
             result = new CompilationResult(compilerOutput.toString());

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/GroovyCompiler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/GroovyCompiler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/JavacCompiler.java (from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/JavacCompiler.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/JavacCompiler.java?p2=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/JavacCompiler.java&p1=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/JavacCompiler.java&r1=909599&r2=910053&rev=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/compiler/JavacCompiler.java (original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/JavacCompiler.java Sun Feb 14 17:44:11 2010
@@ -16,16 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.scripting.sandbox.compiler;
+package org.apache.myfaces.extensions.scripting.compiler;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.scripting.sandbox.loader.ClassLoaderUtils;
-import org.apache.myfaces.scripting.api.CompilationException;
+import org.apache.myfaces.extensions.scripting.loader.ClassLoaderUtils;
+import org.apache.myfaces.extensions.scripting.compiler.CompilationException;
 
 import java.io.File;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.lang.*;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/JavacCompiler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/compiler/JavacCompiler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ClassLoaderUtils.java (from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/loader/ClassLoaderUtils.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ClassLoaderUtils.java?p2=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ClassLoaderUtils.java&p1=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/loader/ClassLoaderUtils.java&r1=909599&r2=910053&rev=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/loader/ClassLoaderUtils.java (original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ClassLoaderUtils.java Sun Feb 14 17:44:11 2010
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.scripting.sandbox.loader;
+package org.apache.myfaces.extensions.scripting.loader;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -31,6 +31,8 @@
 /**
  * <p>Utility class for class loading purposes, e.g. to determine the classpath of a
  * class loader hierarchy.</p>
+ *
+ * @author Bernhard Huemer
  */
 public class ClassLoaderUtils {
 
@@ -110,7 +112,7 @@
         List<URL> classpath = new ArrayList<URL>();
 
         ClassLoader classLoader = parent;
-        // Walk up the hierachy of class loaders in order to determine the current classpath.
+        // Walk up the hierarchy of class loaders in order to determine the current classpath.
         while (classLoader != null) {
             if (classLoader instanceof URLClassLoader) {
                 URLClassLoader urlClassLoader = (URLClassLoader) classLoader;
@@ -119,16 +121,13 @@
                 if (urls != null) {
                     classpath.addAll(Arrays.asList(urls));
                 }
-            } /*else {
+            } else {
                 if (logger.isWarnEnabled()) {
                     logger.warn("Resolving the classpath of the classloader '" + parent + "' - One of its parent class"
                             + " loaders is no URLClassLoader '" + classLoader + "', which means it's possible that"
                             + " some classpath entries aren't in the final outcome of this method call.");
                 }
-            } */
-
-            //we disable this warning entirely for now because our own url classloader
-            //can deal with this properly, due to extra startup context classpath determination
+            }
 
             // Inspect the parent class loader next.
             classLoader = classLoader.getParent();

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ClassLoaderUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ClassLoaderUtils.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ClassReloadingListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ClassReloadingListener.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ClassReloadingListener.java (added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ClassReloadingListener.java Sun Feb 14 17:44:11 2010
@@ -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.extensions.scripting.loader;
+
+import org.apache.myfaces.extensions.scripting.loader.support.ThrowAwayClassLoader;
+
+/**
+ * <p>Implement this interface if you want to get a notification when a class gets reloaded (or
+ * loaded for the first time). Register your implementation afterwards using
+ * {@link org.apache.myfaces.extensions.scripting.loader.ReloadingClassLoader#registerReloadingListener(ClassReloadingListener)}.</p> 
+ *
+ * @author Bernhard Huemer
+ */
+public interface ClassReloadingListener {
+
+    /**
+     * <p>Callback method that will be called if the reloading class loader, that
+     * you've attached this listener to, has either reloaded a class or loaded a
+     * class for the first time (use the given class loaders to distinguish
+     * between those two cases).</p>
+     *
+     * @param oldClassLoader the old class loader that has been replaced by the new one, or
+     *                          <code>null</code> if the given class has been loaded for the first time
+     * @param newClassLoader the new class loader that has replaced the old one
+     * @param className the name of the class that has been reloaded
+     */
+    public void classReloaded(
+            ThrowAwayClassLoader oldClassLoader, ThrowAwayClassLoader newClassLoader, String className);    
+
+}

Added: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/DependencyAwareReloadingClassLoader.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/DependencyAwareReloadingClassLoader.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/DependencyAwareReloadingClassLoader.java (added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/DependencyAwareReloadingClassLoader.java Sun Feb 14 17:44:11 2010
@@ -0,0 +1,140 @@
+/*
+ * 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.loader;
+
+import org.apache.myfaces.extensions.scripting.loader.dependencies.registry.DefaultDependencyRegistry;
+import org.apache.myfaces.extensions.scripting.loader.dependencies.registry.DependencyRegistry;
+import org.apache.myfaces.extensions.scripting.loader.dependencies.scanner.DependencyScanner;
+
+import java.io.File;
+
+/**
+ * 
+ */
+public class DependencyAwareReloadingClassLoader extends ReloadingClassLoader {
+
+    /** The dependency scanner that determines dependencies for a class. */ 
+    private DependencyScanner scanner;
+
+    /** The dependency registry that keeps track of the dependencies determine by the scanner. */
+    private DependencyRegistry registry;
+
+    // ------------------------------------------ Constructors
+
+    /**
+     * <p>Constructs a new dependency aware reloading class loader for the specified
+     * compilation directory using the default delegation parent class loader. Note
+     * that this class loader will only delegate to the parent class loader if
+     * there's no dynamically compiled class available.</p>
+     *
+     * <p>The given dependency scanner will be used to determine dependencies for each
+     * class that this class loader has to load. If you then reload one of those
+     * dependencies, the dependent class will be reloaded automatically as well.</p>
+     *
+     * @param scanner the dependency scanner that will be used to determine dependencies
+     * @param compilationDirectory the compilation directory
+     */
+    public DependencyAwareReloadingClassLoader(DependencyScanner scanner, File compilationDirectory) {
+        this(scanner, new DefaultDependencyRegistry(), compilationDirectory);
+    }
+
+    /**
+     * <p>Constructs a new reloading class loader for the specified compilation
+     * directory using the given delegation parent class loader. Note that this
+     * class loader will only delegate to the parent class loader if there's no
+     * dynamically compiled class available.</p>
+     *
+     * <p>The given dependency scanner will be used to determine dependencies for each
+     * class that this class loader has to load. If you then reload one of those
+     * dependencies, the dependent class will be reloaded automatically as well.</p>
+     *
+     * @param scanner the dependency scanner that will be used to determine dependencies
+     * @param parentClassLoader    the parent class loader
+     * @param compilationDirectory the compilation directory
+     */
+    public DependencyAwareReloadingClassLoader(DependencyScanner scanner, ClassLoader parentClassLoader, File compilationDirectory) {
+        this(scanner, new DefaultDependencyRegistry(), parentClassLoader, compilationDirectory);
+    }
+
+    public DependencyAwareReloadingClassLoader(DependencyScanner scanner, DependencyRegistry registry, File compilationDirectory) {
+        super(compilationDirectory);
+
+        if (scanner == null) {
+            throw new IllegalArgumentException("The given dependency scanner must not be null.");
+        }
+
+        this.scanner = scanner;
+
+        if (registry != null) {
+            this.registry = registry;
+        } else {
+            this.registry = new DefaultDependencyRegistry();
+        }
+    }
+
+    public DependencyAwareReloadingClassLoader(DependencyScanner scanner, DependencyRegistry registry,
+                                                ClassLoader parentClassLoader, File compilationDirectory) {
+        super(parentClassLoader, compilationDirectory);
+
+        if (scanner == null) {
+            throw new IllegalArgumentException("The given dependency scanner must not be null.");
+        }
+
+        this.scanner = scanner;
+
+        if (registry != null) {
+            this.registry = registry;
+        } else {
+            this.registry = new DefaultDependencyRegistry();
+        }
+    }
+
+    // ------------------------------------------ ReloadingClassLoader methods
+
+    /**
+     * <p>Reloads the given class internally explicitly. Note that this class loader usually
+     * reloads classes automatically, i.e. this class loader detects if there is a newer
+     * version of a class file available in the compilation directory. However, by using
+     * this method you tell this class loader to forcefully reload the given class. For
+     * example, if you've got a newer version of a dynamically recompiled class and a
+     * statically compiled class depending on this one, you can tell this class loader to
+     * reload the statically compiled class as well so that it references the correct
+     * version of the Class object.</p>
+     *
+     * <p>This method also automatically reloads all dependent classes of the given class.</p>
+     *
+     * @param className the class you want to reload
+     */
+    @Override
+    public void reloadClass(String className) {
+        super.reloadClass(className);
+
+        // First of all, update the dependencies of this class
+        // as they could have changed due to the reload.
+        registry.unregisterDependencies(className);
+        scanner.scan(registry, this, className);
+
+        // Reload all dependent classes as well, in doing so we're automatically updating
+        // dependencies, even transitive ones. 
+        for (String dependentClassName : registry.getDependentClasses(className)) {
+            reloadClass(dependentClassName);
+        }
+    }
+    
+}

Copied: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ReloadingClassLoader.java (from r909599, myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/loader/ReloadingClassLoader.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ReloadingClassLoader.java?p2=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ReloadingClassLoader.java&p1=myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/loader/ReloadingClassLoader.java&r1=909599&r2=910053&rev=910053&view=diff
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/scripting/sandbox/loader/ReloadingClassLoader.java (original)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ReloadingClassLoader.java Sun Feb 14 17:44:11 2010
@@ -16,19 +16,21 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.scripting.sandbox.loader;
+package org.apache.myfaces.extensions.scripting.loader;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.scripting.sandbox.loader.support.ThrowAwayClassLoader;
-import org.apache.myfaces.scripting.sandbox.loader.support.ClassFileLoader;
-import org.apache.myfaces.scripting.sandbox.loader.support.OverridingClassLoader;
+import org.apache.myfaces.extensions.scripting.loader.support.ClassFileLoader;
+import org.apache.myfaces.extensions.scripting.loader.support.ThrowAwayClassLoader;
+import org.apache.myfaces.extensions.scripting.loader.support.OverridingClassLoader;
 
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -76,6 +78,12 @@
             new HashMap<String, ThrowAwayClassLoader>();
 
     /**
+     * A list of reloading listeners that this class loader notifies once a class
+     * has been reloaded. 
+     */
+    private List<ClassReloadingListener> reloadingListeners = new ArrayList<ClassReloadingListener>();
+
+    /**
      * The target directory for the compiler, i.e. the directory that contains the
      * dynamically compiled .class files.
      */
@@ -84,9 +92,9 @@
     // ------------------------------------------ Constructors
 
     /**
-     * <p>Constructs a new reloading classloader for the specified compilation
-     * directory using the default delegation parent classloader. Note that this
-     * classloader will only delegate to the parent classloader if there's no
+     * <p>Constructs a new reloading class loader for the specified compilation
+     * directory using the default delegation parent class loader. Note that this
+     * class loader will only delegate to the parent class loader if there's no
      * dynamically compiled class available.</p>
      *
      * @param compilationDirectory the compilation directory
@@ -94,20 +102,26 @@
     public ReloadingClassLoader(File compilationDirectory) {
         super(new URL[0]);
         this.compilationDirectory = compilationDirectory;
+
+        // Register a default logging listener
+        registerReloadingListener(new LoggingClassReloadingListener());
     }
 
     /**
-     * <p>Constructs a new reloading classloader for the specified compilation
-     * directory using the given delegation parent classloader. Note that this
-     * classloader will only delegate to the parent classloader if there's no
+     * <p>Constructs a new reloading class loader for the specified compilation
+     * directory using the given delegation parent class loader. Note that this
+     * class loader will only delegate to the parent class loader if there's no
      * dynamically compiled class available.</p>
      *
-     * @param parentClassLoader    the parent classloader
+     * @param parentClassLoader    the parent class loader
      * @param compilationDirectory the compilation directory
      */
     public ReloadingClassLoader(ClassLoader parentClassLoader, File compilationDirectory) {
         super(new URL[0], parentClassLoader);
         this.compilationDirectory = compilationDirectory;
+
+        // Register a default logging listener
+        registerReloadingListener(new LoggingClassReloadingListener());
     }
 
     // ------------------------------------------ URLClassLoader methods
@@ -180,7 +194,7 @@
      */
     public URL[] getURLs() {
         try {
-            return new URL[]{compilationDirectory.toURI().toURL()};
+            return new URL[]{ compilationDirectory.toURI().toURL() };
         } catch (IOException ex) {
             logger.error("Couldn't resolve the URL to the compilation directory '" + compilationDirectory + "'.", ex);
             return new URL[0];
@@ -217,12 +231,12 @@
     }
 
     /**
-     * <p>Reloads the given class internally explicitly. Note that this classloader usually
-     * reloads classes automatically, i.e. this classloader detects if there is a newer
+     * <p>Reloads the given class internally explicitly. Note that this class loader usually
+     * reloads classes automatically, i.e. this class loader detects if there is a newer
      * version of a class file available in the compilation directory. However, by using
-     * this method you tell this classloader to forcefully reload the given class. For
+     * this method you tell this class loader to forcefully reload the given class. For
      * example, if you've got a newer version of a dynamically recompiled class and a
-     * statically compiled class depending on this one, you can tell this classloader to
+     * statically compiled class depending on this one, you can tell this class loader to
      * reload the statically compiled class as well so that it references the correct
      * version of the Class object.</p>
      *
@@ -238,14 +252,25 @@
             classLoader = new OverridingClassLoader(className, this);
         }
 
+        // Replace the class loader in the table and fire the according event.
         ThrowAwayClassLoader oldClassLoader = classLoaders.put(className, classLoader);
-        if (logger.isInfoEnabled()) {
-            if (oldClassLoader != null) {
-                logger.info("Replaced the class loader '" + oldClassLoader + "' with the class loader '"
-                        + classLoader + "' as this class loader is supposed to reload the class '" + className + "'.");
-            } else {
-                logger.info("Installed a new class loader '" + classLoader + "' for the class '"
-                        + className + "' as this class loader is supposed to reload it.");
+        synchronized (reloadingListeners) {
+            for (ClassReloadingListener reloadingListener : reloadingListeners) {
+                reloadingListener.classReloaded(oldClassLoader, classLoader, className);
+            }
+        }    
+    }
+
+    /**
+     * <p>Registers a new reloading listener. Afterwards the given listener
+     * will be notified if this class loader reloads or loads a class.</p>
+     *
+     * @param reloadingListener the reloading listener you want to register
+     */
+    public void registerReloadingListener(ClassReloadingListener reloadingListener) {
+        synchronized (reloadingListeners) {
+            if (reloadingListener != null) {
+                reloadingListeners.add(reloadingListener);
             }
         }
     }
@@ -266,9 +291,10 @@
 
         // Note that we don't have to create "deep copies" as the class loaders in the map
         // are immutable anyway (they are only supposed to load a single class) and additionally
-        // this map doesn't contain any classes that have been loaded using the current parent
+        // this map doesn't contain classes that have been loaded using the current parent
         // class loader!
         classLoader.classLoaders = new HashMap<String, ThrowAwayClassLoader>(classLoaders);
+        classLoader.reloadingListeners = new ArrayList<ClassReloadingListener>(reloadingListeners);
 
         return classLoader;
     }
@@ -295,4 +321,21 @@
                 className.replaceAll("\\.", FILE_SEPARATOR).concat(".class"));
     }
 
+    // ------------------------------------------ Private classes
+
+    private static class LoggingClassReloadingListener implements ClassReloadingListener {
+
+        public void classReloaded(ThrowAwayClassLoader oldClassLoader, ThrowAwayClassLoader newClassLoader, String className) {
+            if (logger.isInfoEnabled()) {
+                if (oldClassLoader != null) {
+                    logger.info("Replaced the class loader '" + oldClassLoader + "' with the class loader '"
+                            + newClassLoader + "' as this class loader is supposed to reload the class '" + className + "'.");
+                } else {
+                    logger.info("Installed a new class loader '" + newClassLoader + "' for the class '"
+                            + className + "' as this class loader is supposed to reload it.");
+                }
+            }
+        }
+    }
+
 }

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ReloadingClassLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/ReloadingClassLoader.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DefaultDependencyRegistry.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DefaultDependencyRegistry.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DefaultDependencyRegistry.java (added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DefaultDependencyRegistry.java Sun Feb 14 17:44:11 2010
@@ -0,0 +1,93 @@
+/*
+ * 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.loader.dependencies.registry;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * <p>Default implementation of a dependency registry.</p>
+ *
+ * @author Bernhard Huemer
+ */
+public class DefaultDependencyRegistry implements DependencyRegistry {
+
+    /** The dependency map that maps from a class name to a set of classes that depend on this class. */
+    private final Map<String, HashSet<String>> dependentClassMap = new HashMap<String, HashSet<String>>();
+
+    // ------------------------------------------ DependencyRegistry methods
+
+    /**
+     * <p>Registers a class dependency for the given class. In doing so, you tell the reloading
+     * facility to reload the given class if it's the case that this particular dependency has
+     * changed.</p>
+     *
+     * @param className the name of the class for which you want to register a new dependency
+     * @param dependency the class dependency, i.e. the class that the given class depends on
+     */
+    public void registerDependency(String className, String dependency) {
+        synchronized (dependentClassMap) {
+            Set<String> dependentClasses = dependentClassMap.get(dependency);
+            if (dependentClasses == null) {
+                dependentClasses = new HashSet<String>();
+                dependentClassMap.put(dependency, (HashSet<String>) dependentClasses);
+            }
+
+            // Register the given class in the set of dependent classes
+            dependentClasses.add(className);
+        }
+    }
+
+    /**
+     * <p>Removes all registered dependencies for the given class.</p>
+     *
+     * @param className the name of the class for which you want to unregister all dependencies
+     */
+    public void unregisterDependencies(String className) {
+        synchronized (dependentClassMap) {
+            dependentClassMap.remove(className);
+        }
+    }
+
+    /**
+     * <p>Returns a set of class names of the classes that depend on the given classes, if any.
+     * If there are no dependent classes, this method will return an empty set.</p>
+     *
+     * @param className the name of class for which you want to retrieve the dependent classes
+     *
+     * @return a set of class names of the dependent classes
+     */
+    public Set<String> getDependentClasses(String className) {
+        Set<String> dependentClasses;
+
+        synchronized (dependentClassMap) {
+            dependentClasses = dependentClassMap.get(className);
+        }
+        
+        if (dependentClasses == null) {
+            dependentClasses = new HashSet<String>();
+        }
+
+        return Collections.unmodifiableSet(dependentClasses);
+    }
+
+}

Added: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DependencyRegistry.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DependencyRegistry.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DependencyRegistry.java (added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/registry/DependencyRegistry.java Sun Feb 14 17:44:11 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.loader.dependencies.registry;
+
+import java.util.Set;
+
+/**
+ * <p>A registry that keeps track of dependencies between classes. This enables you to
+ * reload certain classes if one of its dependencies has changed, even if the dependent
+ * class itself hasn't changed at all. However, once a dependency changes the dependent
+ * class has to pick up those changes somehow.</p>
+ *
+ * @author Bernhard Huemer
+ */
+public interface DependencyRegistry {
+
+    /**
+     * <p>Registers a class dependency for the given class. In doing so, you tell the reloading
+     * facility to reload the given class if it's the case that this particular dependency has
+     * changed.</p>
+     *
+     * @param className the name of the class for which you want to register a new dependency
+     * @param dependency the class dependency, i.e. the class that the given class depends on
+     */
+    public void registerDependency(String className, String dependency);
+
+    /**
+     * <p>Removes all registered dependencies for the given class.</p>
+     *
+     * @param className the name of the class for which you want to unregister all dependencies
+     */
+    public void unregisterDependencies(String className);
+
+    /**
+     * <p>Returns a set of class names of the classes that depend on the given classes, if any.
+     * If there are no dependent classes, this method will return an empty set.</p>
+     * 
+     * @param className the name of class for which you want to retrieve the dependent classes
+     * 
+     * @return a set of class names of the dependent classes
+     */
+    public Set<String> getDependentClasses(String className);
+
+}

Added: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/ClassReadingDependencyScanner.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/ClassReadingDependencyScanner.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/ClassReadingDependencyScanner.java (added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/ClassReadingDependencyScanner.java Sun Feb 14 17:44:11 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.loader.dependencies.scanner;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.extensions.scripting.loader.dependencies.registry.DependencyRegistry;
+import org.apache.myfaces.extensions.scripting.loader.dependencies.scanner.adapter.ClassVisitorAdapter;
+import org.objectweb.asm.ClassReader;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * 
+ */
+public class ClassReadingDependencyScanner implements DependencyScanner {
+
+    /** The logger instance for this class. */
+    private static final Log logger = LogFactory.getLog(ClassReadingDependencyScanner.class);
+
+    // ------------------------------------------ DependencyScanner methods
+
+    public void scan(DependencyRegistry registry, ClassLoader classLoader, String className) {
+        try {
+            InputStream classStream =
+                    classLoader.getResourceAsStream(className.replace('.', '/') + ".class");
+            ClassReader reader = new ClassReader(classStream);
+            reader.accept(new ClassScanner(registry), 0);
+        } catch (IOException ex) {
+            logger.error("An I/O error occurred while scanning the dependencies of the class '"
+                    + className + "' using the class loader '" + classLoader + "'.", ex);
+        }
+    }
+
+    // ------------------------------------------ Private classes
+
+    private class ClassScanner extends ClassVisitorAdapter {
+
+        private DependencyRegistry registry;
+
+        // -------------------------------------- Constructors
+
+        public ClassScanner(DependencyRegistry registry) {
+            this.registry = registry;
+        }
+
+        // -------------------------------------- ClassVisitor methods
+
+        
+
+    }
+    
+}

Added: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/DependencyScanner.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/DependencyScanner.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/DependencyScanner.java (added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/DependencyScanner.java Sun Feb 14 17:44:11 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.loader.dependencies.scanner;
+
+import org.apache.myfaces.extensions.scripting.loader.dependencies.registry.DependencyRegistry;
+
+/**
+ * 
+ *
+ */
+public interface DependencyScanner {
+
+    public void scan(DependencyRegistry registry, ClassLoader classLoader, String className);
+
+}

Added: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/adapter/ClassVisitorAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/adapter/ClassVisitorAdapter.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/adapter/ClassVisitorAdapter.java (added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/adapter/ClassVisitorAdapter.java Sun Feb 14 17:44:11 2010
@@ -0,0 +1,79 @@
+/*
+ * 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.loader.dependencies.scanner.adapter;
+
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Attribute;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.MethodVisitor;
+
+/**
+ * <p>Stub implementation of the ASM ClassVisitor interface. Extend this class if you
+ * only want to implement certain methods, not all of them, and don't want to bother
+ * about the remaining ones. This implementation does by default nothing, i.e. if it's
+ * just a callback method, it does nothing, and if it's a method that's supposed to
+ * create another visitor, it returns <code>null</code>.</p>
+ *
+ * @author Bernhard Huemer
+ */
+public class ClassVisitorAdapter implements ClassVisitor {
+
+    // ------------------------------------------ ClassVisitor methods
+
+    public void visit(int version, int access, String name,
+                      String signature, String supername, String[] interfaces) {
+        
+    }
+
+    public void visitSource(String source, String debug) {
+        
+    }
+
+    public void visitOuterClass(String owner, String name, String desc) {
+
+    }
+
+    public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
+        return null;
+    }
+
+    public void visitAttribute(Attribute attribute) {
+
+    }
+
+    public void visitInnerClass(String name, String outerName, String innerName, int access) {
+        
+    }
+
+    public FieldVisitor visitField(int access, String name, String desc,
+                                    String signature, Object value) {
+        return null;
+    }
+
+    public MethodVisitor visitMethod(int access, String name,
+                                      String desc, String signature, String[] exceptions) {
+        return null;
+    }
+
+    public void visitEnd() {
+        
+    }
+    
+}

Added: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/adapter/MethodVisitorAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/adapter/MethodVisitorAdapter.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/adapter/MethodVisitorAdapter.java (added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/dependencies/scanner/adapter/MethodVisitorAdapter.java Sun Feb 14 17:44:11 2010
@@ -0,0 +1,137 @@
+/*
+ * 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.loader.dependencies.scanner.adapter;
+
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Attribute;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+
+/**
+ * <p>Stub implementation of the ASM MethodVisitor interface. Extend this class if you
+ * only want to implement certain methods, not all of them, and don't want to bother
+ * about the remaining ones. This implementation does by default nothing, i.e. if it's
+ * just a callback method, it does nothing, and if it's a method that's supposed to
+ * create another visitor, it returns <code>null</code>.</p>
+ *
+ * @author Bernhard Huemer
+ */
+public class MethodVisitorAdapter implements MethodVisitor {
+
+    // ------------------------------------------ MethodVisitor methods
+
+    public AnnotationVisitor visitAnnotationDefault() {
+        return null;
+    }
+
+    public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
+        return null;
+    }
+
+    public AnnotationVisitor visitParameterAnnotation(int i, String s, boolean b) {
+        return null;
+    }
+
+    public void visitAttribute(Attribute attribute) {
+
+    }
+
+    public void visitCode() {
+
+    }
+
+    public void visitFrame(int type, int nLocal, Object[] local,
+                            int nStack, Object[] stack) {
+
+    }
+
+    public void visitInsn(int opcode) {
+
+    }
+
+    public void visitIntInsn(int opcode, int operand) {
+
+    }
+
+    public void visitVarInsn(int opcode, int var) {
+        
+    }
+
+    public void visitTypeInsn(int opcode, String type) {
+
+    }
+
+    public void visitFieldInsn(int opcode, String owner, String name, String desc) {
+        
+    }
+
+    public void visitMethodInsn(int opcode, String owner, String name, String desc) {
+
+    }
+
+    public void visitJumpInsn(int opcode, Label label) {
+
+    }
+
+    public void visitLabel(Label label) {
+
+    }
+
+    public void visitLdcInsn(Object cst) {
+
+    }
+
+    public void visitIincInsn(int var, int increment) {
+
+    }
+
+    public void visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels) {
+
+    }
+
+    public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) {
+
+    }
+
+    public void visitMultiANewArrayInsn(String desc, int dims) {
+
+    }
+
+    public void visitTryCatchBlock(Label start, Label end, Label handler, String type) {
+
+    }
+
+    public void visitLocalVariable(
+            String name, String desc, String signature, Label start, Label end, int index) {
+
+    }
+
+    public void visitLineNumber(int line, Label start) {
+
+    }
+
+    public void visitMaxs(int maxStack, int maxLocals) {
+
+    }
+
+    public void visitEnd() {
+
+    }
+
+}

Added: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/AbstractThrowAwayClassLoader.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/AbstractThrowAwayClassLoader.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/AbstractThrowAwayClassLoader.java (added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/AbstractThrowAwayClassLoader.java Sun Feb 14 17:44:11 2010
@@ -0,0 +1,229 @@
+/*
+ * 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.loader.support;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ *
+ */
+public abstract class AbstractThrowAwayClassLoader extends URLClassLoader
+        implements ThrowAwayClassLoader {
+
+    /**
+     * The size of the buffer we're going to use to copy the contents from a stream to a byte array.
+     */
+    private static final int BUFFER_SIZE = 4096;
+
+    /**
+     * Indicates when this ClassLoader has been created.
+     */
+    private final long timestamp;
+
+    /**
+     * The name of the class that this class loader is going to load.
+     */
+    private final String className;
+
+    // ------------------------------------------ Constructors
+
+    public AbstractThrowAwayClassLoader(String className, ClassLoader parentClassLoader) {
+        super(new URL[0], parentClassLoader);
+
+        if (className == null) {
+            throw new IllegalArgumentException("The given class name must not be null.");
+        }
+
+        // Save a timestamp of the time this class loader has been created. In doing
+        // so, we're able to tell if this class loader is already outdated or not.
+        this.timestamp = System.currentTimeMillis();
+        this.className = className;
+    }
+
+    // ------------------------------------------ ThrowAwayClassLoader methods
+
+    /**
+     * <p>Loads the class with the specified class name. However, note that implementing
+     * classes are just supposed to load a single class, so if you want to load a different
+     * class than that, this class loader will just delegate to the parent class loader.</p>
+     *
+     * @param className the name of the class you want to load
+     * @param resolve   if <tt>true</tt> then resolve the class
+     * @return the resulting Class reference
+     * @throws ClassNotFoundException if the class could not be found
+     */
+    public Class loadClass(String className, boolean resolve) throws ClassNotFoundException {
+        Class c;
+
+        // Note that this class loader is only supposed to load a specific Class reference,
+        // hence the check against the class name. Otherwise this class loader would try to
+        // resolve class files for dependent classes as well, which means that there would
+        // be different versions of the same Class reference in the system.
+        if (isEligibleForLoading(className)) {
+            // First, check if the class has already been loaded
+            c = findLoadedClass(className);
+            if (c == null) {
+                // Note that execution reaches this point only if we're either updating a
+                // dynamically loaded class or loading it for the first time. Otherwise
+                // this ClassLoader would have returned an already loaded class (see the
+                // call to findLoadedClass()).
+                c = findClass(className);
+                if (resolve) {
+                    resolveClass(c);
+                }
+            }
+        }
+
+        // If this class loader isn't supposed to load the given class it doesn't
+        // necessarily mean, that we're not dealing with a dynamic class here.
+        // However, if that's the case, we really want to use the same class loader
+        // (i.e. the same ClassFileLoader instance) as Spring does, hence the
+        // delegation to the parent class loader (i.e. the ReloadingClassLoader
+        // again).
+        else {
+            c = super.loadClass(className, resolve);
+        }
+
+        return c;
+    }
+
+    /**
+     * <p>Returns <code>true</code> if the given "last modified"-timestamp is
+     * more recent than the time stamp of this class loader, i.e. if this class loader
+     * is to be destroyed as there is a newer class file available.
+     *
+     * @param lastModified the "last modified"-timestamp of the class file you want to load
+     * @return <code>true</code> if the given "last modified"-timestamp is
+     *         more recent than the time stamp of this ClassLoader
+     */
+    public boolean isOutdated(long lastModified) {
+        return timestamp < lastModified;
+    }
+
+    // ------------------------------------------ Utility methods
+
+    /**
+     * <p>Determines whether this class loader is supposed to load the given class.</p>
+     *
+     * @param className the name of the class
+     * @return <code>true</code>, if this class loader is supposed to load the
+     *         given class, <code>false</code> otherwise
+     */
+    protected boolean isEligibleForLoading(String className) {
+        return getClassName().equals(className);
+    }
+
+    /**
+     * <p>Finds and loads the class with the specified name from the compilation path.</p>
+     *
+     * @param className the name of the class
+     * @return the resulting class
+     * @throws ClassNotFoundException if the class could not be found
+     */
+    protected Class findClass(final String className) throws ClassNotFoundException {
+        if (isEligibleForLoading(className)) {
+            try {
+                return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
+                    public Class<?> run() throws Exception {
+                        InputStream stream = null;
+
+                        try {
+                            // Load the raw bytes of the class file into the memory ..
+                            stream = openStreamForClass(className);
+                            if (stream != null) {
+                                byte[] buffer = loadClassFromStream(stream);
+
+                                // .. and create an according Class object.
+                                return defineClass(className, buffer, 0, buffer.length);
+                            } else {
+                                throw new ClassNotFoundException(
+                                        "Cannot find the resource that defines the class '" + className + "'.");
+                            }
+                        }
+                        catch (IOException ex) {
+                            throw new ClassNotFoundException(
+                                    "Cannot load the raw byte contents for the class '" + className + "'.", ex);
+                        }
+                        finally {
+                            if (stream != null) {
+                                stream.close();
+                            }
+                        }
+                    }
+                });
+            }
+            catch (PrivilegedActionException e) {
+                throw (ClassNotFoundException) e.getException();
+            }
+        } else {
+            throw new ClassNotFoundException(
+                    "This class loader only knows how to load the class '" + getClassName() + "'.");
+        }
+    }
+
+    /**
+     * <p>Returns the name of the class that this class loader is going to load.</p>
+     *
+     * @return the name of the class that this class loader is going to load
+     */
+    protected String getClassName() {
+        return className;
+    }
+
+    /**
+     * <p>Loads the byte array that you can use to define the given class
+     * afterwards using a call to {@link #defineClass}.</p>
+     *
+     * @param stream a stream referencing e.g. a .class file
+     * @return the byte array that you can use to define the given class
+     * @throws IOException if an I/O error occurs
+     */
+    private byte[] loadClassFromStream(InputStream stream) throws IOException {
+        ByteArrayOutputStream result = new ByteArrayOutputStream(BUFFER_SIZE * 5);
+
+        byte[] buffer = new byte[BUFFER_SIZE];
+
+        int readBytes;
+        while ((readBytes = stream.read(buffer)) != -1) {
+            result.write(buffer, 0, readBytes);
+        }
+
+        return result.toByteArray();
+    }
+
+    // ------------------------------------------ Abstract methods
+
+    /**
+     * <p>Opens a stream to the resource that defines the given class. If it
+     * cannot be found, return <code>null</code>.</p>
+     *
+     * @param className the class to load
+     * @return a stream to the resource that defines the given class
+     * @throws IOException if an I/O error occurs
+     */
+    protected abstract InputStream openStreamForClass(String className) throws IOException;
+
+}

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/AbstractThrowAwayClassLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/AbstractThrowAwayClassLoader.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ClassFileLoader.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ClassFileLoader.java?rev=910053&view=auto
==============================================================================
--- myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ClassFileLoader.java (added)
+++ myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ClassFileLoader.java Sun Feb 14 17:44:11 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.loader.support;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+/**
+ * <p>This class loader actually loads the newly compiled classes. Each newly compiled class
+ * requires one to instantiate a new instance of this class loader, in doing so we don't cause
+ * severe linkage errors (the JVM doesn't permit class loaders to load classes more than once).
+ * That means on the other hand that each class loader is just going to load a single class.
+ * </p>
+ */
+public class ClassFileLoader extends AbstractThrowAwayClassLoader {
+
+    /**
+     * The logger instance for this class.
+     */
+    private static final Log logger = LogFactory.getLog(ClassFileLoader.class);
+
+    /**
+     * The .class file that contains the byte code for the class that this class loader is going to load.
+     */
+    private final File classFile;
+
+    // -------------------------------------- Constructors
+
+    /**
+     * <p>Constructs a new class loader that is just going to load the given class file. If one
+     * requests to load a different class than that, this class loader will just delegate the
+     * request to the given parent class loader.</p>
+     *
+     * @param className         the name of the class that this class loader is going to load
+     * @param classFile         a reference to the .class file that contains the bytecode for the class
+     * @param parentClassLoader the parent class loader
+     */
+    public ClassFileLoader(String className, File classFile, ClassLoader parentClassLoader) {
+        super(className, parentClassLoader);
+
+        if (classFile == null) {
+            throw new IllegalArgumentException("The given class file must not be null.");
+        }
+
+        this.classFile = classFile;
+    }
+
+    // ------------------------------------------ URLClassLoader methods
+
+    /**
+     * <p>Returns the search path of URLs for loading classes, i.e. the
+     * given compilation target directory, the directory that contains the
+     * dynamically compiled .class files.</p>
+     *
+     * @return the search path of URLs for loading classes
+     */
+    public URL[] getURLs() {
+        try {
+            return new URL[]{classFile.toURI().toURL()};
+        }
+        catch (IOException ex) {
+            logger.error("Couldn't resolve the URL to the class file '"
+                    + classFile + "' that this class loader '" + this + "' should load.", ex);
+            return new URL[0];
+        }
+    }
+
+    // -------------------------------------- ThrowAwayClassLoader methods
+
+    /**
+     * <p>Opens a stream to the resource that defines the given class. If it
+     * cannot be found, return <code>null</code>.</p>
+     *
+     * @param className the class to load
+     * @return a stream to the resource that defines the given class
+     * @throws java.io.IOException if an I/O error occurs
+     */
+    protected InputStream openStreamForClass(String className) throws IOException {
+        return new FileInputStream(classFile);
+    }
+
+}

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ClassFileLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/branches/1_1/core/core/src/main/java/org/apache/myfaces/extensions/scripting/loader/support/ClassFileLoader.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



Mime
View raw message