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 2012/03/14 16:46:07 UTC

svn commit: r1300598 [6/10] - in /myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src: main/java/org/apache/myfaces/extensions/scripting/core/api/ main/java/org/apache/myfaces/extensions/scripting/core/common/ main/java/org/apache...

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/GenericAnnotationScanner.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/GenericAnnotationScanner.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/GenericAnnotationScanner.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/GenericAnnotationScanner.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.scripting.jsf.annotation;
+
+import org.apache.myfaces.extensions.scripting.core.api.AnnotationScanListener;
+import org.apache.myfaces.extensions.scripting.core.api.ClassScanListener;
+import org.apache.myfaces.extensions.scripting.core.api.ScriptingConst;
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+import org.apache.myfaces.extensions.scripting.core.engine.api.ClassScanner;
+import org.apache.myfaces.extensions.scripting.core.engine.dependencyScan.loaders.ScannerClassloader;
+
+import javax.faces.context.FacesContext;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ *          <p/>
+ *          Source path annotation scanner for java it scans all sources in the specified source paths
+ *          recursively for additional information
+ *          and then adds the id/name -> class binding information to the correct factory locations,
+ *          wherever possible
+ */
+@SuppressWarnings("unused")
+public class GenericAnnotationScanner extends BaseAnnotationScanListener implements ClassScanner
+{
+    //eventing system not yet fully implemented
+    List<ClassScanListener> _listeners = new LinkedList<ClassScanListener>();
+
+    //this registry is needed to keep track of added and moved annotations
+    Map<String, String> _registeredAnnotations = new HashMap<String, String>();
+
+    LinkedList<String> _sourcePaths = new LinkedList<String>();
+
+    WeavingContext _weaver = null;
+
+    public GenericAnnotationScanner() {
+        _weaver = WeavingContext.getInstance();
+        initDefaultListeners();
+    }
+
+    public void addScanPath(String sourcePath) {
+        _sourcePaths.addFirst(sourcePath);
+    }
+
+    Collection<java.lang.annotation.Annotation> filterAnnotations(java.lang.annotation.Annotation[] annotations) {
+        List<java.lang.annotation.Annotation> retVal = new ArrayList<java.lang.annotation.Annotation>(annotations.length);
+        
+        for (java.lang.annotation.Annotation annotation : annotations) {
+            if (annotation.annotationType().getName().startsWith(ScriptingConst.JAVAX_FACES)) {
+                retVal.add(annotation);
+            }
+
+        }
+        return retVal;
+    }
+
+    public void scanClass(Class clazz) {
+        java.lang.annotation.Annotation[] annotations = clazz.getAnnotations();
+
+        Collection<java.lang.annotation.Annotation> annCol = filterAnnotations(annotations);
+        if (!annCol.isEmpty()) {
+            addOrMoveAnnotations(clazz);
+        } else {
+            removeAnnotations(clazz);
+        }
+    }
+
+    private void initDefaultListeners() {
+        _listeners.add(new BeanImplementationListener());
+        _listeners.add(new BehaviorImplementationListener());
+        _listeners.add(new ComponentImplementationListener());
+        _listeners.add(new ConverterImplementationListener());
+        _listeners.add(new RendererImplementationListener());
+        _listeners.add(new ValidatorImplementationListener());
+    }
+
+    /**
+     * builds up the parsing chain and then notifies its observers
+     * on the found data
+     */
+    public void scanPaths() {
+        //https://issues.apache.org/jira/browse/EXTSCRIPT-33
+
+        //check if the faces config is already available otherwise we cannot scan yet
+        final FacesContext facesContext = FacesContext.getCurrentInstance();
+        //runtime config not started
+        //for now we only can reach the runtime config in the referenced BaseAnnotatonScanListener
+        //if we have a facesContext reachable.
+        if (facesContext == null) {
+            //TODO (1.1) decouple the scan in the BaseAnnotationScanListener from the facesConfig
+            //to get the runtime config
+            return;
+        }
+        if(!_weaver.isPostInit() || _weaver.getLastAnnotationScan() >= _weaver.getLastTaint()) return;
+        _weaver.markLastAnnotationScan();
+
+
+        for (String className : _weaver.loadPossibleDynamicClasses()) {
+            try {
+                if(!_weaver.isTainted(className)) continue;
+
+                ScannerClassloader loader = new ScannerClassloader(Thread.currentThread().getContextClassLoader(),
+                        -1, null, _weaver.getConfiguration().getCompileTarget());
+
+                Class clazz;
+                //in case the class does not exist we have to load it from our weavingcontext
+                //otherwise we do just a scan on the class to avoid side behavior
+                //if (WeavingContext.getFileChangedDaemon().getClassMap().get(className) == null) {
+                //    clazz = _weaver.loadScriptingClassFromName(className);
+                //} else {
+                    clazz = loader.loadClass(className);
+                //}
+
+                if (clazz != null) {
+                    java.lang.annotation.Annotation[] anns = clazz.getAnnotations();
+                    if (anns != null && anns.length > 0) {
+                        addOrMoveAnnotations(clazz);
+                    } else {
+                        removeAnnotations(clazz);
+                    }
+                }
+            } catch (ClassNotFoundException e) {
+                Logger _logger = Logger.getLogger(this.getClass().getName());
+                _logger.log(Level.WARNING, "", e);
+            }
+        }
+
+    }
+
+    /**
+     * add or moves a class level annotation
+     * to a new place
+     *
+     * @param clazz the class to have the annotation moved or added
+     */
+    private void addOrMoveAnnotations(Class clazz) {
+        java.lang.annotation.Annotation[] anns = clazz.getAnnotations();
+        for (java.lang.annotation.Annotation ann : anns) {
+            for (ClassScanListener cListener : _listeners) {
+                AnnotationScanListener listener = (AnnotationScanListener) cListener;
+                if (listener.supportsAnnotation(ann.annotationType())) {
+                    listener.register(clazz, ann);
+
+                    _registeredAnnotations.put(clazz.getName(), ann.annotationType().getName());
+                    //TODO check if we still need this
+                    //ClassResource metaData = WeavingContext.getInstance().getWatchedResource(clazz.getName());
+                    
+                }
+            }
+        }
+    }
+
+    /**
+     * use case annotation removed
+     * we have to entirely remove the annotation
+     * from our internal registry and the myfaces registry
+     *
+     * @param clazz the class to have the annotation removed
+     */
+    private void removeAnnotations(Class clazz) {
+        String registeredAnnotation = _registeredAnnotations.get(clazz.getName());
+        if (registeredAnnotation != null) {
+            for (ClassScanListener cListener : _listeners) {
+                AnnotationScanListener listener = (AnnotationScanListener) cListener;
+                if (listener.supportsAnnotation(registeredAnnotation)) {
+                    listener.purge(clazz.getName());
+                    _registeredAnnotations.remove(clazz.getName());
+                    //WeavingContext.getFileChangedDaemon().getClassMap().remove(clazz.getName());
+                }
+            }
+        }
+    }
+
+    public void clearListeners() {
+        _listeners.clear();
+    }
+
+    public void addListener(ClassScanListener listener) {
+        _listeners.add(listener);
+    }
+
+
+    public void scanAndMarkChange() {
+        //do nothing here
+    }
+}

Copied: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/ListenerForAnnotationHandler.java (from r1300587, myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe2.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/ListenerForAnnotationHandler.java?p2=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/ListenerForAnnotationHandler.java&p1=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe2.java&r1=1300587&r2=1300598&rev=1300598&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe2.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/ListenerForAnnotationHandler.java Wed Mar 14 15:46:00 2012
@@ -17,20 +17,15 @@
  * under the License.
  */
 
-package org.apache.myfaces.extensions.scripting.scanningcore.probes;
+package org.apache.myfaces.extensions.scripting.jsf.annotation;
 
 /**
+ * A generic system event listener which makes the system event
+ * annotations dynamic
+ *
  * @author Werner Punz (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
 
-public class Probe2 {
-
-    public Probe2(String[] test) {
-
-    }
-
-    public static Boolean myHello(String xxx) {
-        return Boolean.TRUE;
-    }
+public class ListenerForAnnotationHandler {
 }

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/MapEntityAnnotationScanner.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/MapEntityAnnotationScanner.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/MapEntityAnnotationScanner.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/MapEntityAnnotationScanner.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.scripting.jsf.annotation;
+
+
+import org.apache.myfaces.extensions.scripting.core.api.AnnotationScanListener;
+import org.apache.myfaces.extensions.scripting.core.common.util.ReflectUtil;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Annotation scanner which scans generically
+ * an annotation with more than one entry values.
+ *
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public abstract class MapEntityAnnotationScanner extends BaseAnnotationScanListener implements AnnotationScanListener
+{
+
+    String[] _annotationParms = null;
+
+    public MapEntityAnnotationScanner(String... annotationParms) {
+        _annotationParms = annotationParms;
+    }
+
+    public void register(Class clazz, Annotation annotation) {
+
+        Map<String, Object> parms = new HashMap<String, Object>(_annotationParms.length);
+
+        for (String accessor : _annotationParms) {
+            parms.put(accessor, ReflectUtil.fastExecuteMethod(annotation, accessor, new Object[0]));
+        }
+
+        if (hasToReregister(parms, clazz)) {
+            addEntity(clazz, parms);
+        }
+    }
+
+    protected abstract void addEntity(Class clazz, Map<String, Object> params);
+
+    protected abstract boolean hasToReregister(Map params, Class clazz);
+
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/RendererImplementationListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/RendererImplementationListener.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/RendererImplementationListener.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/RendererImplementationListener.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.scripting.jsf.annotation;
+
+
+import org.apache.myfaces.extensions.scripting.core.api.AnnotationScanListener;
+import org.apache.myfaces.extensions.scripting.jsf.annotation.purged.PurgedRenderer;
+
+import javax.faces.FactoryFinder;
+import javax.faces.context.FacesContext;
+import javax.faces.render.FacesRenderer;
+import javax.faces.render.RenderKit;
+import javax.faces.render.RenderKitFactory;
+import javax.faces.render.Renderer;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class RendererImplementationListener extends MapEntityAnnotationScanner implements AnnotationScanListener
+{
+    private static final String PAR_FAMILY = "componentFamily";
+    private static final String PAR_RENDERERTYPE = "rendererType";
+    private static final String PAR_RENDERKITID = "renderKitId";
+
+    Map<AnnotationEntry, String> _inverseIndex = new HashMap<AnnotationEntry, String>();
+
+    public RendererImplementationListener() {
+        super(PAR_FAMILY, PAR_RENDERERTYPE, PAR_RENDERKITID);
+    }
+
+    class AnnotationEntry {
+        String componentFamily;
+        String rendererType;
+        String renderKitId;
+
+        AnnotationEntry(String componentFamily, String rendererType, String renderKitId) {
+            this.componentFamily = componentFamily;
+            this.rendererType = rendererType;
+            this.renderKitId = renderKitId;
+        }
+
+        public boolean equals(Object incoming) {
+            if (!(incoming instanceof AnnotationEntry)) {
+                return false;
+            }
+            AnnotationEntry toCompare = (AnnotationEntry) incoming;
+            //handle null cases
+            if ((componentFamily == null && toCompare.getComponentFamily() != null) ||
+                    (componentFamily != null && toCompare.getComponentFamily() == null) ||
+                    (rendererType == null && toCompare.getRendererType() != null) ||
+                    (rendererType != null && toCompare.getRendererType() == null) ||
+                    (renderKitId == null && toCompare.getRenderKitId() != null) ||
+                    (renderKitId != null && toCompare.getRenderKitId() == null)) {
+
+                return false;
+            } else if (componentFamily == null && toCompare.getComponentFamily() == null &&
+                    rendererType == null && toCompare.getRendererType() == null &&
+                    renderKitId == null && toCompare.getRenderKitId() == null) {
+                return true;
+            }
+
+            return componentFamily.equals(toCompare.getComponentFamily()) &&
+                    rendererType.equals(toCompare.getRendererType()) &&
+                    renderKitId.equals(toCompare.getRenderKitId());
+        }
+
+        @Override
+        public int hashCode() {
+            /*we calculate the hashcoide to avoid double entries*/
+            return (((componentFamily != null) ? componentFamily : "")
+                    + "_" +
+                    ((rendererType != null) ? rendererType : "")
+                    + "_" +
+                    ((renderKitId != null) ? renderKitId : "")
+
+            ).hashCode();
+        }
+
+        public String getComponentFamily() {
+            return componentFamily;
+        }
+
+        public String getRendererType() {
+            return rendererType;
+        }
+
+        public String getRenderKitId() {
+            return renderKitId;
+        }
+    }
+
+    public boolean supportsAnnotation(String annotation) {
+        return annotation.equals(FacesRenderer.class.getName());
+    }
+
+    public boolean supportsAnnotation(Class annotation) {
+        return annotation.equals(FacesRenderer.class);
+    }
+
+    @Override
+    protected void addEntity(Class clazz, Map<String, Object> params) {
+        String value = (String) params.get(PAR_FAMILY);
+        String theDefault = (String) params.get(PAR_RENDERERTYPE);
+
+        String renderKitId = getRenderKitId(params);
+        RenderKit renderKit = getRenderkit(renderKitId);
+
+        AnnotationEntry entry = new AnnotationEntry(value, theDefault, renderKitId);
+        _inverseIndex.put(entry, clazz.getName());
+        _alreadyRegistered.put(clazz.getName(), entry);
+
+        if (_log.isLoggable(Level.FINEST)) {
+            _log.log(Level.FINEST, "addRenderer(" + renderKitId + ", "
+                    + entry.getComponentFamily() + ", " + entry.getRendererType()
+                    + ", " + clazz.getName() + ")");
+        }
+
+        try {
+            renderKit.addRenderer(entry.getComponentFamily(), entry.getRendererType(), (Renderer) clazz.newInstance());
+        } catch (InstantiationException e) {
+            _log.log(Level.SEVERE, "", e);
+        } catch (IllegalAccessException e) {
+            _log.log(Level.SEVERE, "", e);
+        }
+    }
+
+    private RenderKitFactory getRenderKitFactory() {
+        return (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+    }
+
+    @Override
+    protected boolean hasToReregister(Map params, Class clazz) {
+        String value = (String) params.get(PAR_FAMILY);
+        String theDefault = (String) params.get(PAR_RENDERERTYPE);
+        String renderKitId = (String) params.get(PAR_RENDERKITID);
+
+        AnnotationEntry entry = new AnnotationEntry(value, theDefault, renderKitId);
+
+        AnnotationEntry alreadyRegistered = (AnnotationEntry) _alreadyRegistered.get(clazz.getName());
+        if (alreadyRegistered == null) {
+            return true;
+        }
+        //here the check if the new class is the same as the old one
+        return alreadyRegistered.equals(entry);
+    }
+
+    private String getRenderKitId(Map<String, Object> params) {
+        String renderKitId = (String) params.get(PAR_RENDERKITID);
+        renderKitId = (renderKitId == null) ? getApplication().getDefaultRenderKitId() : renderKitId;
+        return renderKitId;
+    }
+
+    private RenderKit getRenderkit(String renderKitId) {
+        RenderKitFactory factory = getRenderKitFactory();
+        RenderKit renderKit = factory.getRenderKit(FacesContext.getCurrentInstance(), renderKitId);
+        return renderKit;
+    }
+
+    @Override
+    public void purge(String className) {
+        super.purge(className);
+        AnnotationEntry entry = (AnnotationEntry) _alreadyRegistered.remove(className);
+        if (entry == null) {
+            return;
+        }
+
+        RenderKit renderKit = getRenderkit(entry.getRenderKitId());
+        try {
+            //by fetching the changed renderer we save a full rescan
+            String rendererClass = _inverseIndex.get(entry);
+            if (rendererClass != null && rendererClass.equals(className)) {
+                _inverseIndex.put(entry, PurgedRenderer.class.getName());
+                renderKit.addRenderer(entry.getComponentFamily(), entry.getRendererType(), PurgedRenderer.class.newInstance());
+            }
+        } catch (InstantiationException e) {
+            _log.log(Level.SEVERE, "", e);
+        } catch (IllegalAccessException e) {
+            _log.log(Level.SEVERE, "", e);
+        }
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/SingleEntityAnnotationListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/SingleEntityAnnotationListener.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/SingleEntityAnnotationListener.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/SingleEntityAnnotationListener.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.scripting.jsf.annotation;
+
+import org.apache.myfaces.extensions.scripting.core.api.AnnotationScanListener;
+import org.apache.myfaces.extensions.scripting.core.common.util.ReflectUtil;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * annotation scanner which generalized
+ * scans annotations with one value entry
+ *
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public abstract class SingleEntityAnnotationListener extends BaseAnnotationScanListener implements AnnotationScanListener
+{
+    String _entityParamValue = null;
+
+    public void register(Class clazz, Annotation annotation) {
+
+        String val = (String) ReflectUtil.executeMethod(annotation, _entityParamValue);
+        if (hasToReregister(val, clazz)) {
+            addEntity(clazz, val);
+        }
+    }
+
+    protected abstract void addEntity(Class clazz, String val);
+
+    protected boolean hasToReregister(String name, Class clazz) {
+        String componentClass = (String) _alreadyRegistered.get(name);
+        return componentClass == null || !componentClass.equals(clazz.getName());
+    }
+
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/ValidatorImplementationListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/ValidatorImplementationListener.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/ValidatorImplementationListener.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/ValidatorImplementationListener.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.scripting.jsf.annotation;
+
+import org.apache.myfaces.extensions.scripting.core.api.AnnotationScanListener;
+import org.apache.myfaces.extensions.scripting.jsf.annotation.purged.PurgedValidator;
+
+import javax.faces.validator.FacesValidator;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class ValidatorImplementationListener extends MapEntityAnnotationScanner implements AnnotationScanListener
+{
+
+    private static final String PAR_VALUE = "value";
+    private static final String PAR_DEFAULT = "isDefault";
+
+    Map<AnnotationEntry, String> _inverseIndex = new HashMap<AnnotationEntry, String>();
+
+    public ValidatorImplementationListener() {
+        /*supported annotation parameters rendererType and default*/
+        super(PAR_VALUE, PAR_DEFAULT);
+    }
+
+    class AnnotationEntry {
+        String value;
+        Boolean theDefault;
+
+        AnnotationEntry(String value, Boolean theDefault) {
+            this.value = value;
+            this.theDefault = theDefault;
+        }
+
+        public boolean equals(Object incoming) {
+            if (!(incoming instanceof AnnotationEntry)) {
+                return false;
+            }
+            AnnotationEntry toCompare = (AnnotationEntry) incoming;
+
+            if (incoming == null) {
+                return false;
+            }
+
+            boolean firstEquals = compareValuePair(value, toCompare.getValue());
+            boolean secondEquals = compareValuePair(theDefault, toCompare.getTheDefault());
+
+            return firstEquals && secondEquals;
+        }
+
+        @Override
+        public int hashCode() {
+            String retVal = checkForNull(value) + "_" + checkForNull(theDefault);
+            return retVal.hashCode();
+        }
+
+        private String checkForNull(String in) {
+            return (in == null) ? "" : in;
+        }
+
+        private String checkForNull(Boolean in) {
+            return (in == null) ? "" : String.valueOf(in.booleanValue());
+        }
+
+        protected boolean compareValuePair(Object val1, Object val2) {
+            boolean retVal = false;
+            if (val1 == null) {
+                if (val2 != null) retVal = false;
+                if (val2 == null) {
+                    retVal = true;
+                }
+            } else {
+                retVal = val1.equals(val2);
+            }
+            return retVal;
+        }
+
+        public String getValue() {
+            return value;
+        }
+
+        public Boolean getTheDefault() {
+            return theDefault;
+        }
+    }
+
+    public boolean supportsAnnotation(String annotation) {
+        return annotation.equals(FacesValidator.class.getName());
+    }
+
+    public boolean supportsAnnotation(Class annotation) {
+        return annotation.equals(FacesValidator.class);
+    }
+
+
+    @Override
+    protected void addEntity(Class clazz, Map<String, Object> params) {
+        String value = (String) params.get(PAR_VALUE);
+        Boolean theDefault = (Boolean) params.get(PAR_DEFAULT);
+
+        AnnotationEntry entry = new AnnotationEntry(value, theDefault);
+        _alreadyRegistered.put(clazz.getName(), entry);
+        _inverseIndex.put(entry, clazz.getName());
+
+        getApplication().addValidator(entry.getValue(), clazz.getName());
+    }
+
+    @Override
+    protected boolean hasToReregister(Map params, Class clazz) {
+        String value = (String) params.get(PAR_VALUE);
+        Boolean theDefault = (Boolean) params.get(PAR_DEFAULT);
+
+        AnnotationEntry entry = new AnnotationEntry(value, theDefault);
+
+        AnnotationEntry alreadyRegistered = (AnnotationEntry) _alreadyRegistered.get(clazz.getName());
+        if (alreadyRegistered == null) {
+            return true;
+        }
+
+        return alreadyRegistered.equals(entry);
+    }
+
+    @Override
+    public void purge(String className) {
+        super.purge(className);
+        AnnotationEntry entry = (AnnotationEntry) _alreadyRegistered.get(className);
+        if (entry == null) {
+            return;
+        }
+
+        String oldValidator = _inverseIndex.get(entry);
+        if (oldValidator.equals(className)) {
+            _alreadyRegistered.remove(className);
+            getApplication().addValidator(entry.getValue(), PurgedValidator.class.getName());
+            _inverseIndex.put(entry, PurgedValidator.class.getName());
+        }
+    }
+}

Copied: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedBehavior.java (from r1300587, myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe2.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedBehavior.java?p2=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedBehavior.java&p1=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe2.java&r1=1300587&r2=1300598&rev=1300598&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe2.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedBehavior.java Wed Mar 14 15:46:00 2012
@@ -16,21 +16,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+package org.apache.myfaces.extensions.scripting.jsf.annotation.purged;
 
-package org.apache.myfaces.extensions.scripting.scanningcore.probes;
+import javax.faces.component.behavior.Behavior;
+import javax.faces.event.BehaviorEvent;
 
 /**
  * @author Werner Punz (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
 
-public class Probe2 {
-
-    public Probe2(String[] test) {
-
-    }
-
-    public static Boolean myHello(String xxx) {
-        return Boolean.TRUE;
+public class PurgedBehavior implements Behavior {
+    public void broadcast(BehaviorEvent event) {
+        throw new RuntimeException("Behavior does not exist");
     }
 }

Copied: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedClientBehaviorRenderer.java (from r1300587, myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe2.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedClientBehaviorRenderer.java?p2=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedClientBehaviorRenderer.java&p1=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe2.java&r1=1300587&r2=1300598&rev=1300598&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe2.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedClientBehaviorRenderer.java Wed Mar 14 15:46:00 2012
@@ -16,21 +16,15 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+package org.apache.myfaces.extensions.scripting.jsf.annotation.purged;
 
-package org.apache.myfaces.extensions.scripting.scanningcore.probes;
+import javax.faces.render.ClientBehaviorRenderer;
 
 /**
  * @author Werner Punz (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
 
-public class Probe2 {
+public class PurgedClientBehaviorRenderer extends ClientBehaviorRenderer {
 
-    public Probe2(String[] test) {
-
-    }
-
-    public static Boolean myHello(String xxx) {
-        return Boolean.TRUE;
-    }
 }

Copied: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedComponent.java (from r1300587, myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe2.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedComponent.java?p2=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedComponent.java&p1=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe2.java&r1=1300587&r2=1300598&rev=1300598&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe2.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedComponent.java Wed Mar 14 15:46:00 2012
@@ -16,21 +16,22 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+package org.apache.myfaces.extensions.scripting.jsf.annotation.purged;
 
-package org.apache.myfaces.extensions.scripting.scanningcore.probes;
+import javax.faces.component.UIOutput;
 
 /**
+ * We override the component from a real family so that
+ * so that myfaces can handle it in a decent way
+ * directly from UIComponent it would fail
+ * unless we implement everything family etc... all by our own
+ *
  * @author Werner Punz (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
 
-public class Probe2 {
-
-    public Probe2(String[] test) {
-
-    }
-
-    public static Boolean myHello(String xxx) {
-        return Boolean.TRUE;
+public class PurgedComponent extends UIOutput {
+    public PurgedComponent() {
+        super();
     }
 }

Copied: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedConverter.java (from r1300587, myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedConverter.java?p2=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedConverter.java&p1=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe.java&r1=1300587&r2=1300598&rev=1300598&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedConverter.java Wed Mar 14 15:46:00 2012
@@ -16,42 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.extensions.scripting.scanningcore.probes;
+package org.apache.myfaces.extensions.scripting.jsf.annotation.purged;
 
-import org.junit.Ignore;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
 
 /**
  * @author Werner Punz (latest modification by $Author$)
  * @version $Revision$ $Date$
- *          <p/>
- *          testprobe for our reflectutils
  */
 
-@Ignore
-public class Probe implements MethodReloadingProbe
-{
+public class PurgedConverter implements Converter {
+    private static final String DOES_NOT_EXIST = "Converter does not exist";
 
-    public Probe() {
+    public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException {
+        throw new RuntimeException(DOES_NOT_EXIST);
     }
 
-    public Probe(String hello, String world) {
-        
+    public String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException {
+        throw new RuntimeException(DOES_NOT_EXIST);
     }
-
-    public void testMethod1() {
-
-    }
-
-    public void testMethod2() {
-        throw new NullPointerException("for test");
-    }
-
-    public boolean testMethod3(String param1) {
-        return true;
-    }
-
-    public static boolean testMethod4(String param1, String param2) {
-        return true;
-    }
-
 }

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedELResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedELResolver.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedELResolver.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedELResolver.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.scripting.jsf.annotation.purged;
+
+
+import org.apache.myfaces.extensions.scripting.core.api.Decorated;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import java.util.Iterator;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class PurgedELResolver extends ELResolver implements Decorated
+{
+
+    private final String DOES_NOT_EXIST = "EL Resolver does not exist";
+
+    ELResolver _delegate;
+
+    public PurgedELResolver(ELResolver delegate) {
+        _delegate = delegate;
+    }
+
+    @Override
+    public Object getValue(ELContext elContext, Object o, Object o1) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public Class getType(ELContext elContext, Object o, Object o1) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public void setValue(ELContext elContext, Object o, Object o1, Object o2) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public boolean isReadOnly(ELContext elContext, Object o, Object o1) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public Iterator getFeatureDescriptors(ELContext elContext, Object o) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public Class getCommonPropertyType(ELContext elContext, Object o) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    public ELResolver getDelegate() {
+        return _delegate;
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedLifecycle.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedLifecycle.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedLifecycle.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedLifecycle.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.scripting.jsf.annotation.purged;
+
+
+
+import org.apache.myfaces.extensions.scripting.core.api.Decorated;
+
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseListener;
+import javax.faces.lifecycle.Lifecycle;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class PurgedLifecycle extends Lifecycle implements Decorated
+{
+
+    private static final String DOES_NOT_EXIST = "Lifecycle does not exist";
+
+    Lifecycle _delegate;
+
+    public PurgedLifecycle(Lifecycle delegate) {
+        _delegate = delegate;
+    }
+
+    @Override
+    public void addPhaseListener(PhaseListener listener) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public void execute(FacesContext context) throws FacesException {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public PhaseListener[] getPhaseListeners() {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public void removePhaseListener(PhaseListener listener) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public void render(FacesContext context) throws FacesException {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    public Object getDelegate() {
+        return _delegate;
+    }
+}

Copied: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedNavigationHandler.java (from r1300587, myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/support/LoggingHandler.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedNavigationHandler.java?p2=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedNavigationHandler.java&p1=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/support/LoggingHandler.java&r1=1300587&r2=1300598&rev=1300598&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/support/LoggingHandler.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedNavigationHandler.java Wed Mar 14 15:46:00 2012
@@ -16,42 +16,38 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+package org.apache.myfaces.extensions.scripting.jsf.annotation.purged;
 
-package org.apache.myfaces.extensions.scripting.scanningcore.support;
 
-import java.util.logging.Handler;
-import java.util.logging.LogRecord;
+import org.apache.myfaces.extensions.scripting.core.api.Decorated;
+
+import javax.faces.application.NavigationHandler;
+import javax.faces.context.FacesContext;
 
 /**
- * A logging handler which can capture our internal logging output
- *
  * @author Werner Punz (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
 
-public class LoggingHandler extends Handler {
-    StringBuilder _output = new StringBuilder();
-
-    @Override
-    public void publish(LogRecord record) {
-        _output.append(record.getMessage());
-    }
+public class PurgedNavigationHandler extends NavigationHandler implements Decorated
+{
 
-    public StringBuilder getOutput() {
-        return _output;
-    }
+    NavigationHandler _delegate;
 
-    public void setOutput(StringBuilder output) {
-        _output = output;
+    public PurgedNavigationHandler(NavigationHandler delegate) {
+        _delegate = delegate;
     }
 
     @Override
-    public void flush() {
-
+    public void handleNavigation(FacesContext context, String fromAction, String outcome) {
+        throw new RuntimeException("Navigation handler does not exist");
     }
 
-    @Override
-    public void close() throws SecurityException {
+    public NavigationHandler getDelegate() {
+        return _delegate;
+    }
 
+    public void setDelegate(NavigationHandler delegate) {
+        _delegate = delegate;
     }
 }

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedRenderer.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedRenderer.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedRenderer.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.scripting.jsf.annotation.purged;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.ConverterException;
+import javax.faces.render.Renderer;
+import java.io.IOException;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class PurgedRenderer extends Renderer {
+    private static final String DOES_NOT_EXIST = "Renderer does not exist";
+
+    public PurgedRenderer() {
+        super();
+    }
+
+    @Override
+    public void decode(FacesContext context, UIComponent component) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public String convertClientId(FacesContext context, String clientId) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public boolean getRendersChildren() {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedRenderkit.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedRenderkit.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedRenderkit.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedRenderkit.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.scripting.jsf.annotation.purged;
+
+
+import org.apache.myfaces.extensions.scripting.core.api.Decorated;
+
+import javax.faces.context.ResponseStream;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.RenderKit;
+import javax.faces.render.Renderer;
+import javax.faces.render.ResponseStateManager;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class PurgedRenderkit extends RenderKit implements Decorated
+{
+
+    private static final String DOES_NOT_EXIST = "Renderkit does not exist";
+
+    RenderKit _delegate;
+
+    public PurgedRenderkit(RenderKit delegate) {
+        _delegate = delegate;
+    }
+
+    @Override
+    public void addRenderer(String family, String rendererType, Renderer renderer) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public ResponseStream createResponseStream(OutputStream out) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public ResponseWriter createResponseWriter(Writer writer, String contentTypeList, String characterEncoding) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public Renderer getRenderer(String family, String rendererType) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public ResponseStateManager getResponseStateManager() {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    public RenderKit getDelegate() {
+        return _delegate;
+    }
+
+    public void setDelegate(RenderKit delegate) {
+        _delegate = delegate;
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedResourceHandler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedResourceHandler.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedResourceHandler.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedResourceHandler.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.scripting.jsf.annotation.purged;
+
+
+import org.apache.myfaces.extensions.scripting.core.api.Decorated;
+
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class PurgedResourceHandler extends ResourceHandler implements Decorated
+{
+
+    private static final String DOES_NOT_EXIST = "Resource Handler does not exist";
+
+    ResourceHandler _delegate;
+
+    public PurgedResourceHandler(ResourceHandler delegate) {
+        _delegate = delegate;
+    }
+
+    @Override
+    public Resource createResource(String resourceName) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public Resource createResource(String resourceName, String libraryName) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public Resource createResource(String resourceName, String libraryName, String contentType) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public String getRendererTypeForResourceName(String resourceName) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public void handleResourceRequest(FacesContext context) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public boolean isResourceRequest(FacesContext context) {
+        throw new RuntimeException(DOES_NOT_EXIST);
+    }
+
+    @Override
+    public boolean libraryExists(String libraryName) {
+        return false;
+    }
+
+    public ResourceHandler getDelegate() {
+        return _delegate;
+    }
+
+    public void setDelegate(ResourceHandler delegate) {
+        _delegate = delegate;
+    }
+}

Copied: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedValidator.java (from r1300587, myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedValidator.java?p2=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedValidator.java&p1=myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe.java&r1=1300587&r2=1300598&rev=1300598&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/test/java/rewrite/org/apache/myfaces/extensions/scripting/scanningcore/probes/Probe.java (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/annotation/purged/PurgedValidator.java Wed Mar 14 15:46:00 2012
@@ -16,42 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.extensions.scripting.scanningcore.probes;
+package org.apache.myfaces.extensions.scripting.jsf.annotation.purged;
 
-import org.junit.Ignore;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
 
 /**
  * @author Werner Punz (latest modification by $Author$)
  * @version $Revision$ $Date$
  *          <p/>
- *          testprobe for our reflectutils
+ *          Purged validator class to enable validator
+ *          purging despite the fact
+ *          that the original code does not allow it
  */
 
-@Ignore
-public class Probe implements MethodReloadingProbe
-{
+public class PurgedValidator implements Validator {
 
-    public Probe() {
-    }
-
-    public Probe(String hello, String world) {
-        
-    }
-
-    public void testMethod1() {
-
-    }
-
-    public void testMethod2() {
-        throw new NullPointerException("for test");
-    }
-
-    public boolean testMethod3(String param1) {
-        return true;
-    }
-
-    public static boolean testMethod4(String param1, String param2) {
-        return true;
+    public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
+        throw new RuntimeException("Validator does not exist");
     }
 
 }

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/CompilerComponent.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/CompilerComponent.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/CompilerComponent.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/CompilerComponent.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.scripting.jsf.components;
+
+
+import org.apache.myfaces.extensions.scripting.core.api.ScriptingConst;
+import org.apache.myfaces.extensions.scripting.core.common.util.StringUtils;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+import java.util.Locale;
+
+/**
+ * Compiler component which currently
+ * just shows the last compile output in the system
+ * <p/>
+ * Not to keep backwards compatibility to JSF 1.2
+ * we do not use the StateHelper but go the old route
+ * instead
+ */
+@SuppressWarnings("unused")
+public class CompilerComponent extends UIOutput {
+
+    String _scriptingLanguage = null;
+    String _errorsLabel = null;
+    String _warningsLabel = null;
+    private static final String RENDERER_TYPE = "org.apache.myfaces.extensions.scripting.components.CompilerComponentRenderer";
+    private static final String ERRORS_LABEL = "errorsLabel";
+    private static final String WARNINGS_LABEL = "warningsLabel";
+    private static final String SCRIPTING_LANGUAGE = "scriptingLanguage";
+
+    public CompilerComponent() {
+        super();
+        setRendererType(RENDERER_TYPE);
+    }
+
+    @Override
+    public boolean isTransient() {
+        return true;
+    }
+
+    @Override
+    public Object saveState(FacesContext facesContext) {
+        Object values[] = new Object[4];
+        values[0] = super.saveState(facesContext);    //To change body of overridden methods use File | Settings | File Templates.
+        values[1] = _scriptingLanguage;
+        values[2] = _errorsLabel;
+        values[3] = _warningsLabel;
+        return values;
+    }
+
+    @Override
+    public void restoreState(FacesContext facesContext, Object state) {
+        Object[] values = (Object[]) state;
+        super.restoreState(facesContext, values[0]);
+
+        _scriptingLanguage = (String) values[1];
+        _errorsLabel = (String) values[2];
+        _warningsLabel = (String) values[3];
+    }
+
+
+    public String getScriptingLanguage() {
+        if (_scriptingLanguage != null) {
+            return _scriptingLanguage;
+        }
+        ValueExpression vb = getValueExpression(SCRIPTING_LANGUAGE);
+        return vb != null ? ((String) vb.getValue(getFacesContext().getELContext())) : null;
+    }
+
+    public Integer getScriptingLanguageAsInt() {
+        if (StringUtils.isBlank(_scriptingLanguage)) {
+            return ScriptingConst.ENGINE_TYPE_JSF_ALL;
+        } else {
+            String scriptingLanguage = _scriptingLanguage.toLowerCase(Locale.getDefault()).trim();
+            if (scriptingLanguage.equals("java")) {
+                return ScriptingConst.ENGINE_TYPE_JSF_JAVA;
+            } else if (_scriptingLanguage.toLowerCase(Locale.getDefault()).trim().equals("groovy")) {
+                return ScriptingConst.ENGINE_TYPE_JSF_GROOVY;
+            }
+        }
+        return ScriptingConst.ENGINE_TYPE_JSF_NO_ENGINE;
+    }
+
+    public void setScriptingLanguage(String scriptingLanguage) {
+        _scriptingLanguage = scriptingLanguage;
+    }
+
+    public String getErrorsLabel() {
+        if (_errorsLabel != null) {
+            return _errorsLabel;
+        }
+        ValueExpression vb = getValueExpression(ERRORS_LABEL);
+        return vb != null ? ((String) vb.getValue(getFacesContext().getELContext())) : null;
+    }
+
+    public void setErrorsLabel(String _errorsLabel) {
+        this._errorsLabel = _errorsLabel;
+    }
+
+    public String getWarningsLabel() {
+        if (_warningsLabel != null) {
+            return _warningsLabel;
+        }
+        ValueExpression vb = getValueExpression(WARNINGS_LABEL);
+        return vb != null ? ((String) vb.getValue(getFacesContext().getELContext())) : null;
+    }
+
+    public void setWarningsLabel(String _warningsLabel) {
+        this._warningsLabel = _warningsLabel;
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/CompilerComponentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/CompilerComponentRenderer.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/CompilerComponentRenderer.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/CompilerComponentRenderer.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.scripting.jsf.components;
+
+import org.apache.myfaces.extensions.scripting.core.api.ScriptingConst;
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+import org.apache.myfaces.extensions.scripting.core.common.util.StringUtils;
+import org.apache.myfaces.extensions.scripting.core.engine.api.CompilationResult;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
+import java.io.IOException;
+import java.util.logging.Logger;
+
+/**
+ * Renderer for the compiler component
+ * <p/>
+ * This renderer is responsible for rendering the last compiler output
+ * hosted in our weavingContext
+ */
+@SuppressWarnings("unchecked")
+public class CompilerComponentRenderer extends Renderer {
+
+    @Override
+    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
+        super.encodeBegin(context, component);
+
+        ResponseWriter responseWriter = FacesContext.getCurrentInstance().getResponseWriter();
+        CompilerComponent compilerComp = (CompilerComponent) component;
+
+        Integer scriptingLanguage = compilerComp.getScriptingLanguageAsInt();
+        CompilationResult result = null;
+        switch (scriptingLanguage) {
+            case ScriptingConst.ENGINE_TYPE_JSF_JAVA:
+                result = WeavingContext.getInstance().getCompilationResult(ScriptingConst.ENGINE_TYPE_JSF_JAVA);
+                break;
+            case ScriptingConst.ENGINE_TYPE_JSF_GROOVY:
+                result = WeavingContext.getInstance().getCompilationResult(ScriptingConst.ENGINE_TYPE_JSF_GROOVY);
+                break;
+            case ScriptingConst.ENGINE_TYPE_JSF_ALL:
+                result = new CompilationResult("");
+                CompilationResult tempResult = WeavingContext.getInstance().getCompilationResult(ScriptingConst.ENGINE_TYPE_JSF_JAVA);
+                if (tempResult != null) {
+                    copyCompilationResult(result, tempResult);
+                }
+
+                tempResult = WeavingContext.getInstance().getCompilationResult(ScriptingConst.ENGINE_TYPE_JSF_GROOVY);
+                if (tempResult != null) {
+                    copyCompilationResult(result, tempResult);
+                }
+
+                break;
+            case ScriptingConst.ENGINE_TYPE_JSF_NO_ENGINE:
+                Logger log = Logger.getLogger(this.getClass().getName());
+                log.warning(RendererConst.WARNING_ENGINE_NOT_FOUND);
+                break;
+        }
+
+        startDiv(component, responseWriter, RendererConst.ERROR_BOX);
+        if (result == null || (!result.hasErrors() && result.getWarnings().isEmpty())) {
+            responseWriter.write(RendererConst.NO_COMPILE_ERRORS);
+        } else {
+            writeErrorsLabel(component, responseWriter, compilerComp);
+            writeErrors(component, responseWriter, result);
+            writeWarningsLabel(component, responseWriter, compilerComp);
+            writeWarnings(component, responseWriter, result);
+        }
+        endDiv(responseWriter);
+
+        responseWriter.flush();
+
+    }
+
+    private void writeWarnings(UIComponent component, ResponseWriter responseWriter, CompilationResult result) throws IOException {
+        startDiv(component, responseWriter, RendererConst.WARNINGS);
+        for (CompilationResult.CompilationMessage msg : result.getWarnings()) {
+            startDiv(component, responseWriter, RendererConst.LINE);
+            writeDiv(component, responseWriter, RendererConst.LINE_NO, String.valueOf(msg.getLineNumber()));
+            writeDiv(component, responseWriter, RendererConst.MESSAGE, msg.getMessage());
+            endDiv(responseWriter);
+        }
+        endDiv(responseWriter);
+    }
+
+    private void writeWarningsLabel(UIComponent component, ResponseWriter responseWriter, CompilerComponent compilerComp) throws IOException {
+        if (!StringUtils.isBlank(compilerComp.getWarningsLabel())) {
+            startDiv(component, responseWriter, RendererConst.WARNINGS_LABEL);
+            responseWriter.write(compilerComp.getWarningsLabel());
+            endDiv(responseWriter);
+        }
+    }
+
+    private void writeErrors(UIComponent component, ResponseWriter responseWriter, CompilationResult result) throws IOException {
+        startDiv(component, responseWriter, RendererConst.ERRORS);
+        for (CompilationResult.CompilationMessage msg : result.getErrors()) {
+            startDiv(component, responseWriter, RendererConst.LINE);
+            writeDiv(component, responseWriter, RendererConst.LINE_NO, String.valueOf(msg.getLineNumber()));
+            writeDiv(component, responseWriter, RendererConst.MESSAGE, msg.getMessage());
+            endDiv(responseWriter);
+        }
+        endDiv(responseWriter);
+    }
+
+    private String writeDiv(UIComponent component, ResponseWriter responseWriter, String styleClass, String value) throws IOException {
+        startDiv(component, responseWriter, styleClass);
+        responseWriter.write(value);
+        endDiv(responseWriter);
+        return "";
+    }
+
+    private void endDiv(ResponseWriter responseWriter) throws IOException {
+        responseWriter.endElement(RendererConst.HTML_DIV);
+    }
+
+    private void startDiv(UIComponent component, ResponseWriter responseWriter, String styleClass) throws IOException {
+        responseWriter.startElement(RendererConst.HTML_DIV, component);
+        responseWriter.writeAttribute(RendererConst.HTML_CLASS, styleClass, null);
+    }
+
+    private void writeErrorsLabel(UIComponent component, ResponseWriter responseWriter, CompilerComponent compilerComp) throws IOException {
+        if (!StringUtils.isBlank(compilerComp.getErrorsLabel())) {
+            startDiv(component, responseWriter, RendererConst.ERRORS_LABEL);
+            responseWriter.write(compilerComp.getErrorsLabel());
+            endDiv(responseWriter);
+        }
+    }
+
+    private void copyCompilationResult(CompilationResult result, CompilationResult tempResult) {
+        result.getErrors().addAll(tempResult.getErrors());
+        result.getWarnings().addAll(tempResult.getWarnings());
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/RendererConst.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/RendererConst.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/RendererConst.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/RendererConst.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.extensions.scripting.jsf.components;
+
+/**
+ * Renderer Constant shared by both renderers
+ *
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class RendererConst {
+    static final String ERROR_BOX = "errorBox";
+    static final String WARNING_ENGINE_NOT_FOUND = "Warning engine not found";
+    static final String LINE_NO = "lineNo";
+    static final String MESSAGE = "message";
+    static final String NO_COMPILE_ERRORS = "No compile errors";
+    static final String HTML_DIV = "div";
+    static final String HTML_CLASS = "class";
+    static final String NO_TAINT_HISTORY_FOUND = "No taint history found";
+    static final String LINE = "line";
+    static final String TIMESTAMP = "timestamp";
+    static final String CHANGED_FILE = "changedFile";
+    static final String ERRORS_LABEL = "errorsLabel";
+    static final String WARNINGS_LABEL = "warningsLabel";
+    static final String ERRORS = "errors";
+    static final String WARNINGS = "warnings";
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/TaintHistory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/TaintHistory.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/TaintHistory.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/components/TaintHistory.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.extensions.scripting.jsf.components;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+
+/**
+ * Component which allows to check which files
+ * have been marked as possibly modified in the recent history
+ *
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class TaintHistory extends UIOutput {
+
+    public static final int DEFAULT_NO_ENTRIES = 10;
+
+    Integer _noEntries;
+    String _filter;
+    private static final String RENDERER_TYPE = "org.apache.myfaces.extensions.scripting.components.TaintHistoryRenderer";
+    private static final String NO_ENTRIES = "noEntries";
+
+    public TaintHistory() {
+        setRendererType(RENDERER_TYPE);
+    }
+
+    @SuppressWarnings("unused")
+    public void setNoEntries(Integer entries) {
+        _noEntries = entries;
+    }
+
+    @Override
+    public Object saveState(FacesContext facesContext) {
+        Object values[] = new Object[3];
+        values[0] = super.saveState(facesContext);    //To change body of overridden methods use File | Settings | File Templates.
+        values[1] = _noEntries;
+        values[2] = _filter;
+        return values;
+    }
+
+    @Override
+    public void restoreState(FacesContext facesContext, Object state) {
+        Object[] values = (Object[]) state;
+        super.restoreState(facesContext, values[0]);
+        _noEntries = (Integer) values[1];
+        _filter = (String) values[2];
+    }
+
+    public Integer getNoEntries() {
+        if (_noEntries != null) {
+            return _noEntries;
+        }
+        ValueExpression vb = getValueExpression(NO_ENTRIES);
+        return vb != null ? ((Integer) vb.getValue(getFacesContext().getELContext())) : DEFAULT_NO_ENTRIES;
+    }
+
+    @SuppressWarnings("unused")
+    public void setFilter(String filter) {
+        _filter = filter;
+    }
+
+    @SuppressWarnings("unused")
+    public String getFilter() {
+        if (_filter != null) {
+            return _filter;
+        }
+        ValueExpression vb = getValueExpression(NO_ENTRIES);
+        return vb != null ? ((String) vb.getValue(getFacesContext().getELContext())) : null;
+    }
+}