You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by sg...@apache.org on 2006/01/07 16:26:15 UTC
svn commit: r366777 [1/3] - in /jakarta/turbine/fulcrum/trunk/script: ./
src/ src/java/ src/java/org/ src/java/org/apache/
src/java/org/apache/fulcrum/ src/java/org/apache/fulcrum/script/
src/java/org/apache/fulcrum/script/impl/ src/test/ src/test/org/...
Author: sgoeschl
Date: Sat Jan 7 07:25:56 2006
New Revision: 366777
URL: http://svn.apache.org/viewcvs?rev=366777&view=rev
Log:
Initial import of fulcrum-script service providing support for JSR 223
Added:
jakarta/turbine/fulcrum/trunk/script/
jakarta/turbine/fulcrum/trunk/script/LICENSE.txt
jakarta/turbine/fulcrum/trunk/script/maven.xml
jakarta/turbine/fulcrum/trunk/script/project.properties
jakarta/turbine/fulcrum/trunk/script/project.xml
jakarta/turbine/fulcrum/trunk/script/src/
jakarta/turbine/fulcrum/trunk/script/src/java/
jakarta/turbine/fulcrum/trunk/script/src/java/org/
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptAvalonContext.java
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptRunnable.java
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptService.java
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptAvalonContextImpl.java
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptBaseService.java
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptCache.java
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptCacheEntry.java
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptEngineEntry.java
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptRunnableImpl.java
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptServiceImpl.java
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptServiceManagerImpl.java
jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/Validate.java
jakarta/turbine/fulcrum/trunk/script/src/test/
jakarta/turbine/fulcrum/trunk/script/src/test/TestGroovyComponentConfig.xml
jakarta/turbine/fulcrum/trunk/script/src/test/TestRhinoComponentConfig.xml
jakarta/turbine/fulcrum/trunk/script/src/test/TestRoleConfig.xml
jakarta/turbine/fulcrum/trunk/script/src/test/org/
jakarta/turbine/fulcrum/trunk/script/src/test/org/apache/
jakarta/turbine/fulcrum/trunk/script/src/test/org/apache/fulcrum/
jakarta/turbine/fulcrum/trunk/script/src/test/org/apache/fulcrum/script/
jakarta/turbine/fulcrum/trunk/script/src/test/org/apache/fulcrum/script/AbstractScriptTest.java
jakarta/turbine/fulcrum/trunk/script/src/test/org/apache/fulcrum/script/GroovyTest.java
jakarta/turbine/fulcrum/trunk/script/src/test/org/apache/fulcrum/script/MyInterface.java
jakarta/turbine/fulcrum/trunk/script/src/test/org/apache/fulcrum/script/RhinoTest.java
jakarta/turbine/fulcrum/trunk/script/src/test/org/apache/fulcrum/script/Testobj.java
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/groovy/
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/groovy/Avalon.groovy
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/groovy/CompilableInterface.groovy
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/groovy/HelloWorld.groovy
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/groovy/MultiThreaded.groovy
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/groovy/NamespaceDemo2.groovy
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/groovy/NamespaceDemo3.groovy
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/groovy/RuntimeError.groovy
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/Avalon.js
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/CompilableInterface.js
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/HelloWorld.js
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/InvocableIntf.js
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/MultiThreaded.js
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/NamespaceDemo2.js
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/NamespaceDemo3.js
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/RuntimeError.js
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/locator/
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/locator/bar/
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/locator/bar/foo.js
jakarta/turbine/fulcrum/trunk/script/src/test/scripts/js/locator/foo.js
jakarta/turbine/fulcrum/trunk/script/xdocs/
jakarta/turbine/fulcrum/trunk/script/xdocs/changes.xml
jakarta/turbine/fulcrum/trunk/script/xdocs/configuration.xml
jakarta/turbine/fulcrum/trunk/script/xdocs/index.xml
jakarta/turbine/fulcrum/trunk/script/xdocs/integration.xml
jakarta/turbine/fulcrum/trunk/script/xdocs/navigation.xml
jakarta/turbine/fulcrum/trunk/script/xdocs/resources.xml
jakarta/turbine/fulcrum/trunk/script/xdocs/technical.xml
Added: jakarta/turbine/fulcrum/trunk/script/LICENSE.txt
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/LICENSE.txt?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/LICENSE.txt (added)
+++ jakarta/turbine/fulcrum/trunk/script/LICENSE.txt Sat Jan 7 07:25:56 2006
@@ -0,0 +1,16 @@
+/*
+ * Copyright 2005 Apache Software Foundation
+ * Licensed 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.
+ */
Added: jakarta/turbine/fulcrum/trunk/script/maven.xml
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/maven.xml?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/maven.xml (added)
+++ jakarta/turbine/fulcrum/trunk/script/maven.xml Sat Jan 7 07:25:56 2006
@@ -0,0 +1,48 @@
+<project default="local:build" xmlns:deploy="deploy" xmlns:ant="jelly:ant">
+
+ <!-- ################################################################## -->
+ <!-- M A V E N G O A L S -->
+ <!-- ################################################################## -->
+
+ <goal name ="local:all" description="Creates everything for this project">
+ <attainGoal name="local:build"/>
+ <attainGoal name="local:site"/>
+ </goal>
+
+ <goal name ="local:clover-build" description="Builds all project artifacts with Clover instrumentation">
+ <attainGoal name="clover:on"/>
+ <attainGoal name="local:build"/>
+ </goal>
+
+ <goal name ="local:build" description="Builds all project artifacts">
+ <attainGoal name="clean"/>
+ <attainGoal name="jar:install"/>
+ </goal>
+
+ <goal name ="local:site" description="Builds the project site">
+ <attainGoal name="clean"/>
+ <attainGoal name="site"/>
+ </goal>
+
+ <goal name ="local:copy-deps" description="Copies the dependent JARs into lib">
+ <deploy:copy-deps todir="lib"/>
+ </goal>
+
+
+ <!-- ################################################################## -->
+ <!-- M A V E N H O O K S -->
+ <!-- ################################################################## -->
+
+ <postGoal name="clean:clean">
+ <echo>Deleting Eclipse directories</echo>
+ <ant:delete dir="classes"/>
+ <ant:delete file="temp/karma.txt"/>
+ </postGoal>
+
+ <preGoal name="jar:jar">
+ <ant:delete file="target/classes/componentRoles.xml"/>
+ <ant:delete file="target/classes/componentConfiguration.xml"/>
+ <ant:delete file="target/classes/log4j.properties"/>
+ </preGoal>
+
+</project>
Added: jakarta/turbine/fulcrum/trunk/script/project.properties
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/project.properties?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/project.properties (added)
+++ jakarta/turbine/fulcrum/trunk/script/project.properties Sat Jan 7 07:25:56 2006
@@ -0,0 +1,2 @@
+# display the date on the site
+maven.xdoc.date = left
\ No newline at end of file
Added: jakarta/turbine/fulcrum/trunk/script/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/project.xml?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/project.xml (added)
+++ jakarta/turbine/fulcrum/trunk/script/project.xml Sat Jan 7 07:25:56 2006
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<project>
+ <extend>${basedir}/../project.xml</extend>
+ <id>fulcrum-script</id>
+ <name>Fulcrum Script Component</name>
+ <currentVersion>1.0.1-dev</currentVersion>
+
+ <dependencies>
+
+ <!-- test dependencies -->
+
+ <dependency>
+ <groupId>fulcrum</groupId>
+ <artifactId>fulcrum-testcontainer</artifactId>
+ <version>1.0.5</version>
+ <url>http://jakarta.apache.org/turbine/fulcrum/</url>
+ </dependency>
+
+ <dependency>
+ <groupId>fulcrum</groupId>
+ <artifactId>fulcrum-yaafi</artifactId>
+ <version>1.0.5-dev</version>
+ <url>http://jakarta.apache.org/turbine/fulcrum/</url>
+ </dependency>
+
+ <dependency>
+ <groupId>groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.0-jsr-04</version>
+ <url>http://groovy.codehaus.org</url>
+ </dependency>
+
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <version>1.6R2</version>
+ <url>http://www.mozilla.org/rhino</url>
+ </dependency>
+
+ <!-- compile/runtime dependencies -->
+
+ <dependency>
+ <groupId>javax.script</groupId>
+ <artifactId>script</artifactId>
+ <version>1.0</version>
+ <url>http://jakarta.apache.org/turbine/fulcrum/</url>
+ http://www.jcp.org/aboutJava/communityprocess/pr/jsr223/
+ </dependency>
+
+ <dependency>
+ <groupId>fulcrum</groupId>
+ <artifactId>fulcrum-resourcemanager</artifactId>
+ <version>1.0.1-dev</version>
+ <url>http://jakarta.apache.org/turbine/fulcrum/</url>
+ </dependency>
+
+ </dependencies>
+
+</project>
Added: jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptAvalonContext.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptAvalonContext.java?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptAvalonContext.java (added)
+++ jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptAvalonContext.java Sat Jan 7 07:25:56 2006
@@ -0,0 +1,70 @@
+package org.apache.fulcrum.script;
+
+/*
+ * Copyright 2005 Apache Software Foundation
+ * Licensed 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.
+ */
+
+import java.io.File;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceManager;
+
+/**
+ * Holder class for Avalon related artifacts to be passed to a script.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public interface ScriptAvalonContext
+{
+ /**
+ * @return Returns the configuration
+ */
+ Configuration getConfiguration();
+
+ /**
+ * @return Returns the context.
+ */
+ Context getContext();
+
+ /**
+ * @return Returns the logger.
+ */
+ Logger getLogger();
+
+ /**
+ * @return Returns the serviceManager.
+ */
+ ServiceManager getServiceManager();
+
+ /**
+ * @return Returns the parameters.
+ */
+ Parameters getParameters();
+
+ /**
+ * @return Returns the Avalon application directory
+ */
+ File getApplicationDir() throws ContextException;
+
+ /**
+ * @return Returns the Avalon application directory
+ */
+ File getTempDir() throws ContextException;
+}
Added: jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptRunnable.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptRunnable.java?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptRunnable.java (added)
+++ jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptRunnable.java Sat Jan 7 07:25:56 2006
@@ -0,0 +1,38 @@
+package org.apache.fulcrum.script;
+
+/*
+ * Copyright 2005 Apache Software Foundation
+ * Licensed 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.
+ */
+
+import java.util.Map;
+
+/**
+ * A Runnable executing scripts
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public interface ScriptRunnable extends Runnable
+{
+ /**
+ * @param args The args to be used.
+ */
+ void setArgs(Map args);
+
+ /**
+ * @return Returns the result.
+ */
+ Object getResult() throws Exception;
+}
Added: jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptService.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptService.java?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptService.java (added)
+++ jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/ScriptService.java Sat Jan 7 07:25:56 2006
@@ -0,0 +1,114 @@
+package org.apache.fulcrum.script;
+
+/*
+ * Copyright 2005 Apache Software Foundation
+ * Licensed 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.
+ */
+
+import java.io.IOException;
+
+import javax.script.Namespace;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+
+/**
+ * An Avalon service to execute scripts based on JSR-223.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public interface ScriptService
+{
+ /**
+ * @return the underlying ScriptEngineManager.
+ */
+ ScriptEngineManager getScriptEngineManager();
+
+ /**
+ * @return the underlying default ScriptEngine.
+ */
+ ScriptEngine getScriptEngine();
+
+ /**
+ * Does the script exist?
+ *
+ * @param scriptName the name of the script
+ * @return true if the script exists
+ */
+ boolean exists( String scriptName );
+
+ /**
+ * Executes the specified script. The default ScriptContext
+ * for the ScriptEngine is used.
+ *
+ * @param scriptName the name of the script
+ * @return result from the executed script
+ * @throws IOException loading the script failed
+ * @throws ScriptException if an error occurrs during script execution.
+ */
+ Object eval( String scriptName ) throws IOException, ScriptException;
+
+ /**
+ * Executes the script using the Namespace argument
+ * as the ENGINE_SCOPE Namespace of the ScriptEngine
+ * during the script execution.
+ *
+ * @param scriptName the name of the script
+ * @param namespace The Namespace of attributes
+ * @return result from the executed script
+ * @throws IOException loading the script failed
+ * @throws ScriptException if an error occurrs during script execution.
+ */
+ Object eval( String scriptName, Namespace namespace ) throws IOException, ScriptException;
+
+ /**
+ * Causes the immediate execution of the script. State left in the engine
+ * from previous executions, including variable values
+ * and compiled procedures may be visible during this
+ * execution.
+ *
+ * @param scriptName the name of the script
+ * @param context The ScriptContext passed to the script engine.
+ * @return result from the executed script
+ * @throws IOException loading the script failed
+ * @throws ScriptException if an error occurrs during script execution.
+ */
+ Object eval( String scriptName, ScriptContext context ) throws IOException, ScriptException;
+
+ /**
+ * Calls a procedure compiled during a previous script execution,
+ * which is retained in the state of the ScriptEngine.
+ *
+ * @param name The name of the procedure to be called.
+ * @param args An array of arguments to pass to the procedure.
+ * @return The value returned by the procedure
+ * @throws ScriptException if an error occurrs during script execution
+ * @throws NoSuchMethodException If method with given name or matching argument types cannot be found.
+ */
+ Object call( String name, Object[] args ) throws ScriptException, NoSuchMethodException;
+
+ /**
+ * Return an object implementing the given interface. It
+ * uses the default scripting engine defined in the role
+ * configuration. This method only works if it is supported
+ * by underlying scripting engine, e.g. Javascript but not
+ * Groovy, by implementing the interface <bold>Invocable</bold>
+ *
+ * @param clazz the interface to implement
+ * @return an scripted object implementing the given interface.
+ */
+ Object getInterface( Class clazz );
+}
Added: jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptAvalonContextImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptAvalonContextImpl.java?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptAvalonContextImpl.java (added)
+++ jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptAvalonContextImpl.java Sat Jan 7 07:25:56 2006
@@ -0,0 +1,137 @@
+package org.apache.fulcrum.script.impl;
+
+/*
+ * Copyright 2005 Apache Software Foundation
+ * Licensed 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.
+ */
+
+import java.io.File;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.fulcrum.script.ScriptAvalonContext;
+
+/**
+ * Holder class for Avalon related stuff.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public class ScriptAvalonContextImpl implements ScriptAvalonContext
+{
+ /** context key for persistent directory*/
+ private final static String URN_AVALON_HOME = "context-root";
+
+ /** context key for temporary directory */
+ private final static String URN_AVALON_TEMP = "impl.workDir";
+
+ /** the Avalon service manager instance */
+ private ServiceManager serviceManager;
+
+ /** the Avalon context */
+ private Context context;
+
+ /** the Avalon logger to use */
+ private Logger logger;
+
+ /** the Avalon configuration to be used */
+ private Configuration configuration;
+
+ /** the Avalon parameters to be used */
+ private Parameters parameters;
+
+ /**
+ * Constructor
+ * @param logger the Avalon logger
+ * @param serviceManager the Avalon ServiceManager
+ * @param context the Avalon context
+ * @param configuration the Avalon configuration
+ * @param parameters the Avalon parameters
+ */
+ public ScriptAvalonContextImpl(
+ Logger logger,
+ ServiceManager serviceManager,
+ Context context,
+ Configuration configuration,
+ Parameters parameters )
+ {
+ this.logger = logger;
+ this.serviceManager = serviceManager;
+ this.context = context;
+ this.configuration = configuration;
+ this.parameters = parameters;
+ }
+
+ /**
+ * @return Returns the context.
+ */
+ public Context getContext()
+ {
+ return context;
+ }
+
+ /**
+ * @return Returns the logger.
+ */
+ public Logger getLogger()
+ {
+ return logger;
+ }
+
+ /**
+ * @return Returns the serviceManager.
+ */
+ public ServiceManager getServiceManager()
+ {
+ return serviceManager;
+ }
+
+ /**
+ * @return Returns the Avalon application directory
+ */
+ public File getApplicationDir()
+ throws ContextException
+ {
+ return (File) this.context.get(URN_AVALON_HOME);
+ }
+
+ /**
+ * @return Returns the Avalon application directory
+ */
+ public File getTempDir()
+ throws ContextException
+ {
+ return (File) this.context.get(URN_AVALON_TEMP);
+ }
+
+ /**
+ * @return Returns the configuration.
+ */
+ public Configuration getConfiguration()
+ {
+ return configuration;
+ }
+
+ /**
+ * @return Returns the parameters.
+ */
+ public Parameters getParameters()
+ {
+ return parameters;
+ }
+}
Added: jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptBaseService.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptBaseService.java?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptBaseService.java (added)
+++ jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptBaseService.java Sat Jan 7 07:25:56 2006
@@ -0,0 +1,185 @@
+package org.apache.fulcrum.script.impl;
+
+/*
+ * Copyright 2005 Apache Software Foundation
+ * Licensed 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.
+ */
+
+import java.io.File;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.configuration.Reconfigurable;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.parameters.ParameterException;
+import org.apache.avalon.framework.parameters.Parameterizable;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+
+/**
+ * Base class for a service implementation capturing the Avalon
+ * configuration artifats. This is basically a "copy-and-waste" from
+ * the YAAFI framework.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+
+public abstract class ScriptBaseService
+ extends AbstractLogEnabled
+ implements Contextualizable, Serviceable, Configurable, Parameterizable, Reconfigurable, Disposable
+{
+ /** context key for persistent directory */
+ private final static String URN_AVALON_HOME = "context-root";
+
+ /** context key for temporary directory */
+ private final static String URN_AVALON_TEMP = "impl.workDir";
+
+ /** The context supplied by the avalon framework */
+ private Context context;
+
+ /** The service manager supplied by the avalon framework */
+ private ServiceManager serviceManager;
+
+ /** The configuraton supplied by the avalon framework */
+ private Configuration configuration;
+
+ /** The parameters supplied by the avalon framework */
+ private Parameters parameters;
+
+ /** the Avalon application directory */
+ private File applicationDir;
+
+ /** the Avalon temp directory */
+ private File tempDir;
+
+ /**
+ * Constructor
+ */
+ public ScriptBaseService()
+ {
+ // nothing to do
+ }
+
+ /**
+ * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+ */
+ public void contextualize(Context context) throws ContextException
+ {
+ this.context = context;
+ this.applicationDir = (File) context.get(URN_AVALON_HOME);
+ this.tempDir = (File) context.get(URN_AVALON_TEMP);
+ }
+
+ /**
+ * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+ */
+ public void service(ServiceManager serviceManager) throws ServiceException
+ {
+ this.serviceManager = serviceManager;
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+ */
+ public void configure(Configuration configuration) throws ConfigurationException
+ {
+ this.configuration = configuration;
+ }
+
+ /**
+ * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)
+ */
+ public void parameterize(Parameters parameters) throws ParameterException
+ {
+ this.parameters = parameters;
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Reconfigurable#reconfigure(org.apache.avalon.framework.configuration.Configuration)
+ */
+ public void reconfigure(Configuration configuration)
+ throws ConfigurationException
+ {
+ this.configuration = configuration;
+ }
+
+ /**
+ * @see org.apache.avalon.framework.activity.Disposable#dispose()
+ */
+ public void dispose()
+ {
+ this.applicationDir = null;
+ this.tempDir = null;
+ this.context = null;
+ this.serviceManager = null;
+ this.parameters = null;
+ this.configuration = null;
+ }
+
+ /**
+ * @return Returns the configuration.
+ */
+ protected Configuration getConfiguration()
+ {
+ return this.configuration;
+ }
+
+ /**
+ * @return Returns the context.
+ */
+ protected Context getContext()
+ {
+ return this.context;
+ }
+
+ /**
+ * @return Returns the parameters.
+ */
+ protected Parameters getParameters()
+ {
+ return this.parameters;
+ }
+
+ /**
+ * @return Returns the serviceManager.
+ */
+ protected ServiceManager getServiceManager()
+ {
+ return this.serviceManager;
+ }
+
+ /**
+ * @return Returns the applicationDir.
+ */
+ public File getApplicationDir()
+ {
+ return applicationDir;
+ }
+
+ /**
+ * @return Returns the tempDir.
+ */
+ public File getTempDir()
+ {
+ return tempDir;
+ }
+}
Added: jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptCache.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptCache.java?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptCache.java (added)
+++ jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptCache.java Sat Jan 7 07:25:56 2006
@@ -0,0 +1,85 @@
+package org.apache.fulcrum.script.impl;
+
+/*
+ * Copyright 2005 Apache Software Foundation
+ * Licensed 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.
+ */
+
+import java.util.Hashtable;
+import java.util.Map;
+
+/**
+ * Type-safe wrapper for storing ScriptCacheEntry.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public class ScriptCache
+{
+ /** mapping from script name to cached scripts */
+ private Hashtable scriptCache;
+
+ /**
+ * Constructor
+ */
+ public ScriptCache()
+ {
+ this.scriptCache = new Hashtable();
+ }
+
+ /**
+ * Does the cache contains the script?.
+ * @param scriptName the name of the script
+ * @return true if the script is already in the cache
+ */
+ public boolean contains( String scriptName )
+ {
+ return this.getScriptCache().containsKey( scriptName );
+ }
+
+ /**
+ * Gets a cached script
+ * @param scriptName the name of the script
+ * @return the ScriptCacheEntry
+ */
+ public ScriptCacheEntry get( String scriptName )
+ {
+ return (ScriptCacheEntry) this.getScriptCache().get( scriptName );
+ }
+
+ /**
+ * Puts a new script into the cache.
+ * @param scriptCacheEntry the ScriptCacheEntry to add
+ */
+ public void put( ScriptCacheEntry scriptCacheEntry )
+ {
+ this.getScriptCache().put( scriptCacheEntry.getScriptName(), scriptCacheEntry );
+ }
+
+ /**
+ * Clears the cache.
+ */
+ public void clear()
+ {
+ this.getScriptCache().clear();
+ }
+
+ /**
+ * @return Returns the scriptCache.
+ */
+ private Map getScriptCache()
+ {
+ return scriptCache;
+ }
+}
Added: jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptCacheEntry.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptCacheEntry.java?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptCacheEntry.java (added)
+++ jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptCacheEntry.java Sat Jan 7 07:25:56 2006
@@ -0,0 +1,108 @@
+package org.apache.fulcrum.script.impl;
+
+/*
+ * Copyright 2005 Apache Software Foundation
+ * Licensed 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.
+ */
+
+import javax.script.CompiledScript;
+
+/**
+ * Keeping track of the metadata of a cached script.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public class ScriptCacheEntry
+{
+ /** the name of the scripting engine */
+ private String engineName;
+
+ /** the plain script */
+ private String plainScript;
+
+ /** the precompiled script */
+ private CompiledScript compiledScript;
+
+ /** the name of the script */
+ private String scriptName;
+
+ /**
+ * Constructor.
+ *
+ * @param engineName the name of the script engine
+ * @param scriptName the name of the script
+ * @param plainScript the plain text script
+ * @param compiledScript an optional compiled script
+ */
+ public ScriptCacheEntry( String engineName, String scriptName, String plainScript, CompiledScript compiledScript )
+ {
+ Validate.notEmpty(engineName, "engineName");
+ Validate.notEmpty(scriptName, "scriptName");
+ Validate.notEmpty(plainScript, "plainScript");
+
+ this.engineName = engineName;
+ this.scriptName = scriptName;
+ this.plainScript = plainScript;
+ this.compiledScript = compiledScript;
+ }
+
+ /**
+ * @return Returns the compiledScript.
+ */
+ public CompiledScript getCompiledScript()
+ {
+ return compiledScript;
+ }
+
+ /**
+ * @param compiledScript The compiledScript to set.
+ */
+ public void setCompiledScript(CompiledScript compiledScript)
+ {
+ this.compiledScript = compiledScript;
+ }
+
+ /**
+ * @return Returns the plainScript.
+ */
+ public String getPlainScript()
+ {
+ return plainScript;
+ }
+
+ /**
+ * @return Returns the scriptName.
+ */
+ public String getScriptName()
+ {
+ return scriptName;
+ }
+
+ /**
+ * @return Returns the engineName.
+ */
+ public String getEngineName()
+ {
+ return engineName;
+ }
+
+ /**
+ * Is the script already compiled
+ */
+ public boolean isCompiled()
+ {
+ return ( this.getCompiledScript() != null ? true : false );
+ }
+}
Added: jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptEngineEntry.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptEngineEntry.java?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptEngineEntry.java (added)
+++ jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptEngineEntry.java Sat Jan 7 07:25:56 2006
@@ -0,0 +1,132 @@
+package org.apache.fulcrum.script.impl;
+
+/*
+ * Copyright 2005 Apache Software Foundation
+ * Licensed 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.
+ */
+
+import java.util.List;
+
+import javax.script.ScriptEngine;
+
+/**
+ * An entry of the script engine.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public class ScriptEngineEntry
+{
+ /** the name of the script engine */
+ private String name;
+
+ /** is the script cached or loaded for each execution */
+ private boolean isCached;
+
+ /** is the script compiled to improve performance */
+ private boolean isCompiled;
+
+ /** the location of the scripts */
+ private String location;
+
+ /** the associated scripting engine */
+ private ScriptEngine scriptEngine;
+
+ /** a list of scripts to execute during initialization */
+ private List scriptList;
+
+ /**
+ * Constructor
+ *
+ * @param name the name of the script engine
+ * @param isCached is the script cached or loaded for each execution
+ * @param isCompiled is the script compiled to improve performance
+ * @param location the location of the scripts
+ * @param scriptEngine the associated scripting engine
+ */
+ public ScriptEngineEntry(
+ String name,
+ boolean isCached,
+ boolean isCompiled,
+ String location,
+ ScriptEngine scriptEngine)
+ {
+ Validate.notEmpty(name, "name");
+ Validate.notEmpty(location, "location");
+ Validate.notNull(scriptEngine, "scriptEngine");
+
+ this.name = name;
+ this.isCached = isCached;
+ this.isCompiled = isCompiled;
+ this.location = location;
+ this.scriptEngine = scriptEngine;
+ }
+
+ /**
+ * @return Returns the isCached.
+ */
+ public boolean isCached()
+ {
+ return isCached;
+ }
+
+ /**
+ * @return Returns the isCompiled.
+ */
+ public boolean isCompiled()
+ {
+ return isCompiled;
+ }
+
+ /**
+ * @return Returns the location.
+ */
+ public String getLocation()
+ {
+ return location;
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @return Returns the scriptEngine.
+ */
+ public ScriptEngine getScriptEngine()
+ {
+ return scriptEngine;
+ }
+
+ /**
+ * @return Returns the scriptList.
+ */
+ public List getScriptList()
+ {
+ return scriptList;
+ }
+
+ /**
+ * @param scriptList The scriptList to set.
+ */
+ public void setScriptList(List scriptList)
+ {
+ Validate.notNull(scriptList, "scriptList");
+ this.scriptList = scriptList;
+ }
+}
Added: jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptRunnableImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptRunnableImpl.java?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptRunnableImpl.java (added)
+++ jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptRunnableImpl.java Sat Jan 7 07:25:56 2006
@@ -0,0 +1,125 @@
+package org.apache.fulcrum.script.impl;
+
+/*
+ * Copyright 2005 Apache Software Foundation
+ * Licensed 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.
+ */
+
+import java.util.Map;
+
+import javax.script.SimpleNamespace;
+
+import org.apache.fulcrum.script.ScriptRunnable;
+import org.apache.fulcrum.script.ScriptService;
+
+/**
+ * A Runnable executing scripts
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public class ScriptRunnableImpl implements ScriptRunnable
+{
+ /** the name of the script to execute */
+ private String scriptName;
+
+ /** the service to execute the scripts */
+ private ScriptService scriptService;
+
+ /** the arguments for executing the script */
+ private SimpleNamespace args;
+
+ /** the result of the execution */
+ private Object result;
+
+ /** the execption thrown by the scipt if any */
+ private Exception exception;
+
+ /**
+ * Constructor
+ *
+ * @param scriptService the service to execute the script
+ * @param scriptName the name of the script to execute
+ * @param args the arguments passed to the script
+ */
+ public ScriptRunnableImpl(
+ ScriptService scriptService,
+ String scriptName,
+ Map args)
+ {
+ Validate.notEmpty( scriptName, "scriptName" );
+ Validate.notNull( scriptService, "scriptService" );
+
+ this.scriptName = scriptName;
+ this.scriptService = scriptService;
+ this.args = new SimpleNamespace(args);
+ }
+
+ /**
+ * @see java.lang.Runnable#run()
+ */
+ public void run()
+ {
+ try
+ {
+ this.result = null;
+ this.exception = null;
+
+ this.result = this.scriptService.eval(
+ this.getScriptName(),
+ this.args
+ );
+ }
+ catch (Exception e)
+ {
+ this.exception = e;
+ }
+ catch (Throwable t)
+ {
+ this.exception = new Exception(t.getMessage());
+ }
+ }
+
+ /**
+ * @return Returns the result.
+ */
+ public Object getResult() throws Exception
+ {
+ if( this.exception != null )
+ {
+ throw this.exception;
+ }
+ else
+ {
+ return result;
+ }
+ }
+
+ /**
+ * @param args The args to set.
+ */
+ public void setArgs(Map args)
+ {
+ Validate.notNull( args, "args" );
+ this.args = new SimpleNamespace(args);
+ }
+
+ /**
+ * @return Returns the scriptName.
+ */
+ private String getScriptName()
+ {
+ return scriptName;
+ }
+}
Added: jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptServiceImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptServiceImpl.java?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptServiceImpl.java (added)
+++ jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptServiceImpl.java Sat Jan 7 07:25:56 2006
@@ -0,0 +1,788 @@
+package org.apache.fulcrum.script.impl;
+
+/*
+ * Copyright 2005 Apache Software Foundation
+ * Licensed 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.
+ */
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.script.Compilable;
+import javax.script.CompiledScript;
+import javax.script.Invocable;
+import javax.script.Namespace;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.configuration.Reconfigurable;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.fulcrum.resourcemanager.ResourceManagerService;
+import org.apache.fulcrum.script.ScriptAvalonContext;
+import org.apache.fulcrum.script.ScriptService;
+
+/**
+ * A Fulcrum service to use the JSR-233.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public class ScriptServiceImpl
+ extends ScriptBaseService
+ implements ScriptService, Contextualizable, Initializable, Disposable, Serviceable, Reconfigurable, ThreadSafe
+{
+ /** the name of the default scripting engine*/
+ private String defaultEngineName;
+
+ /** the script manager */
+ private ScriptEngineManager scriptEngineManager;
+
+ /** the mapof scripting engines to use */
+ private HashMap scriptEngineMap;
+
+ /** maps from a script name to a script */
+ private ScriptCache scriptCache;
+
+ /** a list of excluded services */
+ private Set excludedServices;
+
+ /** common script configuration */
+ private Configuration scriptConfiguration;
+
+ /////////////////////////////////////////////////////////////////////////
+ // Avalon Service Lifecycle Implementation
+ /////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructor
+ */
+ public ScriptServiceImpl()
+ {
+ super();
+ this.scriptCache = new ScriptCache();
+ this.scriptEngineMap = new HashMap();
+ this.scriptEngineManager = new ScriptEngineManager();
+ this.excludedServices = new HashSet();
+ }
+
+ /**
+ * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+ */
+ public void service(ServiceManager serviceManager) throws ServiceException
+ {
+ super.service( serviceManager );
+ this.getServiceManager().lookup( ResourceManagerService.class.getName() );
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+ */
+ public void configure(Configuration configuration) throws ConfigurationException
+ {
+ super.configure( configuration );
+
+ // extract the common script configuration
+
+ this.scriptConfiguration = configuration.getChild("scriptConfiguration");
+
+ // create all scripting engines
+
+ Configuration[] scriptEngineConfigurationList = configuration.getChild("scriptEngines").getChildren("scriptEngine");
+
+ for (int i=0; i<scriptEngineConfigurationList.length; i++)
+ {
+ ScriptEngineEntry scriptEngineEntry = this.createScriptEngineEntry(scriptEngineConfigurationList[i]);
+ this.getScriptEngineMap().put(scriptEngineEntry.getName(), scriptEngineEntry);
+ this.getLogger().debug("Added ScriptEngine for " + scriptEngineEntry.getName());
+
+ if( this.defaultEngineName == null)
+ {
+ this.defaultEngineName = scriptEngineEntry.getName();
+ }
+ }
+
+ // verify that at least one scripting engine is available
+
+ if( this.getScriptEngineMap().size() == 0 )
+ {
+ String msg = "At least one scripting engine must be defined";
+ this.getLogger().error(msg);
+ throw new ConfigurationException(msg);
+ }
+
+ // evaluate the scripts defined in the onLoad section
+
+ this.preloadScripts();
+ }
+
+ /**
+ * @see org.apache.avalon.framework.activity.Initializable#initialize()
+ */
+ public void initialize() throws Exception
+ {
+ ScriptAvalonContext avalonContext = this.createScriptAvalonContext();
+ this.scriptEngineManager.put("avalonContext", avalonContext);
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Reconfigurable#reconfigure(org.apache.avalon.framework.configuration.Configuration)
+ */
+ public void reconfigure(Configuration cfg) throws ConfigurationException
+ {
+ super.reconfigure(cfg);
+ this.defaultEngineName = null;
+ this.scriptConfiguration = null;
+ this.getScriptEngineMap().clear();
+ this.getScriptCache().clear();
+ this.configure(cfg);
+ }
+
+ /**
+ * @see org.apache.avalon.framework.activity.Disposable#dispose()
+ */
+ public void dispose()
+ {
+ super.dispose();
+ this.scriptCache.clear();
+ this.scriptCache = null;
+ this.excludedServices = null;
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // Service interface implementation
+ /////////////////////////////////////////////////////////////////////////
+
+ /**
+ * @see org.apache.fulcrum.script.ScriptService#getScriptEngineManager()
+ */
+ public ScriptEngineManager getScriptEngineManager()
+ {
+ return this.scriptEngineManager;
+ }
+
+ /**
+ * @see org.apache.fulcrum.script.ScriptService#getScriptEngine()
+ */
+ public ScriptEngine getScriptEngine()
+ {
+ return this.getScriptEngine(this.getDefaultEngineName());
+ }
+
+ /**
+ * @see org.apache.fulcrum.script.ScriptService#eval(java.lang.String, javax.script.Namespace)
+ */
+ public Object eval(String scriptName, Namespace namespace)
+ throws IOException, ScriptException
+ {
+ Validate.notEmpty(scriptName, "scriptName");
+ Validate.notNull(namespace, "namespace");
+ String currScriptName = this.makeScriptName(scriptName);
+ ScriptCacheEntry scriptCacheEntry = this.createScriptCacheEntry(currScriptName);
+ Object result = this.doEval( scriptCacheEntry, namespace, null );
+ return result;
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.fulcrum.script.ScriptService#eval(java.lang.String, javax.script.ScriptContext)
+ */
+ public Object eval(String scriptName, ScriptContext context)
+ throws IOException, ScriptException
+ {
+ Validate.notEmpty(scriptName, "scriptName");
+ Validate.notNull(context, "context");
+ String currScriptName = this.makeScriptName(scriptName);
+ ScriptCacheEntry scriptCacheEntry = this.createScriptCacheEntry(currScriptName);
+ ScriptAvalonContext avalonContext = this.createScriptAvalonContext();
+ context.setAttribute("avalonContext", avalonContext, ScriptContext.ENGINE_SCOPE);
+ Object result = this.doEval( scriptCacheEntry, null, context );
+ return result;
+ }
+
+ /**
+ * @see org.apache.fulcrum.script.ScriptService#eval(java.lang.String)
+ */
+ public Object eval(String scriptName) throws IOException, ScriptException
+ {
+ Validate.notEmpty(scriptName, "scriptName");
+ String currScriptName = this.makeScriptName(scriptName);
+ ScriptCacheEntry scriptCacheEntry = this.createScriptCacheEntry(currScriptName);
+ Object result = this.doEval( scriptCacheEntry, null, null );
+ return result;
+ }
+
+ /**
+ * @see org.apache.fulcrum.script.ScriptService#call(java.lang.String, java.lang.Object[])
+ */
+ public Object call(String name, Object [] args) throws ScriptException,
+ NoSuchMethodException
+ {
+ Validate.notEmpty(name, "name");
+ return this.call(this.getDefaultEngineName(), name, args);
+
+ }
+
+ /**
+ * @see org.apache.fulcrum.script.ScriptService#getInterface(java.lang.Class)
+ */
+ public Object getInterface(Class clazz)
+ {
+ return this.getInterface(this.getDefaultEngineName(), clazz);
+ }
+
+ /**
+ * @see org.apache.fulcrum.script.ScriptService#exists(java.lang.String)
+ */
+ public boolean exists(String name)
+ {
+ Validate.notEmpty(name, "name");
+
+ String scriptName = this.makeScriptName(name);
+ String engineName = this.getEngineName(scriptName);
+ ScriptEngineEntry scriptEngineEntry = this.getScriptEngineEntry(engineName);
+ String location = scriptEngineEntry.getLocation();
+
+ if( this.getResourceManagerService().exists(location) &&
+ this.getResourceManagerService().exists(location, scriptName) )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // Service Implementation
+ /////////////////////////////////////////////////////////////////////////
+
+ private ScriptEngine getScriptEngine(String engineName)
+ {
+ ScriptEngineEntry scriptEngineEntry = this.getScriptEngineEntry(engineName);
+ return scriptEngineEntry.getScriptEngine();
+ }
+
+ /**
+ * @param engineName the engine name
+ * @param clazz the inteface to implement
+ * @return a scripting object implementing the given interface
+ */
+ private Object call(String engineName, String name, Object[] args)
+ throws ScriptException, NoSuchMethodException
+ {
+ Validate.notEmpty(engineName, "engineName");
+
+ Object result = this.doCall(engineName, name, args);
+ return result;
+ }
+
+ /**
+ * @param engineName the engine name
+ * @param clazz the inteface to implement
+ * @return a scripting object implementing the given interface
+ */
+ private Object getInterface(String engineName, Class clazz)
+ {
+ Validate.notEmpty(engineName, "engineName");
+ Validate.notNull(clazz, "clazz");
+
+ Object result = this.doGetInterface(engineName, clazz);
+ return result;
+ }
+
+ /**
+ * @return an instance of the ResourceService
+ */
+ private ResourceManagerService getResourceManagerService()
+ {
+ try
+ {
+ return (ResourceManagerService) this.getServiceManager().lookup(
+ ResourceManagerService.class.getName()
+ );
+ }
+ catch (ServiceException e)
+ {
+ throw new RuntimeException( e.getMessage() );
+ }
+ }
+
+ /**
+ * Load a script from the persistent storage.
+ *
+ * @param scriptName the name of the Groovy script
+ * @return the plain content of the script
+ */
+ private String loadScript( String engineName, String scriptName )
+ throws IOException
+ {
+ ScriptEngineEntry scriptEngineEntry = this.getScriptEngineEntry(engineName);
+ String location = scriptEngineEntry.getLocation();
+
+ String result = null;
+ byte[] scriptContent = null;
+ String[] sriptContext = {};
+
+ scriptContent = this.getResourceManagerService().read(
+ location,
+ sriptContext,
+ scriptName
+ );
+
+ result = new String( scriptContent );
+ return result;
+ }
+
+ /**
+ * Creates a compiled script.
+ *
+ * @param scriptName the name of the scipt to compile
+ * @param scriptContent the name scipt to compile
+ * @return the compiled script
+ * @throws ScriptException failed to compile the script
+ */
+ private CompiledScript compileScript( String engineName, String scriptName, String scriptContent )
+ throws ScriptException
+ {
+ CompiledScript result = null;
+
+ try
+ {
+ ScriptEngineEntry scriptEngineEntry = this.getScriptEngineEntry(engineName);
+ Compilable compilable = (Compilable) scriptEngineEntry.getScriptEngine();
+ long startTime = System.currentTimeMillis();
+ result = compilable.compile(scriptContent);
+ long endTime = System.currentTimeMillis();
+
+ if( this.getLogger().isDebugEnabled() )
+ {
+ this.getLogger().debug(
+ "Compiling of " + scriptName + " took "
+ + (endTime - startTime) + " ms"
+ );
+ }
+
+ return result;
+ }
+ catch (ScriptException e)
+ {
+ String msg = "Compiling the script failed : " + scriptName;
+ this.getLogger().error( msg, e );
+ throw new RuntimeException( msg ,e );
+ }
+ }
+
+ /**
+ * Evaluates a script.
+ *
+ * @param scriptCacheEntry the script to run
+ * @param namespace the parameters to pass to the script
+ * @return the result of the executed script
+ */
+ private Object doEval( ScriptCacheEntry scriptCacheEntry, Namespace namespace, ScriptContext scriptContext ) throws ScriptException
+ {
+ Object result = null;
+ String scriptName = scriptCacheEntry.getScriptName();
+ ScriptEngineEntry scriptEngineEntry = this.getScriptEngineEntry(scriptCacheEntry.getEngineName());
+ ScriptEngine scriptEngine = scriptEngineEntry.getScriptEngine();
+
+ try
+ {
+ long startTime = System.currentTimeMillis();
+
+ if( scriptCacheEntry.isCompiled() )
+ {
+ if( namespace != null )
+ {
+ result = scriptCacheEntry.getCompiledScript().eval(namespace);
+ }
+ else if( scriptContext != null )
+ {
+ result = scriptCacheEntry.getCompiledScript().eval(scriptContext);
+ }
+ else
+ {
+ result = scriptCacheEntry.getCompiledScript().eval();
+ }
+ }
+ else
+ {
+ if( namespace != null )
+ {
+ result = scriptEngine.eval(scriptCacheEntry.getPlainScript(), namespace);
+ }
+ else if( scriptContext != null )
+ {
+ result = scriptEngine.eval(scriptCacheEntry.getPlainScript(), scriptContext);
+ }
+ else
+ {
+ result = scriptEngine.eval(scriptCacheEntry.getPlainScript());
+ }
+ }
+
+ long endTime = System.currentTimeMillis();
+
+ if( this.getLogger().isDebugEnabled() )
+ {
+ this.getLogger().debug(
+ "Execution of " + scriptName + " took "
+ + (endTime - startTime) + " ms"
+ );
+ }
+
+ return result;
+ }
+ catch( ScriptException e )
+ {
+ String msg= "Execution of the script failed : " + scriptName;
+ this.getLogger().error( msg, e );
+ throw e;
+ }
+ }
+
+ /**
+ * Invokes a global script method
+ */
+ private Object doCall( String engineName, String name, Object[] args )
+ throws ScriptException, NoSuchMethodException
+ {
+ Object result = null;
+ ScriptEngineEntry scriptEngineEntry = this.getScriptEngineEntry(engineName);
+ ScriptEngine scriptEngine = scriptEngineEntry.getScriptEngine();
+ Invocable invocable = (Invocable) scriptEngine;
+
+ try
+ {
+ long startTime = System.currentTimeMillis();
+ result = invocable.call(name, args);
+ long endTime = System.currentTimeMillis();
+
+ if( this.getLogger().isDebugEnabled() )
+ {
+ this.getLogger().debug(
+ "Calling the method " + name + " took "
+ + (endTime - startTime) + " ms"
+ );
+ }
+
+ return result;
+ }
+ catch( ScriptException e )
+ {
+ String msg= "Caling the following method failed : " + name;
+ this.getLogger().error( msg, e );
+ throw e;
+ }
+ catch( NoSuchMethodException e )
+ {
+ String msg= "Caling the following method failed : " + name;
+ this.getLogger().error( msg, e );
+ throw e;
+ }
+ }
+
+ /**
+ * Creates a script object implementing the requested interface.
+ *
+ * @param engineName the name of the scripting engine
+ * @param clazz the requested interface
+ * @return the result of the executed script
+ */
+ private Object doGetInterface( String engineName, Class clazz )
+ {
+ Object result = null;
+ ScriptEngineEntry scriptEngineEntry = this.getScriptEngineEntry(engineName);
+ ScriptEngine scriptEngine = scriptEngineEntry.getScriptEngine();
+ Invocable invocable = (Invocable) scriptEngine;
+
+ try
+ {
+ long startTime = System.currentTimeMillis();
+ result = invocable.getInterface(clazz);
+ long endTime = System.currentTimeMillis();
+
+ if( this.getLogger().isDebugEnabled() )
+ {
+ this.getLogger().debug(
+ "Creating the interface for " + clazz.getName() + " took "
+ + (endTime - startTime) + " ms"
+ );
+ }
+
+ return result;
+ }
+ catch( RuntimeException e )
+ {
+ String msg= "Creation of the interface failed : " + clazz.getName();
+ this.getLogger().error( msg, e );
+ throw e;
+ }
+ }
+
+ /**
+ * Create the Avalon specific context
+ */
+ private ScriptAvalonContext createScriptAvalonContext()
+ {
+ ScriptAvalonContextImpl result = null;
+
+ ScriptServiceManagerImpl scriptServiceManager = new ScriptServiceManagerImpl(
+ this.getServiceManager(),
+ this.excludedServices
+ );
+
+ result = new ScriptAvalonContextImpl(
+ this.getLogger().getChildLogger("script"),
+ scriptServiceManager,
+ this.getContext(),
+ this.scriptConfiguration,
+ this.getParameters()
+ );
+
+ return result;
+ }
+
+ /**
+ * @return the name of the default engine
+ */
+ private String getDefaultEngineName()
+ {
+ return this.defaultEngineName;
+ }
+
+ /**
+ * @return Returns the scriptCache.
+ */
+ private ScriptCache getScriptCache()
+ {
+ return scriptCache;
+ }
+
+ /**
+ * Creates a script to be evaluates.
+ *
+ * @param scriptName the name of the script to execute
+ * @return ScriptCacheEntry
+ */
+ private synchronized ScriptCacheEntry createScriptCacheEntry(String scriptName)
+ throws IOException, ScriptException
+ {
+ String engineName = this.getEngineName(scriptName);
+ ScriptCacheEntry scriptCacheEntry = null;
+ ScriptEngineEntry scriptEngineEntry = this.getScriptEngineEntry(engineName);
+ String plainScript = null;
+ CompiledScript compiledScript = null;
+ boolean isInCache = false;
+
+ // try to load the script from the cache or from the resource manager
+
+ if( scriptEngineEntry.isCached() == true )
+ {
+ scriptCacheEntry = this.getScriptCache().get(scriptName);
+
+ if( scriptCacheEntry == null )
+ {
+ plainScript = this.loadScript(engineName, scriptName);
+ }
+ else
+ {
+ plainScript = scriptCacheEntry.getPlainScript();
+ isInCache = true;
+ }
+ }
+ else
+ {
+ plainScript = this.loadScript(engineName, scriptName);
+ }
+
+ if( isInCache == false )
+ {
+ // compile the script if required
+
+ if( scriptEngineEntry.isCompiled())
+ {
+ compiledScript = this.compileScript(engineName, scriptName, plainScript);
+ }
+
+ scriptCacheEntry = new ScriptCacheEntry(
+ engineName,
+ scriptName,
+ plainScript,
+ compiledScript
+ );
+
+ // update the cache
+
+ if( scriptEngineEntry.isCached() )
+ {
+ this.getScriptCache().put(scriptCacheEntry);
+ }
+ }
+
+ return scriptCacheEntry;
+ }
+
+ /**
+ * Create a ScriptEngineEntry by parsing the configuration.
+ *
+ * @param configuration the configuration
+ * @return ScriptEngineEntry
+ * @throws ConfigurationException parsing the configuration failed
+ */
+ private ScriptEngineEntry createScriptEngineEntry(Configuration configuration)
+ throws ConfigurationException
+ {
+ String name = configuration.getChild("name").getValue();
+ boolean isCached = configuration.getChild("isCached").getValueAsBoolean(true);
+ boolean isCompiled = configuration.getChild("isCompiled").getValueAsBoolean(true);
+ String location = configuration.getChild("location").getValue(name);
+ ScriptEngine scriptEngine = this.getScriptEngineManager().getEngineByName(name);
+
+ if( (scriptEngine instanceof Compilable) == false )
+ {
+ isCompiled = false;
+ }
+
+ ScriptEngineEntry result = new ScriptEngineEntry(name, isCached, isCompiled, location, scriptEngine);
+
+ // evaluate the given scripts
+
+ ArrayList scriptList = new ArrayList();
+ Configuration[] scriptListConfiguration = configuration.getChild("preLoad").getChildren("script");
+ for( int i=0; i<scriptListConfiguration.length; i++ )
+ {
+ scriptList.add(scriptListConfiguration[i].getValue());
+ }
+
+ result.setScriptList(scriptList);
+
+ return result;
+ }
+
+ /**
+ * @param engineName the name of the scriptng engine
+ * @return the ScriptEngineEntry
+ */
+ private ScriptEngineEntry getScriptEngineEntry( String engineName)
+ {
+ ScriptEngineEntry result = (ScriptEngineEntry) this.getScriptEngineMap().get(engineName);
+
+ if( result == null )
+ {
+ String msg = "Unable to handle scripts for the following script engine : " + engineName;
+ this.getLogger().error(msg);
+ throw new IllegalArgumentException(msg);
+ }
+
+ return result;
+ }
+
+ /**
+ * Determines the name of the scripting engine by looking at the extension
+ *
+ * @param scriptName the script name
+ * @return name of the scripting engine
+ */
+ private String getEngineName( String scriptName )
+ {
+ int pos = scriptName.lastIndexOf('.');
+
+ if( pos > 0 )
+ {
+ return scriptName.substring(pos+1, scriptName.length());
+ }
+ else
+ {
+ return this.getDefaultEngineName();
+ }
+ }
+
+ /**
+ * @return Returns the scriptEngineMap.
+ */
+ private HashMap getScriptEngineMap()
+ {
+ return scriptEngineMap;
+ }
+
+ /**
+ * Ensure that the name has a proper extension.
+ *
+ * @param name the name of the script
+ * @return script name
+ */
+ private String makeScriptName( String name )
+ {
+ String engineName = this.getEngineName(name);
+ String extension = '.' + engineName;
+
+ if( name.endsWith(extension) )
+ {
+ return name;
+ }
+ else
+ {
+ return name + extension;
+ }
+ }
+
+ /**
+ * Preload the scripts defined in the onLoad section
+ */
+ private void preloadScripts()
+ {
+ Iterator iter = this.getScriptEngineMap().keySet().iterator();
+
+ while( iter.hasNext() )
+ {
+ String engineName = (String) iter.next();
+ ScriptEngineEntry scriptEngineEntry = this.getScriptEngineEntry(engineName);
+ ScriptEngine scriptEngine = scriptEngineEntry.getScriptEngine();
+ Object[] scriptList = scriptEngineEntry.getScriptList().toArray();
+
+ for( int i=0; i<scriptList.length; i++ )
+ {
+ String scriptName = scriptList[i].toString();
+
+ try
+ {
+ String plainScript = this.loadScript(engineName, scriptName);
+ scriptEngine.eval(plainScript);
+ }
+ catch (Exception e)
+ {
+ String msg = "Unable to load the following script : " + scriptName;
+ this.getLogger().error(msg, e);
+ throw new RuntimeException(msg);
+ }
+ }
+ }
+ }
+}
Added: jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptServiceManagerImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptServiceManagerImpl.java?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptServiceManagerImpl.java (added)
+++ jakarta/turbine/fulcrum/trunk/script/src/java/org/apache/fulcrum/script/impl/ScriptServiceManagerImpl.java Sat Jan 7 07:25:56 2006
@@ -0,0 +1,90 @@
+package org.apache.fulcrum.script.impl;
+
+/*
+ * Copyright 2005 Apache Software Foundation
+ * Licensed 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.
+ */
+
+import java.util.Set;
+
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+
+
+/**
+ * A decorator for the ServiceManager interface to restrict access
+ * to Avalon services.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public class ScriptServiceManagerImpl implements ServiceManager
+{
+ /** the Avalon service manager to lookup service */
+ private ServiceManager serviceManager;
+
+ /** the excluded services */
+ private Set excludedServices;
+
+ /**
+ * Constructor.
+ *
+ * @param serviceManager the Avalon service manager to lookup service
+ * @param excludedServices the excluded services
+ */
+ public ScriptServiceManagerImpl(ServiceManager serviceManager, Set excludedServices)
+ {
+ this.serviceManager = serviceManager;
+ this.excludedServices = excludedServices;
+ }
+
+ /**
+ * @see org.apache.avalon.framework.service.ServiceManager#hasService(java.lang.String)
+ */
+ public boolean hasService(String arg)
+ {
+ if( this.excludedServices.contains(arg) )
+ {
+ return false;
+ }
+ else
+ {
+ return this.serviceManager.hasService(arg);
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.service.ServiceManager#lookup(java.lang.String)
+ */
+ public Object lookup(String arg) throws ServiceException
+ {
+ if( this.excludedServices.contains(arg) )
+ {
+ // just add a space at the end to enforce a ServiceException
+ return this.serviceManager.lookup(arg + ' ');
+ }
+ else
+ {
+ return this.serviceManager.lookup(arg);
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.service.ServiceManager#release(java.lang.Object)
+ */
+ public void release(Object obj)
+ {
+ this.serviceManager.release(obj);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org