You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bridges-commits@portals.apache.org by wo...@apache.org on 2010/04/22 18:44:42 UTC
svn commit: r936949 [1/2] - in /portals/bridges/bridges-script/trunk: ./
dependencies/ dependencies/beanshell/ dependencies/groovy/
dependencies/jruby/ dependencies/jython/ dependencies/rhino/ portlet/
portlet/src/ portlet/src/main/ portlet/src/main/ja...
Author: woonsan
Date: Thu Apr 22 16:44:40 2010
New Revision: 936949
URL: http://svn.apache.org/viewvc?rev=936949&view=rev
Log:
PB-104: Adding script dependencies subprojects.
Added:
portals/bridges/bridges-script/trunk/portlet/ (with props)
portals/bridges/bridges-script/trunk/portlet/pom.xml (with props)
portals/bridges/bridges-script/trunk/portlet/src/
portals/bridges/bridges-script/trunk/portlet/src/main/
portals/bridges/bridges-script/trunk/portlet/src/main/java/
portals/bridges/bridges-script/trunk/portlet/src/main/java/org/
portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/
portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/
portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/
portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/
portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptEngineUtils.java (with props)
portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortlet.java (with props)
portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortletPreferencesValidator.java (with props)
portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptSource.java (with props)
portals/bridges/bridges-script/trunk/portlet/src/main/resources/
portals/bridges/bridges-script/trunk/portlet/src/test/
portals/bridges/bridges-script/trunk/portlet/src/test/java/
portals/bridges/bridges-script/trunk/portlet/src/test/java/org/
portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/
portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/
portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/
portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/
portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/AbstractSimpleScriptPortletTestCase.java (with props)
portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloBeanShellScriptPortlet.java (with props)
portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloGroovyScriptPortlet.java (with props)
portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJRubyScriptPortlet.java (with props)
portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJythonScriptPortlet.java (with props)
portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloRhinoScriptPortlet.java (with props)
portals/bridges/bridges-script/trunk/portlet/src/test/resources/
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloBeanShell.bsh
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloBeanShellPrefsValidator.bsh
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloGroovy.groovy
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloGroovyPrefsValidator.groovy
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRuby.rb (with props)
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb (with props)
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJython.py (with props)
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py (with props)
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhino.js (with props)
portals/bridges/bridges-script/trunk/portlet/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js (with props)
Removed:
portals/bridges/bridges-script/trunk/src/main/java/org/apache/portals/bridges/script/
portals/bridges/bridges-script/trunk/src/test/java/org/apache/portals/bridges/script/
portals/bridges/bridges-script/trunk/src/test/resources/org/
Modified:
portals/bridges/bridges-script/trunk/dependencies/ (props changed)
portals/bridges/bridges-script/trunk/dependencies/beanshell/ (props changed)
portals/bridges/bridges-script/trunk/dependencies/beanshell/pom.xml
portals/bridges/bridges-script/trunk/dependencies/groovy/ (props changed)
portals/bridges/bridges-script/trunk/dependencies/groovy/pom.xml
portals/bridges/bridges-script/trunk/dependencies/jruby/ (props changed)
portals/bridges/bridges-script/trunk/dependencies/jruby/pom.xml
portals/bridges/bridges-script/trunk/dependencies/jython/ (props changed)
portals/bridges/bridges-script/trunk/dependencies/jython/pom.xml
portals/bridges/bridges-script/trunk/dependencies/pom.xml
portals/bridges/bridges-script/trunk/dependencies/rhino/ (props changed)
portals/bridges/bridges-script/trunk/dependencies/rhino/pom.xml
portals/bridges/bridges-script/trunk/pom.xml
Propchange: portals/bridges/bridges-script/trunk/dependencies/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Apr 22 16:44:40 2010
@@ -0,0 +1 @@
+target
Propchange: portals/bridges/bridges-script/trunk/dependencies/beanshell/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Apr 22 16:44:40 2010
@@ -0,0 +1 @@
+target
Modified: portals/bridges/bridges-script/trunk/dependencies/beanshell/pom.xml
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/dependencies/beanshell/pom.xml?rev=936949&r1=936948&r2=936949&view=diff
==============================================================================
--- portals/bridges/bridges-script/trunk/dependencies/beanshell/pom.xml (original)
+++ portals/bridges/bridges-script/trunk/dependencies/beanshell/pom.xml Thu Apr 22 16:44:40 2010
@@ -25,11 +25,11 @@
<maven>2.0.9</maven>
</prerequisites>
- <groupId>org.apache.portals.bridges.portals-bridges-script.dependencies</groupId>
+ <groupId>org.apache.portals.bridges.script.dependencies</groupId>
<artifactId>beanshell</artifactId>
<name>Apache Portals Bridges Script Bridge Dependencies for BeanShell</name>
<parent>
- <groupId>org.apache.portals.bridges.portals-bridges-script</groupId>
+ <groupId>org.apache.portals.bridges.script</groupId>
<artifactId>dependencies</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>
Propchange: portals/bridges/bridges-script/trunk/dependencies/groovy/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Apr 22 16:44:40 2010
@@ -0,0 +1 @@
+target
Modified: portals/bridges/bridges-script/trunk/dependencies/groovy/pom.xml
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/dependencies/groovy/pom.xml?rev=936949&r1=936948&r2=936949&view=diff
==============================================================================
--- portals/bridges/bridges-script/trunk/dependencies/groovy/pom.xml (original)
+++ portals/bridges/bridges-script/trunk/dependencies/groovy/pom.xml Thu Apr 22 16:44:40 2010
@@ -25,11 +25,11 @@
<maven>2.0.9</maven>
</prerequisites>
- <groupId>org.apache.portals.bridges.portals-bridges-script.dependencies</groupId>
+ <groupId>org.apache.portals.bridges.script.dependencies</groupId>
<artifactId>groovy</artifactId>
<name>Apache Portals Bridges Script Bridge Dependencies for Groovy</name>
<parent>
- <groupId>org.apache.portals.bridges.portals-bridges-script</groupId>
+ <groupId>org.apache.portals.bridges.script</groupId>
<artifactId>dependencies</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>
Propchange: portals/bridges/bridges-script/trunk/dependencies/jruby/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Apr 22 16:44:40 2010
@@ -0,0 +1 @@
+target
Modified: portals/bridges/bridges-script/trunk/dependencies/jruby/pom.xml
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/dependencies/jruby/pom.xml?rev=936949&r1=936948&r2=936949&view=diff
==============================================================================
--- portals/bridges/bridges-script/trunk/dependencies/jruby/pom.xml (original)
+++ portals/bridges/bridges-script/trunk/dependencies/jruby/pom.xml Thu Apr 22 16:44:40 2010
@@ -25,11 +25,11 @@
<maven>2.0.9</maven>
</prerequisites>
- <groupId>org.apache.portals.bridges.portals-bridges-script.dependencies</groupId>
+ <groupId>org.apache.portals.bridges.script.dependencies</groupId>
<artifactId>jruby</artifactId>
<name>Apache Portals Bridges Script Bridge Dependencies for JRuby</name>
<parent>
- <groupId>org.apache.portals.bridges.portals-bridges-script</groupId>
+ <groupId>org.apache.portals.bridges.script</groupId>
<artifactId>dependencies</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>
Propchange: portals/bridges/bridges-script/trunk/dependencies/jython/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Apr 22 16:44:40 2010
@@ -0,0 +1 @@
+target
Modified: portals/bridges/bridges-script/trunk/dependencies/jython/pom.xml
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/dependencies/jython/pom.xml?rev=936949&r1=936948&r2=936949&view=diff
==============================================================================
--- portals/bridges/bridges-script/trunk/dependencies/jython/pom.xml (original)
+++ portals/bridges/bridges-script/trunk/dependencies/jython/pom.xml Thu Apr 22 16:44:40 2010
@@ -25,11 +25,11 @@
<maven>2.0.9</maven>
</prerequisites>
- <groupId>org.apache.portals.bridges.portals-bridges-script.dependencies</groupId>
+ <groupId>org.apache.portals.bridges.script.dependencies</groupId>
<artifactId>jython</artifactId>
<name>Apache Portals Bridges Script Bridge Dependencies for Jython</name>
<parent>
- <groupId>org.apache.portals.bridges.portals-bridges-script</groupId>
+ <groupId>org.apache.portals.bridges.script</groupId>
<artifactId>dependencies</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>
Modified: portals/bridges/bridges-script/trunk/dependencies/pom.xml
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/dependencies/pom.xml?rev=936949&r1=936948&r2=936949&view=diff
==============================================================================
--- portals/bridges/bridges-script/trunk/dependencies/pom.xml (original)
+++ portals/bridges/bridges-script/trunk/dependencies/pom.xml Thu Apr 22 16:44:40 2010
@@ -24,12 +24,12 @@
<maven>2.0.9</maven>
</prerequisites>
- <groupId>org.apache.portals.bridges.portals-bridges-script</groupId>
+ <groupId>org.apache.portals.bridges.script</groupId>
<artifactId>dependencies</artifactId>
<name>Apache Portals Bridges Script Bridge Dependencies</name>
<parent>
<groupId>org.apache.portals.bridges</groupId>
- <artifactId>portals-bridges-script</artifactId>
+ <artifactId>script</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
Propchange: portals/bridges/bridges-script/trunk/dependencies/rhino/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Apr 22 16:44:40 2010
@@ -0,0 +1 @@
+target
Modified: portals/bridges/bridges-script/trunk/dependencies/rhino/pom.xml
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/dependencies/rhino/pom.xml?rev=936949&r1=936948&r2=936949&view=diff
==============================================================================
--- portals/bridges/bridges-script/trunk/dependencies/rhino/pom.xml (original)
+++ portals/bridges/bridges-script/trunk/dependencies/rhino/pom.xml Thu Apr 22 16:44:40 2010
@@ -25,11 +25,11 @@
<maven>2.0.9</maven>
</prerequisites>
- <groupId>org.apache.portals.bridges.portals-bridges-script.dependencies</groupId>
+ <groupId>org.apache.portals.bridges.script.dependencies</groupId>
<artifactId>rhino</artifactId>
<name>Apache Portals Bridges Script Bridge Dependencies for Rhino JavaScript</name>
<parent>
- <groupId>org.apache.portals.bridges.portals-bridges-script</groupId>
+ <groupId>org.apache.portals.bridges.script</groupId>
<artifactId>dependencies</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>
Modified: portals/bridges/bridges-script/trunk/pom.xml
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/pom.xml?rev=936949&r1=936948&r2=936949&view=diff
==============================================================================
--- portals/bridges/bridges-script/trunk/pom.xml (original)
+++ portals/bridges/bridges-script/trunk/pom.xml Thu Apr 22 16:44:40 2010
@@ -28,8 +28,8 @@
</parent>
<groupId>org.apache.portals.bridges</groupId>
- <artifactId>portals-bridges-script</artifactId>
- <packaging>jar</packaging>
+ <artifactId>script</artifactId>
+ <packaging>pom</packaging>
<name>Apache Portals Bridges Script Bridge</name>
<version>2.0-SNAPSHOT</version>
<description>Apache Portals Bridges Script Bridge</description>
@@ -231,145 +231,10 @@
</dependencyManagement>
- <dependencies>
-
- <dependency>
- <groupId>org.apache.portals</groupId>
- <artifactId>portlet-api_2.0_spec</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.portals.bridges</groupId>
- <artifactId>portals-bridges-common</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.script</groupId>
- <artifactId>script-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <!-- ServiceMix Repo Script Engines -->
-
- <dependency>
- <groupId>com.sun.script</groupId>
- <artifactId>groovy-engine</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.sun.script</groupId>
- <artifactId>js-engine</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.sun.script</groupId>
- <artifactId>jython-engine</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.sun.script</groupId>
- <artifactId>jruby-engine</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.sun.script</groupId>
- <artifactId>bsh-engine</artifactId>
- <scope>test</scope>
- </dependency>
-
- <!-- Script Libraries -->
-
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>rhino</groupId>
- <artifactId>js</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.python</groupId>
- <artifactId>jython</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jruby</groupId>
- <artifactId>jruby</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.beanshell</groupId>
- <artifactId>bsh</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
+ <modules>
+ <module>portlet</module>
+ <module>dependencies</module>
+ </modules>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/portals/bridges/bridges-script/trunk</connection>
Propchange: portals/bridges/bridges-script/trunk/portlet/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Apr 22 16:44:40 2010
@@ -0,0 +1 @@
+target
Added: portals/bridges/bridges-script/trunk/portlet/pom.xml
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/pom.xml?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/pom.xml (added)
+++ portals/bridges/bridges-script/trunk/portlet/pom.xml Thu Apr 22 16:44:40 2010
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ 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.
+
+ @version $Id$
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.portals.bridges</groupId>
+ <artifactId>script</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.portals.bridges.script</groupId>
+ <artifactId>portlet</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Portals Bridges Script Bridge Portlet</name>
+ <description>Apache Portals Bridges Script Bridge Portlet</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.portals</groupId>
+ <artifactId>portlet-api_2.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.portals.bridges</groupId>
+ <artifactId>portals-bridges-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.script</groupId>
+ <artifactId>script-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- ServiceMix Repo Script Engines -->
+
+ <dependency>
+ <groupId>com.sun.script</groupId>
+ <artifactId>groovy-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.script</groupId>
+ <artifactId>js-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.script</groupId>
+ <artifactId>jython-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.script</groupId>
+ <artifactId>jruby-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.script</groupId>
+ <artifactId>bsh-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Script Libraries -->
+
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.python</groupId>
+ <artifactId>jython</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jruby</groupId>
+ <artifactId>jruby</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.beanshell</groupId>
+ <artifactId>bsh</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
Propchange: portals/bridges/bridges-script/trunk/portlet/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/portlet/pom.xml
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptEngineUtils.java
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptEngineUtils.java?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptEngineUtils.java (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptEngineUtils.java Thu Apr 22 16:44:40 2010
@@ -0,0 +1,189 @@
+/*
+ * 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.portals.bridges.script;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+
+/**
+ * ScriptEngineUtils
+ *
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class ScriptEngineUtils
+{
+ private ScriptEngineUtils()
+ {
+
+ }
+
+ /**
+ * Creates script engine based on scriptEngineName and scriptSource.
+ * <P>
+ * When scriptEngineName is not null, it creates a script engine by the scriptEngineName.
+ * When scriptEngineName is not null, it creates a script engine by the mimeType of the scriptSource if available.
+ * Otherwise, it creates a script engine by the script extension.
+ * </P>
+ *
+ * @param scriptEngineName
+ * @param scriptSource
+ * @return
+ * @throws ScriptException
+ */
+ public static ScriptEngine createScriptEngine(final String scriptEngineName, final ScriptSource scriptSource) throws ScriptException
+ {
+ ScriptEngine scriptEngine = null;
+ ScriptEngineManager manager = new ScriptEngineManager();
+
+ if (scriptEngineName != null)
+ {
+ scriptEngine = manager.getEngineByName(scriptEngineName);
+ }
+ else
+ {
+ if (scriptSource.getMimeType() != null)
+ {
+ scriptEngine = manager.getEngineByMimeType(scriptSource.getMimeType());
+ }
+
+ if (scriptEngine == null)
+ {
+ if (scriptSource.getExtension() != null)
+ {
+ scriptEngine = manager.getEngineByExtension(scriptSource.getExtension());
+ }
+ }
+ }
+
+ if (scriptEngine == null)
+ {
+ throw new ScriptException("Cannot create script engine. { scriptEngineName: " + scriptEngineName + ", scriptSource: " + scriptSource);
+ }
+
+ return scriptEngine;
+ }
+
+ /**
+ * Evaluates the scriptSource through the scriptEngine and returns the evaluated object.
+ * <P>
+ * If the evalKey is null, it returns the last evaluated object.
+ * Otherwise, it retrieves the object by the evalKey from the scriptEngine.
+ * </P>
+ *
+ * @param scriptEngine
+ * @param scriptSource
+ * @param evalKey
+ * @param fallback
+ * @return
+ * @throws ScriptException
+ * @throws IOException
+ */
+ public static Object evaluateScript(final ScriptEngine scriptEngine, final ScriptSource scriptSource, final String evalKey, final boolean fallback) throws ScriptException, IOException
+ {
+ Object evaledObject = null;
+
+ InputStream input = null;
+ InputStreamReader isr = null;
+ BufferedReader br = null;
+
+ try
+ {
+ input = scriptSource.getInputStream();
+
+ if (scriptSource.getCharacterEncoding() != null)
+ {
+ isr = new InputStreamReader(input, scriptSource.getCharacterEncoding());
+ }
+ else
+ {
+ isr = new InputStreamReader(input);
+ }
+
+ br = new BufferedReader(isr);
+
+ Object ret = scriptEngine.eval(br);
+
+ if (evalKey != null)
+ {
+ evaledObject = scriptEngine.get(evalKey);
+
+ if (evaledObject == null && fallback)
+ {
+ evaledObject = ret;
+ }
+ }
+
+ if (evaledObject == null)
+ {
+ evaledObject = ret;
+ }
+
+ if (evaledObject == null)
+ {
+ throw new ScriptException("The evaluated object is null. (" + evalKey + ")");
+ }
+ }
+ finally
+ {
+ if (br != null)
+ {
+ try
+ {
+ br.close();
+ }
+ catch (Exception ignore) { }
+ }
+ if (isr != null)
+ {
+ try
+ {
+ isr.close();
+ }
+ catch (Exception ignore) { }
+ }
+ if (input != null)
+ {
+ try
+ {
+ input.close();
+ }
+ catch (Exception ignore) { }
+ }
+ }
+
+ return evaledObject;
+ }
+
+ /**
+ * Checks if the script source has been modified after the specified time.
+ *
+ * @param scriptSource
+ * @param after
+ * @return
+ */
+ public static boolean isScriptModified(final ScriptSource scriptSource, final long after)
+ {
+ return (scriptSource.lastModified() > after);
+ }
+}
Propchange: portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptEngineUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptEngineUtils.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortlet.java
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortlet.java?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortlet.java (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortlet.java Thu Apr 22 16:44:40 2010
@@ -0,0 +1,552 @@
+/*
+ * 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.portals.bridges.script;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventPortlet;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PreferencesValidator;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceServingPortlet;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+
+/**
+ * ScriptPortlet evaluates a script source to create a delegatee portlet instance
+ * and delegate invocations to the delegatee scripted portlet instance.
+ * <P>
+ * The final evaluated object from the scripted portlet source must be a portlet instance or portlet class
+ * based on the Java Portlet Specifications.
+ * </P>
+ * <P>
+ * Here's an example portlet definition with descriptions on init parameters.
+ * </P>
+ * <PRE><CODE><XMP>
+ * <portlet>
+ * <portlet-name>HelloGroovy</portlet-name>
+ * <display-name>Hello Groovy</display-name>
+ * <portlet-class>org.apache.portals.bridges.script.ScriptPortlet</portlet-class>
+ *
+ * <!-- Optional init parameter for script engine
+ * If this init parameter is not set, the ScriptPortlet will look up a script engine automatically
+ * by the mimeType or the extension of the script source file. -->
+ * <init-param>
+ * <name>engine</name>
+ * <!--
+ * Note: You can set other script engine which support JSR-223 ScriptEngine
+ * such as 'groovy', 'jruby', 'jython'.
+ * -->
+ * <value>groovy</value>
+ * </init-param>
+ *
+ * <!-- Optional init parameter for the key for portlet/preferencesValidator class or portlet/preferencesValidator instance which is evaluated and returned by the script.
+ * By default, when this init parameter is not set, ScriptPortlet retrieves the last evaluated object from the script.
+ * If you set this to 'value', then ScriptPortlet retrieves an object named 'value' from the bindings of the script engine.
+ * Depending on script engines, this init parameter should be properly configured because some script engines do not return the last evaluated object. -->
+ * <init-param>
+ * <name>eval-key</name>
+ * <value>value</value>
+ * </init-param>
+ *
+ * <!-- Required init parameter for script source path -->
+ * <init-param>
+ * <name>source</name>
+ * <!--
+ * Note: You can set script source in three ways.
+ * The first is to use context relative path,
+ * the second is to use file: url,
+ * and the third is to classpath: uri.
+ * Here are the examples for each way.
+ * -->
+ * <!--
+ * <value>/WEB-INF/groovy/HelloGroovy.groovy</value>
+ * <value>file:/C:/Program Files/Apache Software Foundation/Tomcat/webapps/demo/WEB-INF/groovy/HelloGroovy.groovy</value>
+ * <value>classpath:org/apache/portals/bridges/script/HelloGroovy.groovy</value>
+ * -->
+ * <value>classpath:org/apache/portals/bridges/script/HelloGroovy.groovy</value>
+ * </init-param>
+ *
+ * <!-- Optional init parameter for script file content encoding. The default value is 'UTF-8'. -->
+ * <init-param>
+ * <name>encoding</name>
+ * <value>UTF-8</value>
+ * </init-param>
+ *
+ * <!-- Optional init parameter for auto-refresh option.
+ * If auto-refresh is true, then a modification of script source applies instantly.
+ * By default, this option is not set to true. -->
+ * <init-param>
+ * <name>auto-refresh</name>
+ * <value>true</value>
+ * </init-param>
+ *
+ * <!-- Optional init parameter for script preferences validator path -->
+ * <init-param>
+ * <name>validator</name>
+ * <!--
+ * Note: You can set script preferences validator source in three ways.
+ * The first is to use context relative path,
+ * the second is to use file: url,
+ * and the third is to classpath: uri.
+ * Here are the examples for each way.
+ * -->
+ * <!--
+ * <value>/WEB-INF/groovy/HelloGroovyPrefsValidator.groovy</value>
+ * <value>file:/C:/Program Files/Apache Software Foundation/Tomcat/webapps/demo/WEB-INF/groovy/HelloGroovyPrefsValidator.groovy</value>
+ * <value>classpath:org/apache/portals/bridges/script/HelloGroovyPrefsValidator.groovy</value>
+ * -->
+ * <value>classpath:org/apache/portals/bridges/script/HelloGroovyPrefsValidator.groovy</value>
+ * </init-param>
+ *
+ * <!-- The followings are not special for ScriptPortlet, but normal configurations for a portlet. -->
+ * <supports>
+ * <mime-type>text/html</mime-type>
+ * <portlet-mode>VIEW</portlet-mode>
+ * <portlet-mode>EDIT</portlet-mode>
+ * <portlet-mode>HELP</portlet-mode>
+ * </supports>
+ * <supported-locale>en</supported-locale>
+ * <portlet-info>
+ * <title>Hello Groovy</title>
+ * <short-title>Hello Groovy</short-title>
+ * <keywords>demo,groovy</keywords>
+ * </portlet-info>
+ * <portlet-preferences>
+ * <preference>
+ * <name>message</name>
+ * <value>Hello, Groovy!</value>
+ * </preference>
+ * <preferences-validator>org.apache.portals.bridges.script.ScriptPortletPreferencesValidator</preferences-validator>
+ * </portlet-preferences>
+ *
+ * </portlet>
+ * </XMP></CODE></PRE>
+ *
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class ScriptPortlet extends GenericPortlet
+{
+ public static final String ENGINE = "engine";
+
+ public static final String EVAL_KEY = "eval-key";
+
+ public static final String SOURCE = "source";
+
+ public static final String VALIDATOR = "validator";
+
+ public static final String URI_ENCODING = "uri-encoding";
+
+ public static final String ENCODING = "encoding";
+
+ public static final String AUTO_REFRESH = "auto-refresh";
+
+ protected PortletConfig portletConfig;
+
+ protected String scriptEngineName;
+
+ protected String evalKey;
+
+ protected ScriptEngine scriptEngine;
+
+ protected String scriptSourceUri;
+
+ protected String scriptSourceUriEncoding;
+
+ protected String scriptSourceCharacterEncoding;
+
+ protected boolean autoRefresh;
+
+ protected ScriptSource scriptSource;
+
+ protected long scriptSourceLastModified;
+
+ protected long scriptSourceLastEvaluated;
+
+ protected Portlet scriptPortletInstance;
+
+ protected GenericPortlet scriptGenericPortletInstance;
+
+ protected Method portletDoEditMethod;
+
+ protected String validatorSourceUri;
+
+ protected ScriptSource validatorSource;
+
+ protected long validatorSourceLastModified;
+
+ protected long validatorSourceLastEvaluated;
+
+ protected PreferencesValidator validatorInstance;
+
+ private static ThreadLocal<PreferencesValidator> tlValidatorInstance = new ThreadLocal<PreferencesValidator>();
+
+ public ScriptPortlet()
+ {
+ super();
+ }
+
+ @Override
+ public void init(PortletConfig config) throws PortletException
+ {
+ portletConfig = config;
+
+ autoRefresh = "true".equals(config.getInitParameter(AUTO_REFRESH));
+
+ String param = config.getInitParameter(ENGINE);
+
+ if (param != null && !"".equals(param.trim()))
+ {
+ scriptEngineName = param;
+ }
+
+ param = config.getInitParameter(EVAL_KEY);
+
+ if (param != null && !"".equals(param.trim()))
+ {
+ evalKey = param;
+ }
+
+ param = config.getInitParameter(ENCODING);
+
+ if (param != null && !"".equals(param.trim()))
+ {
+ scriptSourceCharacterEncoding = param;
+ }
+
+ param = config.getInitParameter(URI_ENCODING);
+
+ if (param != null && !"".equals(param.trim()))
+ {
+ scriptSourceUriEncoding = param;
+ }
+
+ scriptSourceUri = config.getInitParameter(SOURCE);
+
+ if (scriptSourceUri == null)
+ {
+ throw new PortletException("Configuration failed: " + SOURCE + " should be set properly!");
+ }
+ else
+ {
+ try
+ {
+ if (scriptSourceUri.startsWith("/"))
+ {
+ scriptSource = new ScriptSource(new File(config.getPortletContext().getRealPath(scriptSourceUri)).toURL().toString(), scriptSourceUriEncoding, scriptSourceCharacterEncoding);
+ }
+ else
+ {
+ scriptSource = new ScriptSource(scriptSourceUri, scriptSourceUriEncoding, scriptSourceCharacterEncoding);
+ }
+
+ scriptSource.setMimeType(config.getPortletContext().getMimeType(scriptSource.getName()));
+ }
+ catch (Exception e)
+ {
+ throw new PortletException("Script not found: " + this.scriptSourceUri, e);
+ }
+ }
+
+ refreshPortletInstance();
+
+ if (scriptPortletInstance == null)
+ {
+ throw new PortletException("Script portlet is not available!");
+ }
+
+ validatorSourceUri = config.getInitParameter(VALIDATOR);
+
+ if (validatorSourceUri != null)
+ {
+ try
+ {
+ if (validatorSourceUri.startsWith("/"))
+ {
+ validatorSource = new ScriptSource(new File(config.getPortletContext().getRealPath(validatorSourceUri)).toURL().toString(), scriptSourceUriEncoding, scriptSourceCharacterEncoding);
+ }
+ else
+ {
+ validatorSource = new ScriptSource(validatorSourceUri, scriptSourceUriEncoding, scriptSourceCharacterEncoding);
+ }
+
+ validatorSource.setMimeType(config.getPortletContext().getMimeType(validatorSource.getName()));
+ }
+ catch (Exception e)
+ {
+ throw new PortletException("Script not found: " + validatorSourceUri, e);
+ }
+
+ refreshValidatorInstance();
+ }
+
+ }
+
+ @Override
+ public void destroy()
+ {
+ if (scriptPortletInstance != null)
+ {
+ scriptPortletInstance.destroy();
+ }
+ }
+
+ @Override
+ public PortletConfig getPortletConfig ()
+ {
+ return portletConfig;
+ }
+
+ @Override
+ public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException
+ {
+ refreshPortletInstance();
+
+ if (scriptPortletInstance == null)
+ {
+ throw new PortletException("Script portlet is not available!");
+ }
+
+ scriptPortletInstance.render(request, response);
+ }
+
+ @Override
+ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException
+ {
+ refreshPortletInstance();
+
+ if (scriptPortletInstance == null)
+ {
+ throw new PortletException("Script portlet is not available!");
+ }
+ else
+ {
+ try
+ {
+ refreshValidatorInstance();
+
+ if (validatorInstance != null)
+ {
+ tlValidatorInstance.set(validatorInstance);
+ }
+
+ scriptPortletInstance.processAction(request, response);
+ }
+ finally
+ {
+ if (validatorInstance != null)
+ {
+ tlValidatorInstance.set(null);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void processEvent(EventRequest request, EventResponse response) throws PortletException, IOException
+ {
+ if (scriptPortletInstance == null)
+ {
+ throw new PortletException("Script portlet is not available!");
+ }
+
+ if (scriptPortletInstance instanceof EventPortlet)
+ {
+ ((EventPortlet) scriptPortletInstance).processEvent(request, response);
+ }
+ }
+
+ @Override
+ public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException
+ {
+ if (scriptPortletInstance == null)
+ {
+ throw new PortletException("Script portlet is not available!");
+ }
+
+ if (scriptPortletInstance instanceof ResourceServingPortlet)
+ {
+ ((ResourceServingPortlet) scriptPortletInstance).serveResource(request, response);
+ }
+ }
+
+ @Override
+ public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException
+ {
+ if (scriptPortletInstance == null)
+ {
+ throw new PortletException("Script portlet is not available!");
+ }
+
+ if (scriptGenericPortletInstance != null && portletDoEditMethod != null)
+ {
+ try
+ {
+ portletDoEditMethod.invoke(scriptGenericPortletInstance, new Object [] { request, response });
+ }
+ catch (Exception e)
+ {
+ throw new PortletException("Failed to invoke doEdit method.", e);
+ }
+ }
+ else
+ {
+ throw new PortletException("doEdit method not implemented or not public.");
+ }
+ }
+
+ protected void refreshPortletInstance() throws PortletException
+ {
+ boolean createNew = (scriptPortletInstance == null);
+
+ if (!createNew)
+ {
+ createNew = (autoRefresh && ScriptEngineUtils.isScriptModified(scriptSource, scriptSourceLastModified));
+
+ if (!createNew)
+ {
+ return;
+ }
+ }
+
+ try
+ {
+ Portlet tempScriptPortletInstance = null;
+
+ if (scriptEngine == null)
+ {
+ scriptEngine = ScriptEngineUtils.createScriptEngine(scriptEngineName, scriptSource);
+ }
+
+ Object evalPortlet = ScriptEngineUtils.evaluateScript(scriptEngine, scriptSource, evalKey, true);
+ scriptSourceLastEvaluated = System.currentTimeMillis();
+
+ if (evalPortlet instanceof Portlet)
+ {
+ tempScriptPortletInstance = (Portlet) evalPortlet;
+ }
+ else if (evalPortlet instanceof Class)
+ {
+ Class<? extends Portlet> scriptPortletClass = (Class<? extends Portlet>) evalPortlet;
+ tempScriptPortletInstance = (Portlet) scriptPortletClass.newInstance();
+ }
+ else
+ {
+ throw new ScriptException("The evaluated return is neither class nor instance of javax.portlet.Portlet. " + evalPortlet);
+ }
+
+ scriptGenericPortletInstance = null;
+ portletDoEditMethod = null;
+
+ if (tempScriptPortletInstance instanceof GenericPortlet)
+ {
+ scriptGenericPortletInstance = (GenericPortlet) tempScriptPortletInstance;
+
+ try
+ {
+ Method doEditMethod = scriptGenericPortletInstance.getClass().getMethod("doEdit", new Class [] { RenderRequest.class, RenderResponse.class });
+
+ if (Modifier.isPublic(doEditMethod.getModifiers()))
+ {
+ portletDoEditMethod = doEditMethod;
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ }
+ }
+
+ scriptSourceLastModified = scriptSource.lastModified();
+ tempScriptPortletInstance.init(portletConfig);
+
+ scriptPortletInstance = tempScriptPortletInstance;
+ }
+ catch (Exception ex)
+ {
+ throw new PortletException("Could not evaluate script: " + scriptSourceUri, ex);
+ }
+ }
+
+ protected void refreshValidatorInstance() throws PortletException
+ {
+ if (validatorSource == null)
+ {
+ return;
+ }
+
+ boolean createNew = (validatorInstance == null);
+
+ if (!createNew)
+ {
+ createNew = (autoRefresh && ScriptEngineUtils.isScriptModified(validatorSource, validatorSourceLastModified));
+
+ if (!createNew)
+ {
+ return;
+ }
+ }
+
+ try
+ {
+ PreferencesValidator tempValidatorInstance = null;
+
+ Object evalPortlet = ScriptEngineUtils.evaluateScript(scriptEngine, validatorSource, evalKey, true);
+ validatorSourceLastEvaluated = System.currentTimeMillis();
+
+ if (evalPortlet instanceof PreferencesValidator)
+ {
+ tempValidatorInstance = (PreferencesValidator) evalPortlet;
+ }
+ else if (evalPortlet instanceof Class)
+ {
+ Class<? extends PreferencesValidator> validatorClass = (Class<? extends PreferencesValidator>) evalPortlet;
+ tempValidatorInstance = (PreferencesValidator) validatorClass.newInstance();
+ }
+ else
+ {
+ throw new ScriptException("The evaluated return is neither class nor instance of javax.portlet.PreferencesValidator. " + evalPortlet);
+ }
+
+ validatorSourceLastModified = validatorSource.lastModified();
+
+ validatorInstance = tempValidatorInstance;
+ }
+ catch (Exception ex)
+ {
+ throw new PortletException("Could not evaluate script: " + validatorSourceUri, ex);
+ }
+ }
+
+ protected static PreferencesValidator getScriptPreferencesValidator()
+ {
+ return (PreferencesValidator) tlValidatorInstance.get();
+ }
+}
Propchange: portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortlet.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortletPreferencesValidator.java
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortletPreferencesValidator.java?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortletPreferencesValidator.java (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortletPreferencesValidator.java Thu Apr 22 16:44:40 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.portals.bridges.script;
+
+import javax.portlet.PortletPreferences;
+import javax.portlet.PreferencesValidator;
+import javax.portlet.ValidatorException;
+
+/**
+ * ScriptPortletPreferencesValidator
+ *
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class ScriptPortletPreferencesValidator implements PreferencesValidator
+{
+ public void validate(PortletPreferences preferences) throws ValidatorException
+ {
+ PreferencesValidator delegatee = ScriptPortlet.getScriptPreferencesValidator();
+
+ if (delegatee != null)
+ {
+ delegatee.validate(preferences);
+ }
+ }
+}
Propchange: portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortletPreferencesValidator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptPortletPreferencesValidator.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptSource.java
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptSource.java?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptSource.java (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptSource.java Thu Apr 22 16:44:40 2010
@@ -0,0 +1,232 @@
+/*
+ * 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.portals.bridges.script;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLDecoder;
+
+/**
+ * ScriptSource
+ * <P>
+ * Representing a script source which could be loaded from a file system, classpath resource.
+ * </P>
+ *
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class ScriptSource
+{
+
+ /** Script source URI. e.g., "file://path", "classpath:path" or "file_relative_path". */
+ private String uri;
+
+ /** The file name part of the script source. */
+ private String name;
+
+ /** The file extension of the script source without dot prefix. */
+ private String extension;
+
+ /** The mime type of this script. */
+ private String mimeType;
+
+ /** The character encoding of the content of this script. */
+ private String characterEncoding;
+
+ /** Phyical file of this script source if acessible. */
+ private File scriptFile;
+
+ /** The script content bytes if the script source file is not accessible. */
+ private byte [] scriptBytes;
+
+ public ScriptSource(String uri) throws IOException
+ {
+ this(uri, null, null);
+ }
+
+ public ScriptSource(String uri, String uriEncoding, String characterEncoding) throws IOException
+ {
+ this.uri = uri;
+ this.characterEncoding = characterEncoding;
+
+ if (uri.startsWith("file:"))
+ {
+ String decodedUri = uri;
+
+ if (uriEncoding != null)
+ {
+ decodedUri = URLDecoder.decode(uri, uriEncoding);
+ }
+
+ scriptFile = new File(decodedUri.substring(5));
+ }
+ else if (uri.startsWith("classpath:"))
+ {
+ URL resourceURL = Thread.currentThread().getContextClassLoader().getResource(uri.substring(10));
+ String resourceURLString = resourceURL.toString();
+
+ if (resourceURLString.startsWith("file:"))
+ {
+ String decodedUri = resourceURLString;
+
+ if (uriEncoding != null)
+ {
+ decodedUri = URLDecoder.decode(resourceURLString, uriEncoding);
+ }
+
+ scriptFile = new File(decodedUri.substring(5));
+ }
+ else
+ {
+ InputStream is = null;
+ BufferedInputStream bis = null;
+ ByteArrayOutputStream baos = null;
+
+ try
+ {
+ is = resourceURL.openStream();
+ bis = new BufferedInputStream(is);
+ baos = new ByteArrayOutputStream(4096);
+
+ byte [] bytes = new byte[4096];
+
+ int readLen = bis.read(bytes, 0, 4096);
+ while (readLen != -1)
+ {
+ baos.write(bytes, 0, readLen);
+ readLen = bis.read(bytes, 0, 4096);
+ }
+
+ scriptBytes = baos.toByteArray();
+ }
+ finally
+ {
+ if (baos != null)
+ {
+ try
+ {
+ baos.close();
+ }
+ catch (Exception ignore) { }
+ }
+ if (bis != null)
+ {
+ try
+ {
+ bis.close();
+ }
+ catch (Exception ignore) { }
+ }
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ }
+ catch (Exception ignore) { }
+ }
+ }
+ }
+ }
+ else
+ {
+ String relPath = uri;
+ scriptFile = new File(relPath);
+ }
+
+ if (scriptFile != null)
+ {
+ name = scriptFile.getName();
+ }
+ else
+ {
+ name = uri;
+ int offset = name.lastIndexOf('/');
+ if (offset != -1)
+ {
+ name = name.substring(offset + 1);
+ }
+ }
+
+ int offset = name.lastIndexOf('.');
+
+ if (offset != -1)
+ {
+ extension = name.substring(offset + 1);
+ }
+ }
+
+ public String getUri()
+ {
+ return uri;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getExtension()
+ {
+ return extension;
+ }
+
+ public String getCharacterEncoding()
+ {
+ return characterEncoding;
+ }
+
+ public void setMimeType(String mimeType)
+ {
+ this.mimeType = mimeType;
+ }
+
+ public String getMimeType()
+ {
+ return mimeType;
+ }
+
+ public long lastModified()
+ {
+ if (scriptFile != null)
+ {
+ return scriptFile.lastModified();
+ }
+ else
+ {
+ return 0L;
+ }
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ if (scriptFile != null)
+ {
+ return new FileInputStream(scriptFile);
+ }
+ else
+ {
+ return new ByteArrayInputStream(scriptBytes);
+ }
+ }
+}
Propchange: portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptSource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/portlet/src/main/java/org/apache/portals/bridges/script/ScriptSource.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/AbstractSimpleScriptPortletTestCase.java
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/AbstractSimpleScriptPortletTestCase.java?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/AbstractSimpleScriptPortletTestCase.java (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/AbstractSimpleScriptPortletTestCase.java Thu Apr 22 16:44:40 2010
@@ -0,0 +1,248 @@
+/*
+ * 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.portals.bridges.script;
+
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.portlet.Portlet;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+
+import junit.framework.TestCase;
+
+import org.springframework.core.io.DefaultResourceLoader;
+import org.springframework.mock.web.portlet.MockActionRequest;
+import org.springframework.mock.web.portlet.MockActionResponse;
+import org.springframework.mock.web.portlet.MockPortletConfig;
+import org.springframework.mock.web.portlet.MockPortletContext;
+import org.springframework.mock.web.portlet.MockPortletPreferences;
+import org.springframework.mock.web.portlet.MockRenderRequest;
+import org.springframework.mock.web.portlet.MockRenderResponse;
+
+/**
+ * AbstractSimpleScriptPortletTestCase
+ *
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public abstract class AbstractSimpleScriptPortletTestCase extends TestCase
+{
+ protected PortletContext portletContext;
+ protected MockPortletConfig portletConfig;
+ protected ScriptPortlet scriptPortlet;
+ protected Portlet scriptPortletInstance;
+ protected long scriptSourceLastEvaluated;
+
+ abstract protected Map<String, String> getPortletInitParameters();
+
+ abstract protected ResourceBundle getPortletResourceBundle();
+
+ abstract protected String getScriptMimeType();
+
+ public void setUp() throws Exception
+ {
+ portletContext = new MockPortletContext(new DefaultResourceLoader());
+ portletConfig = new MockPortletConfig(portletContext);
+
+ for (Map.Entry<String, String> entry : getPortletInitParameters().entrySet())
+ {
+ portletConfig.addInitParameter(entry.getKey(), entry.getValue());
+ }
+
+ portletConfig.setResourceBundle(Locale.ENGLISH, getPortletResourceBundle());
+
+ scriptPortlet = new ScriptPortlet();
+
+ try
+ {
+ scriptPortlet.init(portletConfig);
+ scriptPortletInstance = scriptPortlet.scriptPortletInstance;
+ scriptSourceLastEvaluated = scriptPortlet.scriptSourceLastEvaluated;
+ assertTrue(scriptPortlet.scriptSourceLastEvaluated > 0L);
+ }
+ catch (PortletException e)
+ {
+ e.printStackTrace();
+ fail("Failed to initialize portlet: " + e);
+ }
+ }
+
+ @Override
+ public void tearDown()
+ {
+ if (scriptPortlet != null)
+ {
+ scriptPortlet.destroy();
+ }
+ }
+
+ public void testInit() throws Exception
+ {
+ String scriptEngine = getPortletInitParameters().get(ScriptPortlet.ENGINE);
+ String evalPortletKey = getPortletInitParameters().get(ScriptPortlet.EVAL_KEY);
+ String scriptSource = getPortletInitParameters().get(ScriptPortlet.SOURCE);
+
+ /*
+ * 1. initialize script engine by script engine name
+ */
+
+ PortletContext portletContext = new MockPortletContext(new DefaultResourceLoader());
+ MockPortletConfig portletConfig = new MockPortletConfig(portletContext);
+ portletConfig.addInitParameter(ScriptPortlet.ENGINE, scriptEngine);
+ if (evalPortletKey != null)
+ {
+ portletConfig.addInitParameter(ScriptPortlet.EVAL_KEY, evalPortletKey);
+ }
+ portletConfig.addInitParameter(ScriptPortlet.SOURCE, scriptSource);
+
+ ScriptPortlet helloScriptPortlet = new ScriptPortlet();
+
+ try
+ {
+ helloScriptPortlet.init(portletConfig);
+ assertTrue(helloScriptPortlet.scriptSourceLastEvaluated > 0L);
+ }
+ catch (PortletException e)
+ {
+ e.printStackTrace();
+ fail("Failed to initialize portlet: " + e);
+ }
+
+ /*
+ * 2. initialize script engine by script file extension
+ */
+
+ portletContext = new MockPortletContext(new DefaultResourceLoader());
+ portletConfig = new MockPortletConfig(portletContext);
+ if (evalPortletKey != null)
+ {
+ portletConfig.addInitParameter(ScriptPortlet.EVAL_KEY, evalPortletKey);
+ }
+ portletConfig.addInitParameter(ScriptPortlet.SOURCE, scriptSource);
+
+ helloScriptPortlet = new ScriptPortlet();
+
+ try
+ {
+ helloScriptPortlet.init(portletConfig);
+ assertTrue(helloScriptPortlet.scriptSourceLastEvaluated > 0L);
+ }
+ catch (PortletException e)
+ {
+ e.printStackTrace();
+ fail("Failed to initialize portlet: " + e);
+ }
+
+ /*
+ * 3. initialize script engine by script mime type
+ */
+
+ portletContext = new MockPortletContext(new DefaultResourceLoader())
+ {
+ @Override
+ public String getMimeType(String filePath)
+ {
+ return getScriptMimeType();
+ }
+ };
+ portletConfig = new MockPortletConfig(portletContext);
+ if (evalPortletKey != null)
+ {
+ portletConfig.addInitParameter(ScriptPortlet.EVAL_KEY, evalPortletKey);
+ }
+ portletConfig.addInitParameter(ScriptPortlet.SOURCE, scriptSource);
+
+ helloScriptPortlet = new ScriptPortlet();
+
+ try
+ {
+ helloScriptPortlet.init(portletConfig);
+ assertTrue(helloScriptPortlet.scriptSourceLastEvaluated > 0L);
+ }
+ catch (PortletException e)
+ {
+ e.printStackTrace();
+ fail("Failed to initialize portlet: " + e);
+ }
+ }
+
+ public void testRender() throws Exception
+ {
+ MockRenderRequest request = new MockRenderRequest(portletContext);
+ MockPortletPreferences preferences = new MockPortletPreferences();
+ request.setPreferences(preferences);
+ request.addLocale(Locale.ENGLISH);
+
+ MockRenderResponse response = new MockRenderResponse();
+
+ scriptPortlet.render(request, response);
+ assertFalse("The script is refreshed " +
+ "(scriptSourceLastEvaluated: " + scriptPortlet.scriptSourceLastEvaluated + ", " +
+ "initial-scriptSourceLastEvaluated: " + scriptSourceLastEvaluated + ")",
+ scriptPortlet.scriptSourceLastEvaluated > scriptSourceLastEvaluated);
+
+ String content = response.getContentAsString();
+ assertNotNull(content);
+ //System.out.println("### content: " + content);
+ String greeting = "<H1>" + portletConfig.getResourceBundle(Locale.ENGLISH).getString("javax.portlet.title") + "</H1>";
+ assertEquals(greeting, content.trim());
+
+ // to force to refresh...
+ Thread.sleep(10);
+ scriptPortlet.scriptSourceLastModified = 0L;
+ scriptPortlet.render(request, response);
+
+ assertNotSame(scriptPortletInstance, scriptPortlet.scriptPortletInstance);
+
+ assertTrue("The script is not refreshed " +
+ "(scriptSourceLastEvaluated: " + scriptPortlet.scriptSourceLastEvaluated + ", " +
+ "initial-scriptSourceLastEvaluated: " + scriptSourceLastEvaluated + ")",
+ scriptPortlet.scriptSourceLastEvaluated > scriptSourceLastEvaluated);
+ }
+
+ public void testProcessAction() throws Exception
+ {
+ MockActionRequest request = new MockActionRequest(portletContext);
+ MockPortletPreferences preferences = new MockPortletPreferences();
+
+ if (scriptPortlet.validatorInstance != null)
+ {
+ preferences.setPreferencesValidator(scriptPortlet.validatorInstance);
+ }
+
+ request.setPreferences(preferences);
+ request.addLocale(Locale.ENGLISH);
+
+ MockActionResponse response = new MockActionResponse();
+
+ try
+ {
+ scriptPortlet.processAction(request, response);
+ fail("Validator exception should occur here!!!");
+ }
+ catch (Exception e)
+ {
+ // expected ...
+ }
+
+ request.addParameter("message", "hello");
+
+ scriptPortlet.processAction(request, response);
+ }
+}
Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/AbstractSimpleScriptPortletTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/AbstractSimpleScriptPortletTestCase.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloBeanShellScriptPortlet.java
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloBeanShellScriptPortlet.java?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloBeanShellScriptPortlet.java (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloBeanShellScriptPortlet.java Thu Apr 22 16:44:40 2010
@@ -0,0 +1,82 @@
+/*
+ * 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.portals.bridges.script;
+
+import java.util.HashMap;
+import java.util.ListResourceBundle;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+/**
+ * TestHelloBeanShellScriptPortlet
+ *
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class TestHelloBeanShellScriptPortlet extends AbstractSimpleScriptPortletTestCase
+{
+ @Override
+ protected Map<String, String> getPortletInitParameters()
+ {
+ Map<String, String> initParams = new HashMap<String, String>();
+ initParams.put(ScriptPortlet.ENGINE, "beanshell");
+ initParams.put(ScriptPortlet.SOURCE, "classpath:org/apache/portals/bridges/script/HelloBeanShell.bsh");
+ initParams.put(ScriptPortlet.VALIDATOR, "classpath:org/apache/portals/bridges/script/HelloBeanShellPrefsValidator.bsh");
+ initParams.put(ScriptPortlet.AUTO_REFRESH, "true");
+ return initParams;
+ }
+
+ @Override
+ protected ResourceBundle getPortletResourceBundle()
+ {
+ return new ListResourceBundle()
+ {
+ protected Object[][] getContents()
+ {
+ return new Object[][] {
+ {"javax.portlet.title", "Hello BeanShell Portlet"},
+ {"javax.portlet.short-title", "Hello BeanShell"},
+ {"javax.portlet.keywords", "hello,beanshell"}
+ };
+ }
+ };
+ }
+
+ @Override
+ protected String getScriptMimeType()
+ {
+ return "application/x-beanshell";
+ }
+
+ @Override
+ public void testInit() throws Exception
+ {
+ super.testInit();
+ }
+
+ @Override
+ public void testRender() throws Exception
+ {
+ super.testRender();
+ }
+
+ @Override
+ public void testProcessAction() throws Exception
+ {
+ super.testProcessAction();
+ }
+}
Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloBeanShellScriptPortlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloBeanShellScriptPortlet.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloGroovyScriptPortlet.java
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloGroovyScriptPortlet.java?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloGroovyScriptPortlet.java (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloGroovyScriptPortlet.java Thu Apr 22 16:44:40 2010
@@ -0,0 +1,82 @@
+/*
+ * 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.portals.bridges.script;
+
+import java.util.HashMap;
+import java.util.ListResourceBundle;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+/**
+ * TestGroovyScriptPortlet
+ *
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class TestHelloGroovyScriptPortlet extends AbstractSimpleScriptPortletTestCase
+{
+ @Override
+ protected Map<String, String> getPortletInitParameters()
+ {
+ Map<String, String> initParams = new HashMap<String, String>();
+ initParams.put(ScriptPortlet.ENGINE, "groovy");
+ initParams.put(ScriptPortlet.SOURCE, "classpath:org/apache/portals/bridges/script/HelloGroovy.groovy");
+ initParams.put(ScriptPortlet.VALIDATOR, "classpath:org/apache/portals/bridges/script/HelloGroovyPrefsValidator.groovy");
+ initParams.put(ScriptPortlet.AUTO_REFRESH, "true");
+ return initParams;
+ }
+
+ @Override
+ protected ResourceBundle getPortletResourceBundle()
+ {
+ return new ListResourceBundle()
+ {
+ protected Object[][] getContents()
+ {
+ return new Object[][] {
+ {"javax.portlet.title", "Hello Groovy Portlet"},
+ {"javax.portlet.short-title", "Hello Groovy"},
+ {"javax.portlet.keywords", "hello,groovy"}
+ };
+ }
+ };
+ }
+
+ @Override
+ protected String getScriptMimeType()
+ {
+ return "application/x-groovy";
+ }
+
+ @Override
+ public void testInit() throws Exception
+ {
+ super.testInit();
+ }
+
+ @Override
+ public void testRender() throws Exception
+ {
+ super.testRender();
+ }
+
+ @Override
+ public void testProcessAction() throws Exception
+ {
+ super.testProcessAction();
+ }
+}
Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloGroovyScriptPortlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloGroovyScriptPortlet.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJRubyScriptPortlet.java
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJRubyScriptPortlet.java?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJRubyScriptPortlet.java (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJRubyScriptPortlet.java Thu Apr 22 16:44:40 2010
@@ -0,0 +1,82 @@
+/*
+ * 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.portals.bridges.script;
+
+import java.util.HashMap;
+import java.util.ListResourceBundle;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+/**
+ * TestHelloJRubyScriptPortlet
+ *
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class TestHelloJRubyScriptPortlet extends AbstractSimpleScriptPortletTestCase
+{
+ @Override
+ protected Map<String, String> getPortletInitParameters()
+ {
+ Map<String, String> initParams = new HashMap<String, String>();
+ initParams.put(ScriptPortlet.ENGINE, "jruby");
+ initParams.put(ScriptPortlet.SOURCE, "classpath:org/apache/portals/bridges/script/HelloJRuby.rb");
+ initParams.put(ScriptPortlet.VALIDATOR, "classpath:org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb");
+ initParams.put(ScriptPortlet.AUTO_REFRESH, "true");
+ return initParams;
+ }
+
+ @Override
+ protected ResourceBundle getPortletResourceBundle()
+ {
+ return new ListResourceBundle()
+ {
+ protected Object[][] getContents()
+ {
+ return new Object[][] {
+ {"javax.portlet.title", "Hello JRuby Portlet"},
+ {"javax.portlet.short-title", "Hello JRuby"},
+ {"javax.portlet.keywords", "hello,jruby"}
+ };
+ }
+ };
+ }
+
+ @Override
+ protected String getScriptMimeType()
+ {
+ return "application/x-ruby";
+ }
+
+ @Override
+ public void testInit() throws Exception
+ {
+ super.testInit();
+ }
+
+ @Override
+ public void testRender() throws Exception
+ {
+ super.testRender();
+ }
+
+ @Override
+ public void testProcessAction() throws Exception
+ {
+ super.testProcessAction();
+ }
+}
Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJRubyScriptPortlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJRubyScriptPortlet.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJythonScriptPortlet.java
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJythonScriptPortlet.java?rev=936949&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJythonScriptPortlet.java (added)
+++ portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJythonScriptPortlet.java Thu Apr 22 16:44:40 2010
@@ -0,0 +1,83 @@
+/*
+ * 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.portals.bridges.script;
+
+import java.util.HashMap;
+import java.util.ListResourceBundle;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+/**
+ * TestHelloJythonScriptPortlet
+ *
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class TestHelloJythonScriptPortlet extends AbstractSimpleScriptPortletTestCase
+{
+ @Override
+ protected Map<String, String> getPortletInitParameters()
+ {
+ Map<String, String> initParams = new HashMap<String, String>();
+ initParams.put(ScriptPortlet.ENGINE, "jython");
+ initParams.put(ScriptPortlet.EVAL_KEY, "value");
+ initParams.put(ScriptPortlet.SOURCE, "classpath:org/apache/portals/bridges/script/HelloJython.py");
+ initParams.put(ScriptPortlet.VALIDATOR, "classpath:org/apache/portals/bridges/script/HelloJythonPrefsValidator.py");
+ initParams.put(ScriptPortlet.AUTO_REFRESH, "true");
+ return initParams;
+ }
+
+ @Override
+ protected ResourceBundle getPortletResourceBundle()
+ {
+ return new ListResourceBundle()
+ {
+ protected Object[][] getContents()
+ {
+ return new Object[][] {
+ {"javax.portlet.title", "Hello Jython Portlet"},
+ {"javax.portlet.short-title", "Hello Jython"},
+ {"javax.portlet.keywords", "hello,jython"}
+ };
+ }
+ };
+ }
+
+ @Override
+ protected String getScriptMimeType()
+ {
+ return "application/x-jython";
+ }
+
+ @Override
+ public void testInit() throws Exception
+ {
+ super.testInit();
+ }
+
+ @Override
+ public void testRender() throws Exception
+ {
+ super.testRender();
+ }
+
+ @Override
+ public void testProcessAction() throws Exception
+ {
+ super.testProcessAction();
+ }
+}
Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJythonScriptPortlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/portlet/src/test/java/org/apache/portals/bridges/script/TestHelloJythonScriptPortlet.java
------------------------------------------------------------------------------
svn:keywords = Id
---------------------------------------------------------------------
To unsubscribe, e-mail: bridges-commits-unsubscribe@portals.apache.org
For additional commands, e-mail: bridges-commits-help@portals.apache.org