JBoss Portal SVN: r10197 - in modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet: impl/jsr168/api and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-04 19:58:25 -0500 (Tue, 04 Mar 2008)
New Revision: 10197
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java
Log:
minor cleanup
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-03-04 23:11:55 UTC (rev 10196)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-03-05 00:58:25 UTC (rev 10197)
@@ -194,8 +194,6 @@
}
}
- // Compute the validation token
-
// Cache if we can
if (expirationTimeMillis > 0)
{
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java 2008-03-04 23:11:55 UTC (rev 10196)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java 2008-03-05 00:58:25 UTC (rev 10197)
@@ -68,12 +68,6 @@
// Configure expiration value
PortletInfo info = preq.container.getInfo();
- CacheInfo cacheInfo = info.getCache();
- org.jboss.portal.portlet.cache.CacheControl cc = new org.jboss.portal.portlet.cache.CacheControl(
- cacheInfo.getExpirationSecs(),
- CacheScope.PRIVATE,
- null
- );
// 0 means no buffering - we say no buffering
this.bufferSize = 0;
16 years, 3 months
JBoss Portal SVN: r10196 - branches.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-04 18:11:55 -0500 (Tue, 04 Mar 2008)
New Revision: 10196
Added:
branches/JBoss_Portal_2_6_4_JBPB/
Log:
branching 2.6.4 for start to admin app migration to bridge
Copied: branches/JBoss_Portal_2_6_4_JBPB (from rev 10195, tags/JBoss_Portal_2_6_4)
16 years, 3 months
JBoss Portal SVN: r10195 - modules/portlet/trunk/portal/src/main/resources/simple-portal-war/layouts/nav.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-03-04 16:46:37 -0500 (Tue, 04 Mar 2008)
New Revision: 10195
Modified:
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/layouts/nav/main.jsp
Log:
remove debugger for now
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/layouts/nav/main.jsp
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/layouts/nav/main.jsp 2008-03-04 21:31:31 UTC (rev 10194)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/layouts/nav/main.jsp 2008-03-04 21:46:37 UTC (rev 10195)
@@ -31,9 +31,6 @@
<li>
<a href="${pageContext.request.contextPath}/demo/demo3.jsp" class="${fn:substringAfter(pageContext.request.servletPath, 'demo/') == 'demo3.jsp' ? 'selected' : ''}">Demo3</a>
</li>
- <li>
- <a href="${pageContext.request.contextPath}/demo/eventdebug.jsp" class="${fn:substringAfter(pageContext.request.servletPath, 'demo/') == 'eventdebug.jsp' ? 'selected' : ''}">Event Debug</a>
- </li>
</ul>
<br class="clear"/>
</div>
16 years, 3 months
JBoss Portal SVN: r10194 - in modules/portlet/trunk: portal/src/main/resources/simple-portal-war/WEB-INF and 15 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-04 16:31:31 -0500 (Tue, 04 Mar 2008)
New Revision: 10194
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/common/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/common/CommonEventPayload.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/event/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/event/EventPayloadTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/eventsupport/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/eventsupport/CommonPayloadEventPortlet.java
modules/portlet/trunk/test/src/test/resources/jsr286/ext/event-war/
modules/portlet/trunk/test/src/test/resources/jsr286/ext/event-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/jsr286/ext/event-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr286/ext/event-war/WEB-INF/web.xml
modules/portlet/trunk/test/src/test/resources/jsr286/ext/eventsupport-war/
modules/portlet/trunk/test/src/test/resources/jsr286/ext/eventsupport-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/jsr286/ext/eventsupport-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr286/ext/eventsupport-war/WEB-INF/web.xml
Modified:
modules/portlet/trunk/build/pom.xml
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/ErrorResponse.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
JBPORTAL-1897 : Event payload marshalling
Modified: modules/portlet/trunk/build/pom.xml
===================================================================
--- modules/portlet/trunk/build/pom.xml 2008-03-04 20:04:28 UTC (rev 10193)
+++ modules/portlet/trunk/build/pom.xml 2008-03-04 21:31:31 UTC (rev 10194)
@@ -33,7 +33,7 @@
<version.jboss-logging>2.0.3.GA</version.jboss-logging>
<version.jbossxb>2.0.0.CR5</version.jbossxb>
<version.jboss-remoting>2.2.1.GA</version.jboss-remoting>
- <version.jboss.portal.common>1.2.0-Beta1</version.jboss.portal.common>
+ <version.jboss.portal.common>1.2.0-SNAPSHOT</version.jboss.portal.common>
<version.jboss.portal.web>1.2.0-SNAPSHOT</version.jboss.portal.web>
<version.jboss.unit>1.2.0.Beta2</version.jboss.unit>
<version.log4j>1.2.14</version.log4j>
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-03-04 20:04:28 UTC (rev 10193)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-03-04 21:31:31 UTC (rev 10194)
@@ -70,6 +70,7 @@
<bean name="ProducerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor"/>
<bean name="CCPPInterceptor" class="org.jboss.portal.portlet.aspects.portlet.CCPPInterceptor"/>
<bean name="RequestAttributeConversationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor"/>
+ <bean name="EventPayloadInterceptor" class="org.jboss.portal.portlet.aspects.portlet.EventPayloadInterceptor"/>
<bean name="ContainerStackFactory" class="org.jboss.portal.portlet.portal.InterceptorStackFactoryImpl">
<property name="interceptors">
<array>
@@ -79,6 +80,7 @@
<inject bean="ProducerCacheInterceptor"/>
<inject bean="CCPPInterceptor"/>
<inject bean="RequestAttributeConversationInterceptor"/>
+ <inject bean="EventPayloadInterceptor"/>
</array>
</property>
</bean>
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java 2008-03-04 21:31:31 UTC (rev 10194)
@@ -0,0 +1,198 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.aspects.portlet;
+
+import org.jboss.portal.portlet.invocation.PortletInterceptor;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.PortletApplication;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.EventingInfo;
+import org.jboss.portal.portlet.info.EventInfo;
+import org.jboss.portal.portlet.impl.info.ContainerTypeInfo;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.io.IOTools;
+import org.apache.log4j.Logger;
+
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * This interceptor is responsible for taking care of converting the optional event payload to the application
+ * classloader.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventPayloadInterceptor extends PortletInterceptor
+{
+
+ /** . */
+ private final static Logger log = Logger.getLogger(EventPayloadInterceptor.class);
+
+ protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
+ {
+ if (invocation instanceof EventInvocation)
+ {
+ EventInvocation eventInvocation = (EventInvocation)invocation;
+
+ //
+ Serializable srcPayload = eventInvocation.getPayload();
+
+ //
+ Serializable dstPayload = null;
+ if (srcPayload != null)
+ {
+ PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
+
+ //
+ PortletApplication application = container.getPortletApplication();
+ PortletApplicationContext applicationContext = application.getContext();
+ ClassLoader applicationClassLoader = applicationContext.getClassLoader();
+ String srcPayloadClassName = srcPayload.getClass().getName();
+ boolean trace = log.isTraceEnabled();
+ QName eventName = eventInvocation.getName();
+ String containerId = container.getId();
+ String applicationId = application.getId();
+
+ //
+ PortletInfo info = container.getInfo();
+ EventingInfo eventingInfo = info.getEventing();
+ Map<QName, ? extends EventInfo> consumedEventInfos = eventingInfo.getConsumedEvents();
+ EventInfo eventInfo = consumedEventInfos.get(eventName);
+
+ //
+ if (trace)
+ {
+ log.trace("Attempt to obtain for event " + eventName + " its payload class " + srcPayloadClassName + " in the application " + applicationId +
+ " for portlet " + container.getInfo());
+ }
+
+ //
+ Class dstPayloadClass = null;
+ if (eventInfo != null)
+ {
+ ContainerTypeInfo typeInfo = (ContainerTypeInfo)eventInfo.getType();
+
+ //
+ if (typeInfo != null)
+ {
+ dstPayloadClass = typeInfo.getType();
+ if (trace)
+ {
+ log.trace("Obtained for event " + eventName + " its payload class " + dstPayloadClass.getName() + " declared by the portlet meta data "
+ + containerId);
+ }
+ }
+ else
+ {
+ if (trace)
+ {
+ log.trace("No type declared for event " + eventName + " declared by the portlet meta data " + containerId);
+ }
+ }
+ }
+
+
+ //
+ if (dstPayloadClass == null)
+ {
+ if (trace)
+ {
+ log.trace("No event meta data declared by portlet " + containerId + " for event " + eventName + " will attempty " +
+ " to load same class name from the application " + applicationId + " classloader");
+ }
+
+ // We try to load the same class from the applicaton class loader
+ try
+ {
+ dstPayloadClass = applicationClassLoader.loadClass(srcPayloadClassName);
+ if (trace)
+ {
+ log.trace("Obtained matching event class " + dstPayloadClass.getName() + " in application " + applicationId + " for event " + eventName);
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ return new ErrorResponse("The application " + applicationId + " does not have access to the event payload class"
+ + srcPayloadClassName, e);
+ }
+ catch (NoClassDefFoundError e)
+ {
+ return new ErrorResponse("The application " + applicationId + " does not have access to the event payload class"
+ + srcPayloadClassName, e);
+ }
+ }
+
+ // We need maybe to perform some serialization to the classloader
+ if (dstPayloadClass != srcPayload.getClass())
+ {
+ if (trace)
+ {
+ log.trace("Need to convert event payload from class " + srcPayloadClassName + " to " + dstPayloadClass.getName());
+ }
+ try
+ {
+ dstPayload = IOTools.clone(srcPayload, applicationClassLoader);
+ }
+ catch (ClassNotFoundException e)
+ {
+ return new ErrorResponse("Could not convert the event payload from class " + srcPayloadClassName + " to class " + dstPayloadClass.getName(), e);
+ }
+ catch (IOException e)
+ {
+ // The cause is likely a non compatible changes in class version
+ return new ErrorResponse("Could not convert the event payload from class " + srcPayloadClassName + " to class " + dstPayloadClass.getName(), e);
+ }
+ }
+ else
+ {
+ dstPayload = srcPayload;
+ }
+ }
+
+ // Set payload
+ eventInvocation.setPayload(dstPayload);
+
+ //
+ try
+ {
+ return invocation.invokeNext();
+ }
+ finally
+ {
+ eventInvocation.setPayload(srcPayload);
+ }
+ }
+ else
+ {
+ return invocation.invokeNext();
+ }
+ }
+}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/ErrorResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/ErrorResponse.java 2008-03-04 20:04:28 UTC (rev 10193)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/ErrorResponse.java 2008-03-04 21:31:31 UTC (rev 10194)
@@ -49,6 +49,20 @@
this.message = cause.getMessage();
}
+ public ErrorResponse(String message, Throwable cause)
+ {
+ if (message == null)
+ {
+ throw new IllegalArgumentException("There must be a message");
+ }
+ if (cause == null)
+ {
+ throw new IllegalArgumentException("There must be a cause");
+ }
+ this.cause = cause;
+ this.message = message;
+ }
+
public ErrorResponse(String message)
{
if (message == null)
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/common/CommonEventPayload.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/common/CommonEventPayload.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/common/CommonEventPayload.java 2008-03-04 21:31:31 UTC (rev 10194)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.ext.common;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@XmlRootElement
+public class CommonEventPayload implements Serializable
+{
+
+ /** . */
+ private String string;
+
+ public String getString()
+ {
+ return string;
+ }
+
+ public void setString(String string)
+ {
+ this.string = string;
+ }
+}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/event/EventPayloadTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/event/EventPayloadTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/event/EventPayloadTestCase.java 2008-03-04 21:31:31 UTC (rev 10194)
@@ -0,0 +1,115 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.ext.event;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletActionTestAction;
+import org.jboss.portal.unit.actions.PortletEventTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.jsr286.ext.common.CommonEventPayload;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.deployer.response.DeployResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.Event;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class EventPayloadTestCase
+{
+
+ /** . */
+ boolean commonEventPonged = false;
+
+ /** . */
+ CommonEventPayload commonPayload;
+
+ /** . */
+ boolean sharedEventPonged = false;
+
+ public EventPayloadTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ return new DeployResponse("test-jsr286-ext-eventsupport.war");
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ //
+ seq.bindAction(2, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ commonPayload = new CommonEventPayload();
+ commonPayload.setString("commonpingvalue");
+ response.setEvent("CommonPing", commonPayload);
+ }
+ });
+ seq.bindAction(2, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertEquals("commonpingvalue", commonPayload.getString());
+ Event event = request.getEvent();
+ assertEquals("CommonPong", event.getName());
+ CommonEventPayload payload = (CommonEventPayload)event.getValue();
+ assertEquals("commonpongvalue", payload.getString());
+ commonEventPonged = true;
+ }
+ });
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertTrue(commonEventPonged);
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/eventsupport/CommonPayloadEventPortlet.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/eventsupport/CommonPayloadEventPortlet.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/eventsupport/CommonPayloadEventPortlet.java 2008-03-04 21:31:31 UTC (rev 10194)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.ext.eventsupport;
+
+import org.jboss.portal.test.portlet.jsr286.ext.common.CommonEventPayload;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.PortletException;
+import javax.portlet.Event;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class CommonPayloadEventPortlet extends GenericPortlet
+{
+ public void processEvent(EventRequest req, EventResponse resp) throws PortletException, IOException
+ {
+ Event event = req.getEvent();
+
+ //
+ if ("CommonPing".equals(event.getName()))
+ {
+ CommonEventPayload payload = (CommonEventPayload)event.getValue();
+ if (payload.getString().equals("commonpingvalue"))
+ {
+ CommonEventPayload newPayload = new CommonEventPayload();
+ payload.setString("commonpongvalue");
+ newPayload.setString("commonpongvalue");
+ resp.setEvent("CommonPong", newPayload);
+ }
+ }
+ }
+}
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-03-04 20:04:28 UTC (rev 10193)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-03-04 21:31:31 UTC (rev 10194)
@@ -378,6 +378,8 @@
<package-jsr286-ext-test test="dispatcher"/>
<package-jsr286-ext-test test="portletcontext"/>
<package-jsr286-ext-test test="portletinterface"/>
+ <package-jsr286-ext-test test="event"/>
+ <package-jsr286-ext-test test="eventsupport"/>
<!-- -->
<jar jarfile="${test.temp.lib}/portlet-test-lib.jar">
Added: modules/portlet/trunk/test/src/test/resources/jsr286/ext/event-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/ext/event-war/WEB-INF/portlet.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/ext/event-war/WEB-INF/portlet.xml 2008-03-04 21:31:31 UTC (rev 10194)
@@ -0,0 +1,54 @@
+<?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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet>
+ <portlet-name>UniversalTestPortletA</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-processing-event>
+ <name>CommonPong</name>
+ </supported-processing-event>
+ <supported-publishing-event>
+ <name>CommonPing</name>
+ </supported-publishing-event>
+ </portlet>
+
+ <event-definition>
+ <name>CommonPing</name>
+ <value-type>org.jboss.portal.test.portlet.jsr286.ext.common.CommonEventPayload</value-type>
+ </event-definition>
+
+ <event-definition>
+ <name>CommonPong</name>
+ <value-type>org.jboss.portal.test.portlet.jsr286.ext.common.CommonEventPayload</value-type>
+ </event-definition>
+
+</portlet-app>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/ext/event-war/WEB-INF/web.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/ext/event-war/WEB-INF/web.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/ext/event-war/WEB-INF/web.xml 2008-03-04 21:31:31 UTC (rev 10194)
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <listener>
+ <listener-class>org.jboss.portal.unit.PortletTestSuite</listener-class>
+ </listener>
+</web-app>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/ext/eventsupport-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/ext/eventsupport-war/WEB-INF/portlet.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/ext/eventsupport-war/WEB-INF/portlet.xml 2008-03-04 21:31:31 UTC (rev 10194)
@@ -0,0 +1,54 @@
+<?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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet>
+ <portlet-name>CommonPayloadEvenPortlet</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.jsr286.ext.eventsupport.CommonPayloadEventPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-processing-event>
+ <name>CommonPing</name>
+ </supported-processing-event>
+ <supported-publishing-event>
+ <name>CommonPong</name>
+ </supported-publishing-event>
+ </portlet>
+
+ <event-definition>
+ <name>CommonPing</name>
+ <value-type>org.jboss.portal.test.portlet.jsr286.ext.common.CommonEventPayload</value-type>
+ </event-definition>
+
+ <event-definition>
+ <name>CommonPong</name>
+ <value-type>org.jboss.portal.test.portlet.jsr286.ext.common.CommonEventPayload</value-type>
+ </event-definition>
+
+</portlet-app>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/ext/eventsupport-war/WEB-INF/web.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/ext/eventsupport-war/WEB-INF/web.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/ext/eventsupport-war/WEB-INF/web.xml 2008-03-04 21:31:31 UTC (rev 10194)
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+</web-app>
Modified: modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml 2008-03-04 20:04:28 UTC (rev 10193)
+++ modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml 2008-03-04 21:31:31 UTC (rev 10194)
@@ -85,6 +85,7 @@
<bean name="ProducerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor"/>
<bean name="CCPPInterceptor" class="org.jboss.portal.portlet.aspects.portlet.CCPPInterceptor"/>
<bean name="RequestAttributeConversationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor"/>
+ <bean name="EventPayloadInterceptor" class="org.jboss.portal.portlet.aspects.portlet.EventPayloadInterceptor"/>
<bean name="ContainerStackFactory" class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
<property name="interceptors">
<array>
@@ -94,6 +95,7 @@
<inject bean="ProducerCacheInterceptor"/>
<inject bean="CCPPInterceptor"/>
<inject bean="RequestAttributeConversationInterceptor"/>
+ <inject bean="EventPayloadInterceptor"/>
</array>
</property>
</bean>
Modified: modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-03-04 20:04:28 UTC (rev 10193)
+++ modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-03-04 21:31:31 UTC (rev 10194)
@@ -85,6 +85,7 @@
<bean name="ProducerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor"/>
<bean name="CCPPInterceptor" class="org.jboss.portal.portlet.aspects.portlet.CCPPInterceptor"/>
<bean name="RequestAttributeConversationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor"/>
+ <bean name="EventPayloadInterceptor" class="org.jboss.portal.portlet.aspects.portlet.EventPayloadInterceptor"/>
<bean name="ContainerStackFactory" class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
<property name="interceptors">
<array>
@@ -94,6 +95,7 @@
<inject bean="ProducerCacheInterceptor"/>
<inject bean="CCPPInterceptor"/>
<inject bean="RequestAttributeConversationInterceptor"/>
+ <inject bean="EventPayloadInterceptor"/>
</array>
</property>
</bean>
Modified: modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-03-04 20:04:28 UTC (rev 10193)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-03-04 21:31:31 UTC (rev 10194)
@@ -231,6 +231,10 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-ext-portletinterface.war"/>
</generic>
+ <generic>
+ <class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId" value="test-jsr286-ext-event.war"/>
+ </generic>
<!--Misc Tests-->
<!--
16 years, 3 months
JBoss Portal SVN: r10193 - in modules/portlet/trunk/portal/src/main: resources/simple-portal-war/css and 1 other directory.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-03-04 15:04:28 -0500 (Tue, 04 Mar 2008)
New Revision: 10193
Modified:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css
Log:
admin portlet markup/changes
Modified: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java 2008-03-04 19:58:45 UTC (rev 10192)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java 2008-03-04 20:04:28 UTC (rev 10193)
@@ -27,6 +27,10 @@
import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
import org.jboss.portal.portlet.container.managed.ManagedPortletFilter;
import org.jboss.portal.portlet.container.managed.ManagedObject;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.common.i18n.LocalizedString;
+import static org.jboss.unit.api.Assert.assertNotNull;
import javax.portlet.GenericPortlet;
import javax.portlet.RenderRequest;
@@ -38,6 +42,7 @@
import javax.portlet.PortletRequestDispatcher;
import java.io.IOException;
import java.io.PrintWriter;
+import java.util.Locale;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -129,22 +134,23 @@
url.setParameter("lifecycle", "start");
String startURL = url.toString();
- //
- //writer.print("<ul><li>Application " + application.getId() + " " + application.getStatus() +
- // " <a href=\"" + startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li><ul>");
+
+
writer.print("<table class=\"admin-table\">");
writer.print("" +
" <tr>\n" +
- " <td class=\"admin-app-header\" colspan=\"3\"><h3>Application</h3></td>\n" +
+ " <td class=\"admin-app-header\" colspan=\"4\"><h3>Application</h3></td>\n" +
" </tr>\n" +
" <tr class=\"admin-cat-header\">\n" +
" <td>ID</td>\n" +
" <td>Status</td>\n" +
+ " <td>Description</td>\n" +
" <td></td>\n" +
" </tr>" +
" <tr>\n" +
" <td>" + application.getId() + "</td>\n" +
" <td>" + application.getStatus() + "</td>\n" +
+ " <td></td>\n" +
" <td><a href=\"" + startURL + "\">Start</a> | <a href=\"" + stopURL + "\">Stop</a></td>\n" +
" </tr>");
@@ -167,7 +173,7 @@
writer.print("" +
" <tr>\n" +
- " <td class=\"admin-filter-header\" colspan=\"3\"><h3>Filter</h3></td>\n" +
+ " <td class=\"admin-filter-header\" colspan=\"4\"><h3>Filter</h3></td>\n" +
" </tr>\n" +
//" <tr class=\"admin-cat-header\">\n" +
//" <td>ID</td>\n" +
@@ -177,6 +183,7 @@
" <tr>\n" +
" <td>" + filter.getId() + "</td>\n" +
" <td>" + filter.getStatus() + "</td>\n" +
+ " <td></td>\n" +
" <td><a href=\"" + startURL + "\">Start</a> | <a href=\"" + stopURL + "\">Stop</a></td>\n" +
" </tr>");
@@ -195,22 +202,32 @@
url.setParameter("lifecycle", "start");
startURL = url.toString();
- //
- //writer.print("<li>Container " + container.getId() + " " + container.getStatus() + " <a href=\"" +
- // startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li>");
+
+ LocalizedString description = null;
+ String descString = "";
+ try{
+ MetaInfo metaInfo = container.getInfo().getMeta();
+ description = metaInfo.getMetaValue("description");
+ }catch(Exception e){
+ //e.printStackTrace();
+ }
+ if (description != null){
+ descString = description.getDefaultValue().getString();
+ }
writer.print("" +
" <tr>\n" +
- " <td class=\"admin-container-header\" colspan=\"3\"><h3>Container</h3></td>\n" +
+ " <td class=\"admin-container-header\" colspan=\"4\"><h3>Container</h3></td>\n" +
" </tr>\n" +
//" <tr class=\"admin-cat-header\">\n" +
//" <td>ID</td>\n" +
//" <td>Status</td>\n" +
//" <td></td>\n" +
//" </tr>" +
- " <tr>\n" +
+ " <tr class=\"" + (container.getStatus().toString().equals("FAILED") ? "admin-failed" : "" ) + "\">\n" +
" <td>" + container.getId() + "</td>\n" +
" <td>" + container.getStatus() + "</td>\n" +
+ " <td>" + descString + "</td>\n" +
" <td><a href=\"" + startURL + "\">Start</a> | <a href=\"" + stopURL + "\">Stop</a></td>\n" +
" </tr>");
}
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css 2008-03-04 19:58:45 UTC (rev 10192)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css 2008-03-04 20:04:28 UTC (rev 10193)
@@ -405,9 +405,13 @@
.admin-table tr.admin-cat-header td{
border-bottom: 1px solid #cccccc;
- width: 33%;
+ width: 25%;
}
.admin-table tr.admin-cat-header td{
font-weight: bold
+}
+
+.admin-table tr.admin-failed{
+ background-color: #f78181
}
\ No newline at end of file
16 years, 3 months
JBoss Portal SVN: r10192 - branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-04 14:58:45 -0500 (Tue, 04 Mar 2008)
New Revision: 10192
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
Log:
PC2 prefers a null navigational state
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-03-04 14:56:32 UTC (rev 10191)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-03-04 19:58:45 UTC (rev 10192)
@@ -246,7 +246,7 @@
public ControllerCommand createInvokeActionCommand(ActionURL actionURL)
{
- return new InvokePortletWindowActionCommand(window.getId(), actionURL.getMode(), actionURL.getWindowState(), actionURL.getNavigationalState(), actionURL.getInteractionState(), null);
+ return new InvokePortletWindowActionCommand(window.getId(), actionURL.getMode(), actionURL.getWindowState(), null, actionURL.getInteractionState(), null);
}
public ControllerCommand createInvokeRenderCommand(RenderURL renderURL)
16 years, 3 months
JBoss Portal SVN: r10191 - branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-04 09:56:32 -0500 (Tue, 04 Mar 2008)
New Revision: 10191
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
Log:
PortletInvocationFcatory migration to PC2 API
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java 2008-03-04 13:26:22 UTC (rev 10190)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java 2008-03-04 14:56:32 UTC (rev 10191)
@@ -30,9 +30,11 @@
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
+import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
import org.jboss.portal.portlet.spi.PortalContext;
import org.jboss.portal.portlet.spi.RequestContext;
import org.jboss.portal.portlet.spi.SecurityContext;
+import org.jboss.portal.portlet.spi.ServerContext;
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
import org.jboss.portal.server.PortalConstants;
@@ -62,23 +64,30 @@
/** . */
private WindowContext windowContext;
+
+ /**. */
+ private ServerContext serverContext;
+
public PortletContextFactory(ControllerContext controllerContext, Portal portal, Window window)
{
- this.requestContext = new AbstractRequestContext(controllerContext.getServerInvocation().getServerContext().getClientRequest(), controllerContext.getServerInvocation().getServerContext().getClientResponse());
+ this.requestContext = new AbstractRequestContext(controllerContext.getServerInvocation().getServerContext().getClientRequest());
this.securityContext = new AbstractSecurityContext(controllerContext.getServerInvocation().getServerContext().getClientRequest());
this.userContext = new ControllerUserContext(controllerContext);
this.portalContext = new org.jboss.portal.core.model.portal.portlet.PortalContextImpl(portal);
this.windowContext = new org.jboss.portal.core.model.portal.portlet.WindowContextImpl(window);
+ this.serverContext = new AbstractServerContext(controllerContext.getServerInvocation().getServerContext().getClientRequest(), controllerContext.getServerInvocation().getServerContext().getClientResponse());
+
}
public PortletContextFactory(ControllerContext controllerContext)
{
- this.requestContext = new AbstractRequestContext(controllerContext.getServerInvocation().getServerContext().getClientRequest(), controllerContext.getServerInvocation().getServerContext().getClientResponse());
+ this.requestContext = new AbstractRequestContext(controllerContext.getServerInvocation().getServerContext().getClientRequest());
this.securityContext = new AbstractSecurityContext(controllerContext.getServerInvocation().getServerContext().getClientRequest());
this.userContext = new ControllerUserContext(controllerContext);
this.portalContext = portalContextImpl;
this.windowContext = new WindowContextImpl("abc"); // Well ????
+ this.serverContext = new AbstractServerContext(controllerContext.getServerInvocation().getServerContext().getClientRequest(), controllerContext.getServerInvocation().getServerContext().getClientResponse());
}
public PortalContext createPortalContext()
@@ -105,7 +114,13 @@
{
return windowContext;
}
+
+ public ServerContext createServerContext()
+ {
+ return serverContext;
+ }
+
/** . */
private static final PortalContextImpl portalContextImpl = new PortalContextImpl();
@@ -113,10 +128,10 @@
{
/** . */
- private final Set windowStates;
+ private final Set<WindowState> windowStates;
/** . */
- private final Set modes;
+ private final Set<Mode> modes;
/** . */
private final Map props;
@@ -133,12 +148,12 @@
return PortalConstants.VERSION.toString();
}
- public Set getWindowStates()
+ public Set<WindowState> getWindowStates()
{
return windowStates;
}
- public Set getModes()
+ public Set<Mode> getModes()
{
return modes;
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-03-04 13:26:22 UTC (rev 10190)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-03-04 14:56:32 UTC (rev 10191)
@@ -22,11 +22,15 @@
******************************************************************************/
package org.jboss.portal.core.controller.portlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.model.portal.Portal;
@@ -34,22 +38,17 @@
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.RenderURL;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.impl.spi.AbstractActionContext;
-import org.jboss.portal.portlet.impl.spi.AbstractRenderContext;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.spi.ActionContext;
-import org.jboss.portal.portlet.spi.RenderContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -98,20 +97,18 @@
{
MarkupInfo markupInfo = (MarkupInfo)controllerContext.getServerInvocation().getResponse().getContentInfo();
+ PortletInvocationContext portletInvocationContext = new ControllerPortletInvocationContext(cpc, controllerContext, mode, windowState, navigationalState, markupInfo);
+
//
- ActionContext ctx = new ControllerActionContext(
- cpc,
- controllerContext,
- mode, windowState,
- navigationalState,
- markupInfo,
- interactionState,
- form);
-
+ ActionInvocation action = new ActionInvocation(portletInvocationContext);
+
+ action.setForm(form);
+ action.setMode(mode);
+ action.setWindowState(windowState);
+ action.setNavigationalState(navigationalState);
+ action.setInteractionState(interactionState);
+
//
- ActionInvocation action = new ActionInvocation(ctx);
-
- //
action.setAttribute(PortletInvocation.INVOCATION_SCOPE, "controller_context", controllerContext);
// Contextualize
@@ -120,6 +117,7 @@
action.setPortalContext(cf.createPortalContext());
action.setWindowContext(cf.createWindowContext());
action.setUserContext(cf.createUserContext());
+ action.setServerContext(cf.createServerContext());
//
return action;
@@ -135,40 +133,36 @@
{
MarkupInfo markupInfo = (MarkupInfo)controllerContext.getServerInvocation().getResponse().getContentInfo();
- //
- RenderContext ctx = new ControllerRenderContext(
- cpc,
- controllerContext,
- mode,
- windowState,
- navigationalState,
- markupInfo);
+ PortletInvocationContext portletInvocationContext = new ControllerPortletInvocationContext(cpc, controllerContext, mode, windowState, navigationalState, markupInfo);
//
- RenderInvocation render = new RenderInvocation(ctx);
+ RenderInvocation render = new RenderInvocation(portletInvocationContext);
+ render.setMode(mode);
+ render.setWindowState(windowState);
+ render.setNavigationalState(navigationalState);
+
//
render.setAttribute(PortletInvocation.INVOCATION_SCOPE, "controller_context", controllerContext);
// Contextualize
render.setSecurityContext(cf.createSecurityContext());
- render.setRequestContext(cf.createRequestContext());
render.setPortalContext(cf.createPortalContext());
render.setWindowContext(cf.createWindowContext());
render.setUserContext(cf.createUserContext());
-
+ render.setServerContext(cf.createServerContext());
//
return render;
}
- private static class ControllerActionContext extends AbstractActionContext
+ private static class ControllerPortletInvocationContext extends AbstractPortletInvocationContext
{
private InvokePortletCommandFactory cmdFactory;
private ControllerContext controllerContext;
- public ControllerActionContext(InvokePortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, MarkupInfo markupInfo, StateString interactionState, PortletParameters form)
+ public ControllerPortletInvocationContext(InvokePortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, MarkupInfo markupInfo)
{
- super(mode, windowState, navigationalState, markupInfo, interactionState, form);
+ super(markupInfo);
//
this.cmdFactory = cmdFactory;
@@ -192,65 +186,29 @@
return controllerContext.getServerInvocation().getServerContext().getClientResponse();
}
- public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+ public String renderURL(ContainerURL containerURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
{
- return PortletInvocationFactory.renderURL(controllerContext, cmdFactory, portletURL, wantSecure, wantAuthenticated, relative);
+ return PortletInvocationFactory.renderURL(controllerContext, cmdFactory, containerURL, wantSecure, wantAuthenticated, relative);
}
}
- private static class ControllerRenderContext extends AbstractRenderContext
- {
- private InvokePortletCommandFactory cmdFactory;
- private ControllerContext controllerContext;
- public ControllerRenderContext(InvokePortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, MarkupInfo markupInfo)
- {
- super(mode, windowState, navigationalState, markupInfo);
-
- //
- this.cmdFactory = cmdFactory;
- this.controllerContext = controllerContext;
-
- //
- addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.REQUEST_SCOPE, controllerContext);
- addResolver(PortletInvocation.PRINCIPAL_SCOPE, controllerContext);
- addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
- }
-
- public HttpServletRequest getClientRequest() throws IllegalStateException
- {
- return controllerContext.getServerInvocation().getServerContext().getClientRequest();
- }
-
- public HttpServletResponse getClientResponse() throws IllegalStateException
- {
- return controllerContext.getServerInvocation().getServerContext().getClientResponse();
- }
-
- public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
- {
- return PortletInvocationFactory.renderURL(controllerContext, cmdFactory, portletURL, wantSecure, wantAuthenticated, relative);
- }
- }
-
public static String renderURL(
ControllerContext controllerContext,
InvokePortletCommandFactory factory,
- PortletURL portletURL,
+ ContainerURL containerURL,
Boolean wantSecure,
Boolean wantAuthenticated,
boolean relative)
{
ControllerCommand cmd;
- if (portletURL instanceof ActionURL)
+ if (containerURL instanceof ActionURL)
{
- cmd = factory.createInvokeActionCommand((ActionURL)portletURL);
+ cmd = factory.createInvokeActionCommand((ActionURL)containerURL);
}
else
{
- cmd = factory.createInvokeRenderCommand((RenderURL)portletURL);
+ cmd = factory.createInvokeRenderCommand((RenderURL)containerURL);
}
//
16 years, 3 months
JBoss Portal SVN: r10190 - in modules/common/trunk/common: src/main/java/org/jboss/portal/common/io and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-04 08:26:22 -0500 (Tue, 04 Mar 2008)
New Revision: 10190
Added:
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/io/SerializableCloneTestCase.java
Modified:
modules/common/trunk/common/pom.xml
modules/common/trunk/common/src/main/java/org/jboss/portal/common/io/IOTools.java
Log:
improve the IOTools.clone() to work with a specified classloader
Modified: modules/common/trunk/common/pom.xml
===================================================================
--- modules/common/trunk/common/pom.xml 2008-03-04 03:47:25 UTC (rev 10189)
+++ modules/common/trunk/common/pom.xml 2008-03-04 13:26:22 UTC (rev 10190)
@@ -112,8 +112,6 @@
export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
-->
<!--
- <forkMode>never</forkMode>
- <argLine>-enableassertions</argLine>
-->
<forkMode>never</forkMode>
<argLine>-enableassertions</argLine>
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/io/IOTools.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/io/IOTools.java 2008-03-04 03:47:25 UTC (rev 10189)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/io/IOTools.java 2008-03-04 13:26:22 UTC (rev 10190)
@@ -40,8 +40,7 @@
import java.io.ObjectInputStream;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
-import java.io.DataOutputStream;
-import java.util.Map;
+import java.io.ObjectStreamClass;
/**
* IO tools.
@@ -341,20 +340,16 @@
/**
* Clone an object implementing the <code>Serializable</code> interface.
*
- * @param serializable
- * @return
+ * @param serializable the serializable object to clone
+ * @return a clone
* @throws IllegalArgumentException if the serializable object is null
- * @throws IOException
+ * @throws IOException any IOException
*/
public static <S extends Serializable> S clone(S serializable) throws IllegalArgumentException, IOException
{
- if (serializable == null)
- {
- throw new IllegalArgumentException("Cannot clone null");
- }
try
{
- return (S)unserialize(serialize(serializable));
+ return clone(serializable, null);
}
catch (ClassNotFoundException e)
{
@@ -362,6 +357,33 @@
}
}
+ /**
+ * Clone an object implementing the <code>Serializable</code> interface. The specified classloader will be used
+ * to perform the unserialization. If no classloader is specified and the object is not null then the classloader
+ * used is the one returned by <code>serializable.getClass().getClassLoader()</code>.
+ *
+ * @param serializable the serializable object to clone
+ * @return a clone
+ * @throws IllegalArgumentException if the serializable object is null
+ * @throws IOException any IOException
+ */
+ public static <S extends Serializable> S clone(S serializable, ClassLoader classLoader) throws IllegalArgumentException, IOException, ClassNotFoundException
+ {
+ if (serializable == null)
+ {
+ throw new IllegalArgumentException("Cannot clone null");
+ }
+
+ //
+ if (classLoader == null && serializable != null)
+ {
+ classLoader = serializable.getClass().getClassLoader();
+ }
+
+ //
+ return (S)unserialize(serialize(serializable), classLoader);
+ }
+
public static byte[] serialize(Serializable serializable) throws IllegalArgumentException, IOException
{
if (serializable == null)
@@ -375,14 +397,76 @@
return baos.toByteArray();
}
+ /**
+ * Unserialize the bytes into an object. The thread context classloader is used to perform unserialization.
+ *
+ * @param bytes the bytes to unserialize
+ * @return the unserialized object
+ * @throws IllegalArgumentException if the byte array is null
+ * @throws IOException any IOException
+ * @throws ClassNotFoundException any ClassNotFoundException
+ */
public static Serializable unserialize(byte[] bytes) throws IllegalArgumentException, IOException, ClassNotFoundException
{
+ return unserialize(bytes, null);
+ }
+
+ /**
+ * Unserialize the bytes into an object. If the provided classloader is not null, this classloader is used to perform
+ * the unserialization otherwise the thread current context classloader is used.
+ *
+ * @param bytes the bytes to unserialize
+ * @param classLoader the classloader
+ * @return the unserialized object
+ * @throws IllegalArgumentException if the byte array is null
+ * @throws IOException any IOException
+ * @throws ClassNotFoundException any ClassNotFoundException
+ */
+ public static Serializable unserialize(byte[] bytes, final ClassLoader classLoader) throws IllegalArgumentException, IOException, ClassNotFoundException
+ {
if (bytes == null)
{
throw new IllegalArgumentException("No null serializable accepted");
}
+
+ //
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- ObjectInputStream ois = new ObjectInputStream(bais);
+ ObjectInputStream ois = new ObjectInputStream(bais)
+ {
+ protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException
+ {
+ if (classLoader == null)
+ {
+ return super.resolveClass(desc);
+ }
+ else
+ {
+ String className = desc.getName();
+
+ // JDK 6, by default, only supports array types (ex. [[B) using Class.forName()
+ return Class.forName(className, false, classLoader);
+ }
+ }
+
+ protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException
+ {
+ if (classLoader == null)
+ {
+ return super.resolveProxyClass(interfaces);
+ }
+ else
+ {
+ // Load the interfaces from the specified class loader
+ Class[] ifaceClasses = new Class[interfaces.length];
+ for (int i = 0; i < interfaces.length; i++)
+ {
+ ifaceClasses[i] = classLoader.loadClass(interfaces[i]);
+ }
+
+ return java.lang.reflect.Proxy.getProxyClass(classLoader, ifaceClasses);
+ }
+ }
+ };
return (Serializable)ois.readObject();
}
Added: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/io/SerializableCloneTestCase.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/io/SerializableCloneTestCase.java (rev 0)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/io/SerializableCloneTestCase.java 2008-03-04 13:26:22 UTC (rev 10190)
@@ -0,0 +1,110 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.common.io;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.io.IOTools;
+
+import java.io.Serializable;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class SerializableCloneTestCase extends TestCase
+{
+
+ public static class Foo implements Serializable
+ {
+ }
+
+ public void testA() throws IOException, ClassNotFoundException
+ {
+ Foo foo = new Foo();
+ ClassLoader fooCL = new FooClassLoader();
+ Class fooClass = fooCL.loadClass(Foo.class.getName());
+ assertNotSame(fooClass, Foo.class);
+
+ //
+ Object clone = IOTools.clone(foo, fooCL);
+ assertSame(fooClass, clone.getClass());
+ }
+
+ private static class FooClassLoader extends ClassLoader
+ {
+
+ /** . */
+ private final byte[] bytes;
+
+ /** . */
+ private Class fooClass;
+
+ private FooClassLoader() throws IOException
+ {
+ InputStream in = Foo.class.getClassLoader().getResourceAsStream(Foo.class.getName().replace('.', '/') + ".class");
+ bytes = IOTools.getBytes(in);
+ }
+
+ public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
+ {
+ if (Foo.class.getName().equals(name))
+ {
+ Class<?> fooClass = findClass(name);
+
+ //
+ if (resolve)
+ {
+ resolveClass(fooClass);
+ }
+
+ //
+ return fooClass;
+ }
+ else
+ {
+ return super.loadClass(name, resolve);
+ }
+ }
+
+ protected Class<?> findClass(String name) throws ClassNotFoundException
+ {
+ if (Foo.class.getName().equals(name))
+ {
+ if (fooClass == null)
+ {
+ fooClass = defineClass(name, bytes, 0, bytes.length);
+ }
+
+ //
+ return fooClass;
+ }
+ else
+ {
+ return super.findClass(name);
+ }
+ }
+ }
+
+}
16 years, 3 months
JBoss Portal SVN: r10189 - modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-03-03 22:47:25 -0500 (Mon, 03 Mar 2008)
New Revision: 10189
Modified:
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css
Log:
admin markup
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css 2008-03-04 03:18:08 UTC (rev 10188)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css 2008-03-04 03:47:25 UTC (rev 10189)
@@ -384,6 +384,8 @@
.admin-table td.admin-app-header {
background-color: #999999;
+ padding: 2px;
+ border-bottom: 1px solid #000;
}
.admin-table td.admin-filter-header {
@@ -394,8 +396,11 @@
background-color: #dddddd;
}
-.admin-table td.admin-container-header h3{
- color: #999;
+.admin-table td.admin-container-header h3,
+.admin-table td.admin-filter-header h3{
+ color: #585858;
+ font-weight: normal;
+ border-bottom: 1px solid #999;
}
.admin-table tr.admin-cat-header td{
16 years, 3 months
JBoss Portal SVN: r10188 - in modules/portlet/trunk/portal/src/main: resources/simple-portal-war and 3 other directories.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-03-03 22:18:08 -0500 (Mon, 03 Mar 2008)
New Revision: 10188
Added:
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/admin/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/admin/admin.jsp
Removed:
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/admin.jsp
Modified:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css
Log:
gave the admin portlet some love - still more to give
Modified: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java 2008-03-04 01:21:56 UTC (rev 10187)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java 2008-03-04 03:18:08 UTC (rev 10188)
@@ -35,6 +35,7 @@
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletURL;
+import javax.portlet.PortletRequestDispatcher;
import java.io.IOException;
import java.io.PrintWriter;
@@ -106,10 +107,15 @@
resp.setContentType("text/html");
PrintWriter writer = resp.getWriter();
+ //PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("admin/admin.jsp");
+ //rd.include(request, response);
+
// Use an alias
PortletApplicationRegistry registry = (PortletApplicationRegistry)getPortletContext().getAttribute("PortletApplicationDeployer");
//
+
+
for (ManagedPortletApplication application : registry.getManagedPortletApplications())
{
PortletURL url = resp.createActionURL();
@@ -124,8 +130,23 @@
String startURL = url.toString();
//
- writer.print("<ul><li>Application " + application.getId() + " " + application.getStatus() +
- " <a href=\"" + startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li><ul>");
+ //writer.print("<ul><li>Application " + application.getId() + " " + application.getStatus() +
+ // " <a href=\"" + startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li><ul>");
+ writer.print("<table class=\"admin-table\">");
+ writer.print("" +
+ " <tr>\n" +
+ " <td class=\"admin-app-header\" colspan=\"3\"><h3>Application</h3></td>\n" +
+ " </tr>\n" +
+ " <tr class=\"admin-cat-header\">\n" +
+ " <td>ID</td>\n" +
+ " <td>Status</td>\n" +
+ " <td></td>\n" +
+ " </tr>" +
+ " <tr>\n" +
+ " <td>" + application.getId() + "</td>\n" +
+ " <td>" + application.getStatus() + "</td>\n" +
+ " <td><a href=\"" + startURL + "\">Start</a> | <a href=\"" + stopURL + "\">Stop</a></td>\n" +
+ " </tr>");
//
for (ManagedPortletFilter filter : application.getManagedPortletFilters())
@@ -141,8 +162,24 @@
startURL = url.toString();
//
- writer.print("<li>Filter " + filter.getId() + " " + filter.getStatus() + " <a href=\"" +
- startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li>");
+ //writer.print("<li>Filter " + filter.getId() + " " + filter.getStatus() + " <a href=\"" +
+ // startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li>");
+
+ writer.print("" +
+ " <tr>\n" +
+ " <td class=\"admin-filter-header\" colspan=\"3\"><h3>Filter</h3></td>\n" +
+ " </tr>\n" +
+ //" <tr class=\"admin-cat-header\">\n" +
+ //" <td>ID</td>\n" +
+ //" <td>Status</td>\n" +
+ //" <td></td>\n" +
+ //" </tr>" +
+ " <tr>\n" +
+ " <td>" + filter.getId() + "</td>\n" +
+ " <td>" + filter.getStatus() + "</td>\n" +
+ " <td><a href=\"" + startURL + "\">Start</a> | <a href=\"" + stopURL + "\">Stop</a></td>\n" +
+ " </tr>");
+
}
//
@@ -159,14 +196,37 @@
startURL = url.toString();
//
- writer.print("<li>Container " + container.getId() + " " + container.getStatus() + " <a href=\"" +
- startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li>");
+ //writer.print("<li>Container " + container.getId() + " " + container.getStatus() + " <a href=\"" +
+ // startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li>");
+
+ writer.print("" +
+ " <tr>\n" +
+ " <td class=\"admin-container-header\" colspan=\"3\"><h3>Container</h3></td>\n" +
+ " </tr>\n" +
+ //" <tr class=\"admin-cat-header\">\n" +
+ //" <td>ID</td>\n" +
+ //" <td>Status</td>\n" +
+ //" <td></td>\n" +
+ //" </tr>" +
+ " <tr>\n" +
+ " <td>" + container.getId() + "</td>\n" +
+ " <td>" + container.getStatus() + "</td>\n" +
+ " <td><a href=\"" + startURL + "\">Start</a> | <a href=\"" + stopURL + "\">Stop</a></td>\n" +
+ " </tr>");
}
- writer.print("</ul></ul>");
+ writer.print("</table>");
}
//
writer.close();
}
+
}
+
+ /*protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
+ {
+ PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("admin/admin.jsp");
+ rd.include(request, response);
+ }*/
+//}
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/admin/admin.jsp (from rev 10183, modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/admin.jsp)
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/admin/admin.jsp (rev 0)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/admin/admin.jsp 2008-03-04 03:18:08 UTC (rev 10188)
@@ -0,0 +1,14 @@
+<%@ page contentType="text/html" %>
+<%@ page language="java" %>
+<%@ taglib prefix="jbp" tagdir="/WEB-INF/tags/portal" %>
+<%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
+<%@ page isELIgnored="false" %>
+
+<%@ include file="/layouts/header.jsp" %>
+
+<portal:page>
+
+ <jbp:portlet name="AdminPortlet" applicationName="simple-portal"/>
+
+</portal:page>
+<%@ include file="/layouts/footer.jsp" %>
\ No newline at end of file
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css 2008-03-04 01:21:56 UTC (rev 10187)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css 2008-03-04 03:18:08 UTC (rev 10188)
@@ -373,4 +373,36 @@
div#container div#content div.wiki-content p {
padding: 5px;
+}
+
+/*-------------------------------------Admin*/
+
+.admin-table {
+ width: 100%;
+ margin: 15px 0 0 0;
+}
+
+.admin-table td.admin-app-header {
+ background-color: #999999;
+}
+
+.admin-table td.admin-filter-header {
+ background-color: #cccccc;
+}
+
+.admin-table td.admin-container-header {
+ background-color: #dddddd;
+}
+
+.admin-table td.admin-container-header h3{
+ color: #999;
+}
+
+.admin-table tr.admin-cat-header td{
+ border-bottom: 1px solid #cccccc;
+ width: 33%;
+}
+
+.admin-table tr.admin-cat-header td{
+ font-weight: bold
}
\ No newline at end of file
Deleted: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/admin.jsp
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/admin.jsp 2008-03-04 01:21:56 UTC (rev 10187)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/admin.jsp 2008-03-04 03:18:08 UTC (rev 10188)
@@ -1,14 +0,0 @@
-<%@ page contentType="text/html" %>
-<%@ page language="java" %>
-<%@ taglib prefix="xportal" tagdir="/WEB-INF/tags/portal" %>
-<%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
-<%@ page isELIgnored="false" %>
-
-<%@ include file="/layouts/header.jsp" %>
-
-<portal:page>
-
- <xportal:portlet name="AdminPortlet" applicationName="simple-portal"/>
-
-</portal:page>
-<%@ include file="/layouts/footer.jsp" %>
\ No newline at end of file
16 years, 3 months