JBoss Portal SVN: r9256 - branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-12-03 17:09:21 -0500 (Mon, 03 Dec 2007)
New Revision: 9256
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockModel.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java
Log:
better state encapsulation of MockeObjectImpl
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockModel.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockModel.java 2007-12-03 21:56:04 UTC (rev 9255)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockModel.java 2007-12-03 22:09:21 UTC (rev 9256)
@@ -64,21 +64,8 @@
{
MockObjectImpl object = universe.remove(objectId);
- // Remove children recursively
- for (String childId : new ArrayList<String>(object.children.keySet()))
- {
- destroy(childId);
- }
-
- // Detach from parent
- if (object.parent != null)
- {
- object.parent.children.remove(object.id);
- object.parent = null;
- }
-
- // We cannot use it anymore
- object.valid = false;
+ //
+ object.destroy();
}
MockObjectImpl createObject(MockObject.Type type, String name)
@@ -117,7 +104,7 @@
for (Map.Entry<String, String> entry : changes.entrySet())
{
String propertyName = entry.getKey();
- MockObject.UpdateBehavior behavior = object.propertyBehaviors.get(propertyName);
+ MockObject.UpdateBehavior behavior = object.getPropertyBehavior(propertyName);
if (behavior instanceof MockObject.Veto)
{
throw new StateChangeVetoException("Cannot modify non behavior property");
@@ -131,15 +118,7 @@
}
else
{
- String propertyValue = entry.getValue();
- if (propertyValue != null)
- {
- object.propertyValues.put(propertyName, propertyValue);
- }
- else
- {
- object.propertyValues.remove(propertyName);
- }
+ object.setPropertyValue(propertyName, entry.getValue());
}
}
}
@@ -149,7 +128,7 @@
StructuralObjectImpl mockStructuralObject = (StructuralObjectImpl)object;
MockObjectImpl mockObject = universe.get(mockStructuralObject.getId());
List<StructuralObject> tmp = new ArrayList<StructuralObject>();
- for (MockObjectImpl mockChild : mockObject.children.values())
+ for (MockObject mockChild : mockObject.getChildren())
{
tmp.add(mockChild.takeSnapshot());
}
@@ -160,7 +139,7 @@
{
StructuralObjectImpl mockStructuralObject = (StructuralObjectImpl)object;
MockObjectImpl mockObject = universe.get(mockStructuralObject.getId());
- return mockObject.parent.takeSnapshot();
+ return mockObject.getParent().takeSnapshot();
}
};
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObject.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObject.java 2007-12-03 21:56:04 UTC (rev 9255)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObject.java 2007-12-03 22:09:21 UTC (rev 9256)
@@ -29,6 +29,7 @@
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+import java.util.List;
import java.util.Set;
/**
@@ -109,6 +110,12 @@
Set<String> getPropertyNames();
MockObject addChild(String name, Type type);
+
+ MockObject getParent();
+
+ List<MockObject> getChildren();
boolean isValid();
+
+ StructuralObject takeSnapshot();
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java 2007-12-03 21:56:04 UTC (rev 9255)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java 2007-12-03 22:09:21 UTC (rev 9256)
@@ -24,9 +24,12 @@
import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
-import java.util.LinkedHashMap;
-import java.util.HashMap;
import java.util.Set;
/**
@@ -37,32 +40,35 @@
{
/** . */
- final MockObject.Type type;
+ private final MockObject.Type type;
/** . */
- final String name;
+ private final String name;
/** . */
- final String id;
+ private final String id;
/** . */
- final Map<String, String> propertyValues;
+ private final Map<String, String> propertyValues;
/** . */
- final Map<String, UpdateBehavior> propertyBehaviors;
+ private final Map<String, UpdateBehavior> propertyBehaviors;
/** . */
- final Map<String, MockObjectImpl> children;
+ private final LinkedHashMap<String, MockObjectImpl> children;
/** . */
- final MockModel model;
+ private final MockModel model;
/** . */
- MockObjectImpl parent;
+ private MockObjectImpl parent;
/** . */
- boolean valid;
+ private boolean valid;
+ /** The version id. */
+ int version;
+
MockObjectImpl(MockModel model, String name, MockObject.Type type, String id)
{
this.model = model;
@@ -73,6 +79,7 @@
this.propertyBehaviors = new HashMap<String, UpdateBehavior>();
this.id = id;
this.valid = true;
+ this.version = 0;
}
public MockObject.Type getType()
@@ -100,6 +107,16 @@
return propertyValues.get(propertyName);
}
+ public MockObject getParent()
+ {
+ return parent;
+ }
+
+ public List<MockObject> getChildren()
+ {
+ return Collections.unmodifiableList(new ArrayList<MockObject>(children.values()));
+ }
+
public MockObject addChild(String name, MockObject.Type type)
{
if (name == null)
@@ -164,10 +181,33 @@
{
propertyValues.remove(propertyName);
}
+
+ //
+ this.version++;
}
- StructuralObject takeSnapshot()
+ public StructuralObject takeSnapshot()
{
- return new StructuralObjectImpl(id, new StructuralStateImpl(type.clazz, name, new HashMap<String, String>(propertyValues)));
+ return new StructuralObjectImpl(id, version, new StructuralStateImpl(type.clazz, name, new HashMap<String, String>(propertyValues)));
}
+
+ void destroy()
+ {
+ // Remove children recursively
+ for (String childId : new ArrayList<String>(children.keySet()))
+ {
+ model.destroy(childId);
+ }
+
+ // Detach from parent
+ if (parent != null)
+ {
+ parent.children.remove(id);
+ parent = null;
+ }
+
+ // We cannot use it anymore
+ valid = false;
+ }
+
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java 2007-12-03 21:56:04 UTC (rev 9255)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java 2007-12-03 22:09:21 UTC (rev 9256)
@@ -33,14 +33,18 @@
{
/** . */
- private final String id;
+ final String id;
/** . */
+ final int version;
+
+ /** . */
private final StructuralStateImpl state;
- public StructuralObjectImpl(String id, StructuralStateImpl state)
+ public StructuralObjectImpl(String id, int version, StructuralStateImpl state)
{
this.id = id;
+ this.version = version;
this.state = state;
}
16 years, 5 months
JBoss Portal SVN: r9255 - in branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model: state and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-12-03 16:56:04 -0500 (Mon, 03 Dec 2007)
New Revision: 9255
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockModel.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.java
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java
Log:
clean up mock model implementation
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-12-03 21:36:09 UTC (rev 9254)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-12-03 21:56:04 UTC (rev 9255)
@@ -35,6 +35,8 @@
import org.jboss.portal.presentation.model.state.NoSuchStateException;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
import org.jboss.portal.presentation.model.state.structural.StructuralStateModification;
+import org.jboss.portal.presentation.test.model.state.structural.MockModel;
+import org.jboss.portal.presentation.test.model.state.structural.MockObject;
import java.util.Collections;
import java.util.List;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java 2007-12-03 21:36:09 UTC (rev 9254)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java 2007-12-03 21:56:04 UTC (rev 9255)
@@ -27,6 +27,7 @@
import org.jboss.portal.presentation.impl.model.UIContextImpl;
import org.jboss.portal.presentation.impl.model.state.navigational.NavigationalStateContextImpl;
import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.test.model.state.structural.MockModel;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockModel.java (from rev 9252, branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java)
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockModel.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockModel.java 2007-12-03 21:56:04 UTC (rev 9255)
@@ -0,0 +1,166 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.test.model.state.structural;
+
+import org.jboss.portal.presentation.model.state.NoSuchStateException;
+import org.jboss.portal.presentation.model.state.StateChangeVetoException;
+import org.jboss.portal.presentation.model.state.StateException;
+import org.jboss.portal.presentation.model.state.structural.AbstractStructuralStateContext;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class MockModel
+{
+
+ /** . */
+ private int generator = 0;
+
+ /** . */
+ private final Map<String, MockObjectImpl> universe = new HashMap<String, MockObjectImpl>();
+
+ /** . */
+ private final MockObjectImpl root = createObject(MockObject.Type.CONTEXT, "");
+
+ public StructuralStateContext getStructuralStateContext()
+ {
+ return structuralStateContext;
+ }
+
+ public MockObject getRoot()
+ {
+ return root;
+ }
+
+ public void destroy(String objectId)
+ {
+ MockObjectImpl object = universe.remove(objectId);
+
+ // Remove children recursively
+ for (String childId : new ArrayList<String>(object.children.keySet()))
+ {
+ destroy(childId);
+ }
+
+ // Detach from parent
+ if (object.parent != null)
+ {
+ object.parent.children.remove(object.id);
+ object.parent = null;
+ }
+
+ // We cannot use it anymore
+ object.valid = false;
+ }
+
+ MockObjectImpl createObject(MockObject.Type type, String name)
+ {
+ MockObjectImpl mockObject = new MockObjectImpl(this, name, type, "" + generator++);
+ universe.put(mockObject.getId(), mockObject);
+ return mockObject;
+ }
+
+ private final StructuralStateContext structuralStateContext = new AbstractStructuralStateContext()
+ {
+ public StructuralObject load(String objectId) throws IllegalArgumentException
+ {
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ MockObjectImpl object = universe.get(objectId);
+ return object != null ? object.takeSnapshot() : null;
+ }
+
+ public String getRootId()
+ {
+ return root.getId();
+ }
+
+ public void update(StructuralObject structuralObject, Map<String, String> changes) throws StateChangeVetoException
+ {
+ MockObjectImpl object = universe.get(structuralObject.getId());
+ if (object == null)
+ {
+ throw new NoSuchStateException();
+ }
+
+ //
+ for (Map.Entry<String, String> entry : changes.entrySet())
+ {
+ String propertyName = entry.getKey();
+ MockObject.UpdateBehavior behavior = object.propertyBehaviors.get(propertyName);
+ if (behavior instanceof MockObject.Veto)
+ {
+ throw new StateChangeVetoException("Cannot modify non behavior property");
+ }
+ else if (behavior instanceof MockObject.Failure)
+ {
+ MockObject.Failure failure = (MockObject.Failure)behavior;
+ failure.throwAs(IllegalArgumentException.class).
+ throwAs(StateChangeVetoException.class).
+ throwAs(StateException.class);
+ }
+ else
+ {
+ String propertyValue = entry.getValue();
+ if (propertyValue != null)
+ {
+ object.propertyValues.put(propertyName, propertyValue);
+ }
+ else
+ {
+ object.propertyValues.remove(propertyName);
+ }
+ }
+ }
+ }
+
+ public List<StructuralObject> loadChildren(StructuralObject object)
+ {
+ StructuralObjectImpl mockStructuralObject = (StructuralObjectImpl)object;
+ MockObjectImpl mockObject = universe.get(mockStructuralObject.getId());
+ List<StructuralObject> tmp = new ArrayList<StructuralObject>();
+ for (MockObjectImpl mockChild : mockObject.children.values())
+ {
+ tmp.add(mockChild.takeSnapshot());
+ }
+ return tmp;
+ }
+
+ public StructuralObject loadParent(StructuralObject object)
+ {
+ StructuralObjectImpl mockStructuralObject = (StructuralObjectImpl)object;
+ MockObjectImpl mockObject = universe.get(mockStructuralObject.getId());
+ return mockObject.parent.takeSnapshot();
+ }
+ };
+}
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObject.java (from rev 9252, branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java)
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObject.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObject.java 2007-12-03 21:56:04 UTC (rev 9255)
@@ -0,0 +1,114 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.test.model.state.structural;
+
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIPage;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface MockObject
+{
+
+ /**
+ *
+ */
+ public enum Type
+ {
+
+ PORTAL(UIPortal.class), PAGE(UIPage.class), WINDOW(UIWindow.class), CONTEXT(UIContext.class);
+
+ /** . */
+ final Class<? extends UIObject> clazz;
+
+ Type(Class<? extends UIObject> clazz)
+ {
+ this.clazz = clazz;
+ }
+ }
+
+ public abstract static class UpdateBehavior
+ {
+ public static UpdateBehavior veto()
+ {
+ return new Veto();
+ }
+ public static UpdateBehavior failure(Throwable throwable)
+ {
+ return new Failure(throwable);
+ }
+ }
+
+ static class Veto extends UpdateBehavior
+ {
+ }
+
+ static class Failure extends UpdateBehavior
+ {
+
+ /** . */
+ final Throwable throwable;
+
+ public Failure(Throwable throwable)
+ {
+ this.throwable = throwable;
+ }
+
+ public <T extends Throwable> Failure throwAs(Class<T> type) throws T
+ {
+ if (type.isInstance(throwable))
+ {
+ throw type.cast(throwable);
+ }
+ return this;
+ }
+ }
+
+ Type getType();
+
+ String getName();
+
+ String getId();
+
+ String getPropertyValue(String propertyName);
+
+ void setPropertyBehavior(String propertyName, UpdateBehavior propertyBehavior);
+
+ UpdateBehavior getPropertyBehavior(String propertyName);
+
+ void setPropertyValue(String propertyName, String propertyValue);
+
+ Set<String> getPropertyNames();
+
+ MockObject addChild(String name, Type type);
+
+ boolean isValid();
+}
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java 2007-12-03 21:56:04 UTC (rev 9255)
@@ -0,0 +1,173 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.test.model.state.structural;
+
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class MockObjectImpl implements MockObject
+{
+
+ /** . */
+ final MockObject.Type type;
+
+ /** . */
+ final String name;
+
+ /** . */
+ final String id;
+
+ /** . */
+ final Map<String, String> propertyValues;
+
+ /** . */
+ final Map<String, UpdateBehavior> propertyBehaviors;
+
+ /** . */
+ final Map<String, MockObjectImpl> children;
+
+ /** . */
+ final MockModel model;
+
+ /** . */
+ MockObjectImpl parent;
+
+ /** . */
+ boolean valid;
+
+ MockObjectImpl(MockModel model, String name, MockObject.Type type, String id)
+ {
+ this.model = model;
+ this.name = name;
+ this.type = type;
+ this.children = new LinkedHashMap<String, MockObjectImpl>();
+ this.propertyValues = new HashMap<String, String>();
+ this.propertyBehaviors = new HashMap<String, UpdateBehavior>();
+ this.id = id;
+ this.valid = true;
+ }
+
+ public MockObject.Type getType()
+ {
+ return type;
+ }
+
+ public boolean isValid()
+ {
+ return valid;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getPropertyValue(String propertyName)
+ {
+ return propertyValues.get(propertyName);
+ }
+
+ public MockObject addChild(String name, MockObject.Type type)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (children.containsKey(name))
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ MockObjectImpl child = model.createObject(type, name);
+
+ //
+ child.parent = this;
+ children.put(child.id, child);
+
+ //
+ return child;
+ }
+
+ public Set<String> getPropertyNames()
+ {
+ return propertyValues.keySet();
+ }
+
+ public void setPropertyBehavior(String propertyName, UpdateBehavior propertyBehavior)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyBehavior != null)
+ {
+ propertyBehaviors.put(name, propertyBehavior);
+ }
+ else
+ {
+ propertyBehaviors.remove(name);
+ }
+ }
+
+ public UpdateBehavior getPropertyBehavior(String propertyName)
+ {
+ return propertyBehaviors.get(propertyName);
+ }
+
+ public void setPropertyValue(String propertyName, String propertyValue)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyValue != null)
+ {
+ propertyValues.put(propertyName, propertyValue);
+ }
+ else
+ {
+ propertyValues.remove(propertyName);
+ }
+ }
+
+ StructuralObject takeSnapshot()
+ {
+ return new StructuralObjectImpl(id, new StructuralStateImpl(type.clazz, name, new HashMap<String, String>(propertyValues)));
+ }
+}
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java 2007-12-03 21:56:04 UTC (rev 9255)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.test.model.state.structural;
+
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class StructuralObjectImpl implements StructuralObject
+{
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final StructuralStateImpl state;
+
+ public StructuralObjectImpl(String id, StructuralStateImpl state)
+ {
+ this.id = id;
+ this.state = state;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public StructuralState getState()
+ {
+ return state;
+ }
+}
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.java 2007-12-03 21:56:04 UTC (rev 9255)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.test.model.state.structural;
+
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.model.UIObject;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class StructuralStateImpl implements StructuralState
+{
+
+ /** . */
+ private final Class<? extends UIObject> type;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ public StructuralStateImpl(Class<? extends UIObject> type, String name, Map<String, String> 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, String> getProperties()
+ {
+ return properties;
+ }
+}
16 years, 5 months
JBoss Portal SVN: r9254 - in branches/JBoss_Portal_Branch_2_6: wsrp/src/resources/portal-wsrp-sar/conf/producer and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-12-03 16:36:09 -0500 (Mon, 03 Dec 2007)
New Revision: 9254
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/wsrp-object.xml
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/conf/producer/config.xml
Log:
- Overwrite WSRP page definition as window and portlet instance names have changed since 2.6.2.
- Revert to use registration by default as in 2.6.2.
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/wsrp-object.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/wsrp-object.xml 2007-12-03 21:26:41 UTC (rev 9253)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/wsrp-object.xml 2007-12-03 21:36:09 UTC (rev 9254)
@@ -28,7 +28,7 @@
<deployments>
<deployment>
<parent-ref>admin</parent-ref>
- <if-exists>keep</if-exists>
+ <if-exists>overwrite</if-exists>
<page>
<page-name>WSRP</page-name>
<properties>
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/conf/producer/config.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/conf/producer/config.xml 2007-12-03 21:26:41 UTC (rev 9253)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/conf/producer/config.xml 2007-12-03 21:36:09 UTC (rev 9254)
@@ -25,11 +25,12 @@
"http://www.jboss.org/portal/dtd/jboss-wsrp-producer_2_6.dtd">
<!-- Configuration using registration with default registration property validator. -->
-<!--<producer-configuration>
+<producer-configuration>
<registration-configuration fullServiceDescriptionRequiresRegistration="true">
- <registration-property-validator>org.jboss.portal.registration.policies.DefaultRegistrationPropertyValidator</registration-property-validator>
+ <registration-property-validator>org.jboss.portal.registration.policies.DefaultRegistrationPropertyValidator
+ </registration-property-validator>
</registration-configuration>
-</producer-configuration>-->
+</producer-configuration>
-<!-- Configuration without registration -->
- <producer-configuration/>
\ No newline at end of file
+ <!-- Configuration without registration -->
+ <!--<producer-configuration/>-->
\ No newline at end of file
16 years, 5 months
JBoss Portal SVN: r9253 - branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-12-03 16:26:41 -0500 (Mon, 03 Dec 2007)
New Revision: 9253
Modified:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java
Log:
dead code removal
Modified: branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java
===================================================================
--- branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java 2007-12-03 21:24:24 UTC (rev 9252)
+++ branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java 2007-12-03 21:26:41 UTC (rev 9253)
@@ -82,22 +82,7 @@
return null;
}
- // Parent Id
-// String parentId = null;
-// if(portalObject.getParent() != null)
-// {
-// parentId = portalObject.getParent().getId().toString();
-// }
-//
-// //Children Ids
-// List<String> childrenIds = new ArrayList<String>();
-// Collection children = portalObject.getChildren();
-// for(Iterator itr=children.iterator(); itr.hasNext();)
-// {
-// PortalObject child = (PortalObject)itr.next();
-// childrenIds.add(child.getId().toString());
-// }
-
+ //
return new StructuralObjectImpl(portalObject);
}
16 years, 5 months
JBoss Portal SVN: r9252 - in branches/presentation: presentation/src/main/org/jboss/portal/presentation/impl/model and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-12-03 16:24:24 -0500 (Mon, 03 Dec 2007)
New Revision: 9252
Added:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralObjectImpl.java
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralObject.java
Removed:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectList.java
Modified:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralState.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
Log:
- remove direct usage of structural ids in the ui model and replace it with StructuralObject which allows the structural context implementation to add information in addition of the id to make stale state detection during an structural state operation
Added: branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralObjectImpl.java
===================================================================
--- branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralObjectImpl.java (rev 0)
+++ branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralObjectImpl.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.presentation.model;
+
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralObjectImpl implements StructuralObject
+{
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final StructuralStateImpl state;
+
+ public StructuralObjectImpl(PortalObject portalObject)
+ {
+ this.id = portalObject.getId().toString();
+ this.state = new StructuralStateImpl(portalObject);
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public StructuralState getState()
+ {
+ return state;
+ }
+}
Modified: branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java
===================================================================
--- branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -22,32 +22,22 @@
******************************************************************************/
package org.jboss.portal.core.presentation.model;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.PortalObjectPath;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.presentation.model.UIObject;
-import org.jboss.portal.presentation.model.UIPage;
-import org.jboss.portal.presentation.model.UIPortal;
-import org.jboss.portal.presentation.model.UIWindow;
-import org.jboss.portal.presentation.model.state.structural.StructuralState;
-import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
-import org.jboss.portal.presentation.model.state.StateChangeVetoException;
+import org.jboss.portal.presentation.model.state.structural.AbstractStructuralStateContext;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
-public class StructuralStateContextImpl implements StructuralStateContext
+public class StructuralStateContextImpl extends AbstractStructuralStateContext
{
/**
*
@@ -81,99 +71,63 @@
/**
*
*/
- public StructuralState load(String objectId) throws IllegalArgumentException
+ public StructuralObject load(String objectId) throws IllegalArgumentException
{
- StructuralState structuralState = null;
-
// Get the PortalObject corresponding to this objectId from the PortalObjectContainer
- PortalObject portalObject = this.portalObjectContainer.getObject(PortalObjectId.parse(objectId,
- PortalObjectPath.CANONICAL_FORMAT));
+ PortalObject portalObject = this.portalObjectContainer.getObject(PortalObjectId.parse(objectId, PortalObjectPath.CANONICAL_FORMAT));
+ // Object by this id was not found in the Portal
if(portalObject == null)
{
- // Object by this id was not found in the Portal
return null;
}
- // Type
- Class<? extends UIObject> type = this.getType(portalObject);
-
- // Name
- String name = portalObject.getName();
-
- // Properties
- Map<String, String> properties = portalObject.getDeclaredProperties();
-
// Parent Id
- String parentId = null;
- if(portalObject.getParent() != null)
- {
- parentId = portalObject.getParent().getId().toString();
- }
+// String parentId = null;
+// if(portalObject.getParent() != null)
+// {
+// parentId = portalObject.getParent().getId().toString();
+// }
+//
+// //Children Ids
+// List<String> childrenIds = new ArrayList<String>();
+// Collection children = portalObject.getChildren();
+// for(Iterator itr=children.iterator(); itr.hasNext();)
+// {
+// PortalObject child = (PortalObject)itr.next();
+// childrenIds.add(child.getId().toString());
+// }
- //Children Ids
- List<String> childrenIds = new ArrayList<String>();
- Collection children = portalObject.getChildren();
- for(Iterator itr=children.iterator(); itr.hasNext();)
- {
- PortalObject child = (PortalObject)itr.next();
- childrenIds.add(child.getId().toString());
- }
-
- structuralState = new StructuralState(
- type, //type
- name,
- properties, //properties
- parentId,
- childrenIds // childrenIds
- );
-
- return structuralState;
+ return new StructuralObjectImpl(portalObject);
}
-
- /**
- *
- * @param portalObject
- * @return
- */
- private Class<? extends UIObject> getType(PortalObject portalObject)
+
+
+ public List<StructuralObject> loadChildren(StructuralObject object)
{
- Class<? extends UIObject> type = null;
-
- if(portalObject instanceof Portal)
+ // Get the PortalObject corresponding to this objectId from the PortalObjectContainer
+ PortalObject portalObject = this.portalObjectContainer.getObject(PortalObjectId.parse(object.getId(), PortalObjectPath.CANONICAL_FORMAT));
+
+ //
+ ArrayList<StructuralObject> children = new ArrayList<StructuralObject>();
+ for (PortalObject childObject : (Collection<PortalObject>)portalObject.getChildren())
{
- type = UIPortal.class;
+ children.add(new StructuralObjectImpl(childObject));
}
- else if(portalObject instanceof Page)
- {
- type = UIPage.class;
- }
- else if(portalObject instanceof Window)
- {
- type = UIWindow.class;
- }
-
- return type;
- }
- public String create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
- {
- throw new StateChangeVetoException();
+ //
+ return children;
}
- public void destroy(String objectId) throws StateChangeVetoException
+ public StructuralObject loadParent(StructuralObject object)
{
- throw new StateChangeVetoException();
- }
+ // Get the PortalObject corresponding to this objectId from the PortalObjectContainer
+ PortalObject portalObject = this.portalObjectContainer.getObject(PortalObjectId.parse(object.getId(), PortalObjectPath.CANONICAL_FORMAT));
- public void move(String objectId, String parentId) throws StateChangeVetoException
- {
- throw new StateChangeVetoException();
- }
+ //
+ PortalObject parent = portalObject.getParent();
- public void update(String objectId, Map<String, String> changes) throws StateChangeVetoException
- {
- throw new StateChangeVetoException();
+ //
+ return parent == null ? null : new StructuralObjectImpl(parent);
}
/**
Added: branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateImpl.java
===================================================================
--- branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateImpl.java (rev 0)
+++ branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateImpl.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.presentation.model;
+
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.UIPage;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Window;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralStateImpl implements StructuralState
+{
+
+ /** . */
+ private Class<? extends UIObject> type;
+
+ /** . */
+ private String name;
+
+ /** . */
+ private Map<String, String> properties;
+
+ StructuralStateImpl(PortalObject portalObject)
+ {
+ type = this.getType(portalObject);
+ portalObject.getName();
+ properties = portalObject.getDeclaredProperties();
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return type;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ /**
+ *
+ * @param portalObject
+ * @return
+ */
+ private Class<? extends UIObject> getType(PortalObject portalObject)
+ {
+ Class<? extends UIObject> type = null;
+
+ if(portalObject instanceof Portal)
+ {
+ type = UIPortal.class;
+ }
+ else if(portalObject instanceof Page)
+ {
+ type = UIPage.class;
+ }
+ else if(portalObject instanceof Window)
+ {
+ type = UIWindow.class;
+ }
+
+ return type;
+ }
+}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -26,6 +26,7 @@
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -34,17 +35,11 @@
public class UIContainerImpl extends UIObjectImpl implements UIContainer
{
- public UIContainerImpl(UIContextImpl context, String id, StructuralState state)
+ public UIContainerImpl(UIContextImpl context, StructuralObject object)
{
- super(context, id, state);
+ super(context, object);
}
- /**
- *
- * @param <T>
- * @param type
- * @return
- */
protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
{
boolean isAllowedAsChild = false;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -31,7 +31,7 @@
import org.jboss.portal.presentation.model.UIPortal;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.state.navigational.NavigationalStateContext;
-import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
import java.util.ArrayList;
@@ -43,11 +43,11 @@
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
-public class UIContextImpl extends UIObjectImpl implements UIContext
+public final class UIContextImpl extends UIObjectImpl implements UIContext
{
/** . */
- private final Map<String, UIObject> objects = new HashMap<String, UIObject>();
+ private final Map<String, UIObjectImpl> objects = new HashMap<String, UIObjectImpl>();
/** . */
protected final StructuralStateContext structuralStateContext;
@@ -58,13 +58,8 @@
/** . */
protected final List<ModelListener> listeners;
- private static String getRootId(StructuralStateContext loader)
+ private static StructuralObject getRootState(StructuralStateContext loader)
{
- return loader.getRootId();
- }
-
- private static StructuralState getRootState(StructuralStateContext loader)
- {
return loader.load(loader.getRootId());
}
@@ -72,7 +67,7 @@
StructuralStateContext structuralStateContext,
NavigationalStateContext navigationalStateContext)
{
- super(getRootId(structuralStateContext), getRootState(structuralStateContext));
+ super(getRootState(structuralStateContext));
//
this.structuralStateContext = structuralStateContext;
@@ -94,9 +89,8 @@
if (object == null)
{
//Fetch the state of the UIObject in question
- StructuralState structuralState = this.structuralStateContext.load(id);
- object = getImplementation(id, structuralState);
- objects.put(id, object);
+ StructuralObject structuralObject = this.structuralStateContext.load(id);
+ return loadObject(structuralObject);
}
return object;
}
@@ -120,27 +114,35 @@
}
}
- /**
- * @return
- */
- protected UIObject getImplementation(String id, StructuralState state) throws Exception
+ protected UIObjectImpl loadObject(StructuralObject structuralObject)
{
- Class type = state.getType();
+ UIObjectImpl object = objects.get(structuralObject.getId());
+ if (object == null)
+ {
+ object = getImplementation(structuralObject);
+ objects.put(structuralObject.getId(), object);
+ }
+ return object;
+ }
+
+ private UIObjectImpl getImplementation(StructuralObject state)
+ {
+ Class type = state.getState().getType();
if(type == UIPortal.class)
{
- return new UIPortalImpl(this, id, state);
+ return new UIPortalImpl(this, state);
}
else if(type == UIPage.class)
{
- return new UIPageImpl(this, id, state);
+ return new UIPageImpl(this, state);
}
else if(type == UIContainer.class)
{
- return new UIContainerImpl(this, id, state);
+ return new UIContainerImpl(this, state);
}
else if(type == UIWindow.class)
{
- return new UIWindowImpl(this, id, state);
+ return new UIWindowImpl(this, state);
}
else
{
@@ -148,12 +150,6 @@
}
}
- /**
- *
- * @param <T>
- * @param type
- * @return
- */
protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
{
boolean isAllowedAsChild = false;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -28,10 +28,11 @@
import org.jboss.portal.presentation.model.state.StateChangeEvent;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
import org.jboss.portal.presentation.model.state.navigational.NavigationalStateModification;
-import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
import org.jboss.portal.presentation.model.state.structural.StructuralStateModification;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -48,37 +49,43 @@
protected final UIContextImpl context;
/** . */
- protected final String id;
+ private List<UIObject> children;
/** . */
- protected final UIObjectList children;
+ private UIObjectImpl parent;
/** This is used to assist with data needed during lazy loading, other state related data etc... */
- private StructuralState state;
+ private StructuralObject structuralObject;
- public UIObjectImpl(UIContextImpl context, String id, StructuralState state)
+ public UIObjectImpl(UIContextImpl context, StructuralObject object)
{
- this.id = id;
- this.state = state;
+ this.structuralObject = object;
this.context = context;
- this.children = new UIObjectList(this.context, state.getChildrenIds());
+ this.children = null;
+ this.parent = null;
}
- public UIObjectImpl(String id, StructuralState state)
+ public UIObjectImpl(StructuralObject object)
{
- this.id = id;
- this.state = state;
+ this.structuralObject = object;
this.context = (UIContextImpl)this;
- this.children = new UIObjectList(this.context, state.getChildrenIds());
+ this.children = null;
+ this.parent = null;
}
+ protected final StructuralObject getStructuralObject()
+ {
+ return structuralObject;
+ }
+
//UIObject interface implementation-----------------------------------------------------------------------------------------------------------------------------
+
/**
*
*/
public String getId()
{
- return this.id;
+ return structuralObject.getId();
}
/**
@@ -129,10 +136,10 @@
switch (scopeType)
{
case NAVIGATIONAL:
- value = context.navigationalStateContext.get(id, propertyName);
+ value = context.navigationalStateContext.get(getId(), propertyName);
break;
case STRUCTURAL:
- value = state.getProperties().get(propertyName);
+ value = structuralObject.getState().getProperties().get(propertyName);
break;
default:
throw new AssertionError();
@@ -160,7 +167,7 @@
case NAVIGATIONAL:
{
NavigationalStateModification mod = new NavigationalStateModification(propertyName, propertyValue);
- StateChange<NavigationalStateModification> change = new StateChange<NavigationalStateModification>(id, mod);
+ StateChange<NavigationalStateModification> change = new StateChange<NavigationalStateModification>(getId(), mod);
// Have context process the change
context.navigationalStateContext.update(change);
@@ -178,16 +185,14 @@
changes.put(propertyName, (String)propertyValue);
// Have context process change
- context.structuralStateContext.update(id, changes);
+ context.structuralStateContext.update(structuralObject, changes);
// Update state locally to reflect correct state
- Map<String, String> updatedProperties = new HashMap<String, String>(state.getProperties());
- updateProperty(updatedProperties, propertyName, (String)propertyValue);
- state = new StructuralState(state.getType(), state.getName(), updatedProperties, state.getParentId(), state.getChildrenIds());
+ structuralObject = context.structuralStateContext.load(structuralObject.getId());
// Broadcast event
StructuralStateModification mod = new StructuralStateModification.Update(changes);
- StateChange<StructuralStateModification> change = new StateChange<StructuralStateModification>(id, mod);
+ StateChange<StructuralStateModification> change = new StateChange<StructuralStateModification>(getId(), mod);
StateChangeEvent event = new StateChangeEvent(change);
context.fireEvent(event);
}
@@ -202,18 +207,6 @@
}
}
- private <T> void updateProperty(Map<String, T> map, String propertyName, T propertyValue)
- {
- if (propertyValue == null)
- {
- map.remove(propertyName);
- }
- else
- {
- map.put(propertyName, propertyValue);
- }
- }
-
public UIObject getChild(String name)
{
for (UIObject child : getChildren())
@@ -231,23 +224,46 @@
*/
public String getName()
{
- return state.getName();
+ return structuralObject.getState().getName();
}
/**
*
*/
- public UIObject getParent()
+ public final UIObject getParent()
{
- return state.getParentId() != null ? context.getObject(state.getParentId()) : null;
+ if (this instanceof UIContextImpl)
+ {
+ return null;
+ }
+
+ //
+ if (parent == null)
+ {
+ StructuralObject parentStructuralState = context.structuralStateContext.loadParent(structuralObject);
+ parent = context.loadObject(parentStructuralState);
+ }
+
+ //
+ return parent;
}
/**
*
*/
- public List<UIObject> getChildren()
- {
- return this.children;
+ public final List<UIObject> getChildren()
+ {
+ if (children == null)
+ {
+ ArrayList<UIObject> tmp = new ArrayList<UIObject>();
+ for (StructuralObject structuralChild : context.structuralStateContext.loadChildren(structuralObject))
+ {
+ UIObjectImpl child = context.loadObject(structuralChild);
+ tmp.add(child);
+ }
+ return tmp;
+ }
+ return children;
}
/**
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectList.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectList.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectList.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -1,58 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.impl.model;
-
-import org.jboss.portal.presentation.model.UIObject;
-
-import java.util.AbstractList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class UIObjectList extends AbstractList<UIObject>
-{
-
- /** . */
- private final UIContextImpl context;
-
- /** . */
- private final List<String> ids;
-
- public UIObjectList(UIContextImpl context, List<String> ids)
- {
- this.context = context;
- this.ids = ids;
- }
-
- public UIObject get(int i)
- {
- return context.getObject(ids.get(i));
- }
-
- public int size()
- {
- return ids.size();
- }
-}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -27,6 +27,7 @@
import org.jboss.portal.presentation.model.UIPage;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -35,17 +36,11 @@
public class UIPageImpl extends UIObjectImpl implements UIPage
{
- public UIPageImpl(UIContextImpl context, String id, StructuralState state)
+ public UIPageImpl(UIContextImpl context, StructuralObject object)
{
- super(context, id, state);
+ super(context, object);
}
- /**
- *
- * @param <T>
- * @param type
- * @return
- */
protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
{
boolean isAllowedAsChild = false;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -26,6 +26,7 @@
import org.jboss.portal.presentation.model.UIPortal;
import org.jboss.portal.presentation.model.UIPage;
import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -34,24 +35,16 @@
public class UIPortalImpl extends UIObjectImpl implements UIPortal
{
- public UIPortalImpl(UIContextImpl context, String id, StructuralState state)
+ public UIPortalImpl(UIContextImpl context, StructuralObject object)
{
- super(context, id, state);
+ super(context, object);
}
- /**
- *
- * @param <T>
- * @param type
- * @return
- */
protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
{
boolean isAllowedAsChild = false;
- if(
- type == UIPage.class
- )
+ if(type == UIPage.class)
{
isAllowedAsChild = true;
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -28,6 +28,7 @@
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -36,9 +37,9 @@
public class UIWindowImpl extends UIObjectImpl implements UIWindow
{
- public UIWindowImpl(UIContextImpl context, String id, StructuralState state)
+ public UIWindowImpl(UIContextImpl context, StructuralObject object)
{
- super(context, id, state);
+ super(context, object);
}
/**
@@ -73,12 +74,6 @@
setProperty(StateScopeType.NAVIGATIONAL, "windowstate", windowState);
}
- /**
- *
- * @param <T>
- * @param type
- * @return
- */
protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
{
return false;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -23,9 +23,11 @@
package org.jboss.portal.presentation.model.state.structural;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
+import org.jboss.portal.presentation.model.state.StateException;
import org.jboss.portal.presentation.model.UIObject;
import java.util.Map;
+import java.util.List;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -34,22 +36,22 @@
public abstract class AbstractStructuralStateContext implements StructuralStateContext
{
- public String create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException
+ public String create(StructuralObject parent, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException, StateException, IllegalArgumentException
{
throw new StateChangeVetoException();
}
- public void destroy(String objectId) throws StateChangeVetoException
+ public void destroy(StructuralObject object) throws StateChangeVetoException, StateException, IllegalArgumentException
{
throw new StateChangeVetoException();
}
- public void move(String objectId, String parentId) throws StateChangeVetoException
+ public void move(StructuralObject object, StructuralObject parent) throws StateChangeVetoException, StateException, IllegalArgumentException
{
throw new StateChangeVetoException();
}
- public void update(String objectId, Map<String, String> changes) throws StateChangeVetoException
+ public void update(StructuralObject object, Map<String, String> changes) throws StateChangeVetoException, StateException, IllegalArgumentException
{
throw new StateChangeVetoException();
}
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralObject.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralObject.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralObject.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model.state.structural;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface StructuralObject
+{
+
+ String getId();
+
+ StructuralState getState();
+
+}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralState.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralState.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralState.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -24,9 +24,7 @@
import org.jboss.portal.presentation.model.UIObject;
-import java.io.Serializable;
import java.util.Map;
-import java.util.List;
/**
* The structural state.
@@ -34,55 +32,12 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class StructuralState implements Serializable
+public interface StructuralState
{
- /** . */
- private final Class<? extends UIObject> type;
+ Class<? extends UIObject> getType();
- /** . */
- private final String name;
+ String getName();
- /** . */
- private final Map<String, String> properties;
-
- /** . */
- private final String parentId;
-
- /** . */
- private final List<String> childrenIds;
-
- public StructuralState(Class<? extends UIObject> type, String name, Map<String, String> properties, String parentId, List<String> childrenIds)
- {
- this.type = type;
- this.name = name;
- this.properties = properties;
- this.parentId = parentId;
- this.childrenIds = childrenIds;
- }
-
- public Class<? extends UIObject> getType()
- {
- return type;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Map<String, String> getProperties()
- {
- return properties;
- }
-
- public String getParentId()
- {
- return parentId;
- }
-
- public List<String> getChildrenIds()
- {
- return childrenIds;
- }
+ Map<String, String> getProperties();
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -24,7 +24,6 @@
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.state.NoSuchStateException;
-import org.jboss.portal.presentation.model.state.StateChange;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
import org.jboss.portal.presentation.model.state.StateException;
@@ -47,8 +46,12 @@
* @return the state of the object or null if such state does not exist
* @throws IllegalArgumentException if the object id argument is null
*/
- StructuralState load(String objectId) throws IllegalArgumentException;
+ StructuralObject load(String objectId) throws IllegalArgumentException;
+ List<StructuralObject> loadChildren(StructuralObject object);
+
+ StructuralObject loadParent(StructuralObject object);
+
/**
* Returns the id of the root object.
*
@@ -59,7 +62,7 @@
/**
* Create an object.
*
- * @param parentId the id of the parent object
+ * @param parent the parent
* @param type the type of the child
* @param name the name of the child
* @param properties the initial properties of the child
@@ -69,41 +72,41 @@
* @throws NoSuchStateException if the parent id does not point a valid state
* @throws IllegalArgumentException if an argument is null or not valid
*/
- String create(String parentId, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException, StateException, IllegalArgumentException;
+ String create(StructuralObject parent, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException, StateException, IllegalArgumentException;
/**
* Destroy a specified object.
*
- * @param objectId the object id to destroy
+ * @param object the object to destroy
* @throws StateChangeVetoException if the creation is vetoed
* @throws StateException a generic state exception
* @throws NoSuchStateException if the object id does not point a valid state
* @throws IllegalArgumentException if an argument is null or not valid
*/
- void destroy(String objectId) throws StateChangeVetoException, StateException, IllegalArgumentException;
+ void destroy(StructuralObject object) throws StateChangeVetoException, StateException, IllegalArgumentException;
/**
* Move an object to a new parent.
*
- * @param objectId the object id to move
- * @param parentId the id of the new parent
+ * @param object the object to move
+ * @param parent the new parent
* @throws StateChangeVetoException if the creation is vetoed
* @throws StateException a generic state exception
* @throws NoSuchStateException if the object id does not point a valid state
* @throws IllegalArgumentException if an argument is null or not valid
*/
- void move(String objectId, String parentId) throws StateChangeVetoException, StateException, IllegalArgumentException;
+ void move(StructuralObject object, StructuralObject parent) throws StateChangeVetoException, StateException, IllegalArgumentException;
/**
* Update the state of a specified object.
*
- * @param objectId the id of the object to udpate
+ * @param object the object to udpate
* @param changes the changes
* @throws StateChangeVetoException if the creation is vetoed
* @throws StateException a generic state exception
* @throws NoSuchStateException if the object id does not point a valid state
* @throws IllegalArgumentException if an argument is null or not valid
*/
- void update(String objectId, Map<String, String> changes) throws StateChangeVetoException, StateException, IllegalArgumentException;
+ void update(StructuralObject object, Map<String, String> changes) throws StateChangeVetoException, StateException, IllegalArgumentException;
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModel.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -22,16 +22,19 @@
******************************************************************************/
package org.jboss.portal.presentation.test.model;
+import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.state.NoSuchStateException;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
import org.jboss.portal.presentation.model.state.StateException;
import org.jboss.portal.presentation.model.state.structural.AbstractStructuralStateContext;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
import org.jboss.portal.presentation.model.state.structural.StructuralState;
import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -53,7 +56,7 @@
private final StructuralStateContext structuralStateContext = new AbstractStructuralStateContext()
{
- public StructuralState load(String objectId) throws IllegalArgumentException
+ public StructuralObject load(String objectId) throws IllegalArgumentException
{
if (objectId == null)
{
@@ -68,9 +71,9 @@
return root.id;
}
- public void update(String objectId, Map<String, String> changes) throws StateChangeVetoException
+ public void update(StructuralObject structuralObject, Map<String, String> changes) throws StateChangeVetoException
{
- MockObjectImpl object = universe.get(objectId);
+ MockObjectImpl object = universe.get(((MockStructuralObject)structuralObject).getId());
if (object == null)
{
throw new NoSuchStateException();
@@ -106,6 +109,25 @@
}
}
}
+
+ public List<StructuralObject> loadChildren(StructuralObject object)
+ {
+ MockStructuralObject mockStructuralObject = (MockStructuralObject)object;
+ MockObjectImpl mockObject = universe.get(mockStructuralObject.id);
+ List<StructuralObject> tmp = new ArrayList<StructuralObject>();
+ for (MockObjectImpl mockChild : mockObject.children.values())
+ {
+ tmp.add(mockChild.takeSnapshot());
+ }
+ return tmp;
+ }
+
+ public StructuralObject loadParent(StructuralObject object)
+ {
+ MockStructuralObject mockStructuralObject = (MockStructuralObject)object;
+ MockObjectImpl mockObject = universe.get(mockStructuralObject.id);
+ return mockObject.parent.takeSnapshot();
+ }
};
public StructuralStateContext getStructuralStateContext()
@@ -207,14 +229,9 @@
return id;
}
- public StructuralState takeSnapshot()
+ public StructuralObject takeSnapshot()
{
- ArrayList<String> childrenIds = new ArrayList<String>();
- for (MockObjectImpl child : children.values())
- {
- childrenIds.add(child.id);
- }
- return new StructuralState(type.clazz, name, new HashMap<String, String>(propertyValues), parent != null ? parent.id : null, childrenIds);
+ return new MockStructuralObject(id, new MockStructuralState(type.clazz, name, new HashMap<String, String>(propertyValues)));
}
public String getPropertyValue(String propertyName)
@@ -275,4 +292,65 @@
}
}
}
+
+ public class MockStructuralState implements StructuralState
+ {
+
+ /** . */
+ private final Class<? extends UIObject> type;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ public MockStructuralState(Class<? extends UIObject> type, String name, Map<String, String> 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, String> getProperties()
+ {
+ return properties;
+ }
+ }
+
+ public class MockStructuralObject implements StructuralObject
+ {
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final MockStructuralState state;
+
+ public MockStructuralObject(String id, MockStructuralState state)
+ {
+ this.id = id;
+ this.state = state;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public StructuralState getState()
+ {
+ return state;
+ }
+ }
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockObject.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -28,6 +28,7 @@
import org.jboss.portal.presentation.model.UIPortal;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
import java.util.Set;
@@ -115,5 +116,5 @@
*
* @return the state snapshot
*/
- StructuralState takeSnapshot();
+ StructuralObject takeSnapshot();
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-12-03 18:47:21 UTC (rev 9251)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-12-03 21:24:24 UTC (rev 9252)
@@ -142,6 +142,12 @@
assertTrue(pageChildren == null || pageChildren.size() == 0);
}*/
+ public void testUIContextParentIsNull()
+ {
+ UIContext context = createContext();
+ assertEquals(null, context.getParent());
+ }
+
public void testSetPropertyThrowsIAE()
{
UIContext context = createContext();
16 years, 5 months
JBoss Portal SVN: r9251 - modules/identity/trunk/identity/src/test/resources.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-12-03 13:47:21 -0500 (Mon, 03 Dec 2007)
New Revision: 9251
Modified:
modules/identity/trunk/identity/src/test/resources/jboss-unit.xml
Log:
- leave only local ldap for now in tests
Modified: modules/identity/trunk/identity/src/test/resources/jboss-unit.xml
===================================================================
--- modules/identity/trunk/identity/src/test/resources/jboss-unit.xml 2007-12-03 18:46:29 UTC (rev 9250)
+++ modules/identity/trunk/identity/src/test/resources/jboss-unit.xml 2007-12-03 18:47:21 UTC (rev 9251)
@@ -26,9 +26,9 @@
<parameter name="directoryName">
<value>OpenDS</value>
- <value>Sun DS</value>
- <value>RedHatDS</value>
- <value>OpenLDAP</value>
+ <!--<value>Sun DS</value>-->
+ <!--<value>RedHatDS</value>-->
+ <!--<value>OpenLDAP</value>-->
</parameter>
<test>
@@ -72,8 +72,8 @@
<parameter name="directories" value="datasources/directories-staticrolemembership.xml"/>
<parameter name="directoryName">
<value>OpenDS</value>
- <value>Sun DS</value>
- <value>RedHatDS</value>
+ <!--<value>Sun DS</value>-->
+ <!--<value>RedHatDS</value>-->
</parameter>
</test>
16 years, 5 months
JBoss Portal SVN: r9250 - modules/identity/trunk/identity.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-12-03 13:46:29 -0500 (Mon, 03 Dec 2007)
New Revision: 9250
Modified:
modules/identity/trunk/identity/pom.xml
Log:
- commented out to much...
Modified: modules/identity/trunk/identity/pom.xml
===================================================================
--- modules/identity/trunk/identity/pom.xml 2007-12-03 18:24:30 UTC (rev 9249)
+++ modules/identity/trunk/identity/pom.xml 2007-12-03 18:46:29 UTC (rev 9250)
@@ -199,10 +199,10 @@
<tasks>
<!--<echo>JBOSS_HOME=${JBOSS_HOME}</echo>-->
- <!--<property name="compile_classpath" refid="maven.compile.classpath"/>-->
- <!--<property name="runtime_classpath" refid="maven.runtime.classpath"/>-->
- <!--<property name="test_classpath" refid="maven.test.classpath"/>-->
- <!--<property name="plugin_classpath" refid="maven.plugin.classpath"/>-->
+ <property name="compile_classpath" refid="maven.compile.classpath"/>
+ <property name="runtime_classpath" refid="maven.runtime.classpath"/>
+ <property name="test_classpath" refid="maven.test.classpath"/>
+ <property name="plugin_classpath" refid="maven.plugin.classpath"/>
<property name="jboss_home" value="${JBOSS_HOME}"/>
16 years, 5 months
JBoss Portal SVN: r9249 - in modules/identity/trunk: identity and 7 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-12-03 13:24:30 -0500 (Mon, 03 Dec 2007)
New Revision: 9249
Added:
modules/identity/trunk/identity/build.xml
modules/identity/trunk/identity/src/test/resources/hibernate/test-domain.hbm.xml
Removed:
modules/identity/trunk/identity/src/test/resources/hibernate/domain.hbm.xml
Modified:
modules/identity/trunk/build/pom.xml
modules/identity/trunk/identity/pom.xml
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/IdentityConfiguration.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLoginModule.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModule.java
modules/identity/trunk/identity/src/test/resources/config/standardidentity-config.xml
modules/identity/trunk/identity/src/test/resources/jboss-unit.xml
modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/db-beans.xml
modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/ldap-beans.xml
Log:
- sync recent updates from branch 1.0
- convert testsuite to run using antrun plugin
Modified: modules/identity/trunk/build/pom.xml
===================================================================
--- modules/identity/trunk/build/pom.xml 2007-12-03 18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/build/pom.xml 2007-12-03 18:24:30 UTC (rev 9249)
@@ -175,6 +175,15 @@
<enabled>false</enabled>
</releases>
</repository>
+ <repository>
+ <id>repository.codehaus.org</id>
+ <name>Codehaus Repository</name>
+ <layout>default</layout>
+ <url>http://repository.codehaus.org</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
</repositories>
<pluginRepositories>
<pluginRepository>
@@ -258,6 +267,12 @@
</dependency>
<dependency>
<groupId>org.jboss.unit</groupId>
+ <artifactId>opends</artifactId>
+ <version>${version.jboss.portal.test}</version>
+ <type>sar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit-mc</artifactId>
<version>${version.jboss.portal.test}</version>
</dependency>
@@ -271,8 +286,12 @@
<artifactId>jboss-unit-tooling-maven2</artifactId>
<version>${version.jboss.portal.test}</version>
</dependency>
-
<dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-ant</artifactId>
+ <version>${version.jboss.portal.test}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>
@@ -284,12 +303,12 @@
<artifactId>jboss-kernel</artifactId>
<version>${version.jboss.microcontainer}</version>
</dependency>
+ <!--<dependency>-->
+ <!--<groupId>cargo</groupId>-->
+ <!--<artifactId>core</artifactId>-->
+ <!--<version>${version.cargo}</version>-->
+ <!--</dependency>-->
<dependency>
- <groupId>cargo</groupId>
- <artifactId>core</artifactId>
- <version>${version.cargo}</version>
- </dependency>
- <dependency>
<groupId>sun-opends</groupId>
<artifactId>opends-core</artifactId>
<version>${version.sun.opends}</version>
Added: modules/identity/trunk/identity/build.xml
===================================================================
--- modules/identity/trunk/identity/build.xml (rev 0)
+++ modules/identity/trunk/identity/build.xml 2007-12-03 18:24:30 UTC (rev 9249)
@@ -0,0 +1,153 @@
+<?xml version="1.0"?>
+<project name="identity-test" xmlns:artifact="urn:maven-artifact-ant">
+
+ <target name="test">
+
+ <!--<property name="jboss_home" value="/home/bdaw/Workshop/JBoss/server/jboss-4.2.1.GA"/>-->
+ <echo message="JBOSS_HOME= ${jboss_home}"/>
+
+ <!--<echo message="compile classpath: ${compile_classpath}"/>-->
+ <!--<echo message="runtime classpath: ${runtime_classpath}"/>-->
+ <!--<echo message="test classpath: ${test_classpath}"/>-->
+ <!--<echo message="plugin classpath: ${plugin_classpath}"/>-->
+
+ <mkdir dir="target/jboss-unit"/>
+ <get src="http://www.apache.org/dist/maven/binaries/maven-ant-tasks-2.0.7.jar" dest="./target/jboss-unit/maven-ant-tasks.jar"/>
+ <path id="maven-ant-tasks.classpath" path="target/jboss-unit/maven-ant-tasks.jar" />
+ <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
+ classpathref="maven-ant-tasks.classpath" />
+
+ <ant>
+ <target name="deploy-opends"/>
+ </ant>
+
+ <ant>
+ <target name="cargo.jboss-4.2.start"/>
+ </ant>
+
+ <ant>
+ <target name="jboss-unit"/>
+ </ant>
+
+ <ant>
+ <target name="cargo.jboss-4.2.stop"/>
+ </ant>
+
+ <ant>
+ <target name="undeploy-opends"/>
+ </ant>
+
+ </target>
+
+ <target name="deploy-opends">
+
+ <artifact:dependencies pathId="opends.classpath" filesetId="opends.fileset">
+ <dependency groupId="org.jboss.unit" artifactId="opends"
+ version="1.1.0-SNAPSHOT" type="sar"/>
+ </artifact:dependencies>
+
+ <echo>Preparing OpenDS files</echo>
+
+ <!--Copy whole fileset with dependencies-->
+ <copy todir="target/jboss-unit/tmp">
+ <fileset refid="opends.fileset"/>
+ <mapper type="flatten" />
+ </copy>
+
+ <!--Filterout opends.sar-->
+ <echo>Copying OpenDS service archive to: ${jboss_home}/server/default/deploy</echo>
+ <copy todir="${jboss_home}/server/default/deploy/">
+ <fileset dir="target/jboss-unit/tmp">
+ <include name="opends-*.sar"/>
+ </fileset>
+ <mapper type="flatten" />
+ </copy>
+
+ <echo>Copying OpenDS configuration files to: ${jboss_home}/server/default/conf/</echo>
+ <copy todir="${jboss_home}/server/default/conf/opends">
+ <fileset dir="./src/test/resources/opends"/>
+ </copy>
+
+ <delete dir="target/jboss-unit/tmp" failonerror="false" deleteonexit="true" quiet="true"/>
+
+ </target>
+
+ <target name="undeploy-opends">
+ <echo>Removing OpenDS configuration files from: ${jboss_home}/server/default/conf/opends</echo>
+ <delete dir="${jboss_home}/server/default/conf/opends" failonerror="false" deleteonexit="true" quiet="true"/>
+
+ <echo>Removing OpenDS service archive from: ${jboss_home}/server/default/deploy/opends.sar</echo>
+ <delete file="${jboss_home}/server/default/deploy/opends-*.sar" failonerror="false" deleteonexit="true" quiet="true"/>
+
+ </target>
+
+ <target name="cargo.setup">
+
+ <property name="cargo.log.dir" value="target/cargo-logs"/>
+ <mkdir dir="${cargo.log.dir}"/>
+ <taskdef resource="cargo.tasks">
+ <classpath>
+ <pathelement path="${plugin_classpath}"/>
+ </classpath>
+ </taskdef>
+
+ </target>
+
+
+
+ <target name="cargo.jboss-4.2.start" depends="cargo.setup">
+
+ <!--output="${cargo.log.dir}/cargo.identity.server.log"-->
+ <!--log="${cargo.log.dir}/cargo.identity.shutdown.log"-->
+ <cargo
+ containerId="jboss42x"
+ home="${jboss_home}"
+ action="start"
+ wait="false">
+ <sharedClasspath>
+ <!-- Empty but need to be present because of a bug in our patch for cargo-->
+ </sharedClasspath>
+ <configuration>
+ <property name="cargo.servlet.port" value="8080"/>
+ <property name="cargo.logging" value="high"/>
+ </configuration>
+ </cargo>
+ </target>
+
+ <target name="cargo.jboss-4.2.stop" depends="cargo.setup">
+
+ <!--log="${cargo.log.dir}/cargo.identity.startup.log"-->
+ <cargo
+ containerId="jboss42x"
+ home="${jboss_home}"
+
+ action="stop">
+ <configuration>
+ <property name="cargo.rmi.port" value="1099"/>
+ </configuration>
+ </cargo>
+ </target>
+
+
+ <target name="jboss-unit">
+ <taskdef name="jboss-unit" classname="org.jboss.unit.tooling.ant.JBossUnitTask" classpath="${test_classpath}"/>
+ <jboss-unit>
+ <tests config="src/test/resources/jboss-unit.xml" suiteName="IdentityTests">
+ <!--<include keywords="DB,generic"/>-->
+ </tests>
+
+ <reports>
+ <xml toDir="target/jboss-unit/reports/xml"/>
+ <html toDir="target/jboss-unit/reports/html"/>
+ </reports>
+
+ <classpath>
+ <pathelement path="${test_classpath}"/>
+ </classpath>
+
+ </jboss-unit>
+
+ </target>
+
+
+</project>
\ No newline at end of file
Modified: modules/identity/trunk/identity/pom.xml
===================================================================
--- modules/identity/trunk/identity/pom.xml 2007-12-03 18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/identity/pom.xml 2007-12-03 18:24:30 UTC (rev 9249)
@@ -32,124 +32,124 @@
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jbosssx</artifactId>
</dependency>
+
<dependency>
<groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.unit</groupId>
+ <artifactId>opends</artifactId>
+ <type>sar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit-mc</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-ant</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
<artifactId>portal-test</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
- <!--<dependency>-->
- <!--<groupId>org.jboss.unit</groupId>-->
- <!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
- <!--<scope>test</scope>-->
- <!--</dependency>-->
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-logging-spi</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-logging-jdk</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-logging-log4j</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jboss-transaction</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jboss-local-jdbc</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jboss-common-jdbc-wrapper</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jboss</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jnpserver</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>jboss.jbossas.core-libs</groupId>
<artifactId>jboss-jca</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>apache-log4j</groupId>
<artifactId>log4j</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>apache-logging</groupId>
<artifactId>commons-logging</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>apache-collections</groupId>
<artifactId>commons-collections</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
- <!--<scope>test</scope>-->
+ <scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.jboss.unit</groupId>
- <artifactId>opends</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- <type>sar</type>
- <!--<scope>test</scope>-->
- </dependency>
- </dependencies>
+ </dependencies>
<build>
<plugins>
@@ -167,8 +167,6 @@
<requireProperty>
<property>JBOSS_HOME</property>
<message>"You must specify JBoss Application Server installation directory using -DJBOSS_HOME=... command line argument"</message>
- <!--<regex>"\d"</regex>-->
- <!--<regexMessage>"You must have a digit in your baseDir!"</regexMessage>-->
</requireProperty>
</rules>
<fail>true</fail>
@@ -176,35 +174,42 @@
</execution>
</executions>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>cargo</groupId>
+ <artifactId>cargo-ant</artifactId>
+ <version>0.9-portal</version>
+ </dependency>
+ <dependency>
+ <groupId>cargo</groupId>
+ <artifactId>cargo-core-uberjar</artifactId>
+ <version>0.9-portal</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
<executions>
<execution>
- <id>opends-confg-init</id>
- <phase>pre-integration-test</phase>
+ <id>test</id>
+ <phase>test</phase>
<configuration>
- <tasks >
- <echo>Copying OpenDS configuration files to: ${env.JBOSS_HOME}/server/default/conf/</echo>
- <copy todir="${env.JBOSS_HOME}/server/default/conf/opends">
- <fileset dir="./src/test/resources/opends"/>
- </copy>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>opends-confg-remove</id>
- <phase>post-integration-test</phase>
- <configuration>
<tasks>
- <echo>Removing OpenDS configuration files from: ${env.JBOSS_HOME}/server/default/conf/opends</echo>
- <delete dir="${env.JBOSS_HOME}/server/default/conf/opends" failonerror="false" deleteonexit="true" quiet="true"/>
- <echo>Removing OpenDS service archive from: ${env.JBOSS_HOME}/server/default/deploy/opends.sar</echo>
- <delete dir="${env.JBOSS_HOME}/server/default/deploy/opends.sar" failonerror="false" deleteonexit="true" quiet="true"/>
+ <!--<echo>JBOSS_HOME=${JBOSS_HOME}</echo>-->
+ <!--<property name="compile_classpath" refid="maven.compile.classpath"/>-->
+ <!--<property name="runtime_classpath" refid="maven.runtime.classpath"/>-->
+ <!--<property name="test_classpath" refid="maven.test.classpath"/>-->
+ <!--<property name="plugin_classpath" refid="maven.plugin.classpath"/>-->
+
+ <property name="jboss_home" value="${JBOSS_HOME}"/>
+
+ <ant antfile="${basedir}/build.xml">
+ <target name="test"/>
+ </ant>
+
</tasks>
</configuration>
<goals>
@@ -213,92 +218,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.jboss.unit</groupId>
- <artifactId>opends</artifactId>
- <type>sar</type>
- <overWrite>true</overWrite>
- <outputDirectory>${env.JBOSS_HOME}/server/default/deploy</outputDirectory>
- <destFileName>opends.sar</destFileName>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <executions>
- <execution>
- <id>start-container</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>stop-container</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <container>
- <containerId>jboss4x</containerId>
- <home>${env.JBOSS_HOME}</home>
- </container>
- <wait>false</wait>
- <configuration>
- <type>existing</type>
- <home>${env.JBOSS_HOME}/server/default</home>
- <properties>
- <cargo.logging >high</cargo.logging>
- <cargo.jboss.configuration>default</cargo.jboss.configuration>
- <cargo.rmi.port>1099</cargo.rmi.port>
- </properties>
- </configuration>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jboss.unit</groupId>
- <artifactId>jboss-unit-tooling-maven2</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- <executions>
- <execution>
- <phase>integration-test</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <testsuites>
- <testsuite>
- <config>jboss-unit.xml</config>
- <!--<JPDA>true</JPDA>-->
- </testsuite>
- </testsuites>
- <reports>
- <xml>${basedir}/target/surefire-reports/xml</xml>
- <html>${basedir}/target/surefire-reports/html</html>
- </reports>
- </configuration>
- </plugin>
</plugins>
</build>
<properties>
Modified: modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/IdentityConfiguration.java
===================================================================
--- modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/IdentityConfiguration.java 2007-12-03 18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/IdentityConfiguration.java 2007-12-03 18:24:30 UTC (rev 9249)
@@ -69,6 +69,8 @@
public static final String USER_SEARCH_FILTER = "userSearchFilter";
+ public static final String USER_ALLOW_EMPTY_PASSWORDS = "allowEmptyPasswords";
+
//public static final String ROLE_CONTAINER_DN = "roleContainerDN";
public static final String ROLE_RID_ATTRIBUTE_ID = "ridAttributeID";
@@ -81,6 +83,8 @@
public static final String ROLE_CONTAINER_DN = ROLE_CONTEXT_DN;
+ public static final String ROLE_DEFAULT_ADMIN_ROLE = "defaultAdminRole";
+
public static final String MEMBERSHIP_ATTRIBUTE_ID = "membershipAttributeID";
public static final String MEMBERSHIP_ATTRIBUTE_IS_DN = "membershipAttributeIsDN";
Modified: modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLoginModule.java
===================================================================
--- modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLoginModule.java 2007-12-03 18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/SynchronizingLoginModule.java 2007-12-03 18:24:30 UTC (rev 9249)
@@ -65,8 +65,11 @@
protected String userProfileModuleJNDIName;
protected String preserveRoles;
+ private transient SimpleGroup userRoles = new SimpleGroup("Roles");
+ private transient String password;
+
private UserModule userModule;
private RoleModule roleModule;
private MembershipModule membershipModule;
@@ -76,6 +79,7 @@
{
super.initialize(subject, callbackHandler, sharedState, options);
+ password = null;
userModuleJNDIName = (String)options.get("userModuleJNDIName");
roleModuleJNDIName = (String)options.get("roleModuleJNDIName");
@@ -159,24 +163,26 @@
}
/**
- * We must implement this - just return "" - it's ok as we override validatePassword
+ * We must implement this
* @return
* @throws LoginException
*/
protected String getUsersPassword() throws LoginException
{
- return "";
+ return password;
}
/**
* This always returns true - so this module always pass.
- * @param string
+ * @param inputPassword
* @param string1
* @return
*/
- protected boolean validatePassword(String string, String string1)
+ protected boolean validatePassword(String inputPassword, String string1)
{
+ // Save the password for the synchro stuff
+ password = inputPassword;
return true;
}
@@ -188,12 +194,12 @@
protected Group[] getRoleSets() throws LoginException
{
- Group group = new SimpleGroup("Roles");
+ //Group group = new SimpleGroup("Roles");
if (additionalRole != null)
{
try
{
- group.addMember(createIdentity(additionalRole));
+ userRoles.addMember(createIdentity(additionalRole));
}
catch (Exception e)
{
@@ -201,7 +207,9 @@
log.error("Error when adding additional role: ", e);
}
}
- return new Group[]{group};
+
+ Group[] roleSets = {userRoles};
+ return roleSets;
}
@@ -237,8 +245,6 @@
{
try
{
-
-
User user = null;
//check if user exist
try
@@ -337,6 +343,7 @@
}
rolesToAssign.add(role);
+ userRoles.addMember(createIdentity(role.getName()));
}
}
}
@@ -346,6 +353,7 @@
try
{
rolesToAssign.add(getRoleModule().findRoleByName(defaultAssignedRole));
+ userRoles.addMember(createIdentity(defaultAssignedRole));
}
catch(Exception e)
{
@@ -363,6 +371,10 @@
if (presentRoles != null)
{
rolesToAssign.addAll(presentRoles);
+ for (Object presentRole : presentRoles)
+ {
+ userRoles.addMember(createIdentity(((Role)presentRole).getName()));
+ }
}
}
Modified: modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModule.java
===================================================================
--- modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-12-03 18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-12-03 18:24:30 UTC (rev 9249)
@@ -117,6 +117,12 @@
public boolean validatePassword(LDAPUserImpl ldapu, String password) throws IdentityException
{
+ // Depending on configuration reject authentication with empty password
+ if ((password == null || password.length() == 0) & !isAllowEmptyPasswords())
+ {
+ return false;
+ }
+
//will use user DN to bind checking the password by default
String principal = ldapu.getDn();
@@ -398,9 +404,20 @@
}
+ protected boolean isAllowEmptyPasswords()
+ {
+ String allowEmptyPasswords = getIdentityConfiguration().getValue(IdentityConfiguration.USER_ALLOW_EMPTY_PASSWORDS);
+ if (allowEmptyPasswords != null && allowEmptyPasswords.equalsIgnoreCase("true"))
+ {
+ return Boolean.TRUE.booleanValue();
+ }
+ return Boolean.FALSE.booleanValue();
+ }
+
+
/*protected String getEmailAttributeId() throws IdentityException
{
String email = getIdentityConfiguration().getValue(IdentityConfiguration.USER_EMAIL_ATTRIBUTE_ID);
Modified: modules/identity/trunk/identity/src/test/resources/config/standardidentity-config.xml
===================================================================
--- modules/identity/trunk/identity/src/test/resources/config/standardidentity-config.xml 2007-12-03 18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/identity/src/test/resources/config/standardidentity-config.xml 2007-12-03 18:24:30 UTC (rev 9249)
@@ -24,7 +24,7 @@
<!--<!DOCTYPE identity-configuration PUBLIC
- "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
"http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
<identity-configuration>
@@ -183,7 +183,7 @@
<option>
<name>sessionFactoryJNDIName</name>
<value>java:/portal/IdentitySessionFactory</value>
- </option>
+ </option>
<option>
<name>JNDIName</name>
<value>java:/portal/DBUserProfileModule</value>
@@ -331,6 +331,10 @@
<name>membershipAttributeIsDN</name>
<value>true</value>
</option>
+ <option>
+ <name>defaultAdminRole</name>
+ <value>Admin</value>
+ </option>
</option-group>
<option-group>
<group-name>userCreateAttibutes</group-name>
Deleted: modules/identity/trunk/identity/src/test/resources/hibernate/domain.hbm.xml
===================================================================
--- modules/identity/trunk/identity/src/test/resources/hibernate/domain.hbm.xml 2007-12-03 18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/identity/src/test/resources/hibernate/domain.hbm.xml 2007-12-03 18:24:30 UTC (rev 9249)
@@ -1,177 +0,0 @@
-<?xml version="1.0"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<hibernate-mapping>
- <class
- name="org.jboss.portal.identity.db.HibernateUserImpl"
- table="jbp_users">
- <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
- <id
- name="key"
- column="jbp_uid"
- type="java.lang.Long">
- <generator class="native">
- <param name="sequence">user_seq</param>
- </generator>
- </id>
- <property
- name="userName"
- column="jbp_uname"
- type="java.lang.String"
- update="false"
- insert="true"
- unique="true"/>
- <map
- name="dynamic"
- table="jbp_user_prop"
- lazy="false"
- sort="unsorted"
- cascade="all">
- <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
- <key column="jbp_uid"/>
- <index
- column="jbp_name"
- type="java.lang.String"/>
- <element
- column="jbp_value"
- type="java.lang.String"
- not-null="false"
- unique="false"/>
- </map>
- <property
- name="givenName"
- column="jbp_givenname"
- type="java.lang.String"
- update="true"
- insert="true"
- unique="false"/>
- <property
- name="familyName"
- column="jbp_familyname"
- type="java.lang.String"
- update="true"
- insert="true"
- unique="false"/>
- <property
- name="password"
- column="jbp_password"
- type="java.lang.String"
- update="true"
- insert="true"
- unique="false"/>
- <property
- name="realEmail"
- column="jbp_realemail"
- type="java.lang.String"
- update="true"
- insert="true"
- unique="false"/>
- <property
- name="fakeEmail"
- column="jbp_fakeemail"
- type="java.lang.String"
- update="true"
- insert="true"
- unique="false"/>
- <property
- name="registrationDate"
- column="jbp_regdate"
- type="java.util.Date"
- update="false"
- insert="true"
- unique="false"/>
- <property
- name="viewRealEmail"
- column="jbp_viewrealemail"
- type="boolean"
- update="true"
- insert="true"
- unique="false"/>
- <property
- name="enabled"
- column="jbp_enabled"
- type="boolean"
- update="true"
- insert="true"
- unique="false"/>
- <set
- name="roles"
- table="jbp_role_membership"
- lazy="false"
- inverse="false"
- cascade="none"
- sort="unsorted">
- <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
- <key column="jbp_uid"/>
- <many-to-many
- class="org.jboss.portal.identity.db.HibernateRoleImpl"
- column="jbp_rid"
- outer-join="true"/>
- </set>
- </class>
- <class
- name="org.jboss.portal.identity.db.HibernateRoleImpl"
- table="jbp_roles">
- <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
- <id
- name="key"
- column="jbp_rid"
- type="java.lang.Long">
- <generator class="native">
- <param name="sequence">user_seq</param>
- </generator>
- </id>
- <property
- name="name"
- column="jbp_name"
- type="java.lang.String"
- update="false"
- insert="true"
- unique="true"/>
- <property
- name="displayName"
- column="jbp_displayname"
- type="java.lang.String"
- update="true"
- insert="true"
- unique="true"/>
- <set
- name="users"
- table="jbp_role_membership"
- lazy="true"
- inverse="true"
- cascade="none"
- sort="unsorted">
- <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
- <key column="jbp_rid"/>
- <many-to-many
- class="org.jboss.portal.identity.db.HibernateUserImpl"
- column="jbp_uid"
- outer-join="false"/>
- </set>
- </class>
-</hibernate-mapping>
\ No newline at end of file
Copied: modules/identity/trunk/identity/src/test/resources/hibernate/test-domain.hbm.xml (from rev 9120, modules/identity/trunk/identity/src/test/resources/hibernate/domain.hbm.xml)
===================================================================
--- modules/identity/trunk/identity/src/test/resources/hibernate/test-domain.hbm.xml (rev 0)
+++ modules/identity/trunk/identity/src/test/resources/hibernate/test-domain.hbm.xml 2007-12-03 18:24:30 UTC (rev 9249)
@@ -0,0 +1,177 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class
+ name="org.jboss.portal.identity.db.HibernateUserImpl"
+ table="jbp_users">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <id
+ name="key"
+ column="jbp_uid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="userName"
+ column="jbp_uname"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <map
+ name="dynamic"
+ table="jbp_user_prop"
+ lazy="false"
+ sort="unsorted"
+ cascade="all">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <key column="jbp_uid"/>
+ <index
+ column="jbp_name"
+ type="java.lang.String"/>
+ <element
+ column="jbp_value"
+ type="java.lang.String"
+ not-null="false"
+ unique="false"/>
+ </map>
+ <property
+ name="givenName"
+ column="jbp_givenname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="familyName"
+ column="jbp_familyname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="password"
+ column="jbp_password"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="realEmail"
+ column="jbp_realemail"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="fakeEmail"
+ column="jbp_fakeemail"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="registrationDate"
+ column="jbp_regdate"
+ type="java.util.Date"
+ update="false"
+ insert="true"
+ unique="false"/>
+ <property
+ name="viewRealEmail"
+ column="jbp_viewrealemail"
+ type="boolean"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <property
+ name="enabled"
+ column="jbp_enabled"
+ type="boolean"
+ update="true"
+ insert="true"
+ unique="false"/>
+ <set
+ name="roles"
+ table="jbp_role_membership"
+ lazy="false"
+ inverse="false"
+ cascade="none"
+ sort="unsorted">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <key column="jbp_uid"/>
+ <many-to-many
+ class="org.jboss.portal.identity.db.HibernateRoleImpl"
+ column="jbp_rid"
+ outer-join="true"/>
+ </set>
+ </class>
+ <class
+ name="org.jboss.portal.identity.db.HibernateRoleImpl"
+ table="jbp_roles">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <id
+ name="key"
+ column="jbp_rid"
+ type="java.lang.Long">
+ <generator class="native">
+ <param name="sequence">user_seq</param>
+ </generator>
+ </id>
+ <property
+ name="name"
+ column="jbp_name"
+ type="java.lang.String"
+ update="false"
+ insert="true"
+ unique="true"/>
+ <property
+ name="displayName"
+ column="jbp_displayname"
+ type="java.lang.String"
+ update="true"
+ insert="true"
+ unique="true"/>
+ <set
+ name="users"
+ table="jbp_role_membership"
+ lazy="true"
+ inverse="true"
+ cascade="none"
+ sort="unsorted">
+ <!--<cache usage="@portal.hibernate.cache.usage@"/>-->
+ <key column="jbp_rid"/>
+ <many-to-many
+ class="org.jboss.portal.identity.db.HibernateUserImpl"
+ column="jbp_uid"
+ outer-join="false"/>
+ </set>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Modified: modules/identity/trunk/identity/src/test/resources/jboss-unit.xml
===================================================================
--- modules/identity/trunk/identity/src/test/resources/jboss-unit.xml 2007-12-03 18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/identity/src/test/resources/jboss-unit.xml 2007-12-03 18:24:30 UTC (rev 9249)
@@ -26,9 +26,9 @@
<parameter name="directoryName">
<value>OpenDS</value>
- <!--<value>Sun DS</value>-->
- <!--<value>RedHatDS</value>-->
- <!--<value>OpenLDAP</value>-->
+ <value>Sun DS</value>
+ <value>RedHatDS</value>
+ <value>OpenLDAP</value>
</parameter>
<test>
@@ -72,8 +72,8 @@
<parameter name="directories" value="datasources/directories-staticrolemembership.xml"/>
<parameter name="directoryName">
<value>OpenDS</value>
- <!--<value>Sun DS</value>-->
- <!--<value>RedHatDS</value>-->
+ <value>Sun DS</value>
+ <value>RedHatDS</value>
</parameter>
</test>
Modified: modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/db-beans.xml
===================================================================
--- modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/db-beans.xml 2007-12-03 18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/db-beans.xml 2007-12-03 18:24:30 UTC (rev 9249)
@@ -64,7 +64,7 @@
<property name="JNDIName">java:/portal/IdentitySessionFactory</property>
<property name="mappings">
<list elementClass="java.lang.String">
- <value>hibernate/domain.hbm.xml</value>
+ <value>hibernate/test-domain.hbm.xml</value>
</list>
</property>
</bean>
Modified: modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/ldap-beans.xml
===================================================================
--- modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/ldap-beans.xml 2007-12-03 18:24:11 UTC (rev 9248)
+++ modules/identity/trunk/identity/src/test/resources/org/jboss/portal/test/identity/ldap-beans.xml 2007-12-03 18:24:30 UTC (rev 9249)
@@ -73,7 +73,7 @@
<property name="JNDIName">java:/portal/IdentitySessionFactory</property>
<property name="mappings">
<list elementClass="java.lang.String">
- <value>hibernate/domain.hbm.xml</value>
+ <value>hibernate/test-domain.hbm.xml</value>
</list>
</property>
</bean>
16 years, 5 months
JBoss Portal SVN: r9248 - in branches/JBoss_Portal_Branch_2_6: core-admin/src/bin/portal-admin-war/img and 4 other directories.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2007-12-03 13:24:11 -0500 (Mon, 03 Dec 2007)
New Revision: 9248
Added:
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/img/section-header-bg.gif
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/img/section-subHeader-bg.gif
branches/JBoss_Portal_Branch_2_6/core-identity/src/bin/portal-identity-war/img/section-header-bg.gif
branches/JBoss_Portal_Branch_2_6/core-identity/src/bin/portal-identity-war/img/section-subHeader-bg.gif
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/bin/portal-wsrp-admin-war/img/section-header-bg.gif
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/bin/portal-wsrp-admin-war/img/section-subHeader-bg.gif
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/basestyles.css
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/style.css
branches/JBoss_Portal_Branch_2_6/core-identity/src/bin/portal-identity-war/style.css
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/basestyles.css
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/style.css
Log:
JBPORTAL-1798 Cleanup nested tables and other UI elements in core adminlocation - 2nd iteration
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/basestyles.css
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/basestyles.css 2007-12-03 15:35:00 UTC (rev 9247)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/basestyles.css 2007-12-03 18:24:11 UTC (rev 9248)
@@ -86,14 +86,17 @@
}
.dotted-blue-border {
- background-image:url(../img/border-dotted-blue.gif);
- background-position:left bottom;
+ font-weight: bold;
+ color: #315896;
+ font-size: 11px;
+ padding: 3px 0 3px 3px;
+ background-image:url(../img/section-subHeader-bg.gif);
+ background-position:left top;
background-repeat:repeat-x;
+ border:1px solid #b9c6d7;
}
.dotted-blue-vert-rt {
- background-image:url(../img/border-dotted-vert.gif);
- background-position:right top;
- background-repeat:repeat-y;
+ border-right: 1px solid #b9c6d7;
}
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/style.css
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/style.css 2007-12-03 15:35:00 UTC (rev 9247)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/style.css 2007-12-03 18:24:11 UTC (rev 9248)
@@ -42,9 +42,6 @@
/*border-bottom: 1px solid #B3C0C7;*/
background-color:#fafafa;
/*border-top: 1px solid #B3C0C7;*/
- background-image:url(../img/border-dotted-blue.gif);
- background-position:left bottom;
- background-repeat:repeat-x;
}
/*.admin-ui thead tr th {
@@ -206,15 +203,19 @@
/* Area header. */
-.admin-ui .portlet-area-header {
+.admin-ui .portlet-area-header,
+.sectionTitle-blue{
font-weight: bold;
- color: #5986b3;
+ color: #5e5e5e;
font-size: 13px;
/*background-color: #5986b3;*/
- background-color: #ebf2f5;
+ /*background-color: #ebf2f5;*/
+ background-image:url(../img/section-header-bg.gif);
+ background-position:left top;
+ background-repeat:repeat-x;
padding: 2px 2px 2px 4px;
margin: 0;
- border:1px solid #B3C0C7;
+ border:1px solid #dbdbdb;
}
.admin-ui .portlet-area-body {
@@ -230,33 +231,18 @@
/* Styles updated and enhanced from the main portal css */
-.admin-ui th.portlet-section-title {
+.admin-ui th.portlet-section-title,
+.admin-ui h3.sectionTitle{
font-weight: bold;
- color: #31587f;
+ color: #315896;
font-size: 11px;
- padding-bottom: 5px;
-}
-
-.admin-ui h3.sectionTitle {
- font-weight: bold;
- color: #31587f;
- font-size: 11px;
- padding-bottom: 5px;
- background-image:url(../img/border-dotted-blue.gif);
- background-position:left bottom;
+ padding: 3px 0 3px 3px;
+ background-image:url(../img/section-subHeader-bg.gif);
+ background-position:left top;
background-repeat:repeat-x;
- background-color:#fafafa;
+ border:1px solid #b9c6d7;
}
-.sectionTitle-blue {
- font-weight: bold;
- color: #5986b3;
- font-size: 13px;
- background-color: #ebf2f5;
- padding: 2px 2px 2px 4px;
- margin: 0;
- border:1px solid #B3C0C7;
-}
.admin-ui .portlet-section-header {
background-image: url( ../img/pathBackground.png );
Added: branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/img/section-header-bg.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/img/section-header-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/img/section-subHeader-bg.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/img/section-subHeader-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_6/core-identity/src/bin/portal-identity-war/img/section-header-bg.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_6/core-identity/src/bin/portal-identity-war/img/section-header-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_6/core-identity/src/bin/portal-identity-war/img/section-subHeader-bg.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_6/core-identity/src/bin/portal-identity-war/img/section-subHeader-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/bin/portal-identity-war/style.css
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/bin/portal-identity-war/style.css 2007-12-03 15:35:00 UTC (rev 9247)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/bin/portal-identity-war/style.css 2007-12-03 18:24:11 UTC (rev 9248)
@@ -227,15 +227,16 @@
}
.identity-ui h3.sectionTitle,
-table th.sectionTitle {
+table th.sectionTitle,
+h3{
font-weight: bold;
- color: #31587f;
+ color: #315896;
font-size: 11px;
- padding-bottom: 5px;
- background-image:url(img/border-dotted-blue.gif);
- background-position:left bottom;
+ padding: 3px 0 3px 3px;
+ background-image:url(img/section-subHeader-bg.gif);
+ background-position:left top;
background-repeat:repeat-x;
- background-color:#fafafa;
+ border:1px solid #b9c6d7;
}
.sectionTitle-blue {
Added: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/bin/portal-wsrp-admin-war/img/section-header-bg.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/bin/portal-wsrp-admin-war/img/section-header-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/bin/portal-wsrp-admin-war/img/section-subHeader-bg.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/bin/portal-wsrp-admin-war/img/section-subHeader-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/basestyles.css
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/basestyles.css 2007-12-03 15:35:00 UTC (rev 9247)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/basestyles.css 2007-12-03 18:24:11 UTC (rev 9248)
@@ -86,14 +86,17 @@
}
.dotted-blue-border {
- background-image:url(../img/border-dotted-blue.gif);
- background-position:left bottom;
+ font-weight: bold;
+ color: #315896;
+ font-size: 11px;
+ padding: 3px 0 3px 3px;
+ background-image:url(img/section-subHeader-bg.gif);
+ background-position:left top;
background-repeat:repeat-x;
+ border:1px solid #b9c6d7;
}
.dotted-blue-vert-rt {
- background-image:url(../img/border-dotted-vert.gif);
- background-position:right top;
- background-repeat:repeat-y;
+
}
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/style.css
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/style.css 2007-12-03 15:35:00 UTC (rev 9247)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/style.css 2007-12-03 18:24:11 UTC (rev 9248)
@@ -102,13 +102,13 @@
/* Override theme styles */
.wsrp-consumers-ui h3.sectionTitle {
font-weight: bold;
- color: #31587f;
+ color: #315896;
font-size: 11px;
- padding-bottom: 5px;
- background-image:url( img/border-dotted-blue.gif);
- background-position:left bottom;
+ padding: 3px 0 3px 3px;
+ background-image:url(img/section-subHeader-bg.gif);
+ background-position:left top;
background-repeat:repeat-x;
- background-color:#fafafa;
+ border:1px solid #b9c6d7;
}
.wsrp-consumers-ui .portlet-section-header {
16 years, 5 months
JBoss Portal SVN: r9247 - modules/common/trunk.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-12-03 10:35:00 -0500 (Mon, 03 Dec 2007)
New Revision: 9247
Modified:
modules/common/trunk/pom.xml
Log:
Aggregate the javadoc
Modified: modules/common/trunk/pom.xml
===================================================================
--- modules/common/trunk/pom.xml 2007-12-03 14:20:08 UTC (rev 9246)
+++ modules/common/trunk/pom.xml 2007-12-03 15:35:00 UTC (rev 9247)
@@ -179,6 +179,9 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
</plugin>
<plugin>
<artifactId>maven-jxr-plugin</artifactId>
@@ -198,4 +201,4 @@
<properties/>
-</project>
\ No newline at end of file
+</project>
16 years, 5 months