Author: woonsan
Date: Wed Jul 21 02:43:42 2010
New Revision: 966070

URL: http://svn.apache.org/viewvc?rev=966070&view=rev
Log:
APA-41: Adding jruby script example portlet.

Added:
    portals/applications/demo/trunk/src/main/webapp/WEB-INF/demo/jruby/
    
portals/applications/demo/trunk/src/main/webapp/WEB-INF/demo/jruby/HelloJRuby.rb
   (with props)
Modified:
    portals/applications/demo/trunk/pom.xml
    portals/applications/demo/trunk/src/main/webapp/WEB-INF/portlet.xml

Modified: portals/applications/demo/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/portals/applications/demo/trunk/pom.xml?rev=966070&r1=966069&r2=966070&view=diff
==============================================================================
--- portals/applications/demo/trunk/pom.xml (original)
+++ portals/applications/demo/trunk/pom.xml Wed Jul 21 02:43:42 2010
@@ -47,6 +47,7 @@
     <velocity-tools.version>1.3</velocity-tools.version>
     
<org.apache.portals.bridges.common.version>2.0</org.apache.portals.bridges.common.version>
     
<org.apache.portals.bridges.velocity.version>2.0</org.apache.portals.bridges.velocity.version>
+    
<org.apache.portals.bridges.script.version>2.0-SNAPSHOT</org.apache.portals.bridges.script.version>
     
<org.apache.portals.bridges.groovy.version>1.0.4</org.apache.portals.bridges.groovy.version>
     <slf4j.version>1.5.6</slf4j.version>
     <log4j.version>1.2.14</log4j.version>
@@ -167,6 +168,12 @@
     </dependency>
     <dependency>
       <groupId>org.apache.portals.bridges</groupId>
+      <artifactId>portals-bridges-script-dependencies-jruby</artifactId>
+      <version>${org.apache.portals.bridges.script.version}</version>
+      <type>pom</type>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.portals.bridges</groupId>
       <artifactId>portals-bridges-groovy</artifactId>
       <version>${org.apache.portals.bridges.groovy.version}</version>
       <exclusions>

Added: 
portals/applications/demo/trunk/src/main/webapp/WEB-INF/demo/jruby/HelloJRuby.rb
URL: 
http://svn.apache.org/viewvc/portals/applications/demo/trunk/src/main/webapp/WEB-INF/demo/jruby/HelloJRuby.rb?rev=966070&view=auto
==============================================================================
--- 
portals/applications/demo/trunk/src/main/webapp/WEB-INF/demo/jruby/HelloJRuby.rb
 (added)
+++ 
portals/applications/demo/trunk/src/main/webapp/WEB-INF/demo/jruby/HelloJRuby.rb
 Wed Jul 21 02:43:42 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.
+#
+
+require 'java'
+
+#
+# @author <a href="mailto:[email protected]";>Woonsan Ko</a>
+# @version $Id$
+#
+class HelloJRuby < javax.portlet.GenericPortlet
+    
+    def doView(request, response)
+        greeting = "<H1>" + getTitle(request) + "</H1>"
+        response.writer.println(greeting)
+    end
+    
+    def processAction(request, response)
+        request.preferences.setValue("message", 
request.getParameter("message"))
+        request.preferences.store()
+    end
+    
+end
+
+# Return portlet instance as a last evaluated object
+# because ScriptPortlet expects the evaluated result object as a portlet class 
or non-initialized portlet instance.
+HelloJRuby.new

Propchange: 
portals/applications/demo/trunk/src/main/webapp/WEB-INF/demo/jruby/HelloJRuby.rb
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
portals/applications/demo/trunk/src/main/webapp/WEB-INF/demo/jruby/HelloJRuby.rb
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/applications/demo/trunk/src/main/webapp/WEB-INF/portlet.xml
URL: 
http://svn.apache.org/viewvc/portals/applications/demo/trunk/src/main/webapp/WEB-INF/portlet.xml?rev=966070&r1=966069&r2=966070&view=diff
==============================================================================
--- portals/applications/demo/trunk/src/main/webapp/WEB-INF/portlet.xml 
(original)
+++ portals/applications/demo/trunk/src/main/webapp/WEB-INF/portlet.xml Wed Jul 
21 02:43:42 2010
@@ -835,7 +835,54 @@
       </preference>
     </portlet-preferences>
   </portlet>
-
+  
+  <portlet id="HelloJRuby">
+    <portlet-name>HelloJRuby</portlet-name>
+    <display-name>Hello JRuby</display-name>
+    
<portlet-class>org.apache.portals.bridges.script.ScriptPortlet</portlet-class>
+    <init-param>
+      <name>engine</name>
+      <value>jruby</value>
+    </init-param>
+    <init-param>
+      <name>eval-key</name>
+      <value>value</value>
+    </init-param>
+    <init-param>
+      <name>source</name>
+      <value>/WEB-INF/demo/jruby/HelloJRuby.rb</value>
+    </init-param>
+    <init-param>
+      <name>encoding</name>
+      <value>UTF-8</value>
+    </init-param>
+    <init-param>
+      <name>auto-refresh</name>
+      <value>true</value>
+    </init-param>
+    <init-param>
+      <name>refresh-delay</name>
+      <value>60000</value>
+    </init-param>
+    <supports>
+      <mime-type>text/html</mime-type>
+      <portlet-mode>VIEW</portlet-mode>
+    </supports>
+    <supported-locale>en</supported-locale>
+    <portlet-info>
+      <title>Hello JRuby</title>
+      <short-title>Hello JRuby</short-title>
+      <keywords>demo,jruby</keywords>
+    </portlet-info>
+    <portlet-preferences>
+      <preference>
+        <name>message</name>
+        <value>Hello, JRuby!</value>
+      </preference>
+      
<preferences-validator>org.apache.portals.bridges.script.ScriptPortletPreferencesValidator</preferences-validator>
+    </portlet-preferences>
+  </portlet>
+  
   <portlet id="HelloGroovy">
     <portlet-name>HelloGroovy</portlet-name>
     <display-name>Hello Groovy</display-name>


Reply via email to