You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2009/10/27 08:24:36 UTC
svn commit: r830081 -
/myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
Author: werpu
Date: Tue Oct 27 07:24:35 2009
New Revision: 830081
URL: http://svn.apache.org/viewvc?rev=830081&view=rev
Log:
https://issues.apache.org/jira/browse/EXTSCRIPT-26
implemented the removal of behaviors for getBehaviorIds
Modified:
myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
Modified: myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java?rev=830081&r1=830080&r2=830081&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java (original)
+++ myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java Tue Oct 27 07:24:35 2009
@@ -21,10 +21,7 @@
import org.apache.myfaces.scripting.api.Decorated;
import org.apache.myfaces.scripting.api.ScriptingConst;
import org.apache.myfaces.scripting.core.util.ProxyUtils;
-import org.apache.myfaces.scripting.jsf2.annotation.purged.PurgedResourceHandler;
-import org.apache.myfaces.scripting.jsf2.annotation.purged.PurgedComponent;
-import org.apache.myfaces.scripting.jsf2.annotation.purged.PurgedValidator;
-import org.apache.myfaces.scripting.jsf2.annotation.purged.PurgedConverter;
+import org.apache.myfaces.scripting.jsf2.annotation.purged.*;
import javax.el.*;
import javax.faces.FacesException;
@@ -41,6 +38,7 @@
import javax.faces.validator.Validator;
import java.lang.reflect.Proxy;
import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
/**
* our decorating applicstion
@@ -61,6 +59,11 @@
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";
+
+ //TODO add purged mapa here as well, for the getBehaviorIds etc...
+ Map <String, String>_behaviors = new ConcurrentHashMap();
+
public ApplicationProxy(Application delegate) {
_delegate = delegate;
@@ -441,8 +444,6 @@
if(newRetVal != retVal) {
return _delegate.createValidator(validatorId);
}
-
- //retVal = (Validator) ProxyUtils.createMethodReloadingProxyFromObject(retVal, Validator.class);
}
return retVal;
}
@@ -461,13 +462,29 @@
@Override
public void addBehavior(String behaviorId, String behaviorClass) {
weaveDelegate();
+
+ if (behaviorClass.equals(PurgedValidator.class.getName())) {
+ //purged case we do a full rescane
+ ProxyUtils.getWeaver().fullAnnotationScan();
+ Behavior 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
+ //sure that we get errors on the proper level
+ _delegate.addBehavior(behaviorId, PurgedBehavior.class.getName());
+ _behaviors.remove(behaviorId);
+ throw new FacesException(ERR_BEH_NOTFOUND);
+ }
+ return;
+ }
+
_delegate.addBehavior(behaviorId, behaviorClass);
}
@Override
- public void addDefaultValidatorId(String behaviorId) {
+ public void addDefaultValidatorId(String validatorId) {
weaveDelegate();
- _delegate.addDefaultValidatorId(behaviorId);
+ _delegate.addDefaultValidatorId(validatorId);
}
@Override
@@ -564,7 +581,8 @@
@Override
public Iterator<String> getBehaviorIds() {
weaveDelegate();
- return _delegate.getBehaviorIds();
+ return _behaviors.keySet().iterator();
+ //return _delegate.getBehaviorIds();
}
@Override