JBoss Portal SVN: r5818 - in trunk: . build/ide/intellij/idea60/modules build/ide/intellij/idea60/modules/widget widget widget/src widget/src/main widget/src/main/org widget/src/main/org/jboss widget/src/main/org/jboss/portal widget/src/main/org/jboss/portal/widget widget/src/main/org/jboss/portal/widget/google widget/src/resources widget/src/resources/widget-invoker-sar widget/src/resources/widget-invoker-sar/META-INF
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-13 05:23:45 -0500 (Wed, 13 Dec 2006)
New Revision: 5818
Added:
trunk/build/ide/intellij/idea60/modules/widget/
trunk/build/ide/intellij/idea60/modules/widget/widget.iml
trunk/widget/
trunk/widget/build.bat
trunk/widget/build.sh
trunk/widget/build.xml
trunk/widget/src/
trunk/widget/src/main/
trunk/widget/src/main/org/
trunk/widget/src/main/org/jboss/
trunk/widget/src/main/org/jboss/portal/
trunk/widget/src/main/org/jboss/portal/widget/
trunk/widget/src/main/org/jboss/portal/widget/google/
trunk/widget/src/main/org/jboss/portal/widget/google/GoogleWidgetPortlet.java
trunk/widget/src/main/org/jboss/portal/widget/google/GoogleWidgetPortletInvoker.java
trunk/widget/src/resources/
trunk/widget/src/resources/widget-invoker-sar/
trunk/widget/src/resources/widget-invoker-sar/META-INF/
trunk/widget/src/resources/widget-invoker-sar/META-INF/jboss-service.xml
Log:
Created a prototype of a portlet invoker that adapts google widgets as portlet called GoogleWidgetPortletInvoker
Added: trunk/build/ide/intellij/idea60/modules/widget/widget.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/widget/widget.iml 2006-12-13 10:20:54 UTC (rev 5817)
+++ trunk/build/ide/intellij/idea60/modules/widget/widget.iml 2006-12-13 10:23:45 UTC (rev 5818)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="true" type="JAVA_MODULE">
+ <component name="ModuleRootManager" />
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../../../../../../widget">
+ <sourceFolder url="file://$MODULE_DIR$/../../../../../../widget/src/main" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="portlet" />
+ <orderEntry type="module" module-name="common" />
+ <orderEntry type="module" module-name="jems" />
+ <orderEntryProperties />
+ </component>
+</module>
+
Added: trunk/widget/build.bat
===================================================================
--- trunk/widget/build.bat 2006-12-13 10:20:54 UTC (rev 5817)
+++ trunk/widget/build.bat 2006-12-13 10:23:45 UTC (rev 5818)
@@ -0,0 +1,54 @@
+@echo off
+rem
+rem Invokes a script of the same name in the 'tools' module.
+rem
+rem The 'tools' module is expected to be a peer directory of the directory
+rem in which this script lives.
+rem
+rem @author Jason Dillon <jason(a)planet57.com>
+rem
+
+rem $Id: build.bat 1140 2005-11-25 23:38:58Z julien $
+
+setlocal
+
+set PROGNAME=%~nx0
+set DIRNAME=%~dp0
+
+rem Legacy shell support
+if x%PROGNAME%==x set PROGNAME=build.bat
+if x%DIRNAME%==x set DIRNAME=.\
+
+set MODULE_ROOT=%DIRNAME%
+if x%TOOLS_ROOT%==x set TOOLS_ROOT=%DIRNAME%..\tools
+set TARGET=%TOOLS_ROOT%\bin\build.bat
+set ARGS=%*
+
+rem Start'er up yo
+goto main
+
+:debug
+if not x%DEBUG%==x echo %PROGNAME%: %*
+goto :EOF
+
+:main
+call :debug PROGNAME=%PROGNAME%
+call :debug DIRNAME=%DIRNAME%
+call :debug TOOLS_ROOT=%TOOLS_ROOT%
+call :debug TARGET=%TARGET%
+
+if exist %TARGET% call :call-script & goto :EOF
+rem else fail, we can not go on
+
+echo %PROGNAME%: *ERROR* The target executable does not exist:
+echo %PROGNAME%:
+echo %PROGNAME%: %TARGET%
+echo %PROGNAME%:
+echo %PROGNAME%: Please make sure you have checked out the 'tools' module
+echo %PROGNAME%: and make sure it is up to date.
+goto :EOF
+
+:call-script
+call :debug Executing %TARGET% %ARGS%
+call %TARGET% %ARGS%
+goto :EOF
Property changes on: trunk/widget/build.bat
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/widget/build.sh
===================================================================
--- trunk/widget/build.sh 2006-12-13 10:20:54 UTC (rev 5817)
+++ trunk/widget/build.sh 2006-12-13 10:23:45 UTC (rev 5818)
@@ -0,0 +1,49 @@
+#!/bin/sh
+##
+## Invokes a script of the same name in the 'tools' module.
+##
+## The 'tools' module is expected to be a peer directory of the directory
+## in which this script lives.
+##
+## @author Jason Dillon <jason(a)planet57.com>
+##
+
+# $Id: build.sh 1140 2005-11-25 23:38:58Z julien $
+
+PROGNAME=`basename $0`
+DIRNAME=`dirname $0`
+
+# Buss it yo
+main() {
+ if [ "x$TOOLS_ROOT" = "x" ]; then
+ TOOLS_ROOT=`cd $DIRNAME/../tools && pwd`
+ fi
+
+ MODULE_ROOT=`cd $DIRNAME; pwd`
+ export TOOLS_ROOT MODULE_ROOT DEBUG TRACE
+
+ # Where is the target script?
+ target="$TOOLS_ROOT/bin/$PROGNAME"
+ if [ ! -f "$target" ]; then
+ echo "${PROGNAME}: *ERROR* The target executable does not exist:"
+ echo "${PROGNAME}:"
+ echo "${PROGNAME}: $target"
+ echo "${PROGNAME}:"
+ echo "${PROGNAME}: Please make sure you have checked out the 'tools' module"
+ echo "${PROGNAME}: and make sure it is up to date."
+ exit 2
+ fi
+
+ # Get busy yo!
+ if [ "x$DEBUG" != "x" ]; then
+ echo "${PROGNAME}: Executing: /bin/sh $target $@"
+ fi
+ if [ "x$TRACE" = "x" ]; then
+ exec /bin/sh $target "$@"
+ else
+ exec /bin/sh -x $target "$@"
+ fi
+}
+
+# Lets get ready to rumble!
+main "$@"
Property changes on: trunk/widget/build.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/widget/build.xml
===================================================================
--- trunk/widget/build.xml 2006-12-13 10:20:54 UTC (rev 5817)
+++ trunk/widget/build.xml 2006-12-13 10:23:45 UTC (rev 5818)
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE project [
+ <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
+ <!ENTITY buildmagic SYSTEM "../tools/etc/buildfragments/buildmagic.ent">
+ <!ENTITY tools SYSTEM "../tools/etc/buildfragments/tools.ent">
+ <!ENTITY modules SYSTEM "../tools/etc/buildfragments/modules.ent">
+ <!ENTITY defaults SYSTEM "../tools/etc/buildfragments/defaults.ent">
+ <!ENTITY targets SYSTEM "../tools/etc/buildfragments/targets.ent">
+ ]>
+
+<!-- $Id: build.xml 5448 2006-10-13 19:29:17Z chris.laprun(a)jboss.com $ -->
+
+<!--+======================================================================+-->
+<!--| JBoss Portal (The OpenSource Portal) Build File |-->
+<!--| |-->
+<!--| Distributable under LGPL license. |-->
+<!--| See terms of license at http://www.gnu.org. |-->
+<!--| |-->
+<!--| This file has been designed to work with the 'tools' module and |-->
+<!--| Buildmagic extentions. |-->
+<!--+======================================================================+-->
+
+<project default="main" name="JBoss Portal">
+
+ <!--+====================================================================+-->
+ <!--| Setup |-->
+ <!--| |-->
+ <!--| Include the common build elements. |-->
+ <!--| |-->
+ <!--| This defines several different targets, properties and paths. |-->
+ <!--| It also sets up the basic extention tasks amoung other things. |-->
+ <!--+====================================================================+-->
+
+ &buildmagic;
+ &modules;
+ &defaults;
+ &tools;
+ &targets;
+
+ <!-- ================================================================== -->
+ <!-- Initialization -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Initialize the build system. Must depend on '_buildmagic:init'.
+ | Other targets should depend on 'init' or things will mysteriously fail.
+ -->
+
+ <target name="init" unless="init.disable" depends="_buildmagic:init">
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Configuration |-->
+ <!--| |-->
+ <!--| This target is invoked by the Buildmagic initialization logic |-->
+ <!--| and should contain module specific configuration elements. |-->
+ <!--+====================================================================+-->
+
+ <target name="configure" unless="configure.disable">
+
+ <!-- Configure some properties -->
+ <property name="jboss-junit-configuration" value=""/>
+ <property name="junit.formatter.usefile" value="true"/>
+
+ <!-- Configure thirdparty libraries -->
+ &libraries;
+ <path id="library.classpath">
+ <path refid="jbossas/core.libs.classpath"/>
+ <path refid="apache.log4j.classpath"/>
+ </path>
+
+ <!-- Configure modules -->
+ <call target="configure-modules"/>
+ <path id="dependentmodule.classpath">
+ <path refid="jboss.portal-common.classpath"/>
+ <path refid="jboss.portal-jems.classpath"/>
+ <path refid="jboss.portal-server.classpath"/>
+ <path refid="jboss.portal-portlet.classpath"/>
+ </path>
+
+ <!--+=======================================+-->
+ <!--| Override any default properties here. |-->
+ <!--+=======================================+-->
+
+ <!-- Configure defaults & build tools -->
+ <call target="configure-defaults"/>
+ <call target="configure-tools"/>
+
+ <!--+=======================================+-->
+ <!--| Define module specific elements here. |-->
+ <!--+=======================================+-->
+ <property name="javadoc.private" value="true"/>
+ <property name="javadoc.protected" value="false"/>
+
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Compile |-->
+ <!--| |-->
+ <!--| This target should depend on other compile-* targets for each |-->
+ <!--| different type of compile that needs to be performed, short of |-->
+ <!--| documentation compiles. |-->
+ <!--+====================================================================+-->
+
+ <target name="compile"
+ description="Compile all source files."
+ depends="_default:compile-classes,
+ _default:compile-etc,
+ _default:compile-resources">
+ <!-- Add module specific elements here. -->
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Generate Output |-->
+ <!--| |-->
+ <!--| Generates the target output for this module. Target output is |-->
+ <!--| the output which is ment to be released or used by external |-->
+ <!--| modules. |-->
+ <!--+====================================================================+-->
+
+ <target name="output"
+ description="Generate all target output."
+ depends="compile">
+
+ <!-- widget-invoker-lib.jar -->
+ <mkdir dir="${build.lib}"/>
+ <jar jarfile="${build.lib}/widget-invoker-lib.jar">
+ <fileset dir="${build.classes}"/>
+ </jar>
+
+ <!-- widget-invoker.sar -->
+ <mkdir dir="${build.resources}/widget-invoker-sar/lib"/>
+ <copy todir="${build.resources}/widget-invoker-sar/lib">
+ <fileset dir="${build.lib}" includes="widget-invoker-lib.jar"/>
+ </copy>
+ <jar jarfile="${build.lib}/widget-invoker.sar">
+ <fileset dir="${build.resources}/widget-invoker-sar"/>
+ </jar>
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Cleaning -->
+ <!-- ================================================================== -->
+
+ <!-- Clean up all build output -->
+ <target name="clean" depends="_default:clean">
+ <!-- Add module specific elements here. -->
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Documents |-->
+ <!--| |-->
+ <!--| Generate all documentation for this module. |-->
+ <!--+====================================================================+-->
+
+ <target name="docs" depends="_default:docs">
+ <!-- Add module specific elements here. -->
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Misc. -->
+ <!-- ================================================================== -->
+
+ <target name="main" depends="most"/>
+ <target name="all" depends="_default:all"/>
+ <target name="most" depends="_default:most"/>
+ <target name="help" depends="_default:help"/>
+
+ <!-- ================================================================== -->
+ <!-- Deployment -->
+ <!-- ================================================================== -->
+
+ <target name="deploy"
+ description="Deploy."
+ depends="output">
+ <require file="${jboss.home}/server/${portal.deploy.dir}"/>
+ <copy file="${build.lib}/widget-invoker.sar" todir="${jboss.home}/server/${portal.deploy.dir}"/>
+ </target>
+
+ <target name="undeploy"
+ description="Undeploy."
+ depends="init">
+ <require file="${jboss.home}/server/${portal.deploy.dir}"/>
+ <delete file="${jboss.home}/server/${portal.deploy.dir}/widget-invoker.sar"/>
+ </target>
+
+</project>
Property changes on: trunk/widget/build.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/widget/src/main/org/jboss/portal/widget/google/GoogleWidgetPortlet.java
===================================================================
--- trunk/widget/src/main/org/jboss/portal/widget/google/GoogleWidgetPortlet.java 2006-12-13 10:20:54 UTC (rev 5817)
+++ trunk/widget/src/main/org/jboss/portal/widget/google/GoogleWidgetPortlet.java 2006-12-13 10:23:45 UTC (rev 5818)
@@ -0,0 +1,153 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.widget.google;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.jboss.portal.common.util.XML;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.support.info.MetaInfoSupport;
+import org.jboss.portal.portlet.support.info.SessionInfoSupport;
+import org.jboss.portal.portlet.support.info.CacheInfoSupport;
+import org.jboss.portal.portlet.support.info.SecurityInfoSupport;
+import org.jboss.portal.portlet.support.info.PreferencesInfoSupport;
+import org.jboss.portal.portlet.support.info.CapabilitiesInfoSupport;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.CapabilitiesInfo;
+import org.jboss.portal.portlet.info.PreferencesInfo;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.info.SecurityInfo;
+import org.jboss.portal.portlet.info.CacheInfo;
+import org.jboss.portal.portlet.info.SessionInfo;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class GoogleWidgetPortlet implements Portlet
+{
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final String title;
+
+ /** . */
+ private final String description;
+
+ /** . */
+ private final Info info;
+
+ /** . */
+ private final String content;
+
+ public GoogleWidgetPortlet(String id, Document widgetDoc)
+ {
+ this.id = id;
+ this.info = new Info();
+
+ Element moduleElt = widgetDoc.getDocumentElement();
+ Iterator modulePrefsEltIterator = XML.getChildrenIterator(moduleElt, "ModulePrefs");
+ Element modulePrefsElt = (Element)modulePrefsEltIterator.next();
+
+ this.title = modulePrefsElt.getAttribute("title");
+ this.description = modulePrefsElt.getAttribute("description");
+
+ Iterator contentEltIterator = XML.getChildrenIterator(moduleElt, "Content");
+ Element contentElt = (Element)contentEltIterator.next();
+
+ this.content = XML.asString(contentElt);
+ }
+
+
+ public PortletContext getContext()
+ {
+ return PortletContext.createPortletContext(id);
+ }
+
+ public PortletInfo getInfo()
+ {
+ return info;
+ }
+
+ public boolean isRemote()
+ {
+ return false;
+ }
+
+ public String getContent()
+ {
+ return content;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ private class Info implements PortletInfo
+ {
+ public CapabilitiesInfo getCapabilities()
+ {
+ return new CapabilitiesInfoSupport();
+ }
+
+ public PreferencesInfo getPreferences()
+ {
+ return new PreferencesInfoSupport();
+ }
+
+ public MetaInfo getMeta()
+ {
+ MetaInfoSupport support = new MetaInfoSupport();
+ support.setDisplayName(title);
+ support.setDescription(description);
+ return support;
+ }
+
+ public SecurityInfo getSecurity()
+ {
+ return new SecurityInfoSupport();
+ }
+
+ public CacheInfo getCache()
+ {
+ return new CacheInfoSupport();
+ }
+
+ public SessionInfo getSession()
+ {
+ return new SessionInfoSupport();
+ }
+
+ public Boolean isRemotable()
+ {
+ return Boolean.FALSE;
+ }
+ }
+
+}
Added: trunk/widget/src/main/org/jboss/portal/widget/google/GoogleWidgetPortletInvoker.java
===================================================================
--- trunk/widget/src/main/org/jboss/portal/widget/google/GoogleWidgetPortletInvoker.java 2006-12-13 10:20:54 UTC (rev 5817)
+++ trunk/widget/src/main/org/jboss/portal/widget/google/GoogleWidgetPortletInvoker.java 2006-12-13 10:23:45 UTC (rev 5818)
@@ -0,0 +1,234 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.widget.google;
+
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.InvokerUnavailableException;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.common.util.XML;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.w3c.dom.Document;
+
+import javax.swing.text.html.HTMLEditorKit;
+import javax.swing.text.html.HTML;
+import javax.swing.text.MutableAttributeSet;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
+import java.util.Set;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.StringTokenizer;
+import java.util.LinkedHashSet;
+import java.util.Iterator;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.HashSet;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class GoogleWidgetPortletInvoker extends AbstractJBossService implements PortletInvoker
+{
+
+ private volatile Map portletMap;
+
+ private static class ParserAccessor extends HTMLEditorKit
+ {
+ public Parser getParser()
+ {
+ return super.getParser();
+ }
+ }
+
+ public Map getPortletMap() throws PortletInvokerException
+ {
+ // Lazy create the map
+ if (portletMap == null)
+ {
+ try
+ {
+ LinkedHashMap portletMap = new LinkedHashMap();
+
+ // Find widget URLs
+ URL url = new URL("http://www.google.com/ig/directory");
+ InputStream in = url.openStream();
+ final LinkedHashSet urls = new LinkedHashSet();
+ HTMLEditorKit.ParserCallback callback = new HTMLEditorKit.ParserCallback()
+ {
+ public void handleStartTag(HTML.Tag t, MutableAttributeSet attrSet, int pos)
+ {
+ if (t == HTML.Tag.A)
+ {
+ try
+ {
+ String href = (String)attrSet.getAttribute(HTML.Attribute.HREF);
+ URL url = new URL(href);
+ String query = url.getQuery();
+ if (query != null)
+ {
+ Map params = new HashMap();
+ StringTokenizer st = new StringTokenizer(query, "&");
+ while (st.hasMoreTokens())
+ {
+ String pair = st.nextToken();
+ int separator = pair.indexOf('=');
+ if (separator != -1)
+ {
+ String left = pair.substring(0, separator);
+ String right = pair.substring(separator + 1);
+ params.put(left, right);
+ }
+ }
+
+ //
+ if (params.containsKey("url"))
+ {
+ url = new URL((String)params.get("url"));
+ if (url.toString().endsWith(".xml"))
+ {
+ urls.add(url);
+ }
+ }
+ }
+ }
+ catch (MalformedURLException ignore)
+ {
+ }
+ }
+ }
+ };
+ HTMLEditorKit.Parser parser = new ParserAccessor().getParser();
+ parser.parse(new InputStreamReader(in, "UTF-8"), callback, true);
+
+ // Now parse each
+ for (Iterator i = urls.iterator();i.hasNext();)
+ {
+ URL widgetURL = (URL)i.next();
+ DocumentBuilderFactory factory = XML.getDocumentBuilderFactory();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.parse(widgetURL.toString());
+ try
+ {
+ GoogleWidgetPortlet portlet = new GoogleWidgetPortlet(widgetURL.toString(), doc);
+ portletMap.put(portlet.getContext().getId(), portlet);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+ this.portletMap = portletMap;
+ }
+ catch (Exception e)
+ {
+ throw new InvokerUnavailableException(e);
+ }
+ }
+
+ //
+ Map portletMap = this.portletMap;
+ if (portletMap == null)
+ {
+ portletMap = Collections.EMPTY_MAP;
+ }
+
+ //
+ return portletMap;
+ }
+
+
+ public Set getPortlets() throws PortletInvokerException
+ {
+ return new HashSet(getPortletMap().values());
+ }
+
+ public Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException
+ {
+ String targetId = portletContext.getId();
+ GoogleWidgetPortlet portlet = (GoogleWidgetPortlet)getPortletMap().get(targetId);
+ if (portlet == null)
+ {
+ throw new NoSuchPortletException(targetId);
+ }
+ return portlet;
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws IllegalArgumentException, PortletInvokerException
+ {
+ if (invocation instanceof RenderInvocation)
+ {
+ PortletContext target = (PortletContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE);
+ GoogleWidgetPortlet portlet = (GoogleWidgetPortlet)getPortlet(target);
+ FragmentResponse resp = new FragmentResponse();
+ resp.setContentType("text/html");
+ resp.getWriter().print(portlet.getContent());
+ resp.setTitle(portlet.getTitle());
+ return resp;
+ }
+ else
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public PortletContext createClone(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public List destroyClones(List portletContexts) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext, Set keys) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Added: trunk/widget/src/resources/widget-invoker-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/widget/src/resources/widget-invoker-sar/META-INF/jboss-service.xml 2006-12-13 10:20:54 UTC (rev 5817)
+++ trunk/widget/src/resources/widget-invoker-sar/META-INF/jboss-service.xml 2006-12-13 10:23:45 UTC (rev 5818)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<server>
+
+ <!-- -->
+ <mbean
+ code="org.jboss.portal.widget.google.GoogleWidgetPortletInvoker"
+ name="portal:service=PortletInvoker,type=GoogleWidget"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+
+ <!-- Register the portlet invoker on the federating portlet invoker -->
+ <mbean
+ code="org.jboss.portal.federation.impl.PortletInvokerRegistrationService"
+ name="portal:service=PortletInvokerRegistration,id=googlewidget"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="Id">googlewidget</attribute>
+ <depends
+ optional-attribute-name="PortletInvoker"
+ proxy-type="attribute">portal:service=PortletInvoker,type=GoogleWidget</depends>
+ <depends
+ optional-attribute-name="FederatingPortletInvoker"
+ proxy-type="attribute">portal:service=PortletInvoker,type=Federating</depends>
+ </mbean>
+</server>
19 years, 5 months
JBoss Portal SVN: r5817 - in trunk: core/src/main/org/jboss/portal/test/core/model/instance core/src/main/org/jboss/portal/test/core/state portlet/src/main/org/jboss/portal/portlet/support portlet/src/main/org/jboss/portal/portlet/support/info portlet/src/main/org/jboss/portal/portlet/test/support portlet/src/main/org/jboss/portal/test/portlet/state
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-13 05:20:54 -0500 (Wed, 13 Dec 2006)
New Revision: 5817
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/support/info/
trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CacheInfoSupport.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CapabilitiesInfoSupport.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/info/MetaInfoSupport.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/info/ModeInfoSupport.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferenceInfoSupport.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferencesInfoSupport.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SessionInfoSupport.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/info/WindowStateInfoSupport.java
Removed:
trunk/portlet/src/main/org/jboss/portal/portlet/test/support/info/
Modified:
trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java
trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletSupport.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
Log:
- moved portlet info support to package org.jboss.portlet.support.info
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -55,6 +55,7 @@
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.support.info.PreferencesInfoSupport;
import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -69,7 +70,6 @@
import org.jboss.portal.portlet.test.ValueMapAssert;
import org.jboss.portal.portlet.test.support.PortletInvokerSupport;
import org.jboss.portal.portlet.test.support.PortletSupport;
-import org.jboss.portal.portlet.test.support.info.PreferencesInfoSupport;
import org.jboss.portal.test.framework.TestRuntimeContext;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
import org.jboss.portal.test.framework.embedded.HibernateSupport;
Modified: trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -43,6 +43,7 @@
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.support.info.PreferencesInfoSupport;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -60,7 +61,6 @@
import org.jboss.portal.portlet.test.ValueMapAssert;
import org.jboss.portal.portlet.test.support.PortletInvokerSupport;
import org.jboss.portal.portlet.test.support.PortletSupport;
-import org.jboss.portal.portlet.test.support.info.PreferencesInfoSupport;
import org.jboss.portal.test.framework.TestRuntimeContext;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
import org.jboss.portal.test.framework.embedded.HibernateSupport;
Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CacheInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CacheInfoSupport.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CacheInfoSupport.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.container.info.ContainerCacheInfo;
+import org.jboss.portal.portlet.info.CacheInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class CacheInfoSupport implements CacheInfo
+{
+
+ /** . */
+ private int expirationTimeMillis;
+
+ /** . */
+ private int referenceType;
+
+ public CacheInfoSupport(int expirationTimeMillis, int referenceType)
+ {
+ this.expirationTimeMillis = expirationTimeMillis;
+ this.referenceType = referenceType;
+ }
+
+ public CacheInfoSupport()
+ {
+ this(0, ContainerCacheInfo.REF_STRONG);
+ }
+
+ public int getExpirationSecs()
+ {
+ return expirationTimeMillis;
+ }
+
+ public void setExpirationTimeMillis(int expirationTimeMillis)
+ {
+ this.expirationTimeMillis = expirationTimeMillis;
+ }
+
+ public int getReferenceType()
+ {
+ return referenceType;
+ }
+
+ public void setReferenceType(int referenceType)
+ {
+ this.referenceType = referenceType;
+ }
+}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CapabilitiesInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CapabilitiesInfoSupport.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CapabilitiesInfoSupport.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,121 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.info.CapabilitiesInfo;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CapabilitiesInfoSupport implements CapabilitiesInfo
+{
+
+ /** . */
+ private Set mimeTypes;
+
+ /** . */
+ private Set modes;
+
+ /** . */
+ private Set windowStates;
+
+ /** . */
+ private Set locales;
+
+ public CapabilitiesInfoSupport()
+ {
+ mimeTypes = new HashSet();
+ mimeTypes.add("text/html");
+
+ //
+ modes = new HashSet();
+ modes.add(new ModeInfoSupport(Mode.VIEW));
+ modes.add(new ModeInfoSupport(Mode.EDIT));
+ modes.add(new ModeInfoSupport(Mode.HELP));
+
+ //
+ windowStates = new HashSet();
+ windowStates.add(new WindowStateInfoSupport(WindowState.NORMAL));
+ windowStates.add(new WindowStateInfoSupport(WindowState.MAXIMIZED));
+ windowStates.add(new WindowStateInfoSupport(WindowState.MINIMIZED));
+
+ //
+ locales = new HashSet();
+ locales.add(Locale.ENGLISH);
+ }
+
+ public Set getMimeTypes()
+ {
+ return mimeTypes;
+ }
+
+ public Set getAllModes()
+ {
+ return modes;
+ }
+
+ public Set getModes(String mimeType)
+ {
+ if (mimeTypes.contains(mimeType))
+ {
+ return modes;
+ }
+ return Collections.EMPTY_SET;
+ }
+
+ public Set getAllWindowStates()
+ {
+ return windowStates;
+ }
+
+ public Set getWindowStates(String mimeType)
+ {
+ if (mimeTypes.contains(mimeType))
+ {
+ return windowStates;
+ }
+ return Collections.EMPTY_SET;
+ }
+
+ public Set getAllLocales()
+ {
+ return locales;
+ }
+
+ public Set getLocales(String mimeType)
+ {
+ if (mimeTypes.contains(mimeType))
+ {
+ return locales;
+ }
+ return Collections.EMPTY_SET;
+ }
+}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/MetaInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/MetaInfoSupport.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/MetaInfoSupport.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,98 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.portlet.info.MetaInfo;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MetaInfoSupport implements MetaInfo
+{
+
+ /** . */
+ private Map values = new HashMap();
+
+ public LocalizedString getMetaValue(String key)
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return (LocalizedString)values.get(key);
+ }
+
+ public void addValue(String key, Locale locale, String value)
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ LocalizedString string = new LocalizedString(value, locale);
+ if (values.put(key, string) != null)
+ {
+ throw new IllegalStateException("Already existing");
+ }
+ }
+
+ public void setTitle(String name)
+ {
+ addValue(MetaInfo.TITLE, Locale.ENGLISH, name);
+ }
+
+ public void setShortTitle(String name)
+ {
+ addValue(MetaInfo.SHORT_TITLE, Locale.ENGLISH, name);
+ }
+
+ public void setKeywords(String name)
+ {
+ addValue(MetaInfo.KEYWORDS, Locale.ENGLISH, name);
+ }
+
+ public void setDisplayName(String name)
+ {
+ addValue(MetaInfo.DISPLAY_NAME, Locale.ENGLISH, name);
+ }
+
+ public void setDescription(String name)
+ {
+ addValue(MetaInfo.DESCRIPTION, Locale.ENGLISH, name);
+ }
+
+ public String getDisplayName()
+ {
+ LocalizedString string = getMetaValue(MetaInfo.DISPLAY_NAME);
+ if (string == null)
+ {
+ throw new IllegalStateException();
+ }
+ return string.getString(Locale.ENGLISH, true);
+ }
+}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/ModeInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/ModeInfoSupport.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/ModeInfoSupport.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.portlet.info.ModeInfo;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class ModeInfoSupport implements ModeInfo
+{
+
+ /** . */
+ private final LocalizedString description;
+
+ /** . */
+ private final Mode mode;
+
+ public ModeInfoSupport(Mode mode)
+ {
+ this.description = new LocalizedString(mode + " mode", Locale.ENGLISH);
+ this.mode = mode;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public String getModeName()
+ {
+ return mode.toString();
+ }
+}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,111 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.info.CacheInfo;
+import org.jboss.portal.portlet.info.CapabilitiesInfo;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.PreferencesInfo;
+import org.jboss.portal.portlet.info.SecurityInfo;
+import org.jboss.portal.portlet.info.SessionInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PortletInfoSupport implements PortletInfo
+{
+
+ private Boolean remotable;
+ private PreferencesInfoSupport preferencesSupport = new PreferencesInfoSupport();
+ private SecurityInfoSupport securitySupport = new SecurityInfoSupport();
+ private CacheInfoSupport cacheSupport = new CacheInfoSupport();
+ private SessionInfoSupport sessionSupport = new SessionInfoSupport();
+ private MetaInfoSupport metaSupport = new MetaInfoSupport();
+
+ public CapabilitiesInfo getCapabilities()
+ {
+ throw new UnsupportedOperationException("Implement me");
+ }
+
+ public PreferencesInfo getPreferences()
+ {
+ return preferencesSupport;
+ }
+
+ public PreferencesInfoSupport getPreferencesSupport()
+ {
+ return preferencesSupport;
+ }
+
+ public MetaInfo getMeta()
+ {
+ return metaSupport;
+ }
+
+ public MetaInfoSupport getMetaSupport()
+ {
+ return metaSupport;
+ }
+
+ public SecurityInfo getSecurity()
+ {
+ return securitySupport;
+ }
+
+ public SecurityInfoSupport getSecuritySupport()
+ {
+ return securitySupport;
+ }
+
+ public CacheInfo getCache()
+ {
+ return cacheSupport;
+ }
+
+ public CacheInfoSupport getCacheSupport()
+ {
+ return cacheSupport;
+ }
+
+ public SessionInfo getSession()
+ {
+ return sessionSupport;
+ }
+
+ public SessionInfoSupport getSessionSupport()
+ {
+ return sessionSupport;
+ }
+
+ public Boolean isRemotable()
+ {
+ return remotable;
+ }
+
+ public void setRemotable(Boolean remotable)
+ {
+ this.remotable = remotable;
+ }
+}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferenceInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferenceInfoSupport.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferenceInfoSupport.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,124 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.portlet.info.PreferenceInfo;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PreferenceInfoSupport implements PreferenceInfo
+{
+
+ /** . */
+ private final String key;
+
+ /** . */
+ private LocalizedString displayName;
+
+ /** . */
+ private LocalizedString description;
+
+ /** . */
+ private Boolean readOnly;
+
+ /** . */
+ private Value defaultValue;
+
+ public PreferenceInfoSupport(String key)
+ {
+ this.key = key;
+ this.displayName = new LocalizedString("Display name of " + key, Locale.ENGLISH);
+ this.description = new LocalizedString("Description of " + key, Locale.ENGLISH);
+ this.readOnly = null;
+ this.defaultValue = null;
+ }
+
+ public PreferenceInfoSupport(String key, Value defaultValue)
+ {
+ this.key = key;
+ this.displayName = new LocalizedString("Display name of " + key, Locale.ENGLISH);
+ this.description = new LocalizedString("Description of " + key, Locale.ENGLISH);
+ this.readOnly = Boolean.FALSE;
+ this.defaultValue = defaultValue;
+ }
+
+ public PreferenceInfoSupport(String key, Value defaultValue, Boolean readOnly)
+ {
+ this.key = key;
+ this.displayName = new LocalizedString("Display name of " + key, Locale.ENGLISH);
+ this.description = new LocalizedString("Description of " + key, Locale.ENGLISH);
+ this.readOnly = readOnly;
+ this.defaultValue = defaultValue;
+ }
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public LocalizedString getDisplayName()
+ {
+ return displayName;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public Boolean isReadOnly()
+ {
+ return readOnly;
+ }
+
+ public void setReadOnly(Boolean readOnly)
+ {
+ this.readOnly = readOnly;
+ }
+
+ public Value getDefaultValue()
+ {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(Value defaultValue)
+ {
+ this.defaultValue = defaultValue;
+ }
+
+ public void setDisplayName(LocalizedString displayName)
+ {
+ this.displayName = displayName;
+ }
+
+ public void setDescription(LocalizedString description)
+ {
+ this.description = description;
+ }
+}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferencesInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferencesInfoSupport.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/PreferencesInfoSupport.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.portlet.info.PreferenceInfo;
+import org.jboss.portal.portlet.info.PreferencesInfo;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PreferencesInfoSupport implements PreferencesInfo
+{
+
+ private final Map preferences;
+
+ public PreferencesInfoSupport(Map preferences)
+ {
+ this.preferences = preferences;
+ }
+
+ public PreferencesInfoSupport()
+ {
+ this(new HashMap());
+ }
+
+ public Set getKeys()
+ {
+ return preferences.keySet();
+ }
+
+ public PreferenceInfo getPreference(String key) throws IllegalArgumentException
+ {
+ return (PreferenceInfo)preferences.get(key);
+ }
+
+ public void addPreference(PreferenceInfoSupport preference)
+ {
+ preferences.put(preference.getKey(), preference);
+ }
+
+ public void addPreference(String key)
+ {
+ preferences.put(key, new PreferenceInfoSupport(key));
+ }
+
+ public void addPreference(String key, Value value)
+ {
+ preferences.put(key, new PreferenceInfoSupport(key, value));
+ }
+
+ public void addPreference(String key, Value value, Boolean readOnly)
+ {
+ preferences.put(key, new PreferenceInfoSupport(key, value, readOnly));
+ }
+}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.portlet.TransportGuarantee;
+import org.jboss.portal.portlet.info.SecurityInfo;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class SecurityInfoSupport implements SecurityInfo
+{
+
+ /** . */
+ private final Set transportGuarantees;
+
+ public SecurityInfoSupport(Set transportGuarantees)
+ {
+ this.transportGuarantees = transportGuarantees;
+ }
+
+ public SecurityInfoSupport()
+ {
+ this(new CollectionBuilder().add(TransportGuarantee.NONE).toHashSet());
+ }
+
+ public boolean containsTransportGuarantee(TransportGuarantee transportGuarantee)
+ {
+ return transportGuarantees.contains(transportGuarantee);
+ }
+
+ public Set getTransportGuarantees()
+ {
+ return transportGuarantees;
+ }
+}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SessionInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SessionInfoSupport.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SessionInfoSupport.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.info.SessionInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class SessionInfoSupport implements SessionInfo
+{
+
+ /** . */
+ private Boolean distributed;
+
+ public SessionInfoSupport(Boolean distributed)
+ {
+ this.distributed = distributed;
+ }
+
+ public SessionInfoSupport()
+ {
+ this(null);
+ }
+
+ public Boolean getDistributed()
+ {
+ return distributed;
+ }
+
+ public void setDistributed(Boolean distributed)
+ {
+ this.distributed = distributed;
+ }
+}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/WindowStateInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/WindowStateInfoSupport.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/WindowStateInfoSupport.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.portlet.info.WindowStateInfo;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class WindowStateInfoSupport implements WindowStateInfo
+{
+
+ /** . */
+ private final LocalizedString description;
+
+ /** . */
+ private final WindowState windowState;
+
+ public WindowStateInfoSupport(WindowState mode)
+ {
+ this.description = new LocalizedString(mode + " window state", Locale.ENGLISH);
+ this.windowState = mode;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+ public String getWindowStateName()
+ {
+ return windowState.toString();
+ }
+}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -29,12 +29,12 @@
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.support.info.PortletInfoSupport;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.state.PropertyChange;
import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.test.support.info.PortletInfoSupport;
import java.util.HashMap;
import java.util.HashSet;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletSupport.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletSupport.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -23,10 +23,10 @@
package org.jboss.portal.portlet.test.support;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.support.info.PortletInfoSupport;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.test.support.info.PortletInfoSupport;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -30,6 +30,7 @@
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.support.info.PortletInfoSupport;
import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -42,7 +43,6 @@
import org.jboss.portal.portlet.state.SimplePropertyMap;
import org.jboss.portal.portlet.test.ValueMapAssert;
import org.jboss.portal.portlet.test.support.PortletSupport;
-import org.jboss.portal.portlet.test.support.info.PortletInfoSupport;
import java.util.Collections;
import java.util.HashSet;
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -25,6 +25,7 @@
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.support.info.PortletInfoSupport;
import org.jboss.portal.portlet.impl.state.StateConverterService;
import org.jboss.portal.portlet.impl.state.StateManagementPolicyService;
import org.jboss.portal.portlet.impl.state.consumer.ConsumerPersistenceManagerService;
@@ -40,7 +41,6 @@
import org.jboss.portal.portlet.test.InstanceContextImpl;
import org.jboss.portal.portlet.test.support.PortletInvokerSupport;
import org.jboss.portal.portlet.test.support.PortletSupport;
-import org.jboss.portal.portlet.test.support.info.PortletInfoSupport;
import java.util.Collections;
import java.util.List;
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2006-12-13 05:30:22 UTC (rev 5816)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2006-12-13 10:20:54 UTC (rev 5817)
@@ -38,7 +38,7 @@
import org.jboss.portal.portlet.test.InstanceContextImpl;
import org.jboss.portal.portlet.test.support.PortletInvokerSupport;
import org.jboss.portal.portlet.test.support.PortletSupport;
-import org.jboss.portal.portlet.test.support.info.PortletInfoSupport;
+import org.jboss.portal.portlet.support.info.PortletInfoSupport;
import java.util.Collections;
import java.util.List;
19 years, 5 months
JBoss Portal SVN: r5816 - in trunk/wsrp/src/main/org/jboss/portal/wsrp: . producer
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2006-12-13 00:30:22 -0500 (Wed, 13 Dec 2006)
New Revision: 5816
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConstants.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/PortletManagementHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
Log:
- Added implementation for getPortletPropertyDescription (untested).
- Added stub to check user authorization, needs to be implemented.
- Now use key instead of display name for the property name. Need to check that this is correct!
- Moved common.LocalizedString to wsrp.LocalizedString conversion method to WSRPUtils.
- Added more creation methods to WSRPTypeFactory.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConstants.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConstants.java 2006-12-13 03:48:34 UTC (rev 5815)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConstants.java 2006-12-13 05:30:22 UTC (rev 5816)
@@ -25,6 +25,7 @@
import org.jboss.portal.server.PortalConstants;
+import javax.xml.namespace.QName;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Random;
@@ -166,7 +167,10 @@
/** The value of SessionContext.expires if the session will never expire. */
public static final int SESSION_NEVER_EXPIRES = -1;
+ /** A QName representing the string type defined as part of XML Schemas Part 2 */
+ public static final QName XSD_STRING = new QName("http://www.w3.org/2001/XMLSchema", "string");
+
private WSRPConstants()
{
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2006-12-13 03:48:34 UTC (rev 5815)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2006-12-13 05:30:22 UTC (rev 5816)
@@ -50,6 +50,8 @@
import org.jboss.portal.wsrp.core.PerformBlockingInteraction;
import org.jboss.portal.wsrp.core.PortletContext;
import org.jboss.portal.wsrp.core.PortletDescription;
+import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
+import org.jboss.portal.wsrp.core.PortletPropertyDescriptionResponse;
import org.jboss.portal.wsrp.core.Property;
import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.RegistrationContext;
@@ -662,6 +664,7 @@
* value(xsd:string), @xml:lang, @resourceName(xsd:string)?
*
* @return
+ * @since 2.6
*/
public static LocalizedString createLocalizedString(String lang, String resourceName, String value)
{
@@ -675,9 +678,34 @@
*
* @param value
* @return
+ * @since 2.6
*/
public static LocalizedString createLocalizedString(String value)
{
return createLocalizedString("en", null, value);
}
+
+ /**
+ * portletDescription(PortletDescription), resourceList(ResourceList)?, extensions(Extension)*
+ *
+ * @param portletDescription
+ * @return
+ * @since 2.6
+ */
+ public static PortletDescriptionResponse createPortletDescriptionResponse(PortletDescription portletDescription)
+ {
+ return new PortletDescriptionResponse(portletDescription, null, null);
+ }
+
+ /**
+ * modelDescription(ModelDescription)?, resourceList(ResourceList)?, extensions(Extension)*
+ *
+ * @param propertyDescriptions
+ * @return
+ * @since 2.6
+ */
+ public static PortletPropertyDescriptionResponse createPortletPropertyDescriptionResponse(PropertyDescription[] propertyDescriptions)
+ {
+ return new PortletPropertyDescriptionResponse(createModelDescription(propertyDescriptions), null, null);
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2006-12-13 03:48:34 UTC (rev 5815)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2006-12-13 05:30:22 UTC (rev 5816)
@@ -283,6 +283,11 @@
}
}
+ /**
+ * @param registrationInfo
+ * @return
+ * @since 2.6
+ */
public static ModelDescription convertRegistrationPropertiesToModelDescription(Map registrationInfo)
{
ParameterValidation.throwIllegalArgExceptionIfNull(registrationInfo, "registration info");
@@ -303,6 +308,11 @@
return WSRPTypeFactory.createModelDescription(propertyDescriptions);
}
+ /**
+ * @param propertyDescription
+ * @return
+ * @since 2.6
+ */
public static PropertyDescription convertToPropertyDescription(RegistrationPropertyDescription propertyDescription)
{
ParameterValidation.throwIllegalArgExceptionIfNull(propertyDescription, "RegistrationPropertyDescription");
@@ -323,12 +333,23 @@
return propDesc;
}
+ /**
+ * @param regLocalizedString
+ * @return
+ * @since 2.6
+ */
public static org.jboss.portal.wsrp.core.LocalizedString convertToWSRPLocalizedString(LocalizedString regLocalizedString)
{
+ ParameterValidation.throwIllegalArgExceptionIfNull(regLocalizedString, "LocalizedString");
return WSRPTypeFactory.createLocalizedString(LocaleInfo.getRFC3066LanguageTagFor(regLocalizedString.getLocale()),
regLocalizedString.getResourceName(), regLocalizedString.getValue());
}
+ /**
+ * @param consumerAgent
+ * @throws IllegalArgumentException
+ * @since 2.6
+ */
public static void validateConsumerAgent(String consumerAgent) throws IllegalArgumentException
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerAgent, "consumer agent", null);
@@ -346,4 +367,39 @@
}
throw new IllegalArgumentException("'" + consumerAgent + "' is not a valid Consumer Agent.");
}
+
+ /**
+ * Creates a WSRP LocalizedString based on the best (according to the specified desired locales) value of the given
+ * LocalizedString.
+ *
+ * @param localizedString the LocalizedString from which a localized value is to be extracted
+ * @param desiredLocales the supported locales orderd by user preference, if no desiredLocales are given, the
+ * default local will be used.
+ * @return the best (according to the specified desired locales) value for the given LocalizedString or
+ * <code>null</code> if no such value can be found.
+ * @since 2.6
+ */
+ public static org.jboss.portal.wsrp.core.LocalizedString convertToWSRPLocalizedString(org.jboss.portal.common.util.LocalizedString localizedString,
+ String[] desiredLocales)
+ {
+ if (localizedString == null)
+ {
+ return null;
+ }
+
+ if (desiredLocales == null || desiredLocales.length == 0)
+ {
+ desiredLocales = new String[]{LocaleInfo.getRFC3066LanguageTagFor(Locale.getDefault())};
+ }
+
+ org.jboss.portal.common.util.LocalizedString.Value bestMapping = localizedString.getPreferredOrBestLocalizedMappingFor(desiredLocales);
+ if (bestMapping != null)
+ {
+ Locale locale = bestMapping.getLocale();
+ String value = bestMapping.getString();
+ String language = LocaleInfo.decodeLocaleInfo(locale).getRFC3066LanguageTag();
+ return WSRPTypeFactory.createLocalizedString(language, null, value);
+ }
+ return null;
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/PortletManagementHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/PortletManagementHandler.java 2006-12-13 03:48:34 UTC (rev 5815)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/PortletManagementHandler.java 2006-12-13 05:30:22 UTC (rev 5816)
@@ -32,7 +32,9 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.info.PreferenceInfo;
+import org.jboss.portal.portlet.info.PreferencesInfo;
import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
@@ -52,8 +54,10 @@
import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
import org.jboss.portal.wsrp.core.PortletPropertyDescriptionResponse;
import org.jboss.portal.wsrp.core.Property;
+import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.PropertyList;
import org.jboss.portal.wsrp.core.SetPortletProperties;
+import org.jboss.portal.wsrp.core.UserContext;
import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
import java.rmi.RemoteException;
@@ -73,6 +77,7 @@
private static final String GET_PORTLET_PROPERTY_DESCRIPTION = "GetPortletPropertyDescription";
private static final String GET_PORTLET_PROPERTIES = "GetPortletProperties";
private static final String PORTLET_CONTEXT = "PortletContext";
+ private static final String GET_PORTLET_DESCRIPTION = "GetPortletDescription";
PortletManagementHandler(WSRPProducerImpl producer)
{
@@ -83,16 +88,24 @@
throws AccessDeniedFault, InvalidHandleFault, InvalidUserCategoryFault, InconsistentParametersFault,
MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
{
- WSRPUtils.throwOperationFailedFaultIfValueIsMissing(getPortletDescription, "getPortletDescription");
+ WSRPUtils.throwOperationFailedFaultIfValueIsMissing(getPortletDescription, GET_PORTLET_DESCRIPTION);
producer.checkRegistration(getPortletDescription.getRegistrationContext());
- String handle = getPortletDescription.getPortletContext().getPortletHandle();
- return new PortletDescriptionResponse(
- producer.getPortletDescription(handle, getPortletDescription.getDesiredLocales()),
- null, null);
+ PortletContext portletContext = getPortletDescription.getPortletContext();
+ WSRPUtils.throwMissingParametersFaultIfValueIsMissing(portletContext, PORTLET_CONTEXT, GET_PORTLET_DESCRIPTION);
+
+ String handle = portletContext.getPortletHandle();
+ WSRPUtils.throwMissingParametersFaultIfValueIsMissing(handle, "portlet handle", PORTLET_CONTEXT);
+
+ UserContext userContext = getPortletDescription.getUserContext();
+ checkUserAuthorization(userContext);
+
+ return WSRPTypeFactory.createPortletDescriptionResponse(producer.getPortletDescription(handle, getPortletDescription.getDesiredLocales()));
}
- public PortletPropertyDescriptionResponse getPortletPropertyDescription(GetPortletPropertyDescription getPortletPropertyDescription) throws MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault, AccessDeniedFault, InvalidHandleFault, OperationFailedFault, RemoteException
+ public PortletPropertyDescriptionResponse getPortletPropertyDescription(GetPortletPropertyDescription getPortletPropertyDescription)
+ throws MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
+ AccessDeniedFault, InvalidHandleFault, OperationFailedFault, RemoteException
{
WSRPUtils.throwOperationFailedFaultIfValueIsMissing(getPortletPropertyDescription, GET_PORTLET_PROPERTY_DESCRIPTION);
@@ -101,10 +114,37 @@
producer.checkRegistration(getPortletPropertyDescription.getRegistrationContext());
+ UserContext userContext = getPortletPropertyDescription.getUserContext();
+ checkUserAuthorization(userContext);
+
+ String[] desiredLocales = getPortletPropertyDescription.getDesiredLocales();
Portlet portlet = getPortletFrom(portletContext);
PortletInfo info = portlet.getInfo();
+ PreferencesInfo prefsInfo = info.getPreferences();
- return null; // todo: implement
+ PropertyDescription[] descs = null;
+ if (prefsInfo != null)
+ {
+ Set keySey = prefsInfo.getKeys();
+ descs = new PropertyDescription[keySey.size()];
+ int index = 0;
+ for (Iterator keys = keySey.iterator(); keys.hasNext();)
+ {
+ PreferenceInfo prefInfo = (PreferenceInfo)keys.next();
+
+ // WSRP Spec 8.7: return only the portion of the Portlet's persistent state is allowed to modify
+ if (!prefInfo.isReadOnly().booleanValue())
+ {
+ //todo: check what we should use key
+ PropertyDescription desc = WSRPTypeFactory.createPropertyDescription(prefInfo.getKey(), WSRPConstants.XSD_STRING);
+ desc.setLabel(WSRPUtils.convertToWSRPLocalizedString(prefInfo.getDisplayName(), desiredLocales));
+ desc.setHint(WSRPUtils.convertToWSRPLocalizedString(prefInfo.getDescription(), desiredLocales));
+ descs[index++] = desc;
+ }
+ }
+ }
+
+ return WSRPTypeFactory.createPortletPropertyDescriptionResponse(descs);
}
public PortletContext clonePortlet(ClonePortlet clonePortlet) throws InvalidUserCategoryFault, AccessDeniedFault, OperationFailedFault, InvalidHandleFault, InvalidRegistrationFault, InconsistentParametersFault, MissingParametersFault, RemoteException
@@ -131,6 +171,9 @@
producer.checkRegistration(getPortletProperties.getRegistrationContext());
+ UserContext userContext = getPortletProperties.getUserContext();
+ checkUserAuthorization(userContext);
+
String[] names = getPortletProperties.getNames();
Set keys = getKeysFromNames(names);
@@ -172,7 +215,7 @@
prefInfo = info.getPreferences().getPreference(key);
displayName = prefInfo.getDisplayName();
String lang = LocaleInfo.getRFC3066LanguageTagFor(displayName.getDefaultLocale());
- resProperties[i] = WSRPTypeFactory.createProperty(displayName.getDefaultString(), lang, value.asString());
+ resProperties[i] = WSRPTypeFactory.createProperty(key, lang, value.asString()); //todo: check what we should use key
}
result.setProperties(resProperties);
@@ -186,6 +229,15 @@
}
}
+ private void checkUserAuthorization(UserContext userContext)
+ {
+ //todo: implement
+ if (userContext != null)
+ {
+
+ }
+ }
+
private Set getKeysFromNames(String[] names)
{
Set keys = null;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2006-12-13 03:48:34 UTC (rev 5815)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2006-12-13 05:30:22 UTC (rev 5816)
@@ -25,7 +25,6 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.LocaleInfo;
-import org.jboss.portal.common.util.LocalizedString;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
@@ -182,11 +181,6 @@
{
log.debug("Constructing portlet description for: " + id);
- if (desiredLocales == null)
- {
- desiredLocales = new String[]{LocaleInfo.getRFC3066LanguageTagFor(Locale.getDefault())};
- }
-
CapabilitiesInfo capInfo = portletInfo.getCapabilities();
Collection allMimeTypes = capInfo.getMimeTypes();
MarkupType[] markupTypes = new MarkupType[allMimeTypes.size()];
@@ -210,21 +204,21 @@
MetaInfo metaInfo = portletInfo.getMeta();
// description
- desc.setDescription(getBestLocalizedValueFrom(metaInfo.getMetaValue(MetaInfo.DESCRIPTION), desiredLocales));
+ desc.setDescription(WSRPUtils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.DESCRIPTION), desiredLocales));
// short title
- desc.setShortTitle(getBestLocalizedValueFrom(metaInfo.getMetaValue(MetaInfo.SHORT_TITLE), desiredLocales));
+ desc.setShortTitle(WSRPUtils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.SHORT_TITLE), desiredLocales));
// title
- desc.setTitle(getBestLocalizedValueFrom(metaInfo.getMetaValue(MetaInfo.TITLE), desiredLocales));
+ desc.setTitle(WSRPUtils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.TITLE), desiredLocales));
// display name
- desc.setDisplayName(getBestLocalizedValueFrom(metaInfo.getMetaValue(MetaInfo.DISPLAY_NAME), desiredLocales));
+ desc.setDisplayName(WSRPUtils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.DISPLAY_NAME), desiredLocales));
// keywords
// metaInfo contains comma-separated keywords: we need to extract them into an array
org.jboss.portal.wsrp.core.LocalizedString concatenatedKeywords =
- getBestLocalizedValueFrom(metaInfo.getMetaValue(MetaInfo.KEYWORDS), desiredLocales);
+ WSRPUtils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.KEYWORDS), desiredLocales);
if (concatenatedKeywords != null)
{
String commaSeparatedKeywords = concatenatedKeywords.getValue();
@@ -298,30 +292,4 @@
return result;
}
-
- /**
- * Retrieves the best (according to the specified desired locales) value for the given localized portlet metadata.
- *
- * @param portletMetadata the localized metadata from which a localized value is to be extracted
- * @param desiredLocales the supported locales orderd by user preference
- * @return the best (according to the specified desired locales) value for the given localized portlet metadata or
- * <code>null</code> if no such value can be found.
- */
- private org.jboss.portal.wsrp.core.LocalizedString getBestLocalizedValueFrom(LocalizedString portletMetadata, String[] desiredLocales)
- {
- if (portletMetadata == null)
- {
- return null;
- }
-
- LocalizedString.Value bestMapping = portletMetadata.getPreferredOrBestLocalizedMappingFor(desiredLocales);
- if (bestMapping != null)
- {
- Locale locale = bestMapping.getLocale();
- String value = bestMapping.getString();
- String language = LocaleInfo.decodeLocaleInfo(locale).getRFC3066LanguageTag();
- return WSRPTypeFactory.createLocalizedString(language, null, value);
- }
- return null;
- }
}
19 years, 5 months
JBoss Portal SVN: r5815 - trunk/wsrp/src/resources/portal-wsrp-sar
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2006-12-12 22:48:34 -0500 (Tue, 12 Dec 2006)
New Revision: 5815
Modified:
trunk/wsrp/src/resources/portal-wsrp-sar/default-wsrp.xml
Log:
Added minimal registration data since default configuration requires registration for our producer.
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/default-wsrp.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/default-wsrp.xml 2006-12-13 03:47:58 UTC (rev 5814)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/default-wsrp.xml 2006-12-13 03:48:34 UTC (rev 5815)
@@ -37,6 +37,7 @@
<registration-url>http://localhost:8080/portal-wsrp/RegistrationService</registration-url>
<portlet-management-url>http://localhost:8080/portal-wsrp/PortletManagementService</portlet-management-url>
</endpoint-config>
+ <registration-data/>
</wsrp-producer>
</deployment>
<!--<deployment>
19 years, 5 months
JBoss Portal SVN: r5814 - trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2006-12-12 22:47:58 -0500 (Tue, 12 Dec 2006)
New Revision: 5814
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
Log:
Improved handling of missing registration data so that it can be more easily reported to users.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2006-12-12 22:44:20 UTC (rev 5813)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2006-12-13 03:47:58 UTC (rev 5814)
@@ -538,16 +538,17 @@
else
{
ModelDescription registrationProperties = serviceDescription.getRegistrationPropertyDescription();
- log.info("Producer " + producerId + " requires registration yet configuration of this producer " +
- "does not provide any registration data. You must at least provide a consumer-name in the " +
- "configuration for this producer. Please refer to the documentation.");
+ StringBuffer message = new StringBuffer("Producer '").append(producerId)
+ .append("' requires registration yet configuration of this producer does not provide any ")
+ .append("registration data. Please refer to the documentation on how to configure a remote producer.");
+ log.info(message);
if (registrationProperties != null)
{
PropertyDescription[] propertyDescriptions = registrationProperties.getPropertyDescriptions();
if (propertyDescriptions != null)
{
- log.info("Additionally, the producer required the following registration information: ");
+ message.append("\nAdditionally, the producer required the following registration information: ");
for (int i = 0; i < propertyDescriptions.length; i++)
{
PropertyDescription propertyDescription = propertyDescriptions[i];
@@ -557,14 +558,13 @@
String label = nillableLabel == null ? null : nillableLabel.getValue();
LocalizedString nillableHint = propertyDescription.getHint();
String hint = nillableHint == null ? null : nillableHint.getValue();
- log.info("propertyDescription =\n"
- + "- name:\t" + name + "\n"
- + "- type:\t" + type + "\n"
- + "- label:\t" + label + "\n"
- + "- hint:\t" + hint + "\n");
+ message.append("propertyDescription =\n- name:\t").append(name).append("\n- type:\t")
+ .append(type).append("\n- label:\t").append(label).append("\n- hint:\t").append(hint)
+ .append("\n");
}
}
}
+ throw new ServiceDescriptionUnavailableException(message.toString(), null);
}
}
@@ -582,6 +582,10 @@
throw new NullPointerException("null service description: deal with it!");
}
}
+ catch (ServiceDescriptionUnavailableException e)
+ {
+ throw e;
+ }
catch (Exception e)
{
log.debug(e);
19 years, 5 months
JBoss Portal SVN: r5813 - in trunk: core/src/main/org/jboss/portal/core/impl/model/instance core/src/main/org/jboss/portal/core/model/instance security/src/main/org/jboss/portal/security
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-12 17:44:20 -0500 (Tue, 12 Dec 2006)
New Revision: 5813
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/instance/PersistentInstanceContainer.java
trunk/core/src/main/org/jboss/portal/core/model/instance/InstancePermission.java
trunk/security/src/main/org/jboss/portal/security/PortalSecurityException.java
Log:
- JBPORTAL-1158 : Secure instances in dashboard configurator
- made portal security exception unchecked
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/instance/PersistentInstanceContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/instance/PersistentInstanceContainer.java 2006-12-12 21:37:36 UTC (rev 5812)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/instance/PersistentInstanceContainer.java 2006-12-12 22:44:20 UTC (rev 5813)
@@ -37,6 +37,7 @@
import org.jboss.portal.core.model.instance.InstanceDefinition;
import org.jboss.portal.core.model.instance.InstancePermission;
import org.jboss.portal.core.model.instance.NoSuchInstanceException;
+import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.jems.hibernate.ObjectContextualizer;
import org.jboss.portal.portlet.PortletContext;
@@ -52,6 +53,7 @@
import org.jboss.portal.security.SecurityConstants;
import org.jboss.portal.security.impl.JBossAuthorizationDomainRegistry;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
import org.jboss.portal.security.spi.provider.AuthorizationDomain;
import org.jboss.portal.security.spi.provider.DomainConfigurator;
import org.jboss.portal.security.spi.provider.PermissionFactory;
@@ -432,8 +434,26 @@
public Collection getInstances()
{
+ //
+ PortalAuthorizationManager mgr = portalAuthorizationManagerFactory.getManager();
+
+ //
Session session = ctx.getCurrentSession();
- return session.createQuery("from InstanceDefinitionImpl").list();
+ List list = session.createQuery("from InstanceDefinitionImpl").list();
+
+ // Filter the list
+ for (Iterator i = list.iterator();i.hasNext();)
+ {
+ Instance instance = (Instance)i.next();
+ InstancePermission perm = new InstancePermission(instance.getId(), InstancePermission.VIEW_ACTION);
+ if (mgr.checkPermission(perm) == false)
+ {
+ i.remove();
+ }
+ }
+
+ //
+ return list;
}
PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/InstancePermission.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/InstancePermission.java 2006-12-12 21:37:36 UTC (rev 5812)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/InstancePermission.java 2006-12-12 22:44:20 UTC (rev 5813)
@@ -48,9 +48,33 @@
/** The view action name. */
public static final String VIEW_ACTION = "view";
+ /** The create action name. */
+ public static final String CREATE_ACTION = "create";
+
+ /** The destroy action name. */
+ public static final String DESTROY_ACTION = "destroy";
+
+ /** The customize action name. */
+ public static final String CUSTOMIZE_ACTION = "customize";
+
+ /** The customize action name. */
+ public static final String ADMIN_ACTION = "admin";
+
/** . */
public static final int VIEW_MASK = 0x01;
+ /** . */
+ public static final int CREATE_MASK = 0x02;
+
+ /** . */
+ public static final int DESTROY_MASK = 0x04;
+
+ /** . */
+ public static final int CUSTOMIZE_MASK = 0x08;
+
+ /** . */
+ public static final int ADMIN_MASK = VIEW_MASK | CREATE_MASK | DESTROY_MASK | CUSTOMIZE_MASK;
+
/** The imply mask. */
private int mask;
@@ -61,7 +85,7 @@
public static final String PERMISSION_TYPE = "instance";
/** The action names. */
- private static final String[] ACTION_NAMES = {VIEW_ACTION};
+ private static final String[] ACTION_NAMES = {VIEW_ACTION,CREATE_ACTION,DESTROY_ACTION,CUSTOMIZE_ACTION};
public InstancePermission(PortalPermissionCollection collection)
{
@@ -113,6 +137,22 @@
{
mask |= VIEW_MASK;
}
+ else if (CREATE_ACTION.equals(action))
+ {
+ mask |= CREATE_MASK;
+ }
+ else if (DESTROY_ACTION.equals(action))
+ {
+ mask |= DESTROY_MASK;
+ }
+ else if (CUSTOMIZE_ACTION.equals(action))
+ {
+ mask |= CUSTOMIZE_MASK;
+ }
+ else if (ADMIN_ACTION.equals(action))
+ {
+ mask |= ADMIN_MASK;
+ }
else
{
throw new IllegalArgumentException("Illegal action " + action);
Modified: trunk/security/src/main/org/jboss/portal/security/PortalSecurityException.java
===================================================================
--- trunk/security/src/main/org/jboss/portal/security/PortalSecurityException.java 2006-12-12 21:37:36 UTC (rev 5812)
+++ trunk/security/src/main/org/jboss/portal/security/PortalSecurityException.java 2006-12-12 22:44:20 UTC (rev 5813)
@@ -28,7 +28,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class PortalSecurityException extends Exception
+public class PortalSecurityException extends RuntimeException
{
/** The serialVersionUID */
private static final long serialVersionUID = -6743601619857049697L;
19 years, 5 months
JBoss Portal SVN: r5812 - docs/tags
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-12 16:37:36 -0500 (Tue, 12 Dec 2006)
New Revision: 5812
Added:
docs/tags/JBoss_Portal_2_4_1/
Log:
tagging 2.4.1
Copied: docs/tags/JBoss_Portal_2_4_1 (from rev 5811, docs/branches/JBoss_Portal_Branch_2_4)
19 years, 5 months
JBoss Portal SVN: r5811 - tags
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-12 16:37:14 -0500 (Tue, 12 Dec 2006)
New Revision: 5811
Added:
tags/JBoss_Portal_2_4_1/
Log:
tagging 2.4.1
Copied: tags/JBoss_Portal_2_4_1 (from rev 5810, branches/JBoss_Portal_Branch_2_4)
19 years, 5 months
JBoss Portal SVN: r5810 - trunk/core/src/main/org/jboss/portal/core/aspects/controller
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-12-12 15:49:17 -0500 (Tue, 12 Dec 2006)
New Revision: 5810
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
Log:
im not sure what the cms admin tool link was supposed to do, but i commented it out.
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-12-12 18:42:45 UTC (rev 5809)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-12-12 20:49:17 UTC (rev 5810)
@@ -251,13 +251,15 @@
sb.append(" | ");
- //inject CMS Admin link
+ //inject CMS Admin link TODO: what is this?!
+/*
if (user != null && showadminURL == null)
{
sb.append("<a href=\"").append("/portal/portal/cms").append("\">CMS Admin Tool</a>");
}
sb.append(" | ");
+*/
sb.append("<a href=\"").append(logoutURL).append("\">Logout</a>");
}
19 years, 5 months
JBoss Portal SVN: r5809 - trunk/core/src/main/org/jboss/portal/core/aspects/controller
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-12-12 13:42:45 -0500 (Tue, 12 Dec 2006)
New Revision: 5809
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
Log:
removing unused vars
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-12-12 18:40:49 UTC (rev 5808)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-12-12 18:42:45 UTC (rev 5809)
@@ -67,8 +67,6 @@
*/
public class PageCustomizerInterceptor extends ControllerInterceptor
{
- private PortalObjectId dashboardId = PortalObjectId.parse("/dashboard", PortalObjectId.CANONICAL_FORMAT);
-
/** . */
private static final String RESOURCE_PREFIX = "PAGENAME_";
19 years, 5 months