JBoss Portal SVN: r11329 - maven.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-07 15:35:34 -0400 (Mon, 07 Jul 2008)
New Revision: 11329
Added:
maven/jboss-portal-docs-parent/
Log:
Adding dir
16 years
JBoss Portal SVN: r11328 - in maven: trunk and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-07 15:34:35 -0400 (Mon, 07 Jul 2008)
New Revision: 11328
Added:
maven/branches/
maven/tags/
maven/trunk/
maven/trunk/pom.xml
Log:
Adding JBoss Portal Docs Maven parent
Added: maven/trunk/pom.xml
===================================================================
--- maven/trunk/pom.xml (rev 0)
+++ maven/trunk/pom.xml 2008-07-07 19:34:35 UTC (rev 11328)
@@ -0,0 +1,145 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.portal</groupId>
+ <artifactId>jboss-portal-docs-parent</artifactId>
+ <packaging>pom</packaging>
+ <name>JBoss Portal Docs Parent POM</name>
+ <version>1-SNAPSHOT</version>
+
+ <repositories>
+ <repository>
+ <id>repository.maven.org</id>
+ <name>Maven Repository</name>
+ <layout>default</layout>
+ <url>http://repo1.maven.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>repository.maven.org</id>
+ <name>Maven Repository</name>
+ <layout>default</layout>
+ <url>http://repo1.maven.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ <pluginRepository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ <pluginRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.1</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.0.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <sourceDirectory>${pom.basedir}/en</sourceDirectory>
+ <imageResource>
+ <directory>${pom.basedir}/en</directory>
+ <includes>
+ <include>images/**/*</include>
+ </includes>
+ </imageResource>
+ <!--<cssResource>
+ <directory>src/main/css</directory>
+ </cssResource>-->
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>${pom.name}.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>eclipse</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/eclipse.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <!-- needed for uri-resolvers; can be ommitted if using 'current' uri scheme -->
+ <!-- could also locate the docbook dependency and inspect its version... -->
+ <docbookVersion>1.72.0</docbookVersion>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <properties>
+ <translation>en-US</translation>
+ </properties>
+
+</project>
16 years
JBoss Portal SVN: r11327 - docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/images.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-07 15:05:09 -0400 (Mon, 07 Jul 2008)
New Revision: 11327
Modified:
docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/images/
Log:
Use externals
Property changes on: docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/images
___________________________________________________________________
Name: svn:externals
+ common ../../../common/en/images
16 years
JBoss Portal SVN: r11326 - in modules/presentation/trunk: classic/src/main/java/org/jboss/portal/presentation/classic and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-07 14:31:34 -0400 (Mon, 07 Jul 2008)
New Revision: 11326
Removed:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicUINode.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicViewPortContext.java
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/model/AjaxViewPortContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelStructuralState.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralAdapter.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralStateContextImpl.java
Log:
update rest of codebase to work with framework changes
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/model/AjaxViewPortContext.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/model/AjaxViewPortContext.java 2008-07-07 17:45:48 UTC (rev 11325)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/model/AjaxViewPortContext.java 2008-07-07 18:31:34 UTC (rev 11326)
@@ -23,11 +23,12 @@
package org.jboss.portal.presentation.ajax.server.model;
import org.jboss.portal.presentation.model.ViewPortContext;
-import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.model.ui.UILayout;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.ajax.client.model.update.ModelUpdate;
import org.jboss.portal.presentation.ajax.client.model.update.AddObject;
import org.jboss.portal.presentation.ajax.client.model.update.RemoveObject;
@@ -36,12 +37,13 @@
import org.jboss.portal.presentation.ajax.client.model.update.AddChild;
import org.jboss.portal.presentation.ajax.client.model.update.RemoveChild;
import org.jboss.portal.presentation.ajax.client.model.update.ObjectType;
-import org.jboss.portal.presentation.state.StateType;
import org.jboss.portal.common.NotYetImplemented;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
+import java.util.Set;
+import java.io.Serializable;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -54,11 +56,11 @@
private ArrayList<ModelUpdate> updates;
/** . */
- private Map<String, UIObject> objects;
+ private Map<String, UIObjectContext> objects;
public AjaxViewPortContext()
{
- objects = new HashMap<String, UIObject>();
+ objects = new HashMap<String, UIObjectContext>();
updates = new ArrayList<ModelUpdate>();
}
@@ -69,12 +71,12 @@
return tmp;
}
- public UIObject getObject(String objectId)
+ public UIObjectContext getObject(String objectId)
{
return objects.get(objectId);
}
- public void addObject(UIObject object)
+ public void addObject(UIObjectContext object)
{
String objectId = object.getId();
@@ -82,20 +84,23 @@
objects.put(objectId, object);
//
+ Class<? extends UIObject> type = object.getType();
+
+ //
int objectType;
- if (object instanceof UIContext)
+ if (UIContext.class.isAssignableFrom(type))
{
objectType = ObjectType.CONTEXT;
}
- else if (object instanceof UIPage)
+ else if (UIPage.class.isAssignableFrom(type))
{
objectType = ObjectType.PAGE;
}
- else if (object instanceof UIWindow)
+ else if (UIWindow.class.isAssignableFrom(type))
{
objectType = ObjectType.WINDOW;
}
- else if (object instanceof UILayout)
+ else if (UILayout.class.isAssignableFrom(type))
{
objectType = ObjectType.PANE;
}
@@ -104,23 +109,14 @@
throw new NotYetImplemented();
}
- //
- Map objectProperties = new HashMap();
- for (String propertyName : object.getPropertyNames(StateType.STRUCTURAL))
- {
- Object propertyValue = object.getPropertyValue(StateType.STRUCTURAL, propertyName, Object.class);
- objectProperties.put(propertyName, propertyValue);
- }
-
- //
- updates.add(new AddObject(objectId, objectType, objectProperties));
+ // We clone the map because of the immutability of the context properties that cannot
+ // be serialized by GWT. The type javax.util.HashMap is serializable by GWT
+ updates.add(new AddObject(objectId, objectType, new HashMap<String, Serializable>(object.getProperties())));
}
- public void updateObject(String objectId)
+ public void updateObject(String objectId, Set<String> removedProperties, Map<String, Serializable> updatedProperties, Map<String, Serializable> addedProperties)
{
-// updates
-//
- throw new NotYetImplemented();
+ throw new NotYetImplemented("todo");
}
public void removeObject(String objectId)
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-07-07 17:45:48 UTC (rev 11325)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-07-07 18:31:34 UTC (rev 11326)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.presentation.classic;
-import org.jboss.portal.presentation.classic.model.ClassicUINode;
-import org.jboss.portal.presentation.classic.model.ClassicViewPortContext;
import org.jboss.portal.presentation.classic.protocol.ClassicActionDecoderContext;
import org.jboss.portal.presentation.classic.protocol.ClassicActionEncoderContext;
import org.jboss.portal.presentation.view.PageViewPortScope;
@@ -33,6 +31,8 @@
import org.jboss.portal.presentation.protocol.codec.ActionEncoderContext;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.impl.model.UIModelImpl;
+import org.jboss.portal.presentation.impl.model.pull.DetachedViewPortContext;
+import org.jboss.portal.presentation.impl.model.pull.DetachedUINode;
import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextSerialization;
import org.jboss.portal.presentation.model.UIModel;
@@ -240,7 +240,7 @@
//
StructuralStateContext ssc = server.getStructuralStateContext();
- ClassicViewPortContext context = new ClassicViewPortContext();
+ DetachedViewPortContext context = new DetachedViewPortContext(navigationalStateContext);
UIModel model = new UIModelImpl(null, ssc);
ViewPort viewPort = model.createViewPort(context, scope);
@@ -248,7 +248,7 @@
viewPort.refresh();
//
- ClassicUINode node = context.getNode(nodeId);
+ DetachedUINode node = context.getNode(nodeId);
//
resp.setContentType("text/html");
Deleted: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicUINode.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicUINode.java 2008-07-07 17:45:48 UTC (rev 11325)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicUINode.java 2008-07-07 18:31:34 UTC (rev 11326)
@@ -1,71 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.classic.model;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.UINode;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ClassicUINode implements UINode
-{
-
- /** . */
- private final UIObject object;
-
- /** . */
- ClassicUINode parent;
-
- /** . */
- Map<String, ClassicUINode> children;
-
- public ClassicUINode(UIObject object)
- {
- this.object = object;
- }
-
- public ClassicUINode getParent()
- {
- return parent;
- }
-
- public String getId()
- {
- return object.getId();
- }
-
- public UIObject getObject()
- {
- return object;
- }
-
- public Collection<? extends UINode> getChildren()
- {
- return children == null ? null : children.values();
- }
-}
Deleted: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicViewPortContext.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicViewPortContext.java 2008-07-07 17:45:48 UTC (rev 11325)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/ClassicViewPortContext.java 2008-07-07 18:31:34 UTC (rev 11326)
@@ -1,103 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.classic.model;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.ViewPortContext;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ClassicViewPortContext implements ViewPortContext
-{
-
- /** . */
- final Map<String, ClassicUINode> nodes = new HashMap<String, ClassicUINode>();
-
- public ClassicUINode getNode(String nodeId)
- {
- return nodes.get(nodeId);
- }
-
- public UIObject getObject(String objectId)
- {
- ClassicUINode node = nodes.get(objectId);
-
- //
- if (node == null)
- {
- return null;
- }
- else
- {
- return node.getObject();
- }
- }
-
- public void addObject(UIObject object)
- {
- ClassicUINode node = new ClassicUINode(object);
-
- //
- nodes.put(node.getId(), node);
- }
-
- public void updateObject(String objectId)
- {
- throw new UnsupportedOperationException();
- }
-
- public void removeObject(String objectId)
- {
- throw new UnsupportedOperationException();
- }
-
- public void createChildren(String parentId)
- {
- nodes.get(parentId).children = new HashMap<String, ClassicUINode>();
- }
-
- public void destroyChildren(String parentId)
- {
- throw new UnsupportedOperationException();
- }
-
- public void addChild(String parentId, String childId)
- {
- ClassicUINode parent = nodes.get(parentId);
- ClassicUINode child = nodes.get(childId);
-
- //
- parent.children.put(child.getId(), child);
- child.parent = parent;
- }
-
- public void removeChild(String parentId, String childId)
- {
- throw new UnsupportedOperationException();
- }
-}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-07-07 17:45:48 UTC (rev 11325)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-07-07 18:31:34 UTC (rev 11326)
@@ -305,12 +305,4 @@
//
return new ModelStructuralState(type, properties);
}
-
- public void lock(Object o)
- {
- }
-
- public void unlock(Object o)
- {
- }
}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelStructuralState.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelStructuralState.java 2008-07-07 17:45:48 UTC (rev 11325)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelStructuralState.java 2008-07-07 18:31:34 UTC (rev 11326)
@@ -58,26 +58,4 @@
{
return properties;
}
-
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof ModelStructuralState)
- {
- ModelStructuralState that = (ModelStructuralState)obj;
-
- //
- if (!that.type.equals(this.type))
- {
- return false;
- }
-
- //
- return that.properties.equals(this.properties);
- }
- return false;
- }
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralAdapter.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralAdapter.java 2008-07-07 17:45:48 UTC (rev 11325)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralAdapter.java 2008-07-07 18:31:34 UTC (rev 11326)
@@ -30,6 +30,14 @@
import java.io.Serializable;
/**
+ * The structural adapter used to adapt a back end model to a structural state context interface. This framework
+ * should be used only to build prototypes.
+ *
+ * <ul>
+ * <li>Consistency is based on object equality and not versionning</li>
+ * <li>It MUST not be used in production as no locking is performed and performance are not optimal</li>
+ * </ul>
+ *
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
@@ -40,20 +48,15 @@
N getNode(String id);
- N getParent(N n);
+ N getParent(N node);
- Collection<? extends N> getChildren(N n);
+ Collection<? extends N> getChildren(N node);
- String getId(N n);
+ String getId(N node);
- Class<? extends UIObject> getType(N n);
+ Class<? extends UIObject> getType(N node);
- Map<String, Serializable> getProperties(N n);
+ Map<String, Serializable> getProperties(N node);
- StructuralState getState(N n);
-
- void lock(N n);
-
- void unlock(N n);
-
+ StructuralState getState(N node);
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralStateContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralStateContextImpl.java 2008-07-07 17:45:48 UTC (rev 11325)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralStateContextImpl.java 2008-07-07 18:31:34 UTC (rev 11326)
@@ -71,33 +71,23 @@
private StructuralObjectImpl takeSnapshot(N node)
{
- adapter.lock(node);
+ StructuralState state = adapter.getState(node);
//
- try
+ Set<String> childrenIds = new HashSet<String>();
+ for (N childNode : adapter.getChildren(node))
{
- StructuralState state = adapter.getState(node);
+ childrenIds.add(adapter.getId(childNode));
+ }
- //
- Set<String> childrenIds = new HashSet<String>();
- for (N childNode : adapter.getChildren(node))
- {
- childrenIds.add(adapter.getId(childNode));
- }
+ //
+ N parent = adapter.getParent(node);
- //
- N parent = adapter.getParent(node);
+ //
+ String parentId = parent != null ? adapter.getId(parent) : null;
- //
- String parentId = parent != null ? adapter.getId(parent) : null;
-
- //
- return new StructuralObjectImpl(adapter.getId(node), parentId, Collections.unmodifiableSet(childrenIds), state);
- }
- finally
- {
- adapter.unlock(node);
- }
+ //
+ return new StructuralObjectImpl(adapter.getId(node), parentId, Collections.unmodifiableSet(childrenIds), state);
}
public Collection<StructuralObject> loadChildren(StructuralObject structuralParent) throws IllegalArgumentException, StateException
@@ -116,7 +106,9 @@
throw new NoSuchStateException();
}
- if (!takeSnapshot(parentNode).equals(structuralParent))
+ //
+ StructuralState parentNodeState = adapter.getState(parentNode);
+ if (!equals(parentNodeState, structuralParent.getState()))
{
throw new StaleStateException();
}
@@ -134,6 +126,17 @@
return structuralChildren;
}
+ private boolean equals(StructuralState o1, StructuralState o2)
+ {
+ if (!o1.getType().equals(o2.getType()))
+ {
+ return false;
+ }
+
+ //
+ return o1.getProperties().equals(o2.getProperties());
+ }
+
public StructuralObject loadParent(StructuralObject structuralChild) throws IllegalArgumentException, StateException
{
if (structuralChild == null)
16 years
JBoss Portal SVN: r11325 - in modules/presentation/trunk/presentation/src: main/java/org/jboss/portal/presentation/impl/model/pull and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-07 13:45:48 -0400 (Mon, 07 Jul 2008)
New Revision: 11325
Removed:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UpdatePhase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ViewPortImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedViewPortContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/UINodeImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UILayoutImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPaneImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObjectContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/AddChildTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/ModelTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/MoveChildTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/NodeDef.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/RemoveChildRecursiveTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/RemoveChildTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/TypeTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectNode.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectTree.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UpdateObjectTestCase.java
Log:
- make property update test case more strict
- fix for making the more strict test to pass
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -197,7 +197,7 @@
//
return ObjectDiff.createRecursiveUpdate(
- object.getStructuralObject().getId(),
+ refresh.getObject(),
refresh.getRemovedProperties(),
refresh.getUpdatedProperties(),
refresh.getAddedProperties(),
@@ -213,7 +213,7 @@
//
return ObjectDiff.createSingleUpdate(
- object.getStructuralObject().getId(),
+ refresh.getObject(),
refresh.getRemovedProperties(),
refresh.getUpdatedProperties(),
refresh.getAddedProperties(),
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -23,10 +23,11 @@
package org.jboss.portal.presentation.impl.model;
import org.jboss.portal.presentation.model.UIObjectContext;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.state.structural.StructuralObject;
import java.util.Map;
+import java.io.Serializable;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -38,13 +39,10 @@
/** We keep track of what was loaded by the scope. */
Map<String, UIObjectRef> childRefs;
- final NavigationalStateContext navigationalStateContext;
+ StructuralObject structuralObject;
- final StructuralObject structuralObject;
-
- InternalObjectContext(NavigationalStateContext navigationalStateContext, StructuralObject structuralObject)
+ InternalObjectContext(StructuralObject structuralObject)
{
- this.navigationalStateContext = navigationalStateContext;
this.structuralObject = structuralObject;
}
@@ -53,8 +51,18 @@
return structuralObject;
}
- public NavigationalStateContext getNavigationalStateContext()
+ public String getId()
{
- return navigationalStateContext;
+ return structuralObject.getId();
}
+
+ public Class<? extends UIObject> getType()
+ {
+ return structuralObject.getState().getType();
+ }
+
+ public Map<String, Serializable> getProperties()
+ {
+ return structuralObject.getState().getProperties();
+ }
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -57,17 +57,17 @@
}
static SingleUpdate createSingleUpdate(
- String objectId,
+ StructuralObject object,
Set<String> removedProperties,
Map<String, Serializable> updatedProperties,
Map<String, Serializable> addedProperties,
Collection<Evict> evictedChildren)
{
- return new SingleUpdate(objectId, removedProperties, updatedProperties, addedProperties, evictedChildren);
+ return new SingleUpdate(object, removedProperties, updatedProperties, addedProperties, evictedChildren);
}
static RecursiveUpdate createRecursiveUpdate(
- String objectId,
+ StructuralObject object,
Set<String> removedProperties,
Map<String, Serializable> updatedProperties,
Map<String, Serializable> addedProperties,
@@ -78,7 +78,7 @@
Collection<Evict> removedChildren)
{
return new RecursiveUpdate(
- objectId,
+ object,
removedProperties,
updatedProperties,
addedProperties,
@@ -200,7 +200,7 @@
private final Collection<Evict> removedChildren;
private RecursiveUpdate(
- String objectId,
+ StructuralObject object,
Set<String> removedProperties,
Map<String, Serializable> updatedProperties,
Map<String, Serializable> addedProperties,
@@ -211,7 +211,7 @@
Collection<Evict> removedChildren)
{
super(
- objectId,
+ object,
removedProperties,
updatedProperties,
addedProperties);
@@ -284,14 +284,14 @@
private final Collection<Evict> evictedChildren;
public SingleUpdate(
- String objectId,
+ StructuralObject object,
Set<String> removedProperties,
Map<String, Serializable> updatedProperties,
Map<String, Serializable> addedProperties,
Collection<Evict> evictedChildren)
{
super(
- objectId,
+ object,
removedProperties,
updatedProperties,
addedProperties);
@@ -317,6 +317,9 @@
{
/** . */
+ private final StructuralObject object;
+
+ /** . */
private final Set<String> removedProperties;
/** . */
@@ -326,19 +329,25 @@
private final Map<String, Serializable> addedProperties;
private Update(
- String objectId,
+ StructuralObject object,
Set<String> removedProperties,
Map<String, Serializable> updatedProperties,
Map<String, Serializable> addedProperties)
{
- super(objectId);
+ super(object.getId());
//
+ this.object = object;
this.removedProperties = removedProperties;
this.updatedProperties = updatedProperties;
this.addedProperties = addedProperties;
}
+ public StructuralObject getObject()
+ {
+ return object;
+ }
+
public Set<String> getRemovedProperties()
{
return removedProperties;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UpdatePhase.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UpdatePhase.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UpdatePhase.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -23,7 +23,6 @@
package org.jboss.portal.presentation.impl.model;
import org.jboss.portal.presentation.model.ViewPortContext;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import java.util.Collection;
import java.util.HashMap;
@@ -47,15 +46,10 @@
/** . */
private final ObjectDiff rootDiff;
- /** . */
- private final NavigationalStateContext navigationalStateContext;
-
public UpdatePhase(
- NavigationalStateContext navigationalStateContext,
ViewPortContext context,
ObjectDiff rootDiff)
{
- this.navigationalStateContext = navigationalStateContext;
this.context = context;
this.rootDiff = rootDiff;
}
@@ -158,7 +152,7 @@
ObjectDiff.Load load = (ObjectDiff.Load)diff;
//
- InternalObjectContext objectContext = new InternalObjectContext(navigationalStateContext, load.getObject());
+ InternalObjectContext objectContext = new InternalObjectContext(load.getObject());
//
context.addObject(objectContext);
@@ -180,6 +174,12 @@
ObjectDiff.Update update = (ObjectDiff.Update)diff;
//
+ InternalObjectContext objectContext = (InternalObjectContext)context.getObject(diff.getObjectId());
+
+ //
+ objectContext.structuralObject = update.getObject();
+
+ //
context.updateObject(
diff.getObjectId(),
update.getRemovedProperties(),
@@ -192,9 +192,6 @@
ObjectDiff.RecursiveUpdate recursiveUpdate = (ObjectDiff.RecursiveUpdate)diff;
//
- InternalObjectContext objectContext = (InternalObjectContext)context.getObject(diff.getObjectId());
-
- //
if (recursiveUpdate.getCreateChildren())
{
objectContext.childRefs = new HashMap<String, UIObjectRef>();
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ViewPortImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ViewPortImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ViewPortImpl.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -60,7 +60,7 @@
ObjectDiff rootDiff = diffPhase.getRootVisit();
//
- UpdatePhase phase = new UpdatePhase(model.navigationalStateContext, context, rootDiff);
+ UpdatePhase phase = new UpdatePhase(context, rootDiff);
//
phase.perform();
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedViewPortContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedViewPortContext.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedViewPortContext.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -26,6 +26,7 @@
import org.jboss.portal.presentation.model.ViewPortContext;
import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import java.util.HashMap;
import java.util.Map;
@@ -42,6 +43,14 @@
/** . */
final Map<String, DetachedUINode> nodes = new HashMap<String, DetachedUINode>();
+ /** . */
+ final NavigationalStateContext navigationalStateContext;
+
+ public DetachedViewPortContext(NavigationalStateContext navigationalStateContext)
+ {
+ this.navigationalStateContext = navigationalStateContext;
+ }
+
public DetachedUINode getNode(String nodeId)
{
return nodes.get(nodeId);
@@ -64,7 +73,7 @@
public void addObject(UIObjectContext objectContext)
{
- UIObject object = UIObjectImpl.create(objectContext);
+ UIObject object = UIObjectImpl.create(navigationalStateContext, objectContext);
//
DetachedUINode node = new DetachedUINode(object, objectContext);
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/UINodeImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/UINodeImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/UINodeImpl.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -32,6 +32,8 @@
import java.util.Collection;
import java.util.ArrayList;
+import java.util.Map;
+import java.io.Serializable;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -84,11 +86,26 @@
return structuralObject;
}
+ public String getId()
+ {
+ return structuralObject.getId();
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return structuralObject.getState().getType();
+ }
+
+ public Map<String, Serializable> getProperties()
+ {
+ return structuralObject.getState().getProperties();
+ }
+
public UIObject getObject()
{
if (object == null)
{
- object = UIObjectImpl.create(this);
+ object = UIObjectImpl.create(navigationalStateContext, this);
}
//
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.UIObjectContext;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -31,8 +32,8 @@
*/
public class UIContextImpl extends UILayoutImpl implements UIContext
{
- public UIContextImpl(UIObjectContext context)
+ public UIContextImpl(NavigationalStateContext navigationalStateContext, UIObjectContext context)
{
- super(context);
+ super(navigationalStateContext, context);
}
}
\ No newline at end of file
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UILayoutImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UILayoutImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UILayoutImpl.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.model.ui.UILayout;
import org.jboss.portal.presentation.model.UIObjectContext;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -32,8 +33,8 @@
public abstract class UILayoutImpl extends UIObjectImpl implements UILayout
{
- public UILayoutImpl(UIObjectContext context)
+ public UILayoutImpl(NavigationalStateContext navigationalStateContext, UIObjectContext context)
{
- super(context);
+ super(navigationalStateContext, context);
}
}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -1,40 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.impl.model.ui;
-
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
-import org.jboss.portal.presentation.state.structural.StructuralObject;
-
-/**
- * Just some context data for a uiobject that can be used by different concerns.
- *
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public interface UIObjectContext
-{
-
- NavigationalStateContext getNavigationalStateContext();
-
- StructuralObject getStructuralObject();
-}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -32,7 +32,7 @@
import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.state.StateException;
import org.jboss.portal.presentation.state.StateType;
-import org.jboss.portal.presentation.state.structural.StructuralObject;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import java.util.Set;
@@ -46,32 +46,34 @@
/** . */
private final UIObjectContext context;
- public static UIObjectImpl create(UIObjectContext objectContext)
+ /** . */
+ private final NavigationalStateContext navigationalStateContext;
+
+ public static UIObjectImpl create(
+ NavigationalStateContext navigationalStateContext,
+ UIObjectContext objectContext)
{
UIObjectImpl object;
//
- StructuralObject structuralObject = objectContext.getStructuralObject();
+ Class type = objectContext.getType();
//
- Class type = structuralObject.getState().getType();
-
- //
if (type == UIWindow.class)
{
- object = new UIWindowImpl(objectContext);
+ object = new UIWindowImpl(navigationalStateContext, objectContext);
}
else if (type == UIPage.class)
{
- object = new UIPageImpl(objectContext);
+ object = new UIPageImpl(navigationalStateContext, objectContext);
}
else if (type == UIPane.class)
{
- object = new UIPaneImpl(objectContext);
+ object = new UIPaneImpl(navigationalStateContext, objectContext);
}
else if (type == UIContext.class)
{
- object = new UIContextImpl(objectContext);
+ object = new UIContextImpl(navigationalStateContext, objectContext);
}
else
{
@@ -82,15 +84,15 @@
return object;
}
- public UIObjectImpl(
- UIObjectContext context)
+ public UIObjectImpl(NavigationalStateContext navigationalStateContext, UIObjectContext context)
{
+ this.navigationalStateContext = navigationalStateContext;
this.context = context;
}
public String getId()
{
- return context.getStructuralObject().getId();
+ return context.getId();
}
public <T> T getPropertyValue(StateType stateType, String propertyName, Class<T> propertyType) throws IllegalArgumentException, StateException
@@ -112,9 +114,9 @@
switch (stateType)
{
case STRUCTURAL:
- return Reflection.safeCast(context.getStructuralObject().getState().getProperties().get(propertyName), propertyType);
+ return Reflection.safeCast(context.getProperties().get(propertyName), propertyType);
case NAVIGATIONAL:
- return Reflection.safeCast(context.getNavigationalStateContext().getProperty(getStructuralObject().getId(), propertyName), propertyType);
+ return Reflection.safeCast(navigationalStateContext.getProperty(context.getId(), propertyName), propertyType);
default:
throw new AssertionError();
}
@@ -131,19 +133,14 @@
switch (stateType)
{
case STRUCTURAL:
- return context.getStructuralObject().getState().getProperties().keySet();
+ return context.getProperties().keySet();
case NAVIGATIONAL:
- return context.getNavigationalStateContext().getPropertyNames(context.getStructuralObject().getId());
+ return navigationalStateContext.getPropertyNames(context.getId());
default:
throw new AssertionError();
}
}
- public StructuralObject getStructuralObject()
- {
- return context.getStructuralObject();
- }
-
public UIObjectContext getContext()
{
return context;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.UIObjectContext;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -31,8 +32,8 @@
*/
public class UIPageImpl extends UILayoutImpl implements UIPage
{
- public UIPageImpl(UIObjectContext context)
+ public UIPageImpl(NavigationalStateContext navigationalStateContext, UIObjectContext context)
{
- super(context);
+ super(navigationalStateContext, context);
}
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPaneImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPaneImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPaneImpl.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -23,6 +23,7 @@
package org.jboss.portal.presentation.impl.model.ui;
import org.jboss.portal.presentation.model.UIObjectContext;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -30,8 +31,8 @@
*/
public class UIPaneImpl extends UILayoutImpl
{
- public UIPaneImpl(UIObjectContext context)
+ public UIPaneImpl(NavigationalStateContext navigationalStateContext, UIObjectContext context)
{
- super(context);
+ super(navigationalStateContext, context);
}
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -27,6 +27,7 @@
import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.state.StateType;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -35,9 +36,9 @@
public class UIWindowImpl extends UIObjectImpl implements UIWindow
{
- public UIWindowImpl(UIObjectContext context)
+ public UIWindowImpl(NavigationalStateContext navigationalStateContext, UIObjectContext context)
{
- super(context);
+ super(navigationalStateContext, context);
}
public WindowState getWindowState()
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObjectContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObjectContext.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObjectContext.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -22,11 +22,13 @@
******************************************************************************/
package org.jboss.portal.presentation.model;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
-import org.jboss.portal.presentation.state.structural.StructuralObject;
+import org.jboss.portal.presentation.model.ui.UIObject;
+import java.io.Serializable;
+import java.util.Map;
+
/**
- * Just some context data for a uiobject that can be used by different concerns.
+ * The context of a a ui object with respect to the viewport.
*
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -34,7 +36,24 @@
public interface UIObjectContext
{
- NavigationalStateContext getNavigationalStateContext();
+ /**
+ * Returns the object id.
+ *
+ * @return the object id
+ */
+ String getId();
- StructuralObject getStructuralObject();
+ /**
+ * Returns the object type.
+ *
+ * @return the type
+ */
+ Class<? extends UIObject> getType();
+
+ /**
+ * Returns an immutable map containing the object properties.
+ *
+ * @return the properties
+ */
+ Map<String, Serializable> getProperties();
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.presentation.model;
-import org.jboss.portal.presentation.model.UIObjectContext;
-
import java.util.Set;
import java.util.Map;
import java.io.Serializable;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/AddChildTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/AddChildTestCase.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/AddChildTestCase.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -26,6 +26,7 @@
import org.jboss.portal.presentation.model.ViewPort;
import org.jboss.portal.presentation.model.ViewPortScope;
import org.jboss.portal.presentation.model.ui.UIPage;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -50,7 +51,7 @@
//
ViewPortScope scope = new CustomScope(mockModel, model, rootDef);
- UIObjectTree context = new UIObjectTree();
+ UIObjectTree context = new UIObjectTree(new NavigationalStateContextImpl());
ViewPort viewPort = model.createViewPort(context, scope);
//
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/ModelTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/ModelTestCase.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/ModelTestCase.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -25,6 +25,7 @@
import org.jboss.portal.presentation.model.ObjectTraversalType;
import org.jboss.portal.presentation.model.ViewPort;
import org.jboss.portal.presentation.model.ViewPortScope;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -57,7 +58,7 @@
//
ViewPortScope scope = new CustomScope(mockModel, model, rootDef);
- UIObjectTree context = new UIObjectTree();
+ UIObjectTree context = new UIObjectTree(new NavigationalStateContextImpl());
ViewPort viewPort = model.createViewPort(context, scope);
//
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/MoveChildTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/MoveChildTestCase.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/MoveChildTestCase.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -25,6 +25,7 @@
import org.jboss.portal.presentation.model.ObjectTraversalType;
import org.jboss.portal.presentation.model.ViewPort;
import org.jboss.portal.presentation.model.ViewPortScope;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -49,7 +50,7 @@
//
ViewPortScope scope = new CustomScope(mockModel, model, rootDef);
- UIObjectTree context = new UIObjectTree();
+ UIObjectTree context = new UIObjectTree(new NavigationalStateContextImpl());
ViewPort viewPort = model.createViewPort(context, scope);
//
@@ -86,7 +87,7 @@
//
ViewPortScope scope = new CustomScope(mockModel, model, rootDef);
- UIObjectTree context = new UIObjectTree();
+ UIObjectTree context = new UIObjectTree(new NavigationalStateContextImpl());
ViewPort viewPort = model.createViewPort(context, scope);
//
@@ -124,7 +125,7 @@
//
ViewPortScope scope = new CustomScope(mockModel, model, rootDef);
- UIObjectTree context = new UIObjectTree();
+ UIObjectTree context = new UIObjectTree(new NavigationalStateContextImpl());
ViewPort viewPort = model.createViewPort(context, scope);
//
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/NodeDef.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/NodeDef.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/NodeDef.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -193,6 +193,7 @@
public void assertEquals(UIObjectNode objectNode)
{
+ // Compare first with node properties
Assert.assertEquals(properties.keySet(), objectNode.getProperties().keySet());
for (String propertyName : properties.keySet())
{
@@ -201,6 +202,15 @@
Assert.assertEquals(expectedProperty, property);
}
+ // Compare then with the context properties
+ Assert.assertEquals(properties.keySet(), objectNode.getContext().getProperties().keySet());
+ for (String propertyName : properties.keySet())
+ {
+ String expectedProperty = properties.get(propertyName);
+ Serializable property = objectNode.getContext().getProperties().get(propertyName);
+ Assert.assertEquals(expectedProperty, property);
+ }
+
//
switch (traversal)
{
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/RemoveChildRecursiveTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/RemoveChildRecursiveTestCase.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/RemoveChildRecursiveTestCase.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -25,6 +25,7 @@
import org.jboss.portal.presentation.model.ObjectTraversalType;
import org.jboss.portal.presentation.model.ViewPort;
import org.jboss.portal.presentation.model.ViewPortScope;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -55,7 +56,7 @@
//
ViewPortScope scope = new CustomScope(mockModel, model, rootDef);
- UIObjectTree context = new UIObjectTree();
+ UIObjectTree context = new UIObjectTree(new NavigationalStateContextImpl());
ViewPort viewPort = model.createViewPort(context, scope);
//
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/RemoveChildTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/RemoveChildTestCase.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/RemoveChildTestCase.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -25,6 +25,7 @@
import org.jboss.portal.presentation.model.ObjectTraversalType;
import org.jboss.portal.presentation.model.ViewPort;
import org.jboss.portal.presentation.model.ViewPortScope;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -53,7 +54,7 @@
//
ViewPortScope scope = new CustomScope(mockModel, model, rootDef);
- UIObjectTree context = new UIObjectTree();
+ UIObjectTree context = new UIObjectTree(new NavigationalStateContextImpl());
ViewPort viewPort = model.createViewPort(context, scope);
//
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/TypeTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/TypeTestCase.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/TypeTestCase.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -28,6 +28,7 @@
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.test.model.AbstractModelTestCase;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -47,7 +48,7 @@
//
ViewPortScope scope = new CustomScope(mockModel, model, rootDef);
- UIObjectTree context = new UIObjectTree();
+ UIObjectTree context = new UIObjectTree(new NavigationalStateContextImpl());
ViewPort viewPort = model.createViewPort(context, scope);
//
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectNode.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectNode.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectNode.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -24,7 +24,6 @@
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.UIObjectContext;
-import org.jboss.portal.presentation.state.StateType;
import java.util.HashMap;
import java.util.Map;
@@ -63,10 +62,7 @@
//
this.object = object;
this.context = context;
- this.properties = new HashMap<String, Serializable>();
-
- //
- updateState();
+ this.properties = new HashMap<String, Serializable>(context.getProperties());
}
public UIObjectContext getContext()
@@ -79,17 +75,6 @@
return properties;
}
- public void updateState()
- {
- properties.clear();
-
- for (String name : object.getPropertyNames(StateType.STRUCTURAL))
- {
- String value = object.getPropertyValue(StateType.STRUCTURAL, name, String.class);
- properties.put(name, value);
- }
- }
-
public UIObject getObject()
{
return object;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectTree.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectTree.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectTree.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -27,6 +27,7 @@
import org.jboss.portal.presentation.model.ViewPortContext;
import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import java.util.ArrayList;
import java.util.HashMap;
@@ -45,6 +46,14 @@
/** . */
private final Map<String, UIObjectNode> nodes = new HashMap<String, UIObjectNode>();
+ /** . */
+ private final NavigationalStateContext navigationalStateContext;
+
+ public UIObjectTree(NavigationalStateContext navigationalStateContext)
+ {
+ this.navigationalStateContext = navigationalStateContext;
+ }
+
public void assertConsistency(String rootId)
{
UIObjectNode root = nodes.get(rootId);
@@ -90,7 +99,7 @@
public void addObject(UIObjectContext objectContext)
{
- String id = objectContext.getStructuralObject().getId();
+ String id = objectContext.getId();
//
if (nodes.containsKey(id))
@@ -99,7 +108,7 @@
}
//
- UIObject object = UIObjectImpl.create(objectContext);
+ UIObject object = UIObjectImpl.create(navigationalStateContext, objectContext);
//
nodes.put(id, new UIObjectNode(object, objectContext));
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UpdateObjectTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UpdateObjectTestCase.java 2008-07-07 17:04:19 UTC (rev 11324)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UpdateObjectTestCase.java 2008-07-07 17:45:48 UTC (rev 11325)
@@ -25,6 +25,7 @@
import org.jboss.portal.presentation.model.ObjectTraversalType;
import org.jboss.portal.presentation.model.ViewPort;
import org.jboss.portal.presentation.model.ViewPortScope;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -48,7 +49,7 @@
//
ViewPortScope scope = new CustomScope(mockModel, model, rootDef);
- UIObjectTree context = new UIObjectTree();
+ UIObjectTree context = new UIObjectTree(new NavigationalStateContextImpl());
ViewPort viewPort = model.createViewPort(context, scope);
//
@@ -73,6 +74,7 @@
mockModel.getRoot().getChild("foo").setPropertyValue("bar", "bar_value");
//
+ rootDef.getChild("foo").setProperty("juu", null);
rootDef.getChild("foo").setProperty("daa", "daa_value2");
rootDef.getChild("foo").setProperty("bar", "bar_value");
16 years
JBoss Portal SVN: r11324 - in modules/presentation/trunk/presentation/src: main/java/org/jboss/portal/presentation/impl/model/pull and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-07 13:04:19 -0400 (Mon, 07 Jul 2008)
New Revision: 11324
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObjectContext.java
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedUINode.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedViewPortContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/UINodeImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UILayoutImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPaneImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectNode.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectTree.java
Log:
make the creation of the ui object impl the responsibility of the viewport context instead of the viewport impl
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.model;
-import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
+import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.presentation.state.structural.StructuralObject;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedUINode.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedUINode.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedUINode.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -24,7 +24,7 @@
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.UINode;
-import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
+import org.jboss.portal.presentation.model.UIObjectContext;
import java.util.Collection;
import java.util.Map;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedViewPortContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedViewPortContext.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedViewPortContext.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -24,7 +24,7 @@
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortContext;
-import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
+import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
import java.util.HashMap;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/UINodeImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/UINodeImpl.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/UINodeImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -27,7 +27,7 @@
import org.jboss.portal.presentation.state.structural.StructuralObject;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
-import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
+import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
import java.util.Collection;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.impl.model.ui;
import org.jboss.portal.presentation.model.ui.UIContext;
-import org.jboss.portal.presentation.state.structural.StructuralObject;
+import org.jboss.portal.presentation.model.UIObjectContext;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UILayoutImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UILayoutImpl.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UILayoutImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.impl.model.ui;
import org.jboss.portal.presentation.model.ui.UILayout;
-import org.jboss.portal.presentation.state.structural.StructuralObject;
+import org.jboss.portal.presentation.model.UIObjectContext;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -29,6 +29,7 @@
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.model.ui.UIPane;
+import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.state.StateException;
import org.jboss.portal.presentation.state.StateType;
import org.jboss.portal.presentation.state.structural.StructuralObject;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.impl.model.ui;
import org.jboss.portal.presentation.model.ui.UIPage;
-import org.jboss.portal.presentation.state.structural.StructuralObject;
+import org.jboss.portal.presentation.model.UIObjectContext;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPaneImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPaneImpl.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPaneImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.model.ui;
-import org.jboss.portal.presentation.state.structural.StructuralObject;
+import org.jboss.portal.presentation.model.UIObjectContext;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -25,8 +25,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.state.StateType;
-import org.jboss.portal.presentation.state.structural.StructuralObject;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObjectContext.java (from rev 11321, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObjectContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObjectContext.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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 org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
+
+/**
+ * Just some context data for a uiobject that can be used by different concerns.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface UIObjectContext
+{
+
+ NavigationalStateContext getNavigationalStateContext();
+
+ StructuralObject getStructuralObject();
+}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.model;
-import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
+import org.jboss.portal.presentation.model.UIObjectContext;
import java.util.Set;
import java.util.Map;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectNode.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectNode.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectNode.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -23,8 +23,8 @@
package org.jboss.portal.presentation.test.model;
import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.state.StateType;
-import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
import java.util.HashMap;
import java.util.Map;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectTree.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectTree.java 2008-07-07 17:03:35 UTC (rev 11323)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectTree.java 2008-07-07 17:04:19 UTC (rev 11324)
@@ -25,7 +25,7 @@
import junit.framework.Assert;
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortContext;
-import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
+import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
import java.util.ArrayList;
16 years
JBoss Portal SVN: r11323 - in modules/presentation/trunk/presentation/src: main/java/org/jboss/portal/presentation/impl/model/pull and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-07 13:03:35 -0400 (Mon, 07 Jul 2008)
New Revision: 11323
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UpdatePhase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedUINode.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedViewPortContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectNode.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectTree.java
Log:
make the creation of the ui object impl the responsibility of the viewport context instead of the viewport impl
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java 2008-07-07 16:52:50 UTC (rev 11322)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java 2008-07-07 17:03:35 UTC (rev 11323)
@@ -27,7 +27,6 @@
import org.jboss.portal.presentation.model.ViewPortScope;
import org.jboss.portal.presentation.state.structural.StructuralObject;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
-import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
import java.util.Collection;
import java.util.ArrayList;
@@ -73,7 +72,7 @@
private ObjectDiff diff(String objectId)
{
- UIObjectImpl object = (UIObjectImpl)context.getObject(objectId);
+ InternalObjectContext object = (InternalObjectContext)context.getObject(objectId);
//
if (object == null)
@@ -91,7 +90,7 @@
}
else
{
- return diff((InternalObjectContext)object.getContext());
+ return diff(object);
}
}
@@ -114,10 +113,10 @@
{
if (removedChildRef.loaded)
{
- UIObjectImpl child = (UIObjectImpl)context.getObject(removedChildRef.getId());
+ InternalObjectContext child = (InternalObjectContext)context.getObject(removedChildRef.getId());
//
- evictedChildren.add(createEvict((InternalObjectContext)child.getContext()));
+ evictedChildren.add(createEvict(child));
}
}
@@ -181,12 +180,12 @@
//
for (String removedChildId : refresh.getRemovedChildren())
{
- UIObjectImpl removedChild = (UIObjectImpl)context.getObject(removedChildId);
+ InternalObjectContext removedChild = (InternalObjectContext)context.getObject(removedChildId);
//
if (removedChild != null)
{
- ObjectDiff.Evict childVisit = createEvict((InternalObjectContext)removedChild.getContext());
+ ObjectDiff.Evict childVisit = createEvict(removedChild);
removedObjects.add(childVisit);
}
else
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UpdatePhase.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UpdatePhase.java 2008-07-07 16:52:50 UTC (rev 11322)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UpdatePhase.java 2008-07-07 17:03:35 UTC (rev 11323)
@@ -23,7 +23,6 @@
package org.jboss.portal.presentation.impl.model;
import org.jboss.portal.presentation.model.ViewPortContext;
-import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import java.util.Collection;
@@ -133,7 +132,7 @@
context.removeChild(parentId, childId);
//
- InternalObjectContext parentContext = (InternalObjectContext)((UIObjectImpl)context.getObject(parentId)).getContext();
+ InternalObjectContext parentContext = (InternalObjectContext)context.getObject(parentId);
//
parentContext.childRefs.remove(childId);
@@ -159,21 +158,18 @@
ObjectDiff.Load load = (ObjectDiff.Load)diff;
//
- UIObjectImpl object = UIObjectImpl.create(new InternalObjectContext(navigationalStateContext, load.getObject()));
+ InternalObjectContext objectContext = new InternalObjectContext(navigationalStateContext, load.getObject());
//
- context.addObject(object);
+ context.addObject(objectContext);
//
if (diff instanceof ObjectDiff.RecursiveLoad)
{
- InternalObjectContext objectContext = (InternalObjectContext)object.getContext();
-
- //
objectContext.childRefs = new HashMap<String, UIObjectRef>();
//
- context.createChildren(object.getId());
+ context.createChildren(objectContext.getStructuralObject().getId());
//
perform2ndPhase(objectContext, ((ObjectDiff.RecursiveLoad)diff).getAddedChildren());
@@ -196,7 +192,7 @@
ObjectDiff.RecursiveUpdate recursiveUpdate = (ObjectDiff.RecursiveUpdate)diff;
//
- InternalObjectContext objectContext = (InternalObjectContext)((UIObjectImpl)context.getObject(diff.getObjectId())).getContext();
+ InternalObjectContext objectContext = (InternalObjectContext)context.getObject(diff.getObjectId());
//
if (recursiveUpdate.getCreateChildren())
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedUINode.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedUINode.java 2008-07-07 16:52:50 UTC (rev 11322)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedUINode.java 2008-07-07 17:03:35 UTC (rev 11323)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.UINode;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
import java.util.Collection;
import java.util.Map;
@@ -39,16 +40,25 @@
private final UIObject object;
/** . */
+ private final UIObjectContext context;
+
+ /** . */
DetachedUINode parent;
/** . */
Map<String, DetachedUINode> children;
- public DetachedUINode(UIObject object)
+ public DetachedUINode(UIObject object, UIObjectContext context)
{
this.object = object;
+ this.context = context;
}
+ public UIObjectContext getContext()
+ {
+ return context;
+ }
+
public DetachedUINode getParent()
{
return parent;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedViewPortContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedViewPortContext.java 2008-07-07 16:52:50 UTC (rev 11322)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/DetachedViewPortContext.java 2008-07-07 17:03:35 UTC (rev 11323)
@@ -24,6 +24,8 @@
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortContext;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
import java.util.HashMap;
import java.util.Map;
@@ -45,7 +47,7 @@
return nodes.get(nodeId);
}
- public UIObject getObject(String objectId)
+ public UIObjectContext getObject(String objectId)
{
DetachedUINode node = nodes.get(objectId);
@@ -56,15 +58,18 @@
}
else
{
- return node.getObject();
+ return node.getContext();
}
}
- public void addObject(UIObject object)
+ public void addObject(UIObjectContext objectContext)
{
- DetachedUINode node = new DetachedUINode(object);
+ UIObject object = UIObjectImpl.create(objectContext);
//
+ DetachedUINode node = new DetachedUINode(object, objectContext);
+
+ //
nodes.put(node.getId(), node);
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java 2008-07-07 16:52:50 UTC (rev 11322)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortContext.java 2008-07-07 17:03:35 UTC (rev 11323)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.model;
-import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
import java.util.Set;
import java.util.Map;
@@ -43,14 +43,14 @@
* @param objectId the object id
* @return the specified object
*/
- UIObject getObject(String objectId);
+ UIObjectContext getObject(String objectId);
/**
* Populate the context with the specified object.
*
* @param object the object
*/
- void addObject(UIObject object);
+ void addObject(UIObjectContext object);
/**
* Signals the context that the object state has been updated.
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectNode.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectNode.java 2008-07-07 16:52:50 UTC (rev 11322)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectNode.java 2008-07-07 17:03:35 UTC (rev 11323)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.state.StateType;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
import java.util.HashMap;
import java.util.Map;
@@ -45,21 +46,34 @@
/** . */
Map<String, Serializable> properties;
- public UIObjectNode(UIObject object)
+ /** . */
+ private final UIObjectContext context;
+
+ public UIObjectNode(UIObject object, UIObjectContext context)
{
if (object == null)
{
throw new IllegalArgumentException();
}
+ if (context == null)
+ {
+ throw new IllegalArgumentException();
+ }
//
this.object = object;
+ this.context = context;
this.properties = new HashMap<String, Serializable>();
//
updateState();
}
+ public UIObjectContext getContext()
+ {
+ return context;
+ }
+
public Map<String, Serializable> getProperties()
{
return properties;
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectTree.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectTree.java 2008-07-07 16:52:50 UTC (rev 11322)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIObjectTree.java 2008-07-07 17:03:35 UTC (rev 11323)
@@ -25,6 +25,8 @@
import junit.framework.Assert;
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortContext;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
+import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
import java.util.ArrayList;
import java.util.HashMap;
@@ -70,12 +72,12 @@
return nodes.get(objectId);
}
- public UIObject getObject(String objectId)
+ public UIObjectContext getObject(String objectId)
{
UIObjectNode node = nodes.get(objectId);
//
- return node != null ? node.getObject() : null;
+ return node != null ? node.getContext() : null;
}
public void removeObject(String objectId)
@@ -86,9 +88,9 @@
}
}
- public void addObject(UIObject object)
+ public void addObject(UIObjectContext objectContext)
{
- String id = object.getId();
+ String id = objectContext.getStructuralObject().getId();
//
if (nodes.containsKey(id))
@@ -97,17 +99,12 @@
}
//
- nodes.put(id, new UIObjectNode(object));
+ UIObject object = UIObjectImpl.create(objectContext);
+
+ //
+ nodes.put(id, new UIObjectNode(object, objectContext));
}
-// public void updateObject(String objectId)
-// {
-// UIObjectNode node = nodes.get(objectId);
-//
-// //
-// node.updateState();
-// }
-
public void updateObject(String objectId, Set<String> removedProperties, Map<String, Serializable> updatedProperties, Map<String, Serializable> addedProperties)
{
UIObjectNode node = nodes.get(objectId);
16 years
JBoss Portal SVN: r11322 - modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-07 12:52:50 -0400 (Mon, 07 Jul 2008)
New Revision: 11322
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UpdatePhase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ViewPortImpl.java
Log:
create ui object impl only when necessary
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java 2008-07-07 16:37:56 UTC (rev 11321)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java 2008-07-07 16:52:50 UTC (rev 11322)
@@ -25,7 +25,6 @@
import org.jboss.portal.presentation.model.ObjectTraversalType;
import org.jboss.portal.presentation.model.ViewPortContext;
import org.jboss.portal.presentation.model.ViewPortScope;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.presentation.state.structural.StructuralObject;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
@@ -47,9 +46,6 @@
private final ViewPortScope scope;
/** . */
- private final NavigationalStateContext navigationalStateContext;
-
- /** . */
private final StructuralStateContext structuralStateContext;
/** . */
@@ -58,12 +54,10 @@
public DiffPhase(
ViewPortContext context,
ViewPortScope scope,
- NavigationalStateContext navigationalStateContext,
StructuralStateContext structuralStateContext)
{
this.context = context;
this.scope = scope;
- this.navigationalStateContext = navigationalStateContext;
this.structuralStateContext = structuralStateContext;
}
@@ -97,23 +91,20 @@
}
else
{
- return diff(object);
+ return diff((InternalObjectContext)object.getContext());
}
}
- private ObjectDiff.Evict createEvict(UIObjectImpl object)
+ private ObjectDiff.Evict createEvict(InternalObjectContext object)
{
Collection<ObjectDiff.Evict> evictedChildren = createEvictedChildren(object);
//
- return ObjectDiff.createEvict(object, evictedChildren);
+ return ObjectDiff.createEvict(object.getStructuralObject().getId(), evictedChildren);
}
- private Collection<ObjectDiff.Evict> createEvictedChildren(UIObjectImpl object)
+ private Collection<ObjectDiff.Evict> createEvictedChildren(InternalObjectContext objectContext)
{
- InternalObjectContext objectContext = (InternalObjectContext)object.getContext();
-
- //
if (objectContext.childRefs != null)
{
Collection<ObjectDiff.Evict> evictedChildren = new ArrayList<ObjectDiff.Evict>();
@@ -126,7 +117,7 @@
UIObjectImpl child = (UIObjectImpl)context.getObject(removedChildRef.getId());
//
- evictedChildren.add(createEvict(child));
+ evictedChildren.add(createEvict((InternalObjectContext)child.getContext()));
}
}
@@ -141,9 +132,9 @@
}
}
- private ObjectDiff diff(UIObjectImpl object)
+ private ObjectDiff diff(InternalObjectContext object)
{
- ObjectTraversalType traversalType = scope.enterObject(object.getContext().getStructuralObject());
+ ObjectTraversalType traversalType = scope.enterObject(object.getStructuralObject());
//
try
@@ -165,7 +156,7 @@
Collection<ObjectDiff.Evict> removedObjects = new ArrayList<ObjectDiff.Evict>();
//
- boolean createChildren = ((InternalObjectContext)object.getContext()).childRefs == null;
+ boolean createChildren = object.childRefs == null;
//
for (StructuralObject addedStructuralChild : refresh.getAddedChildren())
@@ -195,7 +186,7 @@
//
if (removedChild != null)
{
- ObjectDiff.Evict childVisit = createEvict(removedChild);
+ ObjectDiff.Evict childVisit = createEvict((InternalObjectContext)removedChild.getContext());
removedObjects.add(childVisit);
}
else
@@ -207,7 +198,7 @@
//
return ObjectDiff.createRecursiveUpdate(
- object,
+ object.getStructuralObject().getId(),
refresh.getRemovedProperties(),
refresh.getUpdatedProperties(),
refresh.getAddedProperties(),
@@ -223,7 +214,7 @@
//
return ObjectDiff.createSingleUpdate(
- object,
+ object.getStructuralObject().getId(),
refresh.getRemovedProperties(),
refresh.getUpdatedProperties(),
refresh.getAddedProperties(),
@@ -233,15 +224,12 @@
}
finally
{
- scope.leaveObject(object.getContext().getStructuralObject());
+ scope.leaveObject(object.getStructuralObject());
}
}
private ObjectDiff load(StructuralObject structuralObject)
{
- UIObjectImpl object = UIObjectImpl.create(new InternalObjectContext(navigationalStateContext, structuralObject));
-
- //
ObjectTraversalType traversalType = scope.enterObject(structuralObject);
//
@@ -249,7 +237,7 @@
{
if (traversalType == ObjectTraversalType.SKIP)
{
- return ObjectDiff.createSkip(object);
+ return ObjectDiff.createSkip(structuralObject.getId());
}
else
{
@@ -260,11 +248,11 @@
{
addedChildren.add(load(structuralChild));
}
- return ObjectDiff.createRecursiveLoad(object, addedChildren);
+ return ObjectDiff.createRecursiveLoad(structuralObject, addedChildren);
}
else
{
- return ObjectDiff.createSingleLoad(object);
+ return ObjectDiff.createSingleLoad(structuralObject);
}
}
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java 2008-07-07 16:37:56 UTC (rev 11321)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java 2008-07-07 16:52:50 UTC (rev 11322)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.model;
-import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
import java.util.Set;
import java.util.Map;
@@ -36,38 +36,38 @@
public abstract class ObjectDiff
{
- static ObjectDiff.Evict createEvict(UIObjectImpl object, Collection<Evict> evictedChildren)
+ static ObjectDiff.Evict createEvict(String objectId, Collection<Evict> evictedChildren)
{
- return new Evict(object, evictedChildren);
+ return new Evict(objectId, evictedChildren);
}
- static RecursiveLoad createRecursiveLoad(UIObjectImpl object, Collection<ObjectDiff> addedChildren)
+ static RecursiveLoad createRecursiveLoad(StructuralObject object, Collection<ObjectDiff> addedChildren)
{
return new RecursiveLoad(object, addedChildren);
}
- static ObjectDiff createSingleLoad(UIObjectImpl object)
+ static ObjectDiff createSingleLoad(StructuralObject object)
{
return new SingleLoad(object);
}
- static ObjectDiff createSkip(UIObjectImpl object)
+ static ObjectDiff createSkip(String objectId)
{
- return new Skip(object);
+ return new Skip(objectId);
}
static SingleUpdate createSingleUpdate(
- UIObjectImpl object,
+ String objectId,
Set<String> removedProperties,
Map<String, Serializable> updatedProperties,
Map<String, Serializable> addedProperties,
Collection<Evict> evictedChildren)
{
- return new SingleUpdate(object, removedProperties, updatedProperties, addedProperties, evictedChildren);
+ return new SingleUpdate(objectId, removedProperties, updatedProperties, addedProperties, evictedChildren);
}
static RecursiveUpdate createRecursiveUpdate(
- UIObjectImpl object,
+ String objectId,
Set<String> removedProperties,
Map<String, Serializable> updatedProperties,
Map<String, Serializable> addedProperties,
@@ -78,7 +78,7 @@
Collection<Evict> removedChildren)
{
return new RecursiveUpdate(
- object,
+ objectId,
removedProperties,
updatedProperties,
addedProperties,
@@ -90,54 +90,55 @@
}
/** . */
- private final UIObjectImpl object;
+ private final String objectId;
- private ObjectDiff(UIObjectImpl object)
+ private ObjectDiff(String objectId)
{
- if (object == null)
+ if (objectId == null)
{
throw new IllegalArgumentException();
}
//
- this.object = object;
+ this.objectId = objectId;
}
public String getObjectId()
{
- return object.getId();
+ return objectId;
}
- /**
- * Returns the object that either was created during the phase or is the same object that
- * was retrieved from the viewport context.
- *
- * @return the object.
- */
- public UIObjectImpl getObject()
- {
- return object;
- }
-
public static class Skip extends ObjectDiff
{
- private Skip(UIObjectImpl object)
+ private Skip(String objectId)
{
- super(object);
+ super(objectId);
}
}
public abstract static class Load extends ObjectDiff
{
- private Load(UIObjectImpl object)
+
+ /** . */
+ private final StructuralObject object;
+
+ private Load(StructuralObject object)
{
- super(object);
+ super(object.getId());
+
+ //
+ this.object = object;
}
+
+ public StructuralObject getObject()
+ {
+ return object;
+ }
}
public static class SingleLoad extends Load
{
- private SingleLoad(UIObjectImpl object)
+ private SingleLoad(StructuralObject object)
{
super(object);
}
@@ -150,7 +151,7 @@
private final Collection<ObjectDiff> addedChildren;
private RecursiveLoad(
- UIObjectImpl object,
+ StructuralObject object,
Collection<ObjectDiff> addedChildren)
{
super(object);
@@ -199,7 +200,7 @@
private final Collection<Evict> removedChildren;
private RecursiveUpdate(
- UIObjectImpl object,
+ String objectId,
Set<String> removedProperties,
Map<String, Serializable> updatedProperties,
Map<String, Serializable> addedProperties,
@@ -210,7 +211,7 @@
Collection<Evict> removedChildren)
{
super(
- object,
+ objectId,
removedProperties,
updatedProperties,
addedProperties);
@@ -283,14 +284,14 @@
private final Collection<Evict> evictedChildren;
public SingleUpdate(
- UIObjectImpl object,
+ String objectId,
Set<String> removedProperties,
Map<String, Serializable> updatedProperties,
Map<String, Serializable> addedProperties,
Collection<Evict> evictedChildren)
{
super(
- object,
+ objectId,
removedProperties,
updatedProperties,
addedProperties);
@@ -325,12 +326,12 @@
private final Map<String, Serializable> addedProperties;
private Update(
- UIObjectImpl object,
+ String objectId,
Set<String> removedProperties,
Map<String, Serializable> updatedProperties,
Map<String, Serializable> addedProperties)
{
- super(object);
+ super(objectId);
//
this.removedProperties = removedProperties;
@@ -360,9 +361,9 @@
/** If null it means that we did not have any children initialized. */
private final Collection<Evict> evictedChildren;
- public Evict(UIObjectImpl object, Collection<Evict> evictedChildren)
+ public Evict(String objectId, Collection<Evict> evictedChildren)
{
- super(object);
+ super(objectId);
//
this.evictedChildren = evictedChildren;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UpdatePhase.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UpdatePhase.java 2008-07-07 16:37:56 UTC (rev 11321)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UpdatePhase.java 2008-07-07 16:52:50 UTC (rev 11322)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.model.ViewPortContext;
import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import java.util.Collection;
import java.util.HashMap;
@@ -47,8 +48,15 @@
/** . */
private final ObjectDiff rootDiff;
- public UpdatePhase(ViewPortContext context, ObjectDiff rootDiff)
+ /** . */
+ private final NavigationalStateContext navigationalStateContext;
+
+ public UpdatePhase(
+ NavigationalStateContext navigationalStateContext,
+ ViewPortContext context,
+ ObjectDiff rootDiff)
{
+ this.navigationalStateContext = navigationalStateContext;
this.context = context;
this.rootDiff = rootDiff;
}
@@ -76,7 +84,7 @@
//
if (evict.getEvictedChildren() != null)
{
- perform1stPhase(diff.getObject(), evict.getEvictedChildren());
+ perform1stPhase(diff.getObjectId(), evict.getEvictedChildren());
//
context.destroyChildren(diff.getObjectId());
@@ -92,10 +100,10 @@
ObjectDiff.RecursiveUpdate recursiveUpdate = (ObjectDiff.RecursiveUpdate)diff;
//
- perform1stPhase(diff.getObject(), recursiveUpdate.getAddedChildren());
- perform1stPhase(diff.getObject(), recursiveUpdate.getStaleChildren());
- perform1stPhase(diff.getObject(), recursiveUpdate.getValidChildren());
- perform1stPhase(diff.getObject(), recursiveUpdate.getRemovedChildren());
+ perform1stPhase(diff.getObjectId(), recursiveUpdate.getAddedChildren());
+ perform1stPhase(diff.getObjectId(), recursiveUpdate.getStaleChildren());
+ perform1stPhase(diff.getObjectId(), recursiveUpdate.getValidChildren());
+ perform1stPhase(diff.getObjectId(), recursiveUpdate.getRemovedChildren());
}
else
{
@@ -104,7 +112,7 @@
//
if (singleUpdate.getEvictedChildren() != null)
{
- perform1stPhase(diff.getObject(), singleUpdate.getEvictedChildren());
+ perform1stPhase(diff.getObjectId(), singleUpdate.getEvictedChildren());
//
context.destroyChildren(diff.getObjectId());
@@ -113,7 +121,7 @@
}
}
- private void perform1stPhase(UIObjectImpl parent, Collection<? extends ObjectDiff> diffs)
+ private void perform1stPhase(String parentId, Collection<? extends ObjectDiff> diffs)
{
for (ObjectDiff diff : diffs)
{
@@ -122,10 +130,10 @@
String childId = diff.getObjectId();
//
- context.removeChild(parent.getId(), childId);
+ context.removeChild(parentId, childId);
//
- InternalObjectContext parentContext = (InternalObjectContext)parent.getContext();
+ InternalObjectContext parentContext = (InternalObjectContext)((UIObjectImpl)context.getObject(parentId)).getContext();
//
parentContext.childRefs.remove(childId);
@@ -146,26 +154,29 @@
private void perform2ndPhase(ObjectDiff diff)
{
- UIObjectImpl object = diff.getObject();
+ if (diff instanceof ObjectDiff.Load)
+ {
+ ObjectDiff.Load load = (ObjectDiff.Load)diff;
- //
- InternalObjectContext objectContext = (InternalObjectContext)object.getContext();
+ //
+ UIObjectImpl object = UIObjectImpl.create(new InternalObjectContext(navigationalStateContext, load.getObject()));
- //
- if (diff instanceof ObjectDiff.Load)
- {
+ //
context.addObject(object);
//
if (diff instanceof ObjectDiff.RecursiveLoad)
{
+ InternalObjectContext objectContext = (InternalObjectContext)object.getContext();
+
+ //
objectContext.childRefs = new HashMap<String, UIObjectRef>();
//
context.createChildren(object.getId());
//
- perform2ndPhase(diff.getObject(), ((ObjectDiff.RecursiveLoad)diff).getAddedChildren());
+ perform2ndPhase(objectContext, ((ObjectDiff.RecursiveLoad)diff).getAddedChildren());
}
}
else if (diff instanceof ObjectDiff.Update)
@@ -185,27 +196,27 @@
ObjectDiff.RecursiveUpdate recursiveUpdate = (ObjectDiff.RecursiveUpdate)diff;
//
+ InternalObjectContext objectContext = (InternalObjectContext)((UIObjectImpl)context.getObject(diff.getObjectId())).getContext();
+
+ //
if (recursiveUpdate.getCreateChildren())
{
objectContext.childRefs = new HashMap<String, UIObjectRef>();
//
- context.createChildren(object.getId());
+ context.createChildren(diff.getObjectId());
}
//
- perform2ndPhase(diff.getObject(), recursiveUpdate.getAddedChildren());
- perform2ndPhase(diff.getObject(), recursiveUpdate.getValidChildren());
- perform2ndPhase(diff.getObject(), recursiveUpdate.getStaleChildren());
+ perform2ndPhase(objectContext, recursiveUpdate.getAddedChildren());
+ perform2ndPhase(objectContext, recursiveUpdate.getValidChildren());
+ perform2ndPhase(objectContext, recursiveUpdate.getStaleChildren());
}
}
}
- private void perform2ndPhase(UIObjectImpl parent, Collection<ObjectDiff> diffs)
+ private void perform2ndPhase(InternalObjectContext parentContext, Collection<ObjectDiff> diffs)
{
- InternalObjectContext objectContext = (InternalObjectContext)parent.getContext();
-
- //
for (ObjectDiff diff : diffs)
{
perform2ndPhase(diff);
@@ -213,8 +224,8 @@
//
if (diff instanceof ObjectDiff.Load)
{
- objectContext.childRefs.put(diff.getObjectId(), new UIObjectRef(diff.getObjectId(), true));
- context.addChild(parent.getId(), diff.getObjectId());
+ parentContext.childRefs.put(diff.getObjectId(), new UIObjectRef(diff.getObjectId(), true));
+ context.addChild(parentContext.getStructuralObject().getId(), diff.getObjectId());
}
else if (diff instanceof ObjectDiff.Update)
{
@@ -222,7 +233,7 @@
}
else if (diff instanceof ObjectDiff.Skip)
{
- objectContext.childRefs.put(diff.getObjectId(), new UIObjectRef(diff.getObjectId(), false));
+ parentContext.childRefs.put(diff.getObjectId(), new UIObjectRef(diff.getObjectId(), false));
}
}
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ViewPortImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ViewPortImpl.java 2008-07-07 16:37:56 UTC (rev 11321)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ViewPortImpl.java 2008-07-07 16:52:50 UTC (rev 11322)
@@ -51,7 +51,7 @@
public void refresh()
{
- DiffPhase diffPhase = new DiffPhase(context, scope, model.navigationalStateContext, model.structuralStateContext);
+ DiffPhase diffPhase = new DiffPhase(context, scope, model.structuralStateContext);
//
diffPhase.perform();
@@ -60,7 +60,7 @@
ObjectDiff rootDiff = diffPhase.getRootVisit();
//
- UpdatePhase phase = new UpdatePhase(context, rootDiff);
+ UpdatePhase phase = new UpdatePhase(model.navigationalStateContext, context, rootDiff);
//
phase.perform();
16 years
JBoss Portal SVN: r11321 - in modules/presentation/trunk/presentation/src: main/java/org/jboss/portal/presentation/impl/model/pull and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-07 12:37:56 -0400 (Mon, 07 Jul 2008)
New Revision: 11321
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/UINodeImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UILayoutImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPaneImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortScope.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/CustomScope.java
Log:
use StructuralObject in the ViewPortScope interface instead of UIObject
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/DiffPhase.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -143,7 +143,7 @@
private ObjectDiff diff(UIObjectImpl object)
{
- ObjectTraversalType traversalType = scope.enterObject(object);
+ ObjectTraversalType traversalType = scope.enterObject(object.getContext().getStructuralObject());
//
try
@@ -233,16 +233,16 @@
}
finally
{
- scope.leaveObject(object);
+ scope.leaveObject(object.getContext().getStructuralObject());
}
}
private ObjectDiff load(StructuralObject structuralObject)
{
- UIObjectImpl object = UIObjectImpl.create(structuralObject, new InternalObjectContext(navigationalStateContext));
+ UIObjectImpl object = UIObjectImpl.create(new InternalObjectContext(navigationalStateContext, structuralObject));
//
- ObjectTraversalType traversalType = scope.enterObject(object);
+ ObjectTraversalType traversalType = scope.enterObject(structuralObject);
//
try
@@ -270,7 +270,7 @@
}
finally
{
- scope.leaveObject(object);
+ scope.leaveObject(structuralObject);
}
}
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/InternalObjectContext.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.impl.model.ui.UIObjectContext;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
import java.util.Map;
@@ -39,11 +40,19 @@
final NavigationalStateContext navigationalStateContext;
- InternalObjectContext(NavigationalStateContext navigationalStateContext)
+ final StructuralObject structuralObject;
+
+ InternalObjectContext(NavigationalStateContext navigationalStateContext, StructuralObject structuralObject)
{
this.navigationalStateContext = navigationalStateContext;
+ this.structuralObject = structuralObject;
}
+ public StructuralObject getStructuralObject()
+ {
+ return structuralObject;
+ }
+
public NavigationalStateContext getNavigationalStateContext()
{
return navigationalStateContext;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -67,7 +67,7 @@
}
static RecursiveUpdate createRecursiveUpdate(
- UIObjectImpl object,
+ UIObjectImpl object,
Set<String> removedProperties,
Map<String, Serializable> updatedProperties,
Map<String, Serializable> addedProperties,
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/UINodeImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/UINodeImpl.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/pull/UINodeImpl.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -79,11 +79,16 @@
this.parentVisited = true;
}
+ public StructuralObject getStructuralObject()
+ {
+ return structuralObject;
+ }
+
public UIObject getObject()
{
if (object == null)
{
- object = UIObjectImpl.create(structuralObject, this);
+ object = UIObjectImpl.create(this);
}
//
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -31,10 +31,8 @@
*/
public class UIContextImpl extends UILayoutImpl implements UIContext
{
- public UIContextImpl(
- StructuralObject structuralObject,
- UIObjectContext context)
+ public UIContextImpl(UIObjectContext context)
{
- super(structuralObject, context);
+ super(context);
}
}
\ No newline at end of file
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UILayoutImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UILayoutImpl.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UILayoutImpl.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -32,8 +32,8 @@
public abstract class UILayoutImpl extends UIObjectImpl implements UILayout
{
- public UILayoutImpl(StructuralObject structuralObject, UIObjectContext context)
+ public UILayoutImpl(UIObjectContext context)
{
- super(structuralObject, context);
+ super(context);
}
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectContext.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -23,6 +23,7 @@
package org.jboss.portal.presentation.impl.model.ui;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
/**
* Just some context data for a uiobject that can be used by different concerns.
@@ -35,4 +36,5 @@
NavigationalStateContext getNavigationalStateContext();
+ StructuralObject getStructuralObject();
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -45,34 +45,32 @@
/** . */
private final UIObjectContext context;
- /** . */
- private StructuralObject structuralObject;
-
- public static UIObjectImpl create(
- StructuralObject structuralObject,
- UIObjectContext objectContext)
+ public static UIObjectImpl create(UIObjectContext objectContext)
{
UIObjectImpl object;
//
+ StructuralObject structuralObject = objectContext.getStructuralObject();
+
+ //
Class type = structuralObject.getState().getType();
//
if (type == UIWindow.class)
{
- object = new UIWindowImpl(structuralObject, objectContext);
+ object = new UIWindowImpl(objectContext);
}
else if (type == UIPage.class)
{
- object = new UIPageImpl(structuralObject, objectContext);
+ object = new UIPageImpl(objectContext);
}
else if (type == UIPane.class)
{
- object = new UIPaneImpl(structuralObject, objectContext);
+ object = new UIPaneImpl(objectContext);
}
else if (type == UIContext.class)
{
- object = new UIContextImpl(structuralObject, objectContext);
+ object = new UIContextImpl(objectContext);
}
else
{
@@ -84,16 +82,14 @@
}
public UIObjectImpl(
- StructuralObject structuralObject,
UIObjectContext context)
{
- this.structuralObject = structuralObject;
this.context = context;
}
public String getId()
{
- return structuralObject.getId();
+ return context.getStructuralObject().getId();
}
public <T> T getPropertyValue(StateType stateType, String propertyName, Class<T> propertyType) throws IllegalArgumentException, StateException
@@ -115,7 +111,7 @@
switch (stateType)
{
case STRUCTURAL:
- return Reflection.safeCast(structuralObject.getState().getProperties().get(propertyName), propertyType);
+ return Reflection.safeCast(context.getStructuralObject().getState().getProperties().get(propertyName), propertyType);
case NAVIGATIONAL:
return Reflection.safeCast(context.getNavigationalStateContext().getProperty(getStructuralObject().getId(), propertyName), propertyType);
default:
@@ -134,9 +130,9 @@
switch (stateType)
{
case STRUCTURAL:
- return structuralObject.getState().getProperties().keySet();
+ return context.getStructuralObject().getState().getProperties().keySet();
case NAVIGATIONAL:
- return context.getNavigationalStateContext().getPropertyNames(structuralObject.getId());
+ return context.getNavigationalStateContext().getPropertyNames(context.getStructuralObject().getId());
default:
throw new AssertionError();
}
@@ -144,22 +140,9 @@
public StructuralObject getStructuralObject()
{
- return structuralObject;
+ return context.getStructuralObject();
}
- public void setStructuralObject(StructuralObject structuralObject)
- {
- if (!structuralObject.getState().getType().equals(this.structuralObject.getState().getType()))
- {
- // It means that actually we should not update the state but rather recreate the node in the
- // view port, we need to think about what to do when this happens
- throw new NotYetImplemented();
- }
-
- //
- this.structuralObject = structuralObject;
- }
-
public UIObjectContext getContext()
{
return context;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPageImpl.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -31,10 +31,8 @@
*/
public class UIPageImpl extends UILayoutImpl implements UIPage
{
- public UIPageImpl(
- StructuralObject structuralObject,
- UIObjectContext context)
+ public UIPageImpl(UIObjectContext context)
{
- super(structuralObject, context);
+ super(context);
}
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPaneImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPaneImpl.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIPaneImpl.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -30,8 +30,8 @@
*/
public class UIPaneImpl extends UILayoutImpl
{
- public UIPaneImpl(StructuralObject structuralObject, UIObjectContext context)
+ public UIPaneImpl(UIObjectContext context)
{
- super(structuralObject, context);
+ super(context);
}
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -35,11 +35,9 @@
public class UIWindowImpl extends UIObjectImpl implements UIWindow
{
- public UIWindowImpl(
- StructuralObject structuralObject,
- UIObjectContext context)
+ public UIWindowImpl(UIObjectContext context)
{
- super(structuralObject, context);
+ super(context);
}
public WindowState getWindowState()
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortScope.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortScope.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortScope.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -23,6 +23,7 @@
package org.jboss.portal.presentation.model;
import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
/**
* Defines the scope of a viewport. This interface is separated from the viewport context in order to
@@ -47,7 +48,7 @@
* @param object the object
* @return true if it should be visited
*/
- ObjectTraversalType enterObject(UIObject object);
+ ObjectTraversalType enterObject(StructuralObject object);
/**
* Callback to signal that an object visit is terminated. It can be used by the scope to maintain a data
@@ -55,5 +56,5 @@
*
* @param object the object
*/
- void leaveObject(UIObject object);
+ void leaveObject(StructuralObject object);
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -28,6 +28,7 @@
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.model.ui.UILayout;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
/**
* A view scope that retrieves a page and its visible content.
@@ -67,11 +68,14 @@
return pageId;
}
- public ObjectTraversalType enterObject(UIObject object)
+ public ObjectTraversalType enterObject(StructuralObject object)
{
- if (object instanceof UILayout)
+ Class<? extends UIObject> type = object.getState().getType();
+
+ //
+ if (UILayout.class.isAssignableFrom(type))
{
- if (object instanceof UIPage)
+ if (UIPage.class.isAssignableFrom(type))
{
switch (pageStatus)
{
@@ -107,7 +111,7 @@
return ObjectTraversalType.RECURSIVE;
}
}
- else if (object instanceof UIWindow)
+ else if (UIWindow.class.isAssignableFrom(type))
{
// We don't traverse windows (for now as they are supposed to be leaves)
return ObjectTraversalType.SINGLE;
@@ -118,9 +122,9 @@
}
}
- public void leaveObject(UIObject object)
+ public void leaveObject(StructuralObject object)
{
- if (object instanceof UIPage)
+ if (UIPage.class.isAssignableFrom(object.getState().getType()))
{
switch (pageStatus)
{
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/CustomScope.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/CustomScope.java 2008-07-07 16:15:04 UTC (rev 11320)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/CustomScope.java 2008-07-07 16:37:56 UTC (rev 11321)
@@ -24,10 +24,10 @@
import org.jboss.portal.presentation.model.ObjectTraversalType;
import org.jboss.portal.presentation.model.UIModel;
-import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortScope;
import org.jboss.portal.presentation.test.state.mock.MockModel;
import org.jboss.portal.presentation.test.state.mock.MockObject;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -67,7 +67,7 @@
return model.getRootId();
}
- public ObjectTraversalType enterObject(UIObject object)
+ public ObjectTraversalType enterObject(StructuralObject object)
{
if (current == null)
{
@@ -107,7 +107,7 @@
return current.getTraversal();
}
- public void leaveObject(UIObject object)
+ public void leaveObject(StructuralObject object)
{
current = current.getParent();
}
16 years
JBoss Portal SVN: r11320 - in branches/JBoss_Portal_Branch_2_7/wsrp/src: main/org/jboss/portal/test/wsrp/framework and 5 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-07 12:15:04 -0400 (Mon, 07 Jul 2008)
New Revision: 11320
Added:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/InteropServiceDescriptionTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/interop/
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/interop/LiferayServiceDescriptionBehavior.java
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPConsumerBaseTest.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ServiceDescriptionBehavior.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/ServiceDescriptionTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/GroupedPortletsServiceDescriptionBehavior.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-wsrp-consumer-servicedescription-sar/META-INF/jboss-service.xml
Log:
- Improved WSRP consumer test framework to make it easier to emulate producer behaviors.
- Added test case to emulate Liferay non-conforming service description and added better work-around for its behavior.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPConsumerBaseTest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPConsumerBaseTest.java 2008-07-07 16:14:32 UTC (rev 11319)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPConsumerBaseTest.java 2008-07-07 16:15:04 UTC (rev 11320)
@@ -24,9 +24,29 @@
package org.jboss.portal.test.wsrp;
import org.jboss.portal.common.junit.ExtendedAssert;
+import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
+import org.jboss.portal.test.wsrp.framework.MarkupBehavior;
+import org.jboss.portal.test.wsrp.framework.PortletManagementBehavior;
+import org.jboss.portal.test.wsrp.framework.RegistrationBehavior;
+import org.jboss.portal.test.wsrp.framework.ServiceDescriptionBehavior;
+import org.jboss.portal.test.wsrp.framework.TestProducerBehavior;
import org.jboss.portal.test.wsrp.framework.TestWSRPProducer;
+import org.jboss.portal.test.wsrp.framework.support.MockConsumerRegistry;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicPortletManagementBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicServiceDescriptionBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.EmptyMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.InitCookieNotRequiredMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.NullMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.PerGroupInitCookieMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.PerUserInitCookieMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.ResourceMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.SessionMarkupBehavior;
import org.jboss.portal.wsrp.WSRPConsumer;
+import org.jboss.portal.wsrp.producer.WSRPValidator;
+import java.util.Set;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision$
@@ -43,6 +63,12 @@
/** . */
protected WSRPConsumer consumer;
+ private boolean strict = true;
+ private String sdClassName;
+ private String mClassName;
+ private String pmClassName;
+ private String rClassName;
+
protected WSRPConsumerBaseTest(String name) throws Exception
{
super(name);
@@ -54,9 +80,59 @@
public void setUp() throws Exception
{
+ // reset producer state
+ producer.reset();
+
+ // set the test producer identifier
consumer.getProducerInfo().setId(TEST_PRODUCER_ID);
+
+ // reset the behaviors
+ BehaviorRegistry registry = producer.getBehaviorRegistry();
+ setSDClassName(sdClassName);
+ setMClassName(mClassName);
+ setPMClassName(pmClassName);
+ setRClassName(rClassName);
+ registerAdditionalMarkupBehaviors(registry);
+
+ // use a fresh ConsumerRegistry
+ consumer.getProducerInfo().setRegistry(new MockConsumerRegistry());
+
+ // make sure we use clean producer info for each test
+ consumer.refreshProducerInfo();
+
+ // use cache to avoid un-necessary calls
+ consumer.getProducerInfo().setExpirationCacheSeconds(120);
}
+ protected void setRegistrationBehavior(RegistrationBehavior behavior)
+ {
+ producer.getBehaviorRegistry().setRegistrationBehavior(behavior);
+ }
+
+ protected void setServiceDescriptionBehavior(ServiceDescriptionBehavior behavior)
+ {
+ if (behavior == null)
+ {
+ log.info("Given service description behavior was null, using the default one instead!");
+ behavior = new BasicServiceDescriptionBehavior();
+ }
+
+ producer.getBehaviorRegistry().setServiceDescriptionBehavior(behavior);
+ }
+
+ protected void setPortletManagementBehavior(PortletManagementBehavior behavior)
+ {
+ BehaviorRegistry registry = producer.getBehaviorRegistry();
+
+ if (behavior == null)
+ {
+ log.info("Given portlet management behavior was null, using the default one instead!");
+ behavior = new BasicPortletManagementBehavior(registry);
+ }
+
+ registry.setPortletManagementBehavior(behavior);
+ }
+
public TestWSRPProducer getProducer()
{
return producer;
@@ -81,4 +157,98 @@
{
ExtendedAssert.assertEquals(TEST_PRODUCER_ID, consumer.getProducerId());
}
+
+ public void setSDClassName(String behaviorClassName)
+ {
+ sdClassName = behaviorClassName;
+ setServiceDescriptionBehavior(createBehavior(behaviorClassName, ServiceDescriptionBehavior.class));
+ }
+
+ public void setMClassName(String behaviorClassName)
+ {
+ mClassName = behaviorClassName;
+ if (behaviorClassName != null)
+ {
+ producer.getBehaviorRegistry().registerMarkupBehavior(createBehavior(behaviorClassName, MarkupBehavior.class));
+ }
+ }
+
+ public void setPMClassName(String behaviorClassName)
+ {
+ pmClassName = behaviorClassName;
+ setPortletManagementBehavior(createBehavior(behaviorClassName, PortletManagementBehavior.class));
+ }
+
+ public void setRClassName(String behaviorClassName)
+ {
+ rClassName = behaviorClassName;
+ setRegistrationBehavior(createBehavior(behaviorClassName, RegistrationBehavior.class));
+ }
+
+ public void setStrict(boolean strict)
+ {
+ this.strict = strict;
+ producer.setUseStrictMode(strict);
+ WSRPValidator.setStrict(strict);
+ }
+
+ public boolean isStrict()
+ {
+ return strict;
+ }
+
+ private <T extends TestProducerBehavior> T createBehavior(String behaviorClassName, Class<T> expectedBehaviorClass)
+ {
+ if (behaviorClassName != null)
+ {
+ try
+ {
+ Class behaviorClass = getClass().getClassLoader().loadClass(behaviorClassName);
+ if (expectedBehaviorClass.isAssignableFrom(behaviorClass))
+ {
+ return (T)behaviorClass.newInstance();
+ }
+ else
+ {
+ throw new IllegalArgumentException(behaviorClassName + " is not a " + expectedBehaviorClass.getSimpleName());
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IllegalArgumentException("Could not find behavior: " + behaviorClassName, e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new IllegalArgumentException("Could not access behavior: " + behaviorClassName, e);
+ }
+ catch (InstantiationException e)
+ {
+ throw new IllegalArgumentException("Could not instantiate behavior: " + behaviorClassName, e);
+ }
+ }
+
+ return null;
+ }
+
+ protected void registerAdditionalMarkupBehaviors(BehaviorRegistry registry)
+ {
+ registry.registerMarkupBehavior(new BasicMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new EmptyMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new InitCookieNotRequiredMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new PerGroupInitCookieMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new PerUserInitCookieMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new NullMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new SessionMarkupBehavior(registry));
+ registry.registerMarkupBehavior(new ResourceMarkupBehavior(registry));
+ }
+
+ protected Set<String> getPortletHandles()
+ {
+ return producer.getBehaviorRegistry().getServiceDescriptionBehavior().getPortletHandles();
+ }
+
+ protected int getPortletNumber()
+ {
+ return producer.getBehaviorRegistry().getServiceDescriptionBehavior().getPortletNumber();
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ServiceDescriptionBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ServiceDescriptionBehavior.java 2008-07-07 16:14:32 UTC (rev 11319)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ServiceDescriptionBehavior.java 2008-07-07 16:15:04 UTC (rev 11320)
@@ -36,7 +36,9 @@
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
import java.rmi.RemoteException;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
* @author <a href="mailto:chris.laprun@jboss.com?subject=org.jboss.portal.test.wsrp.framework.ServiceDescriptionBehavior">Chris
@@ -57,7 +59,7 @@
}
public ServiceDescription getServiceDescription(GetServiceDescription getServiceDescription) throws
- OperationFailedFault, InvalidRegistrationFault, RemoteException
+ OperationFailedFault, InvalidRegistrationFault, RemoteException
{
incrementCallCount();
return serviceDescription;
@@ -92,12 +94,30 @@
}
else
{
- List portlets = Tools.toList(initial);
+ List<PortletDescription> portlets = Tools.toList(initial);
portlets.add(portletDescription);
- serviceDescription.setOfferedPortlets((PortletDescription[])portlets.toArray(new PortletDescription[0]));
+ serviceDescription.setOfferedPortlets(portlets.toArray(new PortletDescription[portlets.size()]));
}
}
+ public Set<String> getPortletHandles()
+ {
+ PortletDescription[] portletDescriptions = serviceDescription.getOfferedPortlets();
+ Set<String> handles = new HashSet<String>(portletDescriptions.length);
+
+ for (PortletDescription description : portletDescriptions)
+ {
+ handles.add(description.getPortletHandle());
+ }
+
+ return handles;
+ }
+
+ public int getPortletNumber()
+ {
+ return serviceDescription.getOfferedPortlets().length;
+ }
+
public static ServiceDescription createServiceDescription(boolean requiresRegistration, int numberOfProperties)
{
ServiceDescription sd = WSRPTypeFactory.createServiceDescription(requiresRegistration);
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/InteropServiceDescriptionTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/InteropServiceDescriptionTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/InteropServiceDescriptionTestCase.java 2008-07-07 16:15:04 UTC (rev 11320)
@@ -0,0 +1,79 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, 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.wsrp.v1.consumer;
+
+import org.jboss.portal.common.junit.ExtendedAssert;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class InteropServiceDescriptionTestCase extends V1ConsumerBaseTest
+{
+ public InteropServiceDescriptionTestCase() throws Exception
+ {
+ super();
+ }
+
+ @Override
+ public void setUp() throws Exception
+ {
+ setStrict(false);
+ super.setUp();
+ }
+
+ public void testUsesRelaxedMode()
+ {
+ ExtendedAssert.assertFalse(isStrict());
+ }
+
+ public void testGetPortlets() throws PortletInvokerException
+ {
+ //invoke consumer
+ Set returnedPortlets = consumer.getPortlets();
+
+ int portletNumber = returnedPortlets.size();
+ ExtendedAssert.assertEquals(getPortletNumber(), portletNumber);
+ Set<String> handles = getPortletHandles();
+ Set<String> consumerHandles = new HashSet<String>(portletNumber);
+ for (Object o : returnedPortlets)
+ {
+ Portlet portlet = (Portlet)o;
+ consumerHandles.add(portlet.getContext().getId());
+ }
+
+ ExtendedAssert.assertTrue(handles.containsAll(consumerHandles));
+ }
+
+ @Override
+ protected void registerAdditionalMarkupBehaviors(BehaviorRegistry registry)
+ {
+ // do nothing so that we don't pollute the service description with markup behaviors
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java 2008-07-07 16:14:32 UTC (rev 11319)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java 2008-07-07 16:15:04 UTC (rev 11320)
@@ -36,6 +36,7 @@
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
import org.jboss.portal.portlet.spi.WindowContext;
+import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
import org.jboss.portal.test.wsrp.framework.support.BasicInstanceContext;
import org.jboss.portal.test.wsrp.framework.support.BasicPortalContext;
import org.jboss.portal.test.wsrp.framework.support.BasicSecurityContext;
@@ -54,8 +55,11 @@
import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
import org.jboss.portal.wsrp.core.CookieProtocol;
import org.jboss.portal.wsrp.core.InvalidHandleFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
import javax.servlet.http.HttpSession;
+import java.rmi.RemoteException;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -100,7 +104,7 @@
public void testRender() throws Exception
{
RenderInvocation render = createRenderInvocation(BasicMarkupBehavior.PORTLET_HANDLE, Mode.EDIT,
- WindowState.NORMAL, "someNS");
+ WindowState.NORMAL, "someNS");
FragmentResponse result = checkRenderResult(consumer.invoke(render), "portlet1:edit:normal:someNS");
ExtendedAssert.assertEquals(15, result.getCacheControl().getExpirationSecs());
@@ -168,13 +172,15 @@
ExtendedAssert.assertEquals(1, behavior.getInitCookieCallCount());
}
- public void testInitCookiePerGroup() throws PortletInvokerException, InvalidHandleFault
+ public void testInitCookiePerGroup() throws PortletInvokerException, InvalidHandleFault, RemoteException, InvalidRegistrationFault, OperationFailedFault
{
- // need to setup with a specific service description behavior
- setUpWith(new GroupedPortletsServiceDescriptionBehavior());
+ BehaviorRegistry registry = producer.getBehaviorRegistry();
+ // need to setup with a specific service description behavior: we wrap the current service description
+ setServiceDescriptionBehavior(new GroupedPortletsServiceDescriptionBehavior(registry.getServiceDescriptionBehavior().getServiceDescription(null)));
+
String handle = PerGroupInitCookieMarkupBehavior.PER_GROUP_INIT_COOKIE_HANDLE;
- InitCookieMarkupBehavior behavior = (InitCookieMarkupBehavior)producer.getBehaviorRegistry().getMarkupBehaviorFor(handle);
+ InitCookieMarkupBehavior behavior = (InitCookieMarkupBehavior)registry.getMarkupBehaviorFor(handle);
ProducerSessionInformation sessionInfo = commonInitCookieTest(handle, behavior, CookieProtocol.perGroup);
ExtendedAssert.assertTrue(sessionInfo.isPerGroupCookies());
@@ -193,7 +199,7 @@
}
private ProducerSessionInformation commonInitCookieTest(String handle, InitCookieMarkupBehavior behavior, CookieProtocol cookieProtocol)
- throws PortletInvokerException
+ throws PortletInvokerException
{
RenderInvocation render = createRenderInvocation(handle);
TestPortletInvocationContext invocationContext = (TestPortletInvocationContext)render.getContext();
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/ServiceDescriptionTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/ServiceDescriptionTestCase.java 2008-07-07 16:14:32 UTC (rev 11319)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/ServiceDescriptionTestCase.java 2008-07-07 16:15:04 UTC (rev 11320)
@@ -26,18 +26,15 @@
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicMarkupBehavior;
-import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicServiceDescriptionBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.SessionMarkupBehavior;
-import java.util.Set;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
* @since 2.4
*/
-public class ServiceDescriptionTestCase extends V1ConsumerBaseTest
+public class ServiceDescriptionTestCase extends InteropServiceDescriptionTestCase
{
public ServiceDescriptionTestCase() throws Exception
@@ -46,27 +43,18 @@
}
+ @Override
public void setUp() throws Exception
{
super.setUp();
- // override default service description behavior to make sure we have the correct state
- producer.getBehaviorRegistry().setServiceDescriptionBehavior(new BasicServiceDescriptionBehavior());
- consumer.refreshProducerInfo();
+
+ // use strict mode
+ setStrict(true);
}
- public void testGetportlets() throws Exception
+ public void testUsesRelaxedMode()
{
- //invoke consumer
- Set returnedPortlets = consumer.getPortlets();
-
- //assert we have our two portlets
- ExtendedAssert.assertEquals(2, returnedPortlets.size());
- Portlet[] portletArray = (Portlet[])returnedPortlets.toArray(new Portlet[0]);
- Portlet p1 = portletArray[0];
- Portlet p2 = portletArray[1];
-
- ExtendedAssert.assertTrue((p1.getContext().getId().equals(BasicMarkupBehavior.PORTLET_HANDLE) && p2.getContext().getId().equals(SessionMarkupBehavior.PORTLET_HANDLE)) ||
- (p2.getContext().getId().equals(BasicMarkupBehavior.PORTLET_HANDLE) && p1.getContext().getId().equals(SessionMarkupBehavior.PORTLET_HANDLE)));
+ ExtendedAssert.assertTrue(isStrict());
}
public void testGetPortlet() throws Exception
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java 2008-07-07 16:14:32 UTC (rev 11319)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java 2008-07-07 16:15:04 UTC (rev 11320)
@@ -24,22 +24,9 @@
import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.test.wsrp.WSRPConsumerBaseTest;
-import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
-import org.jboss.portal.test.wsrp.framework.ServiceDescriptionBehavior;
-import org.jboss.portal.test.wsrp.framework.support.MockConsumerRegistry;
import org.jboss.portal.test.wsrp.framework.support.ServiceObjectFactory;
-import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicMarkupBehavior;
-import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicPortletManagementBehavior;
-import org.jboss.portal.test.wsrp.v1.consumer.behaviors.EmptyMarkupBehavior;
-import org.jboss.portal.test.wsrp.v1.consumer.behaviors.InitCookieNotRequiredMarkupBehavior;
-import org.jboss.portal.test.wsrp.v1.consumer.behaviors.NullMarkupBehavior;
-import org.jboss.portal.test.wsrp.v1.consumer.behaviors.PerGroupInitCookieMarkupBehavior;
-import org.jboss.portal.test.wsrp.v1.consumer.behaviors.PerUserInitCookieMarkupBehavior;
-import org.jboss.portal.test.wsrp.v1.consumer.behaviors.ResourceMarkupBehavior;
-import org.jboss.portal.test.wsrp.v1.consumer.behaviors.SessionMarkupBehavior;
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
@@ -66,34 +53,5 @@
public void setUp() throws Exception
{
super.setUp();
- setUpWith(new ServiceDescriptionBehavior());
}
-
- protected void setUpWith(ServiceDescriptionBehavior serviceDescriptionBehavior) throws PortletInvokerException
- {
- // reset producer state
- producer.reset();
-
- // reset the behaviors
- BehaviorRegistry registry = producer.getBehaviorRegistry();
- registry.setPortletManagementBehavior(new BasicPortletManagementBehavior(registry));
- registry.setServiceDescriptionBehavior(serviceDescriptionBehavior);
- registry.registerMarkupBehavior(new BasicMarkupBehavior(registry));
- registry.registerMarkupBehavior(new EmptyMarkupBehavior(registry));
- registry.registerMarkupBehavior(new InitCookieNotRequiredMarkupBehavior(registry));
- registry.registerMarkupBehavior(new PerGroupInitCookieMarkupBehavior(registry));
- registry.registerMarkupBehavior(new PerUserInitCookieMarkupBehavior(registry));
- registry.registerMarkupBehavior(new NullMarkupBehavior(registry));
- registry.registerMarkupBehavior(new SessionMarkupBehavior(registry));
- registry.registerMarkupBehavior(new ResourceMarkupBehavior(registry));
-
- // use a fresh ConsumerRegistry
- consumer.getProducerInfo().setRegistry(new MockConsumerRegistry());
-
- // make sure we use clean producer info for each test
- consumer.refreshProducerInfo();
-
- // use cache to avoid un-necessary calls
- consumer.getProducerInfo().setExpirationCacheSeconds(120);
- }
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/GroupedPortletsServiceDescriptionBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/GroupedPortletsServiceDescriptionBehavior.java 2008-07-07 16:14:32 UTC (rev 11319)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/GroupedPortletsServiceDescriptionBehavior.java 2008-07-07 16:15:04 UTC (rev 11320)
@@ -32,11 +32,18 @@
import java.rmi.RemoteException;
/**
+ * Wraps a service description to add group information on portlet descriptions...
+ *
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
public class GroupedPortletsServiceDescriptionBehavior extends ServiceDescriptionBehavior
{
+ public GroupedPortletsServiceDescriptionBehavior(ServiceDescription sd)
+ {
+ serviceDescription = sd;
+ }
+
@Override
public ServiceDescription getServiceDescription(GetServiceDescription getServiceDescription) throws OperationFailedFault, InvalidRegistrationFault, RemoteException
{
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/interop/LiferayServiceDescriptionBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/interop/LiferayServiceDescriptionBehavior.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/interop/LiferayServiceDescriptionBehavior.java 2008-07-07 16:15:04 UTC (rev 11320)
@@ -0,0 +1,70 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, 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.wsrp.v1.consumer.behaviors.interop;
+
+import org.jboss.portal.test.wsrp.framework.ServiceDescriptionBehavior;
+import org.jboss.portal.wsrp.core.LocalizedString;
+import org.jboss.portal.wsrp.core.PortletDescription;
+
+/**
+ * Liferay behavior as exhibited at http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4162201#4162201
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class LiferayServiceDescriptionBehavior extends ServiceDescriptionBehavior
+{
+ public LiferayServiceDescriptionBehavior()
+ {
+ /*
+ <portletHandle>98</portletHandle>
+<markupTypes>
+ <mimeType>text/html</mimeType>
+ <modes>wsrp:view</modes>
+ <windowStates>wsrp:normal</windowStates>
+ <windowStates>wsrp:minimized</windowStates>
+ <windowStates>wsrp:maximized</windowStates>
+ <locales>en_US</locales>
+</markupTypes>
+<groupID>98</groupID>
+<shortTitle lang='English'>
+ <value>javax.portlet.short-title.98</value>
+</shortTitle>
+<title lang='English'>
+ <value>Software Catalog</value>
+</title>
+ */
+ PortletDescription pd = createPortletDescription("98", null);
+ pd.getMarkupTypes()[0].getLocales()[0] = "en_US";
+ LocalizedString locString = pd.getShortTitle();
+ pd.setGroupID("98");
+ String lang = "English";
+ locString.setLang(lang);
+ locString.setValue("javax.portlet.short-title.98");
+ locString = pd.getTitle();
+ locString.setLang(lang);
+ locString.setValue("Software Catalog");
+
+ serviceDescription.setOfferedPortlets(new PortletDescription[]{pd});
+ }
+}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2008-07-07 16:14:32 UTC (rev 11319)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2008-07-07 16:15:04 UTC (rev 11320)
@@ -317,7 +317,7 @@
{
ParameterValidation.throwIllegalArgExceptionIfNull(propertyDescription, "RegistrationPropertyDescription");
PropertyDescription propDesc = WSRPTypeFactory.createPropertyDescription(propertyDescription.getName().toString(),
- propertyDescription.getType());
+ propertyDescription.getType());
// todo: deal with languages properly!!
LocalizedString hint = propertyDescription.getHint();
@@ -342,7 +342,7 @@
{
ParameterValidation.throwIllegalArgExceptionIfNull(propertyDescription, "PropertyDescription");
RegistrationPropertyDescription desc = new RegistrationPropertyDescription(propertyDescription.getName(),
- propertyDescription.getType());
+ propertyDescription.getType());
desc.setLabel(getLocalizedStringOrNull(propertyDescription.getLabel()));
desc.setHint(getLocalizedStringOrNull(propertyDescription.getHint()));
@@ -394,7 +394,7 @@
{
ParameterValidation.throwIllegalArgExceptionIfNull(regLocalizedString, "LocalizedString");
return WSRPTypeFactory.createLocalizedString(toString(regLocalizedString.getLocale()),
- regLocalizedString.getResourceName(), regLocalizedString.getValue());
+ regLocalizedString.getResourceName(), regLocalizedString.getValue());
}
/**
@@ -448,7 +448,16 @@
}
catch (ConversionException e)
{
- throw new IllegalArgumentException(e);
+ if (WSRPUtils.strict)
+ {
+ throw new IllegalArgumentException(e);
+ }
+ else
+ {
+ log.debug("Was given an invalid language: '" + possiblyRelaxed
+ + "'. Since we're using relaxed validation, we will assume " + Locale.ENGLISH + " to avoid crashing!", e);
+ return Locale.ENGLISH;
+ }
}
}
@@ -482,7 +491,7 @@
sb.append("(secure)");
}
sb.append("[M=").append(params.getMode()).append("][WS=").append(params.getWindowState()).append("]")
- .append("[NS=").append(params.getNavigationalState()).append("]");
+ .append("[NS=").append(params.getNavigationalState()).append("]");
return sb.toString();
}
return null;
@@ -501,7 +510,7 @@
{
StringBuffer sb = new StringBuffer("InteractionParams");
sb.append("[IS=").append(interactionParams.getInteractionState()).append("]")
- .append("[StateChange=").append(interactionParams.getPortletStateChange().getValue()).append("]");
+ .append("[StateChange=").append(interactionParams.getPortletStateChange().getValue()).append("]");
NamedString[] formParams = interactionParams.getFormParameters();
if (formParams != null)
{
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-wsrp-consumer-servicedescription-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-wsrp-consumer-servicedescription-sar/META-INF/jboss-service.xml 2008-07-07 16:14:32 UTC (rev 11319)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-wsrp-consumer-servicedescription-sar/META-INF/jboss-service.xml 2008-07-07 16:15:04 UTC (rev 11320)
@@ -24,14 +24,30 @@
<server>
<mbean
- code="org.jboss.portal.test.wsrp.v1.consumer.ServiceDescriptionTestCase"
- name="portal.test:test=ServiceDescription"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ code="org.jboss.portal.test.wsrp.v1.consumer.ServiceDescriptionTestCase"
+ name="portal.test:test=ServiceDescription"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends optional-attribute-name="TestDriverRegistry"
- proxy-type="attribute">portal.test:service=TestDriverServer</depends>
+ proxy-type="attribute">portal.test:service=TestDriverServer
+ </depends>
<depends optional-attribute-name="Consumer" proxy-type="attribute">portal.wsrp:service=WSRPConsumer</depends>
<depends optional-attribute-name="Producer" proxy-type="attribute">portal.wsrp:service=WSRPProducer</depends>
</mbean>
+ <mbean
+ code="org.jboss.portal.test.wsrp.v1.consumer.InteropServiceDescriptionTestCase"
+ name="portal.test:test=LiferayServiceDescription"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends optional-attribute-name="TestDriverRegistry"
+ proxy-type="attribute">portal.test:service=TestDriverServer
+ </depends>
+ <depends optional-attribute-name="Consumer" proxy-type="attribute">portal.wsrp:service=WSRPConsumer</depends>
+ <depends optional-attribute-name="Producer" proxy-type="attribute">portal.wsrp:service=WSRPProducer</depends>
+ <attribute name="SDClassName">
+ org.jboss.portal.test.wsrp.v1.consumer.behaviors.interop.LiferayServiceDescriptionBehavior
+ </attribute>
+ </mbean>
</server>
16 years