Author: julien(a)jboss.com
Date: 2008-06-26 08:44:23 -0400 (Thu, 26 Jun 2008)
New Revision: 11158
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/ContextNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PageNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNodeManager.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/WindowNode.java
Removed:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/ContextNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PageNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNodeManager.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/WindowNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/
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/ModelAdapter.java
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/content/PageContentContextImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/content/WindowContentContextImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/ModelImportTrigger.java
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java
Log:
rename object package to "node" package for better consistency
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-26
10:29:40 UTC (rev 11157)
+++
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-26
12:44:23 UTC (rev 11158)
@@ -131,7 +131,7 @@
</constructor>
</bean>
- <bean name="PortalNodeManager"
class="org.jboss.portal.presentation.portal.model.object.PortalNodeManager"/>
+ <bean name="PortalNodeManager"
class="org.jboss.portal.presentation.portal.model.node.PortalNodeManager"/>
<bean name="LayoutStore"
class="org.jboss.portal.presentation.portal.model.layout.LayoutStore"/>
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-26
10:29:40 UTC (rev 11157)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -23,10 +23,10 @@
package org.jboss.portal.presentation.portal;
import org.jboss.portal.presentation.client.PresentationClient;
-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.node.PortalNode;
+import org.jboss.portal.presentation.portal.model.node.WindowNode;
+import org.jboss.portal.presentation.portal.model.node.PageNode;
+import org.jboss.portal.presentation.portal.model.node.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.layout.SimpleElement;
import org.jboss.portal.presentation.portal.model.content.PageContentContextImpl;
import org.jboss.portal.presentation.impl.state.structural.adapter.StructuralAdapter;
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-26
10:29:40 UTC (rev 11157)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -31,10 +31,10 @@
import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
import org.jboss.portal.presentation.portal.model.layout.LayoutItem;
import org.jboss.portal.presentation.portal.model.layout.SimpleElement;
-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.portal.model.node.PortalNodeManager;
+import org.jboss.portal.presentation.portal.model.node.PortalNode;
+import org.jboss.portal.presentation.portal.model.node.PageNode;
+import org.jboss.portal.presentation.portal.model.node.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;
Modified:
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 2008-06-26
10:29:40 UTC (rev 11157)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -33,9 +33,9 @@
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.portal.model.node.PortalNode;
+import org.jboss.portal.presentation.portal.model.node.PageNode;
+import org.jboss.portal.presentation.portal.model.node.WindowNode;
import org.jboss.portal.presentation.model.layout.Constants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/content/PageContentContextImpl.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/content/PageContentContextImpl.java 2008-06-26
10:29:40 UTC (rev 11157)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/content/PageContentContextImpl.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -24,9 +24,9 @@
import org.jboss.portal.presentation.portal.content.PageContentContext;
import org.jboss.portal.presentation.portal.content.WindowContentContext;
-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.portal.model.node.PageNode;
+import org.jboss.portal.presentation.portal.model.node.PortalNode;
+import org.jboss.portal.presentation.portal.model.node.WindowNode;
import java.util.Collection;
import java.util.Map;
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/content/WindowContentContextImpl.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/content/WindowContentContextImpl.java 2008-06-26
10:29:40 UTC (rev 11157)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/content/WindowContentContextImpl.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -25,7 +25,7 @@
import org.jboss.portal.presentation.portal.content.WindowContentContext;
import org.jboss.portal.presentation.portal.content.PageContentContext;
import org.jboss.portal.presentation.portal.content.Content;
-import org.jboss.portal.presentation.portal.model.object.WindowNode;
+import org.jboss.portal.presentation.portal.model.node.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/node
(from rev 11001,
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object)
Deleted:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/ContextNode.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/ContextNode.java 2008-06-12
15:06:46 UTC (rev 11001)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/ContextNode.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -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.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/node/ContextNode.java
(from rev 11157,
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/node/ContextNode.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/ContextNode.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -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.node;
+
+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;
+ }
+}
Deleted:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PageNode.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PageNode.java 2008-06-12
15:06:46 UTC (rev 11001)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PageNode.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -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.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/node/PageNode.java
(from rev 11157,
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/node/PageNode.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PageNode.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.node;
+
+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
+{
+
+ public PageNode(String name, PortalNodeManager structuralStateContext)
+ {
+ super(name, structuralStateContext);
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return UIPage.class;
+ }
+}
Deleted:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNode.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNode.java 2008-06-12
15:06:46 UTC (rev 11001)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNode.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -1,244 +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.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/node/PortalNode.java
(from rev 11157,
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/node/PortalNode.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNode.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -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.node;
+
+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);
+ }
+ }
+}
Deleted:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNodeManager.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PortalNodeManager.java 2008-06-12
15:06:46 UTC (rev 11001)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNodeManager.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -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.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/node/PortalNodeManager.java
(from rev 11157,
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/node/PortalNodeManager.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNodeManager.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -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.node;
+
+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/node/WindowNode.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/WindowNode.java 2008-06-12
15:06:46 UTC (rev 11001)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/WindowNode.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -1,63 +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.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.ui.UIWindow;
-import org.jboss.portal.presentation.portal.content.Content;
-
-/**
- * @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 ContentImpl
- {
- public abstract String getType();
- }
-}
Copied:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/WindowNode.java
(from rev 11157,
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/WindowNode.java)
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/WindowNode.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/WindowNode.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.node;
+
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.portal.content.Content;
+
+/**
+ * @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 ContentImpl
+ {
+ public abstract String getType();
+ }
+}
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/ModelImportTrigger.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/ModelImportTrigger.java 2008-06-26
10:29:40 UTC (rev 11157)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/ModelImportTrigger.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -22,9 +22,9 @@
******************************************************************************/
package org.jboss.portal.presentation.portal.servlet;
-import org.jboss.portal.presentation.portal.model.object.PortalNodeManager;
+import org.jboss.portal.presentation.portal.model.node.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.ModelImporter;
-import org.jboss.portal.presentation.portal.model.object.ContextNode;
+import org.jboss.portal.presentation.portal.model.node.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-26
10:29:40 UTC (rev 11157)
+++
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java 2008-06-26
12:44:23 UTC (rev 11158)
@@ -31,11 +31,11 @@
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;
-import org.jboss.portal.presentation.portal.model.object.PortalNode;
-import org.jboss.portal.presentation.portal.model.object.PortalNodeManager;
-import org.jboss.portal.presentation.portal.model.object.WindowNode;
+import org.jboss.portal.presentation.portal.model.node.ContextNode;
+import org.jboss.portal.presentation.portal.model.node.PageNode;
+import org.jboss.portal.presentation.portal.model.node.PortalNode;
+import org.jboss.portal.presentation.portal.model.node.PortalNodeManager;
+import org.jboss.portal.presentation.portal.model.node.WindowNode;
import java.util.ArrayList;
import java.util.List;