JBoss Portal SVN: r8958 - in modules/identity/trunk: build and 2 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-11-15 14:53:15 -0500 (Thu, 15 Nov 2007)
New Revision: 8958
Modified:
modules/identity/trunk/build/pom.xml
modules/identity/trunk/identity/pom.xml
modules/identity/trunk/pom.xml
modules/identity/trunk/sso/pom.xml
Log:
better naming
Modified: modules/identity/trunk/build/pom.xml
===================================================================
--- modules/identity/trunk/build/pom.xml 2007-11-15 19:48:52 UTC (rev 8957)
+++ modules/identity/trunk/build/pom.xml 2007-11-15 19:53:15 UTC (rev 8958)
@@ -20,7 +20,7 @@
<artifactId>jboss-portal-modules-identity</artifactId>
<version>1.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
- <name>JBoss Portal Identity Module</name>
+ <name>JBoss Portal Identity</name>
<url>http://www.jboss.com/products/jbossmc</url>
<description>JBoss Portal Identity Module</description>
<scm>
Modified: modules/identity/trunk/identity/pom.xml
===================================================================
--- modules/identity/trunk/identity/pom.xml 2007-11-15 19:48:52 UTC (rev 8957)
+++ modules/identity/trunk/identity/pom.xml 2007-11-15 19:53:15 UTC (rev 8958)
@@ -9,6 +9,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>portal-identity</artifactId>
<packaging>jar</packaging>
+ <name>JBoss Portal Identity Core</name>
<dependencies>
<dependency>
Modified: modules/identity/trunk/pom.xml
===================================================================
--- modules/identity/trunk/pom.xml 2007-11-15 19:48:52 UTC (rev 8957)
+++ modules/identity/trunk/pom.xml 2007-11-15 19:53:15 UTC (rev 8958)
@@ -4,7 +4,7 @@
<groupId>org.jboss.portal.identity</groupId>
<artifactId>jboss-portal-modules-identity-aggregator</artifactId>
<packaging>pom</packaging>
- <name>JBoss Portal Modules Identity</name>
+ <name>JBoss Portal Identity Module</name>
<version>1.1.0-SNAPSHOT</version>
<url>http://labs.jboss.com/jbossportal</url>
Modified: modules/identity/trunk/sso/pom.xml
===================================================================
--- modules/identity/trunk/sso/pom.xml 2007-11-15 19:48:52 UTC (rev 8957)
+++ modules/identity/trunk/sso/pom.xml 2007-11-15 19:53:15 UTC (rev 8958)
@@ -9,6 +9,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>portal-identity-sso</artifactId>
<packaging>jar</packaging>
+ <name>JBoss Portal Identity SSO Integration</name>
<dependencies>
<dependency>
16 years, 10 months
JBoss Portal SVN: r8957 - in modules/identity/trunk: identity and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-11-15 14:48:52 -0500 (Thu, 15 Nov 2007)
New Revision: 8957
Modified:
modules/identity/trunk/build/pom.xml
modules/identity/trunk/identity/pom.xml
Log:
enforcer plugin and missing cargo plugin version
Modified: modules/identity/trunk/build/pom.xml
===================================================================
--- modules/identity/trunk/build/pom.xml 2007-11-15 19:21:45 UTC (rev 8956)
+++ modules/identity/trunk/build/pom.xml 2007-11-15 19:48:52 UTC (rev 8957)
@@ -51,6 +51,7 @@
<properties>
<version.junit>3.8.1</version.junit>
+ <version.cargo>0.9-portal</version.cargo>
<version.ant>1.6.5</version.ant>
<version.jboss.portal.common>1.1.0-SNAPSHOT</version.jboss.portal.common>
<version.jboss.portal.test>1.1.0-SNAPSHOT</version.jboss.portal.test>
Modified: modules/identity/trunk/identity/pom.xml
===================================================================
--- modules/identity/trunk/identity/pom.xml 2007-11-15 19:21:45 UTC (rev 8956)
+++ modules/identity/trunk/identity/pom.xml 2007-11-15 19:48:52 UTC (rev 8957)
@@ -148,6 +148,29 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-property</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>JBOSS_HOME</property>
+ <message>"You must specify JBoss Application Server installation directory using -DJBOSS_HOME=... command line argument"</message>
+ <!--<regex>"\d"</regex>-->
+ <!--<regexMessage>"You must have a digit in your baseDir!"</regexMessage>-->
+ </requireProperty>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
@@ -245,6 +268,9 @@
</configuration>
</plugin>
<plugin>
+ <dependencies>
+
+ </dependencies>
<groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit-tooling-maven2</artifactId>
<executions>
@@ -263,8 +289,8 @@
</testsuite>
</testsuites>
<reports>
- <xml>../testsuite/reports/xml</xml>
- <html>../testsuite/reports/html</html>
+ <xml>${basedir}/reports/xml</xml>
+ <html>${basedir}/reports/html</html>
</reports>
</configuration>
</plugin>
16 years, 10 months
JBoss Portal SVN: r8956 - branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-15 14:21:45 -0500 (Thu, 15 Nov 2007)
New Revision: 8956
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ErrorResponse.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/RedirectResponse.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ServerResponse.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowPageResponse.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewPageAction.java
Log:
minor update
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ErrorResponse.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ErrorResponse.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ErrorResponse.java 2007-11-15 19:21:45 UTC (rev 8956)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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.presentation.action.server;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ErrorResponse extends ServerResponse
+{
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/RedirectResponse.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/RedirectResponse.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/RedirectResponse.java 2007-11-15 19:21:45 UTC (rev 8956)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.presentation.action.server;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RedirectResponse
+{
+
+ /** . */
+ private final String location;
+
+ public RedirectResponse(String location)
+ {
+ this.location = location;
+ }
+
+ public String getLocation()
+ {
+ return location;
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ServerResponse.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ServerResponse.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ServerResponse.java 2007-11-15 19:21:45 UTC (rev 8956)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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.presentation.action.server;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class ServerResponse
+{
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowPageResponse.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowPageResponse.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowPageResponse.java 2007-11-15 19:21:45 UTC (rev 8956)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.presentation.action.server;
+
+/**
+ * Tell the client to show a particular page.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ShowPageResponse extends ServerResponse
+{
+
+ /** . */
+ private final String pageId;
+
+ public ShowPageResponse(String pageId)
+ {
+ this.pageId = pageId;
+ }
+
+ public String getPageId()
+ {
+ return pageId;
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewPageAction.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewPageAction.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewPageAction.java 2007-11-15 19:21:45 UTC (rev 8956)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.presentation.action.server;
+
+/**
+ * Shows a page.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ViewPageAction extends ServerAction
+{
+
+ /** . */
+ private final String pageId;
+
+ public ViewPageAction(String pageId)
+ {
+ this.pageId = pageId;
+ }
+
+ public String getPageId()
+ {
+ return pageId;
+ }
+}
16 years, 10 months
JBoss Portal SVN: r8955 - in branches/UIServer: uiserver/src/main/org/jboss/portal/presentation/impl/ajax/service and 6 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-11-15 12:38:28 -0500 (Thu, 15 Nov 2007)
New Revision: 8955
Removed:
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PortalObjectReaderImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Component.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Container.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Page.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Window.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PortalObjectReader.java
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/ajax/service/PortalEntryPoint.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/layout/LayoutManager.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/layout/LayoutService.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/PortalObject.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorResponse.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/service/PortalEntryPoint.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/service/UIServer.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/layout/TestFlexibleGrid.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/layout/TestRegionLayoutManager.java
Log:
removing UI model used during prototyping
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -46,8 +46,6 @@
import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.presentation.RequestContext;
-import org.jboss.portal.presentation.model.Page;
-import org.jboss.portal.presentation.model.Window;
import org.jboss.portal.presentation.server.Processor;
import org.jboss.portal.presentation.server.ProcessorRequest;
import org.jboss.portal.presentation.server.ProcessorResponse;
@@ -116,6 +114,7 @@
if(task.equals("aggregate"))
{
//Handle page aggregation and sending result back to the client
+ /*
MarkupInfo markupInfo = (MarkupInfo)invocation.getResponse().getContentInfo();
PageResult pageResult = (PageResult)invocation.getServerContext().getClientRequest().getAttribute("pageResult");
@@ -139,6 +138,7 @@
//Generate the response to be sent back for processing by the Presentation Framework
response = new ProcessorResponse(dispatcher, contentType, markupInfo.getCharset(), updatedPages);
+ */
}
else if(task.equals("stream"))
{
@@ -203,7 +203,7 @@
{
List windows = null;
- if(windowContexts != null)
+ /*if(windowContexts != null)
{
windows = new ArrayList();
for(Iterator itr=windowContexts.keySet().iterator(); itr.hasNext();)
@@ -218,7 +218,7 @@
windows.add(window);
}
- }
+ }*/
return windows;
}
Deleted: branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PortalObjectReaderImpl.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PortalObjectReaderImpl.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PortalObjectReaderImpl.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -1,203 +0,0 @@
-/******************************************************************************
- * 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.core.presentation.server;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
-import org.jboss.portal.core.model.portal.PortalContainer;
-
-import org.jboss.portal.presentation.model.Page;
-import org.jboss.portal.presentation.model.Portal;
-import org.jboss.portal.presentation.model.PortalObject;
-import org.jboss.portal.presentation.model.Window;
-import org.jboss.portal.presentation.server.PortalObjectReader;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class PortalObjectReaderImpl extends AbstractJBossService implements PortalObjectReader
-{
- private PortalObjectContainer portalObjectContainer = null;
-
- /**
- *
- * @return
- */
- public PortalObjectContainer getPortalObjectContainer()
- {
- return portalObjectContainer;
- }
-
- /**
- *
- * @param portalObjectContainer
- */
- public void setPortalObjectContainer(
- PortalObjectContainer portalObjectContainer)
- {
- this.portalObjectContainer = portalObjectContainer;
- }
-
- /**
- *
- */
- public Portal findPortal(String id)
- {
- Portal portal = null;
- PortalContainer portalContainer = this.portalObjectContainer.getContext();
-
- org.jboss.portal.core.model.portal.Portal cour = portalContainer
- .getPortal(id);
- if (cour != null)
- {
- portal = new Portal();
- portal.setId(cour.getId().toString());
- portal.setName(cour.getName());
-
- // Setup top level children for this node
- Collection children = cour.getChildren();
- Collection portalChildren = new ArrayList();
- for (Iterator itr = children.iterator(); itr.hasNext();)
- {
- org.jboss.portal.core.model.portal.PortalObject child = (org.jboss.portal.core.model.portal.PortalObject) itr
- .next();
-
- PortalObject portalChild = null;
-
- if (child instanceof org.jboss.portal.core.model.portal.Page)
- {
- portalChild = new Page();
- portalChild.setId(child.getId().toString());
- portalChild.setName(child.getName());
- portalChild.setParent(portal);
- portalChildren.add(portalChild);
- }
- else if (child instanceof org.jboss.portal.core.model.portal.Window)
- {
- portalChild = new Window();
- portalChild.setId(child.getId().toString());
- portalChild.setName(child.getName());
- portalChild.setParent(portal);
- portalChildren.add(portalChild);
- }
- }
-
- portal.setChildren(portalChildren);
- }
-
- return portal;
- }
-
- /**
- *
- */
- public PortalObject findPortalObject(PortalObject parent, String id)
- {
- PortalObject portalObject = null;
- PortalContainer portalContainer = this.portalObjectContainer.getContext();
-
- //Find the Portal to introspect
- int startIndex = 1;
- int endIndex = id.indexOf('/', startIndex);
- String portalName = id.substring(startIndex, endIndex);
- org.jboss.portal.core.model.portal.Portal portal = portalContainer.getPortal(portalName);
- if(portal == null)
- {
- return null;
- }
-
- //Find the Portal Object inside this Portal represented by the id
- org.jboss.portal.core.model.portal.PortalObject cour = null;
- StringTokenizer st = new StringTokenizer(id, "/");
- while(st.hasMoreTokens())
- {
- String token = st.nextToken();
-
- if(cour == null)
- {
- cour = portal.getChild(token);
- }
- else
- {
- cour = cour.getChild(token);
- }
- }
-
- //Map the Portal Object to the protocol Portal Object
- if (cour != null)
- {
- if (cour instanceof org.jboss.portal.core.model.portal.Page)
- {
- portalObject = new Page();
- }
- else if (cour instanceof org.jboss.portal.core.model.portal.Window)
- {
- portalObject = new Window();
- }
-
- if (portalObject != null)
- {
- portalObject.setId(cour.getId().toString());
- portalObject.setName(cour.getName());
- portalObject.setParent(parent);
-
- // Setup top level children for this node
- Collection children = cour.getChildren();
- Collection portalChildren = new ArrayList();
- for (Iterator itr = children.iterator(); itr.hasNext();)
- {
- org.jboss.portal.core.model.portal.PortalObject child = (org.jboss.portal.core.model.portal.PortalObject) itr
- .next();
-
- PortalObject portalChild = null;
-
- if (child instanceof org.jboss.portal.core.model.portal.Page)
- {
- portalChild = new Page();
- portalChild.setId(child.getId().toString());
- portalChild.setName(child.getName());
- portalChild.setParent(portalObject);
- portalChildren.add(portalChild);
- }
- else if (child instanceof org.jboss.portal.core.model.portal.Window)
- {
- portalChild = new Window();
- portalChild.setId(child.getId().toString());
- portalChild.setName(child.getName());
- portalChild.setParent(portalObject);
- portalChildren.add(portalChild);
- }
- }
- portalObject.setChildren(portalChildren);
- }
- }
-
- return portalObject;
- }
-}
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -25,7 +25,6 @@
import org.jboss.portal.presentation.RequestContext;
import org.jboss.portal.presentation.server.Processor;
import org.jboss.portal.presentation.server.PresentationServer;
-import org.jboss.portal.presentation.server.PortalObjectReader;
import org.jboss.portal.presentation.model2.UIWindow;
import org.jboss.portal.presentation.model2.state.ModelLoader;
@@ -104,15 +103,7 @@
public void setProcessor(Processor processor)
{
this.processor = processor;
- }
-
- /**
- * @deprecated
- */
- public PortalObjectReader getPortalObjectReader()
- {
- return null;
- }
+ }
/**
*
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/ajax/service/PortalEntryPoint.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/ajax/service/PortalEntryPoint.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/ajax/service/PortalEntryPoint.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -142,6 +142,8 @@
{
Page display = null;
+ //Implement this with the new model
+ /*
org.jboss.portal.presentation.model.Page portalPage = processorResponse
.findDisplayedPage();
@@ -166,6 +168,7 @@
}
}
}
+ */
return display;
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -24,9 +24,6 @@
import org.apache.log4j.Logger;
-import org.jboss.portal.presentation.model.Container;
-import org.jboss.portal.presentation.model.Window;
-
import java.io.Serializable;
/**
@@ -188,7 +185,7 @@
/**
*
*/
- String doLayout(Container container)
+ /*String doLayout(Container container)
{
String output = null;
@@ -224,7 +221,7 @@
output = buffer.toString();
return output;
- }
+ }*/
/**
@@ -232,7 +229,7 @@
* @param container
* @return
*/
- String generateInlineStyle(Container container)
+ /*String generateInlineStyle(Container container)
{
String style = null;
@@ -253,7 +250,7 @@
style = buffer.toString();
return style;
- }
+ }*/
/**
*
@@ -261,7 +258,7 @@
* @param column
* @return
*/
- String getCellStyle(int row, int column)
+ /*String getCellStyle(int row, int column)
{
String style = null;
@@ -311,7 +308,7 @@
}
return style;
- }
+ }*/
/**
*
@@ -319,7 +316,7 @@
* @param column
* @return
*/
- private String getPortletMarkup(Container container,int row,int column)
+ /*private String getPortletMarkup(Container container,int row,int column)
{
String markup = "";
@@ -340,5 +337,5 @@
}
return markup;
- }
+ }*/
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.classic.layout;
-import org.jboss.portal.presentation.model.Container;
-import org.jboss.portal.presentation.model.Page;
import org.jboss.portal.presentation.layout.LayoutManager;
@@ -72,7 +70,7 @@
/**
*
*/
- public String doLayout(Page page)
+ /*public String doLayout(Page page)
{
String layoutOutput = "";
@@ -101,7 +99,7 @@
layoutOutput = buffer.toString();
return layoutOutput;
- }
+ }*/
/**
*
@@ -109,7 +107,7 @@
* @param grids
* @return
*/
- private Container[] findContainers(Page page, FlexibleGrid[] grids)
+ /*private Container[] findContainers(Page page, FlexibleGrid[] grids)
{
Container[] containers = null;
@@ -137,7 +135,7 @@
}
return containers;
- }
+ }*/
/**
*
@@ -145,7 +143,7 @@
* @param containers
* @return
*/
- private String generateInlineStyle(FlexibleGrid[] grids,Container[] containers)
+ /*private String generateInlineStyle(FlexibleGrid[] grids,Container[] containers)
{
String inlineStyle = null;
@@ -182,5 +180,5 @@
inlineStyle = buffer.toString();
return inlineStyle;
- }
+ }*/
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -25,9 +25,6 @@
import java.util.List;
import java.util.ArrayList;
-import org.jboss.portal.presentation.model.Container;
-import org.jboss.portal.presentation.model.Page;
-import org.jboss.portal.presentation.model.Window;
import org.jboss.portal.presentation.layout.LayoutManager;
/**
@@ -65,7 +62,7 @@
/**
*
*/
- public String doLayout(Page page)
+ /*public String doLayout(Page page)
{
String output = null;
@@ -98,7 +95,7 @@
output = buffer.toString();
return output;
- }
+ }*/
/**
*
@@ -106,7 +103,7 @@
* @param page
* @return
*/
- private Container findContainerByRegion(int regionType, Page page)
+ /*private Container findContainerByRegion(int regionType, Page page)
{
Container container = null;
@@ -132,14 +129,14 @@
}
return container;
- }
+ }*/
/**
*
* @param regionType
* @param container
*/
- private String layoutRegion(int regionType, Container container)
+ /*private String layoutRegion(int regionType, Container container)
{
String output = null;
@@ -179,5 +176,5 @@
output = buffer.toString();
return output;
- }
+ }*/
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/layout/LayoutManager.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/layout/LayoutManager.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/layout/LayoutManager.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.presentation.layout;
-import org.jboss.portal.presentation.model.Page;
-
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
@@ -35,5 +33,5 @@
* @param container
* @return
*/
- public String doLayout(Page page);
+ //public String doLayout(Page page);
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/layout/LayoutService.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/layout/LayoutService.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/layout/LayoutService.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.presentation.layout;
-import org.jboss.portal.presentation.model.Page;
-
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
@@ -44,12 +42,12 @@
* @param layoutManager
* @return
*/
- public String doLayout(Page page, LayoutManager layoutManager)
+ /*public String doLayout(Page page, LayoutManager layoutManager)
{
String output = null;
output = layoutManager.doLayout(page);
return output;
- }
+ }*/
}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Component.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Component.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Component.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -1,53 +0,0 @@
-/******************************************************************************
- * 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.presentation.model;
-
-import java.io.Serializable;
-
-/**
- * Component represents a UI entity that will be rendered eventually on the client
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public interface Component extends Serializable
-{
- /**
- *
- * @return
- */
- public String getId();
-
- /**
- *
- * @param id
- */
- public void setId(String id);
-
-
- /**
- *
- * @return
- */
- public String getMarkup();
-}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Container.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Container.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Container.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -1,134 +0,0 @@
-/******************************************************************************
- * 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.presentation.model;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * Container is an organizational entity which aggregates the Components that will be rendered on the client
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class Container implements Serializable
-{
- /**
- * required unique id of the container. uniqueness in relation to
- * other containers added to the same instance of the page
- */
- protected String id = null;
-
-
- /**
- *
- */
- private List components = null;
-
- /**
- *
- *
- */
- public Container(String id)
- {
- this.id = id;
- this.components = new ArrayList();
- }
-
- /**
- *
- * @return
- */
- public String getId()
- {
- return id;
- }
-
- /**
- *
- * @param id
- */
- public void setId(String id)
- {
- this.id = id;
- }
-
-
- /**
- *
- * @return
- */
- public List getComponents()
- {
- return components;
- }
-
- /**
- *
- * @param components
- */
- public void setComponents(List components)
- {
- this.components = components;
- }
-
- /**
- *
- * @param componentId
- * @return
- */
- public Component getComponent(String componentId)
- {
- Component component = null;
-
- if(this.components != null)
- {
- for(int i=0;i<this.components.size();i++)
- {
- Component cour = (Component)this.components.get(i);
- if(cour.getId().equals(componentId))
- {
- component = cour;
- break;
- }
- }
- }
-
- return component;
- }
-
- /**
- *
- * @param component
- */
- public void addComponent(Component component)
- {
- if(this.components == null)
- {
- this.components = new ArrayList();
- }
-
- this.components.add(component);
- }
-}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Page.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Page.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Page.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -1,132 +0,0 @@
-/******************************************************************************
- * 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.presentation.model;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class Page extends PortalObject
-{
- /**
- * A page consists of multiple containers that are to be displayed/aggregated along with their corresponding
- * UI components
- */
- private List containers = null;
-
- /**
- * Signifies if this page is currently being displayed on the client
- */
- private boolean currentlyDisplayed = false;
-
- /**
- *
- *
- */
- public Page()
- {
- super();
- this.containers = new ArrayList();
- }
-
- /**
- *
- */
- public String toString()
- {
- return "Page: "+super.toString();
- }
-
- /**
- *
- * @return
- */
- public List getWindows()
- {
- List windows = new ArrayList();
-
- if(this.children != null)
- {
- for(Iterator itr=this.children.iterator(); itr.hasNext();)
- {
- Object child = itr.next();
-
- if(child instanceof Window)
- {
- windows.add(child);
- }
- }
- }
-
- return windows;
- }
-
- /**
- *
- * @return
- */
- public List getContainers()
- {
- return containers;
- }
-
- /**
- *
- * @param containers
- */
- public void setContainers(List containers)
- {
- this.containers = containers;
- }
-
- /**
- *
- * @param container
- */
- public void addContainer(Container container)
- {
- this.getContainers().add(container);
- }
-
- /**
- *
- * @return
- */
- public boolean isCurrentlyDisplayed()
- {
- return currentlyDisplayed;
- }
-
- /**
- *
- * @param currentlyDisplayed
- */
- public void setCurrentlyDisplayed(boolean currentlyDisplayed)
- {
- this.currentlyDisplayed = currentlyDisplayed;
- }
-}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/PortalObject.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/PortalObject.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/PortalObject.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -23,11 +23,6 @@
package org.jboss.portal.presentation.model;
import java.io.Serializable;
-import java.util.Map;
-import java.util.Collection;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.HashMap;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -37,9 +32,6 @@
{
protected String id = null;
protected String name = null;
- protected PortalObject parent = null;
- protected Collection children = null;
- protected Map properties = null;
/**
*
@@ -47,8 +39,6 @@
*/
public PortalObject()
{
- this.children = new ArrayList();
- this.properties = new HashMap(5);
}
/**
@@ -58,12 +48,10 @@
* @param parent
* @param children
*/
- public PortalObject(String id, String name, PortalObject parent, Collection children)
+ public PortalObject(String id, String name)
{
this.id = id;
this.name = name;
- this.parent = parent;
- this.children = children;
}
/**
@@ -104,97 +92,7 @@
/**
*
- * @return
*/
- public PortalObject getParent()
- {
- return parent;
- }
-
- /**
- *
- * @param parent
- */
- public void setParent(PortalObject parent)
- {
- this.parent = parent;
- }
-
- /**
- *
- * @return
- */
- public Collection getChildren()
- {
- if(this.children == null)
- {
- this.children = new ArrayList();
- }
- return children;
- }
-
- /**
- *
- * @param children
- */
- public void setChildren(Collection children)
- {
- this.children = children;
- }
-
- /**
- * Recursively traverses the Portal Object's children tree to find a child registered with the
- * specified id
- *
- * @param id
- * @return
- */
- public PortalObject findChild(String id)
- {
- PortalObject child = null;
-
- for(Iterator itr=this.children.iterator(); itr.hasNext();)
- {
- PortalObject cour = (PortalObject)itr.next();
- if(cour.id.equals(id))
- {
- child = cour;
- }
- else
- {
- child = cour.findChild(id);
- }
-
- if(child != null)
- {
- return child;
- }
- }
-
- return child;
- }
-
- /**
- *
- * @return
- */
- public Map getProperties()
- {
- return properties;
- }
-
- /**
- *
- * @param properties
- */
- public void setProperties(Map properties)
- {
- this.properties = properties;
- }
-
- /**
- *
- */
public String toString()
{
String rep = null;
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Window.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Window.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Window.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -1,240 +0,0 @@
-/******************************************************************************
- * 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.presentation.model;
-
-import java.util.Map;
-import java.util.HashMap;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class Window extends PortalObject implements Component
-{
- /**
- * Title for this Window
- */
- private String title = null;
-
- /**
- * Content/Markup to be displayed inside this Window
- */
- private String content = null;
-
- /**
- * Content/Markup related to the header of this Window
- */
- private final String headerContent;
-
- /**
- * The State of this Window such as Normal, Maximized, Minimized etc
- */
- private final WindowState windowState;
-
- /**
- * The Mode of this Window such as View, Edit, Help etc
- */
- private final Mode mode;
-
- /**
- * Runtime View related meta data associated with this particular window.
- *
- * The meta data is provided in the form of Name/Value pairs with Name being the key of the and Value being the Value
- * of a Map entry
- */
- private Map viewMetaData = null;
-
-
- /**
- *
- *
- */
- public Window()
- {
- super();
- this.viewMetaData = new HashMap(5);
- this.headerContent = null;
- this.windowState = null;
- this.mode = null;
- }
-
- /**
- *
- *
- */
- public Window(String id,String title, String content, String headerContent, WindowState windowState, Mode mode)
- {
- super();
- this.viewMetaData = new HashMap(5);
- this.id = id;
- this.title = title;
- this.content = content;
- this.headerContent = headerContent;
- this.windowState = windowState;
- this.mode = mode;
- }
-
- /**
- *
- * @param id
- * @param content
- */
- public Window(String id, String content)
- {
- super();
- this.viewMetaData = new HashMap(5);
- this.id = id;
- this.content = content;
- this.headerContent = null;
- this.windowState = null;
- this.mode = null;
- }
-
- /**
- *
- * @param id
- * @param content
- */
- public Window(String id)
- {
- super();
- this.viewMetaData = new HashMap(5);
- this.id = id;
- this.headerContent = null;
- this.windowState = null;
- this.mode = null;
- }
-
-
- /**
- *
- * @return
- */
- public String getContent()
- {
- return content;
- }
-
-
- /**
- *
- * @param content
- */
- public void setContent(String content)
- {
- this.content = content;
- }
-
-
- /**
- *
- * @return
- */
- public String getHeaderContent()
- {
- return headerContent;
- }
-
-
- /**
- *
- * @return
- */
- public Mode getMode()
- {
- return mode;
- }
-
-
- /**
- *
- * @return
- */
- public String getTitle()
- {
- return title;
- }
-
-
- /**
- *
- * @param title
- */
- public void setTitle(String title)
- {
- this.title = title;
- }
-
-
- /**
- *
- * @return
- */
- public WindowState getWindowState()
- {
- return windowState;
- }
-
-
- /**
- *
- */
- public String toString()
- {
- return "Window: "+super.toString();
- }
-
- /**
- *
- */
- public String getMarkup()
- {
- String markup = "";
-
- markup = this.content;
-
- return markup;
- }
-
- /**
- *
- * @return
- */
- public Map getViewMetaData()
- {
- return viewMetaData;
- }
-
- /**
- *
- * @param viewMetaData
- */
- public void setViewMetaData(Map viewMetaData)
- {
- this.viewMetaData = viewMetaData;
- }
-}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PortalObjectReader.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PortalObjectReader.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PortalObjectReader.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -1,55 +0,0 @@
-/******************************************************************************
- * 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.presentation.server;
-
-import org.jboss.portal.presentation.model.Portal;
-import org.jboss.portal.presentation.model.PortalObject;
-
-/**
- * The PortalObjectReader service is used to provide information about different Portal Objects stored in the system
- *
- * It provides an implementation independent way to query this information without any coupling to low level Portal container
- * implementation details
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public interface PortalObjectReader
-{
- /**
- * Finds a Portal registered with the specified id in the system
- *
- * @param id
- * @return
- */
- public Portal findPortal(String id);
-
- /**
- * Finds a PortalObject registered as a child of the specified parent
- *
- * @param portal
- * @param id
- * @return
- */
- public PortalObject findPortalObject(PortalObject parent, String id);
-}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -37,14 +37,8 @@
* @return
*/
Processor getProcessor();
-
+
/**
- *
- * @return
- */
- PortalObjectReader getPortalObjectReader();
-
- /**
* Obtain the markup.
*
* @param context the request context
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorResponse.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorResponse.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorResponse.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -27,8 +27,6 @@
import org.jboss.portal.web.ServletContextDispatcher;
-import org.jboss.portal.presentation.model.Page;
-
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
@@ -149,7 +147,7 @@
*
* @return
*/
- public Page findDisplayedPage()
+ /*public Page findDisplayedPage()
{
Page displayedPage = null;
@@ -167,5 +165,5 @@
}
return displayedPage;
- }
+ }*/
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/service/PortalEntryPoint.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/service/PortalEntryPoint.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/service/PortalEntryPoint.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -66,9 +66,6 @@
import org.jboss.portal.presentation.impl.classic.layout.FlexibleGridLayoutManager;
import org.jboss.portal.presentation.impl.classic.layout.RegionConstraints;
import org.jboss.portal.presentation.impl.classic.layout.RegionLayoutManager;
-import org.jboss.portal.presentation.model.Container;
-import org.jboss.portal.presentation.model.Page;
-import org.jboss.portal.presentation.model.Window;
import org.jboss.portal.presentation.server.ProcessorResponse;
/**
@@ -337,7 +334,7 @@
{
InterceptorStackFactory stack = this.entryPoint.getInterceptorStackFactory();
invocation.invoke(stack.getInterceptorStack());
- ProcessorResponse processorResponse = (ProcessorResponse)req.getAttribute("processorResponse");
+ /*ProcessorResponse processorResponse = (ProcessorResponse)req.getAttribute("processorResponse");
if(processorResponse != null)
{
Page displayedPage = processorResponse.findDisplayedPage();
@@ -346,7 +343,7 @@
this.render(invocation.getServerContext().getClientResponse().getWriter(),
displayedPage);
}
- }
+ }*/
}
catch (ServerException e)
{
@@ -412,18 +409,8 @@
* @param clientConnection
* @param page
*/
- private void render(PrintWriter clientConnection, Page pageResult)
- {
- /**
- * Special Note: Currently this prototype code and layout configuration including page result creation is hard coded for the purpose
- * of getting the architecture right
- *
- * In the real implementation, LayoutState would be fetched dynamically based on the Page State/Configuration being rendered
- * Even type of Client considerations would be handled here
- *
- * Basically the UIServer would delegate functions to its various components and then send back the result to the client
- *
- */
+ /*private void render(PrintWriter clientConnection, Page pageResult)
+ {
//Some flexible grid layout testing code
Object[] gridData = this.getFlexibleGridLayoutManager(pageResult);
Page page = (Page)gridData[0];
@@ -448,16 +435,14 @@
//Sending the results back to the Client
clientConnection.write(buffer.toString());
clientConnection.flush();
- }
+ }*/
/**
*
*/
- private Object[] getFlexibleGridLayoutManager(Page pageResult)
+ /*private Object[] getFlexibleGridLayoutManager(Page pageResult)
{
- /**
- * Hard coding the FlexibleGridLayout Management here
- */
+
Page page = new Page();
Container header = new Container("header");
Container leftPanel = new Container("leftPanel");
@@ -534,7 +519,7 @@
}
return new Object[]{page, layoutManager};
- }
+ }*/
/**
@@ -544,13 +529,13 @@
* @param columns
* @return
*/
- private FlexibleGrid getGrid(String containerId,int rows, int columns)
+ /*private FlexibleGrid getGrid(String containerId,int rows, int columns)
{
FlexibleGrid grid = new FlexibleGrid(containerId);
grid.setRows(rows);
grid.setColumns(columns);
return grid;
- }
+ }*/
/**
*
@@ -561,7 +546,7 @@
* @param left
* @param right
*/
- private FlexibleGridConstraints getConstraints(String componentId, String widthPercentage, int top, int bottom, int left, int right, int row, int column)
+ /*private FlexibleGridConstraints getConstraints(String componentId, String widthPercentage, int top, int bottom, int left, int right, int row, int column)
{
FlexibleGridConstraints constraints = new FlexibleGridConstraints();
constraints.setComponentId(componentId);
@@ -573,14 +558,14 @@
constraints.setLeft(left);
constraints.setRight(right);
return constraints;
- }
+ }*/
/**
*
* @param pageResult
* @return
*/
- private Object[] getRegionBasedLayoutManager(Page pageResult)
+ /*private Object[] getRegionBasedLayoutManager(Page pageResult)
{
Page page = new Page();
Container left = new Container("left");
@@ -629,5 +614,5 @@
layoutManager.addRegionConstraints(centerConstraints);
return new Object[]{page, layoutManager};
- }
+ }*/
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/service/UIServer.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/service/UIServer.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/service/UIServer.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -141,7 +141,7 @@
{
ServerAction serverAction = null;
- ServerInvocationContext invocationContext = invocation.getServerContext();
+ /*ServerInvocationContext invocationContext = invocation.getServerContext();
HttpServletRequest request = invocationContext.getClientRequest();
if(request.getMethod().equals("GET"))
{
@@ -224,8 +224,8 @@
((LinkActivation)serverAction).setPortal(portal);
((LinkActivation)serverAction).setTarget(target);
}
+ */
-
return serverAction;
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/layout/TestFlexibleGrid.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/layout/TestFlexibleGrid.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/layout/TestFlexibleGrid.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -28,9 +28,6 @@
import java.io.FileOutputStream;
-import org.jboss.portal.presentation.model.Container;
-import org.jboss.portal.presentation.model.Page;
-import org.jboss.portal.presentation.model.Window;
import org.jboss.portal.presentation.impl.classic.layout.FlexibleGrid;
import org.jboss.portal.presentation.impl.classic.layout.FlexibleGridConstraints;
import org.jboss.portal.presentation.impl.classic.layout.FlexibleGridLayoutManager;
@@ -64,7 +61,7 @@
*
* @throws Exception
*/
- public void testDoLayout() throws Exception
+ /*public void testDoLayout() throws Exception
{
// Setup a Page and a container with two portlet windows...
// This part is generic with no decoupling to anything layout specific
@@ -129,13 +126,13 @@
fos.write(buffer.toString().getBytes());
fos.flush();
fos.close();
- }
+ }*/
/**
*
* @return
*/
- private String getHtmlContent()
+ /*private String getHtmlContent()
{
String markup = null;
@@ -163,7 +160,7 @@
}
return markup;
- }
+ }*/
/**
*
@@ -172,13 +169,13 @@
* @param columns
* @return
*/
- private FlexibleGrid getGrid(String containerId,int rows, int columns)
+ /*private FlexibleGrid getGrid(String containerId,int rows, int columns)
{
FlexibleGrid grid = new FlexibleGrid(containerId);
grid.setRows(rows);
grid.setColumns(columns);
return grid;
- }
+ }*/
/**
*
@@ -189,7 +186,7 @@
* @param left
* @param right
*/
- private FlexibleGridConstraints getConstraints(String componentId, String widthPercentage, int top, int bottom, int left, int right, int row, int column)
+ /*private FlexibleGridConstraints getConstraints(String componentId, String widthPercentage, int top, int bottom, int left, int right, int row, int column)
{
FlexibleGridConstraints constraints = new FlexibleGridConstraints();
constraints.setComponentId(componentId);
@@ -201,5 +198,5 @@
constraints.setLeft(left);
constraints.setRight(right);
return constraints;
- }
+ }*/
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/layout/TestRegionLayoutManager.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/layout/TestRegionLayoutManager.java 2007-11-15 17:17:11 UTC (rev 8954)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/layout/TestRegionLayoutManager.java 2007-11-15 17:38:28 UTC (rev 8955)
@@ -28,9 +28,6 @@
import java.io.FileOutputStream;
-import org.jboss.portal.presentation.model.Container;
-import org.jboss.portal.presentation.model.Page;
-import org.jboss.portal.presentation.model.Window;
import org.jboss.portal.presentation.impl.classic.layout.RegionConstraints;
import org.jboss.portal.presentation.impl.classic.layout.RegionLayoutManager;
@@ -63,7 +60,7 @@
*
* @throws Exception
*/
- public void testDoLayout() throws Exception
+ /*public void testDoLayout() throws Exception
{
// Setup a Page and a container with two portlet windows...
// This part is generic with no decoupling to anything layout specific
@@ -113,13 +110,13 @@
fos.write(buffer.toString().getBytes());
fos.flush();
fos.close();
- }
+ }*/
/**
*
* @return
*/
- private String getHtmlContent()
+ /*private String getHtmlContent()
{
String markup = null;
@@ -147,5 +144,5 @@
}
return markup;
- }
+ }*/
}
16 years, 10 months
JBoss Portal SVN: r8954 - branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-15 12:17:11 -0500 (Thu, 15 Nov 2007)
New Revision: 8954
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
Log:
minor update
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java 2007-11-15 17:02:02 UTC (rev 8953)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java 2007-11-15 17:17:11 UTC (rev 8954)
@@ -151,12 +151,27 @@
}
return filteredList;
}
+
+ protected Class<? extends UIObjectImpl> getImplementationType(Class<? extends UIObject> type)
+ {
+ return null;
+ }
+
+ protected abstract boolean isChildTypeAccepted(Class<? extends UIObject> type);
/**
*
*/
public <T extends UIObject> T createChild(String name, Class<T> type) throws IllegalArgumentException
{
+ if (!isChildTypeAccepted(type))
+ {
+ throw new IllegalArgumentException("Blah");
+ }
+
+ //
+ Class<? extends UIObjectImpl> implType = getImplementationType(type);
+
try
{
T child = null;
@@ -166,7 +181,7 @@
throw new IllegalArgumentException("UIContext must be the root of the UIObject tree. It should not be added to any UIObject as a child");
}
- child = type.newInstance();
+ child = type.newInstance();
//Name
((UIObjectImpl)child).name = name;
16 years, 11 months
JBoss Portal SVN: r8953 - in branches/JBoss_Portal_Branch_2_6/widget/src: main/org/jboss/portal/widget/google and 2 other directories.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2007-11-15 12:02:02 -0500 (Thu, 15 Nov 2007)
New Revision: 8953
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/AbstractWidgetPortlet.java
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/AbstractWidgetProvider.java
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/ExpiringFutureTask.java
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/GGWidget.java
branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-netvibes-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-war/WEB-INF/portlet.xml
Log:
Eviction thread timing update
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/AbstractWidgetPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/AbstractWidgetPortlet.java 2007-11-15 16:58:54 UTC (rev 8952)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/AbstractWidgetPortlet.java 2007-11-15 17:02:02 UTC (rev 8953)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.widget;
+import java.util.concurrent.TimeUnit;
+
import javax.portlet.GenericPortlet;
import javax.portlet.PortletConfig;
import javax.portlet.PortletException;
@@ -66,6 +68,7 @@
{
try
{
+ // time in millisecond
provider.setConnectionTimeout(Integer.parseInt(timeout));
}
catch (NumberFormatException e)
@@ -79,7 +82,9 @@
{
try
{
- provider.setQueryExpiration(Integer.parseInt(queryExpiration));
+ // time in minutes
+ int expiration = Integer.parseInt(queryExpiration) * 60;
+ provider.setQueryExpiration(TimeUnit.MILLISECONDS.convert(expiration, TimeUnit.SECONDS));
}
catch(NumberFormatException e)
{
@@ -92,7 +97,9 @@
{
try
{
- provider.setEntryExpiration(Integer.parseInt(entryExpiration));
+ // time in minutes
+ int expiration = Integer.parseInt(entryExpiration) * 60;
+ provider.setEntryExpiration(TimeUnit.MILLISECONDS.convert(expiration, TimeUnit.SECONDS));
}
catch(NumberFormatException e)
{
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/AbstractWidgetProvider.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/AbstractWidgetProvider.java 2007-11-15 16:58:54 UTC (rev 8952)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/AbstractWidgetProvider.java 2007-11-15 17:02:02 UTC (rev 8953)
@@ -55,17 +55,17 @@
/** The scheduled executor */
protected ScheduledExecutorService scheduledExecutor;
- /** The entry expiration time in millis */
- protected long entryExpiration = TimeUnit.MILLISECONDS.convert(120, TimeUnit.SECONDS);
+ /** The entry expiration time in millis (default: 1 day) */
+ protected long entryExpiration = TimeUnit.MILLISECONDS.convert(86400, TimeUnit.SECONDS);
- /** The query expiration time in millis */
- protected long queryExpiration = TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS);
+ /** The query expiration time in millis (default: 15 minutes) */
+ protected long queryExpiration = TimeUnit.MILLISECONDS.convert(900, TimeUnit.SECONDS);
/** Fetch all widgets in on the directory lookup */
private boolean fetchWidgetsOnDirectoryLookup = false;
/** The connection timeout */
- protected long connectionTimeout;
+ protected long connectionTimeout = 5000;
/** Eviction thread timing */
protected long timing = TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS);
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/ExpiringFutureTask.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/ExpiringFutureTask.java 2007-11-15 16:58:54 UTC (rev 8952)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/ExpiringFutureTask.java 2007-11-15 17:02:02 UTC (rev 8953)
@@ -48,7 +48,7 @@
}
if (this.isDone())
{
- return System.currentTimeMillis() > expires ? true : false;
+ return System.currentTimeMillis() > expires;
}
else
{
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/GGWidget.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/GGWidget.java 2007-11-15 16:58:54 UTC (rev 8952)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/GGWidget.java 2007-11-15 17:02:02 UTC (rev 8953)
@@ -131,7 +131,6 @@
String defaultValue = prefInfo.getDefaultValue() != null ? prefInfo.getDefaultValue() : "";
String[] values = (String[])parameters.get(prefName);
String value = values != null ? values[0] : defaultValue;
- System.out.println("value: " + value);
// if value is present and not a default parameter
if (value != null && !defaultValue.equals(value))
{
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-netvibes-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-netvibes-war/WEB-INF/portlet.xml 2007-11-15 16:58:54 UTC (rev 8952)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-netvibes-war/WEB-INF/portlet.xml 2007-11-15 17:02:02 UTC (rev 8953)
@@ -32,6 +32,16 @@
<portlet-name>NetvibesWidgetPortlet</portlet-name>
<display-name>Netvibes Widget Portlet</display-name>
<portlet-class>org.jboss.portal.widget.netvibes.NetvibesWidgetPortlet</portlet-class>
+ <init-param>
+ <description>Connection timeout when retreiving gadgets from google directory (in milliseconds)</description>
+ <name>connectionTimeout</name>
+ <value>5000</value>
+ </init-param>
+ <init-param>
+ <description>Time until a Widget expires and gets refreshed (in minutes). Default value is 1 day.</description>
+ <name>entryExpiration</name>
+ <value>1440</value>
+ </init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-war/WEB-INF/portlet.xml 2007-11-15 16:58:54 UTC (rev 8952)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-war/WEB-INF/portlet.xml 2007-11-15 17:02:02 UTC (rev 8953)
@@ -33,10 +33,20 @@
<display-name>Google Widget Portlet</display-name>
<portlet-class>org.jboss.portal.widget.google.GGWidgetPortlet</portlet-class>
<init-param>
- <description>Connection timeout when retreiving gadgets from google directory</description>
+ <description>Connection timeout when retreiving gadgets from google directory (in milliseconds)</description>
<name>connectionTimeout</name>
<value>5000</value>
</init-param>
+ <init-param>
+ <description>Time until a Widget expires and gets refreshed (in minutes). Default value is 1 day.</description>
+ <name>entryExpiration</name>
+ <value>1440</value>
+ </init-param>
+ <init-param>
+ <description>Time until a query expires. Default value is 15 minutes.</description>
+ <name>queryExpiration</name>
+ <value>900</value>
+ </init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
16 years, 11 months
JBoss Portal SVN: r8952 - in modules/portlet/trunk: portlet/src/main/org/jboss/portal/portlet/impl/spi and 8 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-15 11:58:54 -0500 (Thu, 15 Nov 2007)
New Revision: 8952
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortalContext.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/state/AbstractPropertyMap.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/state/PropertyMap.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/state/SimplePropertyMap.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractActionInvalidatesTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractCacheMarkupTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractDisableDuringRenderTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/FiltersTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/AbstractNoCacheTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletApplicationDeployment.java
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletController.java
Log:
udpate portlet container trunk to changes in common/web
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -45,7 +45,6 @@
/** Creates an empty parameter set. */
public PortletParameters()
{
- super(new HashMap());
}
/**
@@ -58,11 +57,8 @@
* @throws ClassCastException if the map contains a key that is not a string or a value that is not a string
* array
*/
- public PortletParameters(Map parameterMap) throws NullPointerException, ClassCastException, IllegalArgumentException
+ public PortletParameters(Map<String,String[]> parameterMap) throws NullPointerException, ClassCastException, IllegalArgumentException
{
- super(new HashMap());
-
- //
if (parameterMap == null)
{
throw new IllegalArgumentException("No null map accepted");
@@ -84,47 +80,35 @@
* @throws ClassCastException if the map contains a key that is not a string or a value that is not a string
* array
*/
- public void append(Map params) throws ClassCastException, NullPointerException, IllegalArgumentException
+ public void append(Map<String, String[]> params) throws ClassCastException, NullPointerException, IllegalArgumentException
{
- String[] appendedNames = new String[params.size()];
- String[][] appendedValues = new String[params.size()][];
+ // Clone
+ params = new HashMap<String, String[]>(params);
- // Unwrap all first and validate so we have the atomic behavior guarantee
- int index = 0;
- for (Iterator entries = params.entrySet().iterator(); entries.hasNext();)
+ //
+ for (Map.Entry<String, String[]> entry : params.entrySet())
{
- Map.Entry entry = (Map.Entry)entries.next();
- appendedNames[index] = (String)unwrapKey(entry.getKey());
- appendedValues[index++] = (String[])unwrapValue(entry.getValue());
- }
+ String[] existingValue = get(entry.getKey());
- // Merge or use appended values
- Map delegate = getDelegate(true);
- while (--index >= 0)
- {
- String appendedName = appendedNames[index];
- String[] appendedValue = appendedValues[index];
-
- //
- String[] value = (String[])delegate.get(appendedName);
- if (value != null)
+ // Perform the appending operation if the entry exist
+ if (existingValue != null)
{
- String[] tmp = new String[value.length + appendedValue.length];
- System.arraycopy(value, 0, tmp, 0, value.length);
- System.arraycopy(appendedValue, 0, tmp, value.length, appendedValue.length);
- appendedValue = tmp;
+ String[] appendedValue = entry.getValue();
+ String[] newValue = new String[existingValue.length + appendedValue.length];
+ System.arraycopy(existingValue, 0, newValue, 0, existingValue.length);
+ System.arraycopy(appendedValue, 0, newValue, existingValue.length, appendedValue.length);
+ entry.setValue(newValue);
}
-
- //
- delegate.put(appendedName, appendedValue);
}
+
+ //
+ putAll(params);
}
public String toString()
{
StringBuffer buffer = new StringBuffer("Parameters[");
- Map delegate = getDelegate(false);
- for (Iterator i = delegate.entrySet().iterator(); i.hasNext();)
+ for (Iterator i = entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry)i.next();
String name = (String)entry.getKey();
@@ -147,7 +131,7 @@
* 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)
+ public static PortletParameters wrap(Map<String, String[]> map)
{
if (map instanceof PortletParameters)
{
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortalContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortalContext.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortalContext.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -25,7 +25,7 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
import org.jboss.portal.portlet.spi.PortalContext;
-import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.util.Tools;
import java.util.Set;
import java.util.Map;
@@ -39,10 +39,10 @@
{
/** . */
- private static final Set ALL_WINDOW_STATES = Collections.unmodifiableSet(new CollectionBuilder().add(WindowState.MAXIMIZED).add(WindowState.MINIMIZED).add(WindowState.NORMAL).toHashSet());
+ private static final Set ALL_WINDOW_STATES = Collections.unmodifiableSet(Tools.toSet(WindowState.MAXIMIZED, WindowState.MINIMIZED, WindowState.NORMAL));
/** . */
- private static final Set ALL_MODES = Collections.unmodifiableSet(new CollectionBuilder().add(Mode.EDIT).add(Mode.HELP).add(Mode.VIEW).toHashSet());
+ private static final Set ALL_MODES = Collections.unmodifiableSet(Tools.toSet(Mode.EDIT, Mode.HELP, Mode.VIEW));
/** . */
private final Set windowStates;
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/state/AbstractPropertyMap.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/state/AbstractPropertyMap.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/state/AbstractPropertyMap.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -32,64 +32,26 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6643 $
*/
-public abstract class AbstractPropertyMap extends TypedMap implements PropertyMap
+public class AbstractPropertyMap<IK, IV> extends TypedMap<String, Value, IK, IV> implements PropertyMap
{
- protected AbstractPropertyMap(MapAccessor accessor)
+ public AbstractPropertyMap(MapAccessor<IK, IV> mapAccessor, Converter<String, IK> keyConverter, Converter<Value, IV> valueConverter)
{
- super(accessor);
+ super(mapAccessor, keyConverter, valueConverter);
}
- protected AbstractPropertyMap(Map delegate)
+ public AbstractPropertyMap(Map<IK, IV> map, Converter<String, IK> keyConverter, Converter<Value, IV> valueConverter)
{
- super(delegate);
+ super(map, keyConverter, valueConverter);
}
- /**
- * Only accept non null string objects.
- *
- * @throws ClassCastException if the value is not an instance of string
- */
- protected void assertKeyValidity(Object value)
- {
- if (value instanceof String == false)
- {
- throw new ClassCastException("Key must be a String");
- }
- }
-
- /**
- * Only check are made to the value. The only valid values accepted are non null instance of
- * <code>org.jboss.portal.common.value.Value</code>.
- *
- * @throws NullPointerException if the value is null
- * @throws ClassCastException if the value type is not an instance of <code>org.jboss.portal.common.value.Value</code>
- */
- protected Object getInternalValue(Object value)
- {
- if (value == null)
- {
- throw new NullPointerException("Value must not be null");
- }
- if (value instanceof Value == false)
- {
- throw new ClassCastException("Value must be a Value");
- }
- return value;
- }
-
- protected Object getExternalValue(Object value)
- {
- return value;
- }
-
public Value getProperty(String key) throws IllegalArgumentException
{
if (key == null)
{
throw new IllegalArgumentException("No null key accepted");
}
- return (Value)get(key);
+ return get(key);
}
public void setProperty(String key, Value value) throws IllegalArgumentException
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/state/PropertyMap.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/state/PropertyMap.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/state/PropertyMap.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -30,7 +30,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6643 $
*/
-public interface PropertyMap extends Map
+public interface PropertyMap extends Map<String, Value>
{
/**
* Return the value for the given key or null if it does not exist.
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/state/SimplePropertyMap.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/state/SimplePropertyMap.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/state/SimplePropertyMap.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.state;
+import org.jboss.portal.common.value.Value;
+
import java.util.HashMap;
import java.util.Map;
import java.io.Serializable;
@@ -30,22 +32,54 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6643 $
*/
-public class SimplePropertyMap extends AbstractPropertyMap
+public class SimplePropertyMap extends AbstractPropertyMap<String, Value>
{
+ private static final Converter<String, String> KEY_CONVERTER = new Converter<String, String>()
+ {
+ protected String getInternal(String s) throws IllegalArgumentException, ClassCastException
+ {
+ return s;
+ }
+ protected String getExternal(String s)
+ {
+ return s;
+ }
+ protected boolean equals(String s, String s1)
+ {
+ return s.equals(s1);
+ }
+ };
+
+ private static Converter<Value, Value> VALUE_CONVERTER = new Converter<Value, Value>()
+ {
+ protected Value getInternal(Value value) throws IllegalArgumentException, ClassCastException
+ {
+ return value;
+ }
+ protected Value getExternal(Value value)
+ {
+ return value;
+ }
+ protected boolean equals(Value value, Value value1)
+ {
+ return value.equals(value1);
+ }
+ };
+
public SimplePropertyMap()
{
- this(new HashMap());
+ this(new HashMap<String, Value>());
}
public SimplePropertyMap(int size)
{
- this(new HashMap(size));
+ this(new HashMap<String, Value>(size));
}
public SimplePropertyMap(PropertyMap that)
{
- this(new HashMap());
+ this(new HashMap<String, Value>());
//
if (that == null)
@@ -57,8 +91,8 @@
putAll(that);
}
- public SimplePropertyMap(Map map)
+ public SimplePropertyMap(Map<String, Value> map)
{
- super(map);
+ super(map, KEY_CONVERTER, VALUE_CONVERTER);
}
}
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/portlet/support/info/SecurityInfoSupport.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.support.info;
-import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.TransportGuarantee;
import org.jboss.portal.portlet.info.SecurityInfo;
@@ -45,7 +45,7 @@
public SecurityInfoSupport()
{
- this(new CollectionBuilder().add(TransportGuarantee.NONE).toHashSet());
+ this(Tools.toSet(TransportGuarantee.NONE));
}
public boolean containsTransportGuarantee(TransportGuarantee transportGuarantee)
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractActionInvalidatesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractActionInvalidatesTestCase.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractActionInvalidatesTestCase.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -25,10 +25,9 @@
import org.jboss.portal.unit.JoinPoint;
import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.unit.PortletTestCase;
-import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.unit.actions.PortletRenderTestAction;
import org.jboss.portal.unit.actions.PortletActionTestAction;
-import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.util.Tools;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
@@ -111,7 +110,7 @@
calls.add("2_render");
//
- Set expected = new CollectionBuilder().add("0").add("2_action").add("2_render").toHashSet();
+ Set expected = Tools.toSet("0", "2_action", "2_render");
assertEquals(expected, calls);
// End test
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractCacheMarkupTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractCacheMarkupTestCase.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractCacheMarkupTestCase.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -25,10 +25,9 @@
import org.jboss.portal.unit.PortletTestCase;
import org.jboss.portal.unit.JoinPoint;
import org.jboss.portal.unit.PortletTestContext;
-import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.unit.actions.PortletRenderTestAction;
import org.jboss.portal.unit.actions.PortletActionTestAction;
-import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.util.Tools;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
@@ -186,7 +185,7 @@
{
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
- Set expected = new CollectionBuilder().add("0").add("2_action").add("2_render").add("3").add("5_action").add("5_render").toHashSet();
+ Set expected = Tools.toSet("0", "2_action", "2_render", "3", "5_action", "5_render");
assertEquals(expected, calls);
// Refresh
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractDisableDuringRenderTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractDisableDuringRenderTestCase.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/common/AbstractDisableDuringRenderTestCase.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -25,10 +25,9 @@
import org.jboss.portal.unit.PortletTestCase;
import org.jboss.portal.unit.JoinPoint;
import org.jboss.portal.unit.PortletTestContext;
-import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.unit.actions.PortletRenderTestAction;
import org.jboss.portal.unit.actions.PortletActionTestAction;
-import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.util.Tools;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
@@ -103,7 +102,7 @@
calls.add("2_render");
//
- Set expected = new CollectionBuilder().add("0").add("1").add("2_action").add("2_render").toHashSet();
+ Set expected = Tools.toSet("0", "1", "2_action", "2_render");
assertEquals(expected, calls);
// End test
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/FiltersTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/FiltersTestCase.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/FiltersTestCase.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -26,7 +26,7 @@
import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.unit.actions.PortletRenderTestAction;
import org.jboss.portal.test.portlet.framework.UTP2;
-import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.util.Tools;
import org.jboss.portal.unit.annotations.TestCase;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
@@ -58,7 +58,7 @@
assertNotNull(prd);
ServletFilter.ids.clear();
prd.include(request, response);
- assertEquals(new CollectionBuilder().add("INCLUDE_URL_PATTERN_FILTER").add("INCLUDE_NAMED_FILTER").toHashSet(), ServletFilter.ids);
+ assertEquals(Tools.toSet("INCLUDE_URL_PATTERN_FILTER", "INCLUDE_NAMED_FILTER"), ServletFilter.ids);
//
prd = request.getPortletSession().getPortletContext().getNamedDispatcher("NoopServlet");
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheTestCase.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/expiringcache/ExpiringCacheTestCase.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -27,7 +27,7 @@
import org.jboss.portal.unit.actions.PortletRenderTestAction;
import org.jboss.portal.test.portlet.framework.UTP10;
import org.jboss.portal.test.portlet.framework.UTP11;
-import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.util.Tools;
import org.jboss.portal.unit.annotations.TestCase;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.FailureResponse;
@@ -216,7 +216,7 @@
calls.add("7");
//
- Set expected = new CollectionBuilder().add("0").add("3").add("4").add("7").toHashSet();
+ Set expected = Tools.toSet("0", "3", "4", "7");
assertEquals(expected, calls);
// Refresh
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/AbstractNoCacheTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/AbstractNoCacheTestCase.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/nocache/AbstractNoCacheTestCase.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -25,11 +25,9 @@
import org.jboss.portal.unit.PortletTestCase;
import org.jboss.portal.unit.JoinPoint;
import org.jboss.portal.unit.PortletTestContext;
-import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.unit.actions.PortletRenderTestAction;
import org.jboss.portal.unit.actions.PortletActionTestAction;
-import org.jboss.portal.common.util.CollectionBuilder;
-import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.common.util.Tools;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.FailureResponse;
import org.jboss.unit.driver.response.EndTestResponse;
@@ -198,7 +196,7 @@
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
//
- Set expected = new CollectionBuilder().add("0").add("1").add("2").add("5").add("6_render").add("6_action").toHashSet();
+ Set expected = Tools.toSet("0", "1", "2", "5", "6_render", "6_action");
assertEquals(expected, calls);
// Refresh
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.test.portlet.state;
-import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.common.value.StringValue;
import org.jboss.portal.common.value.Value;
@@ -630,7 +630,7 @@
ValueMapAssert.assertEquals(expectedProps, props);
//
- props = getProperties(popCtx, new CollectionBuilder().add("abc").add("mno").toHashSet());
+ props = getProperties(popCtx, Tools.toSet("abc", "mno"));
expectedProps = new SimplePropertyMap();
expectedProps.setProperty("abc", new StringValue("def"));
ValueMapAssert.assertEquals(expectedProps, props);
@@ -664,7 +664,7 @@
ValueMapAssert.assertEquals(expectedProps, props);
//
- props = getProperties(ccpCtx, new CollectionBuilder().add("abc").add("mno").add("yz").toHashSet());
+ props = getProperties(ccpCtx, Tools.toSet("abc", "mno", "yz"));
expectedProps = new SimplePropertyMap();
expectedProps.setProperty("abc", new StringValue("_def"));
expectedProps.setProperty("mno", new StringValue("pqr"));
Modified: modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletApplicationDeployment.java
===================================================================
--- modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletApplicationDeployment.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletApplicationDeployment.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -32,7 +32,7 @@
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
import org.jboss.portal.web.WebApp;
-import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.NotYetImplemented;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
@@ -105,10 +105,7 @@
String portletContainerId = "PortletContainer[" + webApp.getContextPath() + "," + portletMetaData.getName() + "]";
AbstractBeanMetaData bmd = new AbstractBeanMetaData(portletContainerId, PortletContainerImpl.class.getName());
AbstractConstructorMetaData ctormd = new AbstractConstructorMetaData();
- ctormd.setParameters(new CollectionBuilder().
- add(new AbstractParameterMetaData(PortletMetaData.class.getName(), portletMetaData)).
- add(new AbstractParameterMetaData(JBossPortletMetaData.class.getName(), (Object)null)).
- toArrayList());
+ ctormd.setParameters(Tools.toList((ParameterMetaData)new AbstractParameterMetaData(PortletMetaData.class.getName(), portletMetaData), new AbstractParameterMetaData(JBossPortletMetaData.class.getName(), (Object)null)));
bmd.setConstructor(ctormd);
bmd.setStart(new AbstractLifecycleMetaData("start"));
bmd.setStop(new AbstractLifecycleMetaData("stop"));
@@ -121,7 +118,7 @@
applicationinstallmd.setBean(id);
applicationinstallmd.setParameters(Collections.singletonList((ParameterMetaData)new AbstractParameterMetaData(new ThisValueMetaData())));
applicationinstallmd.setMethodName("addContainer");
- bmd.setInstalls(new CollectionBuilder().add(deployerinstallmd).add(applicationinstallmd).toArrayList());
+ bmd.setInstalls(Tools.toList((InstallMetaData)deployerinstallmd, applicationinstallmd));
AbstractInstallMetaData deployeruninstallmd = new AbstractInstallMetaData();
deployeruninstallmd.setBean("PortletApplicationDeployer");
deployeruninstallmd.setParameters(Collections.singletonList((ParameterMetaData)new AbstractParameterMetaData(new ThisValueMetaData())));
@@ -130,7 +127,7 @@
applicationuninstallmd.setBean(id);
applicationuninstallmd.setParameters(Collections.singletonList((ParameterMetaData)new AbstractParameterMetaData(new ThisValueMetaData())));
applicationuninstallmd.setMethodName("removeContainer");
- bmd.setUninstalls(new CollectionBuilder().add(deployeruninstallmd).add(applicationuninstallmd).toArrayList());
+ bmd.setUninstalls(Tools.toList((InstallMetaData)deployeruninstallmd, applicationuninstallmd));
try
{
KernelControllerContext portletContainerControllerContext = kernel.getController().install(bmd);
@@ -145,13 +142,12 @@
//
AbstractBeanMetaData bmd = new AbstractBeanMetaData(id, PortletApplicationImpl.class.getName());
AbstractConstructorMetaData ctormd = new AbstractConstructorMetaData();
- ctormd.setParameters(new CollectionBuilder().
- add(new AbstractParameterMetaData(PortletApplicationMetaData.class.getName(), metaData)).
- add(new AbstractParameterMetaData(JBossApplicationMetaData.class.getName(), (Object)null)).
- add(new AbstractParameterMetaData(PortletApplicationContext.class.getName(), this)).
- add(new AbstractParameterMetaData(PortletAPIFactory.class.getName(), new AbstractDependencyValueMetaData("PortletAPIFactory"))).
- add(new AbstractParameterMetaData(PortletInfoFactory.class.getName(), new AbstractDependencyValueMetaData("PortletInfoFactory"))).
- toArrayList());
+ ctormd.setParameters(Tools.toList(
+ (ParameterMetaData)new AbstractParameterMetaData(PortletApplicationMetaData.class.getName(), metaData),
+ new AbstractParameterMetaData(JBossApplicationMetaData.class.getName(), (Object)null),
+ new AbstractParameterMetaData(PortletApplicationContext.class.getName(), this),
+ new AbstractParameterMetaData(PortletAPIFactory.class.getName(), new AbstractDependencyValueMetaData("PortletAPIFactory")),
+ new AbstractParameterMetaData(PortletInfoFactory.class.getName(), new AbstractDependencyValueMetaData("PortletInfoFactory"))));
bmd.setConstructor(ctormd);
bmd.setStart(new AbstractLifecycleMetaData("start"));
bmd.setStop(new AbstractLifecycleMetaData("stop"));
Modified: modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletController.java 2007-11-15 16:35:04 UTC (rev 8951)
+++ modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletController.java 2007-11-15 16:58:54 UTC (rev 8952)
@@ -165,7 +165,7 @@
portletNS,
MARKUP_INFO,
PortletParametersStateString.create(request.queryParameters),
- new PortletParameters(request.bodyParameters));
+ request.bodyParameters != null ? new PortletParameters(request.bodyParameters) : null);
ActionInvocation action = new ActionInvocation(actionContext);
//
16 years, 11 months
JBoss Portal SVN: r8951 - in branches/JBoss_Portal_Branch_2_6: core/src/main/org/jboss/portal/core/impl/portlet/state and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-15 11:35:04 -0500 (Thu, 15 Nov 2007)
New Revision: 8951
Modified:
branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletState.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java
branches/JBoss_Portal_Branch_2_6/theme/src/main/org/jboss/portal/test/theme/model/PageObject.java
branches/JBoss_Portal_Branch_2_6/theme/src/main/org/jboss/portal/test/theme/model/RegionObject.java
Log:
udpate 2.6 to updates in common/web/portlet
Modified: branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml 2007-11-15 16:30:05 UTC (rev 8950)
+++ branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml 2007-11-15 16:35:04 UTC (rev 8951)
@@ -48,7 +48,7 @@
-->
<componentref name="jboss-portal/modules/common" version="trunk-SNAPSHOT"/>
- <componentref name="jboss-portal/modules/web" version="1.0.0"/>
+ <componentref name="jboss-portal/modules/web" version="trunk-SNAPSHOT"/>
<componentref name="jboss-portal/modules/test" version="1.0-SNAPSHOT"/>
<componentref name="jboss-portal/modules/portlet" version="1.0-SNAPSHOT"/>
<componentref name="jboss-portal/modules/identity" version="1.0.0"/>
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletState.java 2007-11-15 16:30:05 UTC (rev 8950)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletState.java 2007-11-15 16:35:04 UTC (rev 8951)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.impl.portlet.state;
import org.jboss.portal.common.value.Value;
+import org.jboss.portal.common.util.TypedMap;
import org.jboss.portal.portlet.state.AbstractPropertyMap;
import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.portlet.state.producer.PortletState;
@@ -195,21 +196,50 @@
{
if (ctx == null)
{
- PropertyMap props = new AbstractPropertyMap(entries)
- {
- protected Object getInternalValue(Object value)
- {
- throw new IllegalArgumentException("Immutable");
- }
-
- protected Object getExternalValue(Object value)
- {
- PersistentPortletStateEntry entry = (PersistentPortletStateEntry)value;
- return entry.getValue();
- }
- };
+ PropertyMap props = new AbstractPropertyMap(entries, KEY_CONVERTER, VALUE_CONVERTER);
ctx = new PortletState(portletId, props);
}
return ctx;
}
+
+ private static final TypedMap.Converter KEY_CONVERTER = new TypedMap.Converter()
+ {
+ protected Object getInternal(Object o) throws IllegalArgumentException, ClassCastException
+ {
+ if (!(o instanceof String))
+ {
+ throw new ClassCastException("Was expecting an instanceof " + String.class.getName() + " but was " + o.getClass().getName());
+ }
+ return o;
+ }
+ protected Object getExternal(Object o)
+ {
+ if (!(o instanceof String))
+ {
+ throw new ClassCastException("Was expecting an instanceof " + String.class.getName() + " but was " + o.getClass().getName());
+ }
+ return o;
+ }
+ protected boolean equals(Object o, Object o1)
+ {
+ return o.equals(o1);
+ }
+ };
+
+ private static TypedMap.Converter VALUE_CONVERTER = new TypedMap.Converter()
+ {
+ protected Object getInternal(Object o) throws IllegalArgumentException, ClassCastException
+ {
+ throw new IllegalArgumentException("Immutable");
+ }
+ protected Object getExternal(Object o)
+ {
+ return ((PersistentPortletStateEntry)o).getValue();
+ }
+ protected boolean equals(Object o, Object o1)
+ {
+ return o.equals(o1);
+ }
+ };
+
}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java 2007-11-15 16:30:05 UTC (rev 8950)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java 2007-11-15 16:35:04 UTC (rev 8951)
@@ -33,6 +33,7 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.HashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -64,7 +65,7 @@
this.persistentHandle = null;
this.relatedConsumer = null;
this.persistentStatus = null;
- this.persistentProperties = null;
+ this.persistentProperties = new HashMap();
this.properties = new Properties();
this.relatedPortletStates = null;
}
@@ -248,32 +249,55 @@
// ***********
- /** Implement registration properties semantics, mostly validation and equality. */
- public class Properties extends TypedMap
+ private static final TypedMap.Converter KEY_CONVERTER = new TypedMap.Converter()
{
-
- public Properties()
+ protected Object getInternal(Object o) throws IllegalArgumentException, ClassCastException
{
- super(persistentProperties);
- }
-
- protected void assertKeyValidity(Object key) throws ClassCastException
- {
- if (key instanceof QName == false)
+ if (o instanceof QName == false)
{
throw new ClassCastException();
}
+ return o;
}
+ protected Object getExternal(Object o)
+ {
+ return o;
+ }
+ protected boolean equals(Object o, Object o1)
+ {
+ return o.equals(o1);
+ }
+ };
- protected Object getInternalValue(Object value) throws ClassCastException
+ private static final TypedMap.Converter VALUE_CONVERTER = new TypedMap.Converter()
+ {
+ protected Object getInternal(Object o) throws IllegalArgumentException, ClassCastException
{
- if (value instanceof String == false)
+ if (o instanceof String == false)
{
throw new ClassCastException();
}
- return value;
+ return o;
}
+ protected Object getExternal(Object o)
+ {
+ return o;
+ }
+ protected boolean equals(Object o, Object o1)
+ {
+ return o.equals(o1);
+ }
+ };
+ /** Implement registration properties semantics, mostly validation and equality. */
+ public class Properties extends TypedMap
+ {
+
+ public Properties()
+ {
+ super(persistentProperties, KEY_CONVERTER, VALUE_CONVERTER);
+ }
+
public void setProperty(String propertyName, Object value)
{
if (propertyName == null)
Modified: branches/JBoss_Portal_Branch_2_6/theme/src/main/org/jboss/portal/test/theme/model/PageObject.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/theme/src/main/org/jboss/portal/test/theme/model/PageObject.java 2007-11-15 16:30:05 UTC (rev 8950)
+++ branches/JBoss_Portal_Branch_2_6/theme/src/main/org/jboss/portal/test/theme/model/PageObject.java 2007-11-15 16:35:04 UTC (rev 8951)
@@ -109,18 +109,46 @@
return rendererContext;
}
+ private static final TypedMap.Converter REGION_CONVERTER = new TypedMap.Converter()
+ {
+ protected Object getInternal(Object o) throws IllegalArgumentException, ClassCastException
+ {
+ throw new IllegalArgumentException("read only");
+ }
+
+ protected Object getExternal(Object o)
+ {
+ RegionObject region = (RegionObject)o;
+ return region.getRendererContext();
+ }
+
+ protected boolean equals(Object o, Object o1)
+ {
+ return o.equals(o1);
+ }
+ };
+
+ private static final TypedMap.Converter TRIVIAL_CONVERTER = new TypedMap.Converter()
+ {
+ protected Object getInternal(Object o) throws IllegalArgumentException, ClassCastException
+ {
+ return o;
+ }
+ protected Object getExternal(Object o)
+ {
+ return o;
+ }
+ protected boolean equals(Object o, Object o1)
+ {
+ return o.equals(o1);
+ }
+ };
+
private PageRendererContext rendererContext = new PageRendererContext()
{
public Collection getRegions()
{
- return new TypedMap(regions)
- {
- protected Object getExternalValue(Object value)
- {
- RegionObject region = (RegionObject)value;
- return region.getRendererContext();
- }
- }.values();
+ return new TypedMap(regions, TRIVIAL_CONVERTER, REGION_CONVERTER).values();
}
public RegionRendererContext getRegion(String regionName)
Modified: branches/JBoss_Portal_Branch_2_6/theme/src/main/org/jboss/portal/test/theme/model/RegionObject.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/theme/src/main/org/jboss/portal/test/theme/model/RegionObject.java 2007-11-15 16:30:05 UTC (rev 8950)
+++ branches/JBoss_Portal_Branch_2_6/theme/src/main/org/jboss/portal/test/theme/model/RegionObject.java 2007-11-15 16:35:04 UTC (rev 8951)
@@ -97,6 +97,41 @@
return rendererContext;
}
+ private static final TypedMap.Converter WINDOW_CONVERTER = new TypedMap.Converter()
+ {
+ protected Object getInternal(Object o) throws IllegalArgumentException, ClassCastException
+ {
+ throw new IllegalArgumentException("read only");
+ }
+
+ protected Object getExternal(Object o)
+ {
+ WindowObject window = (WindowObject)o;
+ return window.getRendererContext();
+ }
+
+ protected boolean equals(Object o, Object o1)
+ {
+ return o.equals(o1);
+ }
+ };
+
+ private static final TypedMap.Converter TRIVIAL_CONVERTER = new TypedMap.Converter()
+ {
+ protected Object getInternal(Object o) throws IllegalArgumentException, ClassCastException
+ {
+ return o;
+ }
+ protected Object getExternal(Object o)
+ {
+ return o;
+ }
+ protected boolean equals(Object o, Object o1)
+ {
+ return o.equals(o1);
+ }
+ };
+
private RegionRendererContext rendererContext = new RegionRendererContext()
{
public String getId()
@@ -106,14 +141,7 @@
public Collection getWindows()
{
- return new TypedMap(windows)
- {
- protected Object getExternalValue(Object value)
- {
- WindowObject window = (WindowObject)value;
- return window.getRendererContext();
- }
- }.values();
+ return new TypedMap(windows, TRIVIAL_CONVERTER, WINDOW_CONVERTER).values();
}
public Orientation getOrientation()
16 years, 11 months
JBoss Portal SVN: r8950 - in branches/UIServer: core/src/main/org/jboss/portal/core/presentation and 13 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-11-15 11:30:05 -0500 (Thu, 15 Nov 2007)
New Revision: 8950
Added:
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java
branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/
branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/
branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/UIModelTester.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/MockModelLoaderImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java
Modified:
branches/UIServer/core/build.xml
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java
branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/UIServer/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/persistent-jboss-beans.xml
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContextImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIContext.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIObject.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIWindow.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/state/ObjectState.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java
Log:
integrated UI model population from PortalObjectContainer
Modified: branches/UIServer/core/build.xml
===================================================================
--- branches/UIServer/core/build.xml 2007-11-15 16:20:16 UTC (rev 8949)
+++ branches/UIServer/core/build.xml 2007-11-15 16:30:05 UTC (rev 8950)
@@ -641,7 +641,11 @@
<test todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectPathTestCase"/>
-
+ <zest todir="${test.reports}" name="org.jboss.portal.test.core.presentation.model.UIModelTester"
+ outfile="TEST-UIModelTester">
+ <parameter name="CacheNaturalId" value="true"/>
+ <parameter name="Config" value="persistent-jboss-beans.xml"/>
+ </zest>
</x-test>
<x-classpath>
<pathelement location="${build.lib}/portal-core-lib.jar"/>
@@ -672,7 +676,61 @@
</x-classpath>
</execute-tests>
</target>
+
+ <target name="test-presentation" depends="init">
+ <execute-tests>
+ <x-sysproperty>
+
+ <!--
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
+ -->
+ <sysproperty
+ key="jboss.aop.path"
+ value="${build.resources}/jboss-portal.sar/portal-aop.xml${path.separator}${source.etc}/jboss-aop/base-aop.xml"/>
+ <sysproperty
+ key="jboss.aop.class.path"
+ value="${jbossas/core.libs.lib}/jboss-aspect-library.jar"/>
+
+ </x-sysproperty>
+ <x-test>
+ <zest todir="${test.reports}" name="org.jboss.portal.test.core.presentation.model.UIModelTester"
+ outfile="TEST-UIModelTester">
+ <parameter name="CacheNaturalId" value="true"/>
+ <parameter name="Config" value="persistent-jboss-beans.xml"/>
+ </zest>
+ </x-test>
+ <x-classpath>
+ <pathelement location="${build.lib}/portal-core-lib.jar"/>
+ <pathelement location="${build.lib}/portal-core-test-lib.jar"/>
+ <pathelement location="${build.resources}/jboss-portal.sar"/>
+ <pathelement location="${jboss.portal-test.root}/etc"/>
+ <pathelement location="${build.resources}"/>
+
+ <path refid="apache.collections.classpath"/>
+ <path refid="apache.logging.classpath"/>
+ <path refid="apache.xerces.classpath"/>
+ <path refid="jboss.jbossxb.classpath"/>
+ <path refid="oswego.concurrent.classpath"/>
+ <path refid="jboss.microcontainer.classpath"/>
+ <path refid="apache.httpclient.classpath"/>
+ <path refid="aop.classpath"/>
+ <path refid="dom4j.dom4j.classpath"/>
+ <path refid="cglib.cglib.classpath"/>
+ <path refid="antlr.antlr.classpath"/>
+ <path refid="asm.asm.classpath"/>
+
+ <path refid="library.classpath"/>
+ <path refid="dependentmodule.classpath"/>
+ <pathelement location="${nekohtml.nekohtml.lib}/nekohtml.jar"/>
+ <pathelement location="${dbunit.dbunit.lib}/dbunit.jar"/>
+ <pathelement location="${jdbc.connectors.lib}/mysql-connector-java.jar"/>
+ <!--<pathelement location="postgresql-8.1-407.jdbc3.jar"/>-->
+ </x-classpath>
+ </execute-tests>
+ </target>
+
<!--
Run a single unit test.
ant -Dtest=org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase one-test
Added: branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java (rev 0)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java 2007-11-15 16:30:05 UTC (rev 8950)
@@ -0,0 +1,172 @@
+/******************************************************************************
+ * 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.core.presentation.model;
+
+import java.util.StringTokenizer;
+import java.util.Map;
+import java.util.List;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+import org.jboss.portal.presentation.model2.UIObject;
+import org.jboss.portal.presentation.impl.model2.UIPortalImpl;
+import org.jboss.portal.presentation.impl.model2.UIPageImpl;
+import org.jboss.portal.presentation.impl.model2.UIWindowImpl;
+import org.jboss.portal.presentation.model2.state.ModelLoader;
+import org.jboss.portal.presentation.model2.state.ObjectState;
+
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.PortalContainer;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.Portal;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class ModelLoaderImpl implements ModelLoader
+{
+ /**
+ *
+ */
+ private PortalObjectContainer portalObjectContainer = null;
+
+ /**
+ *
+ * @return
+ */
+ public PortalObjectContainer getPortalObjectContainer()
+ {
+ return portalObjectContainer;
+ }
+
+ /**
+ *
+ * @param portalObjectContainer
+ */
+ public void setPortalObjectContainer(
+ PortalObjectContainer portalObjectContainer)
+ {
+ this.portalObjectContainer = portalObjectContainer;
+ }
+
+ /**
+ *
+ */
+ public ObjectState loadState(String objectId) throws IllegalArgumentException
+ {
+ ObjectState objectState = null;
+
+ //Get the PortalObject corresponding to this objectId from the PortalObjectContainer
+ PortalContainer portalContainer = this.portalObjectContainer.getContext();
+
+ StringTokenizer st = new StringTokenizer(objectId, "/");
+ PortalObject portalObject = portalContainer.getChild(st.nextToken());
+ while(st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ portalObject = portalObject.getChild(token);
+ }
+
+ //Type
+ Class<? extends UIObject> type = this.getType(portalObject);
+
+ //Name
+ String name = portalObject.getName();
+
+ //Properties
+ Map<String, String> properties = portalObject.getDeclaredProperties();
+
+ //Parent Id
+ String parentId = portalObject.getParent().getId().toString();
+ if(parentId.equals("/"))
+ {
+ parentId = "";
+ }
+
+ //Children Ids
+ List<String> childrenIds = new ArrayList<String>();
+ Collection children = portalObject.getChildren();
+ for(Iterator itr=children.iterator(); itr.hasNext();)
+ {
+ PortalObject child = (PortalObject)itr.next();
+ childrenIds.add(child.getId().toString());
+ }
+
+ objectState = new ObjectState(
+ type, //type
+ name,
+ properties, //properties
+ parentId,
+ childrenIds // childrenIds
+ );
+
+ return objectState;
+ }
+
+ /**
+ *
+ * @param portalObject
+ * @return
+ */
+ private Class<? extends UIObject> getType(PortalObject portalObject)
+ {
+ Class<? extends UIObject> type = null;
+
+ if(portalObject instanceof Portal)
+ {
+ type = UIPortalImpl.class;
+ }
+ else if(portalObject instanceof Page)
+ {
+ type = UIPageImpl.class;
+ }
+ else if(portalObject instanceof Window)
+ {
+ type = UIWindowImpl.class;
+ }
+
+ return type;
+ }
+
+ /**
+ *
+ *
+ */
+ public void start()
+ {
+
+ }
+
+ /**
+ *
+ *
+ */
+ public void stop()
+ {
+
+ }
+}
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java 2007-11-15 16:20:16 UTC (rev 8949)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java 2007-11-15 16:30:05 UTC (rev 8950)
@@ -22,9 +22,12 @@
******************************************************************************/
package org.jboss.portal.core.presentation.server;
+import org.jboss.portal.presentation.RequestContext;
import org.jboss.portal.presentation.server.Processor;
+import org.jboss.portal.presentation.server.PresentationServer;
import org.jboss.portal.presentation.server.PortalObjectReader;
-import org.jboss.portal.presentation.server.PresentationServer;
+import org.jboss.portal.presentation.model2.UIWindow;
+import org.jboss.portal.presentation.model2.state.ModelLoader;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -32,11 +35,18 @@
*/
public class PresentationServerImpl implements PresentationServer
{
+ /**
+ *
+ */
private Processor processor = null;
- private PortalObjectReader portalObjectReader = null;
/**
*
+ */
+ private ModelLoader modelLoader = null;
+
+ /**
+ *
*
*/
public PresentationServerImpl()
@@ -65,18 +75,18 @@
/**
*
*/
- public PortalObjectReader getPortalObjectReader()
+ public ModelLoader getModelLoader()
{
- return this.portalObjectReader;
+ return modelLoader;
}
-
+
/**
*
- * @param portalObjectReader
+ * @param modelLoader
*/
- public void setPortalObjectReader(PortalObjectReader portalObjectReader)
+ public void setModelLoader(ModelLoader modelLoader)
{
- this.portalObjectReader = portalObjectReader;
+ this.modelLoader = modelLoader;
}
/**
@@ -95,4 +105,20 @@
{
this.processor = processor;
}
+
+ /**
+ * @deprecated
+ */
+ public PortalObjectReader getPortalObjectReader()
+ {
+ return null;
+ }
+
+ /**
+ *
+ */
+ public String getMarkup(RequestContext context, UIWindow window) throws Exception
+ {
+ return null;
+ }
}
Added: branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/UIModelTester.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/UIModelTester.java (rev 0)
+++ branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/UIModelTester.java 2007-11-15 16:30:05 UTC (rev 8950)
@@ -0,0 +1,149 @@
+/******************************************************************************
+ * 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.test.core.presentation.model;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestSuite;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.test.core.model.portal.AbstractPortalObjectContainerTestCase;
+import org.jboss.portal.test.framework.AbstractPortalTestCase;
+
+import org.jboss.portal.common.junit.TransactionAssert;
+import org.jboss.portal.core.model.portal.*;
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.presentation.model.ModelLoaderImpl;
+import org.jboss.portal.presentation.model2.*;
+import org.jboss.portal.presentation.impl.model2.*;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIModelTester extends AbstractPortalObjectContainerTestCase
+{
+ private Logger logger = Logger.getLogger(this.getClass());
+
+ private UIContext uiContext = null;
+
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return AbstractPortalTestCase.suite(UIModelTester.class);
+ }
+
+ /**
+ *
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ ModelLoaderImpl modelLoader = new ModelLoaderImpl();
+ modelLoader.setPortalObjectContainer(this.container);
+ this.uiContext = new UIContextImpl();
+ ((UIContextImpl)this.uiContext).setModelLoader(modelLoader);
+ this.loadPortalObjectContainer();
+ }
+
+ /**
+ *
+ */
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ this.uiContext = null;
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testModelLoading() throws Exception
+ {
+ TransactionAssert.beginTransaction();
+
+ //Setup rootChildrenInfo
+ Map rootChildrenInfo = new HashMap();
+ rootChildrenInfo.put("defaultPortal", UIPortalImpl.class);
+
+ UIContext objectTree = this.uiContext.initUIObjectTree(rootChildrenInfo);
+ UIObject defaultPortal = objectTree.getChildren(UIPortalImpl.class).get(0);
+
+ assertEquals(defaultPortal.getName(), "defaultPortal");
+ assertEquals(defaultPortal.getId(), "/defaultPortal");
+ assertTrue(defaultPortal instanceof UIPortal);
+
+ List<UIObject> lazyLoadedChildren = defaultPortal.getChildren();
+
+ assertTrue((lazyLoadedChildren != null && lazyLoadedChildren.size()>0));
+ for(int i=0; i<lazyLoadedChildren.size(); i++)
+ {
+ UIObject child = lazyLoadedChildren.get(i);
+ assertEquals(child.getParent().getName(), "defaultPortal");
+ assertEquals(child.getParent().getId(), "/defaultPortal");
+ assertTrue(child instanceof UIPage);
+ assertTrue(child.getId().equals("/defaultPortal/page1") || child.getId().equals("/defaultPortal/page2"));
+
+ if(child.getId().equals("/defaultPortal/page1"))
+ {
+ List<UIObject> subchildren = child.getChildren();
+ for(int j=0; j<subchildren.size(); j++)
+ {
+ UIObject subchild = subchildren.get(j);
+
+ logger.info("------------------------------");
+ logger.info("Child="+subchild+"("+subchild.getId()+")");
+ logger.info("------------------------------");
+ }
+ }
+ }
+
+
+ TransactionAssert.commitTransaction();
+ }
+
+ /**
+ *
+ *
+ */
+ private void loadPortalObjectContainer() throws Exception
+ {
+ TransactionAssert.beginTransaction();
+ PortalContainer ctx = container.getContext();
+ Portal portal_1 = ctx.createPortal("defaultPortal");
+ Page page_1_1 = portal_1.createPage("page1");
+ Page page_1_2 = portal_1.createPage("page2");
+ Page page_1_1_1 = page_1_1.createPage("subpage1");
+ Page page_1_1_3 = page_1_1.createPage("subpage2");
+ Window window_1_1_2 = page_1_1.createWindow("window1", ContentType.PORTLET, "uri");
+ Window window_1_1_4 = page_1_1.createWindow("window3", ContentType.PORTLET, "uri");
+ TransactionAssert.commitTransaction();
+ }
+}
Modified: branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-11-15 16:20:16 UTC (rev 8949)
+++ branches/UIServer/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-11-15 16:30:05 UTC (rev 8950)
@@ -1097,8 +1097,8 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="PortalObjectReader" proxy-type="attribute">portal:container=PortalObjectReader</depends>
<depends optional-attribute-name="Processor" proxy-type="attribute">portal:service=Processor</depends>
+ <depends optional-attribute-name="ModelLoader" proxy-type="attribute">portal:container=ModelLoader</depends>
<depends>portal:service=PageService</depends>
<depends>portal:commandFactory=DefaultPortal</depends>
<depends>portal:urlFactory=Delegating</depends>
@@ -1130,8 +1130,8 @@
<depends>portal:service=ControlPolicy,type=Page</depends>
</mbean>
<mbean
- code="org.jboss.portal.core.presentation.server.PortalObjectReaderImpl"
- name="portal:container=PortalObjectReader"
+ code="org.jboss.portal.core.presentation.model.ModelLoaderImpl"
+ name="portal:container=ModelLoader"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
@@ -1147,8 +1147,7 @@
<depends>portal:service=ContentProviderRegistry</depends>
<depends>portal:service=ResponseHandler,type=Selector</depends>
<depends>portal:service=ControlPolicy,type=Page</depends>
- </mbean>
-
+ </mbean>
<!-- The controller factory -->
<mbean
Modified: branches/UIServer/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/persistent-jboss-beans.xml
===================================================================
--- branches/UIServer/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/persistent-jboss-beans.xml 2007-11-15 16:20:16 UTC (rev 8949)
+++ branches/UIServer/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/persistent-jboss-beans.xml 2007-11-15 16:30:05 UTC (rev 8950)
@@ -90,7 +90,7 @@
<property name="portalAuthorizationManagerFactory"><inject bean="AuthorizationManagerFactory"/></property>
<property name="contentProviderRegistry"><inject bean="ContentProviderRegistry"/></property>
</bean>
-
+
<bean name="TestBean" class="org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase">
<constructor factoryMethod="getBean">
<factory bean="BeanFactory"/>
@@ -99,5 +99,5 @@
<property name="hibernate"><inject bean="HibernateSupport"/></property>
<property name="portalObjectContainer"><inject bean="PortalObjectContainer"/></property>
<property name="authorizationManagerFactory"><inject bean="AuthorizationManagerFactory"/></property>
- </bean>
+ </bean>
</deployment>
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContextImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContextImpl.java 2007-11-15 16:20:16 UTC (rev 8949)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContextImpl.java 2007-11-15 16:30:05 UTC (rev 8950)
@@ -22,8 +22,12 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.model2;
+import java.util.Map;
+import java.util.Iterator;
import org.jboss.portal.presentation.model2.UIContext;
import org.jboss.portal.presentation.model2.UIObject;
+import org.jboss.portal.presentation.model2.state.ModelLoader;
+import org.jboss.portal.presentation.model2.state.ObjectState;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -34,8 +38,79 @@
/**
*
*/
- public UIObject getObject(String id)
+ private ModelLoader modelLoader = null;
+
+ /**
+ *
+ *
+ */
+ public UIContextImpl()
{
- return null;
}
+
+ /**
+ *
+ */
+ public <T extends UIObject> T getObject(String id, Class<T> type)
+ {
+ try
+ {
+ T uiObject = null;
+
+ //Fetch the state of the UIObject in question
+ ObjectState objectState = this.modelLoader.loadState(id);
+
+ uiObject = type.newInstance();
+ ((UIObjectImpl)uiObject).setState(this,objectState, true);
+
+ return uiObject;
+ }
+ catch(InstantiationException ie)
+ {
+ throw new RuntimeException(ie);
+ }
+ catch(IllegalAccessException iae)
+ {
+ throw new RuntimeException(iae);
+ }
+ }
+
+ /**
+ *
+ */
+ public UIContext initUIObjectTree(Map<String,Class<? extends UIObject>> rootChildrenInfo)
+ {
+ UIContext uiContext = new UIContextImpl();
+ ((UIContextImpl)uiContext).setModelLoader(this.getModelLoader());
+
+ //load the children of the UIContext
+ Iterator<String> childrenNames = rootChildrenInfo.keySet().iterator();
+ while(childrenNames.hasNext())
+ {
+ String childName = childrenNames.next();
+ Class<? extends UIObject> type = rootChildrenInfo.get(childName);
+ UIObject child = uiContext.createChild(childName, type);
+ ObjectState objectState = this.modelLoader.loadState(child.getId());
+ ((UIObjectImpl)child).setState(this,objectState, false);
+ }
+
+ return uiContext;
+ }
+
+ /**
+ *
+ */
+ public ModelLoader getModelLoader()
+ {
+ return this.modelLoader;
+ }
+
+ /**
+ *
+ * @param modelLoader
+ */
+ public void setModelLoader(ModelLoader modelLoader)
+ {
+ this.modelLoader = modelLoader;
+ }
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java 2007-11-15 16:20:16 UTC (rev 8949)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java 2007-11-15 16:30:05 UTC (rev 8950)
@@ -24,14 +24,17 @@
import java.util.List;
import java.util.ArrayList;
+import java.io.Serializable;
import org.jboss.portal.presentation.model2.UIObject;
+import org.jboss.portal.presentation.model2.UIContext;
+import org.jboss.portal.presentation.model2.state.ObjectState;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
-public abstract class UIObjectImpl implements UIObject
+public abstract class UIObjectImpl implements UIObject, Serializable
{
/**
*
@@ -46,20 +49,33 @@
/**
*
*/
- protected List<UIObject> children = new ArrayList<UIObject>();
+ protected UIObject parent = null;
/**
*
*/
- protected UIObject parent = null;
+ protected List<UIObject> children = new ArrayList<UIObject>(); //Lazy loaded
/**
+ * used to see if the children of this UIObject are fully loaded or not. Used for helping with lazy loading
+ */
+ private boolean childrenFullyLoaded = false;
+
+
+ /**
+ * This is used to assist with data needed during lazy loading, other state related data etc
+ */
+ private ObjectState state = null;
+
+
+ /**
*
*/
public UIObjectImpl()
{
}
+ //UIObject interface implementation-----------------------------------------------------------------------------------------------------------------------------
/**
*
*/
@@ -80,55 +96,90 @@
*
*/
public UIObject getParent()
- {
+ {
return this.parent;
}
/**
*
*/
+ public List<UIObject> getChildren()
+ {
+ if(!this.childrenFullyLoaded)
+ {
+ //Lazy Load just the children of this UIObject. Don't load the children of each child though
+ if(this.state != null)
+ {
+ List<String> childrenIds = this.state.getChildrenIds();
+ if(childrenIds != null)
+ {
+ for(int i=0; i<childrenIds.size(); i++)
+ {
+ String childId = childrenIds.get(i);
+ ObjectState childState = this.getUIContext().getModelLoader().loadState(childId);
+ this.createChild(childState.getName(), childState.getType());
+ }
+ }
+ }
+
+ this.childrenFullyLoaded = true;
+ }
+
+ return this.children;
+ }
+
+ /**
+ *
+ */
+ public <T extends UIObject> List<UIObject> getChildren(Class<T> type)
+ {
+ List<UIObject> filteredList = new ArrayList<UIObject>();
+
+ //Making sure all children are fully loaded
+ List<UIObject> allChildren = this.getChildren();
+
+ if(allChildren != null)
+ {
+ for(int i=0; i<allChildren.size(); i++)
+ {
+ UIObject child = allChildren.get(i);
+ if(type == child.getClass())
+ {
+ filteredList.add(child);
+ }
+ }
+ }
+ return filteredList;
+ }
+
+ /**
+ *
+ */
public <T extends UIObject> T createChild(String name, Class<T> type) throws IllegalArgumentException
{
try
{
T child = null;
- if(type == UIContainerImpl.class)
+ if(type == UIContextImpl.class)
{
- child = type.newInstance();
- ((UIContainerImpl)child).name = name;
- ((UIContainerImpl)child).parent = this;
- ((UIContainerImpl)child).id = this.generateId(name);
+ throw new IllegalArgumentException("UIContext must be the root of the UIObject tree. It should not be added to any UIObject as a child");
}
- else if(type == UIContextImpl.class)
- {
- child = type.newInstance();
- ((UIContextImpl)child).name = name;
- ((UIContextImpl)child).parent = this;
- ((UIContextImpl)child).id = this.generateId(name);
- }
- else if(type == UIPageImpl.class)
- {
- child = type.newInstance();
- ((UIPageImpl)child).name = name;
- ((UIPageImpl)child).parent = this;
- ((UIPageImpl)child).id = this.generateId(name);
- }
- else if(type == UIPortalImpl.class)
- {
- child = type.newInstance();
- ((UIPortalImpl)child).name = name;
- ((UIPortalImpl)child).parent = this;
- ((UIPortalImpl)child).id = this.generateId(name);
- }
- else if(type == UIWindowImpl.class)
- {
- child = type.newInstance();
- ((UIWindowImpl)child).name = name;
- ((UIWindowImpl)child).parent = this;
- ((UIWindowImpl)child).id = this.generateId(name);
- }
+ child = type.newInstance();
+
+ //Name
+ ((UIObjectImpl)child).name = name;
+
+ //Parent
+ ((UIObjectImpl)child).parent = this;
+
+ //Id
+ ((UIObjectImpl)child).id = this.generateChildId(name);
+
+ //State
+ ((UIObjectImpl)child).state = this.getUIContext().getModelLoader().loadState(((UIObjectImpl)child).id);
+
this.children.add(child);
return child;
}
@@ -146,7 +197,9 @@
*
*/
public void destroyChild(String name)
- {
+ {
+ //Make sure all children are loaded
+ this.getChildren();
if(this.children != null)
{
for(int i=0; i<this.children.size(); i++)
@@ -159,53 +212,127 @@
}
}
}
+ }
+ //-----UIObjectImpl implementation specific methods------------------------------------------------------------------------------------------------------------
+ protected void setState(UIContext uiContext, ObjectState state, boolean loadParent)
+ {
+ //Name
+ this.name = state.getName();
+
+ //Parent..load using parentId from state being used
+ if(loadParent && state.getParentId() != null && state.getParentId().trim().length()>0)
+ {
+ ObjectState parentState = uiContext.getModelLoader().loadState(state.getParentId());
+ this.parent = uiContext.getObject(state.getParentId(), parentState.getType());
+ }
+
+ //Id
+ this.id = this.generateId();
+
+ //State
+ this.state = state;
}
-
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------------
/**
*
+ * @return
*/
- public List<UIObject> getChildren()
+ private String generateId()
{
- return this.children;
+ String newId = null;
+
+ String myName = "";
+ if(this.getName() != null && this.getName().trim().length()>0)
+ {
+ myName = this.getName();
+ }
+
+ //Generate a new id concatenating its entire path in the UIObject tree
+ StringBuffer buffer = new StringBuffer();
+ if(this.getParent() != null && !(this.getParent() instanceof UIContext))
+ {
+ buffer.append("/"+this.getParent().getId().substring(1)+"/");
+ if(myName.trim().length()>0)
+ {
+ buffer.append(myName);
+ }
+ newId = buffer.toString();
+ }
+ else
+ {
+ buffer.append("/");
+ if(myName.trim().length()>0)
+ {
+ buffer.append(myName);
+ }
+ newId = buffer.toString();
+ }
+
+ return newId;
}
-
+
/**
*
+ * @return
*/
- public <T extends UIObject> List<UIObject> getChildren(Class<T> type)
+ private String generateChildId(String childName)
{
- List<UIObject> filteredList = new ArrayList<UIObject>();
- if(this.children != null)
+ String newId = null;
+
+ String myName = "";
+ if(this.getName() != null && this.getName().trim().length()>0)
{
- for(int i=0; i<this.children.size(); i++)
+ myName = this.getName();
+ }
+
+ //Generate a new id concatenating its entire path in the UIObject tree
+ StringBuffer buffer = new StringBuffer();
+ if(this.getParent() != null && !(this.getParent() instanceof UIContext))
+ {
+ buffer.append("/"+this.getParent().getId().substring(1)+"/");
+ if(myName.trim().length()>0)
{
- UIObject child = this.children.get(i);
- if(type == child.getClass())
- {
- filteredList.add(child);
- }
+ buffer.append(myName+"/");
}
+ buffer.append(childName);
+ newId = buffer.toString();
}
- return filteredList;
- }
+ else
+ {
+ buffer.append("/");
+ if(myName.trim().length()>0)
+ {
+ buffer.append(myName+"/");
+ }
+ buffer.append(childName);
+ newId = buffer.toString();
+ }
+
+ return newId;
+ }
/**
*
* @return
*/
- private String generateId(String childName)
+ private UIContext getUIContext()
{
- String newId = null;
+ UIContext uiContext = null;
- if(this.parent != null)
+ //Make sure this UIObject is not the root UIContext object
+ if(this.getParent() == null)
{
- newId = this.parent.getId() + "/" + this.name + "/" + childName;
+ return (UIContext)this;
}
- else
+
+ //Move up the tree to the UIContext and get the ModelLoader
+ UIObject parent = this.getParent();
+ while(!(parent instanceof UIContext))
{
- newId = this.name + "/" + childName;
+ parent = parent.getParent();
}
+ uiContext = (UIContext)parent;
- return newId;
+ return uiContext;
}
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIContext.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIContext.java 2007-11-15 16:20:16 UTC (rev 8949)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIContext.java 2007-11-15 16:30:05 UTC (rev 8950)
@@ -22,13 +22,33 @@
******************************************************************************/
package org.jboss.portal.presentation.model2;
+import java.util.Map;
+import org.jboss.portal.presentation.model2.state.ModelLoader;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public interface UIContext extends UIObject
{
-
- UIObject getObject(String id);
-
+ /**
+ *
+ * @param id
+ * @return
+ */
+ public <T extends UIObject> T getObject(String id, Class<T> type);
+
+ /**
+ *
+ * @param <T>
+ * @param childrenInfo
+ * @return
+ */
+ public UIContext initUIObjectTree(Map<String,Class<? extends UIObject>> rootChildrenInfo);
+
+ /**
+ *
+ * @return
+ */
+ public ModelLoader getModelLoader();
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIObject.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIObject.java 2007-11-15 16:20:16 UTC (rev 8949)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIObject.java 2007-11-15 16:30:05 UTC (rev 8950)
@@ -34,19 +34,19 @@
*
* @return
*/
- String getId();
+ public String getId();
/**
*
* @return
*/
- String getName();
+ public String getName();
/**
*
* @return
*/
- UIObject getParent();
+ public UIObject getParent();
/**
* Create a child with a specified type.
@@ -56,19 +56,19 @@
* @return the newly created child
* @throws IllegalArgumentException if the name is null, already exists or this kind of object does not accept children of the specified type
*/
- <T extends UIObject>T createChild(String name, Class<T> type) throws IllegalArgumentException;
+ public <T extends UIObject>T createChild(String name, Class<T> type) throws IllegalArgumentException;
/**
*
* @param name
*/
- void destroyChild(String name);
+ public void destroyChild(String name);
/**
*
* @return
*/
- List<UIObject> getChildren();
+ public List<UIObject> getChildren();
/**
*
@@ -76,5 +76,5 @@
* @param type
* @return
*/
- <T extends UIObject> List<UIObject> getChildren(Class<T> type);
+ public <T extends UIObject> List<UIObject> getChildren(Class<T> type);
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIWindow.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIWindow.java 2007-11-15 16:20:16 UTC (rev 8949)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIWindow.java 2007-11-15 16:30:05 UTC (rev 8950)
@@ -31,17 +31,39 @@
*/
public interface UIWindow extends UIObject
{
+ /**
+ *
+ * @return
+ */
+ public String getTitle();
- String getTitle();
+ /**
+ *
+ * @param title
+ */
+ public void setTitle(String title);
- void setTitle(String title);
+ /**
+ *
+ * @return
+ */
+ public WindowState getWindowState();
- WindowState getWindowState();
-
- void setWindowState(WindowState windowState);
+ /**
+ *
+ * @param windowState
+ */
+ public void setWindowState(WindowState windowState);
- Mode getMode();
+ /**
+ *
+ * @return
+ */
+ public Mode getMode();
- void setMode(Mode mode);
-
+ /**
+ *
+ * @param mode
+ */
+ public void setMode(Mode mode);
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/state/ObjectState.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/state/ObjectState.java 2007-11-15 16:20:16 UTC (rev 8949)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/state/ObjectState.java 2007-11-15 16:30:05 UTC (rev 8950)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.model2.UIObject;
+import java.io.Serializable;
import java.util.Map;
import java.util.List;
@@ -31,7 +32,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class ObjectState
+public class ObjectState implements Serializable
{
/** . */
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java 2007-11-15 16:20:16 UTC (rev 8949)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java 2007-11-15 16:30:05 UTC (rev 8950)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.RequestContext;
import org.jboss.portal.presentation.model2.UIWindow;
+import org.jboss.portal.presentation.model2.state.ModelLoader;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -53,5 +54,9 @@
*/
String getMarkup(RequestContext context, UIWindow window) throws Exception;
-
+ /**
+ *
+ * @return
+ */
+ ModelLoader getModelLoader();
}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/MockModelLoaderImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/MockModelLoaderImpl.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/MockModelLoaderImpl.java 2007-11-15 16:30:05 UTC (rev 8950)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * 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.presentation.test.model;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.jboss.portal.presentation.impl.model2.UIPortalImpl;
+import org.jboss.portal.presentation.model2.state.ModelLoader;
+import org.jboss.portal.presentation.model2.state.ObjectState;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MockModelLoaderImpl implements ModelLoader
+{
+ /**
+ *
+ */
+ public ObjectState loadState(String objectId) throws IllegalArgumentException
+ {
+ ObjectState state = null;
+
+ int lastIndex = objectId.lastIndexOf('/');
+ String name = objectId.substring(lastIndex+1);
+ String parentId = objectId.substring(0, lastIndex);
+
+ //Just stub children
+ List<String> childrenIds = null;
+ if(name.contains("testingLazyLoading"))
+ {
+ childrenIds = new ArrayList<String>();
+ childrenIds.add(objectId+"/child1");
+ childrenIds.add(objectId+"/child2");
+ childrenIds.add(objectId+"/child3");
+ }
+
+
+ state = new ObjectState(UIPortalImpl.class,
+ name,
+ null, //properties
+ parentId,
+ childrenIds //childrenIds
+ );
+
+ return state;
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java 2007-11-15 16:30:05 UTC (rev 8950)
@@ -0,0 +1,202 @@
+/******************************************************************************
+ * 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.presentation.test.model;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.jboss.portal.presentation.model2.*;
+import org.jboss.portal.presentation.impl.model2.*;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIModelTester extends TestCase
+{
+ private Logger logger = Logger.getLogger(this.getClass());
+ private UIContext uiContext = null;
+
+ /**
+ *
+ */
+ protected void setUp() throws Exception
+ {
+ this.uiContext = new UIContextImpl();
+ ((UIContextImpl)this.uiContext).setModelLoader(new MockModelLoaderImpl());
+ }
+
+ /**
+ *
+ */
+ protected void tearDown() throws Exception
+ {
+ this.uiContext = null;
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testCreateChild() throws Exception
+ {
+ //Adding a UIContext...this should result in an IllegalArgumentException
+ try
+ {
+ this.uiContext.createChild("duplicateRoot", UIContextImpl.class);
+ }
+ catch(Exception e)
+ {
+ this.assertEquals(e.getClass(), IllegalArgumentException.class);
+ }
+
+ //Add a UIPage to the UIContext
+ this.uiContext.createChild("defaultPortal", UIPortalImpl.class);
+
+ //Assert the state of UIPortal added to the UIObject tree
+ UIObject portal = this.uiContext.getChildren(UIPortalImpl.class).get(0);
+ assertEquals(portal.getName(), "defaultPortal");
+ assertEquals(portal.getId(), "/defaultPortal");
+ assertTrue(portal.getParent() instanceof UIContext);
+
+ //Add a UIPage to the UIPortal
+ portal.createChild("defaultPage", UIPageImpl.class);
+ UIObject page = portal.getChildren(UIPageImpl.class).get(0);
+ assertEquals(page.getName(), "defaultPage");
+ assertEquals(page.getId(), "/defaultPortal/defaultPage");
+ assertTrue(page.getParent() instanceof UIPortal);
+
+ //Add a UIPage to the UIContainer
+ page.createChild("defaultContainer", UIContainerImpl.class);
+ UIObject container = page.getChildren(UIContainerImpl.class).get(0);
+ assertEquals(container.getName(), "defaultContainer");
+ assertEquals(container.getId(), "/defaultPortal/defaultPage/defaultContainer");
+ assertTrue(container.getParent() instanceof UIPage);
+
+ //Add a UIWindow to UIPage
+ container.createChild("defaultWindow", UIWindowImpl.class);
+ UIObject window = container.getChildren(UIWindowImpl.class).get(0);
+ assertEquals(window.getName(), "defaultWindow");
+ assertEquals(window.getId(), "/defaultPortal/defaultPage/defaultContainer/defaultWindow");
+ assertTrue(window.getParent() instanceof UIContainer);
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testDestroyChild() throws Exception
+ {
+ //Add a UIPage to the UIContext
+ this.uiContext.createChild("defaultPortal", UIPortalImpl.class);
+
+ //Assert the state of UIPortal added to the UIObject tree
+ UIObject portal = this.uiContext.getChildren(UIPortalImpl.class).get(0);
+
+ //Add a UIPage to the UIPortal
+ portal.createChild("defaultPage", UIPageImpl.class);
+ UIObject page = portal.getChildren(UIPageImpl.class).get(0);
+
+ //Add a UIPage to the UIContainer
+ page.createChild("defaultContainer", UIContainerImpl.class);
+ UIObject container = page.getChildren(UIContainerImpl.class).get(0);
+
+ //Add a UIWindow to UIPage
+ container.createChild("defaultWindow", UIWindowImpl.class);
+ UIObject window = container.getChildren(UIWindowImpl.class).get(0);
+
+ //Destroy the container. When this is done, both container and window must be destroyed from the UIObject tree
+ page.destroyChild(container.getName());
+ List<UIObject> pageChildren = page.getChildren();
+ assertTrue(pageChildren == null || pageChildren.size() == 0);
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testModelLoading() throws Exception
+ {
+ //Setup rootChildrenInfo
+ Map rootChildrenInfo = new HashMap();
+ rootChildrenInfo.put("defaultPortal", UIPortalImpl.class);
+ rootChildrenInfo.put("someOtherPortal", UIPortalImpl.class);
+
+ UIContext objectTree = this.uiContext.initUIObjectTree(rootChildrenInfo);
+ UIObject defaultPortal = objectTree.getChildren(UIPortalImpl.class).get(0);
+ UIObject someOtherPortal = objectTree.getChildren(UIPortalImpl.class).get(1);
+
+ assertEquals(defaultPortal.getName(), "defaultPortal");
+ assertEquals(defaultPortal.getId(), "/defaultPortal");
+ assertEquals(someOtherPortal.getName(), "someOtherPortal");
+ assertEquals(someOtherPortal.getId(), "/someOtherPortal");
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testParentLoading() throws Exception
+ {
+ //Setup rootChildrenInfo
+ Map rootChildrenInfo = new HashMap();
+ rootChildrenInfo.put("defaultPortal", UIPortalImpl.class);
+
+ UIContext objectTree = this.uiContext.initUIObjectTree(rootChildrenInfo);
+
+ UIObject uiObject = objectTree.getObject("/defaultPortal/defaultPage", UIPortalImpl.class);
+ UIObject parent = uiObject.getParent();
+
+ assertEquals(parent.getName(), "defaultPortal");
+ assertEquals(parent.getId(), "/defaultPortal");
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testLazyLoading() throws Exception
+ {
+ Map rootChildrenInfo = new HashMap();
+ rootChildrenInfo.put("testingLazyLoading", UIPortalImpl.class);
+
+ UIContext objectTree = this.uiContext.initUIObjectTree(rootChildrenInfo);
+ UIObject defaultPortal = objectTree.getChildren(UIPortalImpl.class).get(0);
+ List<UIObject> lazyLoadedChildren = defaultPortal.getChildren();
+
+ assertTrue((lazyLoadedChildren != null && lazyLoadedChildren.size()>0));
+ logger.info("-----------------------------------------------------------");
+ for(int i=0; i<lazyLoadedChildren.size(); i++)
+ {
+ UIObject child = lazyLoadedChildren.get(i);
+ logger.info(child.getId());
+ assertEquals(child.getParent().getName(), "testingLazyLoading");
+ assertEquals(child.getParent().getId(), "/testingLazyLoading");
+ }
+ logger.info("--------------------------------------------------------");
+ }
+}
16 years, 11 months
JBoss Portal SVN: r8949 - in modules/portlet/branches/JBP_PORTLET_BRANCH_1_0: portlet/src/main/org/jboss/portal/portlet and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-15 11:20:16 -0500 (Thu, 15 Nov 2007)
New Revision: 8949
Modified:
modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/build/build-thirdparty.xml
modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java
modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/portlet/state/AbstractPropertyMap.java
modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/portlet/state/SimplePropertyMap.java
modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/test/src/main/org/jboss/portal/portlet/test/PortletController.java
Log:
update 1.0 snapshot to common and web update
Modified: modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/build/build-thirdparty.xml
===================================================================
--- modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/build/build-thirdparty.xml 2007-11-15 16:07:42 UTC (rev 8948)
+++ modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/build/build-thirdparty.xml 2007-11-15 16:20:16 UTC (rev 8949)
@@ -47,7 +47,7 @@
-->
<componentref name="jboss-portal/modules/common" version="trunk-SNAPSHOT"/>
- <componentref name="jboss-portal/modules/web" version="1.0.0"/>
+ <componentref name="jboss-portal/modules/web" version="trunk-SNAPSHOT"/>
<componentref name="jboss-portal/modules/test" version="1.0-SNAPSHOT"/>
<componentref name="sun-servlet" version="2.4"/>
<componentref name="sun-jaf" version="1.1"/>
Modified: modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java
===================================================================
--- modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java 2007-11-15 16:07:42 UTC (rev 8948)
+++ modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java 2007-11-15 16:20:16 UTC (rev 8949)
@@ -86,45 +86,36 @@
*/
public void append(Map params) throws ClassCastException, NullPointerException, IllegalArgumentException
{
- String[] appendedNames = new String[params.size()];
- String[][] appendedValues = new String[params.size()][];
+ // Clone
+ params = new HashMap(params);
- // Unwrap all first and validate so we have the atomic behavior guarantee
- int index = 0;
- for (Iterator entries = params.entrySet().iterator(); entries.hasNext();)
+ //
+ for (Iterator i = params.entrySet().iterator();i.hasNext();)
{
- Map.Entry entry = (Map.Entry)entries.next();
- appendedNames[index] = (String)unwrapKey(entry.getKey());
- appendedValues[index++] = (String[])unwrapValue(entry.getValue());
- }
+ Map.Entry entry = (Entry)i.next();
- // Merge or use appended values
- Map delegate = getDelegate(true);
- while (--index >= 0)
- {
- String appendedName = appendedNames[index];
- String[] appendedValue = appendedValues[index];
-
//
- String[] value = (String[])delegate.get(appendedName);
- if (value != null)
+ String[] existingValue = (String[])get(entry.getKey());
+
+ // Perform the appending operation if the entry exist
+ if (existingValue != null)
{
- String[] tmp = new String[value.length + appendedValue.length];
- System.arraycopy(value, 0, tmp, 0, value.length);
- System.arraycopy(appendedValue, 0, tmp, value.length, appendedValue.length);
- appendedValue = tmp;
+ String[] appendedValue = (String[])entry.getValue();
+ String[] newValue = new String[existingValue.length + appendedValue.length];
+ System.arraycopy(existingValue, 0, newValue, 0, existingValue.length);
+ System.arraycopy(appendedValue, 0, newValue, existingValue.length, appendedValue.length);
+ entry.setValue(newValue);
}
-
- //
- delegate.put(appendedName, appendedValue);
}
+
+ //
+ putAll(params);
}
public String toString()
{
StringBuffer buffer = new StringBuffer("Parameters[");
- Map delegate = getDelegate(false);
- for (Iterator i = delegate.entrySet().iterator(); i.hasNext();)
+ for (Iterator i = entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry)i.next();
String name = (String)entry.getKey();
Modified: modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/portlet/state/AbstractPropertyMap.java
===================================================================
--- modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/portlet/state/AbstractPropertyMap.java 2007-11-15 16:07:42 UTC (rev 8948)
+++ modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/portlet/state/AbstractPropertyMap.java 2007-11-15 16:20:16 UTC (rev 8949)
@@ -32,57 +32,19 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6643 $
*/
-public abstract class AbstractPropertyMap extends TypedMap implements PropertyMap
+public class AbstractPropertyMap extends TypedMap implements PropertyMap
{
- protected AbstractPropertyMap(MapAccessor accessor)
+ public AbstractPropertyMap(MapAccessor mapAccessor, Converter converter, Converter converter1)
{
- super(accessor);
+ super(mapAccessor, converter, converter1);
}
- protected AbstractPropertyMap(Map delegate)
+ public AbstractPropertyMap(Map map, Converter converter, Converter converter1)
{
- super(delegate);
+ super(map, converter, converter1);
}
- /**
- * Only accept non null string objects.
- *
- * @throws ClassCastException if the value is not an instance of string
- */
- protected void assertKeyValidity(Object value)
- {
- if (value instanceof String == false)
- {
- throw new ClassCastException("Key must be a String");
- }
- }
-
- /**
- * Only check are made to the value. The only valid values accepted are non null instance of
- * <code>org.jboss.portal.common.value.Value</code>.
- *
- * @throws NullPointerException if the value is null
- * @throws ClassCastException if the value type is not an instance of <code>org.jboss.portal.common.value.Value</code>
- */
- protected Object getInternalValue(Object value)
- {
- if (value == null)
- {
- throw new NullPointerException("Value must not be null");
- }
- if (value instanceof Value == false)
- {
- throw new ClassCastException("Value must be a Value");
- }
- return value;
- }
-
- protected Object getExternalValue(Object value)
- {
- return value;
- }
-
public Value getProperty(String key) throws IllegalArgumentException
{
if (key == null)
Modified: modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/portlet/state/SimplePropertyMap.java
===================================================================
--- modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/portlet/state/SimplePropertyMap.java 2007-11-15 16:07:42 UTC (rev 8948)
+++ modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/portlet/src/main/org/jboss/portal/portlet/state/SimplePropertyMap.java 2007-11-15 16:20:16 UTC (rev 8949)
@@ -22,9 +22,10 @@
******************************************************************************/
package org.jboss.portal.portlet.state;
+import org.jboss.portal.common.value.Value;
+
import java.util.HashMap;
import java.util.Map;
-import java.io.Serializable;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -33,6 +34,54 @@
public class SimplePropertyMap extends AbstractPropertyMap
{
+ private static final Converter KEY_CONVERTER = new Converter()
+ {
+ protected Object getInternal(Object o) throws IllegalArgumentException, ClassCastException
+ {
+ if (!(o instanceof String))
+ {
+ throw new ClassCastException("Was expecting an instanceof " + String.class.getName() + " but was " + o.getClass().getName());
+ }
+ return o;
+ }
+ protected Object getExternal(Object o)
+ {
+ if (!(o instanceof String))
+ {
+ throw new ClassCastException("Was expecting an instanceof " + String.class.getName() + " but was " + o.getClass().getName());
+ }
+ return o;
+ }
+ protected boolean equals(Object o, Object o1)
+ {
+ return o.equals(o1);
+ }
+ };
+
+ private static Converter VALUE_CONVERTER = new Converter()
+ {
+ protected Object getInternal(Object o) throws IllegalArgumentException, ClassCastException
+ {
+ if (!(o instanceof Value))
+ {
+ throw new ClassCastException("Was expecting an instanceof " + Value.class.getName() + " but was " + o.getClass().getName());
+ }
+ return o;
+ }
+ protected Object getExternal(Object o)
+ {
+ if (!(o instanceof Value))
+ {
+ throw new ClassCastException("Was expecting an instanceof " + Value.class.getName() + " but was " + o.getClass().getName());
+ }
+ return o;
+ }
+ protected boolean equals(Object o, Object o1)
+ {
+ return o.equals(o1);
+ }
+ };
+
public SimplePropertyMap()
{
this(new HashMap());
@@ -59,6 +108,6 @@
public SimplePropertyMap(Map map)
{
- super(map);
+ super(map, KEY_CONVERTER, VALUE_CONVERTER);
}
}
Modified: modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/test/src/main/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/test/src/main/org/jboss/portal/portlet/test/PortletController.java 2007-11-15 16:07:42 UTC (rev 8948)
+++ modules/portlet/branches/JBP_PORTLET_BRANCH_1_0/test/src/main/org/jboss/portal/portlet/test/PortletController.java 2007-11-15 16:20:16 UTC (rev 8949)
@@ -165,7 +165,7 @@
portletNS,
MARKUP_INFO,
PortletParametersStateString.create(request.queryParameters),
- new PortletParameters(request.bodyParameters));
+ request.bodyParameters != null ? new PortletParameters(request.bodyParameters) : null);
ActionInvocation action = new ActionInvocation(actionContext);
//
16 years, 11 months