JBoss Portal SVN: r10945 - in modules/presentation/trunk/portal/src: main/java/org/jboss/portal/presentation/portal/model and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-08 10:13:28 -0400 (Sun, 08 Jun 2008)
New Revision: 10945
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeState.java
Modified:
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java
Log:
minor refactor
Modified: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-08 14:10:51 UTC (rev 10944)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-08 14:13:28 UTC (rev 10945)
@@ -135,7 +135,7 @@
<bean name="LayoutStore" class="org.jboss.portal.presentation.portal.model.layout.LayoutStore"/>
- <bean name="PortalNodeAdapter" class="org.jboss.portal.presentation.portal.model.object.PortalNodeAdapter">
+ <bean name="PortalNodeAdapter" class="org.jboss.portal.presentation.portal.model.PortalNodeAdapter">
<constructor>
<parameter><inject bean="PortalNodeManager"/></parameter>
<parameter><inject bean="LayoutStore"/></parameter>
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java (from rev 10943, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeAdapter.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java 2008-06-08 14:13:28 UTC (rev 10945)
@@ -0,0 +1,288 @@
+/******************************************************************************
+ * 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.portal.model;
+
+import org.jboss.portal.presentation.impl.state.structural.adapter.StructuralAdapter;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
+import org.jboss.portal.presentation.portal.model.layout.StructureElement;
+import org.jboss.portal.presentation.portal.model.layout.NestedStructure;
+import org.jboss.portal.presentation.portal.model.layout.ObjectStructure;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
+import org.jboss.portal.presentation.portal.model.layout.LayoutObject;
+import org.jboss.portal.presentation.portal.model.layout.ObjectElement;
+import org.jboss.portal.presentation.portal.model.object.PortalNodeManager;
+import org.jboss.portal.presentation.portal.model.object.PortalNode;
+import org.jboss.portal.presentation.portal.model.object.PageNode;
+import org.jboss.portal.presentation.portal.model.object.WindowNode;
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIPane;
+import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.state.structural.StructuralState;
+import org.jboss.portal.common.NotYetImplemented;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalNodeAdapter implements StructuralAdapter<Object>
+{
+
+ /** . */
+ private PortalNodeManager nodeManager;
+
+ /** . */
+ private LayoutStore layoutStore;
+
+ public PortalNodeAdapter(PortalNodeManager nodeManager, LayoutStore layoutStore)
+ {
+ this.nodeManager = nodeManager;
+ this.layoutStore = layoutStore;
+ }
+
+ public String getRootId()
+ {
+ return "node." + nodeManager.getRoot().getId();
+ }
+
+ public Object getNode(String id)
+ {
+ if (id.startsWith("node."))
+ {
+ return nodeManager.getNode(id.substring(5));
+ }
+ else if (id.startsWith("structure."))
+ {
+ return layoutStore.getObject(id.substring(10));
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unrecognized id " + id);
+ }
+ }
+
+ public Object getParent(Object o)
+ {
+ if (o instanceof PortalNode)
+ {
+ return ((PortalNode)o).getParent();
+ }
+ else if (o instanceof LayoutElement)
+ {
+ LayoutStructure layout = ((LayoutElement)o).getStructure();
+
+ //
+ if (layout instanceof NestedStructure)
+ {
+ return ((NestedStructure)layout).getStructureElement();
+ }
+ else
+ {
+ ObjectStructure objectStructure = (ObjectStructure)layout;
+ String objectId = objectStructure.getObjectRef();
+ return nodeManager.getNode(objectId);
+ }
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public Collection<?> getChilren(Object o)
+ {
+ if (o instanceof PortalNode)
+ {
+ if (o instanceof PageNode)
+ {
+ String layoutStructureId = ((PageNode)o).getLayoutStructureId();
+
+ //
+ LayoutStructure layoutStructure = (LayoutStructure)layoutStore.getObject(layoutStructureId);
+
+ //
+ return layoutStructure.getElements();
+ }
+ else
+ {
+ return ((PortalNode)o).getChildren();
+ }
+ }
+ else if (o instanceof LayoutElement)
+ {
+ if (o instanceof StructureElement)
+ {
+ return ((StructureElement)o).getNestedStructure().getElements();
+ }
+ else
+ {
+ return Collections.emptyList();
+ }
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public String getId(Object o)
+ {
+ if (o instanceof PortalNode)
+ {
+ return "node." + ((PortalNode)o).getId();
+ }
+ else if (o instanceof LayoutObject)
+ {
+ return "structure." + ((LayoutObject)o).getId();
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public Class<? extends UIObject> getType(Object o)
+ {
+ if (o instanceof PortalNode)
+ {
+ return ((PortalNode)o).getType();
+ }
+ else if (o instanceof LayoutElement)
+ {
+ if (o instanceof StructureElement)
+ {
+ return UIPane.class;
+ }
+ else if (o instanceof ObjectElement)
+ {
+ return UIWindow.class;
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public String getName(Object o)
+ {
+ if (o instanceof PortalNode)
+ {
+ return ((PortalNode)o).getName();
+ }
+ else if (o instanceof LayoutObject)
+ {
+ // no natural name, for now use id
+ return ((LayoutObject)o).getId();
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public Map<String, Serializable> getProperties(Object o)
+ {
+ if (o instanceof PageNode)
+ {
+ PageNode page = (PageNode)o;
+
+ //
+ String layoutStructureId = ((PageNode)o).getLayoutStructureId();
+
+ //
+ LayoutStructure layoutStructure = (LayoutStructure)layoutStore.getObject(layoutStructureId);
+
+ //
+ Map<String, Serializable> properties = new HashMap<String, Serializable>(page.getProperties());
+
+ //
+ properties.putAll(layoutStructure.getState().getProperties());
+
+ //
+ return properties;
+ }
+ else if (o instanceof PortalNode)
+ {
+ return ((PortalNode)o).getProperties();
+ }
+ else if (o instanceof LayoutObject)
+ {
+ if (o instanceof ObjectElement)
+ {
+ ObjectElement element = (ObjectElement)o;
+
+ //
+ String windowId = element.getObjectRef();
+
+ //
+ WindowNode window = (WindowNode)nodeManager.getNode(windowId);
+
+ //
+ Map<String, Serializable> properties = new HashMap<String, Serializable>(window.getProperties());
+
+ //
+ properties.putAll(element.getState().getProperties());
+
+ //
+ return properties;
+ }
+ else
+ {
+ return ((LayoutObject)o).getState().getProperties();
+ }
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public StructuralState getState(Object o)
+ {
+ Class<? extends UIObject> type = getType(o);
+ String name = getName(o);
+ Map<String, Serializable> properties = getProperties(o);
+
+ //
+ return new PortalNodeState(type, name, properties);
+ }
+
+ public void lock(Object o)
+ {
+ }
+
+ public void unlock(Object o)
+ {
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeState.java (from rev 10942, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeState.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeState.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeState.java 2008-06-08 14:13:28 UTC (rev 10945)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * 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.portal.model;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.state.structural.StructuralState;
+
+import java.util.Map;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class PortalNodeState implements StructuralState
+{
+
+ /** . */
+ private final Class<? extends UIObject> type;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Map<String, Serializable> properties;
+
+ public PortalNodeState(
+ Class<? extends UIObject> type,
+ String name,
+ Map<String, Serializable> properties)
+ {
+ this.type = type;
+ this.name = name;
+ this.properties = properties;
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return type;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Map<String, Serializable> getProperties()
+ {
+ return properties;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof PortalNodeState)
+ {
+ PortalNodeState that = (PortalNodeState)obj;
+
+ //
+ if (!that.type.equals(this.type))
+ {
+ return false;
+ }
+
+ //
+ if (!that.name.equals(this.name))
+ {
+ return false;
+ }
+
+ //
+ return that.properties.equals(this.properties);
+ }
+ return false;
+ }
+}
Modified: modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java
===================================================================
--- modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java 2008-06-08 14:10:51 UTC (rev 10944)
+++ modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java 2008-06-08 14:13:28 UTC (rev 10945)
@@ -34,7 +34,7 @@
import org.jboss.portal.presentation.portal.model.object.ContextNode;
import org.jboss.portal.presentation.portal.model.object.PageNode;
import org.jboss.portal.presentation.portal.model.object.PortalNode;
-import org.jboss.portal.presentation.portal.model.object.PortalNodeAdapter;
+import org.jboss.portal.presentation.portal.model.PortalNodeAdapter;
import org.jboss.portal.presentation.portal.model.object.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.object.WindowNode;
17 years, 11 months
JBoss Portal SVN: r10943 - in modules/presentation/trunk: portal/src/main/java/org/jboss/portal/presentation/portal and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-08 10:08:18 -0400 (Sun, 08 Jun 2008)
New Revision: 10943
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/
Modified:
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeAdapter.java
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.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/StructuralObjectImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralStateContextImpl.java
Log:
move the structural adapter to the presentation package
Modified: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-07 21:22:25 UTC (rev 10942)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-08 14:08:18 UTC (rev 10943)
@@ -142,7 +142,7 @@
</constructor>
</bean>
- <bean name="StructuralStateContext" class="org.jboss.portal.presentation.portal.model.structural.StructuralStateContextImpl">
+ <bean name="StructuralStateContext" class="org.jboss.portal.presentation.impl.state.structural.adapter.StructuralStateContextImpl">
<constructor>
<parameter><inject bean="PortalNodeAdapter"/></parameter>
</constructor>
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-07 21:22:25 UTC (rev 10942)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-08 14:08:18 UTC (rev 10943)
@@ -28,7 +28,7 @@
import org.jboss.portal.presentation.portal.model.object.PageNode;
import org.jboss.portal.presentation.portal.model.object.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.layout.ObjectElement;
-import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
+import org.jboss.portal.presentation.impl.state.structural.adapter.StructuralAdapter;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
import org.jboss.portal.presentation.portal.content.ContentHandlerRegistry;
import org.jboss.portal.presentation.portal.content.ContentHandler;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeAdapter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeAdapter.java 2008-06-07 21:22:25 UTC (rev 10942)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeAdapter.java 2008-06-08 14:08:18 UTC (rev 10943)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.portal.model.object;
-import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
+import org.jboss.portal.presentation.impl.state.structural.adapter.StructuralAdapter;
import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
import org.jboss.portal.presentation.portal.model.layout.StructureElement;
Modified: modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java
===================================================================
--- modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java 2008-06-07 21:22:25 UTC (rev 10942)
+++ modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java 2008-06-08 14:08:18 UTC (rev 10943)
@@ -28,8 +28,8 @@
import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
import org.jboss.portal.presentation.test.model.AbstractModelTestCase;
-import org.jboss.portal.presentation.portal.model.structural.StructuralStateContextImpl;
-import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
+import org.jboss.portal.presentation.impl.state.structural.adapter.StructuralStateContextImpl;
+import org.jboss.portal.presentation.impl.state.structural.adapter.StructuralAdapter;
import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
import org.jboss.portal.presentation.portal.model.object.ContextNode;
import org.jboss.portal.presentation.portal.model.object.PageNode;
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter (from rev 10942, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/structural)
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralAdapter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/structural/StructuralAdapter.java 2008-06-07 21:22:25 UTC (rev 10942)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralAdapter.java 2008-06-08 14:08:18 UTC (rev 10943)
@@ -20,7 +20,7 @@
* 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.portal.model.structural;
+package org.jboss.portal.presentation.impl.state.structural.adapter;
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.state.structural.StructuralState;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralObjectImpl.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/structural/StructuralObjectImpl.java 2008-06-07 21:22:25 UTC (rev 10942)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralObjectImpl.java 2008-06-08 14:08:18 UTC (rev 10943)
@@ -20,7 +20,7 @@
* 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.portal.model.structural;
+package org.jboss.portal.presentation.impl.state.structural.adapter;
import org.jboss.portal.presentation.state.structural.StructuralObject;
import org.jboss.portal.presentation.state.structural.StructuralState;
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralStateContextImpl.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/structural/StructuralStateContextImpl.java 2008-06-07 21:22:25 UTC (rev 10942)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/structural/adapter/StructuralStateContextImpl.java 2008-06-08 14:08:18 UTC (rev 10943)
@@ -20,7 +20,7 @@
* 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.portal.model.structural;
+package org.jboss.portal.presentation.impl.state.structural.adapter;
import org.jboss.portal.presentation.state.NoSuchStateException;
import org.jboss.portal.presentation.state.StaleStateException;
17 years, 11 months
JBoss Portal SVN: r10942 - in modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal: model/object and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-07 17:22:25 -0400 (Sat, 07 Jun 2008)
New Revision: 10942
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java
Removed:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ContextNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeState.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/NodeImporter.java
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java
Log:
rename NodeImporter to ModelImporter
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ContextNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ContextNode.java 2008-06-07 21:20:31 UTC (rev 10941)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ContextNode.java 2008-06-07 21:22:25 UTC (rev 10942)
@@ -1,43 +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.portal.model;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.ui.UIContext;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ContextNode extends PortalNode
-{
- public ContextNode(String name, PortalNodeManager structuralStateContext)
- {
- super(name, structuralStateContext);
- }
-
- public Class<? extends UIObject> getType()
- {
- return UIContext.class;
- }
-}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java 2008-06-07 21:22:25 UTC (rev 10942)
@@ -0,0 +1,305 @@
+/******************************************************************************
+ * 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.portal.model;
+
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.xml.XMLTools;
+import org.jboss.portal.common.NotYetImplemented;
+import static org.jboss.portal.common.xml.XMLTools.*;
+import org.jboss.portal.presentation.portal.content.markup.MarkupContent;
+import org.jboss.portal.presentation.portal.content.portlet.PortletContent;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
+import org.jboss.portal.presentation.portal.model.layout.StructureElement;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
+import org.jboss.portal.presentation.portal.model.object.PortalNode;
+import org.jboss.portal.presentation.portal.model.object.PageNode;
+import org.jboss.portal.presentation.portal.model.object.WindowNode;
+import org.jboss.portal.presentation.model.layout.Constants;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ModelImporter
+{
+
+ /** . */
+ private final static Schema schema;
+
+ /** . */
+ private static final URL schemaURL;
+
+ static
+ {
+ try
+ {
+ schemaURL = ModelImporter.class.getClassLoader().getResource("org/jboss/portal/presentation/portal/page_structure_1_0.xsd");
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ schema = factory.newSchema(schemaURL);
+ }
+ catch (SAXException e)
+ {
+ throw new Error("Could not load the page structure 1.0 schema", e);
+ }
+
+ }
+
+ /** The root to import the children to. */
+ private final PortalNode root;
+
+ /** . */
+ private final LayoutStore layoutStore;
+
+ public ModelImporter(PortalNode root, LayoutStore layoutStore)
+ {
+ this.root = root;
+ this.layoutStore = layoutStore;
+ }
+
+ /**
+ * Imports the specified document.
+ *
+ * @param document the document
+ * @throws IllegalArgumentException if the document is null
+ */
+ public void importDocument(Document document) throws IllegalArgumentException
+ {
+ if (document == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ importContextDef(document.getDocumentElement());
+ }
+
+ public void importDocument(InputStream in) throws IllegalArgumentException, ParserConfigurationException, IOException, SAXException
+ {
+ if (in == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ InputStream schemaStream = schemaURL.openStream();
+
+ try
+ {
+ DocumentBuilderFactory factory = XMLTools.getDocumentBuilderFactory();
+ factory.setValidating(true);
+ factory.setNamespaceAware(true);
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaStream);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.parse(in);
+ importDocument(doc);
+ }
+ finally
+ {
+ IOTools.safeClose(schemaStream);
+ }
+ }
+
+ private void importContextDef(org.w3c.dom.Element contextDefElt)
+ {
+ // Children pages
+ for (org.w3c.dom.Element childElt : getChildren(contextDefElt, "page-def"))
+ {
+ importPageDef(root, childElt);
+ }
+ }
+
+ private PageNode importPageDef(PortalNode parentNode, org.w3c.dom.Element pageDefElt)
+ {
+ PageNode page = createStructuralNode(parentNode, PageNode.class, pageDefElt);
+
+ // Sub pages
+ for (org.w3c.dom.Element childElt : getChildren(pageDefElt, "page-def"))
+ {
+ importPageDef(page, childElt);
+ }
+
+ //
+ Element element = getUniqueChild(pageDefElt, "simple-layout", false);
+
+ //
+ if (element != null)
+ {
+ importLayout(page, element);
+ }
+
+ //
+ return page;
+ }
+
+ private void importLayout(PageNode page, Element element)
+ {
+ LayoutStructure pageStructure = layoutStore.createStructure(page.getId());
+
+ //
+ page.setLayoutStructureId(pageStructure.getId());
+
+ //
+ importLayout(page, pageStructure, element);
+ }
+
+ private void importLayout(PageNode page, LayoutStructure layout, Element element)
+ {
+ if ("simple-layout".equals(element.getNodeName()))
+ {
+ String orientation = "horizontal".equals(element.getAttribute("orientation")) ? Constants.HORIZONTAL_ORIENTATION : Constants.VERTICAL_ORIENTATION;
+
+ //
+ layout.setProperty(Constants.LAYOUT_ID, Constants.SIMPLE_LAYOUT);
+ layout.setProperty(Constants.SIMPLE_LAYOUT_ORIENTATION, orientation);
+
+ //
+ int index = 0;
+ for (org.w3c.dom.Element childElt : getChildren(element))
+ {
+ String childName = childElt.getNamespaceURI() == null ? childElt.getTagName() : childElt.getLocalName();
+
+ //
+ LayoutElement structureElement;
+ if ("window-def".equals(childName))
+ {
+ WindowNode window = importWindowDef(page, childElt);
+
+ //
+ structureElement = layout.addObjectElement(window.getId());
+ }
+ else if ("simple-layout".equals(childName))
+ {
+ StructureElement nestedLayout = layout.addStructureElement();
+
+ //
+ importLayout(page, nestedLayout.getNestedStructure(), childElt);
+
+ //
+ structureElement = nestedLayout;
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+
+ //
+ structureElement.setProperty(Constants.SIMPLE_LAYOUT_INDEX, index++);
+ }
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ private WindowNode importWindowDef(PortalNode parentNode, org.w3c.dom.Element windowDefElt)
+ {
+ WindowNode windowNode = createStructuralNode(parentNode, WindowNode.class, windowDefElt);
+
+ //
+ WindowNode.Content content = null;
+ org.w3c.dom.Element markupElt = getUniqueChild(windowDefElt, "markup", false);
+ if (markupElt != null)
+ {
+ String markup = asString(markupElt);
+ content = new MarkupContent(markup);
+ }
+ else
+ {
+ org.w3c.dom.Element portletElt = getUniqueChild(windowDefElt, "portlet", false);
+ if (portletElt != null)
+ {
+ String portletRef = portletElt.getAttribute("ref");
+ content = new PortletContent(portletRef);
+ }
+ }
+
+ //
+ windowNode.setContent(content);
+
+ //
+ return windowNode;
+ }
+
+ private <T extends PortalNode> T createStructuralNode(PortalNode parent, Class<T> type, org.w3c.dom.Element nodeDefElt)
+ {
+ String nodeName = nodeDefElt.getAttribute("name");
+
+ //
+ T node = parent.addChild(nodeName, type);
+
+ //
+ org.w3c.dom.Element propertiesElt = XMLTools.getUniqueChild(nodeDefElt, "properties", false);
+
+ //
+ if (propertiesElt != null)
+ {
+ for (org.w3c.dom.Element propertyElt : XMLTools.getChildren(propertiesElt, "property"))
+ {
+ org.w3c.dom.Element nameElt = XMLTools.getUniqueChild(propertyElt, "name", true);
+ String propertyName = XMLTools.asString(nameElt);
+
+ //
+ org.w3c.dom.Element valueElt = XMLTools.getUniqueChild(propertyElt, "value", true);
+ String litteralPropertyValue = XMLTools.asString(valueElt);
+
+ Serializable propertyValue;
+ String propertyType = valueElt.getAttribute("type");
+ if (propertyType == null || "string".equals(propertyType))
+ {
+ propertyValue = litteralPropertyValue;
+ }
+ else if ("int".equals(propertyType))
+ {
+ propertyValue = Integer.parseInt(litteralPropertyValue);
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+
+ //
+ node.setProperty(propertyName, propertyValue);
+ }
+ }
+
+ //
+ return node;
+ }
+}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java 2008-06-07 21:20:31 UTC (rev 10941)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java 2008-06-07 21:22:25 UTC (rev 10942)
@@ -1,303 +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.portal.model;
-
-import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.common.xml.XMLTools;
-import org.jboss.portal.common.NotYetImplemented;
-import static org.jboss.portal.common.xml.XMLTools.*;
-import org.jboss.portal.presentation.portal.content.markup.MarkupContent;
-import org.jboss.portal.presentation.portal.content.portlet.PortletContent;
-import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
-import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
-import org.jboss.portal.presentation.portal.model.layout.StructureElement;
-import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
-import org.jboss.portal.presentation.model.layout.Constants;
-import org.jboss.portal.presentation.model.layout.Orientation;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.net.URL;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class NodeImporter
-{
-
- /** . */
- private final static Schema schema;
-
- /** . */
- private static final URL schemaURL;
-
- static
- {
- try
- {
- schemaURL = NodeImporter.class.getClassLoader().getResource("org/jboss/portal/presentation/portal/page_structure_1_0.xsd");
- SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- schema = factory.newSchema(schemaURL);
- }
- catch (SAXException e)
- {
- throw new Error("Could not load the page structure 1.0 schema", e);
- }
-
- }
-
- /** The root to import the children to. */
- private final PortalNode root;
-
- /** . */
- private final LayoutStore layoutStore;
-
- public NodeImporter(PortalNode root, LayoutStore layoutStore)
- {
- this.root = root;
- this.layoutStore = layoutStore;
- }
-
- /**
- * Imports the specified document.
- *
- * @param document the document
- * @throws IllegalArgumentException if the document is null
- */
- public void importDocument(Document document) throws IllegalArgumentException
- {
- if (document == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- importContextDef(document.getDocumentElement());
- }
-
- public void importDocument(InputStream in) throws IllegalArgumentException, ParserConfigurationException, IOException, SAXException
- {
- if (in == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- InputStream schemaStream = schemaURL.openStream();
-
- try
- {
- DocumentBuilderFactory factory = XMLTools.getDocumentBuilderFactory();
- factory.setValidating(true);
- factory.setNamespaceAware(true);
- factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
- factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaStream);
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.parse(in);
- importDocument(doc);
- }
- finally
- {
- IOTools.safeClose(schemaStream);
- }
- }
-
- private void importContextDef(org.w3c.dom.Element contextDefElt)
- {
- // Children pages
- for (org.w3c.dom.Element childElt : getChildren(contextDefElt, "page-def"))
- {
- importPageDef(root, childElt);
- }
- }
-
- private PageNode importPageDef(PortalNode parentNode, org.w3c.dom.Element pageDefElt)
- {
- PageNode page = createStructuralNode(parentNode, PageNode.class, pageDefElt);
-
- // Sub pages
- for (org.w3c.dom.Element childElt : getChildren(pageDefElt, "page-def"))
- {
- importPageDef(page, childElt);
- }
-
- //
- Element element = getUniqueChild(pageDefElt, "simple-layout", false);
-
- //
- if (element != null)
- {
- importLayout(page, element);
- }
-
- //
- return page;
- }
-
- private void importLayout(PageNode page, Element element)
- {
- LayoutStructure pageStructure = layoutStore.createStructure(page.getId());
-
- //
- page.setLayoutStructureId(pageStructure.getId());
-
- //
- importLayout(page, pageStructure, element);
- }
-
- private void importLayout(PageNode page, LayoutStructure layout, Element element)
- {
- if ("simple-layout".equals(element.getNodeName()))
- {
- String orientation = "horizontal".equals(element.getAttribute("orientation")) ? Constants.HORIZONTAL_ORIENTATION : Constants.VERTICAL_ORIENTATION;
-
- //
- layout.setProperty(Constants.LAYOUT_ID, Constants.SIMPLE_LAYOUT);
- layout.setProperty(Constants.SIMPLE_LAYOUT_ORIENTATION, orientation);
-
- //
- int index = 0;
- for (org.w3c.dom.Element childElt : getChildren(element))
- {
- String childName = childElt.getNamespaceURI() == null ? childElt.getTagName() : childElt.getLocalName();
-
- //
- LayoutElement structureElement;
- if ("window-def".equals(childName))
- {
- WindowNode window = importWindowDef(page, childElt);
-
- //
- structureElement = layout.addObjectElement(window.getId());
- }
- else if ("simple-layout".equals(childName))
- {
- StructureElement nestedLayout = layout.addStructureElement();
-
- //
- importLayout(page, nestedLayout.getNestedStructure(), childElt);
-
- //
- structureElement = nestedLayout;
- }
- else
- {
- throw new NotYetImplemented();
- }
-
- //
- structureElement.setProperty(Constants.SIMPLE_LAYOUT_INDEX, index++);
- }
- }
- else
- {
- throw new NotYetImplemented();
- }
- }
-
- private WindowNode importWindowDef(PortalNode parentNode, org.w3c.dom.Element windowDefElt)
- {
- WindowNode windowNode = createStructuralNode(parentNode, WindowNode.class, windowDefElt);
-
- //
- WindowNode.Content content = null;
- org.w3c.dom.Element markupElt = getUniqueChild(windowDefElt, "markup", false);
- if (markupElt != null)
- {
- String markup = asString(markupElt);
- content = new MarkupContent(markup);
- }
- else
- {
- org.w3c.dom.Element portletElt = getUniqueChild(windowDefElt, "portlet", false);
- if (portletElt != null)
- {
- String portletRef = portletElt.getAttribute("ref");
- content = new PortletContent(portletRef);
- }
- }
-
- //
- windowNode.setContent(content);
-
- //
- return windowNode;
- }
-
- private <T extends PortalNode> T createStructuralNode(PortalNode parent, Class<T> type, org.w3c.dom.Element nodeDefElt)
- {
- String nodeName = nodeDefElt.getAttribute("name");
-
- //
- T node = parent.addChild(nodeName, type);
-
- //
- org.w3c.dom.Element propertiesElt = XMLTools.getUniqueChild(nodeDefElt, "properties", false);
-
- //
- if (propertiesElt != null)
- {
- for (org.w3c.dom.Element propertyElt : XMLTools.getChildren(propertiesElt, "property"))
- {
- org.w3c.dom.Element nameElt = XMLTools.getUniqueChild(propertyElt, "name", true);
- String propertyName = XMLTools.asString(nameElt);
-
- //
- org.w3c.dom.Element valueElt = XMLTools.getUniqueChild(propertyElt, "value", true);
- String litteralPropertyValue = XMLTools.asString(valueElt);
-
- Serializable propertyValue;
- String propertyType = valueElt.getAttribute("type");
- if (propertyType == null || "string".equals(propertyType))
- {
- propertyValue = litteralPropertyValue;
- }
- else if ("int".equals(propertyType))
- {
- propertyValue = Integer.parseInt(litteralPropertyValue);
- }
- else
- {
- throw new AssertionError();
- }
-
- //
- node.setProperty(propertyName, propertyValue);
- }
- }
-
- //
- return node;
- }
-}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java 2008-06-07 21:20:31 UTC (rev 10941)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java 2008-06-07 21:22:25 UTC (rev 10942)
@@ -1,57 +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.portal.model;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.ui.UIPage;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PageNode extends PortalNode
-{
-
- /** . */
- private String layoutStructureId;
-
- public PageNode(String name, PortalNodeManager structuralStateContext)
- {
- super(name, structuralStateContext);
- }
-
- public String getLayoutStructureId()
- {
- return layoutStructureId;
- }
-
- public void setLayoutStructureId(String layoutStructureId)
- {
- this.layoutStructureId = layoutStructureId;
- }
-
- public Class<? extends UIObject> getType()
- {
- return UIPage.class;
- }
-}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java 2008-06-07 21:20:31 UTC (rev 10941)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java 2008-06-07 21:22:25 UTC (rev 10942)
@@ -1,245 +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.portal.model;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public abstract class PortalNode
-{
-
- /** . */
- private PortalNode parent;
-
- /** . */
- final Map<String, PortalNode> children = new HashMap<String, PortalNode>();
-
- /** . */
- private final PortalNodeManager structuralStateContext;
-
- /** . */
- final String id;
-
- /** . */
- private boolean valid;
-
- /** . */
- final String name;
-
- /** . */
- final Map<String, Serializable> properties;
-
- /** . */
- final Map<String, Serializable> immutableProperties;
-
- protected PortalNode(String name, PortalNodeManager structuralStateContext)
- {
- this.name = name;
- this.id = structuralStateContext.nextId();
- this.structuralStateContext = structuralStateContext;
- this.properties = new HashMap<String, Serializable>();
- this.valid = true;
- this.immutableProperties = Collections.unmodifiableMap(properties);
- }
-
- public abstract Class<? extends UIObject> getType();
-
- public boolean isValid()
- {
- return valid;
- }
-
- public String getId()
- {
- return id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public PortalNode getParent()
- {
- return parent;
- }
-
- public Map<String, Serializable> getProperties()
- {
- return immutableProperties;
- }
-
- public Serializable getProperty(String propertyName)
- {
- if (propertyName == null)
- {
- throw new IllegalArgumentException("No null property name");
- }
-
- //
- synchronized (this)
- {
- return properties.get(propertyName);
- }
- }
-
- public void setProperty(String propertyName, Serializable propertyValue)
- {
- if (propertyName == null)
- {
- throw new IllegalArgumentException("No null property name");
- }
-
- //
- synchronized (this)
- {
- if (propertyValue != null)
- {
- properties.put(propertyName, propertyValue);
- }
- else
- {
- properties.remove(propertyName);
- }
- }
- }
-
- public Collection<? extends PortalNode> getChildren()
- {
- return Collections.unmodifiableCollection(children.values());
- }
-
- public <T extends PortalNode> T addChild(String name, Class<T> type)
- {
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
- if (type == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- T child;
- try
- {
- Constructor<T> ctor = type.getConstructor(String.class, PortalNodeManager.class);
- child = ctor.newInstance(name, structuralStateContext);
- }
- catch (InstantiationException e)
- {
- throw new AssertionError(e);
- }
- catch (IllegalAccessException e)
- {
- throw new AssertionError(e);
- }
- catch (NoSuchMethodException e)
- {
- throw new AssertionError(e);
- }
- catch (InvocationTargetException e)
- {
- throw new AssertionError(e);
- }
-
- //
- synchronized (this)
- {
- if (children.containsKey(name))
- {
- throw new IllegalArgumentException("Child already exist");
- }
- children.put(name, child);
- child.parent = this;
- }
-
- //
- structuralStateContext.nodes.put(child.id, child);
-
- //
- return child;
- }
-
- public void destroyChild(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- PortalNode child;
- synchronized (this)
- {
- if (!children.containsKey(name))
- {
- throw new IllegalArgumentException("No such child " + name);
- }
-
- child = children.get(name);
-
- //
- for (String blah : new ArrayList<String>(child.children.keySet()))
- {
- child.destroyChild(blah);
- }
-
- //
- children.remove(name);
- structuralStateContext.nodes.remove(child.id);
-
- //
- child.valid = false;
- child.parent = null;
- }
- }
-
- public PortalNode getChild(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- synchronized (this)
- {
- return children.get(name);
- }
- }
-}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java 2008-06-07 21:20:31 UTC (rev 10941)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java 2008-06-07 21:22:25 UTC (rev 10942)
@@ -1,284 +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.portal.model;
-
-import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
-import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
-import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
-import org.jboss.portal.presentation.portal.model.layout.StructureElement;
-import org.jboss.portal.presentation.portal.model.layout.NestedStructure;
-import org.jboss.portal.presentation.portal.model.layout.ObjectStructure;
-import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
-import org.jboss.portal.presentation.portal.model.layout.LayoutObject;
-import org.jboss.portal.presentation.portal.model.layout.ObjectElement;
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.ui.UIPane;
-import org.jboss.portal.presentation.model.ui.UIWindow;
-import org.jboss.portal.presentation.state.structural.StructuralState;
-import org.jboss.portal.common.NotYetImplemented;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortalNodeAdapter implements StructuralAdapter<Object>
-{
-
- /** . */
- private PortalNodeManager nodeManager;
-
- /** . */
- private LayoutStore layoutStore;
-
- public PortalNodeAdapter(PortalNodeManager nodeManager, LayoutStore layoutStore)
- {
- this.nodeManager = nodeManager;
- this.layoutStore = layoutStore;
- }
-
- public String getRootId()
- {
- return "node." + nodeManager.getRoot().getId();
- }
-
- public Object getNode(String id)
- {
- if (id.startsWith("node."))
- {
- return nodeManager.getNode(id.substring(5));
- }
- else if (id.startsWith("structure."))
- {
- return layoutStore.getObject(id.substring(10));
- }
- else
- {
- throw new IllegalArgumentException("Unrecognized id " + id);
- }
- }
-
- public Object getParent(Object o)
- {
- if (o instanceof PortalNode)
- {
- return ((PortalNode)o).getParent();
- }
- else if (o instanceof LayoutElement)
- {
- LayoutStructure layout = ((LayoutElement)o).getStructure();
-
- //
- if (layout instanceof NestedStructure)
- {
- return ((NestedStructure)layout).getStructureElement();
- }
- else
- {
- ObjectStructure objectStructure = (ObjectStructure)layout;
- String objectId = objectStructure.getObjectRef();
- return nodeManager.getNode(objectId);
- }
- }
- else
- {
- throw new NotYetImplemented();
- }
- }
-
- public Collection<?> getChilren(Object o)
- {
- if (o instanceof PortalNode)
- {
- if (o instanceof PageNode)
- {
- String layoutStructureId = ((PageNode)o).getLayoutStructureId();
-
- //
- LayoutStructure layoutStructure = (LayoutStructure)layoutStore.getObject(layoutStructureId);
-
- //
- return layoutStructure.getElements();
- }
- else
- {
- return ((PortalNode)o).getChildren();
- }
- }
- else if (o instanceof LayoutElement)
- {
- if (o instanceof StructureElement)
- {
- return ((StructureElement)o).getNestedStructure().getElements();
- }
- else
- {
- return Collections.emptyList();
- }
- }
- else
- {
- throw new NotYetImplemented();
- }
- }
-
- public String getId(Object o)
- {
- if (o instanceof PortalNode)
- {
- return "node." + ((PortalNode)o).getId();
- }
- else if (o instanceof LayoutObject)
- {
- return "structure." + ((LayoutObject)o).getId();
- }
- else
- {
- throw new NotYetImplemented();
- }
- }
-
- public Class<? extends UIObject> getType(Object o)
- {
- if (o instanceof PortalNode)
- {
- return ((PortalNode)o).getType();
- }
- else if (o instanceof LayoutElement)
- {
- if (o instanceof StructureElement)
- {
- return UIPane.class;
- }
- else if (o instanceof ObjectElement)
- {
- return UIWindow.class;
- }
- else
- {
- throw new NotYetImplemented();
- }
- }
- else
- {
- throw new NotYetImplemented();
- }
- }
-
- public String getName(Object o)
- {
- if (o instanceof PortalNode)
- {
- return ((PortalNode)o).getName();
- }
- else if (o instanceof LayoutObject)
- {
- // no natural name, for now use id
- return ((LayoutObject)o).getId();
- }
- else
- {
- throw new NotYetImplemented();
- }
- }
-
- public Map<String, Serializable> getProperties(Object o)
- {
- if (o instanceof PageNode)
- {
- PageNode page = (PageNode)o;
-
- //
- String layoutStructureId = ((PageNode)o).getLayoutStructureId();
-
- //
- LayoutStructure layoutStructure = (LayoutStructure)layoutStore.getObject(layoutStructureId);
-
- //
- Map<String, Serializable> properties = new HashMap<String, Serializable>(page.getProperties());
-
- //
- properties.putAll(layoutStructure.getState().getProperties());
-
- //
- return properties;
- }
- else if (o instanceof PortalNode)
- {
- return ((PortalNode)o).getProperties();
- }
- else if (o instanceof LayoutObject)
- {
- if (o instanceof ObjectElement)
- {
- ObjectElement element = (ObjectElement)o;
-
- //
- String windowId = element.getObjectRef();
-
- //
- WindowNode window = (WindowNode)nodeManager.getNode(windowId);
-
- //
- Map<String, Serializable> properties = new HashMap<String, Serializable>(window.getProperties());
-
- //
- properties.putAll(element.getState().getProperties());
-
- //
- return properties;
- }
- else
- {
- return ((LayoutObject)o).getState().getProperties();
- }
- }
- else
- {
- throw new NotYetImplemented();
- }
- }
-
- public StructuralState getState(Object o)
- {
- Class<? extends UIObject> type = getType(o);
- String name = getName(o);
- Map<String, Serializable> properties = getProperties(o);
-
- //
- return new PortalNodeState(type, name, properties);
- }
-
- public void lock(Object o)
- {
- }
-
- public void unlock(Object o)
- {
- }
-}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java 2008-06-07 21:20:31 UTC (rev 10941)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java 2008-06-07 21:22:25 UTC (rev 10942)
@@ -1,93 +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.portal.model;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortalNodeManager
-{
-
- /** . */
- private final AtomicLong sequence = new AtomicLong();
-
- /** . */
- final ConcurrentMap<String, PortalNode> nodes = new ConcurrentHashMap<String, PortalNode>();
-
- /** . */
- private final ContextNode root = new ContextNode("", this);
-
- public PortalNodeManager()
- {
- nodes.put(root.getId(), root);
- }
-
- String nextId()
- {
- return Long.toString(sequence.getAndIncrement());
- }
-
- public PortalNode getNode(String nodeId)
- {
- if (nodeId == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- return nodes.get(nodeId);
- }
-
- public ContextNode getRoot()
- {
- return root;
- }
-
- public void destroy(String objectId)
- {
- if (objectId == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- PortalNode node = nodes.get(objectId);
-
- //
- PortalNode parent = node.getParent();
-
- //
- if (parent == null)
- {
- throw new IllegalArgumentException("Cannot destroy root");
- }
-
- //
- parent.destroyChild(node.getName());
- }
-}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeState.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeState.java 2008-06-07 21:20:31 UTC (rev 10941)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeState.java 2008-06-07 21:22:25 UTC (rev 10942)
@@ -1,99 +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.portal.model;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.state.structural.StructuralState;
-
-import java.util.Map;
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortalNodeState implements StructuralState
-{
-
- /** . */
- private final Class<? extends UIObject> type;
-
- /** . */
- private final String name;
-
- /** . */
- private final Map<String, Serializable> properties;
-
- public PortalNodeState(
- Class<? extends UIObject> type,
- String name,
- Map<String, Serializable> properties)
- {
- this.type = type;
- this.name = name;
- this.properties = properties;
- }
-
- public Class<? extends UIObject> getType()
- {
- return type;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Map<String, Serializable> getProperties()
- {
- return properties;
- }
-
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof PortalNodeState)
- {
- PortalNodeState that = (PortalNodeState)obj;
-
- //
- if (!that.type.equals(this.type))
- {
- return false;
- }
-
- //
- if (!that.name.equals(this.name))
- {
- return false;
- }
-
- //
- return that.properties.equals(this.properties);
- }
- return false;
- }
-}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java 2008-06-07 21:20:31 UTC (rev 10941)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java 2008-06-07 21:22:25 UTC (rev 10942)
@@ -1,69 +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.portal.model;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.ui.UIWindow;
-import org.jboss.portal.presentation.model.content.WindowContent;
-import org.jboss.portal.presentation.client.PresentationClient;
-import org.jboss.portal.presentation.server.PresentationServerException;
-import org.jboss.portal.portlet.PortletInvoker;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class WindowNode extends PortalNode
-{
-
- /** . */
- private Content content;
-
- public WindowNode(String name, PortalNodeManager structuralStateContext)
- {
- super(name, structuralStateContext);
- }
-
- public Class<? extends UIObject> getType()
- {
- return UIWindow.class;
- }
-
- public void setContent(Content content)
- {
- this.content = content;
- }
-
- public Content getContent()
- {
- return content;
- }
-
- public static abstract class Content
- {
- public abstract WindowContent render(WindowNode window, PresentationClient client, PortletInvoker portletInvoker) throws PresentationServerException;
-
- public abstract String getType();
-
- }
-}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/NodeImporter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/NodeImporter.java 2008-06-07 21:20:31 UTC (rev 10941)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/NodeImporter.java 2008-06-07 21:22:25 UTC (rev 10942)
@@ -1,302 +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.portal.model.object;
-
-import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.common.xml.XMLTools;
-import org.jboss.portal.common.NotYetImplemented;
-import static org.jboss.portal.common.xml.XMLTools.*;
-import org.jboss.portal.presentation.portal.content.markup.MarkupContent;
-import org.jboss.portal.presentation.portal.content.portlet.PortletContent;
-import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
-import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
-import org.jboss.portal.presentation.portal.model.layout.StructureElement;
-import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
-import org.jboss.portal.presentation.model.layout.Constants;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.net.URL;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class NodeImporter
-{
-
- /** . */
- private final static Schema schema;
-
- /** . */
- private static final URL schemaURL;
-
- static
- {
- try
- {
- schemaURL = NodeImporter.class.getClassLoader().getResource("org/jboss/portal/presentation/portal/page_structure_1_0.xsd");
- SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- schema = factory.newSchema(schemaURL);
- }
- catch (SAXException e)
- {
- throw new Error("Could not load the page structure 1.0 schema", e);
- }
-
- }
-
- /** The root to import the children to. */
- private final PortalNode root;
-
- /** . */
- private final LayoutStore layoutStore;
-
- public NodeImporter(PortalNode root, LayoutStore layoutStore)
- {
- this.root = root;
- this.layoutStore = layoutStore;
- }
-
- /**
- * Imports the specified document.
- *
- * @param document the document
- * @throws IllegalArgumentException if the document is null
- */
- public void importDocument(Document document) throws IllegalArgumentException
- {
- if (document == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- importContextDef(document.getDocumentElement());
- }
-
- public void importDocument(InputStream in) throws IllegalArgumentException, ParserConfigurationException, IOException, SAXException
- {
- if (in == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- InputStream schemaStream = schemaURL.openStream();
-
- try
- {
- DocumentBuilderFactory factory = XMLTools.getDocumentBuilderFactory();
- factory.setValidating(true);
- factory.setNamespaceAware(true);
- factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
- factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaStream);
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.parse(in);
- importDocument(doc);
- }
- finally
- {
- IOTools.safeClose(schemaStream);
- }
- }
-
- private void importContextDef(org.w3c.dom.Element contextDefElt)
- {
- // Children pages
- for (org.w3c.dom.Element childElt : getChildren(contextDefElt, "page-def"))
- {
- importPageDef(root, childElt);
- }
- }
-
- private PageNode importPageDef(PortalNode parentNode, org.w3c.dom.Element pageDefElt)
- {
- PageNode page = createStructuralNode(parentNode, PageNode.class, pageDefElt);
-
- // Sub pages
- for (org.w3c.dom.Element childElt : getChildren(pageDefElt, "page-def"))
- {
- importPageDef(page, childElt);
- }
-
- //
- Element element = getUniqueChild(pageDefElt, "simple-layout", false);
-
- //
- if (element != null)
- {
- importLayout(page, element);
- }
-
- //
- return page;
- }
-
- private void importLayout(PageNode page, Element element)
- {
- LayoutStructure pageStructure = layoutStore.createStructure(page.getId());
-
- //
- page.setLayoutStructureId(pageStructure.getId());
-
- //
- importLayout(page, pageStructure, element);
- }
-
- private void importLayout(PageNode page, LayoutStructure layout, Element element)
- {
- if ("simple-layout".equals(element.getNodeName()))
- {
- String orientation = "horizontal".equals(element.getAttribute("orientation")) ? Constants.HORIZONTAL_ORIENTATION : Constants.VERTICAL_ORIENTATION;
-
- //
- layout.setProperty(Constants.LAYOUT_ID, Constants.SIMPLE_LAYOUT);
- layout.setProperty(Constants.SIMPLE_LAYOUT_ORIENTATION, orientation);
-
- //
- int index = 0;
- for (org.w3c.dom.Element childElt : getChildren(element))
- {
- String childName = childElt.getNamespaceURI() == null ? childElt.getTagName() : childElt.getLocalName();
-
- //
- LayoutElement structureElement;
- if ("window-def".equals(childName))
- {
- WindowNode window = importWindowDef(page, childElt);
-
- //
- structureElement = layout.addObjectElement(window.getId());
- }
- else if ("simple-layout".equals(childName))
- {
- StructureElement nestedLayout = layout.addStructureElement();
-
- //
- importLayout(page, nestedLayout.getNestedStructure(), childElt);
-
- //
- structureElement = nestedLayout;
- }
- else
- {
- throw new NotYetImplemented();
- }
-
- //
- structureElement.setProperty(Constants.SIMPLE_LAYOUT_INDEX, index++);
- }
- }
- else
- {
- throw new NotYetImplemented();
- }
- }
-
- private WindowNode importWindowDef(PortalNode parentNode, org.w3c.dom.Element windowDefElt)
- {
- WindowNode windowNode = createStructuralNode(parentNode, WindowNode.class, windowDefElt);
-
- //
- WindowNode.Content content = null;
- org.w3c.dom.Element markupElt = getUniqueChild(windowDefElt, "markup", false);
- if (markupElt != null)
- {
- String markup = asString(markupElt);
- content = new MarkupContent(markup);
- }
- else
- {
- org.w3c.dom.Element portletElt = getUniqueChild(windowDefElt, "portlet", false);
- if (portletElt != null)
- {
- String portletRef = portletElt.getAttribute("ref");
- content = new PortletContent(portletRef);
- }
- }
-
- //
- windowNode.setContent(content);
-
- //
- return windowNode;
- }
-
- private <T extends PortalNode> T createStructuralNode(PortalNode parent, Class<T> type, org.w3c.dom.Element nodeDefElt)
- {
- String nodeName = nodeDefElt.getAttribute("name");
-
- //
- T node = parent.addChild(nodeName, type);
-
- //
- org.w3c.dom.Element propertiesElt = XMLTools.getUniqueChild(nodeDefElt, "properties", false);
-
- //
- if (propertiesElt != null)
- {
- for (org.w3c.dom.Element propertyElt : XMLTools.getChildren(propertiesElt, "property"))
- {
- org.w3c.dom.Element nameElt = XMLTools.getUniqueChild(propertyElt, "name", true);
- String propertyName = XMLTools.asString(nameElt);
-
- //
- org.w3c.dom.Element valueElt = XMLTools.getUniqueChild(propertyElt, "value", true);
- String litteralPropertyValue = XMLTools.asString(valueElt);
-
- Serializable propertyValue;
- String propertyType = valueElt.getAttribute("type");
- if (propertyType == null || "string".equals(propertyType))
- {
- propertyValue = litteralPropertyValue;
- }
- else if ("int".equals(propertyType))
- {
- propertyValue = Integer.parseInt(litteralPropertyValue);
- }
- else
- {
- throw new AssertionError();
- }
-
- //
- node.setProperty(propertyName, propertyValue);
- }
- }
-
- //
- return node;
- }
-}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java 2008-06-07 21:20:31 UTC (rev 10941)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java 2008-06-07 21:22:25 UTC (rev 10942)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.portal.servlet;
import org.jboss.portal.presentation.portal.model.object.PortalNodeManager;
-import org.jboss.portal.presentation.portal.model.object.NodeImporter;
+import org.jboss.portal.presentation.portal.model.ModelImporter;
import org.jboss.portal.presentation.portal.model.object.ContextNode;
import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
import org.jboss.portal.common.io.IOTools;
@@ -85,7 +85,7 @@
try
{
ContextNode root = portalNodeManager.getRoot();
- new NodeImporter(root, layoutStore).importDocument(in);
+ new ModelImporter(root, layoutStore).importDocument(in);
}
finally
{
17 years, 11 months
JBoss Portal SVN: r10941 - in modules/presentation/trunk/portal/src: main/java/org/jboss/portal/presentation/portal and 9 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-07 17:20:31 -0400 (Sat, 07 Jun 2008)
New Revision: 10941
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/ContextNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/NodeImporter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PageNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeAdapter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeManager.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeState.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/WindowNode.java
Modified:
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandler.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContentHandler.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContent.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletControllerContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationInstanceContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationWindowContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java
Log:
move portal node to a nested package
Modified: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-07 21:03:17 UTC (rev 10940)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-07 21:20:31 UTC (rev 10941)
@@ -131,11 +131,11 @@
</constructor>
</bean>
- <bean name="PortalNodeManager" class="org.jboss.portal.presentation.portal.model.PortalNodeManager"/>
+ <bean name="PortalNodeManager" class="org.jboss.portal.presentation.portal.model.object.PortalNodeManager"/>
<bean name="LayoutStore" class="org.jboss.portal.presentation.portal.model.layout.LayoutStore"/>
- <bean name="PortalNodeAdapter" class="org.jboss.portal.presentation.portal.model.PortalNodeAdapter">
+ <bean name="PortalNodeAdapter" class="org.jboss.portal.presentation.portal.model.object.PortalNodeAdapter">
<constructor>
<parameter><inject bean="PortalNodeManager"/></parameter>
<parameter><inject bean="LayoutStore"/></parameter>
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-07 21:03:17 UTC (rev 10940)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -23,10 +23,10 @@
package org.jboss.portal.presentation.portal;
import org.jboss.portal.presentation.client.PresentationClient;
-import org.jboss.portal.presentation.portal.model.PortalNode;
-import org.jboss.portal.presentation.portal.model.WindowNode;
-import org.jboss.portal.presentation.portal.model.PageNode;
-import org.jboss.portal.presentation.portal.model.PortalNodeManager;
+import org.jboss.portal.presentation.portal.model.object.PortalNode;
+import org.jboss.portal.presentation.portal.model.object.WindowNode;
+import org.jboss.portal.presentation.portal.model.object.PageNode;
+import org.jboss.portal.presentation.portal.model.object.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.layout.ObjectElement;
import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandler.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandler.java 2008-06-07 21:03:17 UTC (rev 10940)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandler.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -23,11 +23,10 @@
package org.jboss.portal.presentation.portal.content;
import org.jboss.portal.presentation.model.content.WindowContent;
-import org.jboss.portal.presentation.portal.model.WindowNode;
+import org.jboss.portal.presentation.portal.model.object.WindowNode;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.server.PresentationServerException;
-import org.jboss.portal.presentation.protocol.ProtocolAction;
import org.jboss.portal.presentation.protocol.ProtocolResponse;
/**
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java 2008-06-07 21:03:17 UTC (rev 10940)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContent.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.portal.content.markup;
-import org.jboss.portal.presentation.portal.model.WindowNode;
+import org.jboss.portal.presentation.portal.model.object.WindowNode;
import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.server.PresentationServerException;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContentHandler.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContentHandler.java 2008-06-07 21:03:17 UTC (rev 10940)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContentHandler.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -24,7 +24,7 @@
import org.jboss.portal.presentation.portal.content.ContentHandler;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
-import org.jboss.portal.presentation.portal.model.WindowNode;
+import org.jboss.portal.presentation.portal.model.object.WindowNode;
import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.server.PresentationServerException;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContent.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContent.java 2008-06-07 21:03:17 UTC (rev 10940)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContent.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -22,13 +22,12 @@
******************************************************************************/
package org.jboss.portal.presentation.portal.content.portlet;
-import org.jboss.portal.presentation.portal.model.WindowNode;
-import org.jboss.portal.presentation.portal.model.PageNode;
+import org.jboss.portal.presentation.portal.model.object.WindowNode;
+import org.jboss.portal.presentation.portal.model.object.PageNode;
import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletControllerContext;
import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletPageNavigationalState;
import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.presentation.client.PresentationClient;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.presentation.server.PresentationServerException;
import org.jboss.portal.portlet.controller.PortletController;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java 2008-06-07 21:03:17 UTC (rev 10940)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -27,8 +27,8 @@
import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletControllerContext;
import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletPageNavigationalState;
import org.jboss.portal.presentation.portal.content.portlet.protocol.PortletContainerAction;
-import org.jboss.portal.presentation.portal.model.WindowNode;
-import org.jboss.portal.presentation.portal.model.PageNode;
+import org.jboss.portal.presentation.portal.model.object.WindowNode;
+import org.jboss.portal.presentation.portal.model.object.PageNode;
import org.jboss.portal.presentation.model.content.WindowContent;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.server.PresentationServerException;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletControllerContext.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletControllerContext.java 2008-06-07 21:03:17 UTC (rev 10940)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletControllerContext.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -48,9 +48,9 @@
import org.jboss.portal.presentation.portal.content.portlet.spi.PresentationPortalContext;
import org.jboss.portal.presentation.portal.content.portlet.spi.PresentationSecurityContext;
import org.jboss.portal.presentation.portal.content.portlet.PortletContent;
-import org.jboss.portal.presentation.portal.model.PageNode;
-import org.jboss.portal.presentation.portal.model.PortalNode;
-import org.jboss.portal.presentation.portal.model.WindowNode;
+import org.jboss.portal.presentation.portal.model.object.PageNode;
+import org.jboss.portal.presentation.portal.model.object.PortalNode;
+import org.jboss.portal.presentation.portal.model.object.WindowNode;
import org.jboss.portal.presentation.client.PresentationClient;
import javax.servlet.http.Cookie;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationInstanceContext.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationInstanceContext.java 2008-06-07 21:03:17 UTC (rev 10940)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationInstanceContext.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -25,7 +25,7 @@
import org.jboss.portal.portlet.StateEvent;
import org.jboss.portal.portlet.spi.InstanceContext;
import org.jboss.portal.portlet.state.AccessMode;
-import org.jboss.portal.presentation.portal.model.WindowNode;
+import org.jboss.portal.presentation.portal.model.object.WindowNode;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationWindowContext.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationWindowContext.java 2008-06-07 21:03:17 UTC (rev 10940)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationWindowContext.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.portal.content.portlet.spi;
import org.jboss.portal.portlet.spi.WindowContext;
-import org.jboss.portal.presentation.portal.model.WindowNode;
+import org.jboss.portal.presentation.portal.model.object.WindowNode;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/ContextNode.java (from rev 10911, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ContextNode.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/ContextNode.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/ContextNode.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * 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.portal.model.object;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIContext;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContextNode extends PortalNode
+{
+ public ContextNode(String name, PortalNodeManager structuralStateContext)
+ {
+ super(name, structuralStateContext);
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return UIContext.class;
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/NodeImporter.java (from rev 10940, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/NodeImporter.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/NodeImporter.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -0,0 +1,302 @@
+/******************************************************************************
+ * 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.portal.model.object;
+
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.xml.XMLTools;
+import org.jboss.portal.common.NotYetImplemented;
+import static org.jboss.portal.common.xml.XMLTools.*;
+import org.jboss.portal.presentation.portal.content.markup.MarkupContent;
+import org.jboss.portal.presentation.portal.content.portlet.PortletContent;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
+import org.jboss.portal.presentation.portal.model.layout.StructureElement;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
+import org.jboss.portal.presentation.model.layout.Constants;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class NodeImporter
+{
+
+ /** . */
+ private final static Schema schema;
+
+ /** . */
+ private static final URL schemaURL;
+
+ static
+ {
+ try
+ {
+ schemaURL = NodeImporter.class.getClassLoader().getResource("org/jboss/portal/presentation/portal/page_structure_1_0.xsd");
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ schema = factory.newSchema(schemaURL);
+ }
+ catch (SAXException e)
+ {
+ throw new Error("Could not load the page structure 1.0 schema", e);
+ }
+
+ }
+
+ /** The root to import the children to. */
+ private final PortalNode root;
+
+ /** . */
+ private final LayoutStore layoutStore;
+
+ public NodeImporter(PortalNode root, LayoutStore layoutStore)
+ {
+ this.root = root;
+ this.layoutStore = layoutStore;
+ }
+
+ /**
+ * Imports the specified document.
+ *
+ * @param document the document
+ * @throws IllegalArgumentException if the document is null
+ */
+ public void importDocument(Document document) throws IllegalArgumentException
+ {
+ if (document == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ importContextDef(document.getDocumentElement());
+ }
+
+ public void importDocument(InputStream in) throws IllegalArgumentException, ParserConfigurationException, IOException, SAXException
+ {
+ if (in == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ InputStream schemaStream = schemaURL.openStream();
+
+ try
+ {
+ DocumentBuilderFactory factory = XMLTools.getDocumentBuilderFactory();
+ factory.setValidating(true);
+ factory.setNamespaceAware(true);
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaStream);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.parse(in);
+ importDocument(doc);
+ }
+ finally
+ {
+ IOTools.safeClose(schemaStream);
+ }
+ }
+
+ private void importContextDef(org.w3c.dom.Element contextDefElt)
+ {
+ // Children pages
+ for (org.w3c.dom.Element childElt : getChildren(contextDefElt, "page-def"))
+ {
+ importPageDef(root, childElt);
+ }
+ }
+
+ private PageNode importPageDef(PortalNode parentNode, org.w3c.dom.Element pageDefElt)
+ {
+ PageNode page = createStructuralNode(parentNode, PageNode.class, pageDefElt);
+
+ // Sub pages
+ for (org.w3c.dom.Element childElt : getChildren(pageDefElt, "page-def"))
+ {
+ importPageDef(page, childElt);
+ }
+
+ //
+ Element element = getUniqueChild(pageDefElt, "simple-layout", false);
+
+ //
+ if (element != null)
+ {
+ importLayout(page, element);
+ }
+
+ //
+ return page;
+ }
+
+ private void importLayout(PageNode page, Element element)
+ {
+ LayoutStructure pageStructure = layoutStore.createStructure(page.getId());
+
+ //
+ page.setLayoutStructureId(pageStructure.getId());
+
+ //
+ importLayout(page, pageStructure, element);
+ }
+
+ private void importLayout(PageNode page, LayoutStructure layout, Element element)
+ {
+ if ("simple-layout".equals(element.getNodeName()))
+ {
+ String orientation = "horizontal".equals(element.getAttribute("orientation")) ? Constants.HORIZONTAL_ORIENTATION : Constants.VERTICAL_ORIENTATION;
+
+ //
+ layout.setProperty(Constants.LAYOUT_ID, Constants.SIMPLE_LAYOUT);
+ layout.setProperty(Constants.SIMPLE_LAYOUT_ORIENTATION, orientation);
+
+ //
+ int index = 0;
+ for (org.w3c.dom.Element childElt : getChildren(element))
+ {
+ String childName = childElt.getNamespaceURI() == null ? childElt.getTagName() : childElt.getLocalName();
+
+ //
+ LayoutElement structureElement;
+ if ("window-def".equals(childName))
+ {
+ WindowNode window = importWindowDef(page, childElt);
+
+ //
+ structureElement = layout.addObjectElement(window.getId());
+ }
+ else if ("simple-layout".equals(childName))
+ {
+ StructureElement nestedLayout = layout.addStructureElement();
+
+ //
+ importLayout(page, nestedLayout.getNestedStructure(), childElt);
+
+ //
+ structureElement = nestedLayout;
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+
+ //
+ structureElement.setProperty(Constants.SIMPLE_LAYOUT_INDEX, index++);
+ }
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ private WindowNode importWindowDef(PortalNode parentNode, org.w3c.dom.Element windowDefElt)
+ {
+ WindowNode windowNode = createStructuralNode(parentNode, WindowNode.class, windowDefElt);
+
+ //
+ WindowNode.Content content = null;
+ org.w3c.dom.Element markupElt = getUniqueChild(windowDefElt, "markup", false);
+ if (markupElt != null)
+ {
+ String markup = asString(markupElt);
+ content = new MarkupContent(markup);
+ }
+ else
+ {
+ org.w3c.dom.Element portletElt = getUniqueChild(windowDefElt, "portlet", false);
+ if (portletElt != null)
+ {
+ String portletRef = portletElt.getAttribute("ref");
+ content = new PortletContent(portletRef);
+ }
+ }
+
+ //
+ windowNode.setContent(content);
+
+ //
+ return windowNode;
+ }
+
+ private <T extends PortalNode> T createStructuralNode(PortalNode parent, Class<T> type, org.w3c.dom.Element nodeDefElt)
+ {
+ String nodeName = nodeDefElt.getAttribute("name");
+
+ //
+ T node = parent.addChild(nodeName, type);
+
+ //
+ org.w3c.dom.Element propertiesElt = XMLTools.getUniqueChild(nodeDefElt, "properties", false);
+
+ //
+ if (propertiesElt != null)
+ {
+ for (org.w3c.dom.Element propertyElt : XMLTools.getChildren(propertiesElt, "property"))
+ {
+ org.w3c.dom.Element nameElt = XMLTools.getUniqueChild(propertyElt, "name", true);
+ String propertyName = XMLTools.asString(nameElt);
+
+ //
+ org.w3c.dom.Element valueElt = XMLTools.getUniqueChild(propertyElt, "value", true);
+ String litteralPropertyValue = XMLTools.asString(valueElt);
+
+ Serializable propertyValue;
+ String propertyType = valueElt.getAttribute("type");
+ if (propertyType == null || "string".equals(propertyType))
+ {
+ propertyValue = litteralPropertyValue;
+ }
+ else if ("int".equals(propertyType))
+ {
+ propertyValue = Integer.parseInt(litteralPropertyValue);
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+
+ //
+ node.setProperty(propertyName, propertyValue);
+ }
+ }
+
+ //
+ return node;
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PageNode.java (from rev 10940, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PageNode.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PageNode.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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.portal.model.object;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIPage;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageNode extends PortalNode
+{
+
+ /** . */
+ private String layoutStructureId;
+
+ public PageNode(String name, PortalNodeManager structuralStateContext)
+ {
+ super(name, structuralStateContext);
+ }
+
+ public String getLayoutStructureId()
+ {
+ return layoutStructureId;
+ }
+
+ public void setLayoutStructureId(String layoutStructureId)
+ {
+ this.layoutStructureId = layoutStructureId;
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return UIPage.class;
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNode.java (from rev 10940, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNode.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNode.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -0,0 +1,244 @@
+/******************************************************************************
+ * 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.portal.model.object;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class PortalNode
+{
+
+ /** . */
+ private PortalNode parent;
+
+ /** . */
+ final Map<String, PortalNode> children = new HashMap<String, PortalNode>();
+
+ /** . */
+ private final PortalNodeManager structuralStateContext;
+
+ /** . */
+ final String id;
+
+ /** . */
+ private boolean valid;
+
+ /** . */
+ final String name;
+
+ /** . */
+ final Map<String, Serializable> properties;
+
+ /** . */
+ final Map<String, Serializable> immutableProperties;
+
+ protected PortalNode(String name, PortalNodeManager structuralStateContext)
+ {
+ this.name = name;
+ this.id = structuralStateContext.nextId();
+ this.structuralStateContext = structuralStateContext;
+ this.properties = new HashMap<String, Serializable>();
+ this.valid = true;
+ this.immutableProperties = Collections.unmodifiableMap(properties);
+ }
+
+ public abstract Class<? extends UIObject> getType();
+
+ public boolean isValid()
+ {
+ return valid;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public PortalNode getParent()
+ {
+ return parent;
+ }
+
+ public Map<String, Serializable> getProperties()
+ {
+ return immutableProperties;
+ }
+
+ public Serializable getProperty(String propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("No null property name");
+ }
+
+ //
+ synchronized (this)
+ {
+ return properties.get(propertyName);
+ }
+ }
+
+ public void setProperty(String propertyName, Serializable propertyValue)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("No null property name");
+ }
+
+ //
+ synchronized (this)
+ {
+ if (propertyValue != null)
+ {
+ properties.put(propertyName, propertyValue);
+ }
+ else
+ {
+ properties.remove(propertyName);
+ }
+ }
+ }
+
+ public Collection<? extends PortalNode> getChildren()
+ {
+ return Collections.unmodifiableCollection(children.values());
+ }
+
+ public <T extends PortalNode> T addChild(String name, Class<T> type)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (type == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ T child;
+ try
+ {
+ Constructor<T> ctor = type.getConstructor(String.class, PortalNodeManager.class);
+ child = ctor.newInstance(name, structuralStateContext);
+ }
+ catch (InstantiationException e)
+ {
+ throw new AssertionError(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new AssertionError(e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new AssertionError(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new AssertionError(e);
+ }
+
+ //
+ synchronized (this)
+ {
+ if (children.containsKey(name))
+ {
+ throw new IllegalArgumentException("Child already exist");
+ }
+ children.put(name, child);
+ child.parent = this;
+ }
+
+ //
+ structuralStateContext.nodes.put(child.id, child);
+
+ //
+ return child;
+ }
+
+ public void destroyChild(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ PortalNode child;
+ synchronized (this)
+ {
+ if (!children.containsKey(name))
+ {
+ throw new IllegalArgumentException("No such child " + name);
+ }
+
+ child = children.get(name);
+
+ //
+ for (String blah : new ArrayList<String>(child.children.keySet()))
+ {
+ child.destroyChild(blah);
+ }
+
+ //
+ children.remove(name);
+ structuralStateContext.nodes.remove(child.id);
+
+ //
+ child.valid = false;
+ child.parent = null;
+ }
+ }
+
+ public PortalNode getChild(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ synchronized (this)
+ {
+ return children.get(name);
+ }
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeAdapter.java (from rev 10940, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeAdapter.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeAdapter.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -0,0 +1,284 @@
+/******************************************************************************
+ * 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.portal.model.object;
+
+import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
+import org.jboss.portal.presentation.portal.model.layout.StructureElement;
+import org.jboss.portal.presentation.portal.model.layout.NestedStructure;
+import org.jboss.portal.presentation.portal.model.layout.ObjectStructure;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
+import org.jboss.portal.presentation.portal.model.layout.LayoutObject;
+import org.jboss.portal.presentation.portal.model.layout.ObjectElement;
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIPane;
+import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.state.structural.StructuralState;
+import org.jboss.portal.common.NotYetImplemented;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalNodeAdapter implements StructuralAdapter<Object>
+{
+
+ /** . */
+ private PortalNodeManager nodeManager;
+
+ /** . */
+ private LayoutStore layoutStore;
+
+ public PortalNodeAdapter(PortalNodeManager nodeManager, LayoutStore layoutStore)
+ {
+ this.nodeManager = nodeManager;
+ this.layoutStore = layoutStore;
+ }
+
+ public String getRootId()
+ {
+ return "node." + nodeManager.getRoot().getId();
+ }
+
+ public Object getNode(String id)
+ {
+ if (id.startsWith("node."))
+ {
+ return nodeManager.getNode(id.substring(5));
+ }
+ else if (id.startsWith("structure."))
+ {
+ return layoutStore.getObject(id.substring(10));
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unrecognized id " + id);
+ }
+ }
+
+ public Object getParent(Object o)
+ {
+ if (o instanceof PortalNode)
+ {
+ return ((PortalNode)o).getParent();
+ }
+ else if (o instanceof LayoutElement)
+ {
+ LayoutStructure layout = ((LayoutElement)o).getStructure();
+
+ //
+ if (layout instanceof NestedStructure)
+ {
+ return ((NestedStructure)layout).getStructureElement();
+ }
+ else
+ {
+ ObjectStructure objectStructure = (ObjectStructure)layout;
+ String objectId = objectStructure.getObjectRef();
+ return nodeManager.getNode(objectId);
+ }
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public Collection<?> getChilren(Object o)
+ {
+ if (o instanceof PortalNode)
+ {
+ if (o instanceof PageNode)
+ {
+ String layoutStructureId = ((PageNode)o).getLayoutStructureId();
+
+ //
+ LayoutStructure layoutStructure = (LayoutStructure)layoutStore.getObject(layoutStructureId);
+
+ //
+ return layoutStructure.getElements();
+ }
+ else
+ {
+ return ((PortalNode)o).getChildren();
+ }
+ }
+ else if (o instanceof LayoutElement)
+ {
+ if (o instanceof StructureElement)
+ {
+ return ((StructureElement)o).getNestedStructure().getElements();
+ }
+ else
+ {
+ return Collections.emptyList();
+ }
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public String getId(Object o)
+ {
+ if (o instanceof PortalNode)
+ {
+ return "node." + ((PortalNode)o).getId();
+ }
+ else if (o instanceof LayoutObject)
+ {
+ return "structure." + ((LayoutObject)o).getId();
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public Class<? extends UIObject> getType(Object o)
+ {
+ if (o instanceof PortalNode)
+ {
+ return ((PortalNode)o).getType();
+ }
+ else if (o instanceof LayoutElement)
+ {
+ if (o instanceof StructureElement)
+ {
+ return UIPane.class;
+ }
+ else if (o instanceof ObjectElement)
+ {
+ return UIWindow.class;
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public String getName(Object o)
+ {
+ if (o instanceof PortalNode)
+ {
+ return ((PortalNode)o).getName();
+ }
+ else if (o instanceof LayoutObject)
+ {
+ // no natural name, for now use id
+ return ((LayoutObject)o).getId();
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public Map<String, Serializable> getProperties(Object o)
+ {
+ if (o instanceof PageNode)
+ {
+ PageNode page = (PageNode)o;
+
+ //
+ String layoutStructureId = ((PageNode)o).getLayoutStructureId();
+
+ //
+ LayoutStructure layoutStructure = (LayoutStructure)layoutStore.getObject(layoutStructureId);
+
+ //
+ Map<String, Serializable> properties = new HashMap<String, Serializable>(page.getProperties());
+
+ //
+ properties.putAll(layoutStructure.getState().getProperties());
+
+ //
+ return properties;
+ }
+ else if (o instanceof PortalNode)
+ {
+ return ((PortalNode)o).getProperties();
+ }
+ else if (o instanceof LayoutObject)
+ {
+ if (o instanceof ObjectElement)
+ {
+ ObjectElement element = (ObjectElement)o;
+
+ //
+ String windowId = element.getObjectRef();
+
+ //
+ WindowNode window = (WindowNode)nodeManager.getNode(windowId);
+
+ //
+ Map<String, Serializable> properties = new HashMap<String, Serializable>(window.getProperties());
+
+ //
+ properties.putAll(element.getState().getProperties());
+
+ //
+ return properties;
+ }
+ else
+ {
+ return ((LayoutObject)o).getState().getProperties();
+ }
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public StructuralState getState(Object o)
+ {
+ Class<? extends UIObject> type = getType(o);
+ String name = getName(o);
+ Map<String, Serializable> properties = getProperties(o);
+
+ //
+ return new PortalNodeState(type, name, properties);
+ }
+
+ public void lock(Object o)
+ {
+ }
+
+ public void unlock(Object o)
+ {
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeManager.java (from rev 10940, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeManager.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeManager.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * 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.portal.model.object;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalNodeManager
+{
+
+ /** . */
+ private final AtomicLong sequence = new AtomicLong();
+
+ /** . */
+ final ConcurrentMap<String, PortalNode> nodes = new ConcurrentHashMap<String, PortalNode>();
+
+ /** . */
+ private final ContextNode root = new ContextNode("", this);
+
+ public PortalNodeManager()
+ {
+ nodes.put(root.getId(), root);
+ }
+
+ String nextId()
+ {
+ return Long.toString(sequence.getAndIncrement());
+ }
+
+ public PortalNode getNode(String nodeId)
+ {
+ if (nodeId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ return nodes.get(nodeId);
+ }
+
+ public ContextNode getRoot()
+ {
+ return root;
+ }
+
+ public void destroy(String objectId)
+ {
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ PortalNode node = nodes.get(objectId);
+
+ //
+ PortalNode parent = node.getParent();
+
+ //
+ if (parent == null)
+ {
+ throw new IllegalArgumentException("Cannot destroy root");
+ }
+
+ //
+ parent.destroyChild(node.getName());
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeState.java (from rev 10911, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeState.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeState.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeState.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * 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.portal.model.object;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.state.structural.StructuralState;
+
+import java.util.Map;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalNodeState implements StructuralState
+{
+
+ /** . */
+ private final Class<? extends UIObject> type;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Map<String, Serializable> properties;
+
+ public PortalNodeState(
+ Class<? extends UIObject> type,
+ String name,
+ Map<String, Serializable> properties)
+ {
+ this.type = type;
+ this.name = name;
+ this.properties = properties;
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return type;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Map<String, Serializable> getProperties()
+ {
+ return properties;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof PortalNodeState)
+ {
+ PortalNodeState that = (PortalNodeState)obj;
+
+ //
+ if (!that.type.equals(this.type))
+ {
+ return false;
+ }
+
+ //
+ if (!that.name.equals(this.name))
+ {
+ return false;
+ }
+
+ //
+ return that.properties.equals(this.properties);
+ }
+ return false;
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/WindowNode.java (from rev 10940, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/WindowNode.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/WindowNode.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * 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.portal.model.object;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.server.PresentationServerException;
+import org.jboss.portal.portlet.PortletInvoker;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class WindowNode extends PortalNode
+{
+
+ /** . */
+ private Content content;
+
+ public WindowNode(String name, PortalNodeManager structuralStateContext)
+ {
+ super(name, structuralStateContext);
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return UIWindow.class;
+ }
+
+ public void setContent(Content content)
+ {
+ this.content = content;
+ }
+
+ public Content getContent()
+ {
+ return content;
+ }
+
+ public static abstract class Content
+ {
+ public abstract WindowContent render(WindowNode window, PresentationClient client, PortletInvoker portletInvoker) throws PresentationServerException;
+
+ public abstract String getType();
+
+ }
+}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java 2008-06-07 21:03:17 UTC (rev 10940)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -22,9 +22,9 @@
******************************************************************************/
package org.jboss.portal.presentation.portal.servlet;
-import org.jboss.portal.presentation.portal.model.PortalNodeManager;
-import org.jboss.portal.presentation.portal.model.NodeImporter;
-import org.jboss.portal.presentation.portal.model.ContextNode;
+import org.jboss.portal.presentation.portal.model.object.PortalNodeManager;
+import org.jboss.portal.presentation.portal.model.object.NodeImporter;
+import org.jboss.portal.presentation.portal.model.object.ContextNode;
import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
import org.jboss.portal.common.io.IOTools;
Modified: modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java
===================================================================
--- modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java 2008-06-07 21:03:17 UTC (rev 10940)
+++ modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java 2008-06-07 21:20:31 UTC (rev 10941)
@@ -31,6 +31,12 @@
import org.jboss.portal.presentation.portal.model.structural.StructuralStateContextImpl;
import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
+import org.jboss.portal.presentation.portal.model.object.ContextNode;
+import org.jboss.portal.presentation.portal.model.object.PageNode;
+import org.jboss.portal.presentation.portal.model.object.PortalNode;
+import org.jboss.portal.presentation.portal.model.object.PortalNodeAdapter;
+import org.jboss.portal.presentation.portal.model.object.PortalNodeManager;
+import org.jboss.portal.presentation.portal.model.object.WindowNode;
import java.util.ArrayList;
import java.util.List;
17 years, 11 months
JBoss Portal SVN: r10940 - in modules/presentation/trunk: portal/src/main/artifacts/presentation-portal-war/WEB-INF and 8 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-07 17:03:17 -0400 (Sat, 07 Jun 2008)
New Revision: 10940
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObject.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObjectContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutState.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectElement.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectStructure.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java
Removed:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PaneNode.java
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java
modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/page_structure_1_0.xsd
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/DefaultPageViewPortScope.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java
Log:
start to implement layout in the back end as a detached structure from the portal nodes
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-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -41,10 +41,12 @@
import org.jboss.portal.presentation.model.layout.LayoutFactory;
import org.jboss.portal.presentation.model.layout.Layout;
import org.jboss.portal.presentation.model.layout.SimpleLayout;
+import org.jboss.portal.presentation.model.layout.Orientation;
import org.jboss.portal.presentation.model.content.WindowContent;
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.UIPane;
import org.jboss.portal.presentation.protocol.ProtocolAction;
import org.jboss.portal.presentation.protocol.ProtocolResponse;
import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
@@ -250,7 +252,9 @@
PrintWriter writer = resp.getWriter();
//
- writer.print("<html><body>");
+ writer.print("<html><head>");
+
+ writer.print("</head><body>");
renderNode(node, writer);
writer.print("</body></html>");
}
@@ -267,38 +271,22 @@
{
renderChildren(node, writer);
}
- else if (object instanceof UIPage)
+ else if (object instanceof UIPane)
{
if (node.getChildren() != null)
{
- LayoutFactory layoutFactory = new LayoutFactory();
-
- //
- Layout layout = layoutFactory.getLayout(node);
-
- //
- if (layout instanceof SimpleLayout)
- {
- writer.print("<div>");
-
- //
- renderChildren(node, writer);
-
- //
- writer.print("</div>");
- }
- else
- {
- throw new NotYetImplemented();
- }
+ renderPane(node, writer);
}
else
{
- ViewUIObjectAction viewPage = new ViewUIObjectAction(object.getId());
+ if (object instanceof UIPage)
+ {
+ ViewUIObjectAction viewPage = new ViewUIObjectAction(object.getId());
- String url = encoder.encode(viewPage, encoderContext);
+ String url = encoder.encode(viewPage, encoderContext);
- writer.print("<div>Link to page <a href=\"" + url + "\">" + object.getName() + "</a></div>");
+ writer.print("<div>Link to page <a href=\"" + url + "\">" + object.getName() + "</a></div>");
+ }
}
}
else if (object instanceof UIWindow)
@@ -308,12 +296,14 @@
WindowContent content = server.renderWindow(this, object.getId());
//
+ writer.print("<li class=\"element\">");
writer.print("<div>");
writer.print("Window " + object.getName());
writer.print("</div>");
writer.print("<div>");
writer.print(content.getMarkup());
writer.print("</div>");
+ writer.print("</li>");
}
catch (PresentationServerException e)
{
@@ -325,6 +315,70 @@
writer.println("</div>");
}
+ private void renderPane(ClassicUINode node, PrintWriter writer)
+ {
+ LayoutFactory layoutFactory = new LayoutFactory();
+
+ //
+ Layout layout = layoutFactory.getLayout(node);
+
+ //
+ if (layout instanceof SimpleLayout)
+ {
+ //
+ SimpleLayout simpleLayout = (SimpleLayout)layout;
+
+
+ //
+ Orientation orientation = simpleLayout.getOrientation();
+
+ //
+ writer.print("<table>");
+
+ //
+ if (orientation == Orientation.HORIZONTAL)
+ {
+ writer.print("<tr>");
+ }
+
+ //
+ Collection<ClassicUINode> children = node.getChildren();
+
+ //
+ if (children != null)
+ {
+ for (ClassicUINode child : children)
+ {
+ if (orientation == Orientation.HORIZONTAL)
+ {
+ writer.print("<td>");
+ renderNode(child, writer);
+ writer.print("</td>");
+ }
+ else
+ {
+ writer.print("<tr><td>");
+ renderNode(child, writer);
+ writer.print("</td></tr>");
+ }
+ }
+ }
+
+ //
+ if (orientation == Orientation.HORIZONTAL)
+ {
+ writer.print("</tr>");
+ }
+
+ //
+ writer.print("</table>");
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
private void renderChildren(ClassicUINode node, PrintWriter writer)
{
Collection<ClassicUINode> children = node.getChildren();
Modified: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-07 21:03:17 UTC (rev 10940)
@@ -131,15 +131,33 @@
</constructor>
</bean>
- <bean name="StructuralStateContext" class="org.jboss.portal.presentation.portal.model.PortalNodeManager"/>
+ <bean name="PortalNodeManager" class="org.jboss.portal.presentation.portal.model.PortalNodeManager"/>
+ <bean name="LayoutStore" class="org.jboss.portal.presentation.portal.model.layout.LayoutStore"/>
+
+ <bean name="PortalNodeAdapter" class="org.jboss.portal.presentation.portal.model.PortalNodeAdapter">
+ <constructor>
+ <parameter><inject bean="PortalNodeManager"/></parameter>
+ <parameter><inject bean="LayoutStore"/></parameter>
+ </constructor>
+ </bean>
+
+ <bean name="StructuralStateContext" class="org.jboss.portal.presentation.portal.model.structural.StructuralStateContextImpl">
+ <constructor>
+ <parameter><inject bean="PortalNodeAdapter"/></parameter>
+ </constructor>
+ </bean>
+
<bean name="StructuralStateContextImporter" class="org.jboss.portal.presentation.portal.servlet.StructuralStateContextImporter">
<property name="servletContext"><inject bean="ServletContext"/></property>
- <property name="structuralStateContext"><inject bean="StructuralStateContext"/></property>
+ <property name="portalNodeManager"><inject bean="PortalNodeManager"/></property>
+ <property name="layoutStore"><inject bean="LayoutStore"/></property>
</bean>
<bean name="PresentationServer" class="org.jboss.portal.presentation.portal.PresentationServerImpl">
<constructor>
+ <parameter><inject bean="PortalNodeManager"/></parameter>
+ <parameter><inject bean="PortalNodeAdapter"/></parameter>
<parameter><inject bean="StructuralStateContext"/></parameter>
<parameter><inject bean="ContentHandlerRegistry"/></parameter>
</constructor>
Modified: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml 2008-06-07 21:03:17 UTC (rev 10940)
@@ -11,7 +11,15 @@
<window-def name="windowB">
<portlet ref="/portal-server.Cart"/>
</window-def>
- </simple-layout>
+ <simple-layout orientation="horizontal">
+ <window-def name="windowC">
+ <markup>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque odio nisl, faucibus id, placerat et, pulvinar at, nisi. Vivamus mollis pharetra risus. Mauris vitae massa vel augue congue eleifend. Morbi pede pede, adipiscing nec, scelerisque nec, ullamcorper sed, libero. Mauris iaculis lorem sit amet eros. Proin viverra eros. Morbi sit amet libero. Donec nec turpis et nunc consectetuer auctor. Fusce et metus. Sed commodo condimentum libero. Sed mollis tellus id justo. Nulla condimentum, libero ultricies accumsan pellentesque, nibh pede egestas quam, vitae varius nisi arcu ac urna. Phasellus interdum, odio vitae eleifend suscipit, nibh massa laoreet lorem, id mollis justo nisl non nunc. Sed enim enim, rutrum a, scelerisque eget, laoreet non, ante. Aenean molestie ipsum in nisi.</markup>
+ </window-def>
+ <window-def name="windowD">
+ <markup>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque odio nisl, faucibus id, placerat et, pulvinar at, nisi. Vivamus mollis pharetra risus. Mauris vitae massa vel augue congue eleifend. Morbi pede pede, adipiscing nec, scelerisque nec, ullamcorper sed, libero. Mauris iaculis lorem sit amet eros. Proin viverra eros. Morbi sit amet libero. Donec nec turpis et nunc consectetuer auctor. Fusce et metus. Sed commodo condimentum libero. Sed mollis tellus id justo. Nulla condimentum, libero ultricies accumsan pellentesque, nibh pede egestas quam, vitae varius nisi arcu ac urna. Phasellus interdum, odio vitae eleifend suscipit, nibh massa laoreet lorem, id mollis justo nisl non nunc. Sed enim enim, rutrum a, scelerisque eget, laoreet non, ante. Aenean molestie ipsum in nisi.</markup>
+ </window-def>
+ </simple-layout>
+ </simple-layout>
<page-def name="child-page-default-1">
<simple-layout>
<window-def name="windowA">
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -24,9 +24,11 @@
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.portal.model.PortalNode;
-import org.jboss.portal.presentation.portal.model.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.WindowNode;
import org.jboss.portal.presentation.portal.model.PageNode;
+import org.jboss.portal.presentation.portal.model.PortalNodeManager;
+import org.jboss.portal.presentation.portal.model.layout.ObjectElement;
+import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
import org.jboss.portal.presentation.portal.content.ContentHandlerRegistry;
import org.jboss.portal.presentation.portal.content.ContentHandler;
@@ -53,26 +55,40 @@
{
/** . */
- private PortalNodeManager structuralStateContext;
+ private PortalNodeManager portalNodeManager;
/** . */
+ private StructuralAdapter structuralAdapter;
+
+ /** . */
+ private StructuralStateContext structuralStateContext;
+
+ /** . */
private ContentHandlerRegistry contentHandlerRegistry;
- public PresentationServerImpl(PortalNodeManager structuralStateContext, ContentHandlerRegistry contentHandlerRegistry)
+ public PresentationServerImpl(
+ PortalNodeManager portalNodeManager,
+ StructuralAdapter structuralAdapter,
+ StructuralStateContext structuralStateContext,
+ ContentHandlerRegistry contentHandlerRegistry)
{
+ this.portalNodeManager = portalNodeManager;
+ this.structuralAdapter = structuralAdapter;
this.structuralStateContext = structuralStateContext;
this.contentHandlerRegistry = contentHandlerRegistry;
}
public StructuralStateContext getStructuralStateContext()
{
- return structuralStateContext.getStructuralStateContext();
+ return structuralStateContext;
}
public WindowContent renderWindow(PresentationClient client, String windowId) throws PresentationServerException
{
- WindowNode window = (WindowNode)structuralStateContext.getNode(windowId);
+ ObjectElement element = (ObjectElement)structuralAdapter.getNode(windowId);
+ WindowNode window = (WindowNode)portalNodeManager.getNode(element.getObjectRef());
+
WindowNode.Content content = window.getContent();
String contentType = content.getType();
@@ -94,7 +110,7 @@
String targetId = objectAction.getTargetId();
//
- PortalNode targetNode = structuralStateContext.getNode(targetId);
+ PortalNode targetNode = (PortalNode)structuralAdapter.getNode(targetId);
//
if (targetNode == null)
@@ -133,7 +149,7 @@
//
if (response == null)
{
- PageNode page = window.getPage();
+ PageNode page = (PageNode)window.getParent();
//
response = new ShowUIObjectResponse(page.getId());
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -72,7 +72,7 @@
PortletContainerAction pcAction = (PortletContainerAction)action;
//
- PageNode page = window.getPage();
+ PageNode page = (PageNode)window.getParent();
//
PresentationPortletControllerContext portletControllerContext = new PresentationPortletControllerContext(
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -26,9 +26,14 @@
import org.jboss.portal.common.xml.XMLTools;
import org.jboss.portal.common.NotYetImplemented;
import static org.jboss.portal.common.xml.XMLTools.*;
-import org.jboss.portal.presentation.model.layout.Constants;
import org.jboss.portal.presentation.portal.content.markup.MarkupContent;
import org.jboss.portal.presentation.portal.content.portlet.PortletContent;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
+import org.jboss.portal.presentation.portal.model.layout.StructureElement;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
+import org.jboss.portal.presentation.model.layout.Constants;
+import org.jboss.portal.presentation.model.layout.Orientation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
@@ -75,9 +80,13 @@
/** The root to import the children to. */
private final PortalNode root;
- public NodeImporter(PortalNode root)
+ /** . */
+ private final LayoutStore layoutStore;
+
+ public NodeImporter(PortalNode root, LayoutStore layoutStore)
{
this.root = root;
+ this.layoutStore = layoutStore;
}
/**
@@ -124,53 +133,91 @@
}
}
- private void importContextDef(Element contextDefElt)
+ private void importContextDef(org.w3c.dom.Element contextDefElt)
{
// Children pages
- for (Element childElt : getChildren(contextDefElt, "page-def"))
+ for (org.w3c.dom.Element childElt : getChildren(contextDefElt, "page-def"))
{
importPageDef(root, childElt);
}
}
- private PageNode importPageDef(PortalNode parentNode, Element pageDefElt)
+ private PageNode importPageDef(PortalNode parentNode, org.w3c.dom.Element pageDefElt)
{
- PageNode pageNode = createStructuralNode(parentNode, PageNode.class, pageDefElt);
+ PageNode page = createStructuralNode(parentNode, PageNode.class, pageDefElt);
// Sub pages
- for (Element childElt : getChildren(pageDefElt, "page-def"))
+ for (org.w3c.dom.Element childElt : getChildren(pageDefElt, "page-def"))
{
- importPageDef(pageNode, childElt);
+ importPageDef(page, childElt);
}
//
- Element layoutElt = getUniqueChild(pageDefElt, "simple-layout", false);
+ Element element = getUniqueChild(pageDefElt, "simple-layout", false);
//
- if (layoutElt != null)
+ if (element != null)
{
- importLayout(pageNode, layoutElt);
+ importLayout(page, element);
}
//
- return pageNode;
+ return page;
}
- private void importLayout(PortalNode paneNode, Element layoutElt)
+ private void importLayout(PageNode page, Element element)
{
- if ("simple-layout".equals(layoutElt.getNodeName()))
+ LayoutStructure pageStructure = layoutStore.createStructure(page.getId());
+
+ //
+ page.setLayoutStructureId(pageStructure.getId());
+
+ //
+ importLayout(page, pageStructure, element);
+ }
+
+ private void importLayout(PageNode page, LayoutStructure layout, Element element)
+ {
+ if ("simple-layout".equals(element.getNodeName()))
{
- paneNode.setProperty(Constants.LAYOUT_ID, Constants.SIMPLE_LAYOUT);
- paneNode.setProperty(Constants.SIMPLE_LAYOUT_ORIENTATION, Constants.VERTICAL_ORIENTATION);
+ String orientation = "horizontal".equals(element.getAttribute("orientation")) ? Constants.HORIZONTAL_ORIENTATION : Constants.VERTICAL_ORIENTATION;
//
+ layout.setProperty(Constants.LAYOUT_ID, Constants.SIMPLE_LAYOUT);
+ layout.setProperty(Constants.SIMPLE_LAYOUT_ORIENTATION, orientation);
+
+ //
int index = 0;
- for (Element childElt : getChildren(layoutElt, "window-def"))
+ for (org.w3c.dom.Element childElt : getChildren(element))
{
- WindowNode windowNode = importWindowDef(paneNode, childElt);
+ String childName = childElt.getNamespaceURI() == null ? childElt.getTagName() : childElt.getLocalName();
//
- windowNode.setProperty(Constants.SIMPLE_LAYOUT_INDEX, index++);
+ LayoutElement structureElement;
+ if ("window-def".equals(childName))
+ {
+ WindowNode window = importWindowDef(page, childElt);
+
+ //
+ structureElement = layout.addObjectElement(window.getId());
+ }
+ else if ("simple-layout".equals(childName))
+ {
+ StructureElement nestedLayout = layout.addStructureElement();
+
+ //
+ importLayout(page, nestedLayout.getNestedStructure(), childElt);
+
+ //
+ structureElement = nestedLayout;
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+
+ //
+ structureElement.setProperty(Constants.SIMPLE_LAYOUT_INDEX, index++);
}
}
else
@@ -179,13 +226,13 @@
}
}
- private WindowNode importWindowDef(PortalNode parentNode, Element windowDefElt)
+ private WindowNode importWindowDef(PortalNode parentNode, org.w3c.dom.Element windowDefElt)
{
WindowNode windowNode = createStructuralNode(parentNode, WindowNode.class, windowDefElt);
//
WindowNode.Content content = null;
- Element markupElt = getUniqueChild(windowDefElt, "markup", false);
+ org.w3c.dom.Element markupElt = getUniqueChild(windowDefElt, "markup", false);
if (markupElt != null)
{
String markup = asString(markupElt);
@@ -193,7 +240,7 @@
}
else
{
- Element portletElt = getUniqueChild(windowDefElt, "portlet", false);
+ org.w3c.dom.Element portletElt = getUniqueChild(windowDefElt, "portlet", false);
if (portletElt != null)
{
String portletRef = portletElt.getAttribute("ref");
@@ -208,7 +255,7 @@
return windowNode;
}
- private <T extends PortalNode> T createStructuralNode(PortalNode parent, Class<T> type, Element nodeDefElt)
+ private <T extends PortalNode> T createStructuralNode(PortalNode parent, Class<T> type, org.w3c.dom.Element nodeDefElt)
{
String nodeName = nodeDefElt.getAttribute("name");
@@ -216,18 +263,18 @@
T node = parent.addChild(nodeName, type);
//
- Element propertiesElt = XMLTools.getUniqueChild(nodeDefElt, "properties", false);
+ org.w3c.dom.Element propertiesElt = XMLTools.getUniqueChild(nodeDefElt, "properties", false);
//
if (propertiesElt != null)
{
- for (Element propertyElt : XMLTools.getChildren(propertiesElt, "property"))
+ for (org.w3c.dom.Element propertyElt : XMLTools.getChildren(propertiesElt, "property"))
{
- Element nameElt = XMLTools.getUniqueChild(propertyElt, "name", true);
+ org.w3c.dom.Element nameElt = XMLTools.getUniqueChild(propertyElt, "name", true);
String propertyName = XMLTools.asString(nameElt);
//
- Element valueElt = XMLTools.getUniqueChild(propertyElt, "value", true);
+ org.w3c.dom.Element valueElt = XMLTools.getUniqueChild(propertyElt, "value", true);
String litteralPropertyValue = XMLTools.asString(valueElt);
Serializable propertyValue;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -25,49 +25,33 @@
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIPage;
-import java.util.Collection;
-import java.util.List;
-import java.util.ArrayList;
-
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
public class PageNode extends PortalNode
{
+
+ /** . */
+ private String layoutStructureId;
+
public PageNode(String name, PortalNodeManager structuralStateContext)
{
super(name, structuralStateContext);
}
- public Class<? extends UIObject> getType()
+ public String getLayoutStructureId()
{
- return UIPage.class;
+ return layoutStructureId;
}
-
- public Collection<WindowNode> getWindows()
- {
- List<WindowNode> windows = new ArrayList<WindowNode>();
- //
- collectWindows(this, windows);
-
- //
- return windows;
+ public void setLayoutStructureId(String layoutStructureId)
+ {
+ this.layoutStructureId = layoutStructureId;
}
- private void collectWindows(PortalNode node, List<WindowNode> windows)
+ public Class<? extends UIObject> getType()
{
- if (node instanceof WindowNode)
- {
- windows.add((WindowNode)node);
- }
- else if (node instanceof PaneNode)
- {
- for (PortalNode child : node.getChildren())
- {
- collectWindows(child, windows);
- }
- }
+ return UIPage.class;
}
}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PaneNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PaneNode.java 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PaneNode.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -1,44 +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.portal.model;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.ui.UIPane;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PaneNode extends PortalNode
-{
-
- public PaneNode(String name, PortalNodeManager structuralStateContext)
- {
- super(name, structuralStateContext);
- }
-
- public Class<? extends UIObject> getType()
- {
- return UIPane.class;
- }
-}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -62,6 +62,9 @@
/** . */
final Map<String, Serializable> properties;
+ /** . */
+ final Map<String, Serializable> immutableProperties;
+
protected PortalNode(String name, PortalNodeManager structuralStateContext)
{
this.name = name;
@@ -69,6 +72,7 @@
this.structuralStateContext = structuralStateContext;
this.properties = new HashMap<String, Serializable>();
this.valid = true;
+ this.immutableProperties = Collections.unmodifiableMap(properties);
}
public abstract Class<? extends UIObject> getType();
@@ -93,14 +97,9 @@
return parent;
}
- public Set<String> getPropertyNames()
- {
- return Collections.unmodifiableSet(properties.keySet());
- }
-
public Map<String, Serializable> getProperties()
{
- return Collections.unmodifiableMap(properties);
+ return immutableProperties;
}
public Serializable getProperty(String propertyName)
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -23,13 +23,24 @@
package org.jboss.portal.presentation.portal.model;
import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
+import org.jboss.portal.presentation.portal.model.layout.StructureElement;
+import org.jboss.portal.presentation.portal.model.layout.NestedStructure;
+import org.jboss.portal.presentation.portal.model.layout.ObjectStructure;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
+import org.jboss.portal.presentation.portal.model.layout.LayoutObject;
+import org.jboss.portal.presentation.portal.model.layout.ObjectElement;
import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIPane;
+import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.state.structural.StructuralState;
import org.jboss.portal.common.NotYetImplemented;
import java.util.Collection;
import java.util.Map;
import java.util.HashMap;
+import java.util.Collections;
import java.io.Serializable;
/**
@@ -42,19 +53,34 @@
/** . */
private PortalNodeManager nodeManager;
- public PortalNodeAdapter(PortalNodeManager nodeManager)
+ /** . */
+ private LayoutStore layoutStore;
+
+ public PortalNodeAdapter(PortalNodeManager nodeManager, LayoutStore layoutStore)
{
this.nodeManager = nodeManager;
+ this.layoutStore = layoutStore;
}
public String getRootId()
{
- return nodeManager.getRoot().getId();
+ return "node." + nodeManager.getRoot().getId();
}
public Object getNode(String id)
{
- return nodeManager.getNode(id);
+ if (id.startsWith("node."))
+ {
+ return nodeManager.getNode(id.substring(5));
+ }
+ else if (id.startsWith("structure."))
+ {
+ return layoutStore.getObject(id.substring(10));
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unrecognized id " + id);
+ }
}
public Object getParent(Object o)
@@ -63,6 +89,22 @@
{
return ((PortalNode)o).getParent();
}
+ else if (o instanceof LayoutElement)
+ {
+ LayoutStructure layout = ((LayoutElement)o).getStructure();
+
+ //
+ if (layout instanceof NestedStructure)
+ {
+ return ((NestedStructure)layout).getStructureElement();
+ }
+ else
+ {
+ ObjectStructure objectStructure = (ObjectStructure)layout;
+ String objectId = objectStructure.getObjectRef();
+ return nodeManager.getNode(objectId);
+ }
+ }
else
{
throw new NotYetImplemented();
@@ -73,8 +115,32 @@
{
if (o instanceof PortalNode)
{
- return ((PortalNode)o).getChildren();
+ if (o instanceof PageNode)
+ {
+ String layoutStructureId = ((PageNode)o).getLayoutStructureId();
+
+ //
+ LayoutStructure layoutStructure = (LayoutStructure)layoutStore.getObject(layoutStructureId);
+
+ //
+ return layoutStructure.getElements();
+ }
+ else
+ {
+ return ((PortalNode)o).getChildren();
+ }
}
+ else if (o instanceof LayoutElement)
+ {
+ if (o instanceof StructureElement)
+ {
+ return ((StructureElement)o).getNestedStructure().getElements();
+ }
+ else
+ {
+ return Collections.emptyList();
+ }
+ }
else
{
throw new NotYetImplemented();
@@ -85,8 +151,12 @@
{
if (o instanceof PortalNode)
{
- return ((PortalNode)o).getId();
+ return "node." + ((PortalNode)o).getId();
}
+ else if (o instanceof LayoutObject)
+ {
+ return "structure." + ((LayoutObject)o).getId();
+ }
else
{
throw new NotYetImplemented();
@@ -99,6 +169,21 @@
{
return ((PortalNode)o).getType();
}
+ else if (o instanceof LayoutElement)
+ {
+ if (o instanceof StructureElement)
+ {
+ return UIPane.class;
+ }
+ else if (o instanceof ObjectElement)
+ {
+ return UIWindow.class;
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
else
{
throw new NotYetImplemented();
@@ -111,6 +196,11 @@
{
return ((PortalNode)o).getName();
}
+ else if (o instanceof LayoutObject)
+ {
+ // no natural name, for now use id
+ return ((LayoutObject)o).getId();
+ }
else
{
throw new NotYetImplemented();
@@ -119,10 +209,55 @@
public Map<String, Serializable> getProperties(Object o)
{
- if (o instanceof PortalNode)
+ if (o instanceof PageNode)
{
+ PageNode page = (PageNode)o;
+
+ //
+ String layoutStructureId = ((PageNode)o).getLayoutStructureId();
+
+ //
+ LayoutStructure layoutStructure = (LayoutStructure)layoutStore.getObject(layoutStructureId);
+
+ //
+ Map<String, Serializable> properties = new HashMap<String, Serializable>(page.getProperties());
+
+ //
+ properties.putAll(layoutStructure.getState().getProperties());
+
+ //
+ return properties;
+ }
+ else if (o instanceof PortalNode)
+ {
return ((PortalNode)o).getProperties();
}
+ else if (o instanceof LayoutObject)
+ {
+ if (o instanceof ObjectElement)
+ {
+ ObjectElement element = (ObjectElement)o;
+
+ //
+ String windowId = element.getObjectRef();
+
+ //
+ WindowNode window = (WindowNode)nodeManager.getNode(windowId);
+
+ //
+ Map<String, Serializable> properties = new HashMap<String, Serializable>(window.getProperties());
+
+ //
+ properties.putAll(element.getState().getProperties());
+
+ //
+ return properties;
+ }
+ else
+ {
+ return ((LayoutObject)o).getState().getProperties();
+ }
+ }
else
{
throw new NotYetImplemented();
@@ -131,21 +266,12 @@
public StructuralState getState(Object o)
{
- if (o instanceof PortalNode)
- {
- PortalNode portalNode = (PortalNode)o;
+ Class<? extends UIObject> type = getType(o);
+ String name = getName(o);
+ Map<String, Serializable> properties = getProperties(o);
- //
- return new PortalNodeState(
- portalNode.getType(),
- portalNode.getName(),
- new HashMap<String, Serializable>(portalNode.getProperties())
- );
- }
- else
- {
- throw new NotYetImplemented();
- }
+ //
+ return new PortalNodeState(type, name, properties);
}
public void lock(Object o)
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.presentation.portal.model;
-import org.jboss.portal.presentation.state.structural.StructuralStateContext;
-import org.jboss.portal.presentation.portal.model.structural.StructuralStateContextImpl;
-
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicLong;
@@ -45,13 +42,9 @@
/** . */
private final ContextNode root = new ContextNode("", this);
- /** . */
- private final StructuralStateContext structuralStateContext;
-
public PortalNodeManager()
{
nodes.put(root.getId(), root);
- structuralStateContext = new StructuralStateContextImpl<Object>(new PortalNodeAdapter(this));
}
String nextId()
@@ -59,11 +52,6 @@
return Long.toString(sequence.getAndIncrement());
}
- public StructuralStateContext getStructuralStateContext()
- {
- return structuralStateContext;
- }
-
public PortalNode getNode(String nodeId)
{
if (nodeId == null)
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -49,20 +49,6 @@
return UIWindow.class;
}
- public PageNode getPage()
- {
- for (PortalNode current = getParent();current != null;current = current.getParent())
- {
- if (current instanceof PageNode)
- {
- return (PageNode)current;
- }
- }
-
- //
- return null;
- }
-
public void setContent(Content content)
{
this.content = content;
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * 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.portal.model.layout;
+
+/**
+ * An element of a layout that belongs to a structure.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class LayoutElement extends LayoutObject
+{
+
+ /** The structure to which this element belongs. */
+ LayoutStructure structure;
+
+ protected LayoutElement()
+ {
+ }
+
+ public LayoutStructure getStructure()
+ {
+ return structure;
+ }
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObject.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObject.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObject.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * 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.portal.model.layout;
+
+import org.jboss.portal.common.NotYetImplemented;
+
+import java.io.Serializable;
+
+/**
+ * An object part of the layout system.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class LayoutObject
+{
+
+ /** . */
+ private LayoutObjectContext context;
+
+ protected LayoutObject()
+ {
+ }
+
+ LayoutObjectContext getContext()
+ {
+ return context;
+ }
+
+ void register(LayoutObjectContext context)
+ {
+ this.context = context;
+ }
+
+ void unregister()
+ {
+ throw new NotYetImplemented("No need for now");
+ }
+
+ public final String getId()
+ {
+ if (context == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ return context.getId();
+ }
+
+ /**
+ * Returns the state of the layout object.
+ *
+ * @return the state
+ */
+ public abstract LayoutState getState();
+
+ public Serializable getProperty(String name)
+ {
+ return getState().getProperty(name);
+ }
+
+ public void setProperty(String name, Serializable value)
+ {
+ getState().setProperty(name, value);
+ }
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObjectContext.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObjectContext.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObjectContext.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * 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.portal.model.layout;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class LayoutObjectContext
+{
+
+ /** . */
+ private final LayoutStore store;
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final LayoutObject object;
+
+ LayoutObjectContext(LayoutStore store, String id, LayoutObject object)
+ {
+ this.store = store;
+ this.id = id;
+ this.object = object;
+ }
+
+ LayoutObject getObject()
+ {
+ return object;
+ }
+
+ String getId()
+ {
+ return id;
+ }
+
+ void register(LayoutObject object)
+ {
+ store.register(object);
+ }
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutState.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutState.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutState.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * 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.portal.model.layout;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * A generic state of layout objects.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class LayoutState
+{
+
+ /** The properties. */
+ private final Map<String, Serializable> properties;
+
+ /** . */
+ private final Map<String, Serializable> immutableProperties;
+
+ LayoutState()
+ {
+ this.properties = new HashMap<String, Serializable>();
+ this.immutableProperties = Collections.unmodifiableMap(properties);
+ }
+
+ public Map<String, Serializable> getProperties()
+ {
+ return immutableProperties;
+ }
+
+ public Serializable getProperty(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ return properties.get(name);
+ }
+
+ public void setProperty(String name, Serializable value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (value != null)
+ {
+ properties.put(name, value);
+ }
+ else
+ {
+ properties.remove(name);
+ }
+ }
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * 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.portal.model.layout;
+
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class LayoutStore
+{
+
+ /** . */
+ private final AtomicLong sequence = new AtomicLong();
+
+ /** . */
+ private final Map<String, LayoutObjectContext> contexts = new ConcurrentHashMap<String, LayoutObjectContext>();
+
+ public ObjectStructure createStructure(String objectRef)
+ {
+ ObjectStructure structure = new ObjectStructure(objectRef);
+
+ //
+ register(structure);
+
+ //
+ return structure;
+ }
+
+ public LayoutObject getObject(String id)
+ {
+ LayoutObjectContext context = contexts.get(id);
+
+ //
+ return context != null ? context.getObject() : null;
+ }
+
+ void register(LayoutObject object)
+ {
+ LayoutObjectContext context = new LayoutObjectContext(this, Long.toString(sequence.getAndIncrement()), object);
+
+ //
+ contexts.put(context.getId(), context);
+
+ //
+ object.register(context);
+ }
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * 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.portal.model.layout;
+
+import java.util.Collection;
+import java.util.ArrayList;
+
+/**
+ * The structure of a layout.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class LayoutStructure extends LayoutObject
+{
+
+ /** The elements of the structure. */
+ private final Collection<LayoutElement> elements;
+
+ /** The state. */
+ final LayoutState state;
+
+ LayoutStructure()
+ {
+ this.elements = new ArrayList<LayoutElement>();
+ this.state = new LayoutState();
+ }
+
+ public Collection<LayoutElement> getElements()
+ {
+ return elements;
+ }
+
+ public ObjectElement addObjectElement(String objectRef)
+ {
+ ObjectElement element = new ObjectElement(objectRef);
+
+ //
+ addElement(element);
+
+ //
+ return element;
+ }
+
+ public StructureElement addStructureElement()
+ {
+ StructureElement element = new StructureElement();
+
+ //
+ addElement(element);
+
+ //
+ return element;
+ }
+
+ private void addElement(LayoutElement element)
+ {
+ if (element.structure != null)
+ {
+ throw new IllegalArgumentException("Layout element is already attached to a layout");
+ }
+
+ // Wire
+ element.structure = this;
+ elements.add(element);
+
+ // Register and contextualize
+ getContext().register(element);
+ }
+
+ public LayoutState getState()
+ {
+ return state;
+ }
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.portal.model.layout;
+
+/**
+ * A structure nested in another structure through a {@link StructureElement}.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public final class NestedStructure extends LayoutStructure
+{
+
+ /** The corresponding structure element. */
+ private final StructureElement structureElement;
+
+ NestedStructure(StructureElement structureElement)
+ {
+ this.structureElement = structureElement;
+ }
+
+ public StructureElement getStructureElement()
+ {
+ return structureElement;
+ }
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectElement.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectElement.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectElement.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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.portal.model.layout;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ObjectElement extends LayoutElement
+{
+
+ /** . */
+ private final String objectRef;
+
+ /** . */
+ private final LayoutState state;
+
+ ObjectElement(String objectRef)
+ {
+ this.objectRef = objectRef;
+ this.state = new LayoutState();
+ }
+
+ public String getObjectRef()
+ {
+ return objectRef;
+ }
+
+ public LayoutState getState()
+ {
+ return state;
+ }
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectStructure.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectStructure.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectStructure.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * 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.portal.model.layout;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ObjectStructure extends LayoutStructure
+{
+
+ /** . */
+ private final String objectRef;
+
+ ObjectStructure(String objectRef)
+ {
+ if (objectRef == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.objectRef = objectRef;
+ }
+
+ public String getObjectRef()
+ {
+ return objectRef;
+ }
+}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * 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.portal.model.layout;
+
+/**
+ * A layout element that references a nested structure.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public final class StructureElement extends LayoutElement
+{
+
+ /** . */
+ private final NestedStructure nestedStructure;
+
+ StructureElement()
+ {
+ this.nestedStructure = new NestedStructure(this);
+ }
+
+ void register(LayoutObjectContext context)
+ {
+ super.register(context);
+
+ //
+ context.register(nestedStructure);
+ }
+
+ public LayoutStructure getNestedStructure()
+ {
+ return nestedStructure;
+ }
+
+ /**
+ * The implementation delegates the state to the nested structure.
+ */
+ public LayoutState getState()
+ {
+ return nestedStructure.state;
+ }
+}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -25,6 +25,7 @@
import org.jboss.portal.presentation.portal.model.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.NodeImporter;
import org.jboss.portal.presentation.portal.model.ContextNode;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
import org.jboss.portal.common.io.IOTools;
import javax.servlet.ServletContext;
@@ -41,8 +42,11 @@
private ServletContext servletContext;
/** . */
- private PortalNodeManager structuralStateContext;
+ private PortalNodeManager portalNodeManager;
+ /** . */
+ private LayoutStore layoutStore;
+
public ServletContext getServletContext()
{
return servletContext;
@@ -53,16 +57,26 @@
this.servletContext = servletContext;
}
- public PortalNodeManager getStructuralStateContext()
+ public PortalNodeManager getPortalNodeManager()
{
- return structuralStateContext;
+ return portalNodeManager;
}
- public void setStructuralStateContext(PortalNodeManager structuralStateContext)
+ public void setPortalNodeManager(PortalNodeManager portalNodeManager)
{
- this.structuralStateContext = structuralStateContext;
+ this.portalNodeManager = portalNodeManager;
}
+ public LayoutStore getLayoutStore()
+ {
+ return layoutStore;
+ }
+
+ public void setLayoutStore(LayoutStore layoutStore)
+ {
+ this.layoutStore = layoutStore;
+ }
+
public void start() throws Exception
{
InputStream in = servletContext.getResourceAsStream("/WEB-INF/page-structure.xml");
@@ -70,8 +84,8 @@
//
try
{
- ContextNode root = structuralStateContext.getRoot();
- new NodeImporter(root).importDocument(in);
+ ContextNode root = portalNodeManager.getRoot();
+ new NodeImporter(root, layoutStore).importDocument(in);
}
finally
{
Modified: modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/page_structure_1_0.xsd
===================================================================
--- modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/page_structure_1_0.xsd 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/page_structure_1_0.xsd 2008-06-07 21:03:17 UTC (rev 10940)
@@ -101,6 +101,8 @@
<xsd:complexType name="simpleLayoutType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="simple-layout" type="simpleLayoutType"/>
+ <xsd:element name="region-layout" type="regionLayoutType"/>
<xsd:element name="window-def" type="windowDefType"/>
</xsd:choice>
<xsd:attribute name="orientation" use="optional" default="vertical">
@@ -121,6 +123,8 @@
<xsd:complexType name="regionType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="simple-layout" type="simpleLayoutType"/>
+ <xsd:element name="region-layout" type="regionLayoutType"/>
<xsd:element name="window-def" type="windowDefType"/>
</xsd:choice>
<xsd:attribute name="orientation" use="required" type="xsd:string"/>
Modified: modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java
===================================================================
--- modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -28,6 +28,9 @@
import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
import org.jboss.portal.presentation.test.model.AbstractModelTestCase;
+import org.jboss.portal.presentation.portal.model.structural.StructuralStateContextImpl;
+import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
import java.util.ArrayList;
import java.util.List;
@@ -42,21 +45,24 @@
{
/** . */
- private PortalNodeManager structuralStateContext;
+ private StructuralStateContext structuralStateContext;
+ /** . */
+ private PortalNodeManager portalNodeManager;
+
protected StructuralStateContext getStructuralStateContext()
{
- return structuralStateContext.getStructuralStateContext();
+ return structuralStateContext;
}
protected PortalNode getRoot()
{
- return structuralStateContext.getRoot();
+ return portalNodeManager.getRoot();
}
protected Set<String> getPropertyNames(PortalNode portalNode)
{
- return portalNode.getPropertyNames();
+ return portalNode.getProperties().keySet();
}
protected PortalNode getParent(PortalNode portalNode)
@@ -127,11 +133,13 @@
protected void destroy(PortalNode portalNode)
{
- structuralStateContext.destroy(portalNode.getId());
+ portalNodeManager.destroy(portalNode.getId());
}
protected void setUp() throws Exception
{
- structuralStateContext = new PortalNodeManager();
+ portalNodeManager = new PortalNodeManager();
+ StructuralAdapter<Object> adapter = new PortalNodeAdapter(portalNodeManager, new LayoutStore());
+ structuralStateContext = new StructuralStateContextImpl<Object>(adapter);
}
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/DefaultPageViewPortScope.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/DefaultPageViewPortScope.java 2008-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/DefaultPageViewPortScope.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -28,6 +28,7 @@
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.UIPane;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -67,36 +68,43 @@
public ObjectTraversalType enterObject(UIObject object)
{
- if (object instanceof UIPage)
+ if (object instanceof UIPane)
{
- switch (pageStatus)
+ if (object instanceof UIPage)
{
- case NO_PAGE:
- if ("default".equals(object.getName()))
- {
- pageStatus = DEFAULT_PAGE;
+ switch (pageStatus)
+ {
+ case NO_PAGE:
+ if ("default".equals(object.getName()))
+ {
+ pageStatus = DEFAULT_PAGE;
- // We want to traverse the children of the default page
- return ObjectTraversalType.RECURSIVE;
- }
- else
- {
- pageStatus = DEFAULT_PAGE_SIBLING;
+ // We want to traverse the children of the default page
+ return ObjectTraversalType.RECURSIVE;
+ }
+ else
+ {
+ pageStatus = DEFAULT_PAGE_SIBLING;
- // We want to see the sibbling pages of the default page
+ // We want to see the sibbling pages of the default page
+ return ObjectTraversalType.SINGLE;
+ }
+ case DEFAULT_PAGE:
+ pageStatus = DEFAULT_PAGE_CHILD;
+
+ // We want to see the children pages of the default page
return ObjectTraversalType.SINGLE;
- }
- case DEFAULT_PAGE:
- pageStatus = DEFAULT_PAGE_CHILD;
-
- // We want to see the children pages of the default page
- return ObjectTraversalType.SINGLE;
- case DEFAULT_PAGE_CHILD:
- case DEFAULT_PAGE_SIBLING:
- return ObjectTraversalType.SKIP;
- default:
- throw new AssertionError();
+ case DEFAULT_PAGE_CHILD:
+ case DEFAULT_PAGE_SIBLING:
+ return ObjectTraversalType.SKIP;
+ default:
+ throw new AssertionError();
+ }
}
+ else
+ {
+ return ObjectTraversalType.RECURSIVE;
+ }
}
else if (object instanceof UIWindow)
{
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-06-06 17:42:41 UTC (rev 10939)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java 2008-06-07 21:03:17 UTC (rev 10940)
@@ -28,6 +28,7 @@
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.UIPane;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -67,36 +68,43 @@
public ObjectTraversalType enterObject(UIObject object)
{
- if (object instanceof UIPage)
+ if (object instanceof UIPane)
{
- switch (pageStatus)
+ if (object instanceof UIPage)
{
- case NO_PAGE:
- if (pageId.equals(object.getId()))
- {
- pageStatus = PAGE;
+ switch (pageStatus)
+ {
+ case NO_PAGE:
+ if (pageId.equals(object.getId()))
+ {
+ pageStatus = PAGE;
- // We want to traverse the children of the default page
- return ObjectTraversalType.RECURSIVE;
- }
- else
- {
- pageStatus = PAGE_SIBLING;
+ // We want to traverse the children of the default page
+ return ObjectTraversalType.RECURSIVE;
+ }
+ else
+ {
+ pageStatus = PAGE_SIBLING;
- // We want to see the sibbling pages of the default page
+ // We want to see the sibbling pages of the default page
+ return ObjectTraversalType.SINGLE;
+ }
+ case PAGE:
+ pageStatus = PAGE_CHILD;
+
+ // We want to see the children pages of the default page
return ObjectTraversalType.SINGLE;
- }
- case PAGE:
- pageStatus = PAGE_CHILD;
-
- // We want to see the children pages of the default page
- return ObjectTraversalType.SINGLE;
- case PAGE_CHILD:
- case PAGE_SIBLING:
- return ObjectTraversalType.SKIP;
- default:
- throw new AssertionError();
+ case PAGE_CHILD:
+ case PAGE_SIBLING:
+ return ObjectTraversalType.SKIP;
+ default:
+ throw new AssertionError();
+ }
}
+ else
+ {
+ return ObjectTraversalType.RECURSIVE;
+ }
}
else if (object instanceof UIWindow)
{
17 years, 11 months
JBoss Portal SVN: r10939 - in branches/JBoss_Portal_Branch_2_6/core-wsrp/src: main/org/jboss/portal/wsrp/admin/ui and 4 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-06-06 13:42:41 -0400 (Fri, 06 Jun 2008)
New Revision: 10939
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/BeanContext.java
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/JSFBeanContext.java
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/confirmDeleteConsumer.xhtml
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/management/managementTemplate.xhtml
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/confirmPropDeletion.xhtml
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producer.xhtml
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producerTemplate.xhtml
Log:
- More internalization: still need to improve the status handling after a consumer refresh as it is currently hardcoded.
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java 2008-06-06 17:42:41 UTC (rev 10939)
@@ -29,6 +29,8 @@
import org.jboss.portal.wsrp.admin.ui.BeanContext;
import org.jboss.portal.wsrp.admin.ui.ConsumerBean;
+import java.util.Locale;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -91,5 +93,10 @@
{
return null;
}
+
+ protected Locale getLocale()
+ {
+ return Locale.getDefault();
+ }
}
}
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/BeanContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/BeanContext.java 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/BeanContext.java 2008-06-06 17:42:41 UTC (rev 10939)
@@ -23,6 +23,10 @@
package org.jboss.portal.wsrp.admin.ui;
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -30,7 +34,10 @@
*/
public abstract class BeanContext
{
- private static final String STATUS = "status";
+ protected static final String STATUS = "status";
+ private static final String RESOURCE_NAME = "WSRPConfigurationResource";
+ private static final String UNEXPECTED_ERROR = "bean_support_unexpected_error";
+ private static final String CAUSE = "bean_support_cause";
protected abstract String getParameter(String key);
@@ -40,16 +47,31 @@
protected abstract Object getInfoSeverity();
- protected void createErrorMessage(String message)
+ protected abstract Locale getLocale();
+
+ protected void createErrorMessage(String message, Object... params)
{
- createMessage(STATUS, message, getErrorSeverity());
+ createLocalizedMessage(STATUS, message, getErrorSeverity(), params);
}
- protected void createErrorMessage(String target, String message)
+ protected void createErrorMessage(String target, String message, Object... params)
{
- createMessage(target, message, getErrorSeverity());
+ createLocalizedMessage(target, message, getErrorSeverity(), params);
}
+ protected void createLocalizedMessage(String target, String message, Object severity, Object... params)
+ {
+ String localizedMessage = MessageFormat.format(getMessageFromBundle(message), params);
+ createMessage(target, localizedMessage, severity);
+ }
+
+ protected String getMessageFromBundle(String message)
+ {
+ Locale locale = getLocale();
+ ResourceBundle rb = ResourceBundle.getBundle(RESOURCE_NAME, locale);
+ return rb.getString(message);
+ }
+
protected void createErrorMessageFrom(Exception e)
{
createErrorMessageFrom(STATUS, e);
@@ -59,8 +81,8 @@
{
Throwable cause = e.getCause();
String localizedMessage = getLocalizedMessageOrExceptionName(e);
- String message = localizedMessage + (cause != null ? "\nCause: " + getLocalizedMessageOrExceptionName(cause) : "");
- createErrorMessage(target, message);
+ String message = localizedMessage + (cause != null ? "\n" + getMessageFromBundle(CAUSE) + getLocalizedMessageOrExceptionName(cause) : "");
+ createMessage(target, message, getErrorSeverity());
}
private String getLocalizedMessageOrExceptionName(Throwable e)
@@ -68,14 +90,14 @@
String localizedMessage = e.getLocalizedMessage();
if (localizedMessage == null)
{
- localizedMessage = "An unexpected error occured: " + e.getClass().getName();
+ localizedMessage = getMessageFromBundle(UNEXPECTED_ERROR) + e.getClass().getName();
}
return localizedMessage;
}
protected void createInfoMessage(String target, String message)
{
- createMessage(target, message, getInfoSeverity());
+ createLocalizedMessage(target, message, getInfoSeverity());
}
protected void createInfoMessage(String message)
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2008-06-06 17:42:41 UTC (rev 10939)
@@ -56,6 +56,14 @@
private String wsdl;
private transient RegistrationInfo expectedRegistrationInfo;
+ private static final String CANNOT_FIND_CONSUMER = "bean_consumer_cannot_find_consumer";
+ private static final String CANNOT_UPDATE_CONSUMER = "bean_consumer_cannot_update_consumer";
+ private static final String CANNOT_REFRESH_CONSUMER = "bean_consumer_cannot_refresh_consumer";
+ private static final String MODIFY_REG_SUCCESS = "bean_consumer_modify_reg_success";
+ private static final String INVALID_MODIFY = "bean_consumer_invalid_modify";
+ private static final String CANNOT_MODIFY_REG = "bean_consumer_cannot_modify_reg";
+ private static final String CANNOT_ERASE_REG = "bean_consumer_cannot_erase_reg";
+ private static final String MALFORMED_URL = "bean_consumer_malformed_url";
public ConsumerBean()
{
@@ -125,7 +133,7 @@
}
else
{
- beanContext.createErrorMessage("Couldn't find consumer '" + id + "'!");
+ beanContext.createErrorMessage(CANNOT_FIND_CONSUMER, id);
}
}
}
@@ -319,7 +327,7 @@
return ConsumerManagerBean.CONFIGURE_CONSUMER;
}
- beanContext.createErrorMessage("Couldn't update Consumer!");
+ beanContext.createErrorMessage(CANNOT_UPDATE_CONSUMER);
return null;
}
@@ -347,7 +355,7 @@
return ConsumerManagerBean.CONFIGURE_CONSUMER;
}
- beanContext.createErrorMessage("Couldn't refresh Consumer!");
+ beanContext.createErrorMessage(CANNOT_REFRESH_CONSUMER);
return null;
}
@@ -377,7 +385,7 @@
if (!isRegistrationLocallyModified())
{
IllegalStateException e =
- new IllegalStateException("Registration not locally modified: there should be expected registration from producer!");
+ new IllegalStateException("Registration not locally modified: there should be expected registration from producer!");
log.debug(e);
throw e;
}
@@ -394,7 +402,7 @@
registrationLocallyModified = false;
- beanContext.createInfoMessage("Successfully modified Registration!");
+ beanContext.createInfoMessage(MODIFY_REG_SUCCESS);
}
catch (Exception e)
{
@@ -410,11 +418,11 @@
}
else
{
- beanContext.createErrorMessage("Invalid attempt to modify a Registration that hasn't been locally modified!");
+ beanContext.createErrorMessage(INVALID_MODIFY);
}
}
- beanContext.createErrorMessage("Couldn't modify Registration!");
+ beanContext.createErrorMessage(CANNOT_MODIFY_REG);
return null;
}
@@ -426,7 +434,7 @@
return ConsumerManagerBean.CONFIGURE_CONSUMER;
}
- beanContext.createErrorMessage("Couldn't erase local Registration!");
+ beanContext.createErrorMessage(CANNOT_ERASE_REG);
return null;
}
@@ -443,7 +451,7 @@
}
catch (MalformedURLException e)
{
- beanContext.createErrorMessage(target, "'" + newValue + "' is not a valid URL: " + e.getLocalizedMessage());
+ beanContext.createErrorMessage(target, MALFORMED_URL, newValue, e.getLocalizedMessage());
}
}
@@ -476,4 +484,4 @@
registrationLocallyModified = isOldAndNewEqual(event.getOldValue(), event.getNewValue());
}
}
-}
\ No newline at end of file
+}
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2008-06-06 17:42:41 UTC (rev 10939)
@@ -49,6 +49,8 @@
static final String CONFIGURE_CONSUMER = "configureConsumer";
static final String CONSUMERS = "consumers";
static final String EXPECTED_REG_INFO_KEY = "expectedRegistrationInfo";
+ private static final String NO_CONSUMER = "bean_consumermanager_no_consumer";
+ private static final String INVALID_NEW_CONSUMER_NAME = "bean_consumermanager_invalid_new_consumer_name";
public ConsumerRegistry getRegistry()
{
@@ -167,7 +169,7 @@
}
else
{
- beanContext.createErrorMessage("Need a non-null, non-empty name for the new Consumer");
+ beanContext.createErrorMessage(INVALID_NEW_CONSUMER_NAME);
return null;
}
}
@@ -254,7 +256,7 @@
registry.deactivateConsumerWith(consumer.getProducerId());
}
- beanContext.createInfoMessage(result.getStatus());
+ beanContext.createMessage(BeanContext.STATUS, result.getStatus(), beanContext.getInfoSeverity()); // todo: localize status!
}
return result;
}
@@ -319,6 +321,6 @@
private void noSelectedConsumerError()
{
- beanContext.createErrorMessage("No Consumer was selected!");
+ beanContext.createErrorMessage(NO_CONSUMER);
}
}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/JSFBeanContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/JSFBeanContext.java 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/JSFBeanContext.java 2008-06-06 17:42:41 UTC (rev 10939)
@@ -25,6 +25,7 @@
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
+import java.util.Locale;
import java.util.Map;
/**
@@ -65,4 +66,9 @@
{
return FacesMessage.SEVERITY_INFO;
}
+
+ protected Locale getLocale()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2008-06-06 17:42:41 UTC (rev 10939)
@@ -104,7 +104,7 @@
}
else
{
- return "RegistrationPolicy unset";
+ return beanContext.getMessageFromBundle("bean_producer_regpolicy_unset");
}
}
@@ -171,7 +171,7 @@
catch (Exception e)
{
log.debug(e);
- beanContext.createErrorMessage("status", "Couldn't save producer configuration. Cause: " + e.getLocalizedMessage());
+ beanContext.createErrorMessage(BeanContext.STATUS, "bean_producer_cannot_save", e.getLocalizedMessage());
}
return PRODUCER;
}
@@ -185,7 +185,7 @@
catch (Exception e)
{
log.debug(e);
- beanContext.createErrorMessage("status", "Couldn't reload producer configuration. Cause: " + e.getLocalizedMessage());
+ beanContext.createErrorMessage(BeanContext.STATUS, "bean_producer_cannot_reload", e.getLocalizedMessage());
}
return PRODUCER;
}
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-06-06 17:42:41 UTC (rev 10939)
@@ -20,26 +20,33 @@
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA #
# 02110-1301 USA, or see the FSF site: http://www.fsf.org. #
################################################################################
+
+## WSRP GUI localization
+
# JBoss Portal display information
org.jboss.portal.object.name.WSRPConfigurationPortlet = WSRP Configuration
org.jboss.portal.instance.name.WSRPConfigurationPortletInstance = WSRP Configuration Portlet
+# Tabs
nav_tabs_consumers = Consumers Configuration
nav_tabs_producer_config = Producer Configuration
nav_tabs_producer_management = Producer Management
+# Object path in consumer template
path_consumers_root = Consumers
path_consumers_consumer = Consumer ''{0}'' configuration
path_consumers_active = active
path_consumers_inactive = inactive
path_consumers_refreshNeeded = (refresh needed)
+# Confirm deletion of a consumer screen
confirm_delete_consumer_title = Delete ''{0}'' consumer?
confirm_delete_consumer_message = You are about to delete the ''{0}'' consumer!
confirm_detete_consumer_proceed = Are you sure you want to proceed?
confirm_delete_consumer_submit = Delete consumer
confirm_delete_consumer_cancel = Cancel
+# Confirm deletion of local registration information screen
confirm_delete_registration_title = Delete local registration for ''{0}'' consumer?
confirm_delete_registration_message = You are about to delete the local registration information for the ''{0}'' consumer! \n\
This is only needed if this consumer had previously registered with the remote producer and this producer \n\
@@ -51,10 +58,12 @@
confirm_delete_registration_submit = Erase local registration
confirm_delete_registration_cancel = Cancel
+# Consumers screen
consumers_title = Manage Consumers
consumers_create_title = Create a consumer named:
consumers_create_submit = Create Consumer
+# Consumers list
consumers_table_column_consumer = Consumer
consumers_table_column_consumer_status = status:
consumers_table_column_actions = Actions
@@ -66,6 +75,7 @@
consumers_table_action_deregister = Deregister
consumers_table_action_delete = Delete
+# Consumer editing screen
edit_consumer_producer = Producer id:
edit_consumer_cache = Cache expiration:
edit_consumer_cache_seconds = (seconds before expiration)
@@ -90,6 +100,58 @@
edit_consumer_registration_context_handle = Handle:
edit_consumer_registration_context_erase = Erase local registration
edit_consumer_registration_context_erase_title = Erase local registration information (potentially dangerous!)
-edit_consumer_refresh = Refresh & Save
+edit_consumer_refresh = Refresh & Save
edit_consumer_refresh_title = Save changes and refresh information from producer
edit_consumer_cancel = Cancel
+
+# Confirm registration property deletion screen
+confirm_delete_reg_property_title = Delete ''{0}'' registration property description?
+confirm_delete_reg_property_message = You are about to delete the ''{0}'' registration property description! \n\
+This will trigger invalidation of consumer registrations which will have to modify their registration \n\
+information.
+confirm_detete_reg_property_proceed = Are you sure you want to proceed?
+confirm_delete_reg_property_submit = Delete property
+confirm_delete_reg_property_cancel = Cancel
+
+# Producer configuration screen
+producer_config_title = Producer configuration
+producer_config_sd_requires_reg = Access to full service description requires consumers to be registered.
+producer_config_strict = Use strict WSRP compliance.
+producer_config_requires_reg = Requires registration. Modifying this information will trigger invalidation of consumer registrations.
+producer_config_reg_policy = Registration policy class name:
+producer_config_reg_prop_validator = Registration property validator class name:
+producer_config_reg_props = Registration properties
+producer_config_reg_prop_name = Name
+producer_config_reg_prop_type = Type
+producer_config_reg_prop_label = Label
+producer_config_reg_prop_hint = Hint
+producer_config_reg_prop_action = Action
+producer_config_reg_prop_remove = Remove
+producer_config_no_reg_props = No specified required registration properties.
+producer_config_add_reg_prop = Add property
+producer_config_save = Save
+producer_config_cancel = Cancel
+
+## Localized messages in JSF beans
+
+bean_support_unexpected_error = An unexpected error occured:
+bean_support_cause = Cause:
+
+# ConsumerBean
+bean_consumer_cannot_find_consumer = Couldn't find consumer ''{0}''!
+bean_consumer_cannot_update_consumer = Couldn't update consumer!
+bean_consumer_cannot_refresh_consumer = Couldn't refresh consumer!
+bean_consumer_modify_reg_success = Successfully modified registration!
+bean_consumer_invalid_modify = Invalid attempt to modify a registration that hasn't been locally modified!
+bean_consumer_cannot_modify_reg = Couldn't modify registration!
+bean_consumer_cannot_erase_reg = Couldn't erase local registration!
+bean_consumer_malformed_url = ''{0}'' is not a valid URL: {1}
+
+# ConsumerManagerBean
+bean_consumermanager_invalid_new_consumer_name = Need a non-null, non-empty name for the new consumer!
+bean_consumermanager_no_consumer = No consumer was selected!
+
+# ProducerBean
+bean_producer_regpolicy_unset = RegistrationPolicy unset
+bean_producer_cannot_save = Couldn't save producer configuration. Cause: {0}
+bean_producer_cannot_reload = Couldn't reload producer configuration. Cause: {0}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-06-06 17:42:41 UTC (rev 10939)
@@ -75,7 +75,7 @@
edit_consumer_prop_desc=Description
edit_consumer_prop_name=Nom
edit_consumer_prop_value=Valeur
-edit_consumer_refresh=Rafra\u00eechir & Sauvegarder
+edit_consumer_refresh=Rafra\u00eechir & Sauvegarder
edit_consumer_refresh_title=Sauvegarde des changements et rafra\u00eechissement \u00e0 partir du producteur
edit_consumer_registration=Information d'enregistrement:
edit_consumer_registration_context=Contexte d'enregistrement:
@@ -87,4 +87,43 @@
edit_consumer_registration_modify=Modifier l'enregistrement
edit_consumer_registration_modify_title=Modifier l'enregistrement avec ce producteur
edit_consumer_registration_no_props=Enregistrement indiqu\u00e9 sans besoin de propri\u00e9t\u00e9s d'enregistrement
-edit_consumer_registration_update_props=Mettre les propri\u00e9t\u00e9s \u00e0 jour
\ No newline at end of file
+edit_consumer_registration_update_props=Mettre les propri\u00e9t\u00e9s \u00e0 jour
+bean_consumer_cannot_erase_reg=L'effacement de l'enregistrement n'a pu \u00eatre effectu\u00e9!
+bean_consumer_cannot_find_consumer=Le consommateur ''{0}'' n'a pu \u00eatre trouv\u00e9!
+bean_consumer_cannot_modify_reg=La modification de l'enregistrement n'a pu \u00eatre effectu\u00e9e!
+bean_consumer_cannot_refresh_consumer=Le rafra\u00eechissement du consommateur n'a pu \u00eatre effectu\u00e9!
+bean_consumer_cannot_update_consumer=La mise \u00e0 jour du consommateur n'a pu \u00eatre effectu\u00e9e!
+bean_consumer_invalid_modify=Tentative invalide de modification d'enregistrement sans modifications locales.
+bean_consumer_malformed_url=''{0}'' n'est pas une URL valide: {1}
+bean_consumer_modify_reg_success=Enregistrement modifi\u00e9!
+bean_support_cause=Cause:
+bean_support_unexpected_error=Une erreur inattendue s'est produite:
+bean_consumermanager_invalid_new_consumer_name=Un consommateur requiert un nom non-nul et non-vide!
+bean_consumermanager_no_consumer=Aucun consommateur n'a \u00e9t\u00e9 s\u00e9lectionn\u00e9!
+bean_producer_cannot_reload=Le rechargement de la configuration du producteur a \u00e9chou\u00e9. Cause: {0}
+bean_producer_cannot_save=La sauvegarde de la configuration du producteur a \u00e9chou\u00e9. Cause: {0}
+bean_producer_regpolicy_unset=RegistrationPolicy non sp\u00e9cifi\u00e9e
+confirm_delete_reg_property_cancel=Annuler
+confirm_delete_reg_property_message=Vous \u00eates sur le point d'effacer la description de la propri\u00e9t\u00e9 d'enregistrement ''{0}''! \n\
+Cel\u00e0 va entra\u00eener l'invalidation des enregistrements des consommateurs qui devront alors modifier \n\
+leur information d'enregistrement.
+confirm_delete_reg_property_submit=Effacer la propri\u00e9t\u00e9
+confirm_delete_reg_property_title=Voulez-vous r\u00e9ellement effacer la description de la propri\u00e9t\u00e9 d'enregistrement ''{0}''?
+confirm_detete_reg_property_proceed=\u00cates-vous certains de vouloir proc\u00e9der?
+producer_config_add_reg_prop=Ajouter une propri\u00e9t\u00e9
+producer_config_cancel=Annuler
+producer_config_no_reg_props=Aucune propri\u00e9t\u00e9 d'enregistrement sp\u00e9cifi\u00e9e.
+producer_config_reg_policy=Nom de la classe de la politique d'enregistrement:
+producer_config_reg_prop_action=Action
+producer_config_reg_prop_hint=Indice
+producer_config_reg_prop_label=\u00c9tiquette
+producer_config_reg_prop_name=Nom
+producer_config_reg_prop_remove=Enlever
+producer_config_reg_prop_type=Type
+producer_config_reg_prop_validator=Nom de la classe de validation des propri\u00e9t\u00e9s d'enregistrement:
+producer_config_reg_props=Propri\u00e9t\u00e9s d'enregistrement
+producer_config_requires_reg=N\u00e9cessite l'enregistrement. Modifier cette information entra\u00eene l'invalidation des enregistrements consommateurs.
+producer_config_save=Sauvegarder
+producer_config_sd_requires_reg=L'acc\u00e8s \u00e0 la description compl\u00e8te des services requiert l'enregistrement.
+producer_config_strict=Utiliser la validation WSRP stricte.
+producer_config_title=Configuration producteur
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/confirmDeleteConsumer.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/confirmDeleteConsumer.xhtml 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/confirmDeleteConsumer.xhtml 2008-06-06 17:42:41 UTC (rev 10939)
@@ -38,4 +38,4 @@
</ui:define>
-</ui:decorate>
+</ui:decorate>
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/management/managementTemplate.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/management/managementTemplate.xhtml 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/management/managementTemplate.xhtml 2008-06-06 17:42:41 UTC (rev 10939)
@@ -7,12 +7,12 @@
<ui:define name="topnav">
<h:form>
<ul class="topnav">
- <li><h:commandLink action="consumers" value="Consumers Configuration"/></li>
- <li><h:commandLink action="producer" value="Producer Configuration"/></li>
- <li id="currentTab">Producer Management</li>
+ <li><h:commandLink action="consumers" value="#{i18n.nav_tabs_consumers}"/></li>
+ <li><h:commandLink action="producer" value="#{i18n.nav_tabs_producer_config}"/></li>
+ <li id="currentTab">#{i18n.nav_tabs_producer_management}</li>
</ul>
</h:form>
</ui:define>
<ui:define name="objectpath"/>
-</ui:decorate>
\ No newline at end of file
+</ui:decorate>
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/confirmPropDeletion.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/confirmPropDeletion.xhtml 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/confirmPropDeletion.xhtml 2008-06-06 17:42:41 UTC (rev 10939)
@@ -11,20 +11,25 @@
<div class="portlet-msg">
<div class="portlet-msg-icon"><h:graphicImage url="/img/msgIcon_Warning.gif" alt="/!\"/></div>
<div class="portlet-msg-body">
- <h3>Delete '#{producer.selectedPropertyName}' registration property description?</h3>
+ <h3>
+ <h:outputFormat value="#{i18n.confirm_delete_reg_property_title}">
+ <f:param value="#{producer.selectedPropertyName}"/>
+ </h:outputFormat>
+ </h3>
<p class="portlet-msg-alert">
- You are about to delete the '#{producer.selectedPropertyName}' registration property description!
- This will trigger invalidation of consumer registrations which will have to modify their registration
- information.
+ <h:outputFormat value="#{i18n.confirm_delete_reg_property_message}">
+ <f:param value="#{producer.selectedPropertyName}"/>
+ </h:outputFormat>
</p>
- <p class="portlet-class">Are you sure you want to proceed?</p>
+ <p class="portlet-class">#{i18n.confirm_delete_reg_property_proceed}</p>
<h:form>
- <h:commandButton value="Delete" action="#{producer.deleteRegistrationProperty}"
+ <h:commandButton value="#{i18n.confirm_delete_reg_property_submit}"
+ action="#{producer.deleteRegistrationProperty}"
styleClass="portlet-form-button portlet-section-buttonrow"/>
- <h:commandButton value="Cancel" action="producer"
+ <h:commandButton value="#{i18n.confirm_delete_reg_property_cancel}" action="producer"
styleClass="portlet-form-button portlet-section-buttonrow"/>
</h:form>
</div>
@@ -32,4 +37,4 @@
</ui:define>
-</ui:decorate>
\ No newline at end of file
+</ui:decorate>
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producer.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producer.xhtml 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producer.xhtml 2008-06-06 17:42:41 UTC (rev 10939)
@@ -4,27 +4,29 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core">
- <ui:param name="title" value="Producer configuration"/>
+ <ui:param name="title" value="#{i18n.producer_config_title}"/>
<ui:define name="content">
<h:form>
<h:panelGrid columns="2" width="100%">
<h:selectBooleanCheckbox value="#{producer.registrationRequiredForFullDescription}"/>
- <h:outputText value="Access to full service description requires consumers to be registered."/>
+ <h:outputText value="#{i18n.producer_config_sd_requires_reg}"/>
+ <h:selectBooleanCheckbox value="#{producer.strictMode}"/>
+ <h:outputText value="#{i18n.producer_config_strict}"/>
+
<h:selectBooleanCheckbox value="#{producer.registrationRequired}" immediate="true"
onchange="this.form.submit()"
valueChangeListener="#{producer.requireRegistrationListener}"/>
- <h:outputText
- value="Requires registration. Modifying this information will trigger invalidation of consumer registrations."/>
+ <h:outputText value="#{i18n.producer_config_requires_reg}"/>
<h:outputText value=" " rendered="#{producer.registrationRequired}"/>
<h:panelGroup rendered="#{producer.registrationRequired}">
<h:panelGrid columns="2" width="100%">
- <h:outputLabel value="Registration policy class name:" for="registrationPolicy"/>
+ <h:outputLabel value="#{i18n.producer_config_reg_policy}" for="registrationPolicy"/>
<h:inputText id="registrationPolicy" value="#{producer.registrationPolicyClassName}" size="80"/>
- <h:outputLabel value="Registration property validator class name:" for="validator"
+ <h:outputLabel value="#{i18n.producer_config_reg_prop_validator}" for="validator"
rendered="#{producer.defaultRegistrationPolicy}"/>
<h:inputText id="validator" value="#{producer.validatorClassName}" size="80"
rendered="#{producer.defaultRegistrationPolicy}"/>
@@ -34,7 +36,7 @@
<h:outputText value=" " rendered="#{producer.registrationRequired}"/>
<h:panelGroup rendered="#{producer.registrationRequired}">
- <h:outputText styleClass="portlet-area-header" value="Registration properties"/>
+ <h:outputText styleClass="portlet-area-header" value="#{i18n.producer_config_reg_props}"/>
<h:panelGroup styleClass="portlet-area-body">
<c:choose>
<c:when test="#{!empty producer.registrationProperties}">
@@ -43,26 +45,27 @@
rendered="#{producer.registrationRequired}"
headerClass="portlet-section-header">
<h:column>
- <f:facet name="header">Name</f:facet>
+ <f:facet name="header">#{i18n.producer_config_reg_prop_name}</f:facet>
<h:inputText value="#{property.nameAsString}" size="30"/>
</h:column>
<h:column>
- <f:facet name="header">Type</f:facet>
+ <f:facet name="header">#{i18n.producer_config_reg_prop_type}</f:facet>
<h:selectOneListbox disabled="true">
<f:selectItems value="#{producer.supportedPropertyTypes}"/>
</h:selectOneListbox>
</h:column>
<h:column>
- <f:facet name="header">Label</f:facet>
+ <f:facet name="header">#{i18n.producer_config_reg_prop_label}</f:facet>
<h:inputText value="#{property.label}" size="50"/>
</h:column>
<h:column>
- <f:facet name="header">Hint</f:facet>
+ <f:facet name="header">#{i18n.producer_config_reg_prop_hint}</f:facet>
<h:inputText value="#{property.hint}" size="50"/>
</h:column>
<h:column>
- <f:facet name="header">Action</f:facet>
- <h:commandLink action="confirmPropDeletion" value="Remove"
+ <f:facet name="header">#{i18n.producer_config_reg_prop_action}</f:facet>
+ <h:commandLink action="confirmPropDeletion"
+ value="#{i18n.producer_config_reg_prop_remove}"
styleClass="portlet-form-button"
actionListener="#{producer.selectProperty}">
<f:param name="propName" value="#{property.nameAsString}"/>
@@ -71,19 +74,21 @@
</h:dataTable>
</c:when>
<c:otherwise>
- <h:outputText value="No specified required registration properties."/>
+ <h:outputText value="#{i18n.producer_config_no_reg_props}"/>
</c:otherwise>
</c:choose>
- <h:commandLink action="#{producer.addRegistrationProperty}" value="Add property"
+ <h:commandLink action="#{producer.addRegistrationProperty}"
+ value="#{i18n.producer_config_add_reg_prop}"
styleClass="portlet-form-button"/>
</h:panelGroup>
</h:panelGroup>
<h:outputText value=" "/>
<h:panelGroup styleClass="portlet-section-buttonrow">
- <h:commandButton action="#{producer.save}" value="Save" styleClass="portlet-form-button"/>
- <h:commandButton action="#{producer.reloadConfiguration}" value="Cancel"
+ <h:commandButton action="#{producer.save}" value="#{i18n.producer_config_save}"
styleClass="portlet-form-button"/>
+ <h:commandButton action="#{producer.reloadConfiguration}" value="#{i18n.producer_config_cancel}"
+ styleClass="portlet-form-button"/>
</h:panelGroup>
</h:panelGrid>
</h:form>
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producerTemplate.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producerTemplate.xhtml 2008-06-06 17:41:24 UTC (rev 10938)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producerTemplate.xhtml 2008-06-06 17:42:41 UTC (rev 10939)
@@ -7,14 +7,14 @@
<ui:define name="topnav">
<h:form>
<ul class="topnav">
- <li><h:commandLink action="consumers" value="Consumers Configuration"/></li>
- <li id="currentTab">Producer Configuration</li>
+ <li><h:commandLink action="consumers" value="#{i18n.nav_tabs_consumers}"/></li>
+ <li id="currentTab">#{i18n.nav_tabs_producer_config}</li>
<ui:remove>
- <li><h:commandLink value="Producer Management" action="management"/></li>
+ <li><h:commandLink value="#{i18n.nav_tabs_producer_management}" action="management"/></li>
</ui:remove>
</ul>
</h:form>
</ui:define>
<ui:define name="objectpath"/>
-</ui:decorate>
\ No newline at end of file
+</ui:decorate>
17 years, 11 months
JBoss Portal SVN: r10938 - in branches/JBoss_Portal_Branch_2_7/core-wsrp/src: main/org/jboss/portal/wsrp/admin/ui and 4 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-06-06 13:41:24 -0400 (Fri, 06 Jun 2008)
New Revision: 10938
Modified:
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/BeanContext.java
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/JSFBeanContext.java
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/confirmDeleteConsumer.xhtml
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/management/managementTemplate.xhtml
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/confirmPropDeletion.xhtml
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producer.xhtml
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producerTemplate.xhtml
Log:
- More internalization: still need to improve the status handling after a consumer refresh as it is currently hardcoded.
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java 2008-06-06 17:41:24 UTC (rev 10938)
@@ -29,6 +29,8 @@
import org.jboss.portal.wsrp.admin.ui.BeanContext;
import org.jboss.portal.wsrp.admin.ui.ConsumerBean;
+import java.util.Locale;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -91,5 +93,10 @@
{
return null;
}
+
+ protected Locale getLocale()
+ {
+ return Locale.getDefault();
+ }
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/BeanContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/BeanContext.java 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/BeanContext.java 2008-06-06 17:41:24 UTC (rev 10938)
@@ -23,6 +23,10 @@
package org.jboss.portal.wsrp.admin.ui;
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -30,7 +34,10 @@
*/
public abstract class BeanContext
{
- private static final String STATUS = "status";
+ protected static final String STATUS = "status";
+ private static final String RESOURCE_NAME = "WSRPConfigurationResource";
+ private static final String UNEXPECTED_ERROR = "bean_support_unexpected_error";
+ private static final String CAUSE = "bean_support_cause";
protected abstract String getParameter(String key);
@@ -40,16 +47,31 @@
protected abstract Object getInfoSeverity();
- protected void createErrorMessage(String message)
+ protected abstract Locale getLocale();
+
+ protected void createErrorMessage(String message, Object... params)
{
- createMessage(STATUS, message, getErrorSeverity());
+ createLocalizedMessage(STATUS, message, getErrorSeverity(), params);
}
- protected void createErrorMessage(String target, String message)
+ protected void createErrorMessage(String target, String message, Object... params)
{
- createMessage(target, message, getErrorSeverity());
+ createLocalizedMessage(target, message, getErrorSeverity(), params);
}
+ protected void createLocalizedMessage(String target, String message, Object severity, Object... params)
+ {
+ String localizedMessage = MessageFormat.format(getMessageFromBundle(message), params);
+ createMessage(target, localizedMessage, severity);
+ }
+
+ protected String getMessageFromBundle(String message)
+ {
+ Locale locale = getLocale();
+ ResourceBundle rb = ResourceBundle.getBundle(RESOURCE_NAME, locale);
+ return rb.getString(message);
+ }
+
protected void createErrorMessageFrom(Exception e)
{
createErrorMessageFrom(STATUS, e);
@@ -59,8 +81,8 @@
{
Throwable cause = e.getCause();
String localizedMessage = getLocalizedMessageOrExceptionName(e);
- String message = localizedMessage + (cause != null ? "\nCause: " + getLocalizedMessageOrExceptionName(cause) : "");
- createErrorMessage(target, message);
+ String message = localizedMessage + (cause != null ? "\n" + getMessageFromBundle(CAUSE) + getLocalizedMessageOrExceptionName(cause) : "");
+ createMessage(target, message, getErrorSeverity());
}
private String getLocalizedMessageOrExceptionName(Throwable e)
@@ -68,14 +90,14 @@
String localizedMessage = e.getLocalizedMessage();
if (localizedMessage == null)
{
- localizedMessage = "An unexpected error occured: " + e.getClass().getName();
+ localizedMessage = getMessageFromBundle(UNEXPECTED_ERROR) + e.getClass().getName();
}
return localizedMessage;
}
protected void createInfoMessage(String target, String message)
{
- createMessage(target, message, getInfoSeverity());
+ createLocalizedMessage(target, message, getInfoSeverity());
}
protected void createInfoMessage(String message)
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2008-06-06 17:41:24 UTC (rev 10938)
@@ -56,6 +56,14 @@
private String wsdl;
private transient RegistrationInfo expectedRegistrationInfo;
+ private static final String CANNOT_FIND_CONSUMER = "bean_consumer_cannot_find_consumer";
+ private static final String CANNOT_UPDATE_CONSUMER = "bean_consumer_cannot_update_consumer";
+ private static final String CANNOT_REFRESH_CONSUMER = "bean_consumer_cannot_refresh_consumer";
+ private static final String MODIFY_REG_SUCCESS = "bean_consumer_modify_reg_success";
+ private static final String INVALID_MODIFY = "bean_consumer_invalid_modify";
+ private static final String CANNOT_MODIFY_REG = "bean_consumer_cannot_modify_reg";
+ private static final String CANNOT_ERASE_REG = "bean_consumer_cannot_erase_reg";
+ private static final String MALFORMED_URL = "bean_consumer_malformed_url";
public ConsumerBean()
{
@@ -125,7 +133,7 @@
}
else
{
- beanContext.createErrorMessage("Couldn't find consumer '" + id + "'!");
+ beanContext.createErrorMessage(CANNOT_FIND_CONSUMER, id);
}
}
}
@@ -319,7 +327,7 @@
return ConsumerManagerBean.CONFIGURE_CONSUMER;
}
- beanContext.createErrorMessage("Couldn't update Consumer!");
+ beanContext.createErrorMessage(CANNOT_UPDATE_CONSUMER);
return null;
}
@@ -347,7 +355,7 @@
return ConsumerManagerBean.CONFIGURE_CONSUMER;
}
- beanContext.createErrorMessage("Couldn't refresh Consumer!");
+ beanContext.createErrorMessage(CANNOT_REFRESH_CONSUMER);
return null;
}
@@ -394,7 +402,7 @@
registrationLocallyModified = false;
- beanContext.createInfoMessage("Successfully modified Registration!");
+ beanContext.createInfoMessage(MODIFY_REG_SUCCESS);
}
catch (Exception e)
{
@@ -410,11 +418,11 @@
}
else
{
- beanContext.createErrorMessage("Invalid attempt to modify a Registration that hasn't been locally modified!");
+ beanContext.createErrorMessage(INVALID_MODIFY);
}
}
- beanContext.createErrorMessage("Couldn't modify Registration!");
+ beanContext.createErrorMessage(CANNOT_MODIFY_REG);
return null;
}
@@ -426,7 +434,7 @@
return ConsumerManagerBean.CONFIGURE_CONSUMER;
}
- beanContext.createErrorMessage("Couldn't erase local Registration!");
+ beanContext.createErrorMessage(CANNOT_ERASE_REG);
return null;
}
@@ -443,7 +451,7 @@
}
catch (MalformedURLException e)
{
- beanContext.createErrorMessage(target, "'" + newValue + "' is not a valid URL: " + e.getLocalizedMessage());
+ beanContext.createErrorMessage(target, MALFORMED_URL, newValue, e.getLocalizedMessage());
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2008-06-06 17:41:24 UTC (rev 10938)
@@ -49,6 +49,8 @@
static final String CONFIGURE_CONSUMER = "configureConsumer";
static final String CONSUMERS = "consumers";
static final String EXPECTED_REG_INFO_KEY = "expectedRegistrationInfo";
+ private static final String NO_CONSUMER = "bean_consumermanager_no_consumer";
+ private static final String INVALID_NEW_CONSUMER_NAME = "bean_consumermanager_invalid_new_consumer_name";
public ConsumerRegistry getRegistry()
{
@@ -167,7 +169,7 @@
}
else
{
- beanContext.createErrorMessage("Need a non-null, non-empty name for the new Consumer");
+ beanContext.createErrorMessage(INVALID_NEW_CONSUMER_NAME);
return null;
}
}
@@ -254,7 +256,7 @@
registry.deactivateConsumerWith(consumer.getProducerId());
}
- beanContext.createInfoMessage(result.getStatus());
+ beanContext.createMessage(BeanContext.STATUS, result.getStatus(), beanContext.getInfoSeverity()); // todo: localize status!
}
return result;
}
@@ -319,6 +321,6 @@
private void noSelectedConsumerError()
{
- beanContext.createErrorMessage("No Consumer was selected!");
+ beanContext.createErrorMessage(NO_CONSUMER);
}
}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/JSFBeanContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/JSFBeanContext.java 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/JSFBeanContext.java 2008-06-06 17:41:24 UTC (rev 10938)
@@ -25,6 +25,7 @@
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
+import java.util.Locale;
import java.util.Map;
/**
@@ -65,4 +66,9 @@
{
return FacesMessage.SEVERITY_INFO;
}
+
+ protected Locale getLocale()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2008-06-06 17:41:24 UTC (rev 10938)
@@ -104,7 +104,7 @@
}
else
{
- return "RegistrationPolicy unset";
+ return beanContext.getMessageFromBundle("bean_producer_regpolicy_unset");
}
}
@@ -181,7 +181,7 @@
catch (Exception e)
{
log.debug(e);
- beanContext.createErrorMessage("status", "Couldn't save producer configuration. Cause: " + e.getLocalizedMessage());
+ beanContext.createErrorMessage(BeanContext.STATUS, "bean_producer_cannot_save", e.getLocalizedMessage());
}
return PRODUCER;
}
@@ -195,7 +195,7 @@
catch (Exception e)
{
log.debug(e);
- beanContext.createErrorMessage("status", "Couldn't reload producer configuration. Cause: " + e.getLocalizedMessage());
+ beanContext.createErrorMessage(BeanContext.STATUS, "bean_producer_cannot_reload", e.getLocalizedMessage());
}
return PRODUCER;
}
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-06-06 17:41:24 UTC (rev 10938)
@@ -20,26 +20,33 @@
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA #
# 02110-1301 USA, or see the FSF site: http://www.fsf.org. #
################################################################################
+
+## WSRP GUI localization
+
# JBoss Portal display information
org.jboss.portal.object.name.WSRPConfigurationPortlet = WSRP Configuration
org.jboss.portal.instance.name.WSRPConfigurationPortletInstance = WSRP Configuration Portlet
+# Tabs
nav_tabs_consumers = Consumers Configuration
nav_tabs_producer_config = Producer Configuration
nav_tabs_producer_management = Producer Management
+# Object path in consumer template
path_consumers_root = Consumers
path_consumers_consumer = Consumer ''{0}'' configuration
path_consumers_active = active
path_consumers_inactive = inactive
path_consumers_refreshNeeded = (refresh needed)
+# Confirm deletion of a consumer screen
confirm_delete_consumer_title = Delete ''{0}'' consumer?
confirm_delete_consumer_message = You are about to delete the ''{0}'' consumer!
confirm_detete_consumer_proceed = Are you sure you want to proceed?
confirm_delete_consumer_submit = Delete consumer
confirm_delete_consumer_cancel = Cancel
+# Confirm deletion of local registration information screen
confirm_delete_registration_title = Delete local registration for ''{0}'' consumer?
confirm_delete_registration_message = You are about to delete the local registration information for the ''{0}'' consumer! \n\
This is only needed if this consumer had previously registered with the remote producer and this producer \n\
@@ -51,10 +58,12 @@
confirm_delete_registration_submit = Erase local registration
confirm_delete_registration_cancel = Cancel
+# Consumers screen
consumers_title = Manage Consumers
consumers_create_title = Create a consumer named:
consumers_create_submit = Create Consumer
+# Consumers list
consumers_table_column_consumer = Consumer
consumers_table_column_consumer_status = status:
consumers_table_column_actions = Actions
@@ -66,6 +75,7 @@
consumers_table_action_deregister = Deregister
consumers_table_action_delete = Delete
+# Consumer editing screen
edit_consumer_producer = Producer id:
edit_consumer_cache = Cache expiration:
edit_consumer_cache_seconds = (seconds before expiration)
@@ -90,6 +100,58 @@
edit_consumer_registration_context_handle = Handle:
edit_consumer_registration_context_erase = Erase local registration
edit_consumer_registration_context_erase_title = Erase local registration information (potentially dangerous!)
-edit_consumer_refresh = Refresh & Save
+edit_consumer_refresh = Refresh & Save
edit_consumer_refresh_title = Save changes and refresh information from producer
edit_consumer_cancel = Cancel
+
+# Confirm registration property deletion screen
+confirm_delete_reg_property_title = Delete ''{0}'' registration property description?
+confirm_delete_reg_property_message = You are about to delete the ''{0}'' registration property description! \n\
+This will trigger invalidation of consumer registrations which will have to modify their registration \n\
+information.
+confirm_detete_reg_property_proceed = Are you sure you want to proceed?
+confirm_delete_reg_property_submit = Delete property
+confirm_delete_reg_property_cancel = Cancel
+
+# Producer configuration screen
+producer_config_title = Producer configuration
+producer_config_sd_requires_reg = Access to full service description requires consumers to be registered.
+producer_config_strict = Use strict WSRP compliance.
+producer_config_requires_reg = Requires registration. Modifying this information will trigger invalidation of consumer registrations.
+producer_config_reg_policy = Registration policy class name:
+producer_config_reg_prop_validator = Registration property validator class name:
+producer_config_reg_props = Registration properties
+producer_config_reg_prop_name = Name
+producer_config_reg_prop_type = Type
+producer_config_reg_prop_label = Label
+producer_config_reg_prop_hint = Hint
+producer_config_reg_prop_action = Action
+producer_config_reg_prop_remove = Remove
+producer_config_no_reg_props = No specified required registration properties.
+producer_config_add_reg_prop = Add property
+producer_config_save = Save
+producer_config_cancel = Cancel
+
+## Localized messages in JSF beans
+
+bean_support_unexpected_error = An unexpected error occured:
+bean_support_cause = Cause:
+
+# ConsumerBean
+bean_consumer_cannot_find_consumer = Couldn't find consumer ''{0}''!
+bean_consumer_cannot_update_consumer = Couldn't update consumer!
+bean_consumer_cannot_refresh_consumer = Couldn't refresh consumer!
+bean_consumer_modify_reg_success = Successfully modified registration!
+bean_consumer_invalid_modify = Invalid attempt to modify a registration that hasn't been locally modified!
+bean_consumer_cannot_modify_reg = Couldn't modify registration!
+bean_consumer_cannot_erase_reg = Couldn't erase local registration!
+bean_consumer_malformed_url = ''{0}'' is not a valid URL: {1}
+
+# ConsumerManagerBean
+bean_consumermanager_invalid_new_consumer_name = Need a non-null, non-empty name for the new consumer!
+bean_consumermanager_no_consumer = No consumer was selected!
+
+# ProducerBean
+bean_producer_regpolicy_unset = RegistrationPolicy unset
+bean_producer_cannot_save = Couldn't save producer configuration. Cause: {0}
+bean_producer_cannot_reload = Couldn't reload producer configuration. Cause: {0}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-06-06 17:41:24 UTC (rev 10938)
@@ -75,7 +75,7 @@
edit_consumer_prop_desc=Description
edit_consumer_prop_name=Nom
edit_consumer_prop_value=Valeur
-edit_consumer_refresh=Rafra\u00eechir & Sauvegarder
+edit_consumer_refresh=Rafra\u00eechir & Sauvegarder
edit_consumer_refresh_title=Sauvegarde des changements et rafra\u00eechissement \u00e0 partir du producteur
edit_consumer_registration=Information d'enregistrement:
edit_consumer_registration_context=Contexte d'enregistrement:
@@ -87,4 +87,43 @@
edit_consumer_registration_modify=Modifier l'enregistrement
edit_consumer_registration_modify_title=Modifier l'enregistrement avec ce producteur
edit_consumer_registration_no_props=Enregistrement indiqu\u00e9 sans besoin de propri\u00e9t\u00e9s d'enregistrement
-edit_consumer_registration_update_props=Mettre les propri\u00e9t\u00e9s \u00e0 jour
\ No newline at end of file
+edit_consumer_registration_update_props=Mettre les propri\u00e9t\u00e9s \u00e0 jour
+bean_consumer_cannot_erase_reg=L'effacement de l'enregistrement n'a pu \u00eatre effectu\u00e9!
+bean_consumer_cannot_find_consumer=Le consommateur ''{0}'' n'a pu \u00eatre trouv\u00e9!
+bean_consumer_cannot_modify_reg=La modification de l'enregistrement n'a pu \u00eatre effectu\u00e9e!
+bean_consumer_cannot_refresh_consumer=Le rafra\u00eechissement du consommateur n'a pu \u00eatre effectu\u00e9!
+bean_consumer_cannot_update_consumer=La mise \u00e0 jour du consommateur n'a pu \u00eatre effectu\u00e9e!
+bean_consumer_invalid_modify=Tentative invalide de modification d'enregistrement sans modifications locales.
+bean_consumer_malformed_url=''{0}'' n'est pas une URL valide: {1}
+bean_consumer_modify_reg_success=Enregistrement modifi\u00e9!
+bean_support_cause=Cause:
+bean_support_unexpected_error=Une erreur inattendue s'est produite:
+bean_consumermanager_invalid_new_consumer_name=Un consommateur requiert un nom non-nul et non-vide!
+bean_consumermanager_no_consumer=Aucun consommateur n'a \u00e9t\u00e9 s\u00e9lectionn\u00e9!
+bean_producer_cannot_reload=Le rechargement de la configuration du producteur a \u00e9chou\u00e9. Cause: {0}
+bean_producer_cannot_save=La sauvegarde de la configuration du producteur a \u00e9chou\u00e9. Cause: {0}
+bean_producer_regpolicy_unset=RegistrationPolicy non sp\u00e9cifi\u00e9e
+confirm_delete_reg_property_cancel=Annuler
+confirm_delete_reg_property_message=Vous \u00eates sur le point d'effacer la description de la propri\u00e9t\u00e9 d'enregistrement ''{0}''! \n\
+Cel\u00e0 va entra\u00eener l'invalidation des enregistrements des consommateurs qui devront alors modifier \n\
+leur information d'enregistrement.
+confirm_delete_reg_property_submit=Effacer la propri\u00e9t\u00e9
+confirm_delete_reg_property_title=Voulez-vous r\u00e9ellement effacer la description de la propri\u00e9t\u00e9 d'enregistrement ''{0}''?
+confirm_detete_reg_property_proceed=\u00cates-vous certains de vouloir proc\u00e9der?
+producer_config_add_reg_prop=Ajouter une propri\u00e9t\u00e9
+producer_config_cancel=Annuler
+producer_config_no_reg_props=Aucune propri\u00e9t\u00e9 d'enregistrement sp\u00e9cifi\u00e9e.
+producer_config_reg_policy=Nom de la classe de la politique d'enregistrement:
+producer_config_reg_prop_action=Action
+producer_config_reg_prop_hint=Indice
+producer_config_reg_prop_label=\u00c9tiquette
+producer_config_reg_prop_name=Nom
+producer_config_reg_prop_remove=Enlever
+producer_config_reg_prop_type=Type
+producer_config_reg_prop_validator=Nom de la classe de validation des propri\u00e9t\u00e9s d'enregistrement:
+producer_config_reg_props=Propri\u00e9t\u00e9s d'enregistrement
+producer_config_requires_reg=N\u00e9cessite l'enregistrement. Modifier cette information entra\u00eene l'invalidation des enregistrements consommateurs.
+producer_config_save=Sauvegarder
+producer_config_sd_requires_reg=L'acc\u00e8s \u00e0 la description compl\u00e8te des services requiert l'enregistrement.
+producer_config_strict=Utiliser la validation WSRP stricte.
+producer_config_title=Configuration producteur
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/confirmDeleteConsumer.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/confirmDeleteConsumer.xhtml 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/confirmDeleteConsumer.xhtml 2008-06-06 17:41:24 UTC (rev 10938)
@@ -20,7 +20,7 @@
<p class="portlet-msg-alert">
<h:outputFormat value="#{i18n.confirm_delete_consumer_message}">
<f:param value="#{consumersMgr.selectedConsumer.producerId}"/>
- </h:outputFormat>
+ </h:outputFormat>
</p>
<p class="portlet-class">#{i18n.confirm_detete_consumer_proceed}</p>
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/management/managementTemplate.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/management/managementTemplate.xhtml 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/management/managementTemplate.xhtml 2008-06-06 17:41:24 UTC (rev 10938)
@@ -7,9 +7,9 @@
<ui:define name="topnav">
<h:form>
<ul class="topnav">
- <li><h:commandLink action="consumers" value="Consumers Configuration"/></li>
- <li><h:commandLink action="producer" value="Producer Configuration"/></li>
- <li id="currentTab">Producer Management</li>
+ <li><h:commandLink action="consumers" value="#{i18n.nav_tabs_consumers}"/></li>
+ <li><h:commandLink action="producer" value="#{i18n.nav_tabs_producer_config}"/></li>
+ <li id="currentTab">#{i18n.nav_tabs_producer_management}</li>
</ul>
</h:form>
</ui:define>
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/confirmPropDeletion.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/confirmPropDeletion.xhtml 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/confirmPropDeletion.xhtml 2008-06-06 17:41:24 UTC (rev 10938)
@@ -11,22 +11,26 @@
<div class="portlet-msg">
<div class="portlet-msg-icon"><h:graphicImage url="/img/msgIcon_Warning.gif" alt="/!\"/></div>
<div class="portlet-msg-body">
- <h3>Delete '#{producer.selectedPropertyName}' registration property description?</h3>
+ <h3>
+ <h:outputFormat value="#{i18n.confirm_delete_reg_property_title}">
+ <f:param value="#{producer.selectedPropertyName}"/>
+ </h:outputFormat>
+ </h3>
<p class="portlet-msg-alert">
- You are about to delete the '#{producer.selectedPropertyName}' registration property description!
- This will trigger invalidation of consumer registrations which will have to modify their registration
- information.
+ <h:outputFormat value="#{i18n.confirm_delete_reg_property_message}">
+ <f:param value="#{producer.selectedPropertyName}"/>
+ </h:outputFormat>
</p>
- <p class="portlet-class">Are you sure you want to proceed?</p>
+ <p class="portlet-class">#{i18n.confirm_delete_reg_property_proceed}</p>
<h:form>
- <h:commandButton value="Delete" action="#{producer.deleteRegistrationProperty}"
+ <h:commandButton value="#{i18n.confirm_delete_reg_property_submit}" action="#{producer.deleteRegistrationProperty}"
styleClass="portlet-form-button portlet-section-buttonrow"/>
- <h:commandButton value="Cancel" action="producer"
+ <h:commandButton value="#{i18n.confirm_delete_reg_property_cancel}" action="producer"
styleClass="portlet-form-button portlet-section-buttonrow"/>
- </h:form>
+ </h:form>
</div>
</div>
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producer.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producer.xhtml 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producer.xhtml 2008-06-06 17:41:24 UTC (rev 10938)
@@ -4,30 +4,29 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core">
- <ui:param name="title" value="Producer configuration"/>
+ <ui:param name="title" value="#{i18n.producer_config_title}"/>
<ui:define name="content">
<h:form>
<h:panelGrid columns="2" width="100%">
<h:selectBooleanCheckbox value="#{producer.registrationRequiredForFullDescription}"/>
- <h:outputText value="Access to full service description requires consumers to be registered."/>
+ <h:outputText value="#{i18n.producer_config_sd_requires_reg}"/>
<h:selectBooleanCheckbox value="#{producer.strictMode}"/>
- <h:outputText value="Use strict WSRP compliance."/>
+ <h:outputText value="#{i18n.producer_config_strict}"/>
<h:selectBooleanCheckbox value="#{producer.registrationRequired}" immediate="true"
onchange="this.form.submit()"
valueChangeListener="#{producer.requireRegistrationListener}"/>
- <h:outputText
- value="Requires registration. Modifying this information will trigger invalidation of consumer registrations."/>
+ <h:outputText value="#{i18n.producer_config_requires_reg}"/>
<h:outputText value=" " rendered="#{producer.registrationRequired}"/>
<h:panelGroup rendered="#{producer.registrationRequired}">
<h:panelGrid columns="2" width="100%">
- <h:outputLabel value="Registration policy class name:" for="registrationPolicy"/>
+ <h:outputLabel value="#{i18n.producer_config_reg_policy}" for="registrationPolicy"/>
<h:inputText id="registrationPolicy" value="#{producer.registrationPolicyClassName}" size="80"/>
- <h:outputLabel value="Registration property validator class name:" for="validator"
+ <h:outputLabel value="#{i18n.producer_config_reg_prop_validator}" for="validator"
rendered="#{producer.defaultRegistrationPolicy}"/>
<h:inputText id="validator" value="#{producer.validatorClassName}" size="80"
rendered="#{producer.defaultRegistrationPolicy}"/>
@@ -37,7 +36,7 @@
<h:outputText value=" " rendered="#{producer.registrationRequired}"/>
<h:panelGroup rendered="#{producer.registrationRequired}">
- <h:outputText styleClass="portlet-area-header" value="Registration properties"/>
+ <h:outputText styleClass="portlet-area-header" value="#{i18n.producer_config_reg_props}"/>
<h:panelGroup styleClass="portlet-area-body">
<c:choose>
<c:when test="#{!empty producer.registrationProperties}">
@@ -46,26 +45,26 @@
rendered="#{producer.registrationRequired}"
headerClass="portlet-section-header">
<h:column>
- <f:facet name="header">Name</f:facet>
+ <f:facet name="header">#{i18n.producer_config_reg_prop_name}</f:facet>
<h:inputText value="#{property.nameAsString}" size="30"/>
</h:column>
<h:column>
- <f:facet name="header">Type</f:facet>
+ <f:facet name="header">#{i18n.producer_config_reg_prop_type}</f:facet>
<h:selectOneListbox disabled="true">
<f:selectItems value="#{producer.supportedPropertyTypes}"/>
</h:selectOneListbox>
</h:column>
<h:column>
- <f:facet name="header">Label</f:facet>
+ <f:facet name="header">#{i18n.producer_config_reg_prop_label}</f:facet>
<h:inputText value="#{property.label}" size="50"/>
</h:column>
<h:column>
- <f:facet name="header">Hint</f:facet>
+ <f:facet name="header">#{i18n.producer_config_reg_prop_hint}</f:facet>
<h:inputText value="#{property.hint}" size="50"/>
</h:column>
<h:column>
- <f:facet name="header">Action</f:facet>
- <h:commandLink action="confirmPropDeletion" value="Remove"
+ <f:facet name="header">#{i18n.producer_config_reg_prop_action}</f:facet>
+ <h:commandLink action="confirmPropDeletion" value="#{i18n.producer_config_reg_prop_remove}"
styleClass="portlet-form-button"
actionListener="#{producer.selectProperty}">
<f:param name="propName" value="#{property.nameAsString}"/>
@@ -74,18 +73,18 @@
</h:dataTable>
</c:when>
<c:otherwise>
- <h:outputText value="No specified required registration properties."/>
+ <h:outputText value="#{i18n.producer_config_no_reg_props}"/>
</c:otherwise>
</c:choose>
- <h:commandLink action="#{producer.addRegistrationProperty}" value="Add property"
+ <h:commandLink action="#{producer.addRegistrationProperty}" value="#{i18n.producer_config_add_reg_prop}"
styleClass="portlet-form-button"/>
</h:panelGroup>
</h:panelGroup>
<h:outputText value=" "/>
<h:panelGroup styleClass="portlet-section-buttonrow">
- <h:commandButton action="#{producer.save}" value="Save" styleClass="portlet-form-button"/>
- <h:commandButton action="#{producer.reloadConfiguration}" value="Cancel"
+ <h:commandButton action="#{producer.save}" value="#{i18n.producer_config_save}" styleClass="portlet-form-button"/>
+ <h:commandButton action="#{producer.reloadConfiguration}" value="#{i18n.producer_config_cancel}"
styleClass="portlet-form-button"/>
</h:panelGroup>
</h:panelGrid>
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producerTemplate.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producerTemplate.xhtml 2008-06-06 17:05:14 UTC (rev 10937)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producerTemplate.xhtml 2008-06-06 17:41:24 UTC (rev 10938)
@@ -7,10 +7,10 @@
<ui:define name="topnav">
<h:form>
<ul class="topnav">
- <li><h:commandLink action="consumers" value="Consumers Configuration"/></li>
- <li id="currentTab">Producer Configuration</li>
+ <li><h:commandLink action="consumers" value="#{i18n.nav_tabs_consumers}"/></li>
+ <li id="currentTab">#{i18n.nav_tabs_producer_config}</li>
<ui:remove>
- <li><h:commandLink value="Producer Management" action="management"/></li>
+ <li><h:commandLink value="#{i18n.nav_tabs_producer_management}" action="management"/></li>
</ui:remove>
</ul>
</h:form>
17 years, 11 months
JBoss Portal SVN: r10937 - branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-06-06 13:05:14 -0400 (Fri, 06 Jun 2008)
New Revision: 10937
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
Log:
- Oops: use window.getName() instead of getId()...
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2008-06-06 16:22:38 UTC (rev 10936)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2008-06-06 17:05:14 UTC (rev 10937)
@@ -145,7 +145,7 @@
// check that the portlet associated with the window is deployed by delegating to the navigational state which
// in turn delegates to ControllerPortletControllerContext which knows the windows which are available
- String windowName = window.getId().toString();
+ String windowName = window.getName();
Window realWindow = pageNavigationalState.getWindow(windowName);
if(realWindow == null)
{
17 years, 11 months
JBoss Portal SVN: r10936 - in branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core: controller/portlet and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-06-06 12:22:38 -0400 (Fri, 06 Jun 2008)
New Revision: 10936
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/CustomizationManagerService.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
Log:
- Implemented acquireResources in RenderWindowCommand to fail fast if resource associated with window is not available.
Otherwise, e.g. if the associated portlet was not deployed, it would cause an NPE in InternalContentProvider.
- Minor improvements.
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2008-06-06 14:02:22 UTC (rev 10935)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2008-06-06 16:22:38 UTC (rev 10936)
@@ -197,7 +197,7 @@
if (user == null)
{
- PortalURL portalURL = null;
+ PortalURL portalURL;
String configNamespace = config.getProperty("core.login.namespace");
if (loginNamespace == null)
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-06-06 14:02:22 UTC (rev 10935)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-06-06 16:22:38 UTC (rev 10936)
@@ -22,21 +22,20 @@
******************************************************************************/
package org.jboss.portal.core.controller.portlet;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.navstate.NavigationalStateContext;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.portlet.info.NavigationInfo;
import org.jboss.portal.portlet.info.ParameterInfo;
import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.info.NavigationInfo;
-import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.core.navstate.NavigationalStateContext;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.PortalObjectId;
import javax.xml.namespace.QName;
-import java.util.Set;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
-import java.util.HashMap;
+import java.util.Set;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -375,4 +374,9 @@
//
pageUpdates.put(name, REMOVAL);
}
+
+ public Window getWindow(String windowName)
+ {
+ return controllerContext.getWindow(windowName);
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java 2008-06-06 14:02:22 UTC (rev 10935)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java 2008-06-06 16:22:38 UTC (rev 10936)
@@ -122,8 +122,6 @@
{
log.debug("Couldn't find a ContentProvider for content type '" + contentType + "'");
instanceId = null;
- // todo: this condition should bubble up, this would happen when trying to access a page referencing portlets
- // for which no content provider is deployed (e.g. default page when cms is not deployed)
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/CustomizationManagerService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/CustomizationManagerService.java 2008-06-06 14:02:22 UTC (rev 10935)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/CustomizationManagerService.java 2008-06-06 16:22:38 UTC (rev 10936)
@@ -276,7 +276,7 @@
//
try
{
- Context dashboardContext = (Context)portalObjectContainer.getContext(dashboardContextId);
+ Context dashboardContext = portalObjectContainer.getContext(dashboardContextId);
//
dashboardPortal = dashboardContext.getPortal(userId);
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2008-06-06 14:02:22 UTC (rev 10935)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2008-06-06 16:22:38 UTC (rev 10936)
@@ -25,12 +25,14 @@
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.NoSuchResourceException;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.portlet.ControllerPageNavigationalState;
import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.core.controller.portlet.ControllerPageNavigationalState;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.command.WindowCommand;
import org.jboss.portal.core.model.portal.content.ContentRenderer;
import org.jboss.portal.core.model.portal.content.ContentRendererContext;
@@ -38,8 +40,8 @@
import org.jboss.portal.core.model.portal.content.WindowRendition;
import org.jboss.portal.core.model.portal.control.page.PageControlContext;
import org.jboss.portal.identity.User;
+import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import java.util.Map;
@@ -135,4 +137,20 @@
portal,
pageNavigationalState);
}
+
+ @Override
+ public void acquireResources() throws NoSuchResourceException
+ {
+ super.acquireResources();
+
+ // check that the portlet associated with the window is deployed by delegating to the navigational state which
+ // in turn delegates to ControllerPortletControllerContext which knows the windows which are available
+ String windowName = window.getId().toString();
+ Window realWindow = pageNavigationalState.getWindow(windowName);
+ if(realWindow == null)
+ {
+ log.debug("Resource associated with window '" + windowName + "' could not be found!");
+ throw new NoSuchResourceException(windowName);
+ }
+ }
}
17 years, 11 months