JBoss Portal SVN: r7218 - in trunk/core-admin/src: resources/portal-admin-war/WEB-INF/jsf and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-07 09:38:07 -0400 (Mon, 07 May 2007)
New Revision: 7218
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard/NewWindowWizard.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objects.xhtml
Log:
Fix: JBPORTAL-1382 Switching into, out of and back into Wizard Mode in the admin portlet doesn't reset the step state properly
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard/NewWindowWizard.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard/NewWindowWizard.java 2007-05-07 13:28:04 UTC (rev 7217)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard/NewWindowWizard.java 2007-05-07 13:38:07 UTC (rev 7218)
@@ -271,7 +271,7 @@
selectedPortletInvokerId = null;
selectedParentPageId = null;
currentStep = 0;
- return "index";
+ return "wizardMode";
}
public List getRegions()
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objects.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objects.xhtml 2007-05-07 13:28:04 UTC (rev 7217)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objects.xhtml 2007-05-07 13:38:07 UTC (rev 7218)
@@ -21,7 +21,7 @@
</c:choose>
<h:form>
- <p style="text-align: right"><h:commandLink action="wizardMode">Switch to wizard mode</h:commandLink></p>
+ <p style="text-align: right"><h:commandLink action="#{newWindowWizard.reset}">Switch to wizard mode</h:commandLink></p>
</h:form>
</div>
18 years, 12 months
JBoss Portal SVN: r7217 - in trunk/core-admin/src: resources/portal-admin-war/WEB-INF/jsf/wizard and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-07 09:28:04 -0400 (Mon, 07 May 2007)
New Revision: 7217
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard/NewWindowWizard.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard/selectPage.xhtml
Log:
Fix JBPORTAL-1381: When selecting a Sub Page in the Add Portlet Wizard Mode, there is no way to navigate up to a parent pageWhen selecting a Sub Page in the Add Portlet Wizard Mode, there is no way to navigate up to a parent page
Fix JBPORTAL-1384: User can go to step 2 in Wizard Mode without selecting a Portlet Window
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard/NewWindowWizard.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard/NewWindowWizard.java 2007-05-07 13:23:00 UTC (rev 7216)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard/NewWindowWizard.java 2007-05-07 13:28:04 UTC (rev 7217)
@@ -112,6 +112,7 @@
currentStep = 2;
selectedPageId = null;
selectedRegionId = null;
+ selectedParentPageId = selectedPortalId;
return (String)steps.get(currentStep);
}
@@ -132,6 +133,16 @@
return (String)steps.get(currentStep);
}
+ public String up()
+ {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ String id = (String)ctx.getExternalContext().getRequestParameterMap().get("id");
+ Page page = (Page)getObjectFromId(id);
+ selectedParentPageId = page.getParent().getId().toString(PortalObjectId.LEGACY_BASE64_FORMAT);
+ currentStep = 2;
+ return (String)steps.get(currentStep);
+ }
+
public String selectRegion()
{
FacesContext ctx = FacesContext.getCurrentInstance();
@@ -166,9 +177,9 @@
return (Page)getObjectFromId(selectedPageId);
}
- public Page getSelectedParentPage()
+ public PortalObject getSelectedParentPage()
{
- return (Page)getObjectFromId(selectedParentPageId);
+ return (PortalObject)getObjectFromId(selectedParentPageId);
}
public Portal getSelectedPortal()
@@ -291,6 +302,11 @@
return selectedPageId;
}
+ public String getSelectedParentPageId()
+ {
+ return selectedParentPageId;
+ }
+
public String getSelectedRegionId()
{
return selectedRegionId;
@@ -348,6 +364,10 @@
public boolean getNextEnabled()
{
+ if (currentStep == 0)
+ {
+ return (selectedPortletId != null);
+ }
if (currentStep == 1)
{
return (selectedPortalId != null);
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard/selectPage.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard/selectPage.xhtml 2007-05-07 13:23:00 UTC (rev 7216)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/wizard/selectPage.xhtml 2007-05-07 13:28:04 UTC (rev 7217)
@@ -17,6 +17,10 @@
</tbody>
<tbody>
<h:form>
+ <h:commandLink action="#{newWindowWizard.up}" rendered="#{newWindowWizard.selectedParentPage.type != 1}">
+ <h:outputText value="Up"/>
+ <f:param name="id" value="#{newWindowWizard.selectedParentPageId}"/>
+ </h:commandLink>
<c:forEach items="#{newWindowWizard.pages}" var="object" varStatus="status">
<tr
class="#{object.id == newWindowWizard.selectedPageId ? 'portlet-section-selected' : status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate'}">
18 years, 12 months
JBoss Portal SVN: r7216 - trunk/build/ide/intellij/idea60/modules/demo.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-07 09:23:00 -0400 (Mon, 07 May 2007)
New Revision: 7216
Modified:
trunk/build/ide/intellij/idea60/modules/demo/demo.iml
Log:
use SVN VCS for demo module in idea
Modified: trunk/build/ide/intellij/idea60/modules/demo/demo.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/demo/demo.iml 2007-05-07 13:22:29 UTC (rev 7215)
+++ trunk/build/ide/intellij/idea60/modules/demo/demo.iml 2007-05-07 13:23:00 UTC (rev 7216)
@@ -8,5 +8,9 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntryProperties />
</component>
+ <component name="VcsManagerConfiguration">
+ <option name="ACTIVE_VCS_NAME" value="svn" />
+ <option name="USE_PROJECT_VCS" value="false" />
+ </component>
</module>
18 years, 12 months
JBoss Portal SVN: r7215 - trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-07 09:22:29 -0400 (Mon, 07 May 2007)
New Revision: 7215
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java
Log:
minor javadoc
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java 2007-05-07 13:11:49 UTC (rev 7214)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java 2007-05-07 13:22:29 UTC (rev 7215)
@@ -34,6 +34,8 @@
import java.util.Map;
/**
+ * An in memory implementation of the producer state persistence manager.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
@@ -46,7 +48,6 @@
/** . */
private int counter = 0;
-
public synchronized PortletStateContext loadState(String stateId) throws IllegalArgumentException, NoSuchStateException, InvalidStateIdException
{
if (stateId == null)
18 years, 12 months
JBoss Portal SVN: r7214 - in trunk: build/ide/intellij/idea60/modules and 5 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-07 09:11:49 -0400 (Mon, 07 May 2007)
New Revision: 7214
Added:
trunk/build/ide/intellij/idea60/modules/demo/
trunk/build/ide/intellij/idea60/modules/demo/demo.iml
trunk/demo/
trunk/demo/build.bat
trunk/demo/build.sh
trunk/demo/build.xml
trunk/demo/src/
trunk/demo/src/etc/
trunk/demo/src/main/
trunk/demo/src/resources/
Modified:
trunk/samples/build.xml
trunk/web/build.xml
Log:
added demo module that will contain a packaged demo version of JBP
Added: trunk/build/ide/intellij/idea60/modules/demo/demo.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/demo/demo.iml (rev 0)
+++ trunk/build/ide/intellij/idea60/modules/demo/demo.iml 2007-05-07 13:11:49 UTC (rev 7214)
@@ -0,0 +1,12 @@
+<?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$/../../../../../../demo" />
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntryProperties />
+ </component>
+</module>
+
Added: trunk/demo/build.bat
===================================================================
--- trunk/demo/build.bat (rev 0)
+++ trunk/demo/build.bat 2007-05-07 13:11:49 UTC (rev 7214)
@@ -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 2 2005-01-14 23:01:32Z vietj $
+
+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/demo/build.bat
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/demo/build.sh
===================================================================
--- trunk/demo/build.sh (rev 0)
+++ trunk/demo/build.sh 2007-05-07 13:11:49 UTC (rev 7214)
@@ -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 2 2005-01-14 23:01:32Z vietj $
+
+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/demo/build.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/demo/build.xml
===================================================================
--- trunk/demo/build.xml (rev 0)
+++ trunk/demo/build.xml 2007-05-07 13:11:49 UTC (rev 7214)
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+ <!ENTITY buildmagic SYSTEM "../tools/etc/buildfragments/buildmagic.ent">
+ <!ENTITY tools SYSTEM "../tools/etc/buildfragments/tools.ent">
+ <!ENTITY libraries SYSTEM "../thirdparty/libraries.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 7200 2007-05-06 16:33:54Z julien(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>
+
+ <!-- Configure modules -->
+ <call target="configure-modules"/>
+ <path id="dependentmodule.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="generate-parsers,
+ _default:compile-classes,
+ _default:compile-etc,
+ _default:compile-resources">
+ <!-- Add module specific elements here. -->
+ </target>
+
+ <target name="generate-parsers" depends="init">
+ </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">
+ </target>
+
+ <!-- generates artifacts used for tests, requires output to be previously run -->
+ <target name="package-tests" depends="init">
+ </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"/>
+
+ <target name="tests" depends="init">
+ </target>
+
+</project>
Property changes on: trunk/demo/build.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/samples/build.xml
===================================================================
--- trunk/samples/build.xml 2007-05-07 09:30:12 UTC (rev 7213)
+++ trunk/samples/build.xml 2007-05-07 13:11:49 UTC (rev 7214)
@@ -244,4 +244,7 @@
</junit>
</target>
+
+ <target name="package-tests"/>
+
</project>
Modified: trunk/web/build.xml
===================================================================
--- trunk/web/build.xml 2007-05-07 09:30:12 UTC (rev 7213)
+++ trunk/web/build.xml 2007-05-07 13:11:49 UTC (rev 7214)
@@ -183,4 +183,6 @@
<!-- Deployment -->
<!-- ================================================================== -->
+ <target name="package-tests"/>
+
</project>
18 years, 12 months
JBoss Portal SVN: r7213 - trunk/core/src/bin/portal-core-war/themes/phalanx/images.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-07 05:30:12 -0400 (Mon, 07 May 2007)
New Revision: 7213
Modified:
trunk/core/src/bin/portal-core-war/themes/phalanx/images/edit.gif
trunk/core/src/bin/portal-core-war/themes/phalanx/images/help.gif
trunk/core/src/bin/portal-core-war/themes/phalanx/images/maximize.gif
trunk/core/src/bin/portal-core-war/themes/phalanx/images/minimize.gif
trunk/core/src/bin/portal-core-war/themes/phalanx/images/modes_bg.gif
trunk/core/src/bin/portal-core-war/themes/phalanx/images/modes_right.gif
trunk/core/src/bin/portal-core-war/themes/phalanx/images/normal.gif
trunk/core/src/bin/portal-core-war/themes/phalanx/images/view.gif
Log:
Revert icons
Modified: trunk/core/src/bin/portal-core-war/themes/phalanx/images/edit.gif
===================================================================
(Binary files differ)
Modified: trunk/core/src/bin/portal-core-war/themes/phalanx/images/help.gif
===================================================================
(Binary files differ)
Modified: trunk/core/src/bin/portal-core-war/themes/phalanx/images/maximize.gif
===================================================================
(Binary files differ)
Modified: trunk/core/src/bin/portal-core-war/themes/phalanx/images/minimize.gif
===================================================================
(Binary files differ)
Modified: trunk/core/src/bin/portal-core-war/themes/phalanx/images/modes_bg.gif
===================================================================
(Binary files differ)
Modified: trunk/core/src/bin/portal-core-war/themes/phalanx/images/modes_right.gif
===================================================================
(Binary files differ)
Modified: trunk/core/src/bin/portal-core-war/themes/phalanx/images/normal.gif
===================================================================
(Binary files differ)
Modified: trunk/core/src/bin/portal-core-war/themes/phalanx/images/view.gif
===================================================================
(Binary files differ)
18 years, 12 months
JBoss Portal SVN: r7212 - trunk/core/src/bin/portal-core-war/themes/phalanx.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-07 05:20:07 -0400 (Mon, 07 May 2007)
New Revision: 7212
Modified:
trunk/core/src/bin/portal-core-war/themes/phalanx/portal_style.css
Log:
Background in wrong position
Modified: trunk/core/src/bin/portal-core-war/themes/phalanx/portal_style.css
===================================================================
--- trunk/core/src/bin/portal-core-war/themes/phalanx/portal_style.css 2007-05-07 04:34:38 UTC (rev 7211)
+++ trunk/core/src/bin/portal-core-war/themes/phalanx/portal_style.css 2007-05-07 09:20:07 UTC (rev 7212)
@@ -183,7 +183,6 @@
margin: 0px;
padding: 0px;
min-width: 250px;
- height: 300px;
}
#regionB {
@@ -195,7 +194,6 @@
padding: 0px; /* test to add 3rd region in layout...*/
width: 67%;
float: left;
- height: 300px;
}
#regionC {
@@ -205,7 +203,6 @@
width: 28%;
float: left; /*hide 3rd region*/
display: none;
- height: 300px;
}
#footer-container {
18 years, 12 months
JBoss Portal SVN: r7211 - in trunk/wsrp/src: main/org/jboss/portal/wsrp and 3 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-05-07 00:34:38 -0400 (Mon, 07 May 2007)
New Revision: 7211
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml
Log:
- JBPORTAL-715: Initial support for modifyRegistration (still buggy).
- RegistrationInfo.refresh now maintains a status of whether the registration is valid or not.
- ProducerInfo.refresh can force refreshing the registration information from the producer.
- Removed WSRPConsumer.refreshRegistrationInfo.
- Better updating of Producer state in DB.
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java 2007-05-07 04:28:58 UTC (rev 7210)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java 2007-05-07 04:34:38 UTC (rev 7211)
@@ -36,7 +36,6 @@
import org.jboss.portal.wsrp.consumer.ProducerInfo;
import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
import org.jboss.portal.wsrp.consumer.RefreshResult;
-import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import org.jboss.portal.wsrp.services.ServiceFactory;
import javax.servlet.http.HttpSession;
@@ -102,11 +101,6 @@
{
}
- public RegistrationInfo.RegistrationRefreshResult refreshRegistrationInfo(boolean eraseLocalData) throws PortletInvokerException
- {
- return null;
- }
-
public boolean isActive()
{
return true;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java 2007-05-07 04:28:58 UTC (rev 7210)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java 2007-05-07 04:34:38 UTC (rev 7211)
@@ -29,7 +29,6 @@
import org.jboss.portal.wsrp.consumer.ProducerInfo;
import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
import org.jboss.portal.wsrp.consumer.RefreshResult;
-import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import org.jboss.system.Service;
import javax.servlet.http.HttpSession;
@@ -109,20 +108,9 @@
void deactivate() throws Exception;
/**
- * Refreshes the Registration information required by the remote producer.
- *
- * @param eraseLocalData <code>true</code> if the local data should be used and validated, <code>false</code> if the
- * local data should be ignored and replaced by empty values for each of the required
- * properties.
* @return
* @since 2.6
*/
- RegistrationInfo.RegistrationRefreshResult refreshRegistrationInfo(boolean eraseLocalData) throws PortletInvokerException;
-
- /**
- * @return
- * @since 2.6
- */
boolean isActive();
/**
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2007-05-07 04:28:58 UTC (rev 7210)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2007-05-07 04:34:38 UTC (rev 7211)
@@ -26,7 +26,7 @@
import org.jboss.portal.wsrp.WSRPConsumer;
import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
import org.jboss.portal.wsrp.consumer.ProducerInfo;
-import org.jboss.portal.wsrp.consumer.RegistrationInfo;
+import org.jboss.portal.wsrp.consumer.RefreshResult;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
@@ -179,6 +179,11 @@
return getProducerInfo().isRegistrationChecked();
}
+ public boolean isRegistrationValid()
+ {
+ return getProducerInfo().getRegistrationInfo().isRegistrationValid();
+ }
+
public ProducerInfo getProducerInfo()
{
return consumer.getProducerInfo();
@@ -216,11 +221,11 @@
{
if (consumer != null)
{
- String param = getParameter("eraseLocalData");
- boolean eraseLocalData = Boolean.valueOf(param).booleanValue();
+ String param = getParameter("mergeLocalInfo");
+ boolean mergeLocalInfo = Boolean.valueOf(param).booleanValue();
try
{
- RegistrationInfo.RegistrationRefreshResult result = consumer.refreshRegistrationInfo(eraseLocalData);
+ RefreshResult result = getProducerInfo().refreshRegistrationInfo(mergeLocalInfo);
if (result.hasIssues())
{
createErrorMessage(result.getStatus());
@@ -242,6 +247,27 @@
return null;
}
+ public String modifyRegistration()
+ {
+ if (consumer != null)
+ {
+ try
+ {
+ getProducerInfo().modifyRegistration();
+ createInfoMessage(null, "Successfully modified Registration!");
+ }
+ catch (Exception e)
+ {
+ createErrorMessageFrom(e);
+ return null;
+ }
+ return null;
+ }
+
+ createErrorMessage("Couldn't modify Registration!");
+ return null;
+ }
+
// Listeners
public void useWSDLListener(ValueChangeEvent event)
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-05-07 04:28:58 UTC (rev 7210)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-05-07 04:34:38 UTC (rev 7211)
@@ -39,10 +39,12 @@
import org.jboss.portal.wsrp.core.GetPortletPropertyDescription;
import org.jboss.portal.wsrp.core.GetServiceDescription;
import org.jboss.portal.wsrp.core.InvalidHandleFault;
+import org.jboss.portal.wsrp.core.ModifyRegistration;
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.RegistrationContext;
+import org.jboss.portal.wsrp.core.RegistrationState;
import org.jboss.portal.wsrp.core.ServiceDescription;
import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
import org.jboss.portal.wsrp.servlet.UserAccess;
@@ -275,7 +277,7 @@
if (serviceDescription.isRequiresRegistration())
{
// attempt to register and determine if the current service description can be used to extract POPs
- RefreshResult registrationResult = register(serviceDescription);
+ RefreshResult registrationResult = register(serviceDescription, forceRefresh);
if (registrationResult.specificCode())
{
// registration occurred, so we should ask for a new service description
@@ -632,26 +634,27 @@
public void register() throws PortletInvokerException
{
- register(null);
+ register(null, false);
}
/**
* Attempts to register with the producer.
*
* @param serviceDescription
+ * @param forceRefresh
* @return <code>true</code> if the client code should ask for a new service description, <code>false</code> if the
* specified description is good to be further processed
* @throws PortletInvokerException
* @since 2.6
*/
- private RefreshResult register(ServiceDescription serviceDescription) throws PortletInvokerException
+ private RefreshResult register(ServiceDescription serviceDescription, boolean forceRefresh) throws PortletInvokerException
{
if (persistentRegistrationInfo == null)
{
persistentRegistrationInfo = new RegistrationInfo(this);
}
- if (!isRegistered())
+ if (forceRefresh || !isRegistered())
{
if (serviceDescription == null)
@@ -662,7 +665,7 @@
if (serviceDescription.isRequiresRegistration())
{
// check if the configured registration information is correct and if we can get the service description
- RefreshResult result = persistentRegistrationInfo.refresh(serviceDescription, persistentId, true, false);
+ RefreshResult result = persistentRegistrationInfo.refresh(serviceDescription, persistentId, true, forceRefresh);
if (!result.hasIssues())
{
try
@@ -715,19 +718,48 @@
{
persistentEndpointInfo.getRegistrationService().deregister(getRegistrationContext());
persistentRegistrationInfo.resetRegistration();
- registry.updateProducerInfo(this);
log.info("Consumer with id '" + persistentId + "' deregistered.");
}
catch (Exception e)
{
throw new PortletInvokerException("Couldn't deregister with producer '" + persistentId + "'", e);
}
+ finally
+ {
+ registry.updateProducerInfo(this);
+ }
}
}
- public RegistrationInfo.RegistrationRefreshResult refreshRegistrationInfo(boolean mergeWithLocalInfo) throws PortletInvokerException
+ public void modifyRegistration() throws PortletInvokerException
{
+ if (isRegistered())
+ {
+ try
+ {
+ ModifyRegistration modifyRegistration = WSRPTypeFactory.createModifyRegistration(getRegistrationContext(),
+ persistentRegistrationInfo.getRegistrationData());
+ RegistrationState state = persistentEndpointInfo.getRegistrationService().modifyRegistration(modifyRegistration);
+ if (state != null)
+ {
+ persistentRegistrationInfo.setRegistrationState(state.getRegistrationState());
+ }
+ log.info("Consumer with id '" + persistentId + "' sucessfully modified its registration.");
+ }
+ catch (Exception e)
+ {
+ throw new PortletInvokerException("Couldn't modify registration with producer '" + persistentId + "'", e);
+ }
+ finally
+ {
+ registry.updateProducerInfo(this);
+ }
+ }
+ }
+
+ public RefreshResult refreshRegistrationInfo(boolean mergeWithLocalInfo) throws PortletInvokerException
+ {
if (persistentRegistrationInfo == null)
{
persistentRegistrationInfo = new RegistrationInfo(this);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-05-07 04:28:58 UTC (rev 7210)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-05-07 04:34:38 UTC (rev 7211)
@@ -24,7 +24,6 @@
package org.jboss.portal.wsrp.consumer;
import org.jboss.logging.Logger;
-import org.jboss.portal.common.i18n.LocaleFormat;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
@@ -63,9 +62,9 @@
private Map persistentRegistrationProperties;
private transient Boolean requiresRegistration;
-
+ private transient Boolean isRegistrationValid;
private transient RegistrationData registrationData;
- private boolean dirty;
+ private transient boolean dirty;
public RegistrationInfo(ProducerInfo producerInfo)
{
@@ -240,7 +239,6 @@
private Map getOrCreateRegistrationPropertiesMap(boolean forceCreate)
{
- // todo: get from registration
if (forceCreate && persistentRegistrationProperties == null)
{
persistentRegistrationProperties = new HashMap();
@@ -386,6 +384,9 @@
result.setRegistrationProperties(persistentRegistrationProperties);
}
+ // if issues have been detected, mark the registration as invalid (but do not reset the data)
+ isRegistrationValid = Boolean.valueOf(!result.hasIssues());
+
String msg = "Registration configuration is " + (result.hasIssues() ? "NOT" : "") + " valid";
result.appendToStatus(msg);
log.debug(msg);
@@ -403,8 +404,8 @@
private void handleNoRequiredRegistrationProperties(String producerId, RegistrationRefreshResult result, boolean keepExtra)
{
log.info("The producer didn't require any specific registration properties");
- Map properties = getRegistrationProperties();
- if (!properties.isEmpty())
+ Map properties = getOrCreateRegistrationPropertiesMap(false);
+ if (properties != null && !properties.isEmpty())
{
String msg = "Registration data is available for producer '"
+ producerId + "' when none is expected by the producer";
@@ -500,8 +501,7 @@
public boolean isRegistrationValid()
{
- return (persistentRegistrationHandle != null && isRegistrationDeterminedRequired()) ||
- isRegistrationDeterminedNotRequired();
+ return isRegistrationValid != null && isRegistrationValid.booleanValue();
}
public void setRegistrationContext(RegistrationContext registrationContext)
@@ -529,7 +529,7 @@
public boolean isRefreshNeeded()
{
- return dirty || requiresRegistration == null;
+ return dirty || requiresRegistration == null || isRegistrationValid == null;
}
public class RegistrationRefreshResult extends RefreshResult
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-05-07 04:28:58 UTC (rev 7210)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-05-07 04:34:38 UTC (rev 7211)
@@ -24,7 +24,6 @@
import org.jboss.portal.api.event.PortalEvent;
import org.jboss.portal.api.event.PortalEventContext;
-import org.jboss.portal.common.i18n.LocaleFormat;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.common.value.StringValue;
@@ -493,11 +492,6 @@
}
}
- public RegistrationInfo.RegistrationRefreshResult refreshRegistrationInfo(boolean mergeWithLocalInfo) throws PortletInvokerException
- {
- return producerInfo.refreshRegistrationInfo(mergeWithLocalInfo);
- }
-
public boolean isActive()
{
return producerInfo.isActive() && started;
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-05-07 04:28:58 UTC (rev 7210)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-05-07 04:34:38 UTC (rev 7211)
@@ -118,19 +118,34 @@
</td>
</tr>
</c:if>
- <c:if test="#{!consumer.registrationChecked}">
- <tr>
- <td colspan="2">
- <p class="info">Registration information hasn't been validated with the Producer. You should validate
- it.</p>
- <h:commandLink action="#{consumer.refreshRegistrationInfo}" value="Validate"
- title="Validate registration info from Producer"
- styleClass="portlet-form-button">
- <f:param name="eraseLocalInfo" value="false"/>
- </h:commandLink>
- </td>
- </tr>
- </c:if>
+ <c:choose>
+ <c:when test="#{!consumer.registrationChecked}">
+ <tr>
+ <td colspan="2">
+ <p class="info">Registration information hasn't been validated with the Producer. You should validate
+ it.</p>
+ <h:commandLink action="#{consumer.refreshRegistrationInfo}" value="Validate"
+ title="Validate registration info from Producer" styleClass="portlet-form-button">
+ <f:param name="mergeLocalInfo" value="true"/>
+ </h:commandLink>
+ </td>
+ </tr>
+ </c:when>
+ <c:otherwise>
+ <c:if
+ test="#{!empty consumer.producerInfo.registrationInfo.registrationHandle and !consumer.registrationValid}">
+ <tr>
+ <td colspan="2">
+ <p class="error">Registration is not valid. You can try to fix the problems and modify the
+ registration.</p>
+ <h:commandLink action="#{consumer.modifyRegistration}" value="Modify registration"
+ title="Modify the registration held with this Producer"
+ styleClass="portlet-form-button"/>
+ </td>
+ </tr>
+ </c:if>
+ </c:otherwise>
+ </c:choose>
</c:if>
<tr>
<td>
18 years, 12 months
JBoss Portal SVN: r7210 - trunk/wsrp/src/main/org/jboss/portal/wsrp.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-05-07 00:28:58 -0400 (Mon, 07 May 2007)
New Revision: 7210
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
Log:
- Added createModifyRegistration method.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2007-05-07 00:56:04 UTC (rev 7209)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2007-05-07 04:28:58 UTC (rev 7210)
@@ -52,6 +52,7 @@
import org.jboss.portal.wsrp.core.MarkupResponse;
import org.jboss.portal.wsrp.core.MarkupType;
import org.jboss.portal.wsrp.core.ModelDescription;
+import org.jboss.portal.wsrp.core.ModifyRegistration;
import org.jboss.portal.wsrp.core.PerformBlockingInteraction;
import org.jboss.portal.wsrp.core.PortletContext;
import org.jboss.portal.wsrp.core.PortletDescription;
@@ -901,4 +902,18 @@
return new ReleaseSessions(registrationContext, sessionIDs);
}
+
+ /**
+ * registrationContext(RegistrationContext)?, registrationData(RegistrationData)
+ *
+ * @return
+ * @since 2.6
+ */
+ public static ModifyRegistration createModifyRegistration(RegistrationContext registrationContext,
+ RegistrationData registrationData)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(registrationData, "RegistrationData");
+
+ return new ModifyRegistration(registrationContext, registrationData);
+ }
}
18 years, 12 months
JBoss Portal SVN: r7209 - in trunk: common/src/main/org/jboss/portal/test/common and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-05-06 20:56:04 -0400 (Sun, 06 May 2007)
New Revision: 7209
Modified:
trunk/common/src/main/org/jboss/portal/common/util/MapAccessor.java
trunk/common/src/main/org/jboss/portal/common/util/TypedMap.java
trunk/common/src/main/org/jboss/portal/test/common/TypedMapTestCase.java
trunk/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java
Log:
- MapAccessor.getMap now distinguishes between accessing the Map with an intent to modify it or just read data off of it. This allows for lazy initialization.
Modified: trunk/common/src/main/org/jboss/portal/common/util/MapAccessor.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/MapAccessor.java 2007-05-07 00:49:23 UTC (rev 7208)
+++ trunk/common/src/main/org/jboss/portal/common/util/MapAccessor.java 2007-05-07 00:56:04 UTC (rev 7209)
@@ -35,7 +35,9 @@
/**
* Return the accessed map.
*
+ * @param requestWriteable whether or not the Map will be accessed for a write-type (e.g., put, remove...) operation.
+ * This allows for lazy initialization via a create-on-write mechanism.
* @return a non null map
*/
- Map getMap();
+ Map getMap(boolean requestWriteable);
}
Modified: trunk/common/src/main/org/jboss/portal/common/util/TypedMap.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/TypedMap.java 2007-05-07 00:49:23 UTC (rev 7208)
+++ trunk/common/src/main/org/jboss/portal/common/util/TypedMap.java 2007-05-07 00:56:04 UTC (rev 7209)
@@ -24,15 +24,15 @@
import org.jboss.portal.common.NotYetImplemented;
-import java.util.Map;
import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
import java.util.Set;
-import java.util.HashMap;
/**
- * A decorator that enforce the map content to be checked against a type.
- * Null internal values are not supported.
+ * A decorator that enforce the map content to be checked against a type. Null internal values are not supported.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -54,29 +54,24 @@
protected TypedMap(final Map delegate)
{
- accessor = new MapAccessor()
- {
- public Map getMap()
- {
- return delegate;
- }
- };
+ accessor = new LazyMapAccessor(delegate);
}
/**
* Return the map provided by the accessor.
*
+ * @param requestWriteable
* @return the delegate map
*/
- protected final Map getDelegate()
+ protected final Map getDelegate(boolean requestWriteable)
{
- return accessor.getMap();
+ return accessor.getMap(requestWriteable);
}
/**
* Override to check the validity of the key, the default implementation is an empty method.
*
- * @throws ClassCastException if the class of the specified key prevents it from being stored in this map
+ * @throws ClassCastException if the class of the specified key prevents it from being stored in this map
* @throws IllegalArgumentException if some aspect of this key prevents it from being stored in this map
*/
protected void assertKeyValidity(Object key) throws IllegalArgumentException, ClassCastException
@@ -84,14 +79,13 @@
}
/**
- * Unwraps the key to the the internal key that will be stored in the map.
- * This method calls the <code>assertKeyValidity(Object key)</code> and returns
- * the same key. It can be overriden to provide a customized key that will be used
- * instead of the external key.
+ * Unwraps the key to the the internal key that will be stored in the map. This method calls the
+ * <code>assertKeyValidity(Object key)</code> and returns the same key. It can be overriden to provide a customized
+ * key that will be used instead of the external key.
*
* @param key the key to unwrap
* @return the unwrapped key
- * @throws ClassCastException if the class of the specified key prevents it from being stored in this map
+ * @throws ClassCastException if the class of the specified key prevents it from being stored in this map
* @throws IllegalArgumentException if some aspect of this key prevents it from being stored in this map
*/
protected Object getInternalKey(Object key) throws IllegalArgumentException, ClassCastException
@@ -103,9 +97,8 @@
}
/**
- * Wrap the internal key into its external representation, by default returns the same key.
- * It can be overriden to provide a customized key that will be used instead of the internal
- * key.
+ * Wrap the internal key into its external representation, by default returns the same key. It can be overriden to
+ * provide a customized key that will be used instead of the internal key.
*/
protected Object getExternalKey(Object key)
{
@@ -157,7 +150,7 @@
*
* @param value the value to unwrap
* @return the unwrapped value
- * @throws ClassCastException if the class of the specified value prevents it from being stored in this map
+ * @throws ClassCastException if the class of the specified value prevents it from being stored in this map
* @throws IllegalArgumentException if some aspect of this value prevents it from being stored in this map
*/
protected Object getInternalValue(Object value) throws IllegalArgumentException, ClassCastException
@@ -166,9 +159,9 @@
}
/**
- * Wrap the internal value into its external representation. The external representation value should not be null.
- * If it is not possible to obtain an external value representation of the internal value, then the the
- * null value should be returned from this method.
+ * Wrap the internal value into its external representation. The external representation value should not be null. If
+ * it is not possible to obtain an external value representation of the internal value, then the the null value
+ * should be returned from this method.
*
* @param value the param value which will not be null
* @return the external value
@@ -212,8 +205,8 @@
*
* @param internalValue the internal value
* @return the non null external value
- * @throws IllegalStateException if the internal value was null or some aspect prevented it to be converted
- * to an external representation
+ * @throws IllegalStateException if the internal value was null or some aspect prevented it to be converted to an
+ * external representation
*/
protected final Object wrapValue(Object internalValue) throws IllegalStateException
{
@@ -236,8 +229,8 @@
}
/**
- * Compare internal values, the default implementation delegates the operation to the equals method
- * of the left argument.
+ * Compare internal values, the default implementation delegates the operation to the equals method of the left
+ * argument.
*
* @param left
* @param right
@@ -250,29 +243,32 @@
public int size()
{
- return getDelegate().size();
+ return getDelegate(false).size();
}
public void clear()
{
- getDelegate().clear();
+ if (!isEmpty())
+ {
+ getDelegate(true).clear();
+ }
}
public boolean isEmpty()
{
- return getDelegate().isEmpty();
+ return getDelegate(false).isEmpty();
}
public boolean containsKey(Object key)
{
key = unwrapKey(key);
- return getDelegate().containsKey(key);
+ return getDelegate(false).containsKey(key);
}
public boolean containsValue(Object value)
{
value = unwrapValue(value);
- return getDelegate().containsValue(value);
+ return getDelegate(false).containsValue(value);
}
public Collection values()
@@ -283,7 +279,7 @@
public void putAll(Map t)
{
t = convert(t);
- getDelegate().putAll(t);
+ getDelegate(true).putAll(t);
}
public Set entrySet()
@@ -299,14 +295,20 @@
public Object get(Object key)
{
key = unwrapKey(key);
- Object value = getDelegate().get(key);
+ Object value = getDelegate(false).get(key);
return value == null ? null : wrapValue(value);
}
public Object remove(Object key)
{
key = unwrapKey(key);
- Object value = getDelegate().remove(key);
+
+ Object value = null;
+ if (!isEmpty())
+ {
+ value = getDelegate(true).remove(key);
+ }
+
return value == null ? null : wrapValue(value);
}
@@ -314,7 +316,7 @@
{
key = unwrapKey(key);
value = unwrapValue(value);
- value = getDelegate().put(key, value);
+ value = getDelegate(true).put(key, value);
return value == null ? null : wrapValue(value);
}
@@ -330,7 +332,7 @@
if (o instanceof Map)
{
Map that = (Map)o;
- Map delegate = getDelegate();
+ Map delegate = getDelegate(false);
// Must have same sizes
if (that.size() != delegate.size())
@@ -395,7 +397,7 @@
/**
* Replace the content with the new map which is validated before replacement.
- *
+ *
* @param t the replacement map
* @throws ClassCastException
* @throws NullPointerException
@@ -403,12 +405,15 @@
*/
public void replace(Map t) throws ClassCastException, NullPointerException, IllegalArgumentException
{
- t = convert(t);
+ if (!t.isEmpty())
+ {
+ t = convert(t);
- //
- Map delegate = getDelegate();
- delegate.clear();
- delegate.putAll(t);
+ //
+ Map delegate = getDelegate(true);
+ delegate.clear();
+ delegate.putAll(t);
+ }
}
/**
@@ -420,7 +425,7 @@
*/
public void validate() throws ClassCastException, NullPointerException, IllegalArgumentException
{
- for (Iterator i = getDelegate().entrySet().iterator(); i.hasNext();)
+ for (Iterator i = getDelegate(false).entrySet().iterator(); i.hasNext();)
{
Entry entry = (Entry)i.next();
wrapKey(entry.getKey());
@@ -428,9 +433,7 @@
}
}
- /**
- * Validate the map and unwrap it if necessary.
- */
+ /** Validate the map and unwrap it if necessary. */
protected final Map convert(Map t) throws IllegalArgumentException, NullPointerException, ClassCastException
{
if (t == null)
@@ -450,13 +453,13 @@
public class ValueCollection implements Collection
{
-
+
/** . */
private final Collection delegate;
public ValueCollection()
{
- this.delegate = getDelegate().values();
+ this.delegate = getDelegate(false).values();
}
public int size()
@@ -562,7 +565,7 @@
public KeySet()
{
- this.delegate = getDelegate().keySet();
+ this.delegate = getDelegate(false).keySet();
}
public int size()
@@ -572,7 +575,10 @@
public void clear()
{
- delegate.clear();
+ if (!isEmpty())
+ {
+ delegate.clear();
+ }
}
public boolean isEmpty()
@@ -585,7 +591,7 @@
try
{
Object key = unwrapKey(o);
- return getDelegate().containsKey(key);
+ return getDelegate(false).containsKey(key);
}
catch (IllegalArgumentException e)
{
@@ -640,7 +646,7 @@
//
boolean changed = false;
- for (Iterator i = iterator();i.hasNext();)
+ for (Iterator i = iterator(); i.hasNext();)
{
Object key = i.next();
if (!c.contains(key))
@@ -700,7 +706,7 @@
public TypedEntrySet()
{
- this.delegate = getDelegate().entrySet();
+ this.delegate = getDelegate(false).entrySet();
}
public int size()
@@ -710,7 +716,10 @@
public void clear()
{
- delegate.clear();
+ if (!isEmpty())
+ {
+ delegate.clear();
+ }
}
public boolean isEmpty()
@@ -843,4 +852,32 @@
}
}
}
+
+ private static class LazyMapAccessor implements MapAccessor
+ {
+ private Map delegate;
+
+ public LazyMapAccessor(Map delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public Map getMap(boolean requestWriteable)
+ {
+ // if the delegate is null, wait until we need to write to it to initialize it
+ if (delegate == null)
+ {
+ if (requestWriteable)
+ {
+ delegate = new HashMap();
+ }
+ else
+ {
+ return Collections.EMPTY_MAP;
+ }
+ }
+
+ return delegate;
+ }
+ }
}
Modified: trunk/common/src/main/org/jboss/portal/test/common/TypedMapTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/TypedMapTestCase.java 2007-05-07 00:49:23 UTC (rev 7208)
+++ trunk/common/src/main/org/jboss/portal/test/common/TypedMapTestCase.java 2007-05-07 00:56:04 UTC (rev 7209)
@@ -23,13 +23,12 @@
package org.jboss.portal.test.common;
import junit.framework.TestCase;
-import org.jboss.portal.common.util.TypedMap;
import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.util.TypedMap;
-import java.util.Map;
-import java.util.HashMap;
import java.util.Collections;
-import java.util.HashSet;
+import java.util.HashMap;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -399,7 +398,7 @@
super(new HashMap());
//
- delegate = getDelegate();
+ delegate = getDelegate(false);
}
protected void assertKeyValidity(Object key) throws ClassCastException
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java 2007-05-07 00:49:23 UTC (rev 7208)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java 2007-05-07 00:56:04 UTC (rev 7209)
@@ -99,7 +99,7 @@
}
// Merge or use appended values
- Map delegate = getDelegate();
+ Map delegate = getDelegate(true);
while (--index >= 0)
{
String appendedName = appendedNames[index];
@@ -123,7 +123,7 @@
public String toString()
{
StringBuffer buffer = new StringBuffer("Parameters[");
- Map delegate = getDelegate();
+ Map delegate = getDelegate(false);
for (Iterator i = delegate.entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry)i.next();
@@ -144,8 +144,8 @@
}
/**
- * Safely wrap the map as a portlet parameters object. If the map is already a portlet parameter object,
- * just return that object otherwise return a wrapper around the map.
+ * Safely wrap the map as a portlet parameters object. If the map is already a portlet parameter object, just return
+ * that object otherwise return a wrapper around the map.
*/
public static PortletParameters wrap(Map map)
{
18 years, 12 months