Author: julien(a)jboss.com
Date: 2007-05-09 05:27:25 -0400 (Wed, 09 May 2007)
New Revision: 7226
Added:
trunk/common/src/main/org/jboss/portal/common/adapter/
trunk/common/src/main/org/jboss/portal/common/adapter/AdaptedMethodDispatcher.java
trunk/common/src/main/org/jboss/portal/common/adapter/AdaptedMethodDispatcherFactory.java
trunk/common/src/main/org/jboss/portal/common/adapter/ClassAdaptable.java
trunk/common/src/main/org/jboss/portal/common/adapter/ClassAdapted.java
trunk/common/src/main/org/jboss/portal/common/adapter/ClassAdapter.java
trunk/common/src/main/org/jboss/portal/common/adapter/DefaultJavaLangObjectAdapted.java
trunk/common/src/main/org/jboss/portal/common/adapter/JavaLangObjectAdapted.java
trunk/common/src/main/org/jboss/portal/common/adapter/JavaLangObjectMethodDispatcher.java
trunk/common/src/main/org/jboss/portal/common/adapter/JavaLangObjectMethodDispatcherFactory.java
trunk/common/src/main/org/jboss/portal/common/adapter/MethodDispatcher.java
trunk/common/src/main/org/jboss/portal/common/adapter/MethodDispatcherFactory.java
trunk/common/src/main/org/jboss/portal/test/common/adapter/
trunk/common/src/main/org/jboss/portal/test/common/adapter/Adapted1.java
trunk/common/src/main/org/jboss/portal/test/common/adapter/Adapted2.java
trunk/common/src/main/org/jboss/portal/test/common/adapter/AdapterTestCase.java
trunk/common/src/main/org/jboss/portal/test/common/adapter/Business1.java
trunk/common/src/main/org/jboss/portal/test/common/adapter/Business2.java
trunk/common/src/main/org/jboss/portal/test/common/adapter/ObjectAdapted.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/AjaxInfoImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoFactory.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/MarkupHeaderInfoImpl.java
trunk/core/src/main/org/jboss/portal/core/portlet/info/
trunk/core/src/main/org/jboss/portal/core/portlet/info/AjaxInfo.java
trunk/core/src/main/org/jboss/portal/core/portlet/info/CorePortletInfo.java
trunk/core/src/main/org/jboss/portal/core/portlet/info/MarkupHeaderInfo.java
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/transient-jboss-beans.xml
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletInfoFactoryImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/spi/
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/spi/PortletInfoFactory.java
Removed:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactory.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactoryImpl.java
Modified:
trunk/bridge/src/main/org/jboss/portal/bridge/JBossServletContextProvider.java
trunk/common/build.xml
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/AjaxInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/TransactionInterceptor.java
trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
trunk/core/src/main/org/jboss/portlet/JBossAPIFactory.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSessionInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/metadata/JBossPortletMetaData.java
Log:
- introduced PortletInfoFactory that allows to plug in PortletInfo extension
- replaced usage of build time meta data in portlet core aspects by an extension of the
portlet runtime meta data
- optimized security checks in the PortalNodeImpl object by leveraging the fact that the
security check view recursive on a node will imply the security check view on its
children
Modified: trunk/bridge/src/main/org/jboss/portal/bridge/JBossServletContextProvider.java
===================================================================
---
trunk/bridge/src/main/org/jboss/portal/bridge/JBossServletContextProvider.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/bridge/src/main/org/jboss/portal/bridge/JBossServletContextProvider.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -23,10 +23,9 @@
package org.jboss.portal.bridge;
import org.apache.portals.bridges.common.ServletContextProvider;
-import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.PortletContainer;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletRequest;
@@ -123,11 +122,11 @@
public BridgeInfo(PortletInvocation invocation)
{
- ContainerPortletInfo info =
(ContainerPortletInfo)(PortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO);
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
//
this.invocation = invocation;
- this.ctx =
info.getContainer().getApplication().getContext().getServletContext();
+ this.ctx = container.getApplication().getContext().getServletContext();
this.breq = null;
this.bresp = null;
}
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-05-08 23:08:48 UTC (rev 7225)
+++ trunk/common/build.xml 2007-05-09 09:27:25 UTC (rev 7226)
@@ -210,6 +210,7 @@
</x-sysproperty>
<x-test>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.common.adapter.AdapterTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.BundleNameIteratorTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.BundleNameParserTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.ComplexResourceBundleFactoryTestCase"/>
Added: trunk/common/src/main/org/jboss/portal/common/adapter/AdaptedMethodDispatcher.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/adapter/AdaptedMethodDispatcher.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/common/adapter/AdaptedMethodDispatcher.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+class AdaptedMethodDispatcher implements MethodDispatcher
+{
+
+ /** . */
+ private final Method method;
+
+ /** . */
+ private final Object target;
+
+ public AdaptedMethodDispatcher(Method method, Object target)
+ {
+ this.method = method;
+ this.target = target;
+ }
+
+ public Object dispatch(ClassAdaptable adaptable, Object[] args) throws Throwable
+ {
+ return method.invoke(target, args);
+ }
+}
Added:
trunk/common/src/main/org/jboss/portal/common/adapter/AdaptedMethodDispatcherFactory.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/adapter/AdaptedMethodDispatcherFactory.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/common/adapter/AdaptedMethodDispatcherFactory.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+class AdaptedMethodDispatcherFactory implements MethodDispatcherFactory
+{
+
+ /** . */
+ private final Object target;
+
+ public AdaptedMethodDispatcherFactory(Object target)
+ {
+ this.target = target;
+ }
+
+ public MethodDispatcher createDispatcher(Method method)
+ {
+ return new AdaptedMethodDispatcher(method, target);
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/adapter/ClassAdaptable.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/adapter/ClassAdaptable.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/adapter/ClassAdaptable.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+/**
+ * Denotes an object that is class adaptable.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ClassAdaptable
+{
+}
Added: trunk/common/src/main/org/jboss/portal/common/adapter/ClassAdapted.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/adapter/ClassAdapted.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/adapter/ClassAdapted.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+/**
+ * A class adapted.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassAdapted
+{
+
+ /** . */
+ final Class itf;
+
+ /** . */
+ final Object object;
+
+ public ClassAdapted(Class itf, Object object)
+ {
+ if (itf == null)
+ {
+ throw new IllegalArgumentException("No null adapted interface
accepted");
+ }
+ if (!itf.isInterface())
+ {
+ throw new IllegalArgumentException("Adapted interface is not an
interface");
+ }
+ if (object == null)
+ {
+ throw new IllegalArgumentException("No null adapted object
accepted");
+ }
+
+ //
+ this.itf = itf;
+ this.object = object;
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/adapter/ClassAdapter.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/adapter/ClassAdapter.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/adapter/ClassAdapter.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,157 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Method;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Creates a new class adapter.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassAdapter
+{
+
+ /** . */
+ private final Map dispatchers;
+
+ /** . */
+ private final Constructor ctor;
+
+ /** . */
+ private final InvocationHandler handler = new InvocationHandler()
+ {
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ MethodDispatcher dispatcher = (MethodDispatcher)dispatchers.get(method);
+
+ //
+ ClassAdaptable adaptable = (ClassAdaptable)proxy;
+
+ //
+ return dispatcher.dispatch(adaptable, args);
+ }
+ };
+
+ /**
+ * Creates a new class adapter. The object adapted implementation used will be an
instance of <code>JavaLangObjectAdapted</code>.
+ *
+ * @param loader the class loader that will contain the dynamic proxy generated class
+ * @param adapteds the array of class adapteds
+ * @throws NoSuchMethodException
+ * @throws IllegalArgumentException if an argument is null
+ */
+ public ClassAdapter(ClassLoader loader, ClassAdapted[] adapteds) throws
NoSuchMethodException, IllegalArgumentException
+ {
+ this(loader, adapteds, new DefaultJavaLangObjectAdapted());
+ }
+
+ /**
+ * Create a new class adapter.
+ *
+ * @param loader the class loader that will contain the dynamic proxy generated class
+ * @param adapteds the array of class adapteds
+ * @param objectAdapted the implementation of object adapted
+ * @throws NoSuchMethodException
+ * @throws IllegalArgumentException if an argument is null
+ */
+ public ClassAdapter(ClassLoader loader, ClassAdapted[] adapteds, JavaLangObjectAdapted
objectAdapted) throws NoSuchMethodException, IllegalArgumentException
+ {
+ if (loader == null)
+ {
+ throw new IllegalArgumentException("No null class loader accepted");
+ }
+ if (adapteds == null)
+ {
+ throw new IllegalArgumentException("No null adapteds accepted");
+ }
+ if (objectAdapted == null)
+ {
+ throw new IllegalArgumentException("No null object adapted
accepted");
+ }
+
+ //
+ dispatchers = new HashMap();
+
+ //
+ addAdapted(Object.class, new
JavaLangObjectMethodDispatcherFactory(objectAdapted));
+
+ //
+ Class[] itfs = new Class[adapteds.length + 1];
+ itfs[0] = ClassAdaptable.class;
+
+ //
+ for (int i = 0;i < adapteds.length;i++)
+ {
+ ClassAdapted adapted = adapteds[i];
+
+ //
+ if (adapted == null)
+ {
+ throw new IllegalArgumentException("No null adapted accepted");
+ }
+
+ //
+ itfs[1 + i] = adapted.itf;
+
+ //
+ addAdapted(adapted.itf, new AdaptedMethodDispatcherFactory(adapted.object));
+ }
+
+ //
+ ctor = Proxy.getProxyClass(loader, itfs).getConstructor(new
Class[]{InvocationHandler.class});
+ }
+
+ private void addAdapted(Class adaptedClass, MethodDispatcherFactory
methodDispatcherFactory)
+ {
+ Method[] methods = adaptedClass.getMethods();
+ for (int j = 0;j < methods.length;j++)
+ {
+ Method method = methods[j];
+ int modifiers = method.getModifiers();
+ if (Modifier.isPublic(modifiers) && !Modifier.isFinal(modifiers)
&& !Modifier.isStatic(modifiers))
+ {
+ if (!dispatchers.containsKey(method))
+ {
+ dispatchers.put(method,
methodDispatcherFactory.createDispatcher(method));
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns an instance of the the adaptable object.
+ */
+ public ClassAdaptable getAdaptable() throws IllegalAccessException,
InstantiationException, InvocationTargetException
+ {
+ return (ClassAdaptable)ctor.newInstance(new Object[]{handler});
+ }
+}
Added:
trunk/common/src/main/org/jboss/portal/common/adapter/DefaultJavaLangObjectAdapted.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/adapter/DefaultJavaLangObjectAdapted.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/common/adapter/DefaultJavaLangObjectAdapted.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class DefaultJavaLangObjectAdapted implements JavaLangObjectAdapted
+{
+
+ public String toString(ClassAdaptable adaptable)
+ {
+ return "Adapter[class=" + adaptable.getClass().getName() +
",hashCode=" + System.identityHashCode(adaptable) + "]";
+ }
+
+ public int hashCode(ClassAdaptable adaptable)
+ {
+ return System.identityHashCode(adaptable);
+ }
+
+ public boolean equals(ClassAdaptable adaptable, Object obj)
+ {
+ return adaptable == obj;
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/adapter/JavaLangObjectAdapted.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/adapter/JavaLangObjectAdapted.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/common/adapter/JavaLangObjectAdapted.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -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.common.adapter;
+
+/**
+ * Defines contract for the <code>java.lang.Object</code> adapted.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface JavaLangObjectAdapted
+{
+ /**
+ * Implementation of <code>toString()</code>.
+ *
+ * @param adaptable the adaptable object
+ * @return the string value
+ */
+ String toString(ClassAdaptable adaptable);
+
+ /**
+ * Implementation of <code>hashCode</code>.
+ *
+ * @param adaptable the adaptable object
+ * @return the hash code value
+ */
+ int hashCode(ClassAdaptable adaptable);
+
+ /**
+ * Implementation of <code>equals</code>.
+ *
+ * @param adaptable the adaptable object
+ * @param obj the object to test equality with
+ * @return true the equals value
+ */
+ boolean equals(ClassAdaptable adaptable, Object obj);
+}
Added:
trunk/common/src/main/org/jboss/portal/common/adapter/JavaLangObjectMethodDispatcher.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/adapter/JavaLangObjectMethodDispatcher.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/common/adapter/JavaLangObjectMethodDispatcher.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+/**
+ * Implementation of the <code>MethodDispatcher</code> interface for the
methods of <code>java.lang.Object</code> which
+ * are delegated by a dynamic proxy to the <code>InvocationHandler</code>.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+abstract class JavaLangObjectMethodDispatcher implements MethodDispatcher
+{
+
+ /** . */
+ protected final JavaLangObjectAdapted target;
+
+ public JavaLangObjectMethodDispatcher(JavaLangObjectAdapted target)
+ {
+ this.target = target;
+ }
+
+ static class ToString extends JavaLangObjectMethodDispatcher
+ {
+
+ public ToString(JavaLangObjectAdapted target)
+ {
+ super(target);
+ }
+
+ public Object dispatch(ClassAdaptable adaptable, Object[] args) throws Throwable
+ {
+ return target.toString(adaptable);
+ }
+ }
+
+ static class Equals extends JavaLangObjectMethodDispatcher
+ {
+
+ public Equals(JavaLangObjectAdapted target)
+ {
+ super(target);
+ }
+
+ public Object dispatch(ClassAdaptable adaptable, Object[] args) throws Throwable
+ {
+ return Boolean.valueOf(target.equals(adaptable, args[0]));
+ }
+ }
+
+ static class HashCode extends JavaLangObjectMethodDispatcher
+ {
+
+ public HashCode(JavaLangObjectAdapted target)
+ {
+ super(target);
+ }
+
+ public Object dispatch(ClassAdaptable adaptable, Object[] args) throws Throwable
+ {
+ return new Integer(target.hashCode(adaptable));
+ }
+ }
+}
Added:
trunk/common/src/main/org/jboss/portal/common/adapter/JavaLangObjectMethodDispatcherFactory.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/adapter/JavaLangObjectMethodDispatcherFactory.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/common/adapter/JavaLangObjectMethodDispatcherFactory.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,61 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+class JavaLangObjectMethodDispatcherFactory implements MethodDispatcherFactory
+{
+
+ /** . */
+ private final JavaLangObjectAdapted target;
+
+ public JavaLangObjectMethodDispatcherFactory(JavaLangObjectAdapted target)
+ {
+ this.target = target;
+ }
+
+ public MethodDispatcher createDispatcher(Method method)
+ {
+ if ("toString".equals(method.getName()))
+ {
+ return new JavaLangObjectMethodDispatcher.ToString(target);
+ }
+ else if ("equals".equals(method.getName()))
+ {
+ return new JavaLangObjectMethodDispatcher.Equals(target);
+ }
+ else if ("hashCode".equals(method.getName()))
+ {
+ return new JavaLangObjectMethodDispatcher.HashCode(target);
+ }
+ else
+ {
+ throw new AssertionError("Should not be possible");
+ }
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/adapter/MethodDispatcher.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/adapter/MethodDispatcher.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/adapter/MethodDispatcher.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+interface MethodDispatcher
+{
+ Object dispatch(ClassAdaptable adaptable, Object[] args) throws Throwable;
+}
Added: trunk/common/src/main/org/jboss/portal/common/adapter/MethodDispatcherFactory.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/adapter/MethodDispatcherFactory.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/common/adapter/MethodDispatcherFactory.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+interface MethodDispatcherFactory
+{
+ MethodDispatcher createDispatcher(Method method);
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/adapter/Adapted1.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/adapter/Adapted1.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/adapter/Adapted1.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class Adapted1 implements Business1
+{
+
+ /** . */
+ int business1MethodCount;
+
+ /** . */
+ int commonMethodCount;
+
+ public void business1Method()
+ {
+ business1MethodCount++;
+ }
+
+ public void commonMethod()
+ {
+ commonMethodCount++;
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/adapter/Adapted2.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/adapter/Adapted2.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/adapter/Adapted2.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class Adapted2 implements Business2
+{
+
+ /** . */
+ int business2MethodCount;
+
+ /** . */
+ int commonMethodCount;
+
+ public void business2Method()
+ {
+ business2MethodCount++;
+ }
+
+ public void commonMethod()
+ {
+ commonMethodCount++;
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/adapter/AdapterTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/adapter/AdapterTestCase.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/adapter/AdapterTestCase.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,162 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.adapter.ClassAdapter;
+import org.jboss.portal.common.adapter.ClassAdapted;
+import org.jboss.portal.common.adapter.ClassAdaptable;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AdapterTestCase extends TestCase
+{
+
+ Adapted1 adapted1;
+ Adapted2 adapted2;
+ ObjectAdapted objectAdapted;
+ ClassAdaptable adaptable;
+
+ protected void setUp() throws Exception
+ {
+ adapted1 = new Adapted1();
+ adapted2 = new Adapted2();
+ objectAdapted = new ObjectAdapted();
+ ClassAdapted[] adapteds = new ClassAdapted[]{new ClassAdapted(Business1.class,
adapted1),new ClassAdapted(Business2.class, adapted2)};
+ ClassAdapter adapter = new
ClassAdapter(Thread.currentThread().getContextClassLoader(), adapteds, objectAdapted);
+ adaptable = adapter.getAdaptable();
+ }
+
+
+ protected void tearDown() throws Exception
+ {
+ adapted1 = null;
+ adapted2 = null;
+ objectAdapted = null;
+ adaptable = null;
+ }
+
+ public void testImplementedInterfaces()
+ {
+ assertTrue(adaptable instanceof Business1);
+ assertTrue(adaptable instanceof Business2);
+ }
+
+ public void testObjectMethodCall() throws Exception
+ {
+ assertEquals(0, adapted1.business1MethodCount);
+ assertEquals(0, adapted1.commonMethodCount);
+ assertEquals(0, adapted2.business2MethodCount);
+ assertEquals(0, adapted2.commonMethodCount);
+ assertEquals(0, objectAdapted.toStringCount);
+ assertEquals(0, objectAdapted.hashCodeCount);
+ assertEquals(0, objectAdapted.equalsCount);
+
+ //
+ assertEquals("Foo", adaptable.toString());
+ assertEquals(0, adapted1.business1MethodCount);
+ assertEquals(0, adapted1.commonMethodCount);
+ assertEquals(0, adapted2.business2MethodCount);
+ assertEquals(0, adapted2.commonMethodCount);
+ assertEquals(1, objectAdapted.toStringCount);
+ assertEquals(0, objectAdapted.hashCodeCount);
+ assertEquals(0, objectAdapted.equalsCount);
+
+ //
+ assertEquals(1234, adaptable.hashCode());
+ assertEquals(0, adapted1.business1MethodCount);
+ assertEquals(0, adapted1.commonMethodCount);
+ assertEquals(0, adapted2.business2MethodCount);
+ assertEquals(0, adapted2.commonMethodCount);
+ assertEquals(1, objectAdapted.toStringCount);
+ assertEquals(1, objectAdapted.hashCodeCount);
+ assertEquals(0, objectAdapted.equalsCount);
+
+ //
+ assertEquals(true, adaptable.equals(Boolean.TRUE));
+ assertEquals(0, adapted1.business1MethodCount);
+ assertEquals(0, adapted1.commonMethodCount);
+ assertEquals(0, adapted2.business2MethodCount);
+ assertEquals(0, adapted2.commonMethodCount);
+ assertEquals(1, objectAdapted.toStringCount);
+ assertEquals(1, objectAdapted.hashCodeCount);
+ assertEquals(1, objectAdapted.equalsCount);
+
+ //
+ assertEquals(false, adaptable.equals(Boolean.FALSE));
+ assertEquals(0, adapted1.business1MethodCount);
+ assertEquals(0, adapted1.commonMethodCount);
+ assertEquals(0, adapted2.business2MethodCount);
+ assertEquals(0, adapted2.commonMethodCount);
+ assertEquals(1, objectAdapted.toStringCount);
+ assertEquals(1, objectAdapted.hashCodeCount);
+ assertEquals(2, objectAdapted.equalsCount);
+ }
+
+ public void testBusinessMethodCall() throws Exception
+ {
+ assertEquals(0, adapted1.business1MethodCount);
+ assertEquals(0, adapted1.commonMethodCount);
+ assertEquals(0, adapted2.business2MethodCount);
+ assertEquals(0, adapted2.commonMethodCount);
+ assertEquals(0, objectAdapted.toStringCount);
+ assertEquals(0, objectAdapted.hashCodeCount);
+ assertEquals(0, objectAdapted.equalsCount);
+
+ //
+ Business1 business1Adapter = (Business1)adaptable;
+ Business2 business2Adapter = (Business2)adaptable;
+
+ //
+ business1Adapter.business1Method();
+ assertEquals(1, adapted1.business1MethodCount);
+ assertEquals(0, adapted1.commonMethodCount);
+ assertEquals(0, adapted2.business2MethodCount);
+ assertEquals(0, adapted2.commonMethodCount);
+ assertEquals(0, objectAdapted.toStringCount);
+ assertEquals(0, objectAdapted.hashCodeCount);
+ assertEquals(0, objectAdapted.equalsCount);
+
+ //
+ business2Adapter.business2Method();
+ assertEquals(1, adapted1.business1MethodCount);
+ assertEquals(0, adapted1.commonMethodCount);
+ assertEquals(1, adapted2.business2MethodCount);
+ assertEquals(0, adapted2.commonMethodCount);
+ assertEquals(0, objectAdapted.toStringCount);
+ assertEquals(0, objectAdapted.hashCodeCount);
+ assertEquals(0, objectAdapted.equalsCount);
+
+ //
+ business1Adapter.commonMethod();
+ assertEquals(1, adapted1.business1MethodCount);
+ assertEquals(1, adapted1.commonMethodCount);
+ assertEquals(1, adapted2.business2MethodCount);
+ assertEquals(0, adapted2.commonMethodCount);
+ assertEquals(0, objectAdapted.toStringCount);
+ assertEquals(0, objectAdapted.hashCodeCount);
+ assertEquals(0, objectAdapted.equalsCount);
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/adapter/Business1.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/adapter/Business1.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/adapter/Business1.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface Business1
+{
+ void business1Method();
+ void commonMethod();
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/adapter/Business2.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/adapter/Business2.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/adapter/Business2.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * 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.common.adapter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface Business2
+{
+ void business2Method();
+ void commonMethod();
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/adapter/ObjectAdapted.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/adapter/ObjectAdapted.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/test/common/adapter/ObjectAdapted.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -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.test.common.adapter;
+
+import org.jboss.portal.common.adapter.JavaLangObjectAdapted;
+import org.jboss.portal.common.adapter.ClassAdaptable;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ObjectAdapted implements JavaLangObjectAdapted
+{
+
+ int toStringCount;
+ int hashCodeCount;
+ int equalsCount;
+
+ public String toString(ClassAdaptable adaptable)
+ {
+ toStringCount++;
+ return "Foo";
+ }
+
+ public int hashCode(ClassAdaptable adaptable)
+ {
+ hashCodeCount++;
+ return 1234;
+ }
+
+ public boolean equals(ClassAdaptable adaptable, Object obj)
+ {
+ equalsCount++;
+ return ((Boolean)obj).booleanValue();
+ }
+}
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-05-08 23:08:48 UTC (rev 7225)
+++ trunk/core/build.xml 2007-05-09 09:27:25 UTC (rev 7226)
@@ -555,10 +555,19 @@
</x-sysproperty>
<x-test>
+<!--
<zest todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase"
outfile="TEST-PortalObjectContainerTestCase">
<parameter name="CacheNaturalId" value="true"/>
+ <parameter name="ConfigLocation"
value="org/jboss/portal/test/core/model/portal/persistent-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"/>
+ <parameter name="ConfigLocation"
value="org/jboss/portal/test/core/model/portal/transient-jboss-beans.xml"/>
+ </zest>
+<!--
<zest todir="${test.reports}"
name="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase"
outfile="TEST-PersistedLocally-ClonedOnCreate-InstanceContainerTestCase">
<parameter name="PersistLocally" value="true"/>
@@ -600,6 +609,7 @@
name="org.jboss.portal.test.core.model.portal.PortalObjectPermissionTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectIdTestCase"/>
+-->
</x-test>
<x-classpath>
<pathelement location="${build.lib}/portal-core-lib.jar"/>
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/portlet/AjaxInterceptor.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/AjaxInterceptor.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/AjaxInterceptor.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -26,12 +26,11 @@
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
-import org.jboss.portal.core.metadata.portlet.AjaxMetaData;
+import org.jboss.portal.core.portlet.info.CorePortletInfo;
+import org.jboss.portal.core.portlet.info.AjaxInfo;
/**
* Look at the portlet ajax meta data.
@@ -44,6 +43,7 @@
public class AjaxInterceptor extends PortletInterceptor
{
+ /** . */
public static final String PARTIAL_REFRESH = "partialRefresh";
protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
@@ -53,14 +53,14 @@
//
if (response instanceof FragmentResponse)
{
- PortletContainer container =
((ContainerPortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO)).getContainer();
- JBossPortletMetaData portletMD =
(JBossPortletMetaData)container.getJBossMetaData();
- if (portletMD != null)
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
+ CorePortletInfo info = (CorePortletInfo)container.getInfo();
+ if (info != null)
{
- AjaxMetaData ajax = portletMD.getAjax();
+ AjaxInfo ajax = info.getAjax();
if (ajax != null)
{
- invocation.setAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE,
PARTIAL_REFRESH, ajax.getPartialRefresh());
+ invocation.setAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE,
PARTIAL_REFRESH, Boolean.valueOf(ajax.getPartialRefresh()));
}
}
}
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -24,12 +24,10 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.markup.MarkupElement;
-import org.jboss.portal.core.metadata.portlet.HeaderContentMetaData;
-import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
-import org.jboss.portal.core.metadata.portlet.ElementMetaData;
+import org.jboss.portal.core.portlet.info.CorePortletInfo;
+import org.jboss.portal.core.portlet.info.MarkupHeaderInfo;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
-import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
@@ -63,22 +61,19 @@
String headerChars = fragment.getHeader();
// Add declaratively injected header content here (get it via the component)
- PortletContainer container =
((ContainerPortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO)).getContainer();
- JBossPortletMetaData portletMD =
(JBossPortletMetaData)container.getJBossMetaData();
- if (portletMD != null)
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
+ CorePortletInfo info = (CorePortletInfo)container.getInfo();
+ MarkupHeaderInfo headerContentInfo = info.getMarkupHeader();
+ if (headerContentInfo != null)
{
- HeaderContentMetaData headerContent = portletMD.getHeaderContent();
- if (headerContent != null)
- {
- // Init the buffer
- buffer = initBuffer(headerChars);
+ // Init the buffer
+ buffer = initBuffer(headerChars);
- // Get the context path
- String contextPath =
(String)invocation.getDispatchedRequest().getAttribute("javax.servlet.include.context_path");
+ // Get the context path
+ String contextPath =
(String)invocation.getDispatchedRequest().getAttribute("javax.servlet.include.context_path");
- // Render header
- render(headerContent, buffer, contextPath);
- }
+ // Render header
+ render(headerContentInfo, buffer, contextPath);
}
// Add header content coming from the response written by the portlet at
runtime
@@ -124,18 +119,17 @@
}
/**
- * Render the header content provided by the portlet meta data.
+ * Render the header content provided by the portlet.
*
* @param headerContent
* @param writer
* @param contextPath
*/
- protected void render(HeaderContentMetaData headerContent, StringWriter writer, String
contextPath)
+ protected void render(MarkupHeaderInfo headerContent, StringWriter writer, String
contextPath)
{
- for (Iterator i = headerContent.getElements().iterator(); i.hasNext();)
+ for (Iterator i = headerContent.getMarkupElements().iterator(); i.hasNext();)
{
- ElementMetaData elementMD = (ElementMetaData)i.next();
- MarkupElement element = elementMD.getElement();
+ MarkupElement element = (MarkupElement)i.next();
writer.write(element.toString(contextPath));
}
}
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/TransactionInterceptor.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/TransactionInterceptor.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/TransactionInterceptor.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -24,12 +24,11 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.transaction.Transactions;
-import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.core.portlet.info.CorePortletInfo;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -44,11 +43,11 @@
Transactions.Type txType = Transactions.TYPE_NOT_SUPPORTED;
// Override tx type if found
- ContainerPortletInfo portlet =
(ContainerPortletInfo)(PortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO);
- JBossPortletMetaData portletMD = portlet.getContainer().getJBossMetaData();
- if (portletMD != null)
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
+ CorePortletInfo info = (CorePortletInfo)container.getInfo();
+ if (info != null)
{
- txType = portletMD.getTxType();
+ txType = info.getTxType();
}
//
Modified: trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeImpl.java 2007-05-08
23:08:48 UTC (rev 7225)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeImpl.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -106,7 +106,7 @@
* @param parentNode the parent node of this node
* @param object the wrapped portal object
*/
- protected PortalNodeImpl(PortalNodeImpl parentNode, PortalObject object)
+ private PortalNodeImpl(PortalNodeImpl parentNode, PortalObject object)
{
this.portalAuthorizationManager = parentNode.portalAuthorizationManager;
this.parentNode = parentNode;
@@ -355,16 +355,25 @@
{
Map childrenMap = new HashMap();
+ // See if we have recursive permission on the provided node that will avoid
to make a check for each of them
+ boolean allVisible = portalAuthorizationManager.checkPermission(new
PortalObjectPermission(objectNode.object.getId(),
PortalObjectPermission.VIEW_RECURSIVE_ACTION));
+
//
for (Iterator i = tmp.iterator(); i.hasNext();)
{
PortalObject childObject = (PortalObject)i.next();
- // Prepare to check
- PortalObjectPermission perm = new
PortalObjectPermission(childObject.getId(), PortalObjectPermission.VIEW_MASK);
+ // It is visible if the parent has recursive view enabled
+ boolean visible = allVisible;
+ // Check for the particular node
+ if (!visible)
+ {
+ visible = portalAuthorizationManager.checkPermission(new
PortalObjectPermission(childObject.getId(), PortalObjectPermission.VIEW_MASK));
+ }
+
// We only add it if the user can view the node
- if (portalAuthorizationManager.checkPermission(perm))
+ if (visible)
{
PortalNodeImpl child = new PortalNodeImpl(objectNode, childObject);
childrenMap.put(child.getName(), child);
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -77,9 +77,9 @@
this(true);
}
- public PortalObjectImpl(boolean hibernate)
+ public PortalObjectImpl(boolean initState)
{
- this.declaredPropertyMap = hibernate ? null : new HashMap();
+ this.declaredPropertyMap = initState ? null : new HashMap();
this.listener = null;
}
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-08
23:08:48 UTC (rev 7225)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -46,21 +46,12 @@
//
ctx = new Context();
- }
- public boolean createRootObject()
- {
- if (root != null)
- {
- return false;
- }
-
//
root = new ObjectNode(ctx, "", "");
- ContextImpl ctx = new ContextImpl();
+ ContextImpl ctx = new ContextImpl(false);
root.setObject(ctx);
ctx.setObjectNode(root);
- return true;
}
/** @see PortalObjectContainer#getAuthorizationDomain() */
Added: trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/AjaxInfoImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/AjaxInfoImpl.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/AjaxInfoImpl.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.impl.portlet.info;
+
+import org.jboss.portal.core.portlet.info.AjaxInfo;
+import org.jboss.portal.core.metadata.portlet.AjaxMetaData;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AjaxInfoImpl implements AjaxInfo
+{
+
+ /** . */
+ private boolean partialRefresh;
+
+ public AjaxInfoImpl(AjaxMetaData ajaxMD)
+ {
+ partialRefresh = !Boolean.FALSE.equals(ajaxMD.getPartialRefresh());
+ }
+
+ public boolean getPartialRefresh()
+ {
+ return partialRefresh;
+ }
+}
Added:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoFactory.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoFactory.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.impl.portlet.info;
+
+import org.jboss.portal.portlet.impl.jsr168.spi.PortletInfoFactory;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
+import org.jboss.portal.common.i18n.ResourceBundleManager;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CorePortletInfoFactory implements PortletInfoFactory
+{
+ public PortletInfo createPortletInfo(
+ PortletMetaData portletMD,
+ JBossPortletMetaData jbossPortletMD,
+ ResourceBundleManager resourceBundleManager)
+ {
+ return new CorePortletInfoImpl(portletMD, jbossPortletMD, resourceBundleManager);
+ }
+}
Added:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * 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.impl.portlet.info;
+
+import org.jboss.portal.core.portlet.info.CorePortletInfo;
+import org.jboss.portal.core.portlet.info.AjaxInfo;
+import org.jboss.portal.core.portlet.info.MarkupHeaderInfo;
+import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
+import org.jboss.portal.core.metadata.portlet.AjaxMetaData;
+import org.jboss.portal.core.metadata.portlet.HeaderContentMetaData;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.common.i18n.ResourceBundleManager;
+import org.jboss.portal.common.transaction.Transactions;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CorePortletInfoImpl extends ContainerPortletInfo implements CorePortletInfo
+{
+
+ /** . */
+ private final Transactions.Type txType;
+
+ /** . */
+ private final AjaxInfoImpl ajax;
+
+ /** . */
+ private final MarkupHeaderInfoImpl markupHeader;
+
+ public CorePortletInfoImpl(PortletMetaData portletMD,
org.jboss.portal.portlet.metadata.JBossPortletMetaData jbossPortletMD,
ResourceBundleManager bundleMgr)
+ {
+ super(portletMD, jbossPortletMD, bundleMgr);
+
+ //
+ AjaxMetaData ajaxMD = ((JBossPortletMetaData)jbossPortletMD).getAjax();
+ HeaderContentMetaData headerContentMD =
((JBossPortletMetaData)jbossPortletMD).getHeaderContent();
+
+ //
+ this.txType = jbossPortletMD.getTxType();
+ this.ajax = ajaxMD != null ? new AjaxInfoImpl(ajaxMD) : null;
+ this.markupHeader = headerContentMD != null ? new
MarkupHeaderInfoImpl(headerContentMD) : null;
+ }
+
+ public Transactions.Type getTxType()
+ {
+ return txType;
+ }
+
+ public AjaxInfo getAjax()
+ {
+ return ajax;
+ }
+
+ public MarkupHeaderInfo getMarkupHeader()
+ {
+ return markupHeader;
+ }
+}
Added:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/MarkupHeaderInfoImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/MarkupHeaderInfoImpl.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/info/MarkupHeaderInfoImpl.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,61 @@
+/******************************************************************************
+ * 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.impl.portlet.info;
+
+import org.jboss.portal.core.portlet.info.MarkupHeaderInfo;
+import org.jboss.portal.core.metadata.portlet.HeaderContentMetaData;
+import org.jboss.portal.core.metadata.portlet.ElementMetaData;
+
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MarkupHeaderInfoImpl implements MarkupHeaderInfo
+{
+
+ /** . */
+ private final Collection markupElements;
+
+ public MarkupHeaderInfoImpl(HeaderContentMetaData headerContentMD)
+ {
+ ArrayList markupElements = new ArrayList(headerContentMD.getElements().size());
+ for (Iterator i = headerContentMD.getElements().iterator();i.hasNext();)
+ {
+ ElementMetaData elementMD = (ElementMetaData)i.next();
+ markupElements.add(elementMD.getElement());
+ }
+
+ //
+ this.markupElements = Collections.unmodifiableCollection(markupElements);
+ }
+
+ public Collection getMarkupElements()
+ {
+ return markupElements;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/portlet/info/AjaxInfo.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/info/AjaxInfo.java
(rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/info/AjaxInfo.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * 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.portlet.info;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface AjaxInfo
+{
+ boolean getPartialRefresh();
+}
Added: trunk/core/src/main/org/jboss/portal/core/portlet/info/CorePortletInfo.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/info/CorePortletInfo.java
(rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/info/CorePortletInfo.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * 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.portlet.info;
+
+import org.jboss.portal.common.transaction.Transactions;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface CorePortletInfo
+{
+ /**
+ *
+ * @return
+ */
+ Transactions.Type getTxType();
+
+ /**
+ *
+ * @return
+ */
+ AjaxInfo getAjax();
+
+ /**
+ *
+ * @return
+ */
+ MarkupHeaderInfo getMarkupHeader();
+}
Added: trunk/core/src/main/org/jboss/portal/core/portlet/info/MarkupHeaderInfo.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/info/MarkupHeaderInfo.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/portlet/info/MarkupHeaderInfo.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * 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.portlet.info;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface MarkupHeaderInfo
+{
+ Collection getMarkupElements();
+}
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-08
23:08:48 UTC (rev 7225)
+++
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -23,19 +23,20 @@
package org.jboss.portal.test.core.model.portal;
import junit.framework.TestSuite;
-import org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalContainer;
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.Window;
import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
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;
@@ -60,7 +61,7 @@
{
/** . */
- private PersistentPortalObjectContainer container;
+ private PortalObjectContainer container;
public static TestSuite suite() throws Exception
{
@@ -76,15 +77,17 @@
protected String getConfigLocation()
{
- return "org/jboss/portal/test/core/model/portal/jboss-beans.xml";
+ TestParametrization parametrization = JUnitAdapter.getParametrization();
+ TestParameterValue paramValue =
parametrization.getParameterValue("ConfigLocation");
+ return (String)paramValue.get();
}
- public PersistentPortalObjectContainer getPortalObjectContainer()
+ public PortalObjectContainer getPortalObjectContainer()
{
return container;
}
- public void setPortalObjectContainer(PersistentPortalObjectContainer container)
+ public void setPortalObjectContainer(PortalObjectContainer container)
{
this.container = container;
}
Modified: trunk/core/src/main/org/jboss/portlet/JBossAPIFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossAPIFactory.java 2007-05-08 23:08:48 UTC
(rev 7225)
+++ trunk/core/src/main/org/jboss/portlet/JBossAPIFactory.java 2007-05-09 09:27:25 UTC
(rev 7226)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portlet;
-import org.jboss.portal.portlet.impl.jsr168.APIFactory;
+import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
@@ -34,7 +34,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class JBossAPIFactory implements APIFactory
+public class JBossAPIFactory implements PortletAPIFactory
{
public ActionRequestImpl createActionRequest(ActionInvocation invocation)
{
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-08
23:08:48 UTC (rev 7225)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-05-09
09:27:25 UTC (rev 7226)
@@ -1131,7 +1131,8 @@
optional-attribute-name="PortletInstancesEntityResolver"
proxy-type="attribute">portal:service=EntityResolver</depends>
<attribute
name="StandardJBossApplicationMetaDataLocation">conf/standardjboss-portlet.xml</attribute>
- <attribute
name="APIFactoryClassName">org.jboss.portlet.JBossAPIFactory</attribute>
+ <attribute
name="PortletAPIFactoryClassName">org.jboss.portlet.JBossAPIFactory</attribute>
+ <attribute
name="PortletInfoFactoryClassName">org.jboss.portal.core.impl.portlet.info.CorePortletInfoFactory</attribute>
<!-- Set to false in clustered mode, otherwise set to true -->
<attribute
name="CreateInstances">@portal.single(a)</attribute>
</mbean>
Added:
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
(rev 0)
+++
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/persistent-jboss-beans.xml 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<deployment
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer">
+
+ <bean name="DataSourceConfig"
class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>DataSourceConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="HibernateConfig"
class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JNDISupport"
class="org.jboss.portal.test.framework.embedded.JNDISupport">
+ </bean>
+
+ <bean name="TransactionManagerSupport"
class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport">
+ </bean>
+
+ <bean name="ConnectionManagerSupport"
class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
+ <property name="transactionManager"><inject
bean="TransactionManagerSupport"
property="transactionManager"/></property>
+ </bean>
+
+ <bean name="DataSourceSupport"
class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
+ <property name="transactionManager"><inject
bean="TransactionManagerSupport"
property="transactionManager"/></property>
+ <property name="connectionManagerReference"><inject
bean="ConnectionManagerSupport"
property="connectionManagerReference"/></property>
+ <property name="config"><inject
bean="DataSourceConfig"/></property>
+ </bean>
+
+ <bean name="HibernateSupport"
class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject
bean="HibernateConfig"/></property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>conf/hibernate/portal/domain.hbm.xml</value>
+ </list>
+ </property>
+ <property name="jNDIName">java:/SessionFactory</property>
+ </bean>
+
+ <bean name="AuthorizationDomainRegistry"
class="org.jboss.portal.security.impl.JBossAuthorizationDomainRegistryImpl">
+ </bean>
+
+ <bean name="AuthorizationManagerFactory"
class="org.jboss.portal.security.impl.jacc.JACCPortalAuthorizationManagerFactory">
+ <property name="authorizationDomainRegistry"><inject
bean="AuthorizationDomainRegistry"/></property>
+ </bean>
+
+ <bean name="ContentProviderRegistry"
class="org.jboss.portal.test.core.model.content.SimpleContentProviderRegistry">
+ </bean>
+
+ <bean name="PortletContentProvider"
class="org.jboss.portal.test.core.model.content.SimpleContentProvider">
+ <constructor>
+ <parameter>portlet</parameter>
+ </constructor>
+ <property name="registry"><inject
bean="ContentProviderRegistry"/></property>
+ </bean>
+
+ <bean name="PortalObjectContainer"
class="org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer">
+ <property
name="sessionFactoryJNDIName">java:/SessionFactory</property>
+ <property name="authorizationDomainRegistry"><inject
bean="AuthorizationDomainRegistry"/></property>
+ <property name="portalAuthorizationManagerFactory"><inject
bean="AuthorizationManagerFactory"/></property>
+ <property name="contentProviderRegistry"><inject
bean="ContentProviderRegistry"/></property>
+ </bean>
+
+ <bean name="TestBean"
class="org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>TestBean</parameter>
+ </constructor>
+ <property name="hibernate"><inject
bean="HibernateSupport"/></property>
+ <property name="portalObjectContainer"><inject
bean="PortalObjectContainer"/></property>
+ </bean>
+</deployment>
Added:
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/transient-jboss-beans.xml
===================================================================
---
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/transient-jboss-beans.xml
(rev 0)
+++
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/transient-jboss-beans.xml 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<deployment
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer">
+
+ <bean name="DataSourceConfig"
class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>DataSourceConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="HibernateConfig"
class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JNDISupport"
class="org.jboss.portal.test.framework.embedded.JNDISupport">
+ </bean>
+
+ <bean name="TransactionManagerSupport"
class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport">
+ </bean>
+
+ <bean name="ConnectionManagerSupport"
class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
+ <property name="transactionManager"><inject
bean="TransactionManagerSupport"
property="transactionManager"/></property>
+ </bean>
+
+ <bean name="DataSourceSupport"
class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
+ <property name="transactionManager"><inject
bean="TransactionManagerSupport"
property="transactionManager"/></property>
+ <property name="connectionManagerReference"><inject
bean="ConnectionManagerSupport"
property="connectionManagerReference"/></property>
+ <property name="config"><inject
bean="DataSourceConfig"/></property>
+ </bean>
+
+ <bean name="HibernateSupport"
class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject
bean="HibernateConfig"/></property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>conf/hibernate/portal/domain.hbm.xml</value>
+ </list>
+ </property>
+ <property name="jNDIName">java:/SessionFactory</property>
+ </bean>
+
+ <bean name="AuthorizationDomainRegistry"
class="org.jboss.portal.security.impl.JBossAuthorizationDomainRegistryImpl">
+ </bean>
+
+ <bean name="AuthorizationManagerFactory"
class="org.jboss.portal.security.impl.jacc.JACCPortalAuthorizationManagerFactory">
+ <property name="authorizationDomainRegistry"><inject
bean="AuthorizationDomainRegistry"/></property>
+ </bean>
+
+ <bean name="ContentProviderRegistry"
class="org.jboss.portal.test.core.model.content.SimpleContentProviderRegistry">
+ </bean>
+
+ <bean name="PortletContentProvider"
class="org.jboss.portal.test.core.model.content.SimpleContentProvider">
+ <constructor>
+ <parameter>portlet</parameter>
+ </constructor>
+ <property name="registry"><inject
bean="ContentProviderRegistry"/></property>
+ </bean>
+
+ <bean name="PortalObjectContainer"
class="org.jboss.portal.core.impl.model.portal.TransientPortalObjectContainer">
+<!--
+ <property name="authorizationDomainRegistry"><inject
bean="AuthorizationDomainRegistry"/></property>
+ <property name="portalAuthorizationManagerFactory"><inject
bean="AuthorizationManagerFactory"/></property>
+-->
+ <property name="contentProviderRegistry"><inject
bean="ContentProviderRegistry"/></property>
+ </bean>
+
+ <bean name="TestBean"
class="org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>TestBean</parameter>
+ </constructor>
+ <property name="hibernate"><inject
bean="HibernateSupport"/></property>
+ <property name="portalObjectContainer"><inject
bean="PortalObjectContainer"/></property>
+ </bean>
+</deployment>
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -28,7 +28,6 @@
import org.jboss.portal.portlet.container.PortletContainerInvoker;
import org.jboss.portal.web.spi.ServletContainerContext;
import org.jboss.portal.web.RequestDispatchCallback;
-import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.spi.RequestContext;
@@ -64,7 +63,7 @@
protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
{
- PortletContainer container =
((ContainerPortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO)).getContainer();
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
PortletApplication portletApplication = container.getApplication();
RequestContext reqCtx = invocation.getRequestContext();
ServletContext targetCtx = portletApplication.getContext().getServletContext();
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -29,6 +29,7 @@
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.common.util.ContentInfo;
import java.util.HashSet;
@@ -69,7 +70,8 @@
String contentType = si.getContentType().toString();
// Get the modes for this content type
- PortletInfo containerInfo =
(PortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO);
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
+ PortletInfo containerInfo = container.getInfo();
CapabilitiesInfo capabilities = containerInfo.getCapabilities();
// Add all the modes
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -30,6 +30,7 @@
import org.jboss.portal.portlet.session.SessionListener;
import org.jboss.portal.portlet.session.SubSession;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.PortletContainer;
import java.util.List;
@@ -41,7 +42,8 @@
{
protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
{
- PortletInfo portletInfo =
(PortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO);
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
+ PortletInfo portletInfo = container.getInfo();
SessionInfo sessionInfo = portletInfo.getSession();
if (sessionInfo != null &&
Boolean.TRUE.equals(sessionInfo.getDistributed()))
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -32,6 +32,7 @@
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.PortletContainer;
import org.apache.log4j.Logger;
/**
@@ -62,7 +63,8 @@
FragmentResponse fragmentResult = (FragmentResponse)response;
// Get config
- PortletInfo info =
(PortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO);
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
+ PortletInfo info = container.getInfo();
CacheInfo cacheInfo = info.getCache();
// Update the fragment cache info from the meta info
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -25,6 +25,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.TransportGuarantee;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.info.SecurityInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
@@ -43,7 +44,8 @@
protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
{
- PortletInfo containerInfo =
(PortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO);
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
+ PortletInfo containerInfo = container.getInfo();
SecurityInfo securityInfo = containerInfo.getSecurity();
SecurityContext securityContext = invocation.getSecurityContext();
boolean invoke = true;
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -28,12 +28,10 @@
import org.jboss.portal.portlet.container.PortletApplication;
import org.jboss.portal.portlet.container.PortletApplicationContext;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
-import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
-import org.jboss.portal.portlet.info.PortletInfo;
/**
* This aspect has two responsabilities :<br/> <ul> <li>continue the
request only if the portlet container valve is
@@ -49,7 +47,7 @@
{
protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
{
- PortletContainer container =
((ContainerPortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO)).getContainer();
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
Valve valve = container.getValve();
// Try to aquire the valve
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -25,11 +25,9 @@
import org.jboss.portal.common.concurrent.Valve;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.impl.jsr168.info.ContentTypes;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -53,22 +51,6 @@
PortletInfo getInfo();
/**
- * todo : remove that and have rather a way to expose runtime information meta data �
la PortletInfo.
- *
- * Return specific JBoss Portlet buildtime meta data.
- *
- * @return the JBoss specific buildtime meta data
- */
- JBossPortletMetaData getJBossMetaData();
-
- /**
- * Return the content types understood by the container.
- *
- * @return the content types
- */
- ContentTypes getContentTypes();
-
- /**
* Return the portlet application of this container.
*
* @return the application
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -57,8 +57,8 @@
public class PortletContainerInvoker implements PortletInvoker,
PortletApplicationRegistryListener
{
- /** The key under which the portlet container info are stored in the request scope of
the invocation. */
- public static final String PORTLET_CONTAINER_INFO =
"PORTLET_CONTAINER_INFO";
+ /** The key under which the portlet container is stored in the request scope of the
invocation. */
+ public static final String PORTLET_CONTAINER = "PORTLET_CONTAINER";
/** . */
private PortletApplicationRegistry registry;
@@ -82,8 +82,7 @@
portletInvocation.setHandler(null);
//
- ContainerPortletInfo info =
(ContainerPortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO);
- PortletContainer container = info.getContainer();
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
return container.dispatch(portletInvocation);
}
finally
@@ -184,9 +183,10 @@
public PortletInvocationResponse invoke(PortletInvocation invocation) throws
PortletInvokerException, InvocationException
{
+ // Get portlet container
PortletContext ctx = invocation.getTarget();
- Portlet portlet = getPortlet(ctx);
- ContainerPortletInfo info = (ContainerPortletInfo)portlet.getInfo();
+ PortletImpl portlet = (PortletImpl)getPortlet(ctx);
+ PortletContainer container = portlet.container;
//
InvocationHandler prevHandler = invocation.getHandler();
@@ -194,7 +194,7 @@
{
invocation.setHandler(handler);
- invocation.setAttribute(PortletInvocation.INVOCATION_SCOPE,
PORTLET_CONTAINER_INFO, info);
+ invocation.setAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER, container);
return
(PortletInvocationResponse)invocation.invoke(stackFactory.getInterceptorStack());
}
catch (Exception e)
@@ -215,7 +215,7 @@
finally
{
invocation.setHandler(prevHandler);
- invocation.removeAttribute(PortletInvocation.INVOCATION_SCOPE,
PORTLET_CONTAINER_INFO);
+ invocation.removeAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
}
}
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -22,7 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.container;
-import org.jboss.portal.portlet.impl.jsr168.APIFactory;
+import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
+import org.jboss.portal.portlet.impl.jsr168.spi.PortletInfoFactory;
import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
@@ -45,39 +46,44 @@
{
/** . */
- private PortletApplicationRegistry registry;
+ private final PortletAPIFactory portletAPIFactory;
/** . */
- private APIFactory apiFactory;
+ private final PortletInfoFactory portletInfoFactory;
/** . */
- private PortletApplicationMetaData portletAppMD;
+ private final PortletApplicationMetaData portletAppMD;
/** . */
- private JBossApplicationMetaData jbossAppMD;
+ private final JBossApplicationMetaData jbossAppMD;
/** . */
- private PortletApplicationImpl portletApp;
+ private final ServletContext servletContext;
/** . */
- private ServletContext servletContext;
+ private final ClassLoader classLoader;
/** . */
- private ClassLoader classLoader;
+ private PortletApplicationImpl portletApp;
/** . */
+ private PortletApplicationRegistry registry;
+
+ /** . */
private PortletApplicationRegistrationContext registrationContext;
public PortletApplicationContextImpl(
PortletApplicationRegistry registry,
- APIFactory apiFactory,
+ PortletAPIFactory portletAPIFactory,
+ PortletInfoFactory portletInfoFactory,
PortletApplicationMetaData portletAppMD,
JBossApplicationMetaData jbossAppMD,
ServletContext servletContext,
ClassLoader classLoader)
{
this.registry = registry;
- this.apiFactory = apiFactory;
+ this.portletAPIFactory = portletAPIFactory;
+ this.portletInfoFactory = portletInfoFactory;
this.portletAppMD = portletAppMD;
this.jbossAppMD = jbossAppMD;
this.servletContext = servletContext;
@@ -93,7 +99,7 @@
public void startPortletApplication() throws Exception
{
- portletApp = new PortletApplicationImpl(portletAppMD, jbossAppMD, this,
apiFactory);
+ portletApp = new PortletApplicationImpl(portletAppMD, jbossAppMD, this,
portletAPIFactory, portletInfoFactory);
portletApp.start();
//
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactory.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactory.java 2007-05-08
23:08:48 UTC (rev 7225)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactory.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -1,53 +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.portlet.impl.jsr168;
-
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface APIFactory
-{
- /**
- */
- ActionRequestImpl createActionRequest(ActionInvocation invocation);
-
- /**
- */
- ActionResponseImpl createActionResponse(ActionInvocation invocation, ActionRequestImpl
actionRequest);
-
- /**
- */
- RenderRequestImpl createRenderRequest(RenderInvocation invocation);
-
- /**
- */
- RenderResponseImpl createRenderResponse(RenderInvocation invocation, RenderRequestImpl
renderRequest);
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactoryImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactoryImpl.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactoryImpl.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -1,57 +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.portlet.impl.jsr168;
-
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class APIFactoryImpl implements APIFactory
-{
- public ActionRequestImpl createActionRequest(ActionInvocation invocation)
- {
- return new ActionRequestImpl(invocation);
- }
-
- public ActionResponseImpl createActionResponse(ActionInvocation invocation,
ActionRequestImpl actionRequest)
- {
- return new ActionResponseImpl(invocation, actionRequest);
- }
-
- public RenderRequestImpl createRenderRequest(RenderInvocation invocation)
- {
- return new RenderRequestImpl(invocation);
- }
-
- public RenderResponseImpl createRenderResponse(RenderInvocation invocation,
RenderRequestImpl renderRequest)
- {
- return new RenderResponseImpl(invocation, renderRequest);
- }
-}
Copied:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java
(from rev 7199,
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactoryImpl.java)
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java
(rev 0)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * 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.portlet.impl.jsr168;
+
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletAPIFactoryImpl implements PortletAPIFactory
+{
+ public ActionRequestImpl createActionRequest(ActionInvocation invocation)
+ {
+ return new ActionRequestImpl(invocation);
+ }
+
+ public ActionResponseImpl createActionResponse(ActionInvocation invocation,
ActionRequestImpl actionRequest)
+ {
+ return new ActionResponseImpl(invocation, actionRequest);
+ }
+
+ public RenderRequestImpl createRenderRequest(RenderInvocation invocation)
+ {
+ return new RenderRequestImpl(invocation);
+ }
+
+ public RenderResponseImpl createRenderResponse(RenderInvocation invocation,
RenderRequestImpl renderRequest)
+ {
+ return new RenderResponseImpl(invocation, renderRequest);
+ }
+}
Property changes on:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -24,6 +24,8 @@
import org.jboss.portal.portlet.impl.jsr168.api.PortletContextImpl;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
+import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
+import org.jboss.portal.portlet.impl.jsr168.spi.PortletInfoFactory;
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.portlet.container.PortletApplication;
import org.jboss.portal.portlet.container.PortletApplicationContext;
@@ -43,18 +45,24 @@
{
/** . */
- protected LinkedHashMap portlets;
+ protected final PortletApplicationMetaData metaData;
/** . */
- protected PortletApplicationMetaData metaData;
+ protected final JBossApplicationMetaData jbossMetaData;
/** . */
- protected JBossApplicationMetaData jbossMetaData;
+ protected final PortletApplicationContext context;
/** . */
- protected PortletApplicationContext context;
+ protected final PortletAPIFactory portletAPIFactory;
/** . */
+ protected final PortletInfoFactory portletInfoFactory;
+
+ /** . */
+ protected LinkedHashMap portlets;
+
+ /** . */
protected PortletContext portletContext;
/** . */
@@ -66,18 +74,17 @@
/** . */
protected Map windowStates;
- /** . */
- protected APIFactory apiFactory;
-
public PortletApplicationImpl(
PortletApplicationMetaData metaData,
JBossApplicationMetaData jbossMetaData,
PortletApplicationContext context,
- APIFactory apiFactory)
+ PortletAPIFactory portletAPIFactory,
+ PortletInfoFactory portletInfoFactory)
{
this.metaData = metaData;
this.jbossMetaData = jbossMetaData;
- this.apiFactory = apiFactory;
+ this.portletAPIFactory = portletAPIFactory;
+ this.portletInfoFactory = portletInfoFactory;
this.portlets = new LinkedHashMap();
this.context = context;
}
@@ -87,11 +94,16 @@
return metaData.getId();
}
- public APIFactory getAPIFactory()
+ public PortletAPIFactory getPortletAPIFactory()
{
- return apiFactory;
+ return portletAPIFactory;
}
+ public PortletInfoFactory getPortletInfoFactory()
+ {
+ return portletInfoFactory;
+ }
+
public PortletApplicationMetaData getMetaData()
{
return metaData;
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -28,16 +28,14 @@
import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletResourceBundleFactory;
import org.jboss.portal.portlet.container.PortletInitializationException;
import org.jboss.portal.portlet.container.PortletApplication;
import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.impl.jsr168.info.ContentTypes;
-import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletPreferencesMetaData;
import org.jboss.portal.portlet.impl.jsr168.metadata.SecurityRoleRefMetaData;
import org.jboss.portal.portlet.impl.jsr168.metadata.ParameterMetaData;
+import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -95,12 +93,6 @@
/** The portlet instance. */
protected Portlet portlet;
- /** . */
- protected ContentTypes contentTypes;
-
- /** . */
- protected ResourceBundleManager bundleMgr;
-
/** The invocation valve. */
protected final Valve valve;
@@ -217,24 +209,19 @@
initParameters.put(parameterMD.getName(), parameterMD.getValue());
}
- // Portlet config object
+ // Resource bundle manager
ResourceBundleManager bundleMgr =
PortletResourceBundleFactory.createResourceBundleManager(application.getContext().getClassLoader(),
metaData.getLanguages());
- //
+ // Portlet config object
PortletConfig config = new PortletConfigImpl(
metaData.getName(),
application.getPortletContext(),
initParameters,
bundleMgr);
- //
- ContentTypes contentTypes = new ContentTypes();
- contentTypes.setMetadata(metaData.getContentTypes());
- contentTypes.start();
+ // Create meta data
+ PortletInfo info = application.getPortletInfoFactory().createPortletInfo(metaData,
jbossMetaData, bundleMgr);
- //
- PortletInfo info = new ContainerPortletInfo(this, bundleMgr, contentTypes);
-
// Finally initialize the porlet instance
try
{
@@ -250,8 +237,6 @@
this.portlet = portlet;
this.config = config;
this.securityRoleRefsMap = Collections.unmodifiableMap(securityRoleRefsMap);
- this.contentTypes = contentTypes;
- this.bundleMgr = bundleMgr;
this.info = info;
this.started = true;
@@ -306,16 +291,12 @@
// Destroy the portlet object
destroyPortlet(portlet);
- // Stop the plugins (static)
- contentTypes.stop();
-
// Update state
preferencesValidator = null;
className = null;
portlet = null;
securityRoleRefsMap = null;
config = null;
- contentTypes = null;
userDataConstraints = null;
info = null;
}
@@ -331,11 +312,6 @@
return portlet;
}
- public ContentTypes getContentTypes()
- {
- return contentTypes;
- }
-
public Map getSecurityRoleRefsMap()
{
return securityRoleRefsMap;
@@ -469,7 +445,7 @@
protected PortletInvocationResponse invokeAction(ActionInvocation invocation) throws
IOException, PortletException
{
- APIFactory factory = application.getAPIFactory();
+ PortletAPIFactory factory = application.getPortletAPIFactory();
ActionRequestImpl areq = factory.createActionRequest(invocation);
ActionResponseImpl aresp = factory.createActionResponse(invocation, areq);
HttpServletRequest dreq = invocation.getDispatchedRequest();
@@ -494,7 +470,7 @@
protected PortletInvocationResponse invokeRender(RenderInvocation invocation) throws
IOException, PortletException
{
- APIFactory factory = application.getAPIFactory();
+ PortletAPIFactory factory = application.getPortletAPIFactory();
RenderRequestImpl rreq = factory.createRenderRequest(invocation);
RenderResponseImpl rresp = factory.createRenderResponse(invocation, rreq);
HttpServletRequest dreq = invocation.getDispatchedRequest();
@@ -513,9 +489,6 @@
dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
}
-
return rresp.getResult();
}
-
-
}
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletInfoFactoryImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletInfoFactoryImpl.java
(rev 0)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletInfoFactoryImpl.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * 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.portlet.impl.jsr168;
+
+import org.jboss.portal.portlet.impl.jsr168.spi.PortletInfoFactory;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
+import org.jboss.portal.common.i18n.ResourceBundleManager;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletInfoFactoryImpl implements PortletInfoFactory
+{
+ public PortletInfo createPortletInfo(PortletMetaData portletMD, JBossPortletMetaData
jbossPortletMD, ResourceBundleManager resourceBundleManager)
+ {
+ return new ContainerPortletInfo(portletMD, jbossPortletMD, resourceBundleManager);
+ }
+}
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -26,14 +26,11 @@
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
-import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.impl.jsr168.PortletRequestAttributes;
import org.jboss.portal.portlet.impl.jsr168.info.ContainerPreferencesInfo;
-import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.impl.jsr168.info.ContentTypes;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.spi.InstanceContext;
import org.jboss.portal.portlet.spi.RequestContext;
@@ -81,7 +78,6 @@
protected InstanceContext instanceContext;
protected PortletPreferences preferences;
protected PortletContainerImpl container;
- protected ContentTypes contentTypes;
protected HttpServletRequest dreq;
protected PortalContext portalContext;
protected PortletSessionImpl psession;
@@ -101,8 +97,7 @@
this.securityContext = invocation.getSecurityContext();
this.requestContext = invocation.getRequestContext();
this.instanceContext = invocation.getInstanceContext();
- this.container =
(PortletContainerImpl)((ContainerPortletInfo)(PortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO)).getContainer();
- this.contentTypes = container.getContentTypes();
+ this.container =
(PortletContainerImpl)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
this.dreq = invocation.getDispatchedRequest();
this.portalContext = new PortalContextImpl(invocation.getPortalContext());
this.parameters = null;
@@ -306,7 +301,7 @@
public boolean isUserInRole(String roleName)
{
// Get the map role name to role link
- Map securityRoleRefsMap =
((PortletContainerImpl)((ContainerPortletInfo)(PortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO)).getContainer()).getSecurityRoleRefsMap();
+ Map securityRoleRefsMap = container.getSecurityRoleRefsMap();
// Process the role link
String roleLink = (String)securityRoleRefsMap.get(roleName);
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -24,13 +24,14 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.common.i18n.ResourceBundleManager;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import java.util.Locale;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -49,15 +50,29 @@
WINDOW_STATES = Collections.unmodifiableSet(WINDOW_STATES);
}
+ /** . */
private Set supportedLocales;
+
+ /** . */
private ContentTypes contentTypes;
- private ResourceBundleManager bundleMgr;
- public ContainerCapabilities(Set supportedLocales, ResourceBundleManager bundleMgr,
ContentTypes contentTypes)
+ public ContainerCapabilities(PortletMetaData portletMD)
{
+ ContentTypes contentTypes = new ContentTypes();
+ contentTypes.setMetadata(portletMD.getContentTypes());
+ contentTypes.start();
+
+ // Add Locale.ENGLISH to supported locales if no locales was provided
+ // todo: should we always include it (i.e. even when other locales are present)?
+ HashSet supportedLocales = new
HashSet(portletMD.getLanguages().getSupportedLocales());
+ if (supportedLocales.isEmpty())
+ {
+ supportedLocales.add(Locale.ENGLISH);
+ }
+
+ //
this.supportedLocales = supportedLocales;
this.contentTypes = contentTypes;
- this.bundleMgr = bundleMgr;
}
public Set getMimeTypes()
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.info;
-import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
-import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
import org.jboss.portal.portlet.info.CacheInfo;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
@@ -33,13 +30,9 @@
import org.jboss.portal.portlet.info.PreferencesInfo;
import org.jboss.portal.portlet.info.SecurityInfo;
import org.jboss.portal.portlet.info.SessionInfo;
-import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
import org.jboss.portal.common.i18n.ResourceBundleManager;
-import java.util.HashSet;
-import java.util.Locale;
-
/**
* For now implementation that use the portlet container directly.
*
@@ -50,7 +43,6 @@
public class ContainerPortletInfo implements PortletInfo
{
- private PortletContainer container;
private ContainerCapabilities capabilities;
private ContainerPreferencesInfo preferences;
private ContainerMetaInfo meta;
@@ -60,49 +52,19 @@
private Boolean remotable;
public ContainerPortletInfo(
- PortletContainerImpl container,
- ResourceBundleManager bundleMgr,
- ContentTypes contentTypes)
+ PortletMetaData portletMD,
+ JBossPortletMetaData jbossPortletMD,
+ ResourceBundleManager bundleMgr)
{
- PortletMetaData portletMD = container.getMetaData();
- JBossPortletMetaData jbossPortletMD = container.getJBossMetaData();
- PortletApplicationImpl pwa = (PortletApplicationImpl)container.getApplication();
- JBossApplicationMetaData jbossAppMD = pwa.getJBossMetaData();
-
- //
- this.container = container;
-
- // Add Locale.ENGLISH to supported locales if no locales was provided
- // todo: should we always include it (i.e. even when other locales are present)?
- HashSet supportedLocales = new
HashSet(container.getMetaData().getLanguages().getSupportedLocales());
- if (supportedLocales.isEmpty())
- {
- supportedLocales.add(Locale.ENGLISH);
- }
-
- this.capabilities = new ContainerCapabilities(supportedLocales, bundleMgr,
contentTypes);
+ this.capabilities = new ContainerCapabilities(portletMD);
this.preferences = portletMD.getPreferences() != null ? new
ContainerPreferencesInfo(portletMD, bundleMgr) : new ContainerPreferencesInfo();
this.meta = new ContainerMetaInfo(portletMD, bundleMgr);
this.security = new ContainerSecurityInfo(portletMD);
this.cache = new ContainerCacheInfo(portletMD, jbossPortletMD);
- this.session = new ContainerSessionInfo(container);
-
- if (jbossPortletMD != null)
- {
- this.remotable = jbossPortletMD.getRemotable();
- }
- if (this.remotable == null && jbossAppMD != null)
- {
- this.remotable = jbossAppMD.getRemotable();
- }
-
+ this.session = new ContainerSessionInfo(jbossPortletMD);
+ this.remotable = jbossPortletMD.getRemotable() != null ?
jbossPortletMD.getRemotable() : Boolean.FALSE;
}
- public PortletContainer getContainer()
- {
- return container;
- }
-
public CapabilitiesInfo getCapabilities()
{
return capabilities;
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSessionInfo.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSessionInfo.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSessionInfo.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -35,9 +35,8 @@
private Boolean distributed;
- ContainerSessionInfo(PortletContainer portletContainer)
+ ContainerSessionInfo(JBossPortletMetaData md)
{
- JBossPortletMetaData md = portletContainer.getJBossMetaData();
if (md != null)
{
distributed = md.getDistributed();
Copied:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java
(from rev 7199,
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactory.java)
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java
(rev 0)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.portlet.impl.jsr168.spi;
+
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
+
+/**
+ * Factory for portlet API implementation.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface PortletAPIFactory
+{
+ /**
+ */
+ ActionRequestImpl createActionRequest(ActionInvocation invocation);
+
+ /**
+ */
+ ActionResponseImpl createActionResponse(ActionInvocation invocation, ActionRequestImpl
actionRequest);
+
+ /**
+ */
+ RenderRequestImpl createRenderRequest(RenderInvocation invocation);
+
+ /**
+ */
+ RenderResponseImpl createRenderResponse(RenderInvocation invocation, RenderRequestImpl
renderRequest);
+}
Property changes on:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/spi/PortletInfoFactory.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/spi/PortletInfoFactory.java
(rev 0)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/spi/PortletInfoFactory.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -0,0 +1,51 @@
+/******************************************************************************
+ * 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.portlet.impl.jsr168.spi;
+
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
+import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
+import org.jboss.portal.common.i18n.ResourceBundleManager;
+
+/**
+ * Enables the creation of custom portlet info implementations.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PortletInfoFactory
+{
+ /**
+ * Create a new portlet info from the provided meta data.
+ *
+ * @param portletMD the portlet meta data
+ * @param jbossPortletMD
+ * @param resourceBundleManager the resource bundle manager
+ * @return the runtime portlet meta data
+ */
+ PortletInfo createPortletInfo(
+ PortletMetaData portletMD,
+ JBossPortletMetaData jbossPortletMD,
+ ResourceBundleManager resourceBundleManager);
+}
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/metadata/JBossPortletMetaData.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/metadata/JBossPortletMetaData.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/metadata/JBossPortletMetaData.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -25,17 +25,30 @@
import org.jboss.portal.common.transaction.Transactions;
/**
+ * Specific metadata specified to jboss portlet container.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
public class JBossPortletMetaData implements Cloneable
{
+ /** . */
private String name;
+
+ /** . */
private Boolean remotable;
+
+ /** . */
private SecurityConstraintMetaData securityConstraint;
+
+ /** . */
private Integer cacheRefType;
+
+ /** . */
private Transactions.Type txType;
+
+ /** . */
private Boolean distributed;
public String getName()
@@ -98,6 +111,9 @@
this.txType = txType;
}
+ /**
+ * Merge the current meta data with portlet application.
+ */
public void merge(JBossApplicationMetaData application)
{
if (remotable == null)
@@ -106,6 +122,9 @@
}
}
+ /**
+ * Merge the current meta data with a specified one.
+ */
public void merge(JBossPortletMetaData portlet)
{
if (remotable == null)
Modified:
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
===================================================================
---
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -141,7 +141,8 @@
{
portletApplicationContext = new PortletApplicationContextImpl(
factory.getWebAppRegistry(),
- factory.getAPIFactory(),
+ factory.getPortletAPIFactory(),
+ factory.getPortletInfoFactory(),
portletAppMD,
jbossAppMD,
pwa.getServletContext(),
Modified:
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
===================================================================
---
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java 2007-05-08
23:08:48 UTC (rev 7225)
+++
trunk/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java 2007-05-09
09:27:25 UTC (rev 7226)
@@ -27,8 +27,10 @@
import org.jboss.portal.portlet.container.PortletApplicationRegistry;
import org.jboss.portal.portlet.deployment.JBossApplicationMetaDataFactory;
import org.jboss.portal.portlet.deployment.ValueTrimmingFilter;
-import org.jboss.portal.portlet.impl.jsr168.APIFactory;
-import org.jboss.portal.portlet.impl.jsr168.APIFactoryImpl;
+import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
+import org.jboss.portal.portlet.impl.jsr168.spi.PortletInfoFactory;
+import org.jboss.portal.portlet.impl.jsr168.PortletAPIFactoryImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletInfoFactoryImpl;
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.portlet.security.PortletSecurityService;
import org.jboss.portal.server.config.ServerConfig;
@@ -64,12 +66,15 @@
protected ServerConfig config;
/** . */
- protected String apiFactoryClassName;
+ protected String portletAPIFactoryClassName;
/** . */
- protected APIFactory apiFactory;
+ protected String portletInfoFactoryClassName;
/** . */
+ protected PortletAPIFactory portletAPIFactory;
+
+ /** . */
protected PortletSecurityService portletSecurityService;
/** . */
@@ -81,6 +86,9 @@
/** . */
protected EntityResolver jbossPortletEntityResolver;
+ /** . */
+ protected PortletInfoFactory portletInfoFactory;
+
public EntityResolver getJBossPortletEntityResolver()
{
return jbossPortletEntityResolver;
@@ -101,16 +109,26 @@
this.config = config;
}
- public String getAPIFactoryClassName()
+ public String getPortletAPIFactoryClassName()
{
- return apiFactoryClassName;
+ return portletAPIFactoryClassName;
}
- public void setAPIFactoryClassName(String apiFactoryClassName)
+ public void setPortletAPIFactoryClassName(String apiFactoryClassName)
{
- this.apiFactoryClassName = apiFactoryClassName;
+ this.portletAPIFactoryClassName = apiFactoryClassName;
}
+ public String getPortletInfoFactoryClassName()
+ {
+ return portletInfoFactoryClassName;
+ }
+
+ public void setPortletInfoFactoryClassName(String portletInfoFactoryClassName)
+ {
+ this.portletInfoFactoryClassName = portletInfoFactoryClassName;
+ }
+
public PortletApplicationRegistry getWebAppRegistry()
{
return portletApplicationRegistry;
@@ -136,11 +154,16 @@
return standardJBossApplicationMetaData;
}
- public APIFactory getAPIFactory()
+ public PortletAPIFactory getPortletAPIFactory()
{
- return apiFactory;
+ return portletAPIFactory;
}
+ public PortletInfoFactory getPortletInfoFactory()
+ {
+ return portletInfoFactory;
+ }
+
public boolean acceptFile(URL url)
{
String urlAsFile = url.getFile();
@@ -158,21 +181,38 @@
//
try
{
- apiFactory = new APIFactoryImpl();
+ portletAPIFactory = new PortletAPIFactoryImpl();
// Try to load
- if (apiFactoryClassName != null)
+ if (portletAPIFactoryClassName != null)
{
- Class apiFactoryClass =
Thread.currentThread().getContextClassLoader().loadClass(apiFactoryClassName);
- apiFactory = (APIFactory)apiFactoryClass.newInstance();
+ Class portletAPIFactoryClass =
Thread.currentThread().getContextClassLoader().loadClass(portletAPIFactoryClassName);
+ portletAPIFactory = (PortletAPIFactory)portletAPIFactoryClass.newInstance();
}
}
catch (Exception e)
{
- log.error("Cannot create portlet APIFactory=" + apiFactoryClassName +
" will use default one instead", e);
+ log.error("Cannot create portlet PortletAPIFactory=" +
portletAPIFactoryClassName + " will use default one instead", e);
}
//
+ try
+ {
+ portletInfoFactory = new PortletInfoFactoryImpl();
+
+ // Try to load
+ if (portletInfoFactoryClassName != null)
+ {
+ Class portletInfoFactoryClass =
Thread.currentThread().getContextClassLoader().loadClass(portletInfoFactoryClassName);
+ portletInfoFactory =
(PortletInfoFactory)portletInfoFactoryClass.newInstance();
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Cannot create portlet PortletAPIFactory=" +
portletAPIFactoryClassName + " will use default one instead", e);
+ }
+
+ //
loadStandardJBossApplicationMetaData();
//
@@ -210,7 +250,7 @@
super.stop();
//
- apiFactory = null;
+ portletAPIFactory = null;
}
public PortletSecurityService getPortletSecurityService()