JBoss Portal SVN: r7268 - trunk/jems/src/main/org/jboss/portal/jems/as/system.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-17 06:17:48 -0400 (Thu, 17 May 2007)
New Revision: 7268
Added:
trunk/jems/src/main/org/jboss/portal/jems/as/system/JMXConstants.java
trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOInjection.java
trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOInjector.java
Modified:
trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java
Log:
added possibility to unwrap JMX dynamic proxies and replace them by the POJOs, disabled by default for now as it is experimental
Modified: trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java 2007-05-16 20:25:06 UTC (rev 7267)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java 2007-05-17 10:17:48 UTC (rev 7268)
@@ -27,6 +27,8 @@
import org.jboss.mx.server.InvocationContext;
import org.jboss.mx.server.Invocation;
import org.jboss.mx.interceptor.AbstractInterceptor;
+import org.jboss.mx.interceptor.Interceptor;
+import org.jboss.mx.util.MBeanProxyExt;
import org.jboss.portal.common.mx.JavaBeanModelMBeanBuilder;
import org.jboss.portal.common.util.Tools;
import org.jboss.system.ServiceMBeanSupport;
@@ -35,6 +37,8 @@
import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
import javax.management.MBeanInfo;
+import javax.management.ObjectName;
+import javax.management.MBeanServer;
import javax.management.modelmbean.InvalidTargetObjectTypeException;
import javax.management.modelmbean.ModelMBeanInfo;
import javax.management.modelmbean.ModelMBeanOperationInfo;
@@ -44,8 +48,11 @@
import javax.management.modelmbean.ModelMBeanNotificationInfo;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Proxy;
import java.util.List;
import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -77,9 +84,15 @@
// Constructors --------------------------------------------------
/** . */
+ private final boolean replaceProxies;
+
+ /** . */
private final ServiceMixin serviceMixin;
/** . */
+ private final POJOInjector injector;
+
+ /** . */
private final boolean createExists;
/** . */
@@ -118,7 +131,9 @@
ModelMBeanInfo info = JavaBeanModelMBeanBuilder.build(resource.getClass(), pojo ? Object.class : ServiceMBeanSupport.class);
//
- serviceMixin = new ServiceMixin(resource);
+ this.replaceProxies = "true".equals(System.getProperty("replace.proxies"));
+ this.injector = new POJOInjector();
+ this.serviceMixin = new ServiceMixin(resource);
//
List mmois = Tools.toList(info.getOperations());
@@ -290,6 +305,48 @@
}
});
}
+ else if (replaceProxies)
+ {
+ // Retrieve original dispatcher
+ final Interceptor dispatcher = ctx.getDispatcher();
+
+ //
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ if (InvocationContext.OP_SETATTRIBUTE.equals(invocation.getType()))
+ {
+ Object value = invocation.getArgs()[0];
+ if (value != null && Proxy.isProxyClass(value.getClass()))
+ {
+ Object handler = Proxy.getInvocationHandler(value);
+ if (handler instanceof MBeanProxyExt)
+ {
+ MBeanProxyExt pojoHandler = (MBeanProxyExt)handler;
+ POJOInjection injection = new POJOInjection(pojoHandler, dispatcher, invocation);
+ injector.addInjection(injection);
+ }
+ else
+ {
+ dispatcher.invoke(invocation);
+ }
+ }
+ else
+ {
+ dispatcher.invoke(invocation);
+ }
+
+ //
+ return null;
+ }
+ else
+ {
+ return dispatcher.invoke(invocation);
+ }
+ }
+ });
+ }
}
//
@@ -450,4 +507,36 @@
}
}
}
+
+ // MBeanRegistration implementation *********************************************************************************
+
+
+ public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
+ {
+ name = super.preRegister(server, name);
+
+ //
+ server.addNotificationListener(JMXConstants.MBEAN_SERVER_DELEGATE, injector, null, null);
+
+ //
+ return name;
+ }
+
+ public void postRegister(Boolean done)
+ {
+ super.postRegister(done);
+ }
+
+ public void preDeregister() throws Exception
+ {
+ getServer().removeNotificationListener(JMXConstants.MBEAN_SERVER_DELEGATE, injector);
+
+ //
+ super.preDeregister();
+ }
+
+ public void postDeregister()
+ {
+ super.postDeregister();
+ }
}
Added: trunk/jems/src/main/org/jboss/portal/jems/as/system/JMXConstants.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/system/JMXConstants.java (rev 0)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/system/JMXConstants.java 2007-05-17 10:17:48 UTC (rev 7268)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.jems.as.system;
+
+import org.jboss.mx.util.ObjectNameFactory;
+
+import javax.management.ObjectName;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface JMXConstants
+{
+ /** The name of the server delegate. */
+ ObjectName MBEAN_SERVER_DELEGATE = ObjectNameFactory.create("JMImplementation:type=MBeanServerDelegate");
+}
Added: trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOInjection.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOInjection.java (rev 0)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOInjection.java 2007-05-17 10:17:48 UTC (rev 7268)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * 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.jems.as.system;
+
+import org.jboss.mx.interceptor.Interceptor;
+import org.jboss.mx.server.Invocation;
+import org.jboss.mx.server.registry.MBeanEntry;
+import org.jboss.mx.util.MBeanProxyExt;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.ReflectionException;
+import javax.management.MalformedObjectNameException;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJOInjection
+{
+
+ /** . */
+ private final Interceptor dispatcher;
+
+ /** . */
+ private final Invocation invocation;
+
+ /** . */
+ private final MBeanServer server;
+
+ /** . */
+ private final ObjectName pojoName;
+
+ /** . */
+ private boolean resolved;
+
+ public POJOInjection(MBeanProxyExt pojoHandler, Interceptor dispatcher, Invocation invocation)
+ {
+ this.dispatcher = dispatcher;
+ this.invocation = invocation;
+ this.server = pojoHandler.getMBeanProxyMBeanServer();
+ this.pojoName = pojoHandler.getMBeanProxyObjectName();
+ }
+
+ public ObjectName getPOJOName()
+ {
+ return pojoName;
+ }
+
+ public synchronized void resolve()
+ {
+ if (!resolved)
+ {
+ if (server.isRegistered(pojoName))
+ {
+ try
+ {
+ // Get the mbean entry
+ MBeanEntry entry = (MBeanEntry)server.invoke(new ObjectName("JMImplementation:type=MBeanRegistry"), "get", new Object[]{pojoName}, new String[]{ObjectName.class.getName()});
+
+ //
+ if (entry != null)
+ {
+ // Get the managed resource (aka the service)
+ Object pojo = entry.getInvoker().getResource();
+
+ // Replace the proxy by the service
+ invocation.getArgs()[0] = pojo;
+
+ // Dispatch the invocation finally
+ dispatcher.invoke(invocation);
+ }
+
+ //
+ this.resolved = true;
+ }
+ catch (InstanceNotFoundException ignore)
+ {
+ // Not found will resolve later
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+
+}
Added: trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOInjector.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOInjector.java (rev 0)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOInjector.java 2007-05-17 10:17:48 UTC (rev 7268)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * 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.jems.as.system;
+
+import javax.management.NotificationListener;
+import javax.management.Notification;
+import javax.management.MBeanServerNotification;
+import javax.management.ObjectName;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJOInjector implements NotificationListener
+{
+
+ /** . */
+ private final Map injections;
+
+ public POJOInjector()
+ {
+ this.injections = new HashMap();
+ }
+
+ public void addInjection(POJOInjection injection)
+ {
+ injections.put(injection.getPOJOName(), injection);
+
+ //
+ injection.resolve();
+ }
+
+ public void handleNotification(Notification notification, Object object)
+ {
+ String type = notification.getType();
+ if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(type))
+ {
+ MBeanServerNotification msn = (MBeanServerNotification)notification;
+ ObjectName name = msn.getMBeanName();
+ POJOInjection injection = (POJOInjection)injections.get(name);
+ if (injection != null)
+ {
+ injection.resolve();
+ }
+ }
+ else if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(type))
+ {
+ MBeanServerNotification msn = (MBeanServerNotification)notification;
+ // ObjectName name = msn.getMBeanName();
+ }
+ }
+}
18 years, 11 months
JBoss Portal SVN: r7267 - trunk/portlet/src/main/org/jboss/portal/portlet.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-05-16 16:25:06 -0400 (Wed, 16 May 2007)
New Revision: 7267
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/StateEvent.java
Log:
- Added toString so that debugging is easier.
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/StateEvent.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/StateEvent.java 2007-05-16 18:47:44 UTC (rev 7266)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/StateEvent.java 2007-05-16 20:25:06 UTC (rev 7267)
@@ -36,8 +36,8 @@
{
private final PortletContext context;
private final StateEventType type;
- public static final StateEventType PORTLET_CLONED_EVENT = new StateEventType();
- public static final StateEventType PORTLET_MODIFIED_EVENT = new StateEventType();
+ public static final StateEventType PORTLET_CLONED_EVENT = new StateEventType("Portlet Cloned Event");
+ public static final StateEventType PORTLET_MODIFIED_EVENT = new StateEventType("Portlet Modified Event");
public StateEvent(PortletContext context, StateEventType type)
{
@@ -59,8 +59,16 @@
public static final class StateEventType
{
- private StateEventType()
+ private String name;
+
+ private StateEventType(String name)
{
+ this.name = name;
}
+
+ public String toString()
+ {
+ return name;
+ }
}
}
18 years, 11 months
JBoss Portal SVN: r7266 - trunk/thirdparty.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-16 14:47:44 -0400 (Wed, 16 May 2007)
New Revision: 7266
Added:
trunk/thirdparty/.project
Log:
Initial import.
Added: trunk/thirdparty/.project
===================================================================
--- trunk/thirdparty/.project (rev 0)
+++ trunk/thirdparty/.project 2007-05-16 18:47:44 UTC (rev 7266)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>thirdparty</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
18 years, 11 months
JBoss Portal SVN: r7265 - trunk.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-16 14:25:25 -0400 (Wed, 16 May 2007)
New Revision: 7265
Added:
trunk/thirdparty/
Log:
Initial import.
18 years, 11 months
JBoss Portal SVN: r7264 - trunk/widget.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-16 11:43:14 -0400 (Wed, 16 May 2007)
New Revision: 7264
Modified:
trunk/widget/build.xml
Log:
Couldn't correctly build the war file
Modified: trunk/widget/build.xml
===================================================================
--- trunk/widget/build.xml 2007-05-16 15:17:25 UTC (rev 7263)
+++ trunk/widget/build.xml 2007-05-16 15:43:14 UTC (rev 7264)
@@ -187,7 +187,7 @@
depends="artifacts">
<implode
- dir="${build.resources}/widget-war"
+ dir="${build.resources}/widget.war"
tofile="${build.lib}/widget.war"/>
</target>
18 years, 11 months
JBoss Portal SVN: r7263 - in trunk/core: src/main/org/jboss/portal/core/impl/model/portal and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-16 11:17:25 -0400 (Wed, 16 May 2007)
New Revision: 7263
Added:
trunk/core/src/main/org/jboss/portal/test/core/model/portal/AbstractPortalObjectContainerTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalNodeTestCase.java
Modified:
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ObjectNode.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPermission.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPermissionTestCase.java
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/persistent-jboss-beans.xml
Log:
- portal object permission "view" should not imply "recursive view" on the same node (it was not on descendants)
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-05-16 13:11:49 UTC (rev 7262)
+++ trunk/core/build.xml 2007-05-16 15:17:25 UTC (rev 7263)
@@ -555,6 +555,16 @@
</x-sysproperty>
<x-test>
+ <zest todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.PortalNodeTestCase"
+ outfile="TEST-PortalObjectContainerTestCase">
+ <parameter name="CacheNaturalId" value="true"/>
+ <parameter name="Config" value="persistent-jboss-beans.xml"/>
+ </zest>
+ <zest todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.PortalNodeTestCase"
+ outfile="TEST-PortalObjectContainerTestCase">
+ <parameter name="CacheNaturalId" value="true"/>
+ <parameter name="Config" value="transient-jboss-beans.xml"/>
+ </zest>
<zest todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase"
outfile="TEST-PortalObjectContainerTestCase">
<parameter name="CacheNaturalId" value="true"/>
@@ -613,14 +623,15 @@
outfile="TEST-RegistrationPersistenceManagerTestCase">
</zest>
<test todir="${test.reports}"
+ name="org.jboss.portal.test.core.model.portal.PortalObjectPermissionTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.core.deployment.JBossApplicationMetaDataFactoryTestCase"/>
<test todir="${test.reports}"
- name="org.jboss.portal.test.core.model.portal.PortalObjectPermissionTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectIdTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectPathTestCase"/>
+
</x-test>
<x-classpath>
<pathelement location="${build.lib}/portal-core-lib.jar"/>
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2007-05-16 13:11:49 UTC (rev 7262)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2007-05-16 15:17:25 UTC (rev 7263)
@@ -28,6 +28,7 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
import org.jboss.portal.core.model.portal.PortalObjectPath;
+import org.jboss.portal.core.model.portal.Context;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.content.spi.ContentProviderRegistry;
import org.jboss.portal.core.model.content.spi.ContentProvider;
@@ -74,7 +75,7 @@
// PortalObjectContainer implementation******************************************************************************
- public PortalObject getContext()
+ public org.jboss.portal.core.model.portal.Context getContext()
{
return getContext("");
}
@@ -89,7 +90,7 @@
return node == null ? null : node.getObject();
}
- public PortalObject getContext(String namespace)
+ public Context getContext(String namespace)
{
if (namespace == null)
{
@@ -97,10 +98,10 @@
}
PortalObjectId id = new PortalObjectId(namespace, PortalObjectPath.ROOT_PATH);
ObjectNode node = getObjectNode(id);
- return node == null ? null : node.getObject();
+ return node == null ? null : (Context)node.getObject();
}
- public PortalObject createContext(String namespace) throws DuplicatePortalObjectException
+ public Context createContext(String namespace) throws DuplicatePortalObjectException
{
if (namespace == null)
{
@@ -114,7 +115,7 @@
return this;
}
- protected abstract PortalObjectImpl createRoot(String namespace) throws DuplicatePortalObjectException;
+ protected abstract ContextImpl createRoot(String namespace) throws DuplicatePortalObjectException;
// AuthorizationDomain implementation *******************************************************************************
@@ -222,7 +223,7 @@
*/
protected abstract ObjectNode getObjectNode(PortalObjectId id);
- public class Context
+ public class ContainerContext
{
/**
*/
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ObjectNode.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ObjectNode.java 2007-05-16 13:11:49 UTC (rev 7262)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ObjectNode.java 2007-05-16 15:17:25 UTC (rev 7263)
@@ -60,24 +60,24 @@
private Map securityConstraints;
// Runtime fields
- private AbstractPortalObjectContainer.Context context;
+ private AbstractPortalObjectContainer.ContainerContext containerContext;
public ObjectNode()
{
- this.context = null;
+ this.containerContext = null;
this.path = null;
this.name = null;
this.children = null;
this.children = null;
}
- public ObjectNode(AbstractPortalObjectContainer.Context context, PortalObjectId path, String name)
+ public ObjectNode(AbstractPortalObjectContainer.ContainerContext containerContext, PortalObjectId path, String name)
{
- if (context == null)
+ if (containerContext == null)
{
throw new IllegalArgumentException("No context provided");
}
- this.context = context;
+ this.containerContext = containerContext;
this.path = path;
this.name = name;
this.children = new HashMap();
@@ -88,7 +88,7 @@
public void setContext(Object context)
{
- this.context = (AbstractPortalObjectContainer.Context)context;
+ this.containerContext = (AbstractPortalObjectContainer.ContainerContext)context;
}
public Long getKey()
@@ -143,12 +143,12 @@
//
log.debug("Creating child of path='" + path + "' with path='" + childPath + "'");
- ObjectNode childNode = new ObjectNode(context, childPath, name);
+ ObjectNode childNode = new ObjectNode(containerContext, childPath, name);
childNode.setObject(childObject);
childObject.setObjectNode(childNode);
//
- context.createChild(childNode);
+ containerContext.createChild(childNode);
//
children.put(name, childNode);
@@ -158,7 +158,7 @@
if (childObject instanceof ContextObject)
{
ContextObject co = (ContextObject)childObject;
- co.setContext(context);
+ co.setContext(containerContext);
}
}
@@ -189,7 +189,7 @@
child.getObject().destroy();
// Let the container destroy it
- context.destroyChild(child);
+ containerContext.destroyChild(child);
// Break the relationship
children.remove(name);
@@ -236,9 +236,9 @@
this.children = children;
}
- public AbstractPortalObjectContainer.Context getContext()
+ public AbstractPortalObjectContainer.ContainerContext getContext()
{
- return context;
+ return containerContext;
}
public String toString()
@@ -289,7 +289,7 @@
}
//
- context.updated(this);
+ containerContext.updated(this);
}
public Set getBindings()
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2007-05-16 13:11:49 UTC (rev 7262)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2007-05-16 15:17:25 UTC (rev 7263)
@@ -56,7 +56,7 @@
protected SessionFactory sessionFactory;
/** . */
- protected Context ctx;
+ protected ContainerContext ctx;
/** . */
protected PortalAuthorizationManagerFactory portalAuthorizationManagerFactory;
@@ -81,7 +81,7 @@
public PersistentPortalObjectContainer()
{
- ctx = new Context()
+ ctx = new ContainerContext()
{
public void destroyChild(ObjectNode node)
{
@@ -167,7 +167,7 @@
this.sessionFactoryJNDIName = sessionFactoryJNDIName;
}
- public Context getContainerContext()
+ public ContainerContext getContainerContext()
{
return this.ctx;
}
@@ -203,7 +203,7 @@
sessionFactory = null;
}
- protected PortalObjectImpl createRoot(String namespace) throws DuplicatePortalObjectException
+ protected ContextImpl createRoot(String namespace) throws DuplicatePortalObjectException
{
log.debug("Detecting the existence of the portal object root context");
Session session = sessionFactory.getCurrentSession();
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2007-05-16 13:11:49 UTC (rev 7262)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2007-05-16 15:17:25 UTC (rev 7263)
@@ -42,21 +42,21 @@
protected Map roots;
/** . */
- protected Context ctx;
+ protected ContainerContext ctx;
protected void createService() throws Exception
{
super.createService();
//
- ctx = new Context();
+ ctx = new ContainerContext();
//
roots = new ConcurrentHashMap();
}
- protected PortalObjectImpl createRoot(String namespace) throws DuplicatePortalObjectException
+ protected ContextImpl createRoot(String namespace) throws DuplicatePortalObjectException
{
if (roots.containsKey(namespace))
{
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java 2007-05-16 13:11:49 UTC (rev 7262)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java 2007-05-16 15:17:25 UTC (rev 7263)
@@ -47,7 +47,7 @@
protected String uri;
// Runtime fields
- protected AbstractPortalObjectContainer.Context context;
+ protected AbstractPortalObjectContainer.ContainerContext containerContext;
protected ContentType contentType;
protected ContentStateImpl contentState;
@@ -99,7 +99,7 @@
public void setContext(Object context)
{
- this.context = (AbstractPortalObjectContainer.Context)context;
+ this.containerContext = (AbstractPortalObjectContainer.ContainerContext)context;
}
public String getURI()
@@ -130,7 +130,7 @@
if (value == null)
{
// If nothing is provided then we use the default content type
- contentType = context.getDefaultContentType();
+ contentType = containerContext.getDefaultContentType();
}
else
{
@@ -214,7 +214,7 @@
ContentType contentType = getContentType();
//
- return context.getContentHandler(contentType);
+ return containerContext.getContentHandler(contentType);
}
public Iterator getParameterNames()
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2007-05-16 13:11:49 UTC (rev 7262)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2007-05-16 15:17:25 UTC (rev 7263)
@@ -46,11 +46,11 @@
*
* @return a root object
*/
- PortalObject getContext();
+ Context getContext();
- PortalObject getContext(String namespace);
+ Context getContext(String namespace);
- PortalObject createContext(String namespace) throws DuplicatePortalObjectException;
+ Context createContext(String namespace) throws DuplicatePortalObjectException;
/**
* Get the authorization domain.
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPermission.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPermission.java 2007-05-16 13:11:49 UTC (rev 7262)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPermission.java 2007-05-16 15:17:25 UTC (rev 7263)
@@ -297,48 +297,16 @@
//
return userName.equals(i2.next());
-
- //
-
-
-// // The index of the expected '/' in that.uri
-// int index = this.uri.length();
-//
-// //
-// if (index == 1)
-// {
-// index = 0;
-// }
-//
-// // We must have (this.uri + '/' + userName) a prefix
-// // of that.uri
-// if (that.uri.length() > index)
-// {
-// // No '/' means not good
-// if (that.uri.charAt(index) == '/')
-// {
-// // Get the index of where to extract the name to make the comparison
-// int from = index + 1;
-// int to = that.uri.indexOf('/', from);
-// if (to == -1)
-// {
-// to = that.uri.length();
-// }
-//
-// //
-// String name = that.uri.substring(from, to);
-// if (name.equals(userName))
-// {
-// return true;
-// }
-// }
-// }
}
}
// Could check namespace and id instead
if (that.uri.equals(this.uri))
{
+ if (that.recursiveMask != 0 && (this.recursiveMask & that.mask) != that.mask)
+ {
+ return false;
+ }
return (this.mask & that.mask) == that.mask;
}
else if (that.uri.startsWith(this.uri))
Added: trunk/core/src/main/org/jboss/portal/test/core/model/portal/AbstractPortalObjectContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/AbstractPortalObjectContainerTestCase.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/AbstractPortalObjectContainerTestCase.java 2007-05-16 15:17:25 UTC (rev 7263)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.core.model.portal;
+
+import org.jboss.portal.test.core.PortalBaseTestCase;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.common.test.TestParametrization;
+import org.jboss.portal.common.test.TestParameterValue;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
+import org.jboss.portal.common.test.junit.POJOJUnitTest;
+import org.jboss.portal.common.junit.TransactionAssert;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
+import junit.framework.TestSuite;
+
+import java.net.URL;
+
+/**
+ * Portal Object Container Test Cases based on the microcontainer architecture
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:anil.saldhana@jboss.org">Anil Saldhana</a>
+ * @version $Revision: 7252 $
+ */
+public class AbstractPortalObjectContainerTestCase extends PortalBaseTestCase
+{
+
+ /** . */
+ protected PortalObjectContainer container;
+
+ /** . */
+ protected PortalAuthorizationManagerFactory authorizationManagerFactory;
+
+ public static TestSuite suite(Class testClass) throws Exception
+ {
+ TestParametrization parametrization = JUnitAdapter.getParametrization();
+ URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+ parametrization.setParameterValue("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(testClass);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parametrization);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
+ return suite;
+ }
+
+ public String getName()
+ {
+ TestParametrization parametrization = JUnitAdapter.getParametrization();
+ return super.getName() + ",ds=" + dataSourceConfigParameter.getName() + ",Config=" + parametrization.getParameterValue("Config").get();
+ }
+
+ protected String getConfigLocation()
+ {
+ TestParametrization parametrization = JUnitAdapter.getParametrization();
+ TestParameterValue paramValue = parametrization.getParameterValue("Config");
+ return "org/jboss/portal/test/core/model/portal/" + paramValue.get();
+ }
+
+ public PortalObjectContainer getPortalObjectContainer()
+ {
+ return container;
+ }
+
+ public void setPortalObjectContainer(PortalObjectContainer container)
+ {
+ this.container = container;
+ }
+
+ public PortalAuthorizationManagerFactory getAuthorizationManagerFactory()
+ {
+ return authorizationManagerFactory;
+ }
+
+ public void setAuthorizationManagerFactory(PortalAuthorizationManagerFactory authorizationManagerFactory)
+ {
+ this.authorizationManagerFactory = authorizationManagerFactory;
+ }
+
+ public PortalAuthorizationManager getAuthorizationManager()
+ {
+ return authorizationManagerFactory.getManager();
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ // Create root context
+ TransactionAssert.beginTransaction();
+ container.createContext("");
+ TransactionAssert.commitTransaction();
+ }
+
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalNodeTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalNodeTestCase.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalNodeTestCase.java 2007-05-16 15:17:25 UTC (rev 7263)
@@ -0,0 +1,151 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.core.model.portal;
+
+import org.jboss.portal.common.junit.TransactionAssert;
+import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObjectPath;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.impl.api.node.PortalNodeImpl;
+import org.jboss.portal.security.spi.provider.AuthorizationDomain;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+import org.jboss.portal.security.RoleSecurityBinding;
+import org.jboss.portal.api.node.PortalNode;
+import junit.framework.TestSuite;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalNodeTestCase extends AbstractPortalObjectContainerTestCase
+{
+
+ public static TestSuite suite() throws Exception
+ {
+ return AbstractPortalObjectContainerTestCase.suite(PortalNodeTestCase.class);
+ }
+
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ //
+ TransactionAssert.beginTransaction();
+ Context root = container.getContext("");
+ Portal p_1 = root.createPortal("1");
+ Page p_1_1 = p_1.createPage("1");
+ Page p_1_2 = p_1.createPage("2");
+ p_1_1.createPage("1");
+ p_1_1.createPage("2");
+ p_1_1.createPage("3");
+ p_1_1.createPage("4");
+ TransactionAssert.commitTransaction();
+ }
+
+ public void testGetChildrenWithViewPermission() throws Exception
+ {
+ TransactionAssert.beginTransaction();
+ AuthorizationDomain auth = container.getAuthorizationDomain();
+ DomainConfigurator cfg = auth.getConfigurator();
+ Portal p_1 = (Portal)container.getObject(PortalObjectId.parse("/1", PortalObjectPath.CANONICAL_FORMAT));
+ cfg.setSecurityBindings(p_1.getId().toString(PortalObjectPath.CANONICAL_FORMAT), CollectionBuilder.singleton(new RoleSecurityBinding("view", "admin")).toHashSet());
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ p_1 = (Portal)container.getObject(PortalObjectId.parse("/1", PortalObjectPath.CANONICAL_FORMAT));
+ PortalNode node = new PortalNodeImpl(getAuthorizationManager(), p_1);
+ assertEquals(0, node.getChildren().size());
+ TransactionAssert.commitTransaction();
+
+ //
+ setUpSubjectForRole("blah", new String[]{"admin"});
+
+ //
+ TransactionAssert.beginTransaction();
+ p_1 = (Portal)container.getObject(PortalObjectId.parse("/1", PortalObjectPath.CANONICAL_FORMAT));
+ node = new PortalNodeImpl(getAuthorizationManager(), p_1);
+ assertEquals(0, node.getChildren().size());
+ TransactionAssert.commitTransaction();
+ }
+
+ public void testGetChildrenWithViewRecursivePermission() throws Exception
+ {
+ TransactionAssert.beginTransaction();
+ AuthorizationDomain auth = container.getAuthorizationDomain();
+ DomainConfigurator cfg = auth.getConfigurator();
+ Portal tmp = (Portal)container.getObject(PortalObjectId.parse("/1", PortalObjectPath.CANONICAL_FORMAT));
+ cfg.setSecurityBindings(tmp.getId().toString(PortalObjectPath.CANONICAL_FORMAT), CollectionBuilder.singleton(new RoleSecurityBinding("viewrecursive", "admin")).toHashSet());
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ tmp = (Portal)container.getObject(PortalObjectId.parse("/1", PortalObjectPath.CANONICAL_FORMAT));
+ PortalNode node_1 = new PortalNodeImpl(getAuthorizationManager(), tmp);
+ assertEquals(0, node_1.getChildren().size());
+ TransactionAssert.commitTransaction();
+
+ //
+ setUpSubjectForRole("blah", new String[]{"admin"});
+
+ //
+ TransactionAssert.beginTransaction();
+ tmp = (Portal)container.getObject(PortalObjectId.parse("/1", PortalObjectPath.CANONICAL_FORMAT));
+ node_1 = new PortalNodeImpl(getAuthorizationManager(), tmp);
+ Map node_1_children = getChildrenMap(node_1);
+ assertEquals(2, node_1_children.size());
+ PortalNode node_1_1 = (PortalNode)node_1_children.get("1");
+ PortalNode node_1_2 = (PortalNode)node_1_children.get("2");
+ assertNotNull(node_1_1);
+ assertNotNull(node_1_2);
+ Map node_1_1_children = getChildrenMap(node_1_1);
+ assertEquals(4, node_1_1_children.size());
+ assertNotNull(node_1_1_children.get("1"));
+ assertNotNull(node_1_1_children.get("2"));
+ assertNotNull(node_1_1_children.get("3"));
+ assertNotNull(node_1_1_children.get("4"));
+ Map node_1_2_children = getChildrenMap(node_1_2);
+ assertEquals(0, node_1_2_children.size());
+ TransactionAssert.commitTransaction();
+ }
+
+ private Map getChildrenMap(PortalNode node)
+ {
+ Map p_1_children = new TreeMap();
+ for (Iterator i = node.getChildren().iterator();i.hasNext();)
+ {
+ PortalNode child = (PortalNode)i.next();
+ p_1_children.put(child.getName(), child);
+ }
+ return p_1_children;
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2007-05-16 13:11:49 UTC (rev 7262)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2007-05-16 15:17:25 UTC (rev 7263)
@@ -29,23 +29,15 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectPath;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.content.spi.handler.ContentState;
-import org.jboss.portal.test.core.PortalBaseTestCase;
import org.jboss.portal.test.core.model.content.SimpleContent;
-import org.jboss.portal.test.framework.embedded.DataSourceSupport;
-import org.jboss.portal.common.test.TestParametrization;
-import org.jboss.portal.common.test.TestParameterValue;
-import org.jboss.portal.common.test.junit.JUnitAdapter;
-import org.jboss.portal.common.test.junit.POJOJUnitTest;
import org.jboss.portal.common.junit.TransactionAssert;
import org.jboss.portal.common.util.CollectionBuilder;
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
-import java.net.URL;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
@@ -58,62 +50,14 @@
* @author <a href="mailto:anil.saldhana@jboss.org">Anil Saldhana</a>
* @version $Revision$
*/
-public class PortalObjectContainerTestCase extends PortalBaseTestCase
+public class PortalObjectContainerTestCase extends AbstractPortalObjectContainerTestCase
{
- /** . */
- private PortalObjectContainer container;
-
public static TestSuite suite() throws Exception
{
- TestParametrization parametrization = JUnitAdapter.getParametrization();
- URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
- parametrization.setParameterValue("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
- POJOJUnitTest abc = new POJOJUnitTest(PortalObjectContainerTestCase.class);
- JUnitAdapter adapter = new JUnitAdapter(abc, parametrization);
- TestSuite suite = new TestSuite();
- suite.addTest(adapter);
- return suite;
+ return AbstractPortalObjectContainerTestCase.suite(PortalObjectContainerTestCase.class);
}
- public String getName()
- {
- TestParametrization parametrization = JUnitAdapter.getParametrization();
- return super.getName() + ",ds=" + dataSourceConfigParameter.getName() + ",Config=" + parametrization.getParameterValue("Config").get();
- }
-
- protected String getConfigLocation()
- {
- TestParametrization parametrization = JUnitAdapter.getParametrization();
- TestParameterValue paramValue = parametrization.getParameterValue("Config");
- return "org/jboss/portal/test/core/model/portal/" + paramValue.get();
- }
-
- public PortalObjectContainer getPortalObjectContainer()
- {
- return container;
- }
-
- public void setPortalObjectContainer(PortalObjectContainer container)
- {
- this.container = container;
- }
-
- public void setUp() throws Exception
- {
- super.setUp();
-
- // Create root context
- TransactionAssert.beginTransaction();
- container.createContext("");
- TransactionAssert.commitTransaction();
- }
-
- public void tearDown() throws Exception
- {
- super.tearDown();
- }
-
/** todo same with a transaction wrapping the start method */
public void testRootNodeCreation() throws Exception
{
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPermissionTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPermissionTestCase.java 2007-05-16 13:11:49 UTC (rev 7262)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPermissionTestCase.java 2007-05-16 15:17:25 UTC (rev 7263)
@@ -60,7 +60,7 @@
PortalObjectPermission v = new PortalObjectPermission(new PortalObjectId("", new PortalObjectPath(new String[]{"abc"})), "view");
PortalObjectPermission vr = new PortalObjectPermission(new PortalObjectId("", new PortalObjectPath(new String[]{"abc"})), "viewrecursive");
assertTrue(v.implies(v));
- assertTrue(v.implies(vr));
+ assertFalse(v.implies(vr));
assertTrue(vr.implies(v));
assertTrue(vr.implies(vr));
}
Modified: trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/persistent-jboss-beans.xml
===================================================================
--- trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/persistent-jboss-beans.xml 2007-05-16 13:11:49 UTC (rev 7262)
+++ trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/persistent-jboss-beans.xml 2007-05-16 15:17:25 UTC (rev 7263)
@@ -98,5 +98,6 @@
</constructor>
<property name="hibernate"><inject bean="HibernateSupport"/></property>
<property name="portalObjectContainer"><inject bean="PortalObjectContainer"/></property>
+ <property name="authorizationManagerFactory"><inject bean="AuthorizationManagerFactory"/></property>
</bean>
</deployment>
18 years, 11 months
JBoss Portal SVN: r7262 - trunk/core/src/main/org/jboss/portal/core/model/portal/command/view.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-16 09:11:49 -0400 (Wed, 16 May 2007)
New Revision: 7262
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPortalCommand.java
Log:
Slightly better error handling
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPortalCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPortalCommand.java 2007-05-16 12:41:35 UTC (rev 7261)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewPortalCommand.java 2007-05-16 13:11:49 UTC (rev 7262)
@@ -22,14 +22,13 @@
******************************************************************************/
package org.jboss.portal.core.model.portal.command.view;
-import org.jboss.portal.core.model.portal.command.PageCommand;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.command.PortalCommand;
import org.jboss.portal.core.model.portal.command.response.UpdatePageResponse;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.controller.command.info.CommandInfo;
-import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
-import org.jboss.portal.core.controller.ControllerResponse;
-import org.jboss.portal.core.controller.ControllerException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -53,6 +52,13 @@
public ControllerResponse execute() throws ControllerException
{
- return new UpdatePageResponse(portal.getDefaultPage().getId());
+ if (portal.getDefaultPage() != null)
+ {
+ return new UpdatePageResponse(portal.getDefaultPage().getId());
+ }
+ else
+ {
+ throw new ControllerException("No default page has been defined for portal " + portal.getName());
+ }
}
}
18 years, 11 months
JBoss Portal SVN: r7261 - trunk/core-cms/src/main/org/jboss/portal/core/cms/ui.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-16 08:41:35 -0400 (Wed, 16 May 2007)
New Revision: 7261
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
Log:
ERROR level to INFO level statement
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-05-16 12:23:53 UTC (rev 7260)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-05-16 12:41:35 UTC (rev 7261)
@@ -178,7 +178,7 @@
}
catch (UndeclaredThrowableException e)
{
- log.error("Cannot start CMS portlet search service due to service unavailability");
+ log.info("Cannot start CMS portlet search service due to service unavailability");
}
}
18 years, 11 months
JBoss Portal SVN: r7260 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-16 08:23:53 -0400 (Wed, 16 May 2007)
New Revision: 7260
Modified:
docs/trunk/referenceGuide/en/modules/xmldescriptors.xml
Log:
Documentation about logging-in the dashboard
Modified: docs/trunk/referenceGuide/en/modules/xmldescriptors.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/xmldescriptors.xml 2007-05-16 12:14:25 UTC (rev 7259)
+++ docs/trunk/referenceGuide/en/modules/xmldescriptors.xml 2007-05-16 12:23:53 UTC (rev 7260)
@@ -1359,22 +1359,21 @@
<title>Portlet Debugging (jboss-portal.sar/conf/config.xml)</title>
<para>
By default, JBoss Portal ships with all errors set to display. You can fine-tune this behaviour by modifying
- the file,
+ some properties in the file,
<emphasis>jboss-portal.sar/conf/config.xml</emphasis>
:
<programlisting><![CDATA[
-<properties>
- <!-- When a window has restrictedaccess : show or hide values are permitted -->
- <entry key="core.render.window_access_denied">show</entry>
- <!-- When a window is unavailable : show or hide values are permitted -->
- <entry key="core.render.window_unavailable">show</entry>
- <!-- When a window produces an error : show, hide or message_only values are permitted -->
- <entry key="core.render.window_error">message_only</entry>
- <!-- When a window produces an internal error : show, hide are permitted -->
- <entry key="core.render.window_internal_error">show</entry>
- <!-- When a window is not found : show or hide values are permitted -->
- <entry key="core.render.window_not_found">show</entry>
-</properties>]]></programlisting>
+<!-- When a window has restrictedaccess : show or hide values are permitted -->
+<entry key="core.render.window_access_denied">show</entry>
+<!-- When a window is unavailable : show or hide values are permitted -->
+<entry key="core.render.window_unavailable">show</entry>
+<!-- When a window produces an error : show, hide or message_only values are permitted -->
+<entry key="core.render.window_error">message_only</entry>
+<!-- When a window produces an internal error : show, hide are permitted -->
+<entry key="core.render.window_internal_error">show</entry>
+<!-- When a window is not found : show or hide values are permitted -->
+<entry key="core.render.window_not_found">show</entry>
+]]></programlisting>
Either
<emphasis>show</emphasis>
or
@@ -1390,6 +1389,17 @@
will display the full stack trace if it is available.
</para>
</sect2>
+ <sect2>
+ <title>Login to dashboard</title>
+ <para>
+ By default, when a user logs in, she is forwarded to the default page of the default portal. In order to
+ forward her to her dashboard, it is possible to set in the file <emphasis>jboss-portal.sar/conf/config.xml</emphasis>:
+ <programlisting><![CDATA[
+<!-- Namespace to use when logging-in, use "dashboard" to directly log-in the dashboard otherwise use "default" -->
+<entry key="core.login.namespace">dashboard</entry>
+]]></programlisting>
+ </para>
+ </sect2>
</sect1>
<sect1 id="desc_examples">
<title>Descriptor Examples</title>
18 years, 11 months
JBoss Portal SVN: r7259 - in trunk/core/src: resources/portal-core-sar/META-INF and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-16 08:14:25 -0400 (Wed, 16 May 2007)
New Revision: 7259
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-sar/conf/config.xml
Log:
Let the user configure which namespace to use. Useful to directly login into the dashboard.
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-05-16 12:12:21 UTC (rev 7258)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-05-16 12:14:25 UTC (rev 7259)
@@ -53,6 +53,7 @@
import org.jboss.portal.core.model.portal.PortalObjectPath;
import org.jboss.portal.core.model.portal.command.action.ImportPageToDashboardCommand;
import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.view.ViewContextCommand;
import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
import org.jboss.portal.core.model.portal.command.view.ViewPortalCommand;
import org.jboss.portal.core.theme.PageRendition;
@@ -62,6 +63,7 @@
import org.jboss.portal.security.PortalSecurityException;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.config.ServerConfig;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
import org.jboss.portal.theme.ThemeConstants;
@@ -95,6 +97,12 @@
/** . */
private String tabsPath;
+
+ /** . */
+ private String loginNamespace;
+
+ /** . */
+ private ServerConfig config;
/** . */
private PortalAuthorizationManagerFactory portalAuthorizationManagerFactory;
@@ -185,7 +193,24 @@
if (user == null)
{
- request.setAttribute("org.jboss.portal.header.LOGIN_URL", new PortalURLImpl(cc, controllerCtx, Boolean.TRUE, null));
+ PortalURL portalURL = null;
+
+ String configNamespace = config.getProperty("core.login.namespace");
+ if (loginNamespace == null)
+ {
+ loginNamespace = configNamespace;
+ }
+
+ if (loginNamespace != null && ! loginNamespace.toLowerCase().trim().equals("default"))
+ {
+ ViewContextCommand vcc = new ViewContextCommand(new PortalObjectId(loginNamespace, new PortalObjectPath()));
+ portalURL = new PortalURLImpl(vcc, controllerCtx, Boolean.TRUE, null);
+ }
+ else
+ {
+ portalURL = new PortalURLImpl(cc, controllerCtx, Boolean.TRUE, null);
+ }
+ request.setAttribute("org.jboss.portal.header.LOGIN_URL", portalURL);
}
// Edit dashboard page || Copy to dashboard link
@@ -432,4 +457,24 @@
return value;
}
}
+
+ public String getLoginNamespace()
+ {
+ return loginNamespace;
+ }
+
+ public void setLoginNamespace(String loginNamespace)
+ {
+ this.loginNamespace = loginNamespace;
+ }
+
+ public ServerConfig getConfig()
+ {
+ return config;
+ }
+
+ public void setConfig(ServerConfig config)
+ {
+ this.config = config;
+ }
}
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-05-16 12:12:21 UTC (rev 7258)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-05-16 12:14:25 UTC (rev 7259)
@@ -202,7 +202,12 @@
<attribute name="TargetContextPath">/portal-core</attribute>
<attribute name="HeaderPath">/WEB-INF/jsp/header/header.jsp</attribute>
<attribute name="TabsPath">/WEB-INF/jsp/header/tabs.jsp</attribute>
+ <!-- Overrides the value of core.login.namespace in config.xml -->
+ <!-- attribute name="LoginNamespace">dashboard</attribute -->
<depends
+ optional-attribute-name="Config"
+ proxy-type="attribute">portal:service=ServerConfig</depends>
+ <depends
optional-attribute-name="PortalAuthorizationManagerFactory"
proxy-type="attribute">portal:service=PortalAuthorizationManagerFactory</depends>
</mbean>
Modified: trunk/core/src/resources/portal-core-sar/conf/config.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/config.xml 2007-05-16 12:12:21 UTC (rev 7258)
+++ trunk/core/src/resources/portal-core-sar/conf/config.xml 2007-05-16 12:14:25 UTC (rev 7259)
@@ -32,4 +32,6 @@
<entry key="core.render.window_internal_error">show</entry>
<!-- When a window is not found : show or hide values are permitted -->
<entry key="core.render.window_not_found">show</entry>
+ <!-- Namespace to use when logging-in, use "dashboard" to directly log-in the dashboard otherwise use "default" -->
+ <entry key="core.login.namespace">default</entry>
</properties>
18 years, 11 months