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:11:36 UTC
svn commit: r936927 [2/2] - in /portals/bridges/bridges-script/trunk: ./
dependencies/ dependencies/beanshell/ dependencies/groovy/
dependencies/jruby/ dependencies/jython/ dependencies/rhino/
src/main/java/org/apache/portals/bridges/script/ src/test/j...
Added: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloGroovyPrefsValidator.groovy
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloGroovyPrefsValidator.groovy?rev=936927&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloGroovyPrefsValidator.groovy (added)
+++ portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloGroovyPrefsValidator.groovy Thu Apr 22 16:11:35 2010
@@ -0,0 +1,41 @@
+/*
+ * 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;
+
+/**
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class HelloGroovyPrefsValidator implements PreferencesValidator
+{
+ public void validate(PortletPreferences preferences)
+ {
+ String message = preferences.getValue("message", null);
+
+ if (message == null)
+ {
+ throw new ValidatorException("Invalid message", null);
+ }
+ }
+}
+
+// Return validator instance as a last evaluated object
+new HelloGroovyPrefsValidator();
Modified: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJRuby.rb
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJRuby.rb?rev=936927&r1=936926&r2=936927&view=diff
==============================================================================
--- portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJRuby.rb (original)
+++ portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJRuby.rb Thu Apr 22 16:11:35 2010
@@ -28,6 +28,11 @@ class HelloJRuby < javax.portlet.Generic
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
Added: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb?rev=936927&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb (added)
+++ portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb Thu Apr 22 16:11:35 2010
@@ -0,0 +1,38 @@
+#
+# 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:woonsan@apache.org">Woonsan Ko</a>
+# @version $Id$
+#
+class HelloJRubyPrefsValidator
+ include javax.portlet.PreferencesValidator
+
+ def validate(preferences)
+ message = preferences.getValue("message", "")
+
+ if !message
+ throw new ValidatorException("Invalid message", null)
+ end
+ end
+
+end
+
+# Return validator instance as a last evaluated object
+HelloJRubyPrefsValidator.new
Propchange: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJRubyPrefsValidator.rb
------------------------------------------------------------------------------
svn:keywords = Id
Modified: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJython.py
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJython.py?rev=936927&r1=936926&r2=936927&view=diff
==============================================================================
--- portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJython.py (original)
+++ portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJython.py Thu Apr 22 16:11:35 2010
@@ -26,7 +26,12 @@ class HelloJython(GenericPortlet):
greeting = "<H1>" + self.getTitle(request) + "</H1>"
response.writer.println(greeting)
+ def processAction(self, request, response):
+ request.preferences.setValue("message", request.getParameter("message"))
+ request.preferences.store();
+
+
# Return portlet instance as a last evaluated object
# because ScriptPortlet expects the evaluated result object as a portlet class or non-initialized portlet instance.
-portlet = HelloJython()
+value = HelloJython()
Added: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py?rev=936927&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py (added)
+++ portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py Thu Apr 22 16:11:35 2010
@@ -0,0 +1,34 @@
+#
+# 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.
+#
+
+from javax.portlet import PreferencesValidator
+
+#
+# @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+# @version $Id$
+#
+class HelloJythonPrefsValidator(PreferencesValidator):
+ def validate(self, preferences):
+ message = preferences.getValue("message", "")
+
+ if not message:
+ raise ValidatorException("Invalid message", null)
+
+
+
+# Return validator instance as a last evaluated object
+value = HelloJythonPrefsValidator()
Propchange: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloJythonPrefsValidator.py
------------------------------------------------------------------------------
svn:keywords = Id
Modified: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloRhino.js
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloRhino.js?rev=936927&r1=936926&r2=936927&view=diff
==============================================================================
--- portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloRhino.js (original)
+++ portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloRhino.js Thu Apr 22 16:11:35 2010
@@ -29,6 +29,10 @@ new GenericPortlet(
doView: function(request, response) {
greeting = "<H1>Hello Rhino Portlet</H1>";
response.getWriter().println(greeting);
+ },
+ processAction: function(request, response) {
+ request.getPreferences().setValue("message", request.getParameter("message"));
+ request.getPreferences().store();
}
}
);
Added: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js?rev=936927&view=auto
==============================================================================
--- portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js (added)
+++ portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js Thu Apr 22 16:11:35 2010
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+importPackage(Packages.javax.portlet);
+
+/**
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+
+// Return portlet instance as a last evaluated object
+// because ScriptPortlet expects the evaluated result object as a portlet class or non-initialized portlet instance.
+new PreferencesValidator(
+ {
+ validate: function(preferences) {
+ message = preferences.getValue("message", "");
+
+ if (!message)
+ {
+ throw new ValidatorException("Invalid message", null);
+ }
+ }
+ }
+);
Propchange: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: portals/bridges/bridges-script/trunk/src/test/resources/org/apache/portals/bridges/script/HelloRhinoPrefsValidator.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
---------------------------------------------------------------------
To unsubscribe, e-mail: bridges-commits-unsubscribe@portals.apache.org
For additional commands, e-mail: bridges-commits-help@portals.apache.org