Author: julien(a)jboss.com
Date: 2008-01-13 14:41:37 -0500 (Sun, 13 Jan 2008)
New Revision: 9493
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/EventInvocation.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/EventContext.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/HTTPRedirectionResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RedirectionResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RenderResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UnavailableResponse.java
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
base class and API implementation prototype for 286 eventing
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java 2008-01-13
18:15:59 UTC (rev 9492)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletAPIFactoryImpl.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -24,10 +24,13 @@
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
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.api.EventRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.EventResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
/**
@@ -46,6 +49,16 @@
return new ActionResponseImpl(invocation, actionRequest);
}
+ public EventRequestImpl createEventRequest(EventInvocation invocation)
+ {
+ return new EventRequestImpl(invocation);
+ }
+
+ public EventResponseImpl createEventResponse(EventInvocation invocation,
EventRequestImpl eventRequest)
+ {
+ return new EventResponseImpl(invocation, eventRequest);
+ }
+
public RenderRequestImpl createRenderRequest(RenderInvocation invocation)
{
return new RenderRequestImpl(invocation);
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-01-13
18:15:59 UTC (rev 9492)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -26,7 +26,6 @@
import org.jboss.portal.common.i18n.ResourceBundleManager;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
import org.jboss.portal.portlet.container.PortletApplication;
import org.jboss.portal.portlet.container.PortletContainer;
@@ -36,12 +35,15 @@
import org.jboss.portal.portlet.impl.jsr168.api.PortletConfigImpl;
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.api.EventRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.EventResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.info.ContainerPreferencesInfo;
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.invocation.EventInvocation;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.SecurityErrorResponse;
@@ -54,6 +56,7 @@
import javax.portlet.PortletSecurityException;
import javax.portlet.PreferencesValidator;
import javax.portlet.UnavailableException;
+import javax.portlet.EventPortlet;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Set;
@@ -413,7 +416,7 @@
dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
}
- return aresp.getResult();
+ return aresp.getResponse();
}
protected PortletInvocationResponse invokeRender(RenderInvocation invocation) throws
IOException, PortletException
@@ -439,4 +442,32 @@
}
return rresp.getResult();
}
+
+ protected PortletInvocationResponse invokeEvent(EventInvocation invocation) throws
IOException, PortletException
+ {
+ // Todo something clever
+ EventPortlet eventPortlet = (EventPortlet)portlet;
+
+ //
+ PortletAPIFactory factory = application.getPortletAPIFactory();
+ EventRequestImpl ereq = factory.createEventRequest(invocation);
+ EventResponseImpl eresp = factory.createEventResponse(invocation, ereq);
+ HttpServletRequest dreq = invocation.getDispatchedRequest();
+ try
+ {
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, ereq);
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, eresp);
+ dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION,
invocation);
+ eventPortlet.processEvent(ereq, eresp);
+ }
+ finally
+ {
+ dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
+ dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
+ dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
+
dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
+ }
+ return eresp.getResponse();
+ }
}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventImpl.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventImpl.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * 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.api;
+
+import org.jboss.portal.portlet.spi.EventContext;
+
+import javax.portlet.Event;
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventImpl implements Event
+{
+
+ /** . */
+ private final EventContext context;
+
+ public EventImpl(EventContext context)
+ {
+ this.context = context;
+ }
+
+ public QName getQName()
+ {
+ return context.getName();
+ }
+
+ public String getName()
+ {
+ return context.getName().getLocalPart();
+ }
+
+ public Serializable getValue()
+ {
+ return context.getPayload();
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * 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.api;
+
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.spi.EventContext;
+
+import javax.portlet.EventRequest;
+import javax.portlet.Event;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventRequestImpl extends PortletRequestImpl implements EventRequest
+{
+
+ /** . */
+ private EventImpl event;
+
+ public EventRequestImpl(EventInvocation invocation)
+ {
+ super(invocation);
+ }
+
+ public Event getEvent()
+ {
+ if (event == null)
+ {
+ event = new EventImpl((EventContext)invocation.getPortletContext());
+ }
+
+ //
+ return event;
+ }
+
+ public String getMethod()
+ {
+ // Does it make sense in the remote case ?
+ return invocation.getDispatchedRequest().getMethod();
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * 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.api;
+
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.invocation.response.RenderResponse;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+
+import javax.portlet.EventResponse;
+import javax.portlet.EventRequest;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventResponseImpl extends StateAwareResponseImpl implements EventResponse
+{
+ public EventResponseImpl(EventInvocation invocation, PortletRequestImpl preq)
+ {
+ super(invocation, preq);
+ }
+
+ public void setRenderParameters(EventRequest eventRequest)
+ {
+ if (eventRequest == null)
+ {
+ // Do something ???
+ }
+ if (eventRequest != preq)
+ {
+ // Do something ???
+ }
+
+ //
+ PortletInvocationContext context = invocation.getPortletContext();
+
+ //
+ ((RenderResponse)response).setMode(context.getMode());
+ ((RenderResponse)response).setWindowState(context.getWindowState());
+ ((RenderResponse)response).setNavigationalState(context.getNavigationalState());
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-01-13
18:15:59 UTC (rev 9492)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -23,11 +23,16 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.RenderResponse;
import org.jboss.portal.portlet.invocation.response.RedirectionResponse;
+import org.jboss.portal.portlet.invocation.response.StateResponse;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
+import org.jboss.portal.portlet.impl.info.ContainerEventsInfo;
+import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
+import org.jboss.portal.portlet.impl.info.ContainerTypeInfo;
+import org.jboss.portal.portlet.impl.info.ContainerEventInfo;
import org.jboss.portal.Mode;
import org.jboss.portal.common.NotYetImplemented;
import org.apache.log4j.Logger;
@@ -38,6 +43,7 @@
import javax.portlet.PortletMode;
import javax.portlet.PortletModeException;
import javax.xml.namespace.QName;
+import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.Map;
@@ -48,13 +54,22 @@
public abstract class StateAwareResponseImpl extends PortletResponseImpl implements
StateAwareResponse
{
+ /** . */
private static final Logger log = Logger.getLogger(ActionResponseImpl.class);
+ /** . */
protected static final int WANT_NOTHING = 0;
+
+ /** . */
protected static final int WANT_RENDER = 1;
+
+ /** . */
protected static final int WANT_REDIRECT = 2;
- protected PortletInvocationResponse response;
+ /** . */
+ protected StateResponse response;
+
+ /** . */
protected int decision;
public StateAwareResponseImpl(PortletInvocation invocation, PortletRequestImpl preq)
@@ -70,7 +85,7 @@
this.decision = WANT_NOTHING;
}
- public PortletInvocationResponse getResult()
+ public StateResponse getResponse()
{
return response;
}
@@ -188,14 +203,67 @@
}
}
- public void setEvent(QName qName, Serializable serializable)
+ public void setEvent(QName name, Serializable value)
{
- throw new NotYetImplemented();
+ if (name == null)
+ {
+ throw new IllegalArgumentException("The portlet must specify a name when
producing an event");
+ }
+
+ //
+ if (value != null)
+ {
+ Class<? extends Serializable> valueType = value.getClass();
+
+ // Check jaxb annotation
+ XmlRootElement annotation = valueType.getAnnotation(XmlRootElement.class);
+ if (annotation == null)
+ {
+ throw new IllegalArgumentException("The provided event value type "
+ value.getClass().getName() +
+ " does not have a valid jaxb annotation");
+ }
+
+ //
+ ContainerEventsInfo eventsInfo = preq.container.getInfo().getEvents();
+
+ // Check type
+ for (ContainerEventInfo eventInfo : eventsInfo.getProducedEvents())
+ {
+ if (eventInfo.getName().equals(name))
+ {
+ ContainerTypeInfo typeInfo = eventInfo.getType();
+
+ //
+ if (typeInfo != null)
+ {
+ Class expectedType = typeInfo.getType();
+
+ //
+ if (!expectedType.isInstance(value))
+ {
+ throw new IllegalArgumentException("The provided event value
type " + valueType.getName() +
+ " does not match the declared event type " +
expectedType.getName());
+ }
+ }
+ }
+ }
+ }
+
+ //
+ response.addEvent(new StateResponse.Event(name, value));
}
- public void setEvent(String s, Serializable serializable)
+ public void setEvent(String localName, Serializable value)
{
- throw new NotYetImplemented();
+ if (localName == null)
+ {
+ throw new IllegalArgumentException("The portlet must specify a local name
when producing an event");
+ }
+
+ //
+ ContainerPortletApplicationInfo info =
((PortletApplicationImpl)preq.container.getApplication()).getInfo();
+ QName name = new QName(info.getDefaultNamespace(), localName);
+ setEvent(name, value);
}
public Map<String, String[]> getRenderParameterMap()
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java 2008-01-13
18:15:59 UTC (rev 9492)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/spi/PortletAPIFactory.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -24,10 +24,13 @@
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
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;
+import org.jboss.portal.portlet.impl.jsr168.api.EventRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.EventResponseImpl;
/**
* Factory for portlet API implementation.
@@ -47,6 +50,14 @@
/**
*/
+ EventRequestImpl createEventRequest(EventInvocation invocation);
+
+ /**
+ */
+ EventResponseImpl createEventResponse(EventInvocation invocation, EventRequestImpl
eventRequest);
+
+ /**
+ */
RenderRequestImpl createRenderRequest(RenderInvocation invocation);
/**
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/EventInvocation.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/EventInvocation.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/EventInvocation.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.invocation;
+
+import org.jboss.portal.portlet.spi.EventContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventInvocation extends PortletInvocation
+{
+ public EventInvocation(EventContext ctx) throws IllegalArgumentException
+ {
+ super(ctx);
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java 2008-01-13
18:15:59 UTC (rev 9492)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -35,11 +35,16 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5602 $
*/
-public class FragmentResponse extends PortletInvocationResponse
+public class FragmentResponse extends StateResponse
{
+ /** . */
public static final int TYPE_EMPTY = 0;
+
+ /** . */
public static final int TYPE_CHARS = 1;
+
+ /** . */
public static final int TYPE_BYTES = 2;
/** Any content that should appear in the header. */
@@ -173,7 +178,12 @@
this.contentType = contentType;
}
- /** @throws IllegalStateException if the output stream is already used or if no
content type is defined */
+ /**
+ * Returns the writer.
+ *
+ * @return the writer
+ * @throws IllegalStateException if the output stream is already used or if no content
type is defined
+ */
public PrintWriter getWriter() throws IllegalStateException
{
if (bytes != null)
@@ -193,10 +203,10 @@
}
/**
- * @throws IOException
+ * @return the output stream
* @throws IllegalStateException if the window writer is already used or if no content
type is defined
*/
- public OutputStream getOutputStream() throws IOException, IllegalStateException
+ public OutputStream getOutputStream() throws IllegalStateException
{
if (chars != null)
{
@@ -387,6 +397,8 @@
/**
* Return the content as a string.
+ *
+ * @return the content
*/
public String getContent()
{
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/HTTPRedirectionResponse.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/HTTPRedirectionResponse.java 2008-01-13
18:15:59 UTC (rev 9492)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/HTTPRedirectionResponse.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -31,7 +31,8 @@
public class HTTPRedirectionResponse extends RedirectionResponse
{
- protected String location;
+ /** . */
+ protected final String location;
public HTTPRedirectionResponse(String location)
{
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RedirectionResponse.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RedirectionResponse.java 2008-01-13
18:15:59 UTC (rev 9492)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RedirectionResponse.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -28,6 +28,6 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5448 $
*/
-public class RedirectionResponse extends PortletInvocationResponse
+public abstract class RedirectionResponse extends StateResponse
{
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RenderResponse.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RenderResponse.java 2008-01-13
18:15:59 UTC (rev 9492)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RenderResponse.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -29,10 +29,12 @@
/**
* Want to be rendered.
*
+ * @todo rename to UpdateNavigationalStateResponse
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5477 $
*/
-public class RenderResponse extends PortletInvocationResponse
+public class RenderResponse extends StateResponse
{
/** The navigational state returned. */
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -0,0 +1,94 @@
+/******************************************************************************
+ * 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.invocation.response;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.List;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StateResponse extends PortletInvocationResponse
+{
+
+ /** . */
+ private ArrayList<Event> producedEvents;
+
+ public void addEvent(Event event)
+ {
+ if (event == null)
+ {
+ throw new IllegalArgumentException("No null event accepted");
+ }
+
+ //
+ if (producedEvents == null)
+ {
+ producedEvents = new ArrayList<Event>();
+ }
+
+ //
+ producedEvents.add(event);
+ }
+
+ public List<Event> getEvents()
+ {
+ return producedEvents;
+ }
+
+ /**
+ * An event produced by a state response.
+ */
+ public static class Event
+ {
+
+ /** The optional event. */
+ private QName name;
+
+ /** The optional event payload. */
+ private Serializable payload;
+
+ public Event(QName name, Serializable payload)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.name = name;
+ this.payload = payload;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public Serializable getPayload()
+ {
+ return payload;
+ }
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UnavailableResponse.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UnavailableResponse.java 2008-01-13
18:15:59 UTC (rev 9492)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UnavailableResponse.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -31,9 +31,12 @@
public class UnavailableResponse extends PortletInvocationResponse
{
- private boolean permanent;
- private int seconds;
+ /** . */
+ private final boolean permanent;
+ /** . */
+ private final int seconds;
+
public UnavailableResponse()
{
this.seconds = 0;
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/EventContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/EventContext.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/EventContext.java 2008-01-13
19:41:37 UTC (rev 9493)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * 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.spi;
+
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface EventContext extends PortletInvocationContext
+{
+
+ QName getName();
+
+ Serializable getPayload();
+
+}
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-01-13
18:15:59 UTC (rev 9492)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-13
19:41:37 UTC (rev 9493)
@@ -5,7 +5,6 @@
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<!--Spec TCK Assertions tests-->
-<!--
<generic>
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr168-tck-dispatcher.war"/>
@@ -50,10 +49,8 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr168-tck-windowstates.war"/>
</generic>
--->
<!--API Tests-->
-<!--
<generic>
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr168-api-actionrequest.war"/>
@@ -106,10 +103,8 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr168-api-windowstate.war"/>
</generic>
--->
<!--Ext Tests-->
-<!--
<generic>
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr168-ext-dispatcher.war"/>
@@ -150,7 +145,6 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr168-ext-nocache.war"/>
</generic>
--->
<!--Spec TCK Assertions tests-->
<generic>