You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2009/08/25 15:22:28 UTC
svn commit: r807608 [1/2] - in /myfaces/extensions/scripting/trunk: ./ core/
core/src/main/groovy/org/apache/myfaces/groovyloader/core/
core/src/main/java/org/apache/myfaces/scripting/api/
core/src/main/java/org/apache/myfaces/scripting/core/util/ core...
Author: werpu
Date: Tue Aug 25 13:22:25 2009
New Revision: 807608
URL: http://svn.apache.org/viewvc?rev=807608&view=rev
Log:
committed the last changed accidentally into the wrong repo here we go
https://issues.apache.org/jira/browse/EXTSCRIPT-3
https://issues.apache.org/jira/browse/EXTSCRIPT-2
Added:
myfaces/extensions/scripting/trunk/spring-example/ (with props)
myfaces/extensions/scripting/trunk/spring-example/pom.xml (with props)
myfaces/extensions/scripting/trunk/spring-example/src/
myfaces/extensions/scripting/trunk/spring-example/src/main/
myfaces/extensions/scripting/trunk/spring-example/src/main/java/
myfaces/extensions/scripting/trunk/spring-example/src/main/java/org/
myfaces/extensions/scripting/trunk/spring-example/src/main/java/org/apache/
myfaces/extensions/scripting/trunk/spring-example/src/main/java/org/apache/myfaces/
myfaces/extensions/scripting/trunk/spring-example/src/main/java/org/apache/myfaces/HelloWorldBacking.java (with props)
myfaces/extensions/scripting/trunk/spring-example/src/main/java/org/apache/myfaces/SpringBean.java (with props)
myfaces/extensions/scripting/trunk/spring-example/src/main/resources/
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/WEB-INF/
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/WEB-INF/applicationContext.xml (with props)
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/WEB-INF/faces-config.xml (with props)
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/WEB-INF/groovy/
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/WEB-INF/groovy-taglib.xml (with props)
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/WEB-INF/groovy/org/
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/WEB-INF/groovy/org/apache/
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovy/
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovy/GroovyBean.groovy
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/WEB-INF/tomahawk.taglib.xml (with props)
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/WEB-INF/web.xml (with props)
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/helloWorld.xhtml
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/index.jsp (with props)
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/page2.xhtml
myfaces/extensions/scripting/trunk/spring-example/src/main/webapp/template.xhtml
Modified:
myfaces/extensions/scripting/trunk/core/ (props changed)
myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/GroovyWeaver.groovy
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Decorated.java
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/ScriptingWeaver.java
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/MethodLevelReloadingHandler.java
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextPlugin.java
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/CustomChainLoader.java
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/ScriptingServletFilter.java
myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java
myfaces/extensions/scripting/trunk/core/src/main/resources/META-INF/faces-config.xml
myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml
myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestActionListener.groovy
myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestBean.groovy
myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestComponent.groovy
myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestConverter.groovy
myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestNavigationHandler.groovy
myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestPhaseListener.groovy
myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestRenderer.groovy
myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestValidator.groovy
myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestViewHandler.groovy
myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/web.xml
myfaces/extensions/scripting/trunk/pom.xml
Propchange: myfaces/extensions/scripting/trunk/core/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Aug 25 13:22:25 2009
@@ -0,0 +1 @@
+*.iml
Modified: myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/GroovyWeaver.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/GroovyWeaver.groovy?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/GroovyWeaver.groovy (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/groovy/org/apache/myfaces/groovyloader/core/GroovyWeaver.groovy Tue Aug 25 13:22:25 2009
@@ -16,15 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.myfaces.groovyloader.core
-import org.codehaus.groovy.runtime.InvokerHelper
-import org.apache.myfaces.groovyloader.core.ReloadingMetadata
-import org.apache.myfaces.groovyloader.core.Groovy2GroovyObjectReloadingProxy
-import org.apache.commons.logging.LogFactory
+import org.apache.myfaces.scripting.refresh.*;
import org.apache.commons.logging.Log
+import org.apache.commons.logging.LogFactory
+import org.apache.myfaces.groovyloader.core.Groovy2GroovyObjectReloadingProxy
import org.apache.myfaces.scripting.api.ScriptingWeaver
+import org.codehaus.groovy.runtime.InvokerHelper
+import org.apache.myfaces.scripting.api.ScriptingConst
+import org.apache.myfaces.scripting.refresh.FileChangedDaemon
+
/**
* Weaver which does dynamic class reloading
@@ -44,14 +46,15 @@
public class GroovyWeaver implements Serializable, ScriptingWeaver {
static def gcl = null
- static Map classMap = Collections.synchronizedMap([:])
-
+ static Map classMap = Collections.synchronizedMap(new java.util.HashMap())
static Log log = LogFactory.getLog(GroovyWeaver.class)
+ static def scriptPath = []
+
public GroovyWeaver() {
}
- /*
+ /*
* we set a deamon to enable webapp artefact change tainting
* this should speed up operations because we do not have
* to check on the filesystem for every reload access
@@ -65,14 +68,15 @@
private synchronized void startThread() {
if (changeWatcher == null) {
- changeWatcher = new FileChangedDaemon(classMap)
+ changeWatcher = FileChangedDaemon.instance
+ classMap = changeWatcher.getClassMap()
}
- changeWatcher.start()
+
}
private void stopThread() {
if (changeWatcher != null) {
- changeWatcher.stop()
+ changeWatcher.running = false
}
}
@@ -133,11 +137,10 @@
/**
* condition which marks a metadata as reload candidate
*/
- private boolean isReloadCandidate(reloadMeta) {
- return reloadMeta != null && reloadMeta.taintedOnce
+ private boolean isReloadCandidate(ReloadingMetadata reloadMeta) {
+ return (reloadMeta?.scriptingEngine == ScriptingConst.ENGINE_TYPE_GROOVY) && reloadMeta?.taintedOnce
}
-
/**
* central algorithm which determines which property values are overwritten and which are not
*/
@@ -149,13 +152,13 @@
try {
if (target.properties.containsKey(property.key)
- && !property.key.equals("metaClass") //the class information and meta class information cannot be changed
- && !property.key.equals("class") //otherwise we will get following error
- // java.lang.IllegalArgumentException: object is not an instance of declaring class
- && !(
- target.properties.containsKey(property.key + "_changed") //||
- //nothing further needed the phases take care of that
- )) {
+ && !property.key.equals("metaClass") //the class information and meta class information cannot be changed
+ && !property.key.equals("class") //otherwise we will get following error
+ // java.lang.IllegalArgumentException: object is not an instance of declaring class
+ && !(
+ target.properties.containsKey(property.key + "_changed") //||
+ //nothing further needed the phases take care of that
+ )) {
target.setProperty(property.key, property.value)
}
} catch (Exception e) {
@@ -182,12 +185,37 @@
return loadScriptingClassFromFile(metadata.getFileName())
}
+ public Class loadScriptingClassFromName(String className) {
+ ReloadingMetadata metadata = classMap[className]
+ if (metadata == null) {
+ String groovyClass = className.replaceAll("\\.", System.getProperty("file.separator")) + ".groovy";
+
+ //TODO this code can probably be replaced by the functionality
+ //already given in the Groovy classloader, this needs further testing
+ for (String pathEntry in scriptPath) {
+ File classFile = new File(pathEntry + groovyClass);
+
+ if (classFile.exists()) /*we check the groovy subdir for our class*/
+ return (Class) loadScriptingClassFromFile(pathEntry + groovyClass);
+ }
+
+ } else {
+ return reloadScriptingClass(metadata.aClass)
+ }
+ return null
+ }
+ public void appendCustomScriptPath(String singlePath) {
+ singlePath = singlePath.trim();
+ if (!singlePath.endsWith("/") && !singlePath.endsWith("\\"))
+ singlePath += "/";
+ scriptPath << singlePath
+ }
- public Class loadScriptingClassFromFile(String file) {
- log.info("reloading $file")
+ protected Class loadScriptingClassFromFile(String file) {
+ log.info("Loading groovy file $file")
File currentClassFile = new File(file)
@@ -198,19 +226,23 @@
return;
}
gcl = new GroovyClassLoader(Thread.currentThread().contextClassLoader);
+ //we have to add the script path so that groovy can work out the kinks of other source files added
+ scriptPath.each {
+ gcl.addClasspath(it)
+ }
}
}
- def aclass = gcl.parseClass(new FileInputStream(currentClassFile))
+ Class aclass = gcl.parseClass(new FileInputStream(currentClassFile))
weaveGroovyReloadingCode(aclass)
ReloadingMetadata reloadingMetaData = new ReloadingMetadata()
-
reloadingMetaData.aClass = aclass;
reloadingMetaData.fileName = file;
reloadingMetaData.timestamp = currentClassFile.lastModified();
reloadingMetaData.tainted = false;
+ reloadingMetaData.scriptingEngine = ScriptingConst.ENGINE_TYPE_GROOVY
classMap.put(aclass.name, reloadingMetaData)
/*we start our thread as late as possible due to groovy bugs*/
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Decorated.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Decorated.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Decorated.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/Decorated.java Tue Aug 25 13:22:25 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.scripting.api;
/**
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/ScriptingWeaver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/ScriptingWeaver.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/ScriptingWeaver.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/api/ScriptingWeaver.java Tue Aug 25 13:22:25 2009
@@ -1,14 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.scripting.api;
/**
* @author werpu
* @date: 15.08.2009
+ * <p/>
+ * Central interface to the scripting layer
+ * this class is a weaver which allows to trigger
+ * the scripting layer in various situations
+ * of the JSF interception points
+ *
+ * The scripting weaver replaces the classloader for those instances
+ * because custom classloaders are inherently problematic in web containers
*/
public interface ScriptingWeaver {
+ /**
+ * appends a custom script search path to the original one
+ * @param scriptPaths
+ */
+ public void appendCustomScriptPath(String scriptPaths);
+
+
+ /**
+ * @param o
+ * @return reloads an existing objects with its attributes
+ * and assigns the reloaded class to the new object
+ * <p/>
+ * note, the new object must not be the same as the original one
+ * it can be a shallow clone with a new class instead
+ */
public Object reloadScriptingInstance(Object o);
+ /**
+ * reloads an existing class if needed
+ * if no new class exists the original class is given back
+ *
+ * @param aclass the class which is likely to be reloaded
+ * @return a new class or the same if no refresh has to be performed
+ */
public Class reloadScriptingClass(Class aclass);
- public Class loadScriptingClassFromFile(String file);
+ /**
+ * loads a scripting class from a given className
+ * note, this method probably will be dropped in the long
+ * run
+ * @param className the classname including the package
+ * @return a class instance of the file
+ */
+ public Class loadScriptingClassFromName(String className);
+
}
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/MethodLevelReloadingHandler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/MethodLevelReloadingHandler.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/MethodLevelReloadingHandler.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/MethodLevelReloadingHandler.java Tue Aug 25 13:22:25 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.scripting.core.util;
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/core/util/ProxyUtils.java Tue Aug 25 13:22:25 2009
@@ -1,10 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.scripting.core.util;
-
-import org.apache.myfaces.groovyloader.core.DelegatingGroovyClassloader;
import org.apache.myfaces.scripting.api.Decorated;
import org.apache.myfaces.scripting.api.ScriptingWeaver;
-import org.apache.myfaces.scripting.core.util.MethodLevelReloadingHandler;
+import org.apache.myfaces.scripting.api.DynamicClassIdentifier;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
@@ -30,7 +46,7 @@
*
*/
static ThreadLocal _weaverHolder = new ThreadLocal();
-
+ static ThreadLocal _identifierHolder = new ThreadLocal();
public static void init() {
@@ -45,31 +61,10 @@
}
public static boolean isScriptingEnabled() {
- if (_weaverHolder.get() != null) {
- return true;
- } else {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- do {
- if (loader instanceof DelegatingGroovyClassloader)
- return true;
-
- loader = loader.getParent();
- } while (loader != null);
-
- return false;
- }
+ return _weaverHolder.get() != null;
}
public static ScriptingWeaver getWeaver() {
- if (_weaverHolder.get() == null) {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- while (loader != null && !(loader instanceof DelegatingGroovyClassloader)) {
- loader = loader.getParent();
- }
- if (loader != null) {
- _weaverHolder.set(((DelegatingGroovyClassloader) loader).getGroovyFactory());
- }
- }
return (ScriptingWeaver) _weaverHolder.get();
}
@@ -121,4 +116,18 @@
}
return o;
}
+
+
+ public static boolean isDynamic(Class clazz) {
+ //TODO open this for a chain of responsibility pattern
+ DynamicClassIdentifier identifier = (DynamicClassIdentifier) _identifierHolder.get();
+ if(identifier == null) {
+ identifier = new DynamicClassIdentifierHolder();
+ _identifierHolder.set(identifier);
+ }
+ return identifier.isDynamic(clazz);
+ }
+
+
+
}
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextPlugin.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextPlugin.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextPlugin.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/StartupServletContextPlugin.java Tue Aug 25 13:22:25 2009
@@ -1,6 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.scripting.jsf;
-import org.apache.myfaces.groovyloader.core.DelegatingGroovyClassloader;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -23,16 +40,6 @@
ServletContext servletContext = servletContextEvent.getServletContext();
if (servletContext == null) return;
-
-
- /*
- if (!(Thread.currentThread().getContextClassLoader() instanceof DelegatingGroovyClassloader)) {
- ClassLoader newLoader = null;
-
- newLoader = new DelegatingGroovyClassloader(servletContext);
- Thread.currentThread().setContextClassLoader(newLoader);
- servletContext.setAttribute(ScriptingConst.SCRIPTING_CLASSLOADER, newLoader);
- } */
}
public void contextDestroyed(ServletContextEvent servletContextEvent) {
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java Tue Aug 25 13:22:25 2009
@@ -18,10 +18,10 @@
*/
package org.apache.myfaces.scripting.jsf.dynamicdecorators.implemetations;
-import org.apache.myfaces.scripting.core.util.DynamicClassIdentifier;
+import org.apache.myfaces.groovyloader.core.DynamicClassIdentifier;
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.jsf.ScriptingConst;
import javax.el.*;
import javax.faces.FacesException;
@@ -67,6 +67,14 @@
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))
elResolver = new ELResolverProxy(elResolver);
_delegate.addELResolver(elResolver);
@@ -109,7 +117,7 @@
* maybe in the long run we can make a decorator here instead
* but for now lets try it this way
*/
- if (DynamicClassIdentifier.isDynamic(component.getClass()) && !alreadyWovenInRequest(component.toString())) {
+ if (ProxyUtils.isDynamic(component.getClass()) && !alreadyWovenInRequest(component.toString())) {
/*once it was tainted we have to recreate all the time*/
component = (UIComponent) ProxyUtils.getWeaver().reloadScriptingInstance(component);
alreadyWovenInRequest(component.toString());
@@ -125,7 +133,7 @@
public void addELContextListener(ELContextListener elContextListener) {
weaveDelegate();
- if (DynamicClassIdentifier.isDynamic(elContextListener.getClass()))
+ if (ProxyUtils.isDynamic(elContextListener.getClass()))
elContextListener = (ELContextListener) ProxyUtils.createMethodReloadingProxyFromObject(elContextListener, ELContextListener.class);
_delegate.addELContextListener(elContextListener);
}
@@ -146,7 +154,7 @@
weaveDelegate();
//good place for a dynamic reloading check as well
Object retVal = _delegate.evaluateExpressionGet(facesContext, s, aClass);
- if (DynamicClassIdentifier.isDynamic(retVal.getClass()))
+ if (ProxyUtils.isDynamic(retVal.getClass()))
retVal = ProxyUtils.getWeaver().reloadScriptingInstance(retVal);
return retVal;
}
@@ -154,14 +162,14 @@
public ActionListener getActionListener() {
weaveDelegate();
ActionListener retVal = _delegate.getActionListener();
- if (DynamicClassIdentifier.isDynamic(retVal.getClass()))
+ if (ProxyUtils.isDynamic(retVal.getClass()))
retVal = (ActionListener) ProxyUtils.createMethodReloadingProxyFromObject(retVal, ActionListener.class);
return retVal;
}
public void setActionListener(ActionListener actionListener) {
weaveDelegate();
- if (DynamicClassIdentifier.isDynamic(actionListener.getClass()))
+ if (ProxyUtils.isDynamic(actionListener.getClass()))
actionListener = (ActionListener) ProxyUtils.createMethodReloadingProxyFromObject(actionListener, ActionListener.class);
_delegate.setActionListener(actionListener);
}
@@ -200,14 +208,14 @@
weaveDelegate();
//defined in the setter to speed things up a little
NavigationHandler retVal = _delegate.getNavigationHandler();
- if (retVal != null && DynamicClassIdentifier.isDynamic(retVal.getClass()))
+ if (retVal != null && ProxyUtils.isDynamic(retVal.getClass()))
retVal = new NavigationHandlerProxy(retVal);
return retVal;
}
public void setNavigationHandler(NavigationHandler navigationHandler) {
weaveDelegate();
- if (navigationHandler != null && DynamicClassIdentifier.isDynamic(navigationHandler.getClass()))
+ if (navigationHandler != null && ProxyUtils.isDynamic(navigationHandler.getClass()))
navigationHandler = new NavigationHandlerProxy(navigationHandler);
_delegate.setNavigationHandler(navigationHandler);
}
@@ -248,7 +256,7 @@
java all our groovy reloading code is lost
hence we have to work with proxies here
*/
- if (DynamicClassIdentifier.isDynamic(handler.getClass()))
+ if (ProxyUtils.isDynamic(handler.getClass()))
handler = (ViewHandlerProxy) new ViewHandlerProxy(handler);
return handler;
}
@@ -256,7 +264,7 @@
public void setViewHandler(ViewHandler viewHandler) {
weaveDelegate();
/*make sure you have the delegates as well in properties*/
- if (DynamicClassIdentifier.isDynamic(viewHandler.getClass()))
+ if (ProxyUtils.isDynamic(viewHandler.getClass()))
viewHandler = (ViewHandlerProxy) new ViewHandlerProxy(viewHandler);
_delegate.setViewHandler(viewHandler);
@@ -288,7 +296,7 @@
* code, in the renderer we do it on method base
* due to the fact that our renderers are recycled via
* a flyweight pattern*/
- if (DynamicClassIdentifier.isDynamic(component.getClass()) && !alreadyWovenInRequest(component.toString())) {
+ if (ProxyUtils.isDynamic(component.getClass()) && !alreadyWovenInRequest(component.toString())) {
/*once it was tainted we have to recreate all the time*/
component = (UIComponent) ProxyUtils.getWeaver().reloadScriptingInstance(component);
alreadyWovenInRequest(component.toString());
@@ -305,7 +313,7 @@
* code, in the renderer we do it on method base
* due to the fact that our renderers are recycled via
* a flyweight pattern*/
- if (DynamicClassIdentifier.isDynamic(component.getClass()) && !alreadyWovenInRequest(component.toString())) {
+ if (ProxyUtils.isDynamic(component.getClass()) && !alreadyWovenInRequest(component.toString())) {
/*once it was tainted we have to recreate all the time*/
component = (UIComponent) ProxyUtils.getWeaver().reloadScriptingInstance(component);
alreadyWovenInRequest(component.toString());
@@ -339,7 +347,7 @@
*
* reloading objects at their interception points
*/
- if (DynamicClassIdentifier.isDynamic(retVal.getClass())) {
+ if (ProxyUtils.isDynamic(retVal.getClass())) {
retVal = (Converter) ProxyUtils.createMethodReloadingProxyFromObject(retVal, Converter.class);
}
@@ -350,7 +358,7 @@
public Converter createConverter(Class aClass) {
weaveDelegate();
Converter retVal = _delegate.createConverter(aClass);
- if (retVal != null && DynamicClassIdentifier.isDynamic(retVal.getClass())) {
+ if (retVal != null && ProxyUtils.isDynamic(retVal.getClass())) {
retVal = (Converter) ProxyUtils.createMethodReloadingProxyFromObject(retVal, Converter.class);
}
@@ -390,7 +398,7 @@
public Validator createValidator(String s) throws FacesException {
weaveDelegate();
Validator retVal = _delegate.createValidator(s);
- if (DynamicClassIdentifier.isDynamic(retVal.getClass()) && !Proxy.isProxyClass(retVal.getClass())) {
+ if (ProxyUtils.isDynamic(retVal.getClass()) && !Proxy.isProxyClass(retVal.getClass())) {
retVal = (Validator) ProxyUtils.createMethodReloadingProxyFromObject(retVal, Validator.class);
}
return retVal;
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ELResolverProxy.java Tue Aug 25 13:22:25 2009
@@ -18,14 +18,20 @@
*/
package org.apache.myfaces.scripting.jsf.dynamicdecorators.implemetations;
-import org.apache.myfaces.scripting.core.util.DynamicClassIdentifier;
-import org.apache.myfaces.scripting.api.Decorated;
-import org.apache.myfaces.scripting.core.util.ProxyUtils;
+import java.beans.FeatureDescriptor;
+import java.util.Iterator;
-import javax.el.*;
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.PropertyNotFoundException;
+import javax.el.PropertyNotWritableException;
-import java.util.Iterator;
-import java.beans.FeatureDescriptor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.scripting.api.Decorated;
+import org.apache.myfaces.groovyloader.core.DynamicClassIdentifier;
+import org.apache.myfaces.scripting.core.util.ProxyUtils;
/**
* EL Resolver which is scripting enabled
@@ -33,19 +39,22 @@
* @author Werner Punz
*/
public class ELResolverProxy extends ELResolver implements Decorated {
+ Log log = LogFactory.getLog(ELResolverProxy.class);
-
//Map reinstantiated = new HashMap();
- public Object getValue(ELContext elContext, Object o, Object o1) throws NullPointerException, PropertyNotFoundException, ELException {
- Object retVal = _delegate.getValue(elContext, o, o1);
- if (retVal != null && DynamicClassIdentifier.isDynamic(retVal.getClass())) {
+ public Object getValue(ELContext elContext, final Object base, final Object property) throws NullPointerException, PropertyNotFoundException, ELException {
+ Object retVal = _delegate.getValue(elContext, base, property);
+
+ if (retVal != null && ProxyUtils.isDynamic(retVal.getClass())) {
+ log.info("dynamically reloading bean");
+
Object newRetVal = ProxyUtils.getWeaver().reloadScriptingInstance(retVal); /*once it was tainted or loaded by
our classloader we have to recreate all the time to avoid classloader issues*/
- if(newRetVal != retVal) {
- _delegate.setValue(elContext, o, o1, newRetVal);
+ if (newRetVal != retVal) {
+ _delegate.setValue(elContext, base, property, newRetVal);
}
return newRetVal;
//reinstantiated.put(retVal.getClass().getName(), retVal.getClass());
@@ -57,8 +66,8 @@
public Class<?> getType(ELContext elContext, Object o, Object o1) throws NullPointerException, PropertyNotFoundException, ELException {
Class<?> retVal = _delegate.getType(elContext, o, o1);
- if (retVal != null && DynamicClassIdentifier.isDynamic((Class)retVal)) {
- return ProxyUtils.getWeaver().reloadScriptingClass((Class)retVal);
+ if (retVal != null && ProxyUtils.isDynamic((Class) retVal)) {
+ return ProxyUtils.getWeaver().reloadScriptingClass((Class) retVal);
}
return retVal;
}
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/LifefcycleProxy.java Tue Aug 25 13:22:25 2009
@@ -18,7 +18,7 @@
*/
package org.apache.myfaces.scripting.jsf.dynamicdecorators.implemetations;
-import org.apache.myfaces.scripting.core.util.DynamicClassIdentifier;
+import org.apache.myfaces.groovyloader.core.DynamicClassIdentifier;
import org.apache.myfaces.scripting.api.Decorated;
import org.apache.myfaces.scripting.core.util.ProxyUtils;
@@ -49,7 +49,7 @@
public void addPhaseListener(PhaseListener phaseListener) {
weaveDelegate();
/*we can put our object weaving code into the add here*/
- if (DynamicClassIdentifier.isDynamic(phaseListener.getClass()))
+ if (ProxyUtils.isDynamic(phaseListener.getClass()))
phaseListener = (PhaseListener) ProxyUtils.createMethodReloadingProxyFromObject(phaseListener, PhaseListener.class);
_delegate.addPhaseListener(phaseListener);
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java Tue Aug 25 13:22:25 2009
@@ -18,10 +18,10 @@
*/
package org.apache.myfaces.scripting.jsf.dynamicdecorators.implemetations;
-import org.apache.myfaces.scripting.core.util.DynamicClassIdentifier;
+import org.apache.myfaces.groovyloader.core.DynamicClassIdentifier;
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.jsf.ScriptingConst;
import javax.faces.context.FacesContext;
import javax.faces.render.RenderKit;
@@ -67,7 +67,7 @@
public void addRenderer(String s, String s1, Renderer renderer) {
weaveDelegate();
- if(DynamicClassIdentifier.isDynamic(renderer.getClass()) && !alreadyWovenInRequest(renderer.toString())) {
+ if(ProxyUtils.isDynamic(renderer.getClass()) && !alreadyWovenInRequest(renderer.toString())) {
renderer = (Renderer) ProxyUtils.getWeaver().reloadScriptingInstance(renderer);
alreadyWovenInRequest(renderer.toString());
}
@@ -79,7 +79,7 @@
weaveDelegate();
Renderer retVal = _delegate.getRenderer(s, s1);
- if (retVal != null && DynamicClassIdentifier.isDynamic(retVal.getClass())&& !alreadyWovenInRequest(retVal.toString())) {
+ if (retVal != null && ProxyUtils.isDynamic(retVal.getClass())&& !alreadyWovenInRequest(retVal.toString())) {
retVal = (Renderer) ProxyUtils.getWeaver().reloadScriptingInstance(retVal);
alreadyWovenInRequest(retVal.toString());
_delegate.addRenderer(s,s1,retVal);
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/VariableResolverProxy.java Tue Aug 25 13:22:25 2009
@@ -18,7 +18,7 @@
*/
package org.apache.myfaces.scripting.jsf.dynamicdecorators.implemetations;
-import org.apache.myfaces.scripting.core.util.DynamicClassIdentifier;
+import org.apache.myfaces.groovyloader.core.DynamicClassIdentifier;
import org.apache.myfaces.scripting.api.Decorated;
import org.apache.myfaces.scripting.core.util.ProxyUtils;
@@ -43,7 +43,7 @@
public Object resolveVariable(FacesContext facesContext, String s) throws EvaluationException {
Object variable = _delegate.resolveVariable(facesContext, s);
- if (DynamicClassIdentifier.isDynamic(variable.getClass()))
+ if (ProxyUtils.isDynamic(variable.getClass()))
variable = ProxyUtils.getWeaver().reloadScriptingInstance(variable);
return variable;
}
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/CustomChainLoader.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/CustomChainLoader.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/CustomChainLoader.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/CustomChainLoader.java Tue Aug 25 13:22:25 2009
@@ -1,63 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.scripting.servlet;
import org.apache.myfaces.groovyloader.core.GroovyWeaver;
+import org.apache.myfaces.scripting.api.ScriptingWeaver;
+import org.apache.myfaces.scripting.core.util.ProxyUtils;
import org.apache.myfaces.shared_impl.util.ClassLoaderExtension;
+import org.apache.commons.lang.StringUtils;
import javax.servlet.ServletContext;
-import java.io.File;
+/**
+ * a custom chainloader which adds a groovy loading
+ * facility to our myfaces loading plugin system
+ *
+ * @author Werner Punz
+ */
public class CustomChainLoader extends ClassLoaderExtension {
- String _classRoot = "";
- String _groovyRoot = "";
- String _testRoot = "/Users/werpu/Desktop/myfaces-groovy/core/src/main/groovy/";
- static GroovyWeaver groovyWeaver = null;
+ /*
+ * servlet context init var for additional chain loader paths which have
+ * higher priority than the default ones
+ */
+ static String CUSTOM_LOADER_PATHS = "org.apache.myfaces.scripting.groovy.LOADER_PATHS";
- static public GroovyWeaver getGroovyFactory() {
- return groovyWeaver;
- }
-
- static public void setGroovyFactory(GroovyWeaver groovyWeaver) {
- groovyWeaver = groovyWeaver;
- }
+ String classRoot = "";
+ String scriptingRoot = "";
+ ScriptingWeaver scriptingWeaver = null;
public CustomChainLoader(ServletContext servletContext) {
- this.groovyWeaver = new GroovyWeaver();
- String contextRoot = servletContext.getRealPath("/WEB-INF/groovy/");
+ this.scriptingWeaver = new GroovyWeaver();
- contextRoot = contextRoot.trim();
- if(!contextRoot.endsWith("/") && !contextRoot.endsWith("\\"))
- contextRoot += "/";
- _groovyRoot = contextRoot;
+ String contextRoot = servletContext.getRealPath("/WEB-INF/groovy/");
+ contextRoot = contextRoot.trim();
+ if (!contextRoot.endsWith("/") && !contextRoot.endsWith("\\"))
+ contextRoot += "/";
+ scriptingRoot = contextRoot;
+
+ String additionalGroovyLoaderPaths = servletContext.getInitParameter(CUSTOM_LOADER_PATHS);
+ if(!StringUtils.isBlank(additionalGroovyLoaderPaths)) {
+ String [] additionalPaths = additionalGroovyLoaderPaths.split(",");
+ for(String path: additionalPaths) {
+ this.scriptingWeaver.appendCustomScriptPath(path);
+ }
+ }
+
+ this.scriptingWeaver.appendCustomScriptPath(scriptingRoot);
+ this.scriptingWeaver.appendCustomScriptPath(classRoot);
+ //we have to store it because our filter
+ //does not trigger upon initialisation
+ ProxyUtils.setWeaver(this.scriptingWeaver);
}
public Class forName(String name) {
if (name.startsWith("java.")) /*the entire java namespace is reserved so no use to do a specific classloading check here*/
return null;
+ if (name.startsWith("javax.")) /*the entire java namespace is reserved so no use to do a specific classloading check here*/
+ return null;
else if (name.startsWith("com.sun")) /*internal java specific namespace*/
return null;
- String groovyClass = name.replaceAll("\\.", "/") + ".groovy";
- File classFile = new File(_groovyRoot + groovyClass);
-
- if (classFile.exists()) /*we check the groovy subdir for our class*/
- return (Class) groovyWeaver.loadScriptingClassFromFile(_groovyRoot + groovyClass);
-
- classFile = new File(_classRoot + groovyClass);
- if (classFile.exists()) /*now lets check our class subdir for a groovy file to be loaded*/
- return (Class) groovyWeaver.loadScriptingClassFromFile(_classRoot + groovyClass);
-
- /*standard testcase*/
- classFile = new File(_testRoot + groovyClass);
-
-
- if (classFile.exists()) /*now lets check our class subdir for a groovy file to be loaded*/
- return groovyWeaver.loadScriptingClassFromFile(_testRoot + groovyClass);
+ return scriptingWeaver.loadScriptingClassFromName(name);
+ }
+ public ScriptingWeaver getScriptingWeaver() {
+ return scriptingWeaver;
+ }
- return null;
+ public void setScriptingWeaver(ScriptingWeaver scriptingWeaver) {
+ this.scriptingWeaver = scriptingWeaver;
}
+
}
\ No newline at end of file
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/ScriptingServletFilter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/ScriptingServletFilter.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/ScriptingServletFilter.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/ScriptingServletFilter.java Tue Aug 25 13:22:25 2009
@@ -19,12 +19,11 @@
package org.apache.myfaces.scripting.servlet;
import org.apache.myfaces.scripting.core.util.ProxyUtils;
-import org.apache.myfaces.scripting.jsf.ScriptingConst;
+import org.apache.myfaces.scripting.api.ScriptingConst;
import javax.servlet.*;
import java.io.IOException;
-import org.apache.myfaces.groovyloader.core.DelegatingGroovyClassloader;
/**
@@ -43,14 +42,8 @@
}
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
- //
Object groovyDynamicLoader = context.getAttribute("GroovyDynamicLoader");
- if(groovyDynamicLoader != null) {
- ProxyUtils.setWeaver(groovyDynamicLoader);
- } else {
- initClassloader();
- }
-
+ ProxyUtils.setWeaver(groovyDynamicLoader);
filterChain.doFilter(servletRequest, servletResponse);
}
@@ -58,42 +51,4 @@
ProxyUtils.clean();
}
- /**
- * main classloader init we can kickstart it only once our context is initialized
- * we have to recheck because sometimes the myfaces init
- * might trigger before our init and the filter might get called
- * before we have our own context classloader in place
- */
- protected void initClassloader() {
- //TODO check whether we have to reinitialize only once
- if (context == null) return;
- ClassLoader cls = Thread.currentThread().getContextClassLoader();
- boolean found = false;
- do {
- found = cls instanceof DelegatingGroovyClassloader;
- cls = cls.getParent();
- } while (!found && cls != null);
- if (found) {
- return; /*we skip this here because we already have the classloader in place*/
- }
-
- /**
- * We have to do that because many containers
- * exchange classloaders on the fly and
- * and sometimes our classloader simply is dropped
- */
-
- //TODO to eliminate the classloader handling we have to add
- //the static data for our reloader into the context
- //and then reinitialize the loader constantly
-
- //we have to make sure that our cleanup thread is not touched by this
-
-
- ClassLoader newLoader = (ClassLoader) context.getAttribute(ScriptingConst.SCRIPTING_CLASSLOADER);
- Thread.currentThread().setContextClassLoader(newLoader);
- //we have to add a remove here because some nio based containers try to serialize the context attributes
-
- }
-
}
\ No newline at end of file
Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java Tue Aug 25 13:22:25 2009
@@ -1,9 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.scripting.servlet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.shared_impl.util.ClassUtils;
+import org.apache.myfaces.webapp.StartupListener;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletContextEvent;
@@ -13,8 +32,10 @@
* @author werpu
* @date: 14.08.2009
*/
-public class StartupServletContextPluginChainLoader implements ServletContextListener {
- public void contextInitialized(ServletContextEvent servletContextEvent) {
+public class StartupServletContextPluginChainLoader implements StartupListener {
+
+
+ public void preInit(ServletContextEvent servletContextEvent) {
Log log = LogFactory.getLog(this.getClass());
log.info("Instantiating StartupServletContextPluginChainLoader");
@@ -24,11 +45,17 @@
CustomChainLoader loader = new CustomChainLoader(servletContext);
ClassUtils.addClassLoadingExtension(loader, true);
- servletContext.setAttribute("GroovyDynamicLoader", loader.getGroovyFactory());
+ servletContext.setAttribute("GroovyDynamicLoader", loader.getScriptingWeaver());
}
- public void contextDestroyed(ServletContextEvent servletContextEvent) {
+ public void postInit(ServletContextEvent evt) {
+ }
+
+ public void preDestroy(ServletContextEvent evt) {
+ }
+
+ public void postDestroy(ServletContextEvent evt) {
}
}
\ No newline at end of file
Modified: myfaces/extensions/scripting/trunk/core/src/main/resources/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/resources/META-INF/faces-config.xml?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/resources/META-INF/faces-config.xml (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/resources/META-INF/faces-config.xml Tue Aug 25 13:22:25 2009
@@ -3,7 +3,42 @@
PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
-<faces-config>
-
+<!--
+ * 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.
+-->
+<faces-config>
+ <factory>
+ <!--
+ all these factories are replacements for the normal ones
+ issue is we have to make a codeweaving for every bean created
+ -->
+ <application-factory>
+ org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingApplicationFactory
+ </application-factory>
+ <faces-context-factory>
+ org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingFacesContextFactory
+ </faces-context-factory>
+ <lifecycle-factory>
+ org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingLifecycleFactory
+ </lifecycle-factory>
+ <render-kit-factory>
+ org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingRenderkitFactory
+ </render-kit-factory>
+ </factory>
</faces-config>
\ No newline at end of file
Modified: myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/faces-config.xml Tue Aug 25 13:22:25 2009
@@ -1,5 +1,22 @@
<?xml version="1.0"?>
-
+<!--
+ * 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.
+-->
<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
@@ -18,25 +35,19 @@
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
- <factory>
- <!--
- all these factories are replacements for the normal ones
- issue is we have to make a codeweaving for every bean created
- -->
- <application-factory>
- org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingApplicationFactory
- </application-factory>
- <faces-context-factory>
- org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingFacesContextFactory
- </faces-context-factory>
- <lifecycle-factory>
- org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingLifecycleFactory
- </lifecycle-factory>
- <render-kit-factory>
- org.apache.myfaces.scripting.jsf.dynamicdecorators.factories.ScriptingRenderkitFactory
- </render-kit-factory>
-
- </factory>
+ <managed-bean>
+ <managed-bean-name>blogView</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.groovyloader.blog.Blog</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>blogService</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.groovyloader.blog.BlogService</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ </managed-bean>
+
+
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
<navigation-handler>
Modified: myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestActionListener.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestActionListener.groovy?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestActionListener.groovy (original)
+++ myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestActionListener.groovy Tue Aug 25 13:22:25 2009
@@ -1,14 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.groovyloader.test
import javax.faces.event.ActionListener
import javax.faces.event.ActionEvent
/**
- * Created by IntelliJ IDEA.
- * User: werpu
- * Date: 13.05.2008
- * Time: 21:21:20
- * To change this template use File | Settings | File Templates.
+ * @author Werner Punz
*/
class TestActionListener implements ActionListener {
Modified: myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestBean.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestBean.groovy?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestBean.groovy (original)
+++ myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestBean.groovy Tue Aug 25 13:22:25 2009
@@ -1,14 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.groovyloader.test
/**
- * Created by IntelliJ IDEA.
- * User: werpu
- * Date: 09.05.2008
- * Time: 15:05:13
- * To change this template use File | Settings | File Templates.
+ * @author Werner Punz
*/
class TestBean {
String helloworld = "hallo ist - die bean"
- def helloworld_changed = true;
+
+ //note you can add new atrtributes
+ //no setter or getter is needed
+ //and with a single request you will get the
+ //attribute be used in your page
+ //give it a try
+
+ //String newAttribute = "This is a new attribute"
+ //uncomment this and add a control to the page displaying it
+
public String getHelloworld() {
return helloworld
@@ -22,6 +45,6 @@
public String getXxx() {
- "Xxx"
+ "xxx Simple text you can change me on the fly"
}
}
\ No newline at end of file
Modified: myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestComponent.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestComponent.groovy?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestComponent.groovy (original)
+++ myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestComponent.groovy Tue Aug 25 13:22:25 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.groovyloader.test
import javax.faces.component.UIInput
@@ -5,11 +23,7 @@
import javax.faces.el.ValueBinding
/**
- * Created by IntelliJ IDEA.
- * User: werpu
- * Date: 15.05.2008
- * Time: 18:50:10
- * To change this template use File | Settings | File Templates.
+ * @author Werner Punz
*/
public class TestComponent extends UIInput {
Modified: myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestConverter.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestConverter.groovy?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestConverter.groovy (original)
+++ myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestConverter.groovy Tue Aug 25 13:22:25 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.groovyloader.test
import javax.faces.convert.Converter
@@ -5,11 +23,7 @@
import javax.faces.component.UIComponent
/**
- * Created by IntelliJ IDEA.
- * User: werpu
- * Date: 13.05.2008
- * Time: 21:35:15
- * To change this template use File | Settings | File Templates.
+ * @author Werner Punz
*/
class TestConverter implements Converter {
Modified: myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestNavigationHandler.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestNavigationHandler.groovy?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestNavigationHandler.groovy (original)
+++ myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestNavigationHandler.groovy Tue Aug 25 13:22:25 2009
@@ -1,14 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.groovyloader.test
import javax.faces.application.NavigationHandler
import javax.faces.context.FacesContext
/**
- * Created by IntelliJ IDEA.
- * User: werpu
- * Date: 13.05.2008
- * Time: 19:09:39
- * To change this template use File | Settings | File Templates.
+ * @author Werner Punz
*/
class TestNavigationHandler extends NavigationHandler {
NavigationHandler _delegate = null;
Modified: myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestPhaseListener.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestPhaseListener.groovy?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestPhaseListener.groovy (original)
+++ myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestPhaseListener.groovy Tue Aug 25 13:22:25 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.groovyloader.test
import javax.faces.event.PhaseListener
@@ -5,11 +23,7 @@
import javax.faces.event.PhaseId
/**
- * Created by IntelliJ IDEA.
- * User: werpu
- * Date: 06.05.2008
- * Time: 07:18:55
- * To change this template use File | Settings | File Templates.
+ * @author Werner Punz
*/
class TestPhaseListener implements PhaseListener {
Modified: myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestRenderer.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestRenderer.groovy?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestRenderer.groovy (original)
+++ myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestRenderer.groovy Tue Aug 25 13:22:25 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.groovyloader.test
import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTextRendererBase
@@ -6,11 +24,7 @@
/**
- * Created by IntelliJ IDEA.
- * User: werpu
- * Date: 16.05.2008
- * Time: 15:18:52
- * To change this template use File | Settings | File Templates.
+ * @author Werner Punz
*/
public class TestRenderer extends HtmlTextRendererBase {
Modified: myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestValidator.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestValidator.groovy?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestValidator.groovy (original)
+++ myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestValidator.groovy Tue Aug 25 13:22:25 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.groovyloader.test
import javax.faces.validator.Validator
@@ -5,11 +23,7 @@
import javax.faces.component.UIComponent
/**
- * Created by IntelliJ IDEA.
- * User: werpu
- * Date: 13.05.2008
- * Time: 21:33:23
- * To change this template use File | Settings | File Templates.
+ * @author Werner Punz
*/
class TestValidator implements Validator {
Modified: myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestViewHandler.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestViewHandler.groovy?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestViewHandler.groovy (original)
+++ myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestViewHandler.groovy Tue Aug 25 13:22:25 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.groovyloader.test
import javax.faces.application.ViewHandler
@@ -5,11 +23,7 @@
import javax.faces.component.UIViewRoot
/**
- * Delegating View handler
- * you have to expose the internal properties
- * to enable on method reloading
- * (if it is possible at all)
- *
+ * @author Werner Punz
*/
class TestViewHandler extends ViewHandler {
//setters and getters are added implicitely
@@ -63,5 +77,4 @@
delegate.writeState(facesContext);
}
-
}
\ No newline at end of file
Modified: myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/web.xml?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/extensions/scripting/trunk/examples/src/main/webapp/WEB-INF/web.xml Tue Aug 25 13:22:25 2009
@@ -45,6 +45,14 @@
<param-value>org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
</context-param>
+ <!--
+ <context-param>
+ <description>Additional comma separated loader paths to allow direct editing on the sources directory instead
+ of the deployment dir</description>
+ <param-name>org.apache.myfaces.scripting.groovy.LOADER_PATHS</param-name>
+ <param-value>/home/werpu/development/workspace/myfaces-groovy/examples/src/main/webapp/WEB-INF/groovy</param-value>
+ </context-param>
+ -->
<context-param>
<description>State saving method: "client" or "server" (= default)
@@ -250,16 +258,7 @@
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
-->
- <!--
- Dirty hack method
- -->
- <!--
- <listener>
- <listener-class>
- org.apache.myfaces.scripting.jsf.StartupServletContextListener
- </listener-class>
- </listener>
- -->
+
<!-- Faces Servlet -->
<servlet>
Modified: myfaces/extensions/scripting/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/pom.xml?rev=807608&r1=807607&r2=807608&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/pom.xml (original)
+++ myfaces/extensions/scripting/trunk/pom.xml Tue Aug 25 13:22:25 2009
@@ -14,7 +14,7 @@
<modules>
<module>core</module>
<module>examples</module>
-
+ <module>spring-example</module>
</modules>
@@ -120,7 +120,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>3.8.2</version>
+ <version>4.7</version>
<scope>test</scope>
</dependency>
@@ -145,6 +145,40 @@
<artifactId>velocity</artifactId>
<version>1.5</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jci-core</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jci-javac</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jci-eclipse</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jci-janino</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jci-javac</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+
</dependencies>
<build>
@@ -153,8 +187,9 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <source>1.5</source>
- <target>1.5</target>
+ <source>1.6</source>
+ <target>1.6</target>
+
</configuration>
</plugin>
</plugins>
Propchange: myfaces/extensions/scripting/trunk/spring-example/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Aug 25 13:22:25 2009
@@ -0,0 +1 @@
+*.iml
Added: myfaces/extensions/scripting/trunk/spring-example/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/spring-example/pom.xml?rev=807608&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/spring-example/pom.xml (added)
+++ myfaces/extensions/scripting/trunk/spring-example/pom.xml Tue Aug 25 13:22:25 2009
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <parent>
+ <artifactId>myfaces-groovy</artifactId>
+ <groupId>org.apache.myfaces.extended</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.myfaces.extended</groupId>
+ <artifactId>myfaces-groovy-spring-examples</artifactId>
+ <packaging>war</packaging>
+ <name>A custom project using myfaces</name>
+ <version>1.0-SNAPSHOT</version>
+ <url>http://www.apache.org</url>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.1</version>
+ <configuration>
+ <connectors>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>9090</port>
+ <maxIdleTime>60000</maxIdleTime>
+ </connector>
+ </connectors>
+ <scanIntervalSeconds>1</scanIntervalSeconds>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.5.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.extended</groupId>
+ <artifactId>myfaces-groovy-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>1.2.8-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>1.2.8-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.11</version>
+ </dependency>
+ <!-- jstl because of facelets -->
+ <dependency>
+ <groupId>jstl</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.tomahawk</groupId>
+ <artifactId>tomahawk</artifactId>
+ <version>1.1.6</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>jstl</artifactId>
+ <groupId>javax.servlet</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.5.6</version>
+ </dependency>
+ </dependencies>
+</project>
Propchange: myfaces/extensions/scripting/trunk/spring-example/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/extensions/scripting/trunk/spring-example/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL