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 2010/04/01 22:25:58 UTC
svn commit: r930076 - in
/myfaces/extensions/scripting/trunk/extscript-core-root:
extscript-core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/
extscript-core/src/main/java/org/apache/myfaces/scripting/api/
extscript-core/src/mai...
Author: werpu
Date: Thu Apr 1 20:25:57 2010
New Revision: 930076
URL: http://svn.apache.org/viewvc?rev=930076&view=rev
Log:
http://issues.apache.org/jira/browse/EXTSCRIPT-111
removed a set of invalid warnings
Removed:
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf2/annotation/purged/PurgedVariableResolver.java
Modified:
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/JSR199Compiler.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/api/BaseWeaver.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/reloading/GlobalReloadingStrategy.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/util/FileUtils.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/util/WeavingContext.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/scripting/core/dependencyScan/probes/GenericsProbe.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/scripting/core/utilsTests/ReflectUtilTest.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/facelet/ConverterHandlerReloadingStrategy.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/SystemEventListenerProxy.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf2/annotation/GenericAnnotationScanner.java
myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf2/annotation/purged/PurgedComponent.java
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/JSR199Compiler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/JSR199Compiler.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/JSR199Compiler.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core-java6/src/main/java/org/apache/myfaces/scripting/loaders/java/jsr199/JSR199Compiler.java Thu Apr 1 20:25:57 2010
@@ -19,11 +19,11 @@
package org.apache.myfaces.scripting.loaders.java.jsr199;
import org.apache.myfaces.scripting.api.CompilationException;
+import org.apache.myfaces.scripting.api.CompilationResult;
import org.apache.myfaces.scripting.api.CompilerConst;
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.scripting.api.CompilationResult;
import javax.tools.*;
import java.io.File;
@@ -55,10 +55,9 @@ import java.util.logging.Logger;
* @author Werner Punz (latest modification by $Author: werpu $)
* @version $Revision: 812255 $ $Date: 2009-09-07 20:51:39 +0200 (Mo, 07 Sep 2009) $
*/
+@SuppressWarnings("unused")
public class JSR199Compiler implements org.apache.myfaces.scripting.api.Compiler {
- private static final String FILE_SEPARATOR = File.separator;
-
JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
ContainerFileManager fileManager = null;
@@ -70,8 +69,8 @@ public class JSR199Compiler implements o
* Compile a single file
*
* @param sourceRoot the source search path (root of our source)
- * @return
- * @throws ClassNotFoundException
+ * @return the compilation result of the compilation
+ * @throws CompilationException in case of a compilation error
* @deprecated note we will move over to a single
* compile step in the beginning in the long run
* we will deprecate it as soon as the full
@@ -82,15 +81,15 @@ public class JSR199Compiler implements o
* we do not do a single compile step anymore
*/
public CompilationResult compile(File sourceRoot, File targetPath, File toCompile, ClassLoader classPathHolder) throws CompilationException {
- fileManager = new ContainerFileManager(javaCompiler.getStandardFileManager(new DiagnosticCollector(), null, null));
+ fileManager = new ContainerFileManager(javaCompiler.getStandardFileManager(new DiagnosticCollector<JavaFileObject>(), null, null));
- DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector();
+ DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<JavaFileObject>();
//TODO add whitelist check here
getLog().info("[EXT-SCRIPTING] Doing a full recompile");
- Iterable<? extends JavaFileObject> fileObjects = fileManager.getJavaFileObjects(new File[]{toCompile});
+ Iterable<? extends JavaFileObject> fileObjects = fileManager.getJavaFileObjects(toCompile);
String[] options = new String[]{CompilerConst.JC_CLASSPATH, fileManager.getClassPath(), CompilerConst.JC_TARGET_PATH, WeavingContext.getConfiguration().getCompileTarget().getAbsolutePath(), CompilerConst.JC_SOURCEPATH, sourceRoot.getAbsolutePath(), CompilerConst.JC_DEBUG};
javaCompiler.getTask(null, fileManager, diagnosticCollector, Arrays.asList(options), null, fileObjects).call();
try {
@@ -112,12 +111,12 @@ public class JSR199Compiler implements o
*
* @param sourceRoot the root for all java sources to be compiled
* @param loader the classpath holder for the compilation
- * @throws ClassNotFoundException in case of a compilation error
+ * @throws CompilationException in case of a compilation error
*/
public CompilationResult compile(File sourceRoot, File destination, ClassLoader loader) throws CompilationException {
- fileManager = new ContainerFileManager(javaCompiler.getStandardFileManager(new DiagnosticCollector(), null, null));
+ fileManager = new ContainerFileManager(javaCompiler.getStandardFileManager(new DiagnosticCollector<JavaFileObject>(), null, null));
- DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector();
+ DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<JavaFileObject>();
getLog().info("[EXT-SCRIPTING] Doing a full recompile");
@@ -191,7 +190,7 @@ public class JSR199Compiler implements o
return retVal.toString();
}
- private final Logger getLog() {
+ private Logger getLog() {
return Logger.getLogger(this.getClass().getName());
}
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/api/BaseWeaver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/api/BaseWeaver.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/api/BaseWeaver.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/api/BaseWeaver.java Thu Apr 1 20:25:57 2010
@@ -22,6 +22,7 @@ import org.apache.commons.io.FilenameUti
import org.apache.myfaces.scripting.core.reloading.GlobalReloadingStrategy;
import org.apache.myfaces.scripting.core.util.ClassUtils;
import org.apache.myfaces.scripting.core.util.FileUtils;
+import org.apache.myfaces.scripting.core.util.StringUtils;
import org.apache.myfaces.scripting.core.util.WeavingContext;
import org.apache.myfaces.scripting.refresh.RefreshContext;
import org.apache.myfaces.scripting.refresh.ReloadingMetadata;
@@ -329,8 +330,7 @@ public abstract class BaseWeaver impleme
//compile via javac dynamically, also after this block dynamic compilation
//for the entire length of the request,
try {
- //TODO fix this
- if (!scriptPath.trim().equals(""))
+ if (!StringUtils.isBlank(scriptPath))
_compiler.compileAllFiles(scriptPath, _classPath);
} catch (ClassNotFoundException e) {
_log.logp(Level.SEVERE, "BaseWeaver", "fullyRecompile", e.getMessage(), e);
@@ -416,10 +416,6 @@ public abstract class BaseWeaver impleme
*
* at the next refresh the second step of the registration cycle should pick the new class up
*
- * TODO we have to mark the artifacting class as de-registered and then enforce
- * a reload this is however not the scope of the commit of this subtask
- * we only deal with class level reloading here
- * the de-registration notification should happen on artifact level (which will be the next subtask)
*/
if (_annotationScanner != null && retVal != null) {
_annotationScanner.scanClass(retVal);
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/reloading/GlobalReloadingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/reloading/GlobalReloadingStrategy.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/reloading/GlobalReloadingStrategy.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/reloading/GlobalReloadingStrategy.java Thu Apr 1 20:25:57 2010
@@ -36,7 +36,7 @@ import java.util.logging.Logger;
* depending on the artifact type to the correct
* strategy
* <p/>
- * TODO make the reloading strategy pluggable from outside!
+ * TODO make the reloading strategy pluggable from outside (1.1)!
*/
public class GlobalReloadingStrategy implements ReloadingStrategy {
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/util/FileUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/util/FileUtils.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/util/FileUtils.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/util/FileUtils.java Thu Apr 1 20:25:57 2010
@@ -95,7 +95,6 @@ public class FileUtils {
return;
}
- //TODO apply a filter here instead of doing the check directly
File[] files = rootDir.listFiles();
for (File file : files) {
boolean isDirectory = file.isDirectory();
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/util/WeavingContext.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/util/WeavingContext.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/util/WeavingContext.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/scripting/core/util/WeavingContext.java Thu Apr 1 20:25:57 2010
@@ -37,7 +37,7 @@ import java.util.logging.Logger;
* A set of weaving context class called
* by the various subsystems
* <p/>
- * TODO move this away from static methods into a singleton which is kept
+ * TODO (1.1) move this away from static methods into a singleton which is kept
* in the application context, to keep the context pattern.
*
* @author Werner Punz
@@ -45,18 +45,6 @@ import java.util.logging.Logger;
public class WeavingContext {
/**
- * data we can pass for other threads
- */
- static class ThreadLocalData {
- public Object _weaverHolder;
- public Object _refreshContextHolder;
- public Object _configuration;
- public Object _externalContext;
- }
-
- static ThreadLocalData _referenceThreadHolder = null;
-
- /**
* <p>
* we push our weaver into the thread local
* to avoid too many calls into the
@@ -198,6 +186,7 @@ public class WeavingContext {
/**
* @return true if our filter is enabled
*/
+ @SuppressWarnings("unused")
public static boolean isFilterEnabled() {
return _filterEnabled.get();
}
@@ -255,6 +244,7 @@ public class WeavingContext {
* @param artifactType the artifact type to be handled
* @return the proxy of the object if scripting is enabled, the original one otherwise
*/
+ @SuppressWarnings("unused")
public static Object createConstructorReloadingProxyFromObject(Object o, Class theInterface, int artifactType) {
if (!isScriptingEnabled()) {
return o;
@@ -304,30 +294,4 @@ public class WeavingContext {
return isScriptingEnabled() && getWeaver().isDynamic(clazz);
}
- /**
- * we push the threading data into
- * a shared queue
- */
- public static void pushThreadingData() {
- ThreadLocalData data = new ThreadLocalData();
- data._configuration = getConfiguration();
- data._refreshContextHolder = getRefreshContext();
- data._weaverHolder = getWeaver();
- data._externalContext = getExternalContext();
- _referenceThreadHolder = data;
- }
-
- public static void popThreadingData() {
- ThreadLocalData data = _referenceThreadHolder;
- setConfiguration((Configuration) data._configuration);
- setRefreshContext((RefreshContext) data._refreshContextHolder);
- setWeaver(data._weaverHolder);
- setExternalContext(data._externalContext);
- }
-
- public static void cleanThreadingData() {
- //we can enforce a prematurely cleanup that way
- _referenceThreadHolder = null;
- }
-
}
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/scripting/core/dependencyScan/probes/GenericsProbe.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/scripting/core/dependencyScan/probes/GenericsProbe.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/scripting/core/dependencyScan/probes/GenericsProbe.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/scripting/core/dependencyScan/probes/GenericsProbe.java Thu Apr 1 20:25:57 2010
@@ -27,6 +27,7 @@ import java.util.Set;
* @author Werner Punz (latest modification by $Author$)
* @version $Revision$ $Date$
*/
+@SuppressWarnings("unused")//used by dynamic instantiation
public class GenericsProbe {
Set<Probe> _testProbe = new HashSet<Probe>();
@@ -35,7 +36,6 @@ public class GenericsProbe {
}
public void setTestProbe(Set<Probe> testProbe) {
- //TODO generic case with generic only right hand side not handled
Collection<Probe2> mySet = new HashSet<Probe2>();
System.out.println(mySet.size());
_testProbe = testProbe;
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/scripting/core/utilsTests/ReflectUtilTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/scripting/core/utilsTests/ReflectUtilTest.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/scripting/core/utilsTests/ReflectUtilTest.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/org/apache/myfaces/scripting/core/utilsTests/ReflectUtilTest.java Thu Apr 1 20:25:57 2010
@@ -66,7 +66,7 @@ public class ReflectUtilTest {
assertTrue(MSG_PROBE_INSTANTIATED, probe != null);
try {
- probe = ReflectUtil.instantiate(Probe.class, new Cast(Integer.class, myHello), HELLO_WORLD);
+ ReflectUtil.instantiate(Probe.class, new Cast(Integer.class, myHello), HELLO_WORLD);
fail();
} catch (RuntimeException ex) {
assertTrue(MSG_INIT_FAIL, true);
@@ -75,13 +75,13 @@ public class ReflectUtilTest {
assertTrue(MSG_PROBE_INSTANTIATED, probe != null);
try {
- probe = ReflectUtil.instantiate(Probe.class, new Null(Integer.class), new Null(String.class));
+ ReflectUtil.instantiate(Probe.class, new Null(Integer.class), new Null(String.class));
fail();
} catch (RuntimeException ex) {
assertTrue(MSG_INIT_FAIL, true);
}
- //TODO test fails, but is not used so we can live with it
+ //TODO (1.1) test fails, but is not used so we can live with it
//probe = ReflectUtil.instantiate(Probe2.class,new Array(String.class, HELLO_WORLD, HELLO_WORLD));
//assertTrue("Probe must be instantiated", probe != null);
}
@@ -98,7 +98,7 @@ public class ReflectUtilTest {
assertTrue("retval must be true", retVal);
try {
- retVal = (Boolean) ReflectUtil.executeStaticMethod(Boolean.class, "xx_valueOf", "true");
+ ReflectUtil.executeStaticMethod(Boolean.class, "xx_valueOf", "true");
fail();
} catch (RuntimeException ex) {
assertTrue("Exception must be thrown", true);
@@ -123,7 +123,7 @@ public class ReflectUtilTest {
@Test
public void testExecuteMethod() throws Exception {
- Boolean probe = new Boolean(true);
+ Boolean probe = true;
Boolean retVal = (Boolean) ReflectUtil.executeMethod(probe, "valueOf", "true");
assertTrue(retVal);
String sRetVal = (String) ReflectUtil.executeMethod(probe, "toString");
@@ -133,7 +133,7 @@ public class ReflectUtilTest {
assertTrue(hashVal != null);
try {
- hashVal = ReflectUtil.executeMethod(new Probe(), "xx_hashCode");
+ ReflectUtil.executeMethod(new Probe(), "xx_hashCode");
fail();
} catch (RuntimeException ex) {
assertTrue("calling must faile with an RE", true);
@@ -143,7 +143,7 @@ public class ReflectUtilTest {
@Test
public void testFastExecuteMethod() throws Exception {
- Boolean probe = new Boolean(true);
+ Boolean probe = true;
Boolean retVal = (Boolean) ReflectUtil.fastExecuteMethod(probe, "valueOf", "true");
assertTrue(retVal);
String sRetVal = (String) ReflectUtil.fastExecuteMethod(probe, "toString");
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java Thu Apr 1 20:25:57 2010
@@ -45,6 +45,7 @@ import java.util.*;
*
* @author Werner Punz
*/
+@SuppressWarnings({"deprecation", "deprecation"})
public class ApplicationProxy extends Application implements Decorated {
volatile Application _delegate;
@@ -53,16 +54,9 @@ public class ApplicationProxy extends Ap
_delegate = delegate;
}
- //TODO add a proxy for the el resolvers as well
public void addELResolver(ELResolver elResolver) {
weaveDelegate();
- //TODO this can be problematic if several libraries add their own proxies
- // that way then might get get a cyclic stack
- //under normal circumstances this should not happen
- //because addElResolver is called once and getElResolver
- //does not change the stack afterwards in the worst case
- //we might get 2 of our proxies in the delegate stack
//the same goes for the rest of the factory stuff
if (!(elResolver instanceof ELResolverProxy))
@@ -130,8 +124,6 @@ public class ApplicationProxy extends Ap
}
public void removeELContextListener(ELContextListener elContextListener) {
- //TODO which el context listener is coming in our normal one
- //or the reloaded one?
weaveDelegate();
_delegate.removeELContextListener(elContextListener);
}
@@ -211,16 +203,19 @@ public class ApplicationProxy extends Ap
_delegate.setNavigationHandler(navigationHandler);
}
+ @SuppressWarnings("deprecation")
public PropertyResolver getPropertyResolver() {
weaveDelegate();
return _delegate.getPropertyResolver();
}
+ @SuppressWarnings("deprecation")
public void setPropertyResolver(PropertyResolver propertyResolver) {
weaveDelegate();
_delegate.setPropertyResolver(propertyResolver);
}
+ @SuppressWarnings("deprecation")
public VariableResolver getVariableResolver() {
weaveDelegate();
VariableResolver variableResolver = _delegate.getVariableResolver();
@@ -229,6 +224,7 @@ public class ApplicationProxy extends Ap
return variableResolver;
}
+ @SuppressWarnings("deprecation")
public void setVariableResolver(VariableResolver variableResolver) {
weaveDelegate();
if (!(variableResolver instanceof VariableResolverProxy))
@@ -248,7 +244,7 @@ public class ApplicationProxy extends Ap
hence we have to work with proxies here
*/
if (WeavingContext.isDynamic(handler.getClass()))
- handler = (ViewHandlerProxy) new ViewHandlerProxy(handler);
+ handler = new ViewHandlerProxy(handler);
return handler;
}
@@ -256,7 +252,7 @@ public class ApplicationProxy extends Ap
weaveDelegate();
/*make sure you have the delegates as well in properties*/
if (WeavingContext.isDynamic(viewHandler.getClass()))
- viewHandler = (ViewHandlerProxy) new ViewHandlerProxy(viewHandler);
+ viewHandler = new ViewHandlerProxy(viewHandler);
_delegate.setViewHandler(viewHandler);
}
@@ -274,8 +270,6 @@ public class ApplicationProxy extends Ap
public void addComponent(String componentType, String componentClass) {
weaveDelegate();
_delegate.addComponent(componentType, componentClass);
- //TODO handle this properly
- // WeavingContext.getRefreshContext().getComponentRendererDependencies(componentClass, "");
}
public UIComponent createComponent(String s) throws FacesException {
@@ -292,6 +286,7 @@ public class ApplicationProxy extends Ap
return (UIComponent) reloadInstance(component, ScriptingConst.ARTIFACT_TYPE_COMPONENT);
}
+ @SuppressWarnings("deprecation")
public UIComponent createComponent(ValueBinding valueBinding, FacesContext facesContext, String s) throws FacesException {
weaveDelegate();
UIComponent component = _delegate.createComponent(valueBinding, facesContext, s);
@@ -358,6 +353,7 @@ public class ApplicationProxy extends Ap
return _delegate.getConverterTypes();
}
+ @SuppressWarnings("deprecation")
public MethodBinding createMethodBinding(String s, Class[] classes) throws ReferenceSyntaxException {
weaveDelegate();
return _delegate.createMethodBinding(s, classes);
@@ -383,8 +379,7 @@ public class ApplicationProxy extends Ap
Validator retVal = _delegate.createValidator(s);
if (WeavingContext.isDynamic(retVal.getClass()) && !Proxy.isProxyClass(retVal.getClass())) {
- //todo bypass the serialisation problem on validators
- retVal = (Validator) reloadInstance(retVal, ScriptingConst.ARTIFACT_TYPE_VALIDATOR); //WeavingContext.createMethodReloadingProxyFromObject(retVal, Validator.class, ScriptingConst.ARTIFACT_TYPE_VALIDATOR);
+ retVal = (Validator) reloadInstance(retVal, ScriptingConst.ARTIFACT_TYPE_VALIDATOR);
}
return retVal;
}
@@ -394,6 +389,7 @@ public class ApplicationProxy extends Ap
return _delegate.getValidatorIds();
}
+ @SuppressWarnings("deprecation")
public ValueBinding createValueBinding(String s) throws ReferenceSyntaxException {
weaveDelegate();
return _delegate.createValueBinding(s);
@@ -403,7 +399,7 @@ public class ApplicationProxy extends Ap
return _delegate; //To change body of implemented methods use File | Settings | File Templates.
}
- private final Object reloadInstance(Object instance, int artefactType) {
+ private Object reloadInstance(Object instance, int artefactType) {
if (instance == null) {
return null;
}
@@ -414,9 +410,9 @@ public class ApplicationProxy extends Ap
return instance;
}
- private final boolean alreadyWovenInRequest(String clazz) {
+ private boolean alreadyWovenInRequest(String clazz) {
//portlets now can be enabled thanks to the jsf2 indirections regarding the external context
- Map reqMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+ Map<String,Object> reqMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
if (reqMap.get(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz) == null) {
reqMap.put(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz, "");
return false;
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java Thu Apr 1 20:25:57 2010
@@ -22,14 +22,10 @@ import org.apache.myfaces.scripting.api.
import org.apache.myfaces.scripting.api.ScriptingConst;
import org.apache.myfaces.scripting.core.util.WeavingContext;
-import javax.el.*;
-import java.beans.FeatureDescriptor;
-import java.util.HashSet;
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
import java.util.Iterator;
-import java.util.Set;
-import java.util.logging.Logger;
-
-
/**
* EL Resolver which is scripting enabled
@@ -37,9 +33,10 @@ import java.util.logging.Logger;
* @author Werner Punz
*/
public class ELResolverProxy extends ELResolver implements Decorated {
- Logger log = Logger.getLogger(ELResolverProxy.class.getName());
- public Object getValue(ELContext elContext, final Object base, final Object property) throws NullPointerException, PropertyNotFoundException, ELException {
+ ELResolver _delegate = null;
+
+ public Object getValue(ELContext elContext, final Object base, final Object property) throws NullPointerException, ELException {
//request, class is loaded anew hence we already have picked up the new code
Object retVal = _delegate.getValue(elContext, base, property);
@@ -54,9 +51,6 @@ public class ELResolverProxy extends ELR
//the problem starts with session application or custom scoped beans
//There nothing is compiled and we have to do the further bean processing
- //TODO move the bean dropping into the beginning of the lifecycle instead of on demand
- //That way we have a cleaner control over the refresh per request
-
Object newRetVal = WeavingContext.getWeaver().reloadScriptingInstance(retVal, ScriptingConst.ARTIFACT_TYPE_MANAGEDBEAN); /*once it was tainted or loaded by
our classloader we have to recreate all the time to avoid classloader issues*/
if (newRetVal != retVal) {
@@ -69,27 +63,27 @@ public class ELResolverProxy extends ELR
}
- public Class<?> getType(ELContext elContext, Object o, Object o1) throws NullPointerException, PropertyNotFoundException, ELException {
+ public Class<?> getType(ELContext elContext, Object o, Object o1) throws NullPointerException, ELException {
Class<?> retVal = _delegate.getType(elContext, o, o1);
- if (retVal != null && WeavingContext.isDynamic((Class) retVal)) {
- return WeavingContext.getWeaver().reloadScriptingClass((Class) retVal);
+ if (retVal != null && WeavingContext.isDynamic(retVal)) {
+ return WeavingContext.getWeaver().reloadScriptingClass(retVal);
}
return retVal;
}
- public void setValue(ELContext elContext, Object base, Object property, Object newRetVal) throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException {
- //now to more complex relations...
- if(base != null) {
- WeavingContext.getRefreshContext().getDependencyRegistry().addDependency(ScriptingConst.ENGINE_TYPE_JSF_ALL, base.getClass().getName(), base.getClass().getName(), newRetVal.getClass().getName());
+ public void setValue(ELContext elContext, Object base, Object property, Object newRetVal) throws NullPointerException, ELException {
+ //now to more complex relations...
+ if (base != null) {
+ WeavingContext.getRefreshContext().getDependencyRegistry().addDependency(ScriptingConst.ENGINE_TYPE_JSF_ALL, base.getClass().getName(), base.getClass().getName(), newRetVal.getClass().getName());
}
_delegate.setValue(elContext, base, property, newRetVal);
}
- public boolean isReadOnly(ELContext elContext, Object o, Object o1) throws NullPointerException, PropertyNotFoundException, ELException {
+ public boolean isReadOnly(ELContext elContext, Object o, Object o1) throws NullPointerException, ELException {
return _delegate.isReadOnly(elContext, o, o1);
}
- public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext elContext, Object o) {
+ public Iterator getFeatureDescriptors(ELContext elContext, Object o) {
return _delegate.getFeatureDescriptors(elContext, o);
}
@@ -101,17 +95,8 @@ public class ELResolverProxy extends ELR
_delegate = delegate;
}
- ELResolver _delegate = null;
-
public Object getDelegate() {
return _delegate; //To change body of implemented methods use File | Settings | File Templates.
}
- public Set<Integer> supportsEvents() {
- Set<Integer> supports = new HashSet<Integer>();
- supports.add(ScriptingConst.ARTIFACT_TYPE_MANAGEDBEAN);
-
- return supports; //To change body of implemented methods use File | Settings | File Templates.
- }
-
}
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java Thu Apr 1 20:25:57 2010
@@ -22,8 +22,8 @@ import org.apache.myfaces.scripting.api.
import org.apache.myfaces.scripting.api.ScriptingConst;
import org.apache.myfaces.scripting.core.util.WeavingContext;
-import javax.faces.el.VariableResolver;
-import javax.faces.el.EvaluationException;
+import javax.faces.el.*;
+
import javax.faces.context.FacesContext;
/**
@@ -32,6 +32,7 @@ import javax.faces.context.FacesContext;
*
* @author Werner Punz
*/
+@SuppressWarnings("deprecation")
public class VariableResolverProxy extends VariableResolver implements Decorated {
VariableResolver _delegate;
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/facelet/ConverterHandlerReloadingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/facelet/ConverterHandlerReloadingStrategy.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/facelet/ConverterHandlerReloadingStrategy.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/facelet/ConverterHandlerReloadingStrategy.java Thu Apr 1 20:25:57 2010
@@ -35,7 +35,7 @@ import javax.faces.view.facelets.*;
* @author Werner Punz (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-
+@SuppressWarnings("unused")//used dynamically
public class ConverterHandlerReloadingStrategy extends SimpleReloadingStrategy {
public ConverterHandlerReloadingStrategy(ScriptingWeaver weaver) {
@@ -58,8 +58,6 @@ public class ConverterHandlerReloadingSt
ConverterConfig config = (ConverterConfig) ReflectUtil.executeMethod(oldHandler, "getConverterConfig");
ConverterHandler newHandler = (ConverterHandler) ReflectUtil.instantiate(aclass, new Cast(ConverterConfig.class, config));
- //TODO check if the component is attached correctly after reloading
-
//save all pending non config related properties wherever possible
super.mapProperties(newHandler, oldHandler);
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java Thu Apr 1 20:25:57 2010
@@ -46,10 +46,6 @@ import java.util.concurrent.ConcurrentHa
public class ApplicationProxy extends Application implements Decorated {
Application _delegate = null;
- private static final String ERR_CONV_ANN_MOVED = "Converter annotation moved but target was not found";
- private static final String ERR_ANN_VAL_MOVED = "Annotation on validator removed but no replacement found";
- private static final String ERR_ANN_COMP_MOVED = "Annotation on component removed but no replacement found";
- private static final String ERR_BEH_NOTFOUND = "Behavior annotation was moved but could not be found";
/*
* separate map needed for the behavior ids, because
@@ -72,10 +68,12 @@ public class ApplicationProxy extends Ap
this.proxy = proxy;
}
+ @SuppressWarnings("unused")
public Class getEvent() {
return event;
}
+ @SuppressWarnings("unused")
public void setEvent(Class event) {
this.event = event;
}
@@ -84,6 +82,7 @@ public class ApplicationProxy extends Ap
return proxy;
}
+ @SuppressWarnings("unused")
public void setProxy(Decorated proxy) {
this.proxy = proxy;
}
@@ -95,11 +94,8 @@ public class ApplicationProxy extends Ap
EventHandlerProxyEntry that = (EventHandlerProxyEntry) o;
- if (event != null ? !event.equals(that.event) : that.event != null) return false;
- if (proxy != null ? !proxy.getDelegate().getClass().getName().equals(that.proxy.getDelegate().getClass().getName()) : that.proxy != null)
- return false;
+ return !(event != null ? !event.equals(that.event) : that.event != null) && !(proxy != null ? !proxy.getDelegate().getClass().getName().equals(that.proxy.getDelegate().getClass().getName()) : that.proxy != null);
- return true;
}
@Override
@@ -119,10 +115,10 @@ public class ApplicationProxy extends Ap
* we can fetch our proxy which might already contain
* the same object in a refreshed state from the value
* part of the set, in our case
- * using hashmaps should speed things up
+ * using hash maps should speed things up
* <p/>
* since we only have few write operations but access
- * the map multithready we use concurrentHashMap here
+ * the map multithreaded we use concurrentHashMap here
*/
Map<EventHandlerProxyEntry, EventHandlerProxyEntry> _eventHandlerIdx = new ConcurrentHashMap<EventHandlerProxyEntry, EventHandlerProxyEntry>();
@@ -197,39 +193,6 @@ public class ApplicationProxy extends Ap
}
- /**
- * De-registers a single object entity from
- * our listener event, the entity can implement either @ListenersFor or @ListenerFor
- * The idea is that the annotation currently is mostly used on components and renderers to keep
- * track of changes. The components and renderers are dynamically refreshed but to keep track of
- * the listeners in our system we have to deregister the old instances upon refresh
- * the new ones should be registered automatically by our code
- *
- * @param listener the listener object implementing our annotation
- */
- private void deregisterEventHandlers(Object listener) {
- if (listener instanceof SystemEventListener && listener.getClass().isAnnotationPresent(ListenersFor.class)) {
- ListenersFor listenerData = listener.getClass().getAnnotation(ListenersFor.class);
- for (ListenerFor singleEntry : listenerData.value()) {
- unsubscribeFromAnnotatedEvent(listener, singleEntry);
- }
- } else if (listener instanceof SystemEventListener && listener.getClass().isAnnotationPresent(ListenerFor.class)) {
- ListenerFor listenerData = listener.getClass().getAnnotation(ListenerFor.class);
- unsubscribeFromAnnotatedEvent(listener, listenerData);
- }
- }
-
- /**
- * De-registers a single listener entity which implements @ListenerFor
- *
- * @param listener the listener object implementing the annotation
- * @param listenerData the annotation data (we have it outside to cover both possible listener cases
- */
- private void unsubscribeFromAnnotatedEvent(Object listener, ListenerFor listenerData) {
- Class systemEventClass = listenerData.systemEventClass();
- unsubscribeFromEvent(systemEventClass, (SystemEventListener) listener);
- }
-
public ExpressionFactory getExpressionFactory() {
weaveDelegate();
return _delegate.getExpressionFactory();
@@ -243,8 +206,6 @@ public class ApplicationProxy extends Ap
}
public void removeELContextListener(ELContextListener elContextListener) {
- //TODO which el context listener is coming in our normal one
- //or the reloaded one?
weaveDelegate();
_delegate.removeELContextListener(elContextListener);
}
@@ -303,7 +264,7 @@ public class ApplicationProxy extends Ap
weaveDelegate();
//defined in the setter to speed things up a little
NavigationHandler retVal = _delegate.getNavigationHandler();
- //TODO add annotatiom support for the navigation handler as well
+
if (retVal != null && WeavingContext.isDynamic(retVal.getClass()))
retVal = new NavigationHandlerProxy(retVal);
return retVal;
@@ -311,22 +272,25 @@ public class ApplicationProxy extends Ap
public void setNavigationHandler(NavigationHandler navigationHandler) {
weaveDelegate();
- //TODO add annotatiom support for the navigation handler as well
+
if (navigationHandler != null && WeavingContext.isDynamic(navigationHandler.getClass()))
navigationHandler = new NavigationHandlerProxy(navigationHandler);
_delegate.setNavigationHandler(navigationHandler);
}
+ @SuppressWarnings("deprecation")
public PropertyResolver getPropertyResolver() {
weaveDelegate();
return _delegate.getPropertyResolver();
}
+ @SuppressWarnings("deprecation")
public void setPropertyResolver(PropertyResolver propertyResolver) {
weaveDelegate();
_delegate.setPropertyResolver(propertyResolver);
}
+ @SuppressWarnings("deprecation")
public VariableResolver getVariableResolver() {
weaveDelegate();
VariableResolver variableResolver = _delegate.getVariableResolver();
@@ -335,6 +299,7 @@ public class ApplicationProxy extends Ap
return variableResolver;
}
+ @SuppressWarnings("deprecation")
public void setVariableResolver(VariableResolver variableResolver) {
weaveDelegate();
if (!(variableResolver instanceof VariableResolverProxy))
@@ -354,7 +319,7 @@ public class ApplicationProxy extends Ap
hence we have to work with proxies here
*/
if (WeavingContext.isDynamic(handler.getClass()))
- handler = (ViewHandlerProxy) new ViewHandlerProxy(handler);
+ handler = new ViewHandlerProxy(handler);
return handler;
}
@@ -362,7 +327,7 @@ public class ApplicationProxy extends Ap
weaveDelegate();
/*make sure you have the delegates as well in properties*/
if (WeavingContext.isDynamic(viewHandler.getClass()))
- viewHandler = (ViewHandlerProxy) new ViewHandlerProxy(viewHandler);
+ viewHandler = new ViewHandlerProxy(viewHandler);
_delegate.setViewHandler(viewHandler);
}
@@ -404,6 +369,7 @@ public class ApplicationProxy extends Ap
}
+ @SuppressWarnings("deprecation")
public UIComponent createComponent(ValueBinding valueBinding, FacesContext facesContext, String componentType) throws FacesException {
weaveDelegate();
UIComponent oldComponent = _delegate.createComponent(valueBinding, facesContext, componentType);
@@ -491,6 +457,7 @@ public class ApplicationProxy extends Ap
return _delegate.getConverterTypes();
}
+ @SuppressWarnings("deprecation")
public MethodBinding createMethodBinding(String s, Class[] classes) throws ReferenceSyntaxException {
weaveDelegate();
return _delegate.createMethodBinding(s, classes);
@@ -528,8 +495,6 @@ public class ApplicationProxy extends Ap
Validator retVal = _delegate.createValidator(validatorId);
- //TODO purge error assert here
-
//the validators are recreated every request we do not have to deal with them on method level
Validator newRetVal = (Validator) reloadInstance(retVal, ScriptingConst.ARTIFACT_TYPE_VALIDATOR);
if (newRetVal != retVal) {
@@ -543,6 +508,7 @@ public class ApplicationProxy extends Ap
return _delegate.getValidatorIds();
}
+ @SuppressWarnings("deprecation")
public ValueBinding createValueBinding(String s) throws ReferenceSyntaxException {
weaveDelegate();
return _delegate.createValueBinding(s);
@@ -555,10 +521,10 @@ public class ApplicationProxy extends Ap
if (behaviorClass.equals(PurgedValidator.class.getName())) {
//purged case we do a full rescan
WeavingContext.getWeaver().fullClassScan();
- Behavior behavior = (Behavior) _delegate.createBehavior(behaviorId);
+ Behavior behavior = _delegate.createBehavior(behaviorId);
_behaviors.put(behaviorId, behaviorClass);
if (behavior instanceof PurgedBehavior) {
- //Null not allowed here, but we set a purted validator to make
+ //Null not allowed here, but we set a purged validator to make
//sure that we get errors on the proper level
_delegate.addBehavior(behaviorId, PurgedBehavior.class.getName());
_behaviors.remove(behaviorId);
@@ -654,6 +620,7 @@ public class ApplicationProxy extends Ap
}
@Override
+ @SuppressWarnings("unchecked")
public <T> T evaluateExpressionGet(FacesContext facesContext, String s, Class<? extends T> aClass) throws ELException {
weaveDelegate();
//good place for a dynamic reloading check as well
@@ -768,18 +735,18 @@ public class ApplicationProxy extends Ap
return _delegate; //To change body of implemented methods use File | Settings | File Templates.
}
- private final Object reloadInstance(Object instance, int artefactType) {
+ private Object reloadInstance(Object instance, int artifactType) {
if (instance == null) {
return null;
}
if (WeavingContext.isDynamic(instance.getClass()) && !alreadyWovenInRequest(instance.getClass().getName())) {
- instance = WeavingContext.getWeaver().reloadScriptingInstance(instance, artefactType);
+ instance = WeavingContext.getWeaver().reloadScriptingInstance(instance, artifactType);
alreadyWovenInRequest(instance.getClass().getName());
}
return instance;
}
- private final boolean alreadyWovenInRequest(String clazz) {
+ private boolean alreadyWovenInRequest(String clazz) {
//portlets now can be enabled thanks to the jsf2 indirections regarding the external context
Map<String, Object> req = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
if (req.get(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz) == null) {
@@ -815,6 +782,7 @@ public class ApplicationProxy extends Ap
return oldComponent;
}
+ @SuppressWarnings("deprecation")
private UIComponent handleAnnotationChange(UIComponent oldComponent, ValueBinding valueBinding, FacesContext context, String componentType) {
UIComponent componentToChange = _delegate.createComponent(valueBinding, context, componentType);
if (componentToChange instanceof PurgedComponent) {
@@ -856,7 +824,6 @@ public class ApplicationProxy extends Ap
private UIComponent handleAnnotationChange(UIComponent oldComponent, ValueExpression valueExpression, FacesContext facesContext, String s, String s1) {
UIComponent componentToChange = _delegate.createComponent(valueExpression, facesContext, s, s1);
- String family = oldComponent.getFamily();
if (componentToChange instanceof PurgedComponent) {
WeavingContext.getWeaver().fullClassScan();
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java Thu Apr 1 20:25:57 2010
@@ -23,9 +23,10 @@ import org.apache.myfaces.scripting.api.
import org.apache.myfaces.scripting.api.ScriptingConst;
import org.apache.myfaces.scripting.core.util.WeavingContext;
-import javax.el.*;
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
import javax.faces.context.FacesContext;
-import java.beans.FeatureDescriptor;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.Level;
@@ -43,28 +44,20 @@ public class ELResolverProxy extends ELR
static ThreadLocal<Boolean> _getValue = new ThreadLocal<Boolean>();
- public Object getValue(ELContext elContext, final Object base, final Object property) throws NullPointerException, PropertyNotFoundException, ELException {
+ public Object getValue(ELContext elContext, final Object base, final Object property) throws NullPointerException, ELException {
Object retVal = _delegate.getValue(elContext, base, property);
- Object newRetVal = null;
- //TODO simplify this, we do not need it anymore since we do our base scan at the beginning
+ Object newRetVal;
if (retVal != null && WeavingContext.isDynamic(retVal.getClass())) {
- //special case late el expression resolution, not catachable on class level
- if (retVal.getClass().getName().equals("BlogEntry")) {
- System.out.println(Thread.currentThread().getContextClassLoader().getClass().toString());
- }
newRetVal = WeavingContext.getWeaver().reloadScriptingInstance(retVal, ScriptingConst.ARTIFACT_TYPE_MANAGEDBEAN);
if (newRetVal != retVal) {
setValue(elContext, base, property, newRetVal);
}
- //in case we have an annotation change we have to deal with it differently
- //newRetVal = reloadAnnotatedBean(elContext, base, property, newRetVal);
-
return newRetVal;
} else if (retVal == null) {
@@ -104,15 +97,15 @@ public class ELResolverProxy extends ELR
return newRetVal;
}
- public Class<?> getType(ELContext elContext, Object o, Object o1) throws NullPointerException, PropertyNotFoundException, ELException {
+ public Class<?> getType(ELContext elContext, Object o, Object o1) throws NullPointerException, ELException {
Class<?> retVal = _delegate.getType(elContext, o, o1);
- if (retVal != null && WeavingContext.isDynamic((Class) retVal)) {
- return WeavingContext.getWeaver().reloadScriptingClass((Class) retVal);
+ if (retVal != null && WeavingContext.isDynamic(retVal)) {
+ return WeavingContext.getWeaver().reloadScriptingClass(retVal);
}
return retVal;
}
- public void setValue(ELContext elContext, Object base, Object property, Object value) throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException {
+ public void setValue(ELContext elContext, Object base, Object property, Object value) throws NullPointerException, ELException {
//now to more complex relations...
if (base != null) {
WeavingContext.getRefreshContext().getDependencyRegistry().addDependency(ScriptingConst.ENGINE_TYPE_JSF_ALL, base.getClass().getName(), base.getClass().getName(), value.getClass().getName());
@@ -120,11 +113,11 @@ public class ELResolverProxy extends ELR
_delegate.setValue(elContext, base, property, value);
}
- public boolean isReadOnly(ELContext elContext, Object o, Object o1) throws NullPointerException, PropertyNotFoundException, ELException {
+ public boolean isReadOnly(ELContext elContext, Object o, Object o1) throws NullPointerException, ELException {
return _delegate.isReadOnly(elContext, o, o1);
}
- public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext elContext, Object o) {
+ public Iterator getFeatureDescriptors(ELContext elContext, Object o) {
return _delegate.getFeatureDescriptors(elContext, o);
}
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/FacesContextProxy.java Thu Apr 1 20:25:57 2010
@@ -140,8 +140,6 @@ public class FacesContextProxy extends F
weaveDelegate();
}
- //TODO add support for myfaces 2.0 fully here
-
@Override
public Map<Object, Object> getAttributes() {
return _delegate.getAttributes();
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java Thu Apr 1 20:25:57 2010
@@ -78,11 +78,9 @@ public class RenderkitProxy extends Rend
return rendr;
}
- //TODO probably not needed anymore
private ClientBehaviorRenderer handleAnnotationChangeBehaviorRenderer(String s) {
ClientBehaviorRenderer rendr2;
- //WeavingContext.getWeaver().fullClassScan();
rendr2 = _delegate.getClientBehaviorRenderer(s);
if (rendr2 instanceof PurgedClientBehaviorRenderer) {
@@ -92,8 +90,6 @@ public class RenderkitProxy extends Rend
return rendr2;
}
- //TODO probably not needed anymore
-
private Renderer handleAnnotationChange(String s, String s1) {
Renderer rendr2;
@@ -121,7 +117,6 @@ public class RenderkitProxy extends Rend
return (ResponseStream) reloadInstance(_delegate.createResponseStream(outputStream), ScriptingConst.ARTIFACT_TYPE_RESPONSESTREAM);
}
- //TODO add full support for myfaces 2.0 here
@Override
public void addClientBehaviorRenderer(String s, ClientBehaviorRenderer renderer) {
@@ -137,7 +132,7 @@ public class RenderkitProxy extends Rend
ClientBehaviorRenderer rendr = _delegate.getClientBehaviorRenderer(s);
ClientBehaviorRenderer rendr2 = (ClientBehaviorRenderer) reloadInstance(rendr, ScriptingConst.ARTIFACT_TYPE_CLIENTBEHAVIORRENDERER);
if (rendr != rendr2) {
- //TODO simplyfy this
+
rendr2 = _delegate.getClientBehaviorRenderer(s);
if (rendr2 instanceof PurgedClientBehaviorRenderer) {
return handleAnnotationChangeBehaviorRenderer(s);
@@ -169,11 +164,11 @@ public class RenderkitProxy extends Rend
return _delegate;
}
- private final void weaveDelegate() {
+ private void weaveDelegate() {
_delegate = (RenderKit) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_RENDERKIT);
}
- private final Object reloadInstance(Object instance, int artefactType) {
+ private Object reloadInstance(Object instance, int artefactType) {
if (instance == null) {
return null;
}
@@ -186,7 +181,7 @@ public class RenderkitProxy extends Rend
return instance;
}
- private final boolean alreadyWovenInRequest(String clazz) {
+ private boolean alreadyWovenInRequest(String clazz) {
//portlets now can be enabled thanks to the jsf2 indirections regarding the external context
Map<String, Object> req = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
if (req.get(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz) == null) {
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/SystemEventListenerProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/SystemEventListenerProxy.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/SystemEventListenerProxy.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/SystemEventListenerProxy.java Thu Apr 1 20:25:57 2010
@@ -60,7 +60,7 @@ public class SystemEventListenerProxy im
}
private void weaveDelegate() {
- //TODO add a speed optimization here by pushing something in the request map
+ //TODO (1.1) add a speed optimization here by pushing something in the request map
if (_delegate != null) {
_delegate = (SystemEventListener) WeavingContext.getWeaver().reloadScriptingInstance(_delegate, ScriptingConst.ARTIFACT_TYPE_SYSTEMEVENTLISTENER);
}
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java Thu Apr 1 20:25:57 2010
@@ -22,9 +22,9 @@ import org.apache.myfaces.scripting.api.
import org.apache.myfaces.scripting.api.ScriptingConst;
import org.apache.myfaces.scripting.core.util.WeavingContext;
-import javax.faces.el.VariableResolver;
-import javax.faces.el.EvaluationException;
import javax.faces.context.FacesContext;
+import javax.faces.el.*;
+
/**
* objects loaded must
@@ -32,6 +32,7 @@ import javax.faces.context.FacesContext;
*
* @author Werner Punz
*/
+@SuppressWarnings("deprecation") //we must suppress it here
public class VariableResolverProxy extends VariableResolver implements Decorated {
VariableResolver _delegate;
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ViewHandlerProxy.java Thu Apr 1 20:25:57 2010
@@ -101,7 +101,6 @@ public class ViewHandlerProxy extends Vi
_delegate.writeState(facesContext);
}
- //TODO add myfaces 2.0 stuff here
@Override
public String deriveViewId(FacesContext facesContext, String s) {
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf2/annotation/GenericAnnotationScanner.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf2/annotation/GenericAnnotationScanner.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf2/annotation/GenericAnnotationScanner.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf2/annotation/GenericAnnotationScanner.java Thu Apr 1 20:25:57 2010
@@ -23,13 +23,13 @@ import org.apache.myfaces.scripting.api.
import org.apache.myfaces.scripting.api.ClassScanner;
import org.apache.myfaces.scripting.api.ScriptingWeaver;
import org.apache.myfaces.scripting.core.util.WeavingContext;
-import org.apache.myfaces.scripting.loaders.groovy.GroovyScriptingWeaver;
-import org.apache.myfaces.scripting.loaders.java.RecompiledClassLoader;
import org.apache.myfaces.scripting.loaders.java.ScannerClassloader;
import org.apache.myfaces.scripting.refresh.ReloadingMetadata;
import javax.faces.context.FacesContext;
import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* @author Werner Punz (latest modification by $Author$)
@@ -40,8 +40,7 @@ import java.util.*;
* and then adds the id/name -> class binding information to the correct factory locations,
* wherever possible
*/
-
-
+@SuppressWarnings("unused")
public class GenericAnnotationScanner extends BaseAnnotationScanListener implements ClassScanner {
List<ClassScanListener> _listeners = new LinkedList<ClassScanListener>();
@@ -65,14 +64,12 @@ public class GenericAnnotationScanner ex
_sourcePaths.addFirst(sourcePath);
}
- Collection<java.lang.annotation.Annotation> filterAnnotations(java.lang.annotation.Annotation[] anns) {
- List<java.lang.annotation.Annotation> retVal = new ArrayList<java.lang.annotation.Annotation>(anns.length);
- if (anns == null) {
- return retVal;
- }
- for (java.lang.annotation.Annotation ann : anns) {
- if (ann.annotationType().getName().startsWith(JAVAX_FACES)) {
- retVal.add(ann);
+ Collection<java.lang.annotation.Annotation> filterAnnotations(java.lang.annotation.Annotation[] annotations) {
+ List<java.lang.annotation.Annotation> retVal = new ArrayList<java.lang.annotation.Annotation>(annotations.length);
+
+ for (java.lang.annotation.Annotation annotation : annotations) {
+ if (annotation.annotationType().getName().startsWith(JAVAX_FACES)) {
+ retVal.add(annotation);
}
}
@@ -80,9 +77,9 @@ public class GenericAnnotationScanner ex
}
public void scanClass(Class clazz) {
- java.lang.annotation.Annotation[] anns = clazz.getAnnotations();
+ java.lang.annotation.Annotation[] annotations = clazz.getAnnotations();
- Collection<java.lang.annotation.Annotation> annCol = filterAnnotations(anns);
+ Collection<java.lang.annotation.Annotation> annCol = filterAnnotations(annotations);
if (!annCol.isEmpty()) {
addOrMoveAnnotations(clazz);
} else {
@@ -109,23 +106,19 @@ public class GenericAnnotationScanner ex
//check if the faces config is already available otherwise we cannot scan yet
final FacesContext facesContext = FacesContext.getCurrentInstance();
//runtime config not started
- //for now we only can reache the runtime config in the referenced BaseAnnotatonScanListener
+ //for now we only can reach the runtime config in the referenced BaseAnnotatonScanListener
//if we have a facesContext reachable.
if (facesContext == null) {
- //TODO decouple the scan in the BaseAnnotationScanListener from the facesConfig
+ //TODO (1.1) decouple the scan in the BaseAnnotationScanListener from the facesConfig
//to get the runtime config
return;
}
for (String className : _weaver.loadPossibleDynamicClasses()) {
- //TODO replace the standard scanner with our Scanning one here
-
- //TODO we need another loader here which adds the meta information if not present to our
- //managed beans
try {
ScannerClassloader loader = new ScannerClassloader(Thread.currentThread().getContextClassLoader(), -1, null, WeavingContext.getConfiguration().getCompileTarget());
- Class clazz = null;
+ Class clazz;
//in case the class does not exist we have to load it from our weavingcontext
//otherwise we do just a scan on the class to avoid side behavior
if (WeavingContext.getFileChangedDaemon().getClassMap().get(className) == null) {
@@ -134,16 +127,6 @@ public class GenericAnnotationScanner ex
clazz = loader.loadClass(className);
}
- //TODO we have the problem here that this code
- //in the worst case resets the class
- //that causes a problem with our bean refreshes afterwards
- //which have to take care of the problem
-
- //TODO unify this, problem is due to the initial class dependency scan
- //we already have the classes but unlike in groovy they are not tainted
- //hence we do not have the annotations yet scanned
- //in groovy we have the initial scan not done hence
- //the annotations are scanned on the fly!
if (clazz != null) {
java.lang.annotation.Annotation[] anns = clazz.getAnnotations();
if (anns != null && anns.length > 0) {
@@ -153,7 +136,8 @@ public class GenericAnnotationScanner ex
}
}
} catch (ClassNotFoundException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ Logger _logger = Logger.getLogger(this.getClass().getName());
+ _logger.log(Level.WARNING, "", e);
}
}
@@ -163,7 +147,7 @@ public class GenericAnnotationScanner ex
* add or moves a class level annotation
* to a new place
*
- * @param clazz
+ * @param clazz the class to have the annotation moved or added
*/
private void addOrMoveAnnotations(Class clazz) {
java.lang.annotation.Annotation[] anns = clazz.getAnnotations();
@@ -189,7 +173,7 @@ public class GenericAnnotationScanner ex
* we have to entirely remove the annotation
* from our internal registry and the myfaces registry
*
- * @param clazz
+ * @param clazz the class to have the annotation removed
*/
private void removeAnnotations(Class clazz) {
String registeredAnnotation = _registeredAnnotations.get(clazz.getName());
@@ -205,14 +189,6 @@ public class GenericAnnotationScanner ex
}
}
- private void annotationMoved(Class clazz, java.lang.annotation.Annotation ann, AnnotationScanListener listener) {
- //case class exists but it has been moved to anoter annotation
- String registeredAnnotation = _registeredAnnotations.get(clazz.getName());
- if (registeredAnnotation != null && registeredAnnotation.equals(ann.getClass().getName())) {
- removeAnnotations(clazz);
- }
- }
-
public void clearListeners() {
_listeners.clear();
}
Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf2/annotation/purged/PurgedComponent.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf2/annotation/purged/PurgedComponent.java?rev=930076&r1=930075&r2=930076&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf2/annotation/purged/PurgedComponent.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf2/annotation/purged/PurgedComponent.java Thu Apr 1 20:25:57 2010
@@ -18,18 +18,7 @@
*/
package org.apache.myfaces.scripting.jsf2.annotation.purged;
-import javax.faces.component.UIComponent;
import javax.faces.component.UIOutput;
-import javax.faces.el.ValueBinding;
-import javax.faces.context.FacesContext;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesListener;
-import javax.faces.render.Renderer;
-import java.util.Map;
-import java.util.List;
-import java.util.Iterator;
-import java.io.IOException;
/**
* We override the component from a real family so that