JBoss Portal SVN: r10237 - in modules/portlet/trunk: controller/src/main/java/org/jboss/portal/portlet/controller/event and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-07 07:50:04 -0500 (Fri, 07 Mar 2008)
New Revision: 10237
Added:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseContextImpl.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseContext.java
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventControllerContextSafeInvoker.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
Log:
rename EventPhaseSession to EventPhaseContext
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventControllerContextSafeInvoker.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventControllerContextSafeInvoker.java 2008-03-07 12:30:18 UTC (rev 10236)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventControllerContextSafeInvoker.java 2008-03-07 12:50:04 UTC (rev 10237)
@@ -23,7 +23,7 @@
package org.jboss.portal.portlet.controller;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
-import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.apache.log4j.Logger;
@@ -40,7 +40,7 @@
/** . */
private final Logger log = Logger.getLogger(EventControllerContextSafeInvoker.class);
- public boolean eventProduced(EventControllerContext context, EventPhaseSession session, Event sourceEvent, Event producedEvent)
+ public boolean eventProduced(EventControllerContext context, EventPhaseContext context, Event sourceEvent, Event producedEvent)
{
try
{
@@ -59,7 +59,7 @@
}
}
- public boolean eventConsumed(EventControllerContext context, EventPhaseSession session, Event consumedEvent, PortletInvocationResponse consumerResponse)
+ public boolean eventConsumed(EventControllerContext context, EventPhaseContext context, Event consumedEvent, PortletInvocationResponse consumerResponse)
{
try
{
@@ -77,7 +77,7 @@
}
}
- public boolean eventFailed(EventControllerContext context, EventPhaseSession session, Event failedEvent, Throwable throwable)
+ public boolean eventFailed(EventControllerContext context, EventPhaseContext context, Event failedEvent, Throwable throwable)
{
try
{
@@ -95,7 +95,7 @@
}
}
- public boolean eventDiscarded(EventControllerContext context, EventPhaseSession session, Event discardedEvent, int cause)
+ public boolean eventDiscarded(EventControllerContext context, EventPhaseContext context, Event discardedEvent, int cause)
{
try
{
Copied: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseContextImpl.java (from rev 10219, modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseSessionImpl.java)
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseContextImpl.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseContextImpl.java 2008-03-07 12:50:04 UTC (rev 10237)
@@ -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.portlet.controller;
+
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
+import org.jboss.portal.portlet.controller.event.Event;
+import org.apache.log4j.Logger;
+
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class EventPhaseContextImpl implements EventPhaseContext
+{
+
+ /** . */
+ static final int READ_MODE = 0;
+
+ /** . */
+ static final int READ_WRITE_MODE = 1;
+
+ /** . */
+ static final int INTERRUPTED_MODE = 2;
+
+ /** . */
+ private final Logger log;
+
+ /** . */
+ LinkedList<EventProduction> producedEvents;
+
+ /** . */
+ LinkedList<Event> toConsumeEvents;
+
+ /** . */
+ int consumedEventSize;
+
+ /** . */
+ int producedEventSize;
+
+ /** . */
+ int mode;
+
+ EventPhaseContextImpl(Logger log)
+ {
+ this.log = log;
+ this.producedEvents = new LinkedList<EventProduction>();
+ this.toConsumeEvents = new LinkedList<Event>();
+ this.consumedEventSize = 0;
+ this.producedEventSize = 0;
+ this.mode = READ_MODE;
+ }
+
+ public void queueEvent(Event event)
+ {
+ if (mode == INTERRUPTED_MODE)
+ {
+ throw new IllegalStateException("The event phase cannot queue events because it is interruped");
+ }
+ if (mode == READ_MODE)
+ {
+ throw new IllegalStateException("The event phase cannot queue events");
+ }
+ if (event == null)
+ {
+ throw new IllegalArgumentException("No null event accepted");
+ }
+
+ //
+ log.trace("Queued event " + event + " in the session");
+
+ //
+ this.toConsumeEvents.addLast(event);
+ }
+
+ public void interrupt()
+ {
+ if (mode == READ_MODE)
+ {
+ throw new IllegalStateException("The event phase is not interruptable");
+ }
+
+ //
+ log.trace("Event delivery interruped");
+
+ //
+ this.mode = INTERRUPTED_MODE;
+ }
+}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-03-07 12:30:18 UTC (rev 10236)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-03-07 12:50:04 UTC (rev 10237)
@@ -108,22 +108,22 @@
UpdateNavigationalStateResponse stateResponse = (UpdateNavigationalStateResponse)response;
//
- EventPhaseSessionImpl session = new EventPhaseSessionImpl(log);
+ EventPhaseContextImpl phaseContext = new EventPhaseContextImpl(log);
// Feed session it with the events that may have been produced
for (UpdateNavigationalStateResponse.Event portletEvent : stateResponse.getEvents())
{
Event producedEvent = new Event(portletEvent.getName(), portletEvent.getPayload(), portletRequest.getWindowId());
- session.producedEvents.add(new EventProduction(null, producedEvent));
+ phaseContext.producedEvents.add(new EventProduction(null, producedEvent));
}
//
int eventDistributionStatus = PortletResponse.DISTRIBUTION_DONE;
// Deliver events
- while (session.producedEvents.size() > 0)
+ while (phaseContext.producedEvents.size() > 0)
{
- EventProduction eventProduction = session.producedEvents.removeFirst();
+ EventProduction eventProduction = phaseContext.producedEvents.removeFirst();
Event producedEvent = eventProduction.getProducedEvent();
//
@@ -134,7 +134,7 @@
if (producerPortletInfo == null)
{
log.trace("Cannot deliver event " + producedEvent +" because the producer does not have portlet info");
- safeInvoker.eventDiscarded(eventCC, session, producedEvent, EventControllerContext.EVENT_PRODUCER_INFO_NOT_AVAILABLE);
+ safeInvoker.eventDiscarded(eventCC, phaseContext, producedEvent, EventControllerContext.EVENT_PRODUCER_INFO_NOT_AVAILABLE);
continue;
}
@@ -144,7 +144,7 @@
if (!producerPortletInfo.getEventing().getProducedEvents().containsKey(producedEvent.getName()))
{
log.trace("Cannot deliver event " + producedEvent +" because the producer of the event does not produce the event name");
- safeInvoker.eventDiscarded(eventCC, session, producedEvent, EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
+ safeInvoker.eventDiscarded(eventCC, phaseContext, producedEvent, EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
continue;
}
}
@@ -153,24 +153,24 @@
int producedEventThreshold = controller.getProducedEventThreshold();
if (producedEventThreshold >= 0)
{
- if (session.producedEventSize + 1 > producedEventThreshold)
+ if (phaseContext.producedEventSize + 1 > producedEventThreshold)
{
log.trace("Event distribution interrupted because the maximum number of produced event is reached");
eventDistributionStatus = PortletResponse.PRODUCED_EVENT_FLOODED;
- safeInvoker.eventDiscarded(eventCC, session, producedEvent, EventControllerContext.PRODUCED_EVENT_FLOODED);
+ safeInvoker.eventDiscarded(eventCC, phaseContext, producedEvent, EventControllerContext.PRODUCED_EVENT_FLOODED);
break;
}
}
// Give control to the event context
- session.mode = EventPhaseSessionImpl.READ_WRITE_MODE;
- if (!safeInvoker.eventProduced(eventCC, session, eventProduction.getConsumedEvent(), producedEvent))
+ phaseContext.mode = EventPhaseContextImpl.READ_WRITE_MODE;
+ if (!safeInvoker.eventProduced(eventCC, phaseContext, eventProduction.getConsumedEvent(), producedEvent))
{
continue;
}
// Perform flow control
- if (session.mode == EventPhaseSessionImpl.INTERRUPTED_MODE)
+ if (phaseContext.mode == EventPhaseContextImpl.INTERRUPTED_MODE)
{
log.trace("Event distribution interrupted by controller context");
eventDistributionStatus = PortletResponse.INTERRUPTED;
@@ -178,9 +178,9 @@
}
//
- while (session.toConsumeEvents.size() > 0)
+ while (phaseContext.toConsumeEvents.size() > 0)
{
- Event toConsumeEvent = session.toConsumeEvents.removeFirst();
+ Event toConsumeEvent = phaseContext.toConsumeEvents.removeFirst();
String consumedId = toConsumeEvent.getWindowId();
//
@@ -188,7 +188,7 @@
if (consumerPortletInfo == null)
{
log.trace("Cannot deliver event " + producedEvent +" because the consumer of the event does not have a portlet info");
- safeInvoker.eventDiscarded(eventCC, session, toConsumeEvent, EventControllerContext.EVENT_CONSUMER_INFO_NOT_AVAILABLE);
+ safeInvoker.eventDiscarded(eventCC, phaseContext, toConsumeEvent, EventControllerContext.EVENT_CONSUMER_INFO_NOT_AVAILABLE);
continue;
}
@@ -198,7 +198,7 @@
if (!consumerPortletInfo.getEventing().getConsumedEvents().containsKey(toConsumeEvent.getName()))
{
log.trace("Cannot deliver event " + producedEvent +" because the consumer of the event does not accept the event name");
- safeInvoker.eventDiscarded(eventCC, session, toConsumeEvent, EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
+ safeInvoker.eventDiscarded(eventCC, phaseContext, toConsumeEvent, EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
continue;
}
}
@@ -207,10 +207,10 @@
int consumedEventThreshold = controller.getConsumedEventThreshold();
if (consumedEventThreshold >= 0)
{
- if (session.consumedEventSize + 1 > consumedEventThreshold)
+ if (phaseContext.consumedEventSize + 1 > consumedEventThreshold)
{
log.trace("Event distribution interrupted because the maximum number of consumed event is reached");
- safeInvoker.eventDiscarded(eventCC, session, toConsumeEvent, EventControllerContext.CONSUMED_EVENT_FLOODED);
+ safeInvoker.eventDiscarded(eventCC, phaseContext, toConsumeEvent, EventControllerContext.CONSUMED_EVENT_FLOODED);
eventDistributionStatus = PortletResponse.CONSUMED_EVENT_FLOODED;
break;
}
@@ -225,12 +225,12 @@
catch (Exception e)
{
log.trace("Event delivery of " + toConsumeEvent + " failed", e);
- safeInvoker.eventFailed(eventCC, session, toConsumeEvent, e);
+ safeInvoker.eventFailed(eventCC, phaseContext, toConsumeEvent, e);
continue;
}
// Now it is consumed
- session.consumedEventSize++;
+ phaseContext.consumedEventSize++;
// Update nav state if needed
if (eventResponse instanceof UpdateNavigationalStateResponse)
@@ -244,7 +244,7 @@
for (UpdateNavigationalStateResponse.Event portletEvent : eventStateResponse.getEvents())
{
Event toRouteEvent = new Event(portletEvent.getName(), portletEvent.getPayload(), toConsumeEvent.getWindowId());
- session.producedEvents.add(new EventProduction(toConsumeEvent, toRouteEvent));
+ phaseContext.producedEvents.add(new EventProduction(toConsumeEvent, toRouteEvent));
}
//
@@ -256,12 +256,12 @@
}
// And we make a callback
- session.mode = EventPhaseSessionImpl.READ_MODE;
- safeInvoker.eventConsumed(eventCC, session, toConsumeEvent, eventResponse);
+ phaseContext.mode = EventPhaseContextImpl.READ_MODE;
+ safeInvoker.eventConsumed(eventCC, phaseContext, toConsumeEvent, eventResponse);
}
// We archive the consumed event in the history
- session.producedEventSize++;
+ phaseContext.producedEventSize++;
}
//
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java 2008-03-07 12:30:18 UTC (rev 10236)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java 2008-03-07 12:50:04 UTC (rev 10237)
@@ -32,19 +32,19 @@
*/
public class AbstractEventControllerContext implements EventControllerContext
{
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event producedEvent)
{
}
- public void eventConsumed(EventPhaseSession session, Event consumedEvent, PortletInvocationResponse consumerResponse)
+ public void eventConsumed(EventPhaseContext context, Event consumedEvent, PortletInvocationResponse consumerResponse)
{
}
- public void eventFailed(EventPhaseSession session, Event consumedEvent, Throwable throwable)
+ public void eventFailed(EventPhaseContext context, Event consumedEvent, Throwable throwable)
{
}
- public void eventDiscarded(EventPhaseSession session, Event discardedEvent, int cause)
+ public void eventDiscarded(EventPhaseContext context, Event discardedEvent, int cause)
{
}
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java 2008-03-07 12:30:18 UTC (rev 10236)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java 2008-03-07 12:50:04 UTC (rev 10237)
@@ -66,11 +66,11 @@
* <p>During the invocation of this method, any error thrown will be propagated
* to the portlet controller invoker.</p>
*
- * @param session the session
+ * @param context the session
* @param sourceEvent the source event
* @param producedEvent the produced event
*/
- void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent);
+ void eventProduced(EventPhaseContext context, Event sourceEvent, Event producedEvent);
/**
* <p>Context call back when an event is consumed by a portlet. The session argument
@@ -83,11 +83,11 @@
* <p>During the invocation of this method, any error thrown will be propagated
* to the portlet controller invoker.</p>
*
- * @param session the session
+ * @param context the session
* @param consumedEvent the consumed event
* @param consumerResponse the consumer response
*/
- void eventConsumed(EventPhaseSession session, Event consumedEvent, PortletInvocationResponse consumerResponse);
+ void eventConsumed(EventPhaseContext context, Event consumedEvent, PortletInvocationResponse consumerResponse);
/**
* <p>Context call back when an event failed to be delivered because the invoker threw an exception.
@@ -100,11 +100,11 @@
* <p>During the invocation of this method, any error thrown will be propagated
* to the portlet controller invoker.</p>
*
- * @param session the session
+ * @param context the session
* @param failedEvent the failed event
* @param throwable the throwable
*/
- void eventFailed(EventPhaseSession session, Event failedEvent, Throwable throwable);
+ void eventFailed(EventPhaseContext context, Event failedEvent, Throwable throwable);
/**
* <p>Context call back when an event is discarded by the controller for a specific reason.
@@ -128,10 +128,10 @@
* <p>During the invocation of this method, any error thrown will be propagated
* to the portlet controller invoker.</p>
*
- * @param session the session
+ * @param context the session
* @param discardedEvent the discarded event
* @param cause the cause
*/
- void eventDiscarded(EventPhaseSession session, Event discardedEvent, int cause);
+ void eventDiscarded(EventPhaseContext context, Event discardedEvent, int cause);
}
Copied: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseContext.java (from rev 10219, modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseSession.java)
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseContext.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseContext.java 2008-03-07 12:50:04 UTC (rev 10237)
@@ -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.portlet.controller.event;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface EventPhaseContext
+{
+
+ /**
+ * Queue an event for consumption. The queue is a FIFO queue.
+ *
+ * @param event an event
+ * @throws IllegalArgumentException if the event is null
+ * @throws IllegalStateException if an event cannot be published
+ */
+ void queueEvent(Event event) throws IllegalArgumentException, IllegalStateException;
+
+ /**
+ * Stop processing of all events and returns from the controller.
+ *
+ * @throws IllegalStateException if the session cannot be interrupted.
+ */
+ void interrupt() throws IllegalStateException;
+
+}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java 2008-03-07 12:30:18 UTC (rev 10236)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java 2008-03-07 12:50:04 UTC (rev 10237)
@@ -28,7 +28,7 @@
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
-import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.info.PortletInfo;
/**
@@ -46,7 +46,7 @@
this.invoker = invoker;
}
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event producedEvent)
{
try
{
@@ -56,26 +56,26 @@
if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
{
Event distributedEvent = new Event(producedEvent.getName(), producedEvent.getPayload(), portlet.getContext().getId());
- session.queueEvent(distributedEvent);
+ context.queueEvent(distributedEvent);
}
}
}
catch (PortletInvokerException e)
{
System.out.println("e = " + e);
- session.interrupt();
+ context.interrupt();
}
}
- public void eventConsumed(EventPhaseSession session, Event consumedEvent, PortletInvocationResponse consumerResponse)
+ public void eventConsumed(EventPhaseContext context, Event consumedEvent, PortletInvocationResponse consumerResponse)
{
}
- public void eventFailed(EventPhaseSession session, Event failedEvent, Throwable throwable)
+ public void eventFailed(EventPhaseContext context, Event failedEvent, Throwable throwable)
{
}
- public void eventDiscarded(EventPhaseSession session, Event discardedEvent, int cause)
+ public void eventDiscarded(EventPhaseContext context, Event discardedEvent, int cause)
{
}
}
Modified: modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java
===================================================================
--- modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java 2008-03-07 12:30:18 UTC (rev 10236)
+++ modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java 2008-03-07 12:50:04 UTC (rev 10237)
@@ -24,7 +24,7 @@
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.event.Event;
-import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import javax.xml.namespace.QName;
@@ -43,7 +43,7 @@
/** . */
private final Map<Point, List<Point>> wires = new HashMap<Point, List<Point>>();
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event producedEvent)
{
List<Point> dsts = wires.get(new Point(producedEvent.getName(), producedEvent.getWindowId()));
@@ -52,20 +52,20 @@
{
for (Point dst : dsts)
{
- session.queueEvent(new Event(dst.name, producedEvent.getPayload(), dst.windowId));
+ context.queueEvent(new Event(dst.name, producedEvent.getPayload(), dst.windowId));
}
}
}
- public void eventConsumed(EventPhaseSession session, Event consumedEvent, PortletInvocationResponse consumerResponse)
+ public void eventConsumed(EventPhaseContext context, Event consumedEvent, PortletInvocationResponse consumerResponse)
{
}
- public void eventFailed(EventPhaseSession session, Event failedEvent, Throwable throwable)
+ public void eventFailed(EventPhaseContext context, Event failedEvent, Throwable throwable)
{
}
- public void eventDiscarded(EventPhaseSession session, Event discardedEvent, int cause)
+ public void eventDiscarded(EventPhaseContext context, Event discardedEvent, int cause)
{
}
Modified: modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java
===================================================================
--- modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java 2008-03-07 12:30:18 UTC (rev 10236)
+++ modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java 2008-03-07 12:50:04 UTC (rev 10237)
@@ -29,7 +29,7 @@
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
import org.jboss.portal.portlet.controller.response.PortletResponse;
-import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.controller.event.AbstractEventControllerContext;
import org.jboss.portal.portlet.OpaqueStateString;
@@ -312,9 +312,9 @@
controller.setProducedEventThreshold(10);
context.setEventControllerContext(new AbstractEventControllerContext()
{
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event producedEvent)
{
- session.interrupt();
+ context.interrupt();
}
});
fooPortlet.addHandler(eventProducerActionHandler);
@@ -350,7 +350,7 @@
controller.setProducedEventThreshold(10);
context.setEventControllerContext(new AbstractEventControllerContext()
{
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event producedEvent)
{
throw new RuntimeException();
}
@@ -364,7 +364,7 @@
final Error error = new Error();
context.setEventControllerContext(new AbstractEventControllerContext()
{
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event producedEvent)
{
throw error;
}
Modified: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java 2008-03-07 12:30:18 UTC (rev 10236)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java 2008-03-07 12:50:04 UTC (rev 10237)
@@ -24,7 +24,7 @@
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.event.Event;
-import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -54,7 +54,7 @@
this.prepareResponse = prepareResponse;
}
- public void eventProduced(EventPhaseSession context, Event sourceEvent, Event producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event producedEvent)
{
for (String windowId : prepareResponse.getWindowIds())
{
@@ -83,15 +83,15 @@
}
}
- public void eventConsumed(EventPhaseSession session, Event consumedEvent, PortletInvocationResponse consumerResponse)
+ public void eventConsumed(EventPhaseContext context, Event consumedEvent, PortletInvocationResponse consumerResponse)
{
}
- public void eventFailed(EventPhaseSession session, Event failedEvent, Throwable throwable)
+ public void eventFailed(EventPhaseContext context, Event failedEvent, Throwable throwable)
{
}
- public void eventDiscarded(EventPhaseSession session, Event discardedEvent, int cause)
+ public void eventDiscarded(EventPhaseContext context, Event discardedEvent, int cause)
{
}
}
16 years, 3 months
JBoss Portal SVN: r10236 - in modules/portlet/trunk: controller/src/main/java/org/jboss/portal/portlet/controller/event and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-07 07:30:18 -0500 (Fri, 07 Mar 2008)
New Revision: 10236
Added:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventControllerContextSafeInvoker.java
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
Log:
update controller to send event for non distributed events
Added: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventControllerContextSafeInvoker.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventControllerContextSafeInvoker.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventControllerContextSafeInvoker.java 2008-03-07 12:30:18 UTC (rev 10236)
@@ -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.portlet.controller;
+
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.Event;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.apache.log4j.Logger;
+
+/**
+ * An help class to catch and log exceptions thrown by an event controller context.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class EventControllerContextSafeInvoker
+{
+
+ /** . */
+ private final Logger log = Logger.getLogger(EventControllerContextSafeInvoker.class);
+
+ public boolean eventProduced(EventControllerContext context, EventPhaseSession session, Event sourceEvent, Event producedEvent)
+ {
+ try
+ {
+ context.eventProduced(session, sourceEvent, producedEvent);
+
+ //
+ return true;
+ }
+ catch (Exception e)
+ {
+ log.error("Cannot deliver produced event " + producedEvent + " because the event " +
+ "controller context threw a runtime exception", e);
+
+ //
+ return false;
+ }
+ }
+
+ public boolean eventConsumed(EventControllerContext context, EventPhaseSession session, Event consumedEvent, PortletInvocationResponse consumerResponse)
+ {
+ try
+ {
+ context.eventConsumed(session, consumedEvent, consumerResponse);
+
+ //
+ return true;
+ }
+ catch (Exception e)
+ {
+ log.error("Event consumed callback threw an exception that is ignored by the controller", e);
+
+ //
+ return false;
+ }
+ }
+
+ public boolean eventFailed(EventControllerContext context, EventPhaseSession session, Event failedEvent, Throwable throwable)
+ {
+ try
+ {
+ context.eventFailed(session, failedEvent, throwable);
+
+ //
+ return true;
+ }
+ catch (Exception e1)
+ {
+ log.error("Event delivery failed callback threw an exception that is ignored by the controller", e1);
+
+ //
+ return false;
+ }
+ }
+
+ public boolean eventDiscarded(EventControllerContext context, EventPhaseSession session, Event discardedEvent, int cause)
+ {
+ try
+ {
+ context.eventDiscarded(session, discardedEvent, cause);
+
+ //
+ return true;
+ }
+ catch (Exception e1)
+ {
+ log.error("Event delivery failed callback threw an exception that is ignored by the controller", e1);
+
+ //
+ return false;
+ }
+ }
+}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-03-06 22:59:54 UTC (rev 10235)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-03-07 12:30:18 UTC (rev 10236)
@@ -42,7 +42,6 @@
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.invocation.ActionInvocation;
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.ResponseProperties;
import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
@@ -59,6 +58,9 @@
class PortletRequestHandler extends RequestHandler<PortletRequest>
{
+ /** . */
+ private static final EventControllerContextSafeInvoker safeInvoker = new EventControllerContextSafeInvoker();
+
public PortletRequestHandler(PortletController controller)
{
super(PortletRequest.class, controller);
@@ -132,6 +134,7 @@
if (producerPortletInfo == null)
{
log.trace("Cannot deliver event " + producedEvent +" because the producer does not have portlet info");
+ safeInvoker.eventDiscarded(eventCC, session, producedEvent, EventControllerContext.EVENT_PRODUCER_INFO_NOT_AVAILABLE);
continue;
}
@@ -141,6 +144,7 @@
if (!producerPortletInfo.getEventing().getProducedEvents().containsKey(producedEvent.getName()))
{
log.trace("Cannot deliver event " + producedEvent +" because the producer of the event does not produce the event name");
+ safeInvoker.eventDiscarded(eventCC, session, producedEvent, EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
continue;
}
}
@@ -153,20 +157,15 @@
{
log.trace("Event distribution interrupted because the maximum number of produced event is reached");
eventDistributionStatus = PortletResponse.PRODUCED_EVENT_FLOODED;
+ safeInvoker.eventDiscarded(eventCC, session, producedEvent, EventControllerContext.PRODUCED_EVENT_FLOODED);
break;
}
}
// Give control to the event context
- try
+ session.mode = EventPhaseSessionImpl.READ_WRITE_MODE;
+ if (!safeInvoker.eventProduced(eventCC, session, eventProduction.getConsumedEvent(), producedEvent))
{
- session.mode = EventPhaseSessionImpl.READ_WRITE_MODE;
- eventCC.eventProduced(session, eventProduction.getConsumedEvent(), producedEvent);
- }
- catch (Exception e)
- {
- log.trace("Cannot deliver produced event " + producedEvent + " because the event controller context " +
- "threw a runtime exception", e);
continue;
}
@@ -182,18 +181,14 @@
while (session.toConsumeEvents.size() > 0)
{
Event toConsumeEvent = session.toConsumeEvents.removeFirst();
-
- //
String consumedId = toConsumeEvent.getWindowId();
//
PortletInfo consumerPortletInfo = context.getPortletInfo(consumedId);
if (consumerPortletInfo == null)
{
- if (log.isTraceEnabled())
- {
- log.trace("Cannot deliver event " + producedEvent +" because the consumer of the event does not have a portlet info");
- }
+ log.trace("Cannot deliver event " + producedEvent +" because the consumer of the event does not have a portlet info");
+ safeInvoker.eventDiscarded(eventCC, session, toConsumeEvent, EventControllerContext.EVENT_CONSUMER_INFO_NOT_AVAILABLE);
continue;
}
@@ -202,10 +197,8 @@
{
if (!consumerPortletInfo.getEventing().getConsumedEvents().containsKey(toConsumeEvent.getName()))
{
- if (log.isTraceEnabled())
- {
- log.trace("Cannot deliver event " + producedEvent +" because the consumer of the event does not accept the event name");
- }
+ log.trace("Cannot deliver event " + producedEvent +" because the consumer of the event does not accept the event name");
+ safeInvoker.eventDiscarded(eventCC, session, toConsumeEvent, EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
continue;
}
}
@@ -217,29 +210,29 @@
if (session.consumedEventSize + 1 > consumedEventThreshold)
{
log.trace("Event distribution interrupted because the maximum number of consumed event is reached");
+ safeInvoker.eventDiscarded(eventCC, session, toConsumeEvent, EventControllerContext.CONSUMED_EVENT_FLOODED);
eventDistributionStatus = PortletResponse.CONSUMED_EVENT_FLOODED;
break;
}
}
//
- PortletInvocationResponse eventResponse = deliverEvent(context, toConsumeEvent, pageNavigationalState, requestProperties.getCookies());
-
- // Now it is consumed we add it to the history
- session.consumedEventSize++;
-
- // And we make a callback
+ PortletInvocationResponse eventResponse;
try
{
- session.mode = EventPhaseSessionImpl.READ_MODE;
- eventCC.eventConsumed(session, producedEvent, toConsumeEvent);
+ eventResponse = deliverEvent(context, toConsumeEvent, pageNavigationalState, requestProperties.getCookies());
}
catch (Exception e)
{
- log.trace("Event consumed callback threw an exception that is ignored by the controller", e);
+ log.trace("Event delivery of " + toConsumeEvent + " failed", e);
+ safeInvoker.eventFailed(eventCC, session, toConsumeEvent, e);
+ continue;
}
- //
+ // Now it is consumed
+ session.consumedEventSize++;
+
+ // Update nav state if needed
if (eventResponse instanceof UpdateNavigationalStateResponse)
{
UpdateNavigationalStateResponse eventStateResponse = (UpdateNavigationalStateResponse)eventResponse;
@@ -250,8 +243,8 @@
// Add events to source event queue
for (UpdateNavigationalStateResponse.Event portletEvent : eventStateResponse.getEvents())
{
- Event blah = new Event(portletEvent.getName(), portletEvent.getPayload(), toConsumeEvent.getWindowId());
- session.producedEvents.add(new EventProduction(toConsumeEvent, blah));
+ Event toRouteEvent = new Event(portletEvent.getName(), portletEvent.getPayload(), toConsumeEvent.getWindowId());
+ session.producedEvents.add(new EventProduction(toConsumeEvent, toRouteEvent));
}
//
@@ -261,14 +254,10 @@
requestProperties.append(updateProperties);
}
}
- else if (eventResponse instanceof ErrorResponse)
- {
- // Do something here !!!!
- }
- else
- {
- // Do something here !!!!
- }
+
+ // And we make a callback
+ session.mode = EventPhaseSessionImpl.READ_MODE;
+ safeInvoker.eventConsumed(eventCC, session, toConsumeEvent, eventResponse);
}
// We archive the consumed event in the history
@@ -344,9 +333,10 @@
}
}
- private PortletInvocationResponse deliverEvent(PortletControllerContext context, Event event,
- PageNavigationalState pageNavigationalState, List<Cookie> requestCookies)
- throws PortletInvokerException
+ private PortletInvocationResponse deliverEvent(
+ PortletControllerContext context, Event event,
+ PageNavigationalState pageNavigationalState,
+ List<Cookie> requestCookies) throws PortletInvokerException
{
WindowNavigationalState windowNS = pageNavigationalState.getWindowNavigationalState(event.getWindowId());
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java 2008-03-06 22:59:54 UTC (rev 10235)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java 2008-03-07 12:30:18 UTC (rev 10236)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.controller.event;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+
/**
* An implementation of the event controller context that do no ops.
*
@@ -34,7 +36,15 @@
{
}
- public void eventConsumed(EventPhaseSession session, Event sourceEvent, Event consumedEvent)
+ public void eventConsumed(EventPhaseSession session, Event consumedEvent, PortletInvocationResponse consumerResponse)
{
}
+
+ public void eventFailed(EventPhaseSession session, Event consumedEvent, Throwable throwable)
+ {
+ }
+
+ public void eventDiscarded(EventPhaseSession session, Event discardedEvent, int cause)
+ {
+ }
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java 2008-03-06 22:59:54 UTC (rev 10235)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java 2008-03-07 12:30:18 UTC (rev 10236)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.controller.event;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -29,8 +31,29 @@
public interface EventControllerContext
{
+ /** . */
+ int EVENT_PRODUCER_NOT_AVAILABLE = 0;
+
+ /** . */
+ int EVENT_PRODUCER_INFO_NOT_AVAILABLE = 1;
+
+ /** . */
+ int EVENT_CONSUMER_NOT_AVAILABLE = 2;
+
+ /** . */
+ int EVENT_CONSUMER_INFO_NOT_AVAILABLE = 3;
+
+ /** . */
+ int PORTLET_DOES_NOT_CONSUME_EVENT = 4;
+
+ /** . */
+ int CONSUMED_EVENT_FLOODED = 5;
+
+ /** . */
+ int PRODUCED_EVENT_FLOODED = 6;
+
/**
- * <p>Give control to the context when an event is produced. The session
+ * <p>Context call back when an event is produced. The session
* argument gives to the context the capability to queue events in response
* of the produced event or to interrupt the session. It has also access
* to the full history of distributed events in order to provide advanced
@@ -50,7 +73,7 @@
void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent);
/**
- * <p>Signal to the context when an event is consumed by a portlet. The session argument
+ * <p>Context call back when an event is consumed by a portlet. The session argument
* only provides querying capabilities and it is not possible to queue event
* or interrupt the session.</p>
*
@@ -61,9 +84,54 @@
* to the portlet controller invoker.</p>
*
* @param session the session
- * @param sourceEvent the source event
* @param consumedEvent the consumed event
+ * @param consumerResponse the consumer response
*/
- void eventConsumed(EventPhaseSession session, Event sourceEvent, Event consumedEvent);
+ void eventConsumed(EventPhaseSession session, Event consumedEvent, PortletInvocationResponse consumerResponse);
+ /**
+ * <p>Context call back when an event failed to be delivered because the invoker threw an exception.
+ * The session argument only provides querying capabilities and it is not possible to queue event
+ * or interrupt the session.</p>
+ *
+ * <p>During the invocation of this method, any runtime exception thrown will
+ * be ignored by the controller.</p>
+ *
+ * <p>During the invocation of this method, any error thrown will be propagated
+ * to the portlet controller invoker.</p>
+ *
+ * @param session the session
+ * @param failedEvent the failed event
+ * @param throwable the throwable
+ */
+ void eventFailed(EventPhaseSession session, Event failedEvent, Throwable throwable);
+
+ /**
+ * <p>Context call back when an event is discarded by the controller for a specific reason.
+ * The session argument only provides querying capabilities and it is not possible to queue event
+ * or interrupt the session.</p>
+ *
+ * <p>The cause value is an integer among the constants
+ * <ul>
+ * <li>{@link #CONSUMED_EVENT_FLOODED}</li>
+ * <li>{@link #EVENT_CONSUMER_INFO_NOT_AVAILABLE}</li>
+ * <li>{@link #EVENT_CONSUMER_NOT_AVAILABLE}</li>
+ * <li>{@link #EVENT_PRODUCER_INFO_NOT_AVAILABLE}</li>
+ * <li>{@link #EVENT_PRODUCER_NOT_AVAILABLE}</li>
+ * <li>{@link #PORTLET_DOES_NOT_CONSUME_EVENT}</li>
+ * <li>{@link #PRODUCED_EVENT_FLOODED}</li>
+ * <p/>
+ *
+ * <p>During the invocation of this method, any runtime exception thrown will
+ * be ignored by the controller.</p>
+ *
+ * <p>During the invocation of this method, any error thrown will be propagated
+ * to the portlet controller invoker.</p>
+ *
+ * @param session the session
+ * @param discardedEvent the discarded event
+ * @param cause the cause
+ */
+ void eventDiscarded(EventPhaseSession session, Event discardedEvent, int cause);
+
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java 2008-03-06 22:59:54 UTC (rev 10235)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java 2008-03-07 12:30:18 UTC (rev 10236)
@@ -25,6 +25,7 @@
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.event.EventPhaseSession;
@@ -66,7 +67,15 @@
}
}
- public void eventConsumed(EventPhaseSession session, Event sourceEvent, Event consumedEvent)
+ public void eventConsumed(EventPhaseSession session, Event consumedEvent, PortletInvocationResponse consumerResponse)
{
}
+
+ public void eventFailed(EventPhaseSession session, Event failedEvent, Throwable throwable)
+ {
+ }
+
+ public void eventDiscarded(EventPhaseSession session, Event discardedEvent, int cause)
+ {
+ }
}
Modified: modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java
===================================================================
--- modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java 2008-03-06 22:59:54 UTC (rev 10235)
+++ modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java 2008-03-07 12:30:18 UTC (rev 10236)
@@ -25,6 +25,7 @@
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import javax.xml.namespace.QName;
import java.util.List;
@@ -56,10 +57,18 @@
}
}
- public void eventConsumed(EventPhaseSession session, Event sourceEvent, Event consumedEvent)
+ public void eventConsumed(EventPhaseSession session, Event consumedEvent, PortletInvocationResponse consumerResponse)
{
}
+ public void eventFailed(EventPhaseSession session, Event failedEvent, Throwable throwable)
+ {
+ }
+
+ public void eventDiscarded(EventPhaseSession session, Event discardedEvent, int cause)
+ {
+ }
+
public void createWire(QName srcName, String srcWindowId, QName dstName, String dstWindowId)
{
Point src = new Point(srcName, srcWindowId);
@@ -89,8 +98,10 @@
private static class Point
{
+ /** . */
final QName name;
+ /** . */
final String windowId;
private Point(QName name, String windowId)
Modified: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java 2008-03-06 22:59:54 UTC (rev 10235)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java 2008-03-07 12:30:18 UTC (rev 10236)
@@ -27,6 +27,7 @@
import org.jboss.portal.portlet.controller.event.EventPhaseSession;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.info.PortletInfo;
/**
@@ -53,13 +54,13 @@
this.prepareResponse = prepareResponse;
}
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
+ public void eventProduced(EventPhaseSession context, Event sourceEvent, Event producedEvent)
{
for (String windowId : prepareResponse.getWindowIds())
{
try
{
- Portlet portlet = context.getPortlet(windowId);
+ Portlet portlet = this.context.getPortlet(windowId);
//
if (portlet != null)
@@ -70,19 +71,27 @@
if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
{
Event distributedEvent = new Event(producedEvent.getName(), producedEvent.getPayload(), windowId);
- session.queueEvent(distributedEvent);
+ context.queueEvent(distributedEvent);
}
}
}
catch (PortletInvokerException e)
{
e.printStackTrace();
- session.interrupt();
+ context.interrupt();
}
}
}
- public void eventConsumed(EventPhaseSession session, Event sourceEvent, Event consumedEvent)
+ public void eventConsumed(EventPhaseSession session, Event consumedEvent, PortletInvocationResponse consumerResponse)
{
}
+
+ public void eventFailed(EventPhaseSession session, Event failedEvent, Throwable throwable)
+ {
+ }
+
+ public void eventDiscarded(EventPhaseSession session, Event discardedEvent, int cause)
+ {
+ }
}
16 years, 3 months
JBoss Portal SVN: r10235 - branches/JBoss_Portal_Branch_2_6/build.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-06 17:59:54 -0500 (Thu, 06 Mar 2008)
New Revision: 10235
Modified:
branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml
Log:
Use same versions as 2.6.4
Modified: branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml 2008-03-06 17:42:20 UTC (rev 10234)
+++ branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml 2008-03-06 22:59:54 UTC (rev 10235)
@@ -50,8 +50,8 @@
<componentref name="jboss-portal/modules/common" version="1.1.0"/>
<componentref name="jboss-portal/modules/web" version="1.1.0"/>
<componentref name="jboss-portal/modules/test" version="1.0.1"/>
- <componentref name="jboss-portal/modules/portlet" version="1.0.1"/>
- <componentref name="jboss-portal/modules/identity" version="1.0.1"/>
+ <componentref name="jboss-portal/modules/portlet" version="1.0.2"/>
+ <componentref name="jboss-portal/modules/identity" version="1.0.2"/>
<componentref name="antlr" version="2.7.6.ga"/>
<componentref name="apache-ant" version="1.6.5"/>
<componentref name="jackrabbit" version="1.1.1"/>
16 years, 3 months
JBoss Portal SVN: r10234 - branches/JBoss_Portal_2_6_1_JBPORTAL-1942/core/src/main/org/jboss/portal/core/aspects/server.
by portal-commits@lists.jboss.org
Author: mmillson
Date: 2008-03-06 12:42:20 -0500 (Thu, 06 Mar 2008)
New Revision: 10234
Modified:
branches/JBoss_Portal_2_6_1_JBPORTAL-1942/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java
Log:
Fix Hibernate/JBoss Cache locking for [JBPORTAL-1942].
Modified: branches/JBoss_Portal_2_6_1_JBPORTAL-1942/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java
===================================================================
--- branches/JBoss_Portal_2_6_1_JBPORTAL-1942/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java 2008-03-06 16:26:41 UTC (rev 10233)
+++ branches/JBoss_Portal_2_6_1_JBPORTAL-1942/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java 2008-03-06 17:42:20 UTC (rev 10234)
@@ -23,8 +23,8 @@
package org.jboss.portal.core.aspects.server;
import org.jboss.logging.Logger;
+import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.core.CoreConstants;
import org.jboss.portal.identity.CachedUserImpl;
import org.jboss.portal.identity.NoSuchUserException;
@@ -41,11 +41,13 @@
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
+import javax.transaction.UserTransaction;
+import javax.transaction.Transaction;
import java.io.Serializable;
import java.security.Principal;
import java.util.Date;
+import java.util.HashMap;
import java.util.Map;
-import java.util.HashMap;
/**
* The interceptor is responsible for managing the user identity lifecycle based on the principal name returned by the
@@ -132,7 +134,6 @@
User user = null;
Map profile = null;
-
// Fetch user if we can
if (userPrincipal != null)
{
@@ -240,7 +241,7 @@
}
try
- {
+ {
// Continue the invocation
invocation.invokeNext();
}
@@ -297,50 +298,85 @@
}
catch (Exception e)
{
- log.error("Cannot finalize user " + userId, e);
+ log.warn("Cannot set last login date for user with id '" + userId + "' : " + e.getMessage());
+ log.debug("Failed to set user last login date (may happen during server shutdown): ", e);
}
}
protected void finalizeUser() throws Exception
- {
- //
- if (log.isTraceEnabled())
+ {
+ /**
+ * Note: Due to a possible bug in JBoss Cache Transaction propagation within a cluster,
+ * We need to spawn a separate thread with its own new transaction to perform the finalizeUser
+ * logic.
+ *
+ * Without that, it results in data deadlocks in the cluster.
+ */
+ Thread thread = new Thread(new FinalizeRunner());
+ thread.start();
+ thread.join();
+ }
+
+ /**
+ *
+ * @author soshah
+ *
+ */
+ private class FinalizeRunner implements Runnable
+ {
+ public void run()
{
- log.trace("Finalizing user " + userId);
- }
-
- //
- // Here we use JNDI to locate the module as this finalizer could have been
- // migrated in the session of another node of the cluster
- UserModule userModule = null;
- UserProfileModule userProfileModule = null;
-
- try
- {
- userModule = (UserModule)new InitialContext().lookup("java:portal/UserModule");
- userProfileModule = (UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");
- }
- catch (NameNotFoundException ignore)
- {
- // Name is not bound anymore, it could happen during a shutdown, we don't do anything
- }
-
- // Get user and set last visit date to now if we can
- if (userModule != null && userProfileModule != null)
- {
+ UserTransaction tx = null;
try
{
- User user = userModule.findUserById(userId);
- //user.setLastVisitDate(new Date());
- userProfileModule.setProperty(user, User.INFO_USER_LAST_LOGIN_DATE, new Date().toString());
-
+ //
+ if (log.isTraceEnabled())
+ {
+ log.trace("Finalizing user " + userId);
+ }
+
+ //
+ // Here we use JNDI to locate the module as this finalizer could have been
+ // migrated in the session of another node of the cluster
+ UserModule userModule = null;
+ UserProfileModule userProfileModule = null;
+ InitialContext ctx = new InitialContext();
+ tx = (UserTransaction)ctx.lookup("UserTransaction");
+ tx.begin();
+ try
+ {
+ userModule = (UserModule)new InitialContext().lookup("java:portal/UserModule");
+ userProfileModule = (UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");
+ }
+ catch (NameNotFoundException ignore)
+ {
+ // Name is not bound anymore, it could happen during a shutdown, we don't do anything
+ }
+
+ // Get user and set last visit date to now if we can
+ if (userModule != null && userProfileModule != null)
+ {
+ try
+ {
+ User user = userModule.findUserById(userId);
+ //user.setLastVisitDate(new Date());
+ userProfileModule.setProperty(user, User.INFO_USER_LAST_LOGIN_DATE, new Date().toString());
+
+ }
+ catch (NoSuchUserException e)
+ {
+ // User is not found
+ log.warn("Trying to finalize non existing user " + userId);
+ }
+ }
+ tx.commit();
}
- catch (NoSuchUserException e)
+ catch(Exception e)
{
- // User is not found
- log.warn("Trying to finalize non existing user " + userId);
- }
+ try{tx.rollback();}catch(Exception rbe){}
+ log.debug(this, e);
+ }
}
}
- }
+ }
}
16 years, 3 months
JBoss Portal SVN: r10233 - in modules/portlet/trunk: build/distrib and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-06 11:26:41 -0500 (Thu, 06 Mar 2008)
New Revision: 10233
Modified:
modules/portlet/trunk/build/distrib/distrib.xml
modules/portlet/trunk/pom.xml
Log:
bundle html doc in the samples so it is possible to link them from the simple portal
Modified: modules/portlet/trunk/build/distrib/distrib.xml
===================================================================
--- modules/portlet/trunk/build/distrib/distrib.xml 2008-03-06 15:43:05 UTC (rev 10232)
+++ modules/portlet/trunk/build/distrib/distrib.xml 2008-03-06 16:26:41 UTC (rev 10233)
@@ -142,12 +142,6 @@
<!--
| Internal tasks
-->
- <target name="__package-binary">
- <antcall target="__package-distrib">
- <param name="todir" value="${bin.dir}"/>
- </antcall>
- <antcall target="__package-bundled-binary"/>
- </target>
<target name="__package-standalone-binary" if="bin-alone">
<mkdir dir="${bin.dir}/lib"/>
@@ -156,13 +150,24 @@
</copy>
<copy todir="${bin.dir}/samples">
<fileset dir="${source.dir}/samples/target" includes="*.war"/>
+ <fileset dir="${source.dir}/docs/user-guide/target/docbook" includes="*.war"/>
</copy>
</target>
+ <target name="__package-binary">
+ <antcall target="__package-distrib">
+ <param name="todir" value="${bin.dir}"/>
+ </antcall>
+ <antcall target="__package-bundled-binary"/>
+ </target>
+
<target name="__package-bundled-binary" unless="bin-alone">
<copy todir="${samples.dir}">
<fileset dir="${source.dir}/samples/target" includes="*.war"/>
</copy>
+ <copy
+ file="${source.dir}/docs/user-guide/target/attach/user-guide-en-US-${maven.version}-html.war"
+ tofile="${samples.dir}/jbosspc-docs.war"/>
</target>
<target name="__package-distrib">
Modified: modules/portlet/trunk/pom.xml
===================================================================
--- modules/portlet/trunk/pom.xml 2008-03-06 15:43:05 UTC (rev 10232)
+++ modules/portlet/trunk/pom.xml 2008-03-06 16:26:41 UTC (rev 10233)
@@ -5,7 +5,7 @@
<artifactId>module-aggregator</artifactId>
<packaging>pom</packaging>
<name>JBoss Portal Portlet Module Aggregator</name>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0-SNAPSHOT</version>
<url>http://labs.jboss.com/jbossportal</url>
<dependencies/>
16 years, 3 months
JBoss Portal SVN: r10232 - in modules/portlet/trunk/build/distrib: jboss-4.2/server/default/deploy/jboss-web.deployer/conf and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-06 10:43:05 -0500 (Thu, 06 Mar 2008)
New Revision: 10232
Modified:
modules/portlet/trunk/build/distrib/distrib.xml
modules/portlet/trunk/build/distrib/jboss-4.2/server/default/deploy/jboss-web.deployer/conf/web.xml
Log:
use filtering to replace jar version number for the AS42 portlet taglib integration
Modified: modules/portlet/trunk/build/distrib/distrib.xml
===================================================================
--- modules/portlet/trunk/build/distrib/distrib.xml 2008-03-06 11:44:54 UTC (rev 10231)
+++ modules/portlet/trunk/build/distrib/distrib.xml 2008-03-06 15:43:05 UTC (rev 10232)
@@ -90,8 +90,11 @@
</copy>
<!-- Taglib integration -->
- <copy todir="${pc.build.bin.as42}" overwrite="true">
+ <copy todir="${pc.build.bin.as42}" overwrite="true" filtering="true">
<fileset dir="jboss-4.2"/>
+ <filterset>
+ <filter token="maven.version" value="${maven.version}"/>
+ </filterset>
</copy>
<!-- -->
Modified: modules/portlet/trunk/build/distrib/jboss-4.2/server/default/deploy/jboss-web.deployer/conf/web.xml
===================================================================
--- modules/portlet/trunk/build/distrib/jboss-4.2/server/default/deploy/jboss-web.deployer/conf/web.xml 2008-03-06 11:44:54 UTC (rev 10231)
+++ modules/portlet/trunk/build/distrib/jboss-4.2/server/default/deploy/jboss-web.deployer/conf/web.xml 2008-03-06 15:43:05 UTC (rev 10232)
@@ -306,7 +306,7 @@
<init-param>
<description>Portlet standard tlds</description>
<param-name>tagLibJar2</param-name>
- <param-value>../simple-portal/lib/portlet-portlet-2.0.0-SNAPSHOT.jar</param-value>
+ <param-value>../simple-portal/lib/portlet-portlet-@maven.version@.jar</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
16 years, 3 months
JBoss Portal SVN: r10231 - branches/JBoss_Portal_Branch_2_7/core-identity.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-06 06:44:54 -0500 (Thu, 06 Mar 2008)
New Revision: 10231
Modified:
branches/JBoss_Portal_Branch_2_7/core-identity/build.xml
Log:
Adding Portlet 2.0 API to core-identity
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/build.xml 2008-03-06 11:41:00 UTC (rev 10230)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/build.xml 2008-03-06 11:44:54 UTC (rev 10231)
@@ -104,12 +104,13 @@
<path refid="apache.log4j.classpath"/>
<path refid="sun.servlet.classpath"/>
<path refid="facelets.facelets.classpath"/>
- <path refid="jcaptcha.jcaptcha.classpath"/>
+ <path refid="jcaptcha.jcaptcha.classpath"/>
<path refid="el.el.classpath"/>
- <path refid="jakarta.cactus.classpath"/>
- <path refid="junit.junit.classpath"/>
+ <path refid="jakarta.cactus.classpath"/>
+ <path refid="junit.junit.classpath"/>
<pathelement location="${source.etc}/sun-jsf/jsf-example.jar"/>
- <path refid="jbpm.jaronly.classpath"/>
+ <path refid="jbpm.jaronly.classpath"/>
+ <path refid="portlet.portlet.classpath"/>
</path>
<!-- Configure modules -->
16 years, 3 months
JBoss Portal SVN: r10230 - in branches/JBoss_Portal_Branch_2_7: core/src/main/org/jboss/portal/core/portlet/info and 3 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-06 06:41:00 -0500 (Thu, 06 Mar 2008)
New Revision: 10230
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/AjaxInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/CorePortletInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/MarkupHeaderInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/PortletIconInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/PortletInfoInfo.java
Modified:
branches/JBoss_Portal_Branch_2_7/core/.classpath
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/CorePortletPreferencesTestCase.java
branches/JBoss_Portal_Branch_2_7/faces/.classpath
branches/JBoss_Portal_Branch_2_7/server/.classpath
Log:
- Files deleted on commit... Weird plugin feature.
- Fixed Eclipse classpath
Modified: branches/JBoss_Portal_Branch_2_7/core/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/.classpath 2008-03-06 11:32:19 UTC (rev 10229)
+++ branches/JBoss_Portal_Branch_2_7/core/.classpath 2008-03-06 11:41:00 UTC (rev 10230)
@@ -56,6 +56,5 @@
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-federation-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar" sourcepath="/module-portlet"/>
<classpathentry kind="lib" path="/thirdparty/portlet/lib/portlet-api.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/module-portlet"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/AjaxInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/AjaxInfo.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/AjaxInfo.java 2008-03-06 11:41:00 UTC (rev 10230)
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.info;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8786 $
+ */
+public interface AjaxInfo
+{
+ boolean getPartialRefresh();
+}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/CorePortletInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/CorePortletInfo.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/CorePortletInfo.java 2008-03-06 11:41:00 UTC (rev 10230)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.info;
+
+import org.jboss.portal.common.transaction.Transactions;
+import org.jboss.portal.portlet.deployment.jboss.info.ContainerPortletInfoWrapper;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8786 $
+ */
+public interface CorePortletInfo extends ContainerPortletInfoWrapper
+{
+ /** @return */
+ Transactions.Type getTxType();
+
+ /** @return */
+ AjaxInfo getAjax();
+
+ /** @return */
+ MarkupHeaderInfo getMarkupHeader();
+
+ PortletInfoInfo getPortletInfo();
+}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/MarkupHeaderInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/MarkupHeaderInfo.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/MarkupHeaderInfo.java 2008-03-06 11:41:00 UTC (rev 10230)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.info;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8786 $
+ */
+public interface MarkupHeaderInfo
+{
+ Collection getMarkupElements();
+}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/PortletIconInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/PortletIconInfo.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/PortletIconInfo.java 2008-03-06 11:41:00 UTC (rev 10230)
@@ -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.core.portlet.info;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 8786 $
+ */
+public interface PortletIconInfo
+{
+ /** . */
+ public static final String SMALL = "small";
+
+ /** . */
+ public static final String LARGE = "large";
+
+ String getIconLocation(String size);
+}
+
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/PortletInfoInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/PortletInfoInfo.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/info/PortletInfoInfo.java 2008-03-06 11:41:00 UTC (rev 10230)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.info;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 8786 $
+ */
+public interface PortletInfoInfo
+{
+
+ PortletIconInfo getPortletIconInfo();
+}
+
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/CorePortletPreferencesTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/CorePortletPreferencesTestCase.java 2008-03-06 11:32:19 UTC (rev 10229)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/CorePortletPreferencesTestCase.java 2008-03-06 11:41:00 UTC (rev 10230)
@@ -23,7 +23,7 @@
package org.jboss.portal.test.core;
import junit.framework.TestCase;
-import org.jboss.portlet.JBossPortletPreferences;
+//import org.jboss.portlet.JBossPortletPreferences;
import javax.portlet.ReadOnlyException;
import java.util.Arrays;
@@ -40,7 +40,7 @@
super(key);
}
- private JBossPortletPreferences prefs;
+// private JBossPortletPreferences prefs;
private TestProxy proxy;
protected void setUp() throws Exception
@@ -61,9 +61,9 @@
protected void tearDown() throws Exception
{
proxy = null;
- prefs = null;
+// prefs = null;
}
-
+/*
public void testSetNonNullString()
{
proxy.setString("value");
@@ -193,7 +193,7 @@
prefs.setValues("BooleanArray", new String[]{null});
assertTrue(Arrays.equals(new boolean[]{true}, proxy.getBooleanArray(new boolean[]{true})));
}
-
+*/
public void testGetNonExistingBooleanArray() throws ReadOnlyException
{
assertTrue(Arrays.equals(new boolean[]{true}, proxy.getBooleanArray(new boolean[]{true})));
Modified: branches/JBoss_Portal_Branch_2_7/faces/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/faces/.classpath 2008-03-06 11:32:19 UTC (rev 10229)
+++ branches/JBoss_Portal_Branch_2_7/faces/.classpath 2008-03-06 11:41:00 UTC (rev 10230)
@@ -16,6 +16,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-portal-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-jsr168api-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-bridge-lib.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/module-portlet"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar" sourcepath="/module-portlet"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/server/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/server/.classpath 2008-03-06 11:32:19 UTC (rev 10229)
+++ branches/JBoss_Portal_Branch_2_7/server/.classpath 2008-03-06 11:41:00 UTC (rev 10230)
@@ -16,7 +16,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/web/lib/portal-web-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/test/lib/portal-test-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/test/lib/portal-test-jboss-lib.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/module-portlet"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar" sourcepath="/module-portlet"/>
<classpathentry kind="output" path="bin"/>
</classpath>
16 years, 3 months
JBoss Portal SVN: r10228 - in branches/JBoss_Portal_Branch_2_7: core and 36 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-06 06:10:42 -0500 (Thu, 06 Mar 2008)
New Revision: 10228
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/SignOutInterceptor.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilder.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilderContext.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilderFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/JBossPortletFilter.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFServerContext.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/CorePortletInvoker.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/LocalizedStringBuilder.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/PortletApplicationModelFactory.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilder.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilderFactory.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletApplicationContextImpl.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerContextImpl.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletFilterContextImpl.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/ContainerCacheInfo.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/ContainerPortletInfoWrapper.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/PortletInfoFactory.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossApplicationMetaData.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossPortletMetaData.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/PolicyPermissionMetaData.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/SecurityConstraintMetaData.java
Removed:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/metadata/PreferencesMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossAPIFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossPortletPreferences.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletApplicationMetaDataFactory.java
Modified:
branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml
branches/JBoss_Portal_Branch_2_7/build/build.xml
branches/JBoss_Portal_Branch_2_7/core-admin/.classpath
branches/JBoss_Portal_Branch_2_7/core-admin/build.xml
branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_7/core-samples/build.xml
branches/JBoss_Portal_Branch_2_7/core/.classpath
branches/JBoss_Portal_Branch_2_7/core/build.xml
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/node/Navigation.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/AjaxInterceptor.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/TransactionInterceptor.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerResponseFactory.java
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/deployment/JBossApplicationMetaDataFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeploymentFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/instance/persistent/PersistentInstanceDefinition.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/JBossApplicationMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/JBossPortletMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/command/render/RenderPortletInstanceCommand.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/metadata/InstanceMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/I18nELTestCase.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/I18nOutELTestCase.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/deployment/PortletInstancesMetaDataFactoryTestCase.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionRequest.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderRequest.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderResponse.java
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/JBoss_Portal_Branch_2_7/faces/.classpath
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletActionEvent.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/UIPortlet.java
branches/JBoss_Portal_Branch_2_7/portlet-server/.classpath
branches/JBoss_Portal_Branch_2_7/portlet-server/build.xml
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/JBossApplicationMetaDataFactory.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
branches/JBoss_Portal_Branch_2_7/server/.classpath
branches/JBoss_Portal_Branch_2_7/server/build.xml
branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/deployment/PortalWebApp.java
branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/deployment/jboss/AbstractDeploymentFactory.java
Log:
Initial integration of PC2
Modified: branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml 2008-03-06 11:10:42 UTC (rev 10228)
@@ -114,6 +114,7 @@
<componentref name="sun-jsf" version="1.2.1_02"/>
<componentref name="sun-opends" version="snapshot"/>
<componentref name="sun-servlet" version="2.4"/>
+ <componentref name="sun-jaxb" version="2.0"/>
<componentref name="xdoclet" version="1.2.3"/>
<componentref name="jbpm/jaronly" version="3.1.2"/>
<componentref name="freemarker" version="2.3.9"/>
Modified: branches/JBoss_Portal_Branch_2_7/build/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/build/build.xml 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/build/build.xml 2008-03-06 11:10:42 UTC (rev 10228)
@@ -139,7 +139,7 @@
<group name="portal">
<include
- modules="api, jems, server, security, search, format, portlet-server, faces, theme, workflow, cms, registration, core, wsrp, core-admin, core-cms, core-management, core-identity, core-samples, widget"/>
+ modules="api, jems, server, security, search, format, portlet-server, faces, theme, workflow, registration, core,core-management, core-identity, core-samples, widget"/>
</group>
<group name="cms">
@@ -292,7 +292,7 @@
<require file="${jboss.home}/server/${portal.deploy.dir}"/>
<copy file="../core/output/lib/jboss-portal.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
<copy file="../core-admin/output/lib/portal-admin.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- <copy file="../core-cms/output/lib/portal-cms.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
+ <!--copy file="../core-cms/output/lib/portal-cms.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/-->
<copy file="../core-identity/output/lib/portal-identity.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
<copy file="../workflow/output/lib/portal-workflow.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
<copy file="../core-management/output/lib/portal-management.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
@@ -304,7 +304,7 @@
<!--<copy file="../core-search/output/lib/portal-search.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>-->
<copy file="../widget/output/lib/portal-widget.war" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
<copy file="../widget/output/lib/portal-widget-netvibes.war" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
- <copy file="../wsrp/output/lib/portal-wsrp.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
+ <!--copy file="../wsrp/output/lib/portal-wsrp.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/-->
</target>
<target name="undeploy-all"
@@ -538,4 +538,4 @@
<setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
</target>
-</project>
\ No newline at end of file
+</project>
Modified: branches/JBoss_Portal_Branch_2_7/core/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/.classpath 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/.classpath 2008-03-06 11:10:42 UTC (rev 10228)
@@ -54,8 +54,8 @@
<classpathentry kind="lib" path="/thirdparty/jboss/backport-concurrent/lib/jboss-backport-concurrent.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/test/lib/portal-test-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-federation-lib.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-jsr168api-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar" sourcepath="/module-portlet"/>
<classpathentry kind="lib" path="/thirdparty/portlet/lib/portlet-api.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/module-portlet"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/core/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/build.xml 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/build.xml 2008-03-06 11:10:42 UTC (rev 10228)
@@ -87,6 +87,7 @@
&libraries;
<path id="library.classpath">
+ <path refid="portlet.portlet.classpath"/>
<path refid="jboss.portal/modules/common.classpath"/>
<path refid="jboss.portal/modules/web.classpath"/>
<path refid="jboss.portal/modules/identity.classpath"/>
@@ -122,6 +123,7 @@
<pathelement location="${source.etc}/sun-jsf/jsf-example.jar"/>
<!-- jbpm integration -->
<path refid="jbpm.jaronly.classpath"/>
+ <path refid="sun.jaxb.classpath"/>
</path>
<!-- Configure modules -->
@@ -232,6 +234,7 @@
<path refid="beanshell.beanshell.classpath"/>
<path refid="hibernate.classpath"/>
<path refid="jboss.portal/modules/common.classpath"/>
+ <path refid="jboss.portal/modules/web.classpath"/>
<path refid="jboss.portal/modules/portlet.classpath"/>
<path refid="jboss.portal/modules/identity.classpath"/>
<path refid="jboss.portal-server.classpath"/>
@@ -322,7 +325,6 @@
<fileset dir="${jboss.portal/modules/portlet.lib}">
<include name="portal-portlet-lib.jar"/>
<include name="portal-portlet-federation-lib.jar"/>
- <include name="portal-portlet-jsr168api-lib.jar"/>
<include name="portal-portlet-management-lib.jar"/>
<include name="portal-portlet-bridge-lib.jar"/>
</fileset>
@@ -344,6 +346,7 @@
<fileset dir="${tagsoup.tagsoup.lib}" includes="tagsoup.jar"/>
<fileset dir="${jboss/backport.concurrent.lib}" includes="jboss-backport-concurrent.jar"/>
<fileset dir="${jbpm.jaronly.lib}" includes="jbpm.jar,jbpm-identity.jar"/>
+ <fileset dir="${portlet.portlet.lib}" includes="portlet-api.jar"/>
</copy>
<copy todir="${build.resources}/jboss-portal/lib" failonerror="false">
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -35,6 +35,7 @@
import org.jboss.portal.api.node.event.WindowRenderEvent;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.util.LazyMap;
+import org.jboss.portal.common.util.MapAccessor;
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.core.controller.CommandRedirectionException;
import org.jboss.portal.core.controller.ControllerCommand;
@@ -146,15 +147,7 @@
Map params = wae.getParameters();
//
- ParameterMap interactionParams;
- if (params instanceof ActionParameterMap)
- {
- interactionParams = (ParameterMap)((ActionParameterMap)params).createDelegate();
- }
- else
- {
- interactionParams = asParameters(params);
- }
+ ParameterMap interactionParams = asParameters(params);
//
if (interactionParams != null)
@@ -333,32 +326,25 @@
/**
*
*/
- private static class ActionParameterMap extends LazyMap
+ private static class ActionParameterMap extends LazyMap<String, String[]>
{
- /** . */
- private ParameterMap formParams;
-
- /** . */
- private ParameterMap interactionParams;
-
- /** . */
- private ParameterMap params;
-
- public ActionParameterMap(ParameterMap interactionParams, ParameterMap formParams)
+ public ActionParameterMap(final ParameterMap interactionParams, final ParameterMap formParams)
{
- this.formParams = formParams;
- this.interactionParams = interactionParams;
- this.params = null;
- }
+ super(new MapAccessor<String, String[]>()
+ {
+ /** . */
+ private ParameterMap params;
- protected Map createDelegate()
- {
- if (params == null)
- {
- params = new ParameterMap(interactionParams);
- params.append(formParams);
- }
- return params;
+ public Map<String, String[]> getMap(boolean writable)
+ {
+ if (params == null)
+ {
+ params = new ParameterMap(interactionParams);
+ params.append(formParams);
+ }
+ return params;
+ }
+ });
}
}
}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/node/Navigation.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/node/Navigation.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/node/Navigation.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -33,10 +33,10 @@
{
/** . */
- private static final ThreadLocal currentNodeLocal = new ThreadLocal();
+ private static final ThreadLocal<PortalNodeImpl> currentNodeLocal = new ThreadLocal<PortalNodeImpl>();
/** . */
- private static final ThreadLocal runtimeContextLocal = new ThreadLocal();
+ private static final ThreadLocal<PortalRuntimeContext> runtimeContextLocal = new ThreadLocal<PortalRuntimeContext>();
public static PortalNodeImpl getCurrentNode()
{
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/AjaxInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/AjaxInterceptor.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/AjaxInterceptor.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -25,8 +25,8 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.core.portlet.info.AjaxInfo;
import org.jboss.portal.core.portlet.info.CorePortletInfo;
-import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.deployment.CorePortletInvoker;
+import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
@@ -48,19 +48,25 @@
protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
{
+ System.out.println("TODO: org.jboss.portal.core.aspects.portlet.AjaxInterceptor");
+
PortletInvocationResponse response = (PortletInvocationResponse)invocation.invokeNext();
//
if (response instanceof FragmentResponse)
{
- PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
- CorePortletInfo info = (CorePortletInfo)container.getInfo();
- if (info != null)
+ PortletInfo portletInfo = (PortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, CorePortletInvoker.PORTLET_CORE_INFO);
+ if (portletInfo instanceof CorePortletInfo)
{
- AjaxInfo ajax = info.getAjax();
- if (ajax != null)
+ CorePortletInfo corePortletInfo = (CorePortletInfo)portletInfo;
+
+ if (corePortletInfo != null)
{
- invocation.setAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, PARTIAL_REFRESH, Boolean.valueOf(ajax.getPartialRefresh()));
+ AjaxInfo ajax = corePortletInfo.getAjax();
+ if (ajax != null)
+ {
+// invocation.setAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, PARTIAL_REFRESH, Boolean.valueOf(ajax.getPartialRefresh()));
+ }
}
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.aspects.portlet;
+import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.markup.MarkupElement;
import org.jboss.portal.core.portlet.info.CorePortletInfo;
@@ -52,6 +53,8 @@
// Only affect fragments
if (response instanceof FragmentResponse)
{
+ System.out.println("TODO: org.jboss.portal.core.aspects.portlet.HeaderInterceptor");
+ /*
FragmentResponse fragment = (FragmentResponse)response;
// The buffer that may become non null if we have content to write in it
@@ -99,6 +102,7 @@
//
fragment.setHeader(headerChars);
+ */
}
//
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/SignOutInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/SignOutInterceptor.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/SignOutInterceptor.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -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.core.aspects.portlet;
+
+import javax.portlet.Event;
+import javax.xml.namespace.QName;
+
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.core.controller.portlet.SignOutResponse;
+import org.jboss.portal.portlet.invocation.PortletInterceptor;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class SignOutInterceptor extends PortletInterceptor
+{
+
+ @Override
+ protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
+ {
+ PortletInvocationResponse response = (PortletInvocationResponse)invocation.invokeNext();
+ if (response instanceof UpdateNavigationalStateResponse)
+ {
+ UpdateNavigationalStateResponse unsr = (UpdateNavigationalStateResponse)response;
+ for (UpdateNavigationalStateResponse.Event event: unsr.getEvents())
+ {
+ if (event.getName().equals(new QName("http://www.jboss.com/portal", "signOut")))
+ {
+ String location = (String)event.getPayload();
+ return new SignOutResponse(location);
+ }
+ }
+ }
+ return response;
+ }
+
+}
+
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/TransactionInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/TransactionInterceptor.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/TransactionInterceptor.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -25,8 +25,8 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.transaction.Transactions;
import org.jboss.portal.core.portlet.info.CorePortletInfo;
-import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.deployment.CorePortletInvoker;
+import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -43,42 +43,47 @@
Transactions.Type txType = Transactions.TYPE_NOT_SUPPORTED;
// Override tx type if found
- PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
- CorePortletInfo info = (CorePortletInfo)container.getInfo();
- if (info != null)
+ PortletInfo portletInfo = (PortletInfo) invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
+ CorePortletInvoker.PORTLET_CORE_INFO);
+ if (portletInfo instanceof CorePortletInfo)
{
- txType = info.getTxType();
- }
+ CorePortletInfo corePortletInfo = (CorePortletInfo) portletInfo;
+ if (corePortletInfo != null)
+ {
+ txType = corePortletInfo.getTxType();
+ }
- //
- if (txType == Transactions.TYPE_NOT_SUPPORTED)
- {
- return invokeNotSupported(invocation);
+ //
+ if (txType == Transactions.TYPE_NOT_SUPPORTED)
+ {
+ return invokeNotSupported(invocation);
+ }
+ else if (txType == Transactions.TYPE_NEVER)
+ {
+ return invokeNever(invocation);
+ }
+ else if (txType == Transactions.TYPE_MANDATORY)
+ {
+ return invokeMandatory(invocation);
+ }
+ else if (txType == Transactions.TYPE_SUPPORTS)
+ {
+ return invokeSupports(invocation);
+ }
+ else if (txType == Transactions.TYPE_REQUIRED)
+ {
+ return invokeRequired(invocation);
+ }
+ else if (txType == Transactions.TYPE_REQUIRES_NEW)
+ {
+ return invokeRequiresNew(invocation);
+ }
+ else
+ {
+ throw new InvocationException("Should not happen");
+ }
}
- else if (txType == Transactions.TYPE_NEVER)
- {
- return invokeNever(invocation);
- }
- else if (txType == Transactions.TYPE_MANDATORY)
- {
- return invokeMandatory(invocation);
- }
- else if (txType == Transactions.TYPE_SUPPORTS)
- {
- return invokeSupports(invocation);
- }
- else if (txType == Transactions.TYPE_REQUIRED)
- {
- return invokeRequired(invocation);
- }
- else if (txType == Transactions.TYPE_REQUIRES_NEW)
- {
- return invokeRequiresNew(invocation);
- }
- else
- {
- throw new InvocationException("Should not happen");
- }
+ return invocation.invokeNext();
}
protected Object invokeNotSupported(PortletInvocation invocation) throws Exception, InvocationException
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerResponseFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerResponseFactory.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerResponseFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -58,7 +58,7 @@
}
}
- public static ControllerResponse createActionResponse(PortalObjectId targetId, RequestContext reqContext, PortletInvocationResponse response)
+ public static ControllerResponse createActionResponse(PortalObjectId targetId, PortletInvocationResponse response)
{
if (response instanceof UpdateNavigationalStateResponse)
{
@@ -66,17 +66,9 @@
//
Mode mode = renderResult.getMode();
- if (mode == null)
- {
- mode = actionContext.getMode();
- }
//
WindowState windowState = renderResult.getWindowState();
- if (windowState == null)
- {
- windowState = actionContext.getWindowState();
- }
//
return new PortletWindowActionResponse(targetId, windowState, mode, renderResult.getNavigationalState());
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-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -27,7 +27,6 @@
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;
@@ -46,6 +45,7 @@
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
@@ -55,7 +55,10 @@
*/
public class PortletInvocationFactory
{
+ public static ThreadLocal<ControllerContext> controllerContextTL = new ThreadLocal<ControllerContext>();
+ public static ThreadLocal<UserContext> userContextTL = new ThreadLocal<UserContext>();
+
public static RenderInvocation createRender(
ControllerContext controllerContext,
Mode mode,
@@ -108,15 +111,18 @@
action.setNavigationalState(navigationalState);
action.setInteractionState(interactionState);
+ UserContext userContext = cf.createUserContext();
+
//
- action.setAttribute(PortletInvocation.INVOCATION_SCOPE, "controller_context", controllerContext);
-
+ controllerContextTL.set(controllerContext);
+ userContextTL.set(userContext);
+
// Contextualize
action.setSecurityContext(cf.createSecurityContext());
action.setRequestContext(cf.createRequestContext());
action.setPortalContext(cf.createPortalContext());
action.setWindowContext(cf.createWindowContext());
- action.setUserContext(cf.createUserContext());
+ action.setUserContext(userContext);
action.setServerContext(cf.createServerContext());
//
@@ -172,8 +178,8 @@
addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
addResolver(PortletInvocation.REQUEST_SCOPE, controllerContext);
addResolver(PortletInvocation.PRINCIPAL_SCOPE, controllerContext);
- addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, EmptyAttributeResolver.getInstance());
- addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
+// addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, EmptyAttributeResolver.getInstance());
+// addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
}
public HttpServletRequest getClientRequest() throws IllegalStateException
@@ -186,9 +192,9 @@
return controllerContext.getServerInvocation().getServerContext().getClientResponse();
}
- public String renderURL(ContainerURL containerURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+ public String renderURL(ContainerURL containerURL, org.jboss.portal.portlet.URLFormat urlFormat)
{
- return PortletInvocationFactory.renderURL(controllerContext, cmdFactory, containerURL, wantSecure, wantAuthenticated, relative);
+ return PortletInvocationFactory.renderURL(controllerContext, cmdFactory, containerURL, urlFormat.getWantSecure(), urlFormat.getWantAuthenticated(), urlFormat.getWantRelative());
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -221,7 +221,7 @@
}
}
- protected org.jboss.portal.portlet.metadata.JBossPortletMetaData createJBossPortlet()
+ protected org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData createJBossPortlet()
{
return new JBossPortletMetaData();
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -47,10 +47,12 @@
import org.jboss.portal.core.model.instance.DuplicateInstanceException;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.metadata.InstanceMetaData;
-import org.jboss.portal.core.model.instance.metadata.PreferencesMetaData;
import org.jboss.portal.portlet.InvalidPortletIdException;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEventListener;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferenceMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferencesMetaData;
import org.jboss.portal.portlet.state.PropertyChange;
import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.security.RoleSecurityBinding;
@@ -80,9 +82,9 @@
/** . */
private PortletAppDeploymentFactory factory;
- public PortletAppDeployment(URL url, PortalWebApp pwa, MBeanServer mbeanServer, PortletAppDeploymentFactory factory)
+ public PortletAppDeployment(URL url, PortalWebApp pwa, ManagedObjectRegistryEventListener listener, MBeanServer mbeanServer, PortletAppDeploymentFactory factory)
{
- super(url, pwa, mbeanServer, factory);
+ super(url, pwa, listener, mbeanServer, factory);
this.factory = factory;
}
@@ -400,14 +402,14 @@
List changes = new ArrayList();
// Reset all preferences that are not overridden
- PreferencesMetaData preferencesMetaData = metaData.getPreferences();
+ PortletPreferencesMetaData preferencesMetaData = metaData.getPreferences();
PropertyMap propertyMap = instance.getProperties();
if (propertyMap != null && propertyMap.size() > 0)
{
for (Iterator i = propertyMap.keySet().iterator(); i.hasNext();)
{
String key = (String)i.next();
- if (preferencesMetaData == null || preferencesMetaData.getPreference(key) == null)
+ if (preferencesMetaData == null || preferencesMetaData.getPortletPreferences() == null || preferencesMetaData.getPortletPreferences().get(key) == null)
{
changes.add(PropertyChange.newReset(key));
}
@@ -415,12 +417,12 @@
}
// Configure preferences only if needed
- if (preferencesMetaData != null && preferencesMetaData.size() > 0)
+ if (preferencesMetaData != null && preferencesMetaData.getPortletPreferences() != null && preferencesMetaData.getPortletPreferences().size() > 0)
{
- for (Iterator i = preferencesMetaData.iterator(); i.hasNext();)
+ for (Iterator i = preferencesMetaData.getPortletPreferences().values().iterator(); i.hasNext();)
{
- PreferenceMetaData preference = (PreferenceMetaData)i.next();
- Value value = new StringValue(preference.getValues());
+ PortletPreferenceMetaData preference = (PortletPreferenceMetaData)i.next();
+ Value value = new StringValue(preference.getValue());
changes.add(PropertyChange.newUpdate(preference.getName(), value));
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeploymentFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeploymentFactory.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeploymentFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -22,6 +22,10 @@
******************************************************************************/
package org.jboss.portal.core.deployment.jboss;
+import java.net.URL;
+
+import javax.management.MBeanServer;
+
import org.jboss.deployment.DeploymentException;
import org.jboss.portal.core.deployment.JBossApplicationMetaDataFactory;
import org.jboss.portal.core.model.instance.InstanceContainer;
@@ -29,9 +33,6 @@
import org.jboss.portal.server.deployment.jboss.Deployment;
import org.xml.sax.EntityResolver;
-import javax.management.MBeanServer;
-import java.net.URL;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -53,7 +54,7 @@
public Deployment newInstance(URL url, PortalWebApp pwa, MBeanServer mbeanServer) throws DeploymentException
{
- return new PortletAppDeployment(url, pwa, mbeanServer, this);
+ return new PortletAppDeployment(url, pwa, bridgeToInvoker, mbeanServer, this);
}
public EntityResolver getPortalObjectEntityResolver()
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -287,6 +287,8 @@
ControllerResponse cr;
if (response instanceof FragmentResponse)
{
+ System.out.println("TODO: org.jboss.portal.core.impl.model.content.InternalContentProvider.renderWindow()");
+
FragmentResponse fragment = (FragmentResponse)response;
//
@@ -297,7 +299,7 @@
}
//
- String headerChars = fragment.getHeader();
+// String headerChars = fragment.getHeader();
// Handle minimized here
String contentChars;
@@ -307,19 +309,23 @@
}
else
{
- contentChars = fragment.getContent();
+ contentChars = fragment.getChars().toString();
}
// Update window props after render if needed
+ System.out.println("TODO AJAX: org.jboss.portal.core.impl.model.content.InternalContentProvider");
+ /*
Boolean partialRefresh = (Boolean)invocation.getAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, AjaxInterceptor.PARTIAL_REFRESH);
if (partialRefresh != null && Boolean.FALSE.equals(partialRefresh))
{
DynaRenderOptions options = DynaRenderOptions.getOptions(null, partialRefresh);
options.setOptions(windowProps);
}
+ */
//
- cr = new MarkupResponse(windowTitle, contentChars, headerChars);
+ cr = new MarkupResponse(windowTitle, contentChars, "");
+
}
else if (response instanceof ErrorResponse)
{
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/instance/persistent/PersistentInstanceDefinition.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/instance/persistent/PersistentInstanceDefinition.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/instance/persistent/PersistentInstanceDefinition.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -23,12 +23,11 @@
package org.jboss.portal.core.impl.model.instance.persistent;
import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.common.i18n.LocalizedString.Value;
import org.jboss.portal.core.impl.model.instance.AbstractInstanceDefinition;
import org.jboss.portal.core.impl.model.instance.InstanceContainerContext;
import org.jboss.portal.core.model.instance.metadata.InstanceMetaData;
import org.jboss.portal.jems.hibernate.ContextObject;
-import org.jboss.portal.portlet.impl.jsr168.metadata.LocalizedStringMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.LocalizedValueMetaData;
import org.jboss.portal.security.RoleSecurityBinding;
import java.util.Collection;
@@ -53,7 +52,7 @@
protected boolean mutable;
protected Map relatedSecurityBindings;
protected Map relatedCustomizations;
- protected Map displayNames;
+ protected Map<Locale, String> displayNames;
// Runtime fields
@@ -94,22 +93,16 @@
this.state = null;
}
- private Map getDisplayNamesMap(LocalizedStringMetaData displayName)
+ private Map<Locale, String> getDisplayNamesMap(LocalizedString lString)
{
- Map map = new HashMap();
- if (displayName == null)
+ Map<Locale, String> map = new HashMap<Locale, String>();
+ if (lString != null)
{
- return map;
- }
- for (int i = 0; i < displayName.getValues().size(); i++)
- {
- LocalizedValueMetaData descriptionMD = (LocalizedValueMetaData)displayName.getValues().get(i);
- Locale locale = descriptionMD.getLocale();
- if (locale == null)
+ Map<Locale, Value> values = lString.getValues();
+ for (Locale locale: values.keySet())
{
- locale = Locale.ENGLISH;
+ map.put(locale, values.get(locale).getString());
}
- map.put(locale, descriptionMD.getValue());
}
return map;
}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilder.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilder.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,100 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.impl.portlet.info;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+
+import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
+import org.jboss.portal.portlet.deployment.jboss.InfoBuilder;
+import org.jboss.portal.portlet.deployment.jboss.PortletApplicationContextImpl;
+import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
+import org.jboss.portal.portlet.impl.info.ContainerInfoBuilder;
+import org.jboss.portal.portlet.impl.info.ContainerInfoBuilderContext;
+import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.ContainerInfoBuilderContextImpl;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.info.PortletInfo;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CoreInfoBuilder implements InfoBuilder
+{
+ private JBossApplicationMetaData jbossApplicationMetaData;
+
+ private PortletApplication10MetaData portletApplicationMD;
+
+ private CoreInfoBuilderContext builderContext;
+
+ private LinkedHashMap<String, PortletInfo> portlets;
+
+ private ContainerPortletApplicationInfo application;
+
+
+ public CoreInfoBuilder(JBossApplicationMetaData jbossApplicationMetaData, PortletApplication10MetaData portletApplicationMD,
+ CoreInfoBuilderContext builderContext)
+ {
+ this.portletApplicationMD = portletApplicationMD;
+ this.jbossApplicationMetaData = jbossApplicationMetaData;
+ this.builderContext = builderContext;
+ this.portlets = new LinkedHashMap<String, PortletInfo>();
+ }
+ public Collection<PortletInfo> getPortlets()
+ {
+ return portlets.values();
+ }
+
+ public ContainerPortletApplicationInfo getApplication()
+ {
+ return application;
+ }
+
+ public void build()
+ {
+ //
+ ContainerInfoBuilderContext containerBuilderContext = new ContainerInfoBuilderContextImpl(portletApplicationMD, builderContext.getWebApp());
+ ContainerInfoBuilder builder = new ContainerInfoBuilder(builderContext.getWebApp().getContextPath(), portletApplicationMD, containerBuilderContext);
+ builder.build();
+
+ this.application = builder.getApplication();
+
+ //
+ for (ContainerPortletInfo containerInfo : builder.getPortlets())
+ {
+ org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData jbPortletMD = (org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData)jbossApplicationMetaData.getPortlets().get(containerInfo.getName());
+ if (jbPortletMD instanceof JBossPortletMetaData)
+ {
+ CorePortletInfoImpl cpi = new CorePortletInfoImpl(containerInfo, new PortletApplicationContextImpl(builderContext.getWebApp()), (JBossPortletMetaData)jbPortletMD, containerInfo.getBundleManager());
+ portlets.put(jbPortletMD.getName(), cpi);
+ }
+ else
+ {
+ portlets.put(jbPortletMD.getName(), containerInfo);
+ }
+ }
+ }
+
+}
\ No newline at end of file
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilderContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilderContext.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilderContext.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.impl.portlet.info;
+
+import org.jboss.portal.server.deployment.PortalWebApp;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CoreInfoBuilderContext
+{
+ private PortalWebApp webApp;
+
+ public CoreInfoBuilderContext(PortalWebApp webApp)
+ {
+ this.webApp = webApp;
+ }
+
+ public PortalWebApp getWebApp()
+ {
+ return webApp;
+ }
+
+}
+
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilderFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilderFactory.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CoreInfoBuilderFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.impl.portlet.info;
+
+import org.jboss.portal.portlet.deployment.jboss.InfoBuilder;
+import org.jboss.portal.portlet.deployment.jboss.InfoBuilderFactory;
+import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.server.deployment.PortalWebApp;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CoreInfoBuilderFactory implements InfoBuilderFactory
+{
+
+ public InfoBuilder createInfoBuilder(PortalWebApp webApp, JBossApplicationMetaData jbossApplicationMetaData, PortletApplication10MetaData portletApplicationMD)
+ {
+ CoreInfoBuilderContext cibc = new CoreInfoBuilderContext(webApp);
+ CoreInfoBuilder cib = new CoreInfoBuilder(jbossApplicationMetaData, portletApplicationMD, cibc);
+ return cib;
+ }
+
+}
+
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoFactory.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -1,46 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.impl.portlet.info;
-
-import org.jboss.portal.common.i18n.ResourceBundleManager;
-import org.jboss.portal.portlet.container.PortletApplicationContext;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.impl.jsr168.spi.PortletInfoFactory;
-import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class CorePortletInfoFactory implements PortletInfoFactory
-{
- public PortletInfo createPortletInfo(
- PortletApplicationContext portletApplicationContext,
- PortletMetaData portletMD,
- JBossPortletMetaData jbossPortletMD,
- ResourceBundleManager resourceBundleManager)
- {
- return new CorePortletInfoImpl(portletApplicationContext, portletMD, jbossPortletMD, resourceBundleManager);
- }
-}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -33,14 +33,21 @@
import org.jboss.portal.core.portlet.info.MarkupHeaderInfo;
import org.jboss.portal.core.portlet.info.PortletInfoInfo;
import org.jboss.portal.portlet.container.PortletApplicationContext;
-import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.info.CacheInfo;
+import org.jboss.portal.portlet.info.CapabilitiesInfo;
+import org.jboss.portal.portlet.info.EventingInfo;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.info.NavigationInfo;
+import org.jboss.portal.portlet.info.PreferencesInfo;
+import org.jboss.portal.portlet.info.SecurityInfo;
+import org.jboss.portal.portlet.info.SessionInfo;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class CorePortletInfoImpl extends ContainerPortletInfo implements CorePortletInfo
+public class CorePortletInfoImpl implements CorePortletInfo
{
/** . */
@@ -54,11 +61,13 @@
/** . */
private final PortletInfoInfoImpl portletInfo;
+
+ private ContainerPortletInfo delegate;
- public CorePortletInfoImpl(PortletApplicationContext portletApplicationContext, PortletMetaData portletMD, org.jboss.portal.portlet.metadata.JBossPortletMetaData jbossPortletMD, ResourceBundleManager bundleMgr)
+ public CorePortletInfoImpl(ContainerPortletInfo delegate, PortletApplicationContext portletApplicationContext, JBossPortletMetaData jbossPortletMD, ResourceBundleManager bundleMgr)
{
- super(portletApplicationContext, portletMD, jbossPortletMD, bundleMgr);
-
+ this.delegate = delegate;
+
//
AjaxMetaData ajaxMD = ((JBossPortletMetaData)jbossPortletMD).getAjax();
HeaderContentMetaData headerContentMD = ((JBossPortletMetaData)jbossPortletMD).getHeaderContent();
@@ -90,4 +99,64 @@
{
return portletInfo;
}
+
+ public ContainerPortletInfo getContainerPortletInfo()
+ {
+ return delegate;
+ }
+
+ public String getApplicationName()
+ {
+ return delegate.getApplicationName();
+ }
+
+ public CacheInfo getCache()
+ {
+ return delegate.getCache();
+ }
+
+ public CapabilitiesInfo getCapabilities()
+ {
+ return delegate.getCapabilities();
+ }
+
+ public EventingInfo getEventing()
+ {
+ return delegate.getEventing();
+ }
+
+ public MetaInfo getMeta()
+ {
+ return delegate.getMeta();
+ }
+
+ public String getName()
+ {
+ return delegate.getName();
+ }
+
+ public NavigationInfo getNavigation()
+ {
+ return delegate.getNavigation();
+ }
+
+ public PreferencesInfo getPreferences()
+ {
+ return delegate.getPreferences();
+ }
+
+ public SecurityInfo getSecurity()
+ {
+ return delegate.getSecurity();
+ }
+
+ public SessionInfo getSession()
+ {
+ return delegate.getSession();
+ }
+
+ public Boolean isRemotable()
+ {
+ return delegate.isRemotable();
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.impl.portlet.state;
import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.common.util.LazyMap;
import org.jboss.portal.common.util.MapAccessor;
import org.jboss.portal.common.util.TypedMap;
import org.jboss.portal.registration.Consumer;
@@ -48,7 +49,7 @@
private Long key;
private String persistentHandle;
private RegistrationStatus persistentStatus;
- private Map persistentProperties;
+ private Map<String, Object> persistentProperties;
// Relationships
@@ -66,12 +67,12 @@
this.persistentHandle = null;
this.relatedConsumer = null;
this.persistentStatus = null;
- this.persistentProperties = new HashMap();
+ this.persistentProperties = new HashMap<String, Object>();
this.properties = new Properties();
this.relatedPortletStates = null;
}
- public PersistentRegistration(Map properties, RegistrationStatus status)
+ public PersistentRegistration(Map<String, Object> properties, RegistrationStatus status)
{
this.key = null;
this.persistentHandle = null;
@@ -137,12 +138,12 @@
this.persistentStatus = persistentStatus;
}
- public Map getPersistentProperties()
+ public Map<String, Object> getPersistentProperties()
{
return persistentProperties;
}
- public void setPersistentProperties(Map persistentProperties)
+ public void setPersistentProperties(Map<String, Object> persistentProperties)
{
this.persistentProperties = persistentProperties;
}
@@ -174,7 +175,7 @@
return relatedConsumer;
}
- public Map getProperties()
+ public Map<String, Object> getProperties()
{
return Collections.unmodifiableMap(properties);
}
@@ -289,14 +290,15 @@
return o.equals(o1);
}
};
-
- private final MapAccessor accessor = new MapAccessor()
+
+ private LazyMap<String, Object> lazyMap = new LazyMap<String, Object>(new MapAccessor<String, Object>()
{
- public Map getMap(boolean b)
+ public Map<String, Object> getMap(boolean writable)
{
return persistentProperties;
}
- };
+
+ });
/** Implement registration properties semantics, mostly validation and equality. */
public class Properties extends TypedMap
@@ -304,7 +306,7 @@
public Properties()
{
- super(accessor, KEY_CONVERTER, VALUE_CONVERTER);
+ super(lazyMap, KEY_CONVERTER, VALUE_CONVERTER);
}
public void setProperty(String propertyName, Object value)
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/JBossApplicationMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/JBossApplicationMetaData.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/JBossApplicationMetaData.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -29,7 +29,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class JBossApplicationMetaData extends org.jboss.portal.portlet.metadata.JBossApplicationMetaData
+public class JBossApplicationMetaData extends org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData
{
private Map services;
@@ -44,7 +44,7 @@
return services;
}
- public JBossApplicationMetaData(org.jboss.portal.portlet.metadata.JBossApplicationMetaData jbAppMD)
+ public JBossApplicationMetaData(org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData jbAppMD)
{
this();
this.remotable = jbAppMD.getRemotable();
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/JBossPortletMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/JBossPortletMetaData.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/JBossPortletMetaData.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -26,7 +26,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class JBossPortletMetaData extends org.jboss.portal.portlet.metadata.JBossPortletMetaData
+public class JBossPortletMetaData extends org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData
{
/** . */
@@ -68,7 +68,7 @@
this.portletInfo = portletInfo;
}
- public void merge(org.jboss.portal.portlet.metadata.JBossPortletMetaData portlet)
+ public void merge(org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData portlet)
{
super.merge(portlet);
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/command/render/RenderPortletInstanceCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/command/render/RenderPortletInstanceCommand.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/command/render/RenderPortletInstanceCommand.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -84,9 +84,12 @@
String header = "";
if (response instanceof FragmentResponse)
{
+ throw new NotYetImplemented("On the TODO List");
+ /*
FragmentResponse fragment = (FragmentResponse)response;
content = fragment.getContent();
header = fragment.getHeader();
+ */
}
else if (response instanceof ErrorResponse)
{
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/metadata/InstanceMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/metadata/InstanceMetaData.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/metadata/InstanceMetaData.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -29,14 +29,16 @@
import org.jboss.portal.common.util.ConversionException;
import org.jboss.portal.common.xml.XMLTools;
import org.jboss.portal.core.model.MetaDataResourceBundleFactory;
-import org.jboss.portal.portlet.impl.jsr168.metadata.DisplayNameMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.LocalizedStringMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PreferenceMetaData;
+import org.jboss.portal.portlet.deployment.LocalizedStringBuilder;
+import org.jboss.portal.portlet.impl.metadata.common.LocalizedDescriptionMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferenceMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferencesMetaData;
import org.jboss.portal.security.metadata.SecurityConstraintsMetaData;
import org.jboss.portal.server.deployment.PortalWebApp;
import org.w3c.dom.Element;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -59,7 +61,7 @@
private String id;
/** The specific preferences of this instance. */
- private PreferencesMetaData preferences;
+ private PortletPreferencesMetaData preferences;
/** The portlet referenced by the instance. */
private String portletRef;
@@ -68,7 +70,7 @@
private SecurityConstraintsMetaData securityConstraints;
/** Localized display name */
- private LocalizedStringMetaData displayName;
+ private LocalizedString displayName;
/** Resource bundle name */
private String resourceBundle;
@@ -90,12 +92,12 @@
this.id = id;
}
- public PreferencesMetaData getPreferences()
+ public PortletPreferencesMetaData getPreferences()
{
return preferences;
}
- public void setPreferences(PreferencesMetaData preferences)
+ public void setPreferences(PortletPreferencesMetaData preferences)
{
this.preferences = preferences;
}
@@ -110,12 +112,12 @@
this.portletRef = portletRef;
}
- public LocalizedStringMetaData getDisplayName()
+ public LocalizedString getDisplayName()
{
return displayName;
}
- public void setDisplayName(LocalizedStringMetaData displayName)
+ public void setDisplayName(LocalizedString displayName)
{
this.displayName = displayName;
}
@@ -143,31 +145,32 @@
Iterator displayNamesIt = XMLTools.getChildrenIterator(instanceElt, "display-name");
// Configure preferences override
- PreferencesMetaData preferencesMD = new PreferencesMetaData();
+ org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferencesMetaData preferencesMD = new PortletPreferencesMetaData();
Element preferencesElt = XMLTools.getUniqueChild(instanceElt, "preferences", false);
if (preferencesElt != null)
{
for (Iterator i = buildPreferencesMetaData(preferencesElt).values().iterator(); i.hasNext();)
{
- PreferenceMetaData preferenceMD = (PreferenceMetaData)i.next();
- preferencesMD.addPreference(preferenceMD);
+ PortletPreferenceMetaData preferenceMD = (PortletPreferenceMetaData)i.next();
+ preferencesMD.addPortletPreference(preferenceMD);
}
}
// Configure localized display-name
- LocalizedStringMetaData localizedStringMD = new LocalizedStringMetaData();
+ LocalizedStringBuilder localizedStringMD = new LocalizedStringBuilder();
+ Object dummy = new String("Dummy");
while (displayNamesIt.hasNext())
{
Element element = (Element)displayNamesIt.next();
- DisplayNameMetaData displayNameMD = new DisplayNameMetaData();
+ LocalizedDescriptionMetaData displayNameMD = new LocalizedDescriptionMetaData();
String lang = element.getAttribute("xml:lang");
Locale locale;
try
{
locale = LocaleFormat.DEFAULT.getLocale(lang);
- displayNameMD.setLocale(locale);
- displayNameMD.setValue(element.getTextContent());
- localizedStringMD.getValues().add(displayNameMD);
+ displayNameMD.setLang(locale.toString());
+ displayNameMD.setDescription(element.getTextContent());
+ localizedStringMD.put(dummy, displayNameMD);
}
catch (ConversionException e)
{
@@ -183,8 +186,9 @@
supportedLocales.add(new Locale(localeName));
}
+ /*
// Set display name
- if (localizedStringMD.getValues().isEmpty() && (pwa != null))
+ if (localizedStringMD.getLocalizedString(dummy).getValues().isEmpty() && (pwa != null))
{
ResourceBundleManager bundleMgr = MetaDataResourceBundleFactory.createResourceBundleManager(pwa.getClassLoader(), supportedLocales, resourceBundle);
LocalizedString localizedString = bundleMgr.getLocalizedValue("org.jboss.portal.instance.name." + instanceName, instanceName);
@@ -193,19 +197,20 @@
while (localeIt.hasNext())
{
LocalizedString.Value value = (LocalizedString.Value)localeIt.next();
- DisplayNameMetaData displayNameMD = new DisplayNameMetaData();
- displayNameMD.setLocale(value.getLocale());
- displayNameMD.setValue(value.getString());
- localizedStringMD.getValues().add(displayNameMD);
+ LocalizedDescriptionMetaData displayNameMD = new LocalizedDescriptionMetaData();
+ displayNameMD.setLang(value.getLocale().toString());
+ displayNameMD.setDescription(value.getString());
+ localizedStringMD.put(dummy, displayNameMD);
}
}
+ */
// Create the meta data
InstanceMetaData instanceMD = new InstanceMetaData();
instanceMD.setId(instanceName);
instanceMD.setPortletRef(componentRef);
instanceMD.setPreferences(preferencesMD);
- instanceMD.setDisplayName(localizedStringMD);
+ instanceMD.setDisplayName(localizedStringMD.getLocalizedString(dummy));
instanceMD.setResourceBundle(resourceBundle);
instanceMD.setSupportedLocales(supportedLocales);
@@ -267,14 +272,14 @@
instanceMD.setPortletRef(portletRef);
// Configure preferences
- PreferencesMetaData preferencesMD = new PreferencesMetaData();
+ PortletPreferencesMetaData preferencesMD = new PortletPreferencesMetaData();
Element preferencesElt = XMLTools.getUniqueChild(instanceElt, "preferences", false);
if (preferencesElt != null)
{
for (Iterator j = InstanceMetaData.buildPreferencesMetaData(preferencesElt).values().iterator(); j.hasNext();)
{
- PreferenceMetaData preferenceMD = (PreferenceMetaData)j.next();
- preferencesMD.addPreference(preferenceMD);
+ PortletPreferenceMetaData preferenceMD = (PortletPreferenceMetaData)j.next();
+ preferencesMD.addPortletPreference(preferenceMD);
}
}
@@ -302,15 +307,15 @@
for (Iterator i = XMLTools.getChildrenIterator(portletPreferencesElt, "preference"); i.hasNext();)
{
Element preferenceElt = (Element)i.next();
- PreferenceMetaData preference = buildPreferenceMetaData(preferenceElt);
+ PortletPreferenceMetaData preference = buildPreferenceMetaData(preferenceElt);
preferences.put(preference.getName(), preference);
}
return preferences;
}
- public static PreferenceMetaData buildPreferenceMetaData(Element preferenceElt)
+ public static PortletPreferenceMetaData buildPreferenceMetaData(Element preferenceElt)
{
- PreferenceMetaData preferenceMD = new PreferenceMetaData();
+ PortletPreferenceMetaData preferenceMD = new PortletPreferenceMetaData();
List valuesElt = XMLTools.getChildren(preferenceElt, "value");
String[] values = new String[valuesElt.size()];
for (int i = 0; i < valuesElt.size(); i++)
@@ -342,7 +347,7 @@
}
preferenceMD.setName(XMLTools.asString(XMLTools.getUniqueChild(preferenceElt, "name", true)));
preferenceMD.setReadOnly(readOnly);
- preferenceMD.setValues(values);
+ preferenceMD.setValue(Arrays.asList(values));
return preferenceMD;
}
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/metadata/PreferencesMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/metadata/PreferencesMetaData.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/metadata/PreferencesMetaData.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -1,59 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.instance.metadata;
-
-import org.jboss.portal.portlet.impl.jsr168.metadata.PreferenceMetaData;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PreferencesMetaData
-{
-
- private Map map = new HashMap();
-
- public void addPreference(PreferenceMetaData preference)
- {
- map.put(preference.getName(), preference);
- }
-
- public Iterator iterator()
- {
- return map.values().iterator();
- }
-
- public int size()
- {
- return map.size();
- }
-
- public PreferenceMetaData getPreference(String key)
- {
- return (PreferenceMetaData)map.get(key);
- }
-}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -174,7 +174,7 @@
PortletInvocationResponse response = instance.invoke(invocation);
//
- return ControllerResponseFactory.createActionResponse(targetId, (RequestContext)invocation.getContext(), response);
+ return ControllerResponseFactory.createActionResponse(targetId, response);
}
catch (PortletInvokerException e)
{
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalMetaData.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalMetaData.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -29,8 +29,9 @@
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.portlet.impl.jsr168.metadata.ModesMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.WindowStatesMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletModeMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SupportsMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.WindowStateMetaData;
import org.w3c.dom.Element;
import java.util.Iterator;
@@ -43,22 +44,45 @@
public class PortalMetaData extends PortalObjectMetaData
{
- private ModesMetaData modes;
- private WindowStatesMetaData windowStates;
+ private SupportsMetaData supportsMetaData;
public PortalMetaData()
{
- modes = new ModesMetaData();
- modes.add("edit");
- modes.add("view");
- modes.add("help");
- modes.add("admin");
- windowStates = new WindowStatesMetaData();
- windowStates.add("maximized");
- windowStates.add("minimized");
- windowStates.add("normal");
+ supportsMetaData = new SupportsMetaData();
+ PortletModeMetaData mode = new PortletModeMetaData();
+ mode.setPortletMode(Mode.EDIT);
+ supportsMetaData.addPortletMode(mode);
+ mode = new PortletModeMetaData();
+ mode.setPortletMode(Mode.VIEW);
+ supportsMetaData.addPortletMode(mode);
+ mode = new PortletModeMetaData();
+ mode.setPortletMode(Mode.HELP);
+ supportsMetaData.addPortletMode(mode);
+ mode = new PortletModeMetaData();
+ mode.setPortletMode(Mode.ADMIN);
+ supportsMetaData.addPortletMode(mode);
+ mode = new PortletModeMetaData();
+ mode.setPortletMode(Mode.EDIT_DEFAULTS);
+ supportsMetaData.addPortletMode(mode);
+
+
+ WindowStateMetaData windowState = new WindowStateMetaData();
+ windowState.setWindowState(WindowState.MAXIMIZED);
+ supportsMetaData.addWindowState(windowState);
+ windowState = new WindowStateMetaData();
+ windowState.setWindowState(WindowState.MINIMIZED);
+ supportsMetaData.addWindowState(windowState);
+ windowState = new WindowStateMetaData();
+ windowState.setWindowState(WindowState.NORMAL);
+ supportsMetaData.addWindowState(windowState);
}
+ public SupportsMetaData getSupportsMetaData()
+ {
+ return supportsMetaData;
+ }
+
+ /*
public ModesMetaData getModes()
{
return modes;
@@ -78,8 +102,8 @@
{
this.windowStates = windowStates;
}
+*/
-
protected PortalObject newInstance(BuildContext buildContext, PortalObject parent) throws Exception
{
if (!(parent instanceof PortalContainer))
@@ -91,18 +115,16 @@
Portal portal = ((PortalContainer)parent).createPortal(getName());
//
- for (Iterator i = modes.getAll(); i.hasNext();)
+ for (Iterator i = supportsMetaData.getPortletModes().iterator(); i.hasNext();)
{
- String modeName = (String)i.next();
- Mode mode = Mode.create(modeName);
+ Mode mode = ((PortletModeMetaData)i.next()).getPortletMode();
portal.getSupportedModes().add(mode);
}
//
- for (Iterator i = windowStates.getAll(); i.hasNext();)
+ for (Iterator i = supportsMetaData.getWindowStates().iterator(); i.hasNext();)
{
- String windowStateName = (String)i.next();
- WindowState windowState = WindowState.create(windowStateName);
+ WindowState windowState = ((WindowStateMetaData)i.next()).getWindowState();
portal.getSupportedWindowStates().add(windowState);
}
@@ -156,25 +178,27 @@
public static void buildSupportedModes(PortalMetaData portalMD, Element supportedModesElt)
{
- ModesMetaData modesMD = portalMD.getModes();
List modeElts = XMLTools.getChildren(supportedModesElt, "mode");
for (int i = 0; i < modeElts.size(); i++)
{
Element modeElt = (Element)modeElts.get(i);
String modeAsString = XMLTools.asString(modeElt);
- modesMD.add(modeAsString);
+ PortletModeMetaData mode = new PortletModeMetaData();
+ mode.setPortletMode(new Mode(modeAsString));
+ portalMD.getSupportsMetaData().addPortletMode(mode);
}
}
public static void buildSupportedWindowStates(PortalMetaData portalMD, Element supportedWindowStatesElt)
{
- WindowStatesMetaData windowStateMD = portalMD.getWindowStates();
- List windowState = XMLTools.getChildren(supportedWindowStatesElt, "window-state");
- for (int i = 0; i < windowState.size(); i++)
+ List windowStates = XMLTools.getChildren(supportedWindowStatesElt, "window-state");
+ for (int i = 0; i < windowStates.size(); i++)
{
- Element windowStateElt = (Element)windowState.get(i);
+ Element windowStateElt = (Element)windowStates.get(i);
String windowStateAsString = XMLTools.asString(windowStateElt);
- windowStateMD.add(windowStateAsString);
+ WindowStateMetaData windowState = new WindowStateMetaData();
+ windowState.setWindowState(new WindowState(windowStateAsString));
+ portalMD.getSupportsMetaData().addWindowState(windowState);
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/I18nELTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/I18nELTestCase.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/I18nELTestCase.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -26,7 +26,7 @@
import org.jboss.portal.core.servlet.jsp.PortalJsp;
import org.jboss.portal.core.servlet.jsp.taglib.PortalLib;
import org.jboss.portal.portlet.impl.jsr168.PortletResourceBundleFactory;
-import org.jboss.portal.portlet.impl.jsr168.metadata.LanguagesMetaData;
+///import org.jboss.portal.portlet.impl.jsr168.metadata.LanguagesMetaData;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -44,7 +44,7 @@
{
private static final String RESOURCE_BUNDLE_NAME = "MyResourceBundle";
-
+/*
public void test01() throws ServletException, IOException
{
PortalJsp jbossJsp = new PortalJsp()
@@ -78,7 +78,7 @@
jbossJsp.service(requestWrapper, response);
jbossJsp.destroy();
}
-
+*/
private class ResourceClassLoader extends ClassLoader
{
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/I18nOutELTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/I18nOutELTestCase.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/I18nOutELTestCase.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -28,7 +28,7 @@
import org.jboss.portal.core.servlet.jsp.taglib.context.Context;
import org.jboss.portal.core.servlet.jsp.taglib.context.DelegateContext;
import org.jboss.portal.portlet.impl.jsr168.PortletResourceBundleFactory;
-import org.jboss.portal.portlet.impl.jsr168.metadata.LanguagesMetaData;
+//import org.jboss.portal.portlet.impl.jsr168.metadata.LanguagesMetaData;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -46,7 +46,7 @@
{
private static final String RESOURCE_BUNDLE_NAME = "MyResourceBundle";
-
+/*
public void test01() throws ServletException, IOException
{
PortalJsp jbossJsp = new PortalJsp()
@@ -84,7 +84,7 @@
jbossJsp.service(requestWrapper, response);
jbossJsp.destroy();
}
-
+*/
private class ResourceClassLoader extends ClassLoader
{
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/deployment/PortletInstancesMetaDataFactoryTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/deployment/PortletInstancesMetaDataFactoryTestCase.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/deployment/PortletInstancesMetaDataFactoryTestCase.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -31,7 +31,7 @@
import org.jboss.portal.common.xml.XMLTools;
import org.jboss.portal.core.deployment.jboss.PortletAppDeploymentFactory;
import org.jboss.portal.core.model.instance.metadata.InstanceMetaData;
-import org.jboss.portal.portlet.impl.jsr168.info.Utils;
+//import org.jboss.portal.portlet.impl.jsr168.info.Utils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.EntityResolver;
@@ -47,7 +47,6 @@
public class PortletInstancesMetaDataFactoryTestCase extends TestCase
{
-
public void testLocalizedDisplayNameMetadata() throws Exception
{
// Get instances from portlet-instances.xml
@@ -102,7 +101,7 @@
InstanceMetaData instanceMD = (InstanceMetaData)instancesMetadata.get(0);
assertEquals("UserPortletInstance", instanceMD.getId());
- LocalizedString lString = Utils.getLocalizedDescription(instanceMD.getDisplayName());
+ LocalizedString lString = instanceMD.getDisplayName();
assertEquals("Mon instance de User portlet", lString.getString(Locale.FRENCH, false));
assertEquals("My User portlet instance", lString.getString(Locale.ENGLISH, false));
assertEquals("My User portlet instance", lString.getDefaultString());
@@ -114,5 +113,4 @@
assertEquals("PortletContentEditorInstance", instanceMD.getId());
}
-
}
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -1,747 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.core.state;
-
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.log4j.Appender;
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.SimpleLayout;
-import org.jboss.portal.Mode;
-import org.jboss.portal.common.junit.TransactionAssert;
-import org.jboss.portal.common.value.StringValue;
-import org.jboss.portal.core.impl.portlet.state.PersistentPortletState;
-import org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager;
-import org.jboss.portal.core.impl.portlet.state.PersistentRegistration;
-import org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker;
-import org.jboss.portal.portlet.NoSuchPortletException;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.impl.spi.AbstractInstanceContext;
-import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
-import org.jboss.portal.portlet.info.MetaInfo;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.state.AbstractPropertyContext;
-import org.jboss.portal.portlet.state.AccessMode;
-import org.jboss.portal.portlet.state.DestroyCloneFailure;
-import org.jboss.portal.portlet.state.PropertyChange;
-import org.jboss.portal.portlet.state.PropertyContext;
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.state.SimplePropertyMap;
-import org.jboss.portal.portlet.state.producer.PortletState;
-import org.jboss.portal.portlet.state.producer.PortletStateContext;
-import org.jboss.portal.registration.Consumer;
-import org.jboss.portal.registration.ConsumerGroup;
-import org.jboss.portal.registration.Registration;
-import org.jboss.portal.registration.RegistrationLocal;
-import org.jboss.portal.test.core.model.instance.ActionContextImpl;
-import org.jboss.portal.test.core.model.instance.PortletInvokerSupport;
-import org.jboss.portal.test.core.model.instance.PortletSupport;
-import org.jboss.portal.test.core.model.instance.ValueMapAssert;
-import org.jboss.portal.test.framework.TestParametrization;
-import org.jboss.portal.test.framework.embedded.DataSourceSupport;
-import org.jboss.portal.test.framework.embedded.HibernateSupport;
-import org.jboss.portal.test.framework.junit.JUnitAdapter;
-import org.jboss.portal.test.framework.junit.POJOJUnitTest;
-import org.jboss.portal.test.framework.mc.TestRuntimeContext;
-
-import javax.xml.namespace.QName;
-import java.net.URL;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ProducerTestCase extends TestCase
-{
-
- static
- {
- Appender appender = new ConsoleAppender(new SimpleLayout());
- Logger.getRoot().addAppender(appender);
- Logger.getRoot().setLevel(Level.DEBUG);
- Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
- }
-
- public static TestSuite suite() throws Exception
- {
- TestParametrization parametrization = JUnitAdapter.getParametrization();
- URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
- parametrization.setParameterValue("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
- POJOJUnitTest abc = new POJOJUnitTest(ProducerTestCase.class);
- JUnitAdapter adapter = new JUnitAdapter(abc, parametrization);
- TestSuite suite = new TestSuite();
- suite.addTest(adapter);
- return suite;
- }
-
- /** Test parameter whether we test registration or not. */
- private boolean useRegistration;
-
- /** . */
- private TestRuntimeContext runtimeContext;
-
- /** . */
- private DataSourceSupport.Config dataSourceConfigParameter;
-
- /** . */
- private HibernateSupport hibernateSupport;
-
- /** The persistence manager of the producer. */
- private PersistentPortletStatePersistenceManager persistenceManager;
-
- /** The producer. */
- private ProducerPortletInvoker producer;
-
- /** The portlet container. */
- private PortletInvokerSupport portletContainer;
-
- /** The consumer. */
- private PortletInvoker consumer;
-
- /** The registration id created during the setup. */
- private String registrationId;
-
- public String getName()
- {
- return super.getName() + ",ds=" + dataSourceConfigParameter.getName();
- }
-
- public String getUseRegistrationParameter()
- {
- return Boolean.toString(useRegistration);
- }
-
- public void setUseRegistrationParameter(String useRegistrationParameter)
- {
- this.useRegistration = Boolean.valueOf(useRegistrationParameter).booleanValue();
- }
-
- public HibernateSupport getHibernateSupport()
- {
- return hibernateSupport;
- }
-
- public void setHibernateSupport(HibernateSupport hibernateSupport)
- {
- this.hibernateSupport = hibernateSupport;
- }
-
- public PersistentPortletStatePersistenceManager getPersistenceManager()
- {
- return persistenceManager;
- }
-
- public void setPersistenceManager(PersistentPortletStatePersistenceManager persistenceManager)
- {
- this.persistenceManager = persistenceManager;
- }
-
- public ProducerPortletInvoker getProducer()
- {
- return producer;
- }
-
- public void setProducer(ProducerPortletInvoker producer)
- {
- this.producer = producer;
- }
-
- public PortletInvokerSupport getPortletContainer()
- {
- return portletContainer;
- }
-
- public void setPortletContainer(PortletInvokerSupport portletContainer)
- {
- this.portletContainer = portletContainer;
- }
-
- public DataSourceSupport.Config getDataSourceConfigParameter()
- {
- return dataSourceConfigParameter;
- }
-
- public void setDataSourceConfigParameter(DataSourceSupport.Config dataSourceConfigParameter)
- {
- this.dataSourceConfigParameter = dataSourceConfigParameter;
- }
-
- public PortletInvoker getConsumer()
- {
- return consumer;
- }
-
- public void setConsumer(PortletInvoker consumer)
- {
- this.consumer = consumer;
- }
-
- public void setUp() throws Exception
- {
- runtimeContext = new TestRuntimeContext("org/jboss/portal/test/core/state/jboss-beans.xml");
- runtimeContext.addBean("TestBean", this);
- runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
- runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig(dataSourceConfigParameter.getName()));
- runtimeContext.start();
-
- PortletInvokerSupport.InternalPortlet internalSimplePortlet = portletContainer.addInternalPortlet("SimplePortlet", new PortletSupport()
- {
- {
- info.getMetaSupport().setDisplayName("SimplePortlet");
- }
-
- public PortletInvocationResponse invoke(PortletInvocation invocation)
- {
- AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
- props.update(new PropertyChange[]{PropertyChange.newUpdate("_abc", new StringValue("_def"))});
- return null;
- }
- });
- internalSimplePortlet.addPreference("abc", new StringValue("def"));
-
- PortletInvokerSupport.InternalPortlet internalCloningPortlet = portletContainer.addInternalPortlet("CloningPortlet", new PortletSupport()
- {
- public PortletInvocationResponse invoke(PortletInvocation invocation)
- {
- AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
- props.update(new PropertyChange[]{PropertyChange.newUpdate("_abc", new StringValue("_def"))});
- return null;
- }
- });
- internalCloningPortlet.addPreference("abc", new StringValue("def"));
-
- PortletInvokerSupport.InternalPortlet internalCloneFailedCloningPortlet = portletContainer.addInternalPortlet("CloneFailedCloningPortlet", new PortletSupport()
- {
- public PortletInvocationResponse invoke(PortletInvocation invocation)
- {
- try
- {
- AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
- props.update(new PropertyChange[]{PropertyChange.newUpdate("_abc", new StringValue("_def"))});
- fail("Was expecting an IllegalStateException");
- }
- catch (IllegalStateException expected)
- {
- }
- return null;
- }
- });
- internalCloneFailedCloningPortlet.addPreference("abc", new StringValue("def"));
-
- PortletInvokerSupport.InternalPortlet internalCloningPortletThrowingRuntimeException = portletContainer.addInternalPortlet("CloningPortletThrowingRuntimeException", new PortletSupport()
- {
- public PortletInvocationResponse invoke(PortletInvocation invocation)
- {
- AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
- props.update(new PropertyChange[]{PropertyChange.newUpdate("_abc", new StringValue("_def"))});
- throw new RuntimeException("custom_message");
- }
- });
- internalCloningPortletThrowingRuntimeException.addPreference("abc", new StringValue("def"));
-
- // Create registration
- if (useRegistration)
- {
- beginTX();
- ConsumerGroup cg = persistenceManager.createConsumerGroup("CG");
- Consumer consumer = persistenceManager.createConsumer("fooConsumer", "fooConsumer");
- cg.addConsumer(consumer);
- Map registrationProperties = new HashMap();
- registrationProperties.put(new QName("prop1"), "value1");
- registrationProperties.put(new QName("prop2"), "value2");
- Registration reg = persistenceManager.addRegistrationFor("fooConsumer", registrationProperties);
- registrationId = reg.getId();
- commitTX();
- }
- }
-
- public void tearDown() throws Exception
- {
- // Cleanup any pending transaction
- TransactionAssert.endTransaction();
-
- //
- runtimeContext.stop();
- }
-
- public void beginTX()
- {
- TransactionAssert.beginTransaction();
- }
-
- public void beginRegistrationScopedTX()
- {
- TransactionAssert.beginTransaction();
-
- //
- if (useRegistration)
- {
- Registration reg = persistenceManager.getRegistration(registrationId);
- RegistrationLocal.setRegistration(reg);
- }
- }
-
- private void rollbackTX()
- {
- TransactionAssert.rollbackTransaction(true);
-
- //
- if (useRegistration)
- {
- RegistrationLocal.setRegistration(null);
- }
- }
-
- public void commitTX()
- {
- TransactionAssert.commitTransaction();
-
- //
- if (useRegistration)
- {
- RegistrationLocal.setRegistration(null);
- }
- }
-
- public void testCloneExistingPOPWithinTx() throws Exception
- {
- // Clone a POP
- beginRegistrationScopedTX();
- PortletContext cloneCtx = consumer.createClone(PortletContext.createPortletContext("SimplePortlet"));
- commitTX();
-
- // Check the clone state
- beginTX();
- assertTrue(cloneCtx.getId().startsWith("_"));
- PersistentPortletState cloneState = (PersistentPortletState)persistenceManager.loadState(cloneCtx.getId().substring(1));
- assertNotNull(cloneState);
- assertEquals(cloneCtx.getId(), "_" + cloneState.getId());
- assertEquals("SimplePortlet", cloneState.getState().getPortletId());
- PropertyMap cloneValues = cloneState.getState().getProperties();
- assertNotNull(cloneValues);
- assertNotNull(cloneValues.keySet());
- assertEquals(1, cloneValues.keySet().size());
- assertEquals(new StringValue("def"), cloneValues.getProperty("abc"));
- if (useRegistration)
- {
- PersistentRegistration registration = cloneState.getRelatedRegistration();
- assertNotNull(registration);
- assertEquals(registrationId, registration.getId());
- }
- commitTX();
- }
-
- public void testCloneExistingCCPWithinTx() throws Exception
- {
- // Clone a POP
- beginTX();
- PortletContext cloneCtx = consumer.createClone(PortletContext.createPortletContext("SimplePortlet"));
- commitTX();
-
- // Update CCP state directly
- beginTX();
- PropertyMap cloneValues = consumer.getProperties(cloneCtx);
- PropertyMap newCloneValues = new SimplePropertyMap(cloneValues);
- newCloneValues.setProperty("abc", new StringValue("fed"));
- persistenceManager.updateState(cloneCtx.getId().substring(1), newCloneValues);
- commitTX();
-
- // Clone the modified CCP
- beginRegistrationScopedTX();
- PortletContext cloneCloneCtx = consumer.createClone(cloneCtx);
- commitTX();
-
- // Check the clone clone state
- beginTX();
- assertTrue(cloneCloneCtx.getId().startsWith("_"));
- PersistentPortletState cloneCloneState = (PersistentPortletState)persistenceManager.loadState(cloneCloneCtx.getId().substring(1));
- assertNotNull(cloneCloneState);
- assertEquals(cloneCloneCtx.getId(), "_" + cloneCloneState.getId());
- assertEquals("SimplePortlet", cloneCloneState.getState().getPortletId());
- PropertyMap cloneCloneValues = cloneCloneState.getState().getProperties();
- assertNotNull(cloneCloneValues);
- assertNotNull(cloneCloneValues.keySet());
- assertEquals(1, cloneCloneValues.keySet().size());
- assertEquals(new StringValue("fed"), cloneCloneValues.getProperty("abc"));
- if (useRegistration)
- {
- PersistentRegistration registration = cloneCloneState.getRelatedRegistration();
- assertNotNull(registration);
- assertEquals(registrationId, registration.getId());
- }
- commitTX();
- }
-
- public void testCloneNullPortletWithinTx() throws Exception
- {
- try
- {
- beginRegistrationScopedTX();
- consumer.createClone(null);
- fail("Was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
- rollbackTX();
- }
- }
-
- public void testDestroyNonExistingPortletWithinTx() throws Exception
- {
- beginRegistrationScopedTX();
- List failures = consumer.destroyClones(Collections.singletonList(PortletContext.createPortletContext("_1")));
- assertEquals(Collections.singletonList(new DestroyCloneFailure("_1")), failures);
- commitTX();
- }
-
- public void testDestroyNullPortletWithinTx() throws Exception
- {
- try
- {
- beginRegistrationScopedTX();
- consumer.destroyClones(null);
- fail("Was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
- rollbackTX();
- }
- }
-
-/*
- public void _testDestroyInvalidPortletWithinTx() throws Exception
- {
- try
- {
- TransactionAssert.beginTransaction();
- statefulPortletInvoker.destroyClone("_invalid");
- fail("Was expecting an InvalidPortletIdException");
- }
- catch (InvalidPortletIdException expected)
- {
- TransactionAssert.rollbackTransaction(true);
- }
- }
-*/
-
- public void testDestroyCCPWithinTx() throws Exception
- {
- // Clone a POP 2 times
- beginTX();
- PortletContext clone1 = consumer.createClone(PortletContext.createPortletContext("SimplePortlet"));
- PortletContext clone2 = consumer.createClone(PortletContext.createPortletContext("SimplePortlet"));
- commitTX();
-
- // Clone the modified CCP 2 times
- beginTX();
- PortletContext cloneOfClone1 = consumer.createClone(clone1);
- PortletContext cloneOfClone2 = consumer.createClone(clone1);
- commitTX();
-
- // Destroy the clone 2
- beginTX();
- List failures = consumer.destroyClones(Collections.singletonList(clone2));
- assertEquals(Collections.EMPTY_LIST, failures);
- commitTX();
-
- // Destroy the clone of the clone 2
- beginTX();
- failures = consumer.destroyClones(Collections.singletonList(cloneOfClone2));
- assertEquals(Collections.EMPTY_LIST, failures);
- commitTX();
-
- // Destroy the clone 1
- beginTX();
- failures = consumer.destroyClones(Collections.singletonList(clone1));
- assertEquals(Collections.EMPTY_LIST, failures);
- commitTX();
-
- // Destroy the clone of the clone 1
- beginTX();
- failures = consumer.destroyClones(Collections.singletonList(cloneOfClone1));
- assertEquals(Collections.EMPTY_LIST, failures);
- commitTX();
- }
-
- public void testInvokeCloneBeforeWritePOPWithinTx() throws Exception
- {
- beginRegistrationScopedTX();
- PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
- action.setTarget(PortletContext.createPortletContext("CloningPortlet"));
- action.setUserContext(new AbstractUserContext("julien"));
- AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.CLONE_BEFORE_WRITE);
- action.setInstanceContext(instanceContext);
- consumer.invoke(action);
- commitTX();
-
- // Check state
- beginTX();
- PortletContext clone = instanceContext.getClonedContext();
- assertNotNull(clone);
- PersistentPortletState cloneState = (PersistentPortletState)persistenceManager.loadState(clone.getId().substring(1));
- assertNotNull(cloneState);
- assertEquals(clone.getId().substring(1), cloneState.getId());
- assertEquals("CloningPortlet", cloneState.getState().getPortletId());
- SimplePropertyMap expectedValue = new SimplePropertyMap();
- expectedValue.setProperty("abc", new StringValue("def"));
- expectedValue.setProperty("_abc", new StringValue("_def"));
- ValueMapAssert.assertEquals(expectedValue, cloneState.getState().getProperties());
- if (useRegistration)
- {
- PersistentRegistration registration = cloneState.getRelatedRegistration();
- assertNotNull(registration);
- assertEquals(registrationId, registration.getId());
- }
- commitTX();
- }
-
- public void testInvokeReadWritePOPWithinTx() throws Exception
- {
- beginRegistrationScopedTX();
- PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
- action.setTarget(PortletContext.createPortletContext("CloneFailedCloningPortlet"));
- action.setUserContext(new AbstractUserContext("julien"));
- AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.READ_WRITE);
- action.setInstanceContext(instanceContext);
- consumer.invoke(action);
- commitTX();
-
- // Check state
- beginTX();
- assertNull(instanceContext.getClonedContext());
- assertNull(instanceContext.getModifiedContext());
- commitTX();
- }
-
- public void testInvokeReadOnlyPOPWithinTx() throws Exception
- {
- beginRegistrationScopedTX();
- PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
- action.setTarget(PortletContext.createPortletContext("CloneFailedCloningPortlet"));
- action.setUserContext(new AbstractUserContext("julien"));
- AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.READ_ONLY);
- action.setInstanceContext(instanceContext);
- consumer.invoke(action);
- commitTX();
-
- // Check state
- beginTX();
- assertNull(instanceContext.getClonedContext());
- assertNull(instanceContext.getModifiedContext());
- commitTX();
- }
-
- public void testInvokeCloneBeforeWriteCCPWithinTx() throws Exception
- {
- beginTX();
- PortletContext cloningPortletId = consumer.createClone(PortletContext.createPortletContext("CloningPortlet"));
- commitTX();
-
- // Modify the state of the CCP
- beginTX();
- PortletState cloningPortletState = persistenceManager.loadState(cloningPortletId.getId().substring(1)).getState();
- SimplePropertyMap newCloningPortletStateValue = new SimplePropertyMap(cloningPortletState.getProperties());
- newCloningPortletStateValue.setProperty("abc", new StringValue("deff"));
- persistenceManager.updateState(cloningPortletId.getId().substring(1), newCloningPortletStateValue);
- commitTX();
-
- //
- beginRegistrationScopedTX();
- PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
- action.setTarget(cloningPortletId);
- action.setUserContext(new AbstractUserContext("julien"));
- AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.CLONE_BEFORE_WRITE);
- action.setInstanceContext(instanceContext);
- consumer.invoke(action);
- commitTX();
-
- // Check state
- beginTX();
- PortletContext clone = instanceContext.getClonedContext();
- assertNotNull(clone);
- PersistentPortletState cloneState = (PersistentPortletState)persistenceManager.loadState(clone.getId().substring(1));
- assertNotNull(cloneState);
- assertEquals(clone.getId().substring(1), cloneState.getId());
- assertEquals("CloningPortlet", cloneState.getState().getPortletId());
- SimplePropertyMap expectedValue = new SimplePropertyMap();
- expectedValue.setProperty("abc", new StringValue("deff"));
- expectedValue.setProperty("_abc", new StringValue("_def"));
- ValueMapAssert.assertEquals(expectedValue, cloneState.getState().getProperties());
- if (useRegistration)
- {
- PersistentRegistration registration = cloneState.getRelatedRegistration();
- assertNotNull(registration);
- assertEquals(registrationId, registration.getId());
- }
- commitTX();
- }
-
- public void testInvokeReadWriteCCPWithinTx() throws Exception
- {
- beginTX();
- PortletContext cloningPortletId = consumer.createClone(PortletContext.createPortletContext("CloningPortlet"));
- commitTX();
-
- //
- beginRegistrationScopedTX();
- PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
- action.setTarget(cloningPortletId);
- action.setUserContext(new AbstractUserContext("julien"));
- AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.READ_WRITE);
- action.setInstanceContext(instanceContext);
- consumer.invoke(action);
- commitTX();
-
- // Check state
- beginTX();
- assertNull(instanceContext.getClonedContext());
- PortletStateContext state = persistenceManager.loadState(cloningPortletId.getId().substring(1));
- assertNotNull(state);
- assertEquals("CloningPortlet", state.getState().getPortletId());
- assertEquals(cloningPortletId.getId().substring(1), state.getId());
- SimplePropertyMap expectedValue = new SimplePropertyMap();
- expectedValue.setProperty("abc", new StringValue("def"));
- expectedValue.setProperty("_abc", new StringValue("_def"));
- ValueMapAssert.assertEquals(expectedValue, state.getState().getProperties());
- commitTX();
- }
-
- public void testInvokeReadOnlyCCPWithinTx() throws Exception
- {
- beginTX();
- PortletContext cloneFailedCloningPortletId = consumer.createClone(PortletContext.createPortletContext("CloneFailedCloningPortlet"));
- commitTX();
-
- //
- beginRegistrationScopedTX();
- PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
- action.setTarget(cloneFailedCloningPortletId);
- action.setUserContext(new AbstractUserContext("julien"));
- AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.READ_ONLY);
- action.setInstanceContext(instanceContext);
- consumer.invoke(action);
- commitTX();
-
- // Check state
- beginTX();
- assertNull(instanceContext.getClonedContext());
- commitTX();
- }
-
- public void testInvokeCloneBeforeWritePOPWithinTxThrowsException() throws Exception
- {
- beginRegistrationScopedTX();
- PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
- action.setTarget(PortletContext.createPortletContext("CloningPortletThrowingRuntimeException"));
- action.setUserContext(new AbstractUserContext("julien"));
- AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.CLONE_BEFORE_WRITE);
- action.setInstanceContext(instanceContext);
- try
- {
- consumer.invoke(action);
- fail("Was expecting RuntimeException");
- }
- catch (RuntimeException expected)
- {
- assertEquals("custom_message", expected.getMessage());
- rollbackTX();
- }
-
- // Check state
- beginTX();
- assertNull(instanceContext.getClonedContext());
- commitTX();
- }
-
- public void _testGetProperties()
- {
-
- }
-
- /** todo : should check the portlet metadata as well */
- public void testGetCCP() throws Exception
- {
- // Clone a POP
- beginTX();
- PortletContext cloneContext = consumer.createClone(PortletContext.createPortletContext("SimplePortlet"));
- commitTX();
-
- //
- beginTX();
- Portlet portlet = consumer.getPortlet(cloneContext);
- assertEquals(cloneContext, portlet.getContext());
- assertEquals("SimplePortlet", portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME).getDefaultString());
- commitTX();
-
- // Clone the modified CCP
- beginTX();
- PortletContext cloneCloneContext = consumer.createClone(cloneContext);
- commitTX();
-
- //
- beginTX();
- portlet = consumer.getPortlet(cloneCloneContext);
- assertEquals(cloneCloneContext, portlet.getContext());
- assertEquals("SimplePortlet", portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME).getDefaultString());
- commitTX();
- }
-
- public void _testCloneNonExistingPortletWithinTx() throws Exception
- {
- try
- {
- beginTX();
- consumer.createClone(PortletContext.createPortletContext("UnknownPortlet"));
- fail("Was expecting no such portlet exception");
- }
- catch (NoSuchPortletException e)
- {
- rollbackTX();
- }
-
- // todo check state
-
-// try
-// {
-// TransactionAssert.beginTransaction();
-// statefulPortletInvoker.createClone("_1");
-// fail("Was expecting no such portlet exception");
-// }
-// catch (NoSuchPortletException e)
-// {
-// TransactionAssert.rollbackTransaction(true);
-// }
-
- // todo check state
- }
-}
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossAPIFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossAPIFactory.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossAPIFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -1,58 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portlet;
-
-import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
-import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class JBossAPIFactory implements PortletAPIFactory
-{
- public ActionRequestImpl createActionRequest(ActionInvocation invocation)
- {
- return new JBossActionRequest(invocation);
- }
-
- public ActionResponseImpl createActionResponse(ActionInvocation invocation, ActionRequestImpl actionRequest)
- {
- return new JBossActionResponse(invocation, actionRequest);
- }
-
- public RenderRequestImpl createRenderRequest(RenderInvocation invocation)
- {
- return new JBossRenderRequest(invocation);
- }
-
- public RenderResponseImpl createRenderResponse(RenderInvocation invocation, RenderRequestImpl renderRequest)
- {
- return new JBossRenderResponse(invocation, renderRequest);
- }
-}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionRequest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionRequest.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionRequest.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -22,38 +22,48 @@
******************************************************************************/
package org.jboss.portlet;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.filter.PortletRequestWrapper;
+
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.core.aspects.controller.node.Navigation;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.portlet.ControllerUserContext;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
import org.jboss.portal.identity.User;
-import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portlet.util.Parameters;
-import javax.portlet.PortletPreferences;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class JBossActionRequest extends ActionRequestImpl
+public class JBossActionRequest
+ extends PortletRequestWrapper implements ActionRequest
{
/** The parameters. */
private Parameters blah;
+
+ private ActionRequest portletRequest;
/** . */
private ControllerContext controllerContext;
- public JBossActionRequest(ActionInvocation invocation)
+ private UserContext userContext;
+
+ public JBossActionRequest(ActionRequest portletRequest)
{
- super(invocation);
-
- //
- this.controllerContext = (ControllerContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, "controller_context");
+ super(portletRequest);
+ this.portletRequest = portletRequest;
+ this.controllerContext = PortletInvocationFactory.controllerContextTL.get();
this.blah = null;
+ this.userContext = PortletInvocationFactory.userContextTL.get();
}
public ControllerContext getControllerContext()
@@ -92,20 +102,39 @@
return blah;
}
- protected PortletPreferences createPreferences()
+ public String getCharacterEncoding()
{
- // Component container = instance.getComponent();
- // ProxyPreferenceSetPlugin plugin = (ProxyPreferenceSetPlugin)container.getPlugin("PROXY");
- // if (plugin != null)
- // {
-// PreferencesValidator validator = container.getPreferencesValidator();
-// ProxyInfo proxyCtor = container.getPreferenceProxyConstructor();
-// return new JBossPortletPreferences(
-// propertySets,
-// validator,
-// PortletPreferencesImpl.RENDER,
-// proxyCtor);
- // }
- return null;
+ return portletRequest.getCharacterEncoding();
}
+
+ public int getContentLength()
+ {
+ return portletRequest.getContentLength();
+ }
+
+ public String getContentType()
+ {
+ return portletRequest.getContentType();
+ }
+
+ public String getMethod()
+ {
+ return portletRequest.getMethod();
+ }
+
+ public InputStream getPortletInputStream() throws IOException
+ {
+ return portletRequest.getPortletInputStream();
+ }
+
+ public BufferedReader getReader() throws UnsupportedEncodingException, IOException
+ {
+ return portletRequest.getReader();
+ }
+
+ public void setCharacterEncoding(String arg0) throws UnsupportedEncodingException
+ {
+ portletRequest.setCharacterEncoding(arg0);
+ }
+
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -22,69 +22,38 @@
******************************************************************************/
package org.jboss.portlet;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Map;
+
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
+import javax.portlet.filter.PortletResponseWrapper;
+import javax.xml.namespace.QName;
+
import org.jboss.portal.api.PortalRuntimeContext;
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
-import org.jboss.portal.common.net.URLTools;
+import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.core.aspects.controller.node.Navigation;
-import org.jboss.portal.core.controller.portlet.SignOutResponse;
-import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import javax.portlet.PortletRequest;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class JBossActionResponse extends ActionResponseImpl
+public class JBossActionResponse extends PortletResponseWrapper implements ActionResponse
{
+ private ActionResponse portletResponse;
- public JBossActionResponse(ActionInvocation invocation, PortletRequestImpl preq)
+ public JBossActionResponse(ActionResponse portletResponse)
{
- super(invocation, preq);
+ super(portletResponse);
+ this.portletResponse = portletResponse;
}
-// /**
-// * The component wants the user to be authenticated to perform the task.
-// * After this has been called all subsequent actions should not be
-// * possible (getWriter()/sendRedirect()/etc...).
-// *
-// * @throws IllegalStateException
-// */
-// public void sendAuthenticate() throws IllegalStateException
-// {
-///*
-// if (result instanceof NoResult || result instanceof AuthenticateResult)
-// {
-// if (result instanceof NoResult)
-// {
-// ServerURL url = PortletUtils.createWindowActionURL(resp, window);
-// result = new AuthenticateResult(portletWindowContext, url);
-// }
-// }
-// else
-// {
-// throw new IllegalStateException("Cannot call send authenticate");
-// }
-//*/
-// }
-
-// public void sendBytes(String contentType, byte[] bytes)
-// {
-///*
-// if (result instanceof NoResult)
-// {
-// result = new StreamResult(portletWindowContext, contentType, bytes);
-// }
-// else
-// {
-// throw new IllegalStateException("Cannot call send bytes");
-// }
-//*/
-// }
-
public PortalNodeURL createActionURL(PortalNode node) throws IllegalArgumentException, IllegalStateException
{
PortalRuntimeContext context = Navigation.getPortalRuntimeContext();
@@ -113,6 +82,71 @@
return node.createURL(context);
}
+ public void sendRedirect(String arg0) throws IOException
+ {
+ portletResponse.sendRedirect(arg0);
+ }
+
+ public void sendRedirect(String arg0, String arg1) throws IOException
+ {
+ portletResponse.sendRedirect(arg0, arg1);
+ }
+
+ public PortletMode getPortletMode()
+ {
+ return portletResponse.getPortletMode();
+ }
+
+ public Map<String, String[]> getRenderParameterMap()
+ {
+ return portletResponse.getRenderParameterMap();
+ }
+
+ public WindowState getWindowState()
+ {
+ return portletResponse.getWindowState();
+ }
+
+ public void removePublicRenderParameter(String arg0)
+ {
+ portletResponse.removePublicRenderParameter(arg0);
+ }
+
+ public void setEvent(QName arg0, Serializable arg1)
+ {
+ portletResponse.setEvent(arg0, arg1);
+ }
+
+ public void setEvent(String arg0, Serializable arg1)
+ {
+ portletResponse.setEvent(arg0, arg1);
+ }
+
+ public void setPortletMode(PortletMode arg0) throws PortletModeException
+ {
+ portletResponse.setPortletMode(arg0);
+ }
+
+ public void setRenderParameter(String arg0, String arg1)
+ {
+ portletResponse.setRenderParameter(arg0, arg1);
+ }
+
+ public void setRenderParameter(String arg0, String[] arg1)
+ {
+ portletResponse.setRenderParameter(arg0, arg1);
+ }
+
+ public void setRenderParameters(Map<String, String[]> arg0)
+ {
+ portletResponse.setRenderParameters(arg0);
+ }
+
+ public void setWindowState(WindowState arg0) throws WindowStateException
+ {
+ portletResponse.setWindowState(arg0);
+ }
+
/**
* Perform a programmatic sign out.
*
@@ -120,13 +154,23 @@
*/
public void signOut() throws IllegalStateException
{
+ setEvent(new QName("http://www.jboss.com/portal", "signOut"), null);
+/*
if (!PortletRequest.FORM_AUTH.equals(preq.getAuthType()))
{
throw new IllegalStateException("Cannot perform programmatic signout");
}
- sendRedirect(new SignOutResponse());
+ try
+ {
+ sendRedirect(null);
+ }
+ catch (IOException e)
+ {
+ throw new IllegalStateException("Cannot perform programmatic signout");
+ }
+ */
}
-
+
/**
* Perform a programmatic sign out and navigate to the URL specified by the location parameter.
*
@@ -136,6 +180,10 @@
*/
public void signOut(String location) throws IllegalStateException
{
+ setEvent(new QName("http://www.jboss.com/portal", "signOut"), location);
+
+// throw new NotYetImplemented();
+ /*
if (!PortletRequest.FORM_AUTH.equals(preq.getAuthType()))
{
throw new IllegalStateException("Cannot perform programmatic signout");
@@ -145,6 +193,15 @@
throw new IllegalArgumentException("Null location is not accepted");
}
URLTools.enforceAbsoluteURL(location);
- sendRedirect(new SignOutResponse(location));
+ try
+ {
+ sendRedirect(location);
+ }
+ catch (IOException e)
+ {
+ throw new IllegalStateException("Cannot perform programmatic signout");
+ }
+ */
}
+
}
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossPortletPreferences.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossPortletPreferences.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossPortletPreferences.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -1,238 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portlet;
-
-import org.jboss.portal.common.util.ProxyInfo;
-import org.jboss.portal.portlet.impl.jsr168.api.PortletPreferencesImpl;
-import org.jboss.portal.portlet.impl.jsr168.info.ContainerPreferencesInfo;
-import org.jboss.portal.portlet.state.PropertyContext;
-
-import javax.portlet.PreferencesValidator;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class JBossPortletPreferences
- extends PortletPreferencesImpl
- implements InvocationHandler
-{
-
- private ProxyInfo proxyInfo;
-
- public JBossPortletPreferences(
- PropertyContext manager,
- ContainerPreferencesInfo containerPrefs,
- PreferencesValidator validator,
- int mode,
- ProxyInfo proxyInfo)
- {
- super(manager, containerPrefs, validator, mode);
- this.proxyInfo = proxyInfo;
- }
-
- public Object getProxy()
- {
- if (proxy == null)
- {
- if (proxyInfo != null)
- {
- try
- {
- proxy = proxyInfo.instantiate(this);
- }
- catch (InstantiationException e)
- {
- log.error("Cannot instantiate proxy", e);
- }
- catch (IllegalAccessException e)
- {
- log.error("Cannot instantiate proxy", e);
- }
- catch (InvocationTargetException e)
- {
- log.error("Cannot instantiate proxy", e);
- }
- }
- }
- return proxy;
- }
-
- private Object proxy;
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
-/*
- // First handle the Object methods
- if (proxyInfo.getToString().equals(method))
- {
- return "proxy";
- }
- else if (proxyInfo.getHashCode().equals(method))
- {
- return new Integer(System.identityHashCode(proxy));
- }
- else if (proxyInfo.getEquals().equals(method))
- {
- return Boolean.valueOf(proxy == args[0]);
- }
-
- // The preference name
- String key = method.getName().substring(3);
-
- if (method.getName().startsWith("get"))
- {
- // Get return type
- Class returnType = method.getReturnType();
-
- Preference preference = strategy.getPreference(sets1, key);
- if (preference != null)
- {
- Value value = preference.getValue();
- if (String.class.equals(returnType))
- {
- return value.asString();
- }
- else if (String[].class.equals(returnType))
- {
- return value.asStringArray();
- }
- else if (int[].class.equals(returnType))
- {
- try
- {
- return value.asIntArray();
- }
- catch (ConversionException e)
- {
- return args[0];
- }
- }
- else if (boolean[].class.equals(returnType))
- {
- try
- {
- return value.asBooleanArray();
- }
- catch (ConversionException e)
- {
- return args[0];
- }
- }
- else if (returnType.isPrimitive())
- {
- try
- {
- if (boolean.class.equals(returnType))
- {
- return Boolean.valueOf(value.asBoolean());
- }
- else if (boolean[].class.equals(returnType))
- {
- return value.asBooleanArray();
- }
- else if (int.class.equals(returnType))
- {
- return new Integer(value.asInt());
- }
- else if (int[].class.equals(returnType))
- {
- return value.asIntArray();
- }
- else
- {
- return args[0];
- }
- }
- catch (ConversionException e)
- {
- return args[0];
- }
- }
- else
- {
- return args[0];
- }
- }
- else
-
- {
- // Return the default argument
- return args[0];
- }
- }
- else
- {
- // this is a set
- Class clazz = method.getParameterTypes()[0];
-
- // The value
- Value value = null;
-
- // If it is not null
- if (args[0] != null)
- {
- // Get the value from the invocation
- if (String.class.equals(clazz))
- {
- value = new StringValues((String)args[0]);
- }
- else if (String[].class.equals(clazz))
- {
- value = new StringValues((String[])args[0]);
- }
- else if (int.class.equals(clazz))
- {
- value = new IntegerValues((Integer)args[0]);
- }
- else if (int[].class.equals(clazz))
- {
- value = new IntegerValues((int[])args[0]);
- }
- else if (boolean.class.equals(clazz))
- {
- value = new BooleanValues((Boolean)args[0]);
- }
- else if (boolean[].class.equals(clazz))
- {
- value = new BooleanValues((boolean[])args[0]);
- }
- else
- {
- throw new IllegalArgumentException("bad type");
- }
- }
-
- // Finally set the property
- updates.put(key, new Update(value));
-
- // This is a setter we don't care what we return
- return null;
- }
-*/
- throw new Error();
- }
-}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderRequest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderRequest.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderRequest.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -22,25 +22,27 @@
******************************************************************************/
package org.jboss.portlet;
+import java.util.Map;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.filter.PortletRequestWrapper;
+
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.core.aspects.controller.node.Navigation;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.portlet.ControllerUserContext;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
import org.jboss.portal.identity.User;
import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portlet.util.Parameters;
-import javax.portlet.PortletPreferences;
-import java.util.Map;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet </a>
* @version $Revision$
*/
public class JBossRenderRequest
- extends RenderRequestImpl
+ extends PortletRequestWrapper implements RenderRequest
{
/** The parameters. */
@@ -48,13 +50,17 @@
/** . */
private ControllerContext controllerContext;
+
+ private RenderRequestImpl portletRequest;
+
+ private UserContext userContext;
- public JBossRenderRequest(RenderInvocation invocation)
+ public JBossRenderRequest(RenderRequestImpl portletRequest)
{
- super(invocation);
-
- //
- this.controllerContext = (ControllerContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, "controller_context");
+ super(portletRequest);
+ this.portletRequest = portletRequest;
+ this.controllerContext = PortletInvocationFactory.controllerContextTL.get();
+ this.userContext = PortletInvocationFactory.userContextTL.get();
}
public ControllerContext getControllerContext()
@@ -66,21 +72,13 @@
return controllerContext;
}
-// protected PortletPreferences createPreferences()
-// {
-// CorePortletContainer container = (CorePortletContainer) portletInstance.getPortletContainer();
-// PreferencesValidator validator = container.getPreferencesValidator();
-// ProxyInfo proxyCtor = container.getPreferenceProxyConstructor();
-// return new JBossPortletPreferences(propertySets, validator, PortletPreferencesImpl.RENDER, proxyCtor);
-// }
-
public PortalNode getPortalNode()
{
return Navigation.getCurrentNode();
}
/** Returns a modifiable map of user informations or null if the user is not authenticated. */
- public Map getInformations()
+ public Map<String, String> getInformations()
{
return userContext.getInformations();
}
@@ -107,25 +105,9 @@
return blah;
}
- protected PortletPreferences createPreferences()
+ public String getETag()
{
- // Component container = instance.getComponent();
- // ProxyPreferenceSetPlugin plugin = (ProxyPreferenceSetPlugin)container.getPlugin("PROXY");
- // if (plugin != null)
- // {
-// PreferencesValidator validator = container.getPreferencesValidator();
-// ProxyInfo proxyCtor = container.getPreferenceProxyConstructor();
-// return new JBossPortletPreferences(
-// propertySets,
-// validator,
-// PortletPreferencesImpl.RENDER,
-// proxyCtor);
- // }
- return null;
+ return portletRequest.getETag();
}
-// public PortalTheme getTheme()
-// {
-// return (PortalTheme)invocation.getDispatchedRequest().getAttribute(ThemeConstants.ATTR_THEME);
-// }
}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderResponse.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderResponse.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderResponse.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -22,27 +22,41 @@
******************************************************************************/
package org.jboss.portlet;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Locale;
+
+import javax.portlet.CacheControl;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceURL;
+import javax.portlet.filter.PortletResponseWrapper;
+
import org.jboss.portal.api.PortalRuntimeContext;
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
import org.jboss.portal.core.aspects.controller.node.Navigation;
import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class JBossRenderResponse extends RenderResponseImpl
+public class JBossRenderResponse extends PortletResponseWrapper implements RenderResponse
{
+ private RenderResponseImpl portletResponse;
- public JBossRenderResponse(RenderInvocation invocation, PortletRequestImpl preq)
+ public JBossRenderResponse(RenderResponseImpl portletResponse, RenderInvocation invocation, PortletRequestImpl preq)
{
- super(invocation, preq);
- }
-
+ super(portletResponse);
+ this.portletResponse = portletResponse;
+ }
+
public PortalNodeURL createActionURL(PortalNode node) throws IllegalArgumentException, IllegalStateException
{
PortalRuntimeContext context = Navigation.getPortalRuntimeContext();
@@ -70,10 +84,94 @@
//
return node.createURL(context);
}
+
+ public void setContentType(String arg0)
+ {
+ portletResponse.setContentType(arg0);
+ }
- /** @deprecated */
- public PortletInvocation getInvocation()
+ public void setNextPossiblePortletModes(Collection<PortletMode> arg0)
{
- return invocation;
+ portletResponse.setNextPossiblePortletModes(arg0);
}
+
+ public void setTitle(String arg0)
+ {
+ portletResponse.setTitle(arg0);
+ }
+
+ public PortletURL createActionURL()
+ {
+ return portletResponse.createActionURL();
+ }
+
+ public PortletURL createRenderURL()
+ {
+ return portletResponse.createRenderURL();
+ }
+
+ public ResourceURL createResourceURL()
+ {
+ return portletResponse.createResourceURL();
+ }
+
+ public void flushBuffer() throws IOException
+ {
+ portletResponse.flushBuffer();
+ }
+
+ public int getBufferSize()
+ {
+ return portletResponse.getBufferSize();
+ }
+
+ public CacheControl getCacheControl()
+ {
+ return portletResponse.getCacheControl();
+ }
+
+ public String getCharacterEncoding()
+ {
+ return portletResponse.getCharacterEncoding();
+ }
+
+ public String getContentType()
+ {
+ return portletResponse.getContentType();
+ }
+
+ public Locale getLocale()
+ {
+ return portletResponse.getLocale();
+ }
+
+ public OutputStream getPortletOutputStream() throws IOException
+ {
+ return portletResponse.getPortletOutputStream();
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ return portletResponse.getWriter();
+ }
+
+ public boolean isCommitted()
+ {
+ return portletResponse.isCommitted();
+ }
+
+ public void reset()
+ {
+ portletResponse.reset();
+ }
+
+ public void resetBuffer()
+ {
+ portletResponse.resetBuffer();
+ }
+
+ public void setBufferSize(int arg0)
+ {
+ portletResponse.setBufferSize(arg0);
+ }
}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/JBossPortletFilter.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/JBossPortletFilter.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/JBossPortletFilter.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * 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.portlet.filter;
+
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.filter.FilterConfig;
+import javax.portlet.filter.PortletFilter;
+import javax.portlet.filter.RenderFilter;
+
+import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
+import org.jboss.portlet.JBossActionRequest;
+import org.jboss.portlet.JBossActionResponse;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class JBossPortletFilter implements ActionFilter, RenderFilter, PortletFilter
+{
+
+ public void doFilter(ActionRequest request, ActionResponse response, FilterChain filterChain) throws IOException, PortletException
+ {
+ JBossActionRequest actionRequest = new JBossActionRequest(request);
+ JBossActionResponse actionResponse = new JBossActionResponse(response);
+
+ filterChain.doFilter(actionRequest, actionResponse);
+ }
+
+ public void destroy()
+ {
+ // FIXME destroy
+
+ }
+
+ public void init(FilterConfig arg0) throws PortletException
+ {
+ // FIXME init
+
+ }
+
+ public void doFilter(RenderRequest request, RenderResponse response, FilterChain filterChain) throws IOException, PortletException
+ {
+ filterChain.doFilter(request, response);
+ }
+
+}
+
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2008-03-06 11:10:42 UTC (rev 10228)
@@ -359,20 +359,6 @@
<xmbean/>
</mbean>
<mbean
- code="org.jboss.portal.portlet.aspects.portlet.WindowStatesInterceptor"
- name="portal:service=Interceptor,type=Portlet,name=WindowStates"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- </mbean>
- <mbean
- code="org.jboss.portal.portlet.aspects.portlet.ModesInterceptor"
- name="portal:service=Interceptor,type=Portlet,name=Modes"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- </mbean>
- <mbean
code="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor"
name="portal:service=Interceptor,type=Portlet,name=ProducerCache"
xmbean-dd=""
@@ -401,6 +387,13 @@
<xmbean/>
</mbean>
<mbean
+ code="org.jboss.portal.core.aspects.portlet.SignOutInterceptor"
+ name="portal:service=Interceptor,type=Portlet,name=SignOut"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
name="portal:service=InterceptorStackFactory,type=Producer"
xmbean-dd=""
@@ -412,10 +405,9 @@
<depends-list-element>portal:service=Interceptor,type=Portlet,name=ContextDispatcher</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=ContextTracker</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=PortletSessionSynchronization</depends-list-element>
- <depends-list-element>portal:service=Interceptor,type=Portlet,name=WindowStates</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Bridge</depends-list-element>
- <depends-list-element>portal:service=Interceptor,type=Portlet,name=Modes</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Ajax</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Portlet,name=SignOut</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=ProducerCache</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Header</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Transaction</depends-list-element>
@@ -687,14 +679,19 @@
-->
<!-- Registries -->
- <mbean
- code="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"
+
+ <!-- mbean
+ code="org.jboss.portal.portlet.deployment.jboss.PortletApplicationDeployer"
name="portal:service=WebAppRegistry"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- </mbean>
-
+ <depends
+ optional-attribute-name="ServletContainerFactory"
+ proxy-type="attribute">portal:service=ServletContainerFactory</depends>
+
+ </mbean-->
+
<!-- Listener registry -->
<mbean
code="org.jboss.portal.core.event.PortalEventListenerRegistryImpl"
@@ -1044,9 +1041,6 @@
<depends
optional-attribute-name="StackFactory"
proxy-type="attribute">portal:service=InterceptorStackFactory,type=Producer</depends>
- <depends
- optional-attribute-name="Registry"
- proxy-type="attribute">portal:service=WebAppRegistry</depends>
</mbean>
<!-- The producer portlet invoker -->
@@ -1075,6 +1069,16 @@
<xmbean/>
</mbean>
<mbean
+ code="org.jboss.portal.portlet.deployment.CorePortletInvoker"
+ name="portal:service=PortletInvoker,type=Core"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends
+ optional-attribute-name="PortletInvoker"
+ proxy-type="attribute">portal:service=PortletInvoker,type=Container</depends>
+ </mbean>
+ <mbean
code="org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker"
name="portal:service=PortletInvoker,type=Producer"
xmbean-dd=""
@@ -1082,7 +1086,7 @@
<xmbean/>
<depends
optional-attribute-name="PortletInvoker"
- proxy-type="attribute">portal:service=PortletInvoker,type=Container</depends>
+ proxy-type="attribute">portal:service=PortletInvoker,type=Core</depends>
<depends
optional-attribute-name="PersistenceManager"
proxy-type="attribute">portal:service=PersistenceManager,type=Producer</depends>
@@ -1294,6 +1298,14 @@
<attribute name="RegistrationControlledByService">@portal.single@</attribute>
</mbean>
+ <mbean
+ code="org.jboss.portal.core.impl.portlet.info.CoreInfoBuilderFactory"
+ name="portal:service=InfoBuilderFactory,type=Core"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+
<!-- -->
<!--
| Uncomment in cluster mode : have the creation of instances run as a clustered singleton
@@ -1326,10 +1338,21 @@
<depends
optional-attribute-name="Deployer"
proxy-type="attribute">portal:deployer=PortalWebApp</depends>
+<!--
<depends
optional-attribute-name="WebAppRegistry"
proxy-type="attribute">portal:service=WebAppRegistry</depends>
+ -->
<depends
+ optional-attribute-name="CoreInfoBuilderFactory"
+ proxy-type="attribute">portal:service=InfoBuilderFactory,type=Core</depends>
+ <depends
+ optional-attribute-name="PortletContainerInvoker"
+ proxy-type="attribute">portal:service=PortletInvoker,type=Container</depends>
+ <depends
+ optional-attribute-name="CorePortletInvoker"
+ proxy-type="attribute">portal:service=PortletInvoker,type=Core</depends>
+ <depends
optional-attribute-name="Config"
proxy-type="attribute">portal:service=ServerConfig</depends>
<depends
@@ -1348,9 +1371,6 @@
optional-attribute-name="PortletInstancesEntityResolver"
proxy-type="attribute">portal:service=EntityResolver</depends>
<attribute name="StandardJBossApplicationMetaDataLocation">conf/standardjboss-portlet.xml</attribute>
- <attribute name="PortletAPIFactoryClassName">org.jboss.portlet.JBossAPIFactory</attribute>
- <attribute
- name="PortletInfoFactoryClassName">org.jboss.portal.core.impl.portlet.info.CorePortletInfoFactory</attribute>
<!-- Set to false in clustered mode, otherwise set to true -->
<attribute name="CreateInstances">@portal.single@</attribute>
</mbean>
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/.classpath 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/.classpath 2008-03-06 11:10:42 UTC (rev 10228)
@@ -22,5 +22,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/identity/lib/portal-identity-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-federation-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/portlet-server"/>
<classpathentry kind="output" path="output/classes"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/build.xml 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/build.xml 2008-03-06 11:10:42 UTC (rev 10228)
@@ -115,6 +115,7 @@
<path refid="jboss.portal-theme.classpath"/>
<path refid="jboss.portal-security.classpath"/>
<path refid="jboss.portal-core.classpath"/>
+ <path refid="jboss.portal-portlet-server.classpath"/>
</path>
<!--+=======================================+-->
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml 2008-03-06 11:10:42 UTC (rev 10228)
@@ -23,11 +23,24 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<portlet-app
- xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ 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_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
- version="1.0">
+ 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">
+ <filter>
+ <filter-name>JBoss Portlet Filter</filter-name>
+ <filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>JBoss Portlet Filter</filter-name>
+ <portlet-name>IdentityUserPortlet</portlet-name>
+ </filter-mapping>
+
+
<portlet>
<description>Identity user portlet</description>
<portlet-name>IdentityUserPortlet</portlet-name>
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/build.xml 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/build.xml 2008-03-06 11:10:42 UTC (rev 10228)
@@ -115,6 +115,8 @@
<path refid="trove.trove.classpath"/>
<path refid="qdox.qdox.classpath"/>
<pathelement location="${source.etc}/sun-jsf/jsf-example.jar"/>
+ <path refid="portlet.portlet.classpath"/>
+
</path>
<!-- Configure modules -->
Modified: branches/JBoss_Portal_Branch_2_7/faces/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/faces/.classpath 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/faces/.classpath 2008-03-06 11:10:42 UTC (rev 10228)
@@ -14,8 +14,8 @@
<classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-portal-lib.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-jsr168api-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-bridge-lib.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/module-portlet"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Deleted: branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -1,84 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.faces.component.portlet;
-
-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.invocation.resolver.PrincipalAttributeResolver;
-import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
-import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.impl.spi.AbstractActionContext;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class JSFActionContext extends AbstractActionContext
-{
-
- /** . */
- private final JSFInvocation invocation;
-
- public JSFActionContext(
- Mode mode, WindowState
- windowState,
- StateString interactionState,
- MarkupInfo markupInfo,
- JSFInvocation invocation)
- {
- super(mode, windowState, null, markupInfo, interactionState, null);
-
- //
- this.invocation = invocation;
-
- //
- addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(invocation.clientRequest));
- addResolver(PortletInvocation.PRINCIPAL_SCOPE, new PrincipalAttributeResolver(invocation.clientRequest));
- addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, EmptyAttributeResolver.getInstance());
- addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
- }
-
- public HttpServletRequest getClientRequest() throws IllegalStateException
- {
- return invocation.clientRequest;
- }
-
- public HttpServletResponse getClientResponse() throws IllegalStateException
- {
- return invocation.clientResponse;
- }
-
- public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
- {
- return invocation.renderURL(portletURL, wantSecure, wantAuthenticated, relative);
- }
-}
Modified: branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -24,27 +24,32 @@
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.text.FastURLEncoder;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.URLFormat;
import org.jboss.portal.portlet.bridge.JBossServletContextProvider;
import org.jboss.portal.portlet.impl.PortletRequestEncoder;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
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.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.spi.ActionContext;
import org.jboss.portal.portlet.spi.PortalContext;
-import org.jboss.portal.portlet.spi.RenderContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
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;
@@ -89,6 +94,9 @@
/** . */
final WindowContext windowContext;
+ /** . */
+ final ServerContext serverContext;
+
public JSFInvocation(FacesContext faces, UIPortlet uiportlet)
{
// Get request and response
@@ -101,13 +109,14 @@
//
this.portalContext = new JSFPortalContext(faces, uiportlet);
- this.requestContext = new AbstractRequestContext(clientRequest, clientResponse);
+ this.requestContext = new AbstractRequestContext(clientRequest);
this.securityContext = new JSFSecurityContext(faces);
this.userContext = new JSFUserContext(faces);
this.windowContext = new JSFWindowContext(faces);
+ this.serverContext = new JSFServerContext(this);
}
- String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+ String renderURL(ContainerURL containerURL, StateString navigationalState, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
{
ViewHandler vh = faces.getApplication().getViewHandler();
String viewId = faces.getViewRoot().getViewId();
@@ -117,9 +126,11 @@
//
url.append("&").append(clientId).append("=jbp");
+ PortletURL portletURL = (PortletURL)containerURL;
+
//
PortletRequestEncoder encoder = new PortletRequestEncoder();
- encoder.encode(portletURL);
+ encoder.encodeRender(navigationalState, portletURL.getMode(), portletURL.getWindowState());
for (Iterator i = encoder.getQueryParameters().entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry)i.next();
@@ -141,18 +152,13 @@
Portlet portlet,
Mode mode,
WindowState windowState,
+ StateString navigationalState,
StateString interactionState) throws PortletInvokerException
{
- //
- ActionContext actionContext = new JSFActionContext(
- mode,
- windowState,
- interactionState,
- new MarkupInfo(MediaType.HTML, "UTF-8"),
- this);
+ PortletInvocationContext portletInvocationContext = new JSFPortletInvocationContext(clientRequest, clientResponse, new MarkupInfo(MediaType.HTML, "UTF-8"), navigationalState, this);
//
- PortletInvocation action = new ActionInvocation(actionContext);
+ PortletInvocation action = new ActionInvocation(portletInvocationContext);
//
return invoke(portlet, action);
@@ -164,16 +170,11 @@
WindowState windowState,
ParameterMap navState) throws PortletInvokerException
{
- //
- RenderContext renderContext = new JSFRenderContext(
- mode,
- windowState,
- navState,
- new MarkupInfo(MediaType.HTML, "UTF-8"),
- this);
+
+ PortletInvocationContext portletInvocationContext = new JSFPortletInvocationContext(clientRequest, clientResponse, new MarkupInfo(MediaType.HTML, "UTF-8"), null, this);
//
- PortletInvocation render = new RenderInvocation(renderContext);
+ PortletInvocation render = new RenderInvocation(portletInvocationContext);
//
return invoke(portlet, render);
@@ -187,7 +188,7 @@
invocation.setPortalContext(portalContext);
invocation.setSecurityContext(securityContext);
invocation.setUserContext(userContext);
- invocation.setRequestContext(requestContext);
+ invocation.setServerContext(serverContext);
invocation.setWindowContext(windowContext);
//
@@ -195,4 +196,54 @@
PortletInvoker invoker = uiportlet.getPortletInvoker();
return invoker.invoke(invocation);
}
+
+ private static class JSFPortletInvocationContext extends AbstractPortletInvocationContext
+ {
+
+ //private InvokePortletCommandFactory cmdFactory;
+ //private ControllerContext controllerContext;
+ private HttpServletRequest clientRequest;
+
+ private HttpServletResponse clientResponse;
+
+ private JSFInvocation invocation;
+
+ private StateString navigationalState;
+
+ public JSFPortletInvocationContext(HttpServletRequest clientRequest, HttpServletResponse clientResponse, MarkupInfo markupInfo, StateString navigationalState, JSFInvocation invocation)
+ {
+ super(markupInfo);
+
+ //
+// this.cmdFactory = cmdFactory;
+// this.controllerContext = controllerContext;
+ this.clientRequest = clientRequest;
+ this.clientResponse = clientResponse;
+ this.invocation = invocation;
+ this.navigationalState = navigationalState;
+
+ //
+ addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
+// addResolver(PortletInvocation.REQUEST_SCOPE, controllerContext);
+// addResolver(PortletInvocation.PRINCIPAL_SCOPE, controllerContext);
+// addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, EmptyAttributeResolver.getInstance());
+// addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
+ }
+
+ public HttpServletRequest getClientRequest() throws IllegalStateException
+ {
+ return clientRequest;
+ }
+
+ public HttpServletResponse getClientResponse() throws IllegalStateException
+ {
+ return clientResponse;
+ }
+
+ public String renderURL(ContainerURL containerURL, URLFormat urlFormat)
+ {
+ return invocation.renderURL(containerURL, navigationalState, urlFormat.getWantSecure(), urlFormat.getWantAuthenticated(), urlFormat.getWantRelative());
+ }
+ }
+
}
Deleted: branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -1,85 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.faces.component.portlet;
-
-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.invocation.resolver.PrincipalAttributeResolver;
-import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
-import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.impl.spi.AbstractRenderContext;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class JSFRenderContext extends AbstractRenderContext
-{
-
- /** . */
- private final JSFInvocation invocation;
-
- public JSFRenderContext(
- Mode mode, WindowState
- windowState,
- ParameterMap navState,
- MarkupInfo markupInfo,
- JSFInvocation invocation)
- {
- super(mode, windowState, navState != null ? ParametersStateString.create(navState) : null, markupInfo);
-
- //
- this.invocation = invocation;
-
- //
- addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(invocation.clientRequest));
- addResolver(PortletInvocation.PRINCIPAL_SCOPE, new PrincipalAttributeResolver(invocation.clientRequest));
- addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, EmptyAttributeResolver.getInstance());
- addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
- }
-
- public HttpServletRequest getClientRequest() throws IllegalStateException
- {
- return invocation.clientRequest;
- }
-
- public HttpServletResponse getClientResponse() throws IllegalStateException
- {
- return invocation.clientResponse;
- }
-
- public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
- {
- return invocation.renderURL(portletURL, wantSecure, wantAuthenticated, relative);
- }
-}
Added: branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFServerContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFServerContext.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFServerContext.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * 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.faces.component.portlet;
+
+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.invocation.resolver.PrincipalAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
+import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 10090 $
+ */
+public class JSFServerContext extends AbstractServerContext
+{
+
+ /** . */
+ private final JSFInvocation invocation;
+
+ public JSFServerContext(JSFInvocation invocation)
+ {
+ super(invocation.clientRequest, invocation.clientResponse);
+
+ //
+ this.invocation = invocation;
+
+ //
+ /*
+ addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(invocation.clientRequest));
+ addResolver(PortletInvocation.PRINCIPAL_SCOPE, new PrincipalAttributeResolver(invocation.clientRequest));
+ addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, EmptyAttributeResolver.getInstance());
+ addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
+ */
+ }
+
+ public HttpServletRequest getClientRequest() throws IllegalStateException
+ {
+ return invocation.clientRequest;
+ }
+
+ public HttpServletResponse getClientResponse() throws IllegalStateException
+ {
+ return invocation.clientResponse;
+ }
+
+ public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+ {
+ return invocation.renderURL(portletURL, null, wantSecure, wantAuthenticated, relative);
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletActionEvent.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletActionEvent.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletActionEvent.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -117,7 +117,7 @@
//
try
{
- PortletInvocationResponse pir = invocation.action(portlet, mode, windowState, ParametersStateString.create(interactionState));
+ PortletInvocationResponse pir = invocation.action(portlet, mode, windowState, null, ParametersStateString.create(interactionState));
if (pir instanceof UpdateNavigationalStateResponse)
{
UpdateNavigationalStateResponse render = (UpdateNavigationalStateResponse)pir;
Modified: branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/UIPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/UIPortlet.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/UIPortlet.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -412,7 +412,7 @@
//
portletId = (String)values[1];
- internalNavState = serializedNavState != null ? ParametersStateString.create(serializedNavState).getParameters() : null;
+// internalNavState = serializedNavState != null ? ParametersStateString.create(serializedNavState).getParameters() : null;
portletListener = (MethodBinding)restoreAttachedState(faces, values[3]);
supportedWindowStates = (Set)values[4];
supportedModes = (Set)values[5];
Modified: branches/JBoss_Portal_Branch_2_7/portlet-server/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/.classpath 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/.classpath 2008-03-06 11:10:42 UTC (rev 10228)
@@ -15,7 +15,9 @@
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-portal-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-jsr168api-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/module-web"/>
+ <classpathentry kind="lib" path="/thirdparty/portlet/lib/portlet-api.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-federation-lib.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/portlet-server/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/build.xml 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/build.xml 2008-03-06 11:10:42 UTC (rev 10228)
@@ -106,6 +106,7 @@
<path refid="jboss.test.classpath"/>
<path refid="sun.servlet.classpath"/>
<path refid="sun.jaf.classpath"/>
+ <path refid="sun.jaxb.classpath"/>
</path>
<!-- Configure modules -->
Modified: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -53,7 +53,7 @@
// Should be left up to the caller whenever it is possible
try
{
- PortletInvocationContext ctx = invocation.getPortletContext();
+ PortletInvocationContext ctx = invocation.getContext();
Method getClientRequestMethod = ctx.getClass().getMethod("getClientRequest", new Class[0]);
req = (HttpServletRequest)getClientRequestMethod.invoke(ctx, new Object[0]);
}
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/CorePortletInvoker.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/CorePortletInvoker.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/CorePortletInvoker.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,172 @@
+/******************************************************************************
+ * 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.deployment;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.state.DestroyCloneFailure;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.PropertyMap;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CorePortletInvoker implements PortletInvoker
+{
+ public static final Object PORTLET_CORE_INFO = "PORTLET_CORE_INFO";
+
+ /** . */
+ private PortletInvoker portletInvoker;
+
+ /** The logger. */
+ protected final Logger log = Logger.getLogger(getClass());
+
+ private Map<String, Map<String, PortletInfo>> portletInfoMap = new HashMap<String, Map<String, PortletInfo>>();
+
+ public PortletInvoker getPortletInvoker()
+ {
+ return portletInvoker;
+ }
+
+ public void addPortletInfo(String applicationName, String name, PortletInfo value)
+ {
+ Map<String, PortletInfo> map = portletInfoMap.get(applicationName);
+ if (map == null)
+ {
+ map = new HashMap<String, PortletInfo>();
+ portletInfoMap.put(applicationName, map);
+ }
+ map.put(name, value);
+ }
+
+ public PortletInfo getPortletInfo(String applicationName, String name)
+ {
+ Map<String, PortletInfo> map = portletInfoMap.get(applicationName);
+ if (map == null)
+ {
+ return null;
+ }
+ return map.get(name);
+ }
+
+ public void setPortletInvoker(PortletInvoker portletInvoker)
+ {
+ this.portletInvoker = portletInvoker;
+ }
+
+ public PortletContext createClone(PortletContext portletContext) throws IllegalArgumentException,
+ PortletInvokerException, UnsupportedOperationException
+ {
+ return portletInvoker.createClone(portletContext);
+ }
+
+ public List<DestroyCloneFailure> destroyClones(List<PortletContext> portletContexts)
+ throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ return portletInvoker.destroyClones(portletContexts);
+ }
+
+ public Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException
+ {
+ return new PortletImpl(portletInvoker.getPortlet(portletContext));
+ }
+
+ public Set<Portlet> getPortlets() throws PortletInvokerException
+ {
+ return portletInvoker.getPortlets();
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext) throws IllegalArgumentException,
+ PortletInvokerException, UnsupportedOperationException
+ {
+ return portletInvoker.getProperties(portletContext);
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext, Set<String> keys) throws IllegalArgumentException,
+ PortletInvokerException, UnsupportedOperationException
+ {
+ return portletInvoker.getProperties(portletContext, keys);
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws IllegalArgumentException,
+ PortletInvokerException
+ {
+ PortletContext ctx = invocation.getTarget();
+ PortletInfo info = portletInvoker.getPortlet(ctx).getInfo();
+
+ invocation.setAttribute(PortletInvocation.INVOCATION_SCOPE, PORTLET_CORE_INFO, getPortletInfo(info.getApplicationName(), info.getName()));
+ try
+ {
+ return portletInvoker.invoke(invocation);
+ }
+ finally
+ {
+ invocation.removeAttribute(PortletInvocation.INVOCATION_SCOPE, PORTLET_CORE_INFO);
+ }
+ }
+
+ public PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes)
+ throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ return portletInvoker.setProperties(portletContext, changes);
+ }
+
+ private class PortletImpl implements Portlet
+ {
+
+ private Portlet delegate;
+
+ public PortletImpl(Portlet delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public PortletContext getContext()
+ {
+ return delegate.getContext();
+ }
+
+ public PortletInfo getInfo()
+ {
+ return getPortletInfo(delegate.getInfo().getApplicationName(), delegate.getInfo().getName());
+ }
+
+ public boolean isRemote()
+ {
+ return delegate.isRemote();
+ }
+ }
+}
+
Copied: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/LocalizedStringBuilder.java (from rev 10109, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/metadata/factory/LocalizedStringBuilder.java)
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/LocalizedStringBuilder.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/LocalizedStringBuilder.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * 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.deployment;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.portlet.impl.metadata.adapter.LocalizedStringAdapter;
+import org.jboss.portal.portlet.impl.metadata.common.LocalizedDescriptionMetaData;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class LocalizedStringBuilder
+{
+
+ /** The object to localized meta data. */
+ private Map<Object, LocalizedMetaDataContainer> map = new LinkedHashMap<Object, LocalizedMetaDataContainer>();
+
+ /** The logger. */
+ private static final Logger log = Logger.getLogger(LocalizedStringBuilder.class);
+
+ public void put(Object object, LocalizedDescriptionMetaData description)
+ {
+ LocalizedMetaDataContainer container = map.get(object);
+ if (container == null)
+ {
+ container = new LocalizedMetaDataContainer();
+ map.put(object, container);
+ }
+ container.addLocalizedDescription(description);
+ }
+
+ public LocalizedString getLocalizedString(Object key)
+ {
+ try
+ {
+ return this.map.get(key) != null ? this.map.get(key).getLocalizedString() : null;
+ }
+ catch (Exception e)
+ {
+ log.error("could not generate localized string.", e);
+ return null;
+ }
+ }
+
+ private static class LocalizedMetaDataContainer
+ {
+ /** The list of localiezd meta data */
+ private List<LocalizedDescriptionMetaData> list = new ArrayList<LocalizedDescriptionMetaData>();
+
+ public void addLocalizedDescription(LocalizedDescriptionMetaData description)
+ {
+ this.list.add(description);
+ }
+
+ public LocalizedString getLocalizedString() throws Exception
+ {
+ LocalizedStringAdapter adapter = new LocalizedStringAdapter();
+ return adapter.unmarshal(list);
+ }
+ }
+}
Copied: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/PortletApplicationModelFactory.java (from rev 10109, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/metadata/factory/PortletApplicationModelFactory.java)
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/PortletApplicationModelFactory.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/PortletApplicationModelFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,848 @@
+/******************************************************************************
+ * 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.deployment;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.portlet.LifeCyclePhase;
+import org.jboss.portal.portlet.TransportGuarantee;
+import org.jboss.portal.portlet.impl.metadata.CustomPortletModeMetaData;
+import org.jboss.portal.portlet.impl.metadata.CustomWindowStateMetaData;
+import org.jboss.portal.portlet.impl.metadata.ListenerMetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import static org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.DEFAULT_LOCALE;
+import static org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.PORTLET_JSR_286_NS;
+import org.jboss.portal.portlet.impl.metadata.PublicRenderParameterMetaData;
+import org.jboss.portal.portlet.impl.metadata.UserAttributeMetaData;
+import org.jboss.portal.portlet.impl.metadata.common.ContainerRuntimeMetaData;
+import org.jboss.portal.portlet.impl.metadata.common.DescribableMetaData;
+import org.jboss.portal.portlet.impl.metadata.common.InitParamMetaData;
+import org.jboss.portal.portlet.impl.metadata.common.LocalizedDescriptionMetaData;
+import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionMetaData;
+import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionReferenceMetaData;
+import org.jboss.portal.portlet.impl.metadata.filter.FilterMappingMetaData;
+import org.jboss.portal.portlet.impl.metadata.filter.FilterMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletCacheScopeEnum;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletInfoMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletModeMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferenceMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferencesMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SecurityRoleRefMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SupportedLocaleMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SupportsMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.WindowStateMetaData;
+import org.jboss.portal.portlet.impl.metadata.security.PortletCollectionMetaData;
+import org.jboss.portal.portlet.impl.metadata.security.SecurityConstraintMetaData;
+import org.jboss.portal.portlet.impl.metadata.security.UserDataConstraintMetaData;
+import org.jboss.xb.binding.GenericObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PortletApplicationModelFactory implements GenericObjectModelFactory
+{
+
+ /** LocalizedDescriptionMetaData container for descriptions */
+ private LocalizedStringBuilder descriptions = new LocalizedStringBuilder();
+
+ /** LocalizedDescriptionMetaData container for displayNames */
+ private LocalizedStringBuilder displayNames = new LocalizedStringBuilder();
+
+ /** Guess what? The logger. */
+ private static final Logger log = Logger.getLogger(PortletApplicationModelFactory.class);
+
+ public Object newRoot(Object root, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
+ {
+
+ String version = attrs.getValue("version");
+ String id = attrs.getValue("id");
+
+ // portlet-app 2.0 or 1.0
+ PortletApplication10MetaData md = PORTLET_JSR_286_NS.equals(nsURI)
+ ? new PortletApplication20MetaData()
+ : new PortletApplication10MetaData();
+
+ // Set portlet-app id
+ md.setId(id);
+ // Set portlet-app version
+ md.setVersion(version);
+ // return
+ return md;
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx, String nsURI, String name)
+ {
+ return root;
+ }
+
+ public Object newChild(Object object, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
+ {
+ String id = attrs.getValue("id");
+ if (object instanceof DescribableMetaData)
+ {
+
+ if ("description".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ? attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new LocalizedDescriptionMetaData(locale);
+ this.descriptions.put(object, localized);
+ return localized;
+ }
+ }
+
+ // portlet-app
+ if (object instanceof PortletApplication10MetaData)
+ {
+ if ("portlet".equals(localName))
+ {
+ return new PortletMetaData(id);
+ }
+ else if ("custom-portlet-mode".equals(localName))
+ {
+ return new CustomPortletModeMetaData(id);
+ }
+ else if ("custom-window-state".equals(localName))
+ {
+ return new CustomWindowStateMetaData(id);
+ }
+ else if ("user-attribute".equals(localName))
+ {
+ return new UserAttributeMetaData(id);
+ }
+ else if ("security-constraint".equals(localName))
+ {
+ return new SecurityConstraintMetaData(id);
+ }
+ }
+
+ // portlet-app 2.0
+ if (object instanceof PortletApplication20MetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ if ("public-render-parameter".equals(localName))
+ {
+ return new PublicRenderParameterMetaData(id);
+ }
+ else if ("event-definition".equals(localName))
+ {
+ return new EventDefinitionMetaData(id);
+ }
+ else if ("filter".equals(localName))
+ {
+ return new FilterMetaData();
+ }
+ else if ("filter-mapping".equals(localName))
+ {
+ return new FilterMappingMetaData();
+ }
+ else if ("listener".equals(localName))
+ {
+ return new ListenerMetaData(id);
+ }
+ else if ("container-runtime-option".equals(localName))
+ {
+ return new ContainerRuntimeMetaData();
+ }
+ }
+
+ // portlet
+ if (object instanceof PortletMetaData)
+ {
+ if ("init-param".equals(localName))
+ {
+ return new InitParamMetaData(id);
+ }
+ else if ("display-name".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ? attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new LocalizedDescriptionMetaData(locale);
+ this.displayNames.put(object, localized);
+ return localized;
+ }
+ else if ("supports".equals(localName))
+ {
+ return new SupportsMetaData(id);
+ }
+ else if ("supported-locale".equals(localName))
+ {
+ return new SupportedLocaleMetaData();
+ }
+ else if ("portlet-info".equals(localName))
+ {
+ return new PortletInfoMetaData(id);
+ }
+ else if ("portlet-preferences".equals(localName))
+ {
+ return new PortletPreferencesMetaData(id);
+ }
+ else if ("security-role-ref".equals(localName))
+ {
+ return new SecurityRoleRefMetaData(id);
+ }
+ else if ("supported-processing-event".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ return new EventDefinitionReferenceMetaData(id);
+ }
+ else if ("supported-publishing-event".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ return new EventDefinitionReferenceMetaData(id);
+ }
+ else if ("container-runtime-option".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ return new ContainerRuntimeMetaData();
+ }
+ }
+
+ // security-constraint
+ if (object instanceof SecurityConstraintMetaData)
+ {
+ if ("portlet-collection".equals(localName))
+ {
+ return new PortletCollectionMetaData();
+ }
+ else if ("user-data-constraint".equals(localName))
+ {
+ return new UserDataConstraintMetaData(id);
+ }
+ else if ("display-name".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ? attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new LocalizedDescriptionMetaData(locale);
+ this.displayNames.put(object, localized);
+ return localized;
+ }
+ }
+
+ // supports
+ if (object instanceof SupportsMetaData)
+ {
+ if ("portlet-mode".equals(localName))
+ {
+ return new PortletModeMetaData();
+ }
+ else if ("window-state".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ return new WindowStateMetaData();
+ }
+ }
+
+ // preference (in portlet-preferences)
+ if (object instanceof PortletPreferencesMetaData)
+ {
+ if ("preference".equals(localName))
+ {
+ return new PortletPreferenceMetaData(id);
+ }
+ }
+
+ // filter
+ if (object instanceof FilterMetaData)
+ {
+ if ("init-param".equals(localName))
+ {
+ return new InitParamMetaData(id);
+ }
+ else if ("display-name".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ? attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new LocalizedDescriptionMetaData(locale);
+ this.displayNames.put(object, localized);
+ return localized;
+ }
+ }
+
+ // listener
+ if (object instanceof ListenerMetaData)
+ {
+ if ("display-name".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ? attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new LocalizedDescriptionMetaData(locale);
+ this.displayNames.put(object, localized);
+ return localized;
+ }
+ }
+
+ return null;
+ }
+
+ public void addChild(Object parent, Object child, UnmarshallingContext nav, String nsURI, String localName)
+ {
+
+ if (child instanceof DescribableMetaData)
+ {
+ DescribableMetaData md = (DescribableMetaData)child;
+ LocalizedString d = this.descriptions.getLocalizedString(md);
+ md.setDescription(d);
+ }
+
+ // portlet app
+ if (parent instanceof PortletApplication10MetaData)
+ {
+ PortletApplication10MetaData md = (PortletApplication10MetaData)parent;
+ // add portlet
+ if (child instanceof PortletMetaData)
+ {
+ PortletMetaData portlet = (PortletMetaData)child;
+ portlet.setDisplayName(this.displayNames.getLocalizedString(portlet));
+ md.addPortlet(portlet);
+ }
+ // add custom-portlet-mode
+ else if (child instanceof CustomPortletModeMetaData)
+ {
+ md.addCustomPortletMode((CustomPortletModeMetaData)child);
+ }
+ // add custom window state
+ else if (child instanceof CustomWindowStateMetaData)
+ {
+ md.addCustomWindowState((CustomWindowStateMetaData)child);
+ }
+ // add user-attribute
+ else if (child instanceof UserAttributeMetaData)
+ {
+ md.addUserAttribute((UserAttributeMetaData)child);
+ }
+ // add security-constraint
+ else if (child instanceof SecurityConstraintMetaData)
+ {
+ SecurityConstraintMetaData security = (SecurityConstraintMetaData)child;
+ // display-name
+ security.setDisplayName(this.displayNames.getLocalizedString(security));
+ md.addSecurityConstraint(security);
+ }
+ }
+
+ // portlet-app 2.0
+ if (parent instanceof PortletApplication20MetaData)
+ {
+ PortletApplication20MetaData md = (PortletApplication20MetaData)parent;
+ // add public-render-parameter
+ if (child instanceof PublicRenderParameterMetaData)
+ {
+ md.addPublicRenderParameter((PublicRenderParameterMetaData)child);
+ }
+ // add event-defintion
+ else if (child instanceof EventDefinitionMetaData)
+ {
+ md.addEventDefinition((EventDefinitionMetaData)child);
+ }
+ // add filter
+ else if (child instanceof FilterMetaData)
+ {
+ FilterMetaData filter = (FilterMetaData)child;
+ filter.setDisplayName(this.displayNames.getLocalizedString(filter));
+ md.addFilter(filter);
+ }
+ // add filter-mapping
+ else if (child instanceof FilterMappingMetaData)
+ {
+ md.addFilterMapping((FilterMappingMetaData)child);
+ }
+ // add container-runtime-option
+ else if (child instanceof ContainerRuntimeMetaData)
+ {
+ md.addContainerRuntime((ContainerRuntimeMetaData)child);
+ }
+ // add listener
+ else if (child instanceof ListenerMetaData)
+ {
+ ListenerMetaData listener = (ListenerMetaData)child;
+ listener.setDisplayName(this.displayNames.getLocalizedString(listener));
+ md.addListener(listener);
+ }
+ }
+
+ // portlet
+ if (parent instanceof PortletMetaData)
+ {
+ PortletMetaData md = (PortletMetaData)parent;
+ // init-param
+ if (child instanceof InitParamMetaData)
+ {
+ md.addInitParam((InitParamMetaData)child);
+ }
+ // supports
+ else if (child instanceof SupportsMetaData)
+ {
+ md.addSupport((SupportsMetaData)child);
+ }
+ // supported-locale
+ else if (child instanceof SupportedLocaleMetaData)
+ {
+ md.addSupportedLocale((SupportedLocaleMetaData)child);
+ }
+ // portlet-info
+ else if (child instanceof PortletInfoMetaData)
+ {
+ md.setPortletInfo((PortletInfoMetaData)child);
+ }
+ // portlet-preferences
+ else if (child instanceof PortletPreferencesMetaData)
+ {
+ md.setPortletPreferences((PortletPreferencesMetaData)child);
+ }
+ // security-role-ref
+ else if (child instanceof SecurityRoleRefMetaData)
+ {
+ md.addSecurityRoleRef((SecurityRoleRefMetaData)child);
+ }
+ // supported-events
+ else if (child instanceof EventDefinitionReferenceMetaData)
+ {
+ if ("supported-processing-event".equals(localName))
+ {
+ md.addSupportedProcessingEvent((EventDefinitionReferenceMetaData)child);
+ }
+ else if ("supported-publishing-event".equals(localName))
+ {
+ md.addSupportedPublishingEvent((EventDefinitionReferenceMetaData)child);
+ }
+ }
+ // container-runtime-option
+ else if (child instanceof ContainerRuntimeMetaData)
+ {
+ md.addContainerRuntime((ContainerRuntimeMetaData)child);
+ }
+ }
+
+ // adding user-data-constraint and portlet-name(s) to security-constraint
+ if (parent instanceof SecurityConstraintMetaData)
+ {
+ SecurityConstraintMetaData md = (SecurityConstraintMetaData)parent;
+ // add user-data-constraint
+ if (child instanceof UserDataConstraintMetaData)
+ {
+ md.setUserDataConstraint((UserDataConstraintMetaData)child);
+ }
+ // add portlet-collection
+ else if (child instanceof PortletCollectionMetaData)
+ {
+ md.setPortletList((PortletCollectionMetaData)child);
+ }
+ }
+
+ // filter
+ if (parent instanceof FilterMetaData)
+ {
+ FilterMetaData md = (FilterMetaData)parent;
+ // add init-param
+ if (child instanceof InitParamMetaData)
+ {
+ md.addInitParam((InitParamMetaData)child);
+ }
+ }
+
+ // add portlet-mode and window-state
+ if (parent instanceof SupportsMetaData)
+ {
+ SupportsMetaData md = (SupportsMetaData)parent;
+ if (child instanceof PortletModeMetaData)
+ {
+ md.addPortletMode((PortletModeMetaData)child);
+ }
+ else if (child instanceof WindowStateMetaData)
+ {
+ md.addWindowState((WindowStateMetaData)child);
+ }
+ }
+
+ // add preference
+ if (parent instanceof PortletPreferencesMetaData)
+ {
+ PortletPreferencesMetaData md = (PortletPreferencesMetaData)parent;
+ if (child instanceof PortletPreferenceMetaData)
+ {
+ md.addPortletPreference((PortletPreferenceMetaData)child);
+ }
+ }
+ }
+
+ public void setValue(Object object, UnmarshallingContext nav, String nsURI, String localName, String value)
+ {
+
+ // JSR 286 portlet-app attributes - default-namespace and resource-bundle.
+ if (object instanceof PortletApplication20MetaData)
+ {
+ PortletApplication20MetaData md = (PortletApplication20MetaData)object;
+ if ("resource-bundle".equals(localName))
+ {
+ md.setResourceBundle(value);
+ }
+ else if ("default-namespace".equals(localName))
+ {
+ try
+ {
+ md.setDefaultNamespace(new URI(value));
+ }
+ catch (URISyntaxException e)
+ {
+ log.error("Invalid syntax for default-namespace: " + value);
+ }
+ }
+ }
+
+ // portlet
+ if (object instanceof PortletMetaData)
+ {
+ PortletMetaData md = (PortletMetaData)object;
+ if ("portlet-name".equals(localName))
+ {
+ md.setPortletName(value);
+ }
+ else if ("portlet-class".equals(localName))
+ {
+ md.setPortletClass(value);
+ }
+ else if ("cache-scope".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ md.setCacheScope(PortletCacheScopeEnum.valueOf(value));
+ }
+ else if ("expiration-cache".equals(localName))
+ {
+ md.setExpirationCache(Integer.valueOf(value));
+ }
+ else if ("resource-bundle".equals(localName))
+ {
+ md.setResourceBundle(value);
+ }
+ else if ("supported-public-render-parameter".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ md.addSupportedPublicRenderParameter(value);
+ }
+ }
+
+ if (object instanceof LocalizedDescriptionMetaData)
+ {
+ LocalizedDescriptionMetaData localized = (LocalizedDescriptionMetaData)object;
+ if ("description".equals(localName))
+ {
+ localized.setDescription(value);
+ }
+ else if ("display-name".equals(localName))
+ {
+ localized.setDescription(value);
+ }
+ }
+
+ // init-param
+ if (object instanceof InitParamMetaData)
+ {
+ InitParamMetaData md = (InitParamMetaData)object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ md.setValue(value);
+ }
+ }
+
+ // supports
+ if (object instanceof SupportsMetaData)
+ {
+ SupportsMetaData md = (SupportsMetaData)object;
+ if ("mime-type".equals(localName))
+ {
+ md.setMimeType(value);
+ }
+ }
+
+ // supports --- portlet-mode
+ if (object instanceof PortletModeMetaData)
+ {
+ PortletModeMetaData md = (PortletModeMetaData)object;
+ if ("portlet-mode".equals(localName))
+ {
+ md.setPortletMode(Mode.create(value));
+ }
+ }
+
+ // supports --- window-state
+ if (object instanceof WindowStateMetaData)
+ {
+ WindowStateMetaData md = (WindowStateMetaData)object;
+ if ("window-state".equals(localName))
+ {
+ md.setWindowState(WindowState.create(value));
+ }
+ }
+
+ // supported-locale
+ if (object instanceof SupportedLocaleMetaData)
+ {
+ SupportedLocaleMetaData md = (SupportedLocaleMetaData)object;
+ if ("supported-locale".equals(localName))
+ {
+ md.setLocale(value);
+ }
+ }
+
+ // portlet-info
+ if (object instanceof PortletInfoMetaData)
+ {
+ PortletInfoMetaData md = (PortletInfoMetaData)object;
+ if ("title".equals(localName))
+ {
+ md.setTitle(value);
+ }
+ else if ("short-title".equals(localName))
+ {
+ md.setShortTitle(value);
+ }
+ else if ("keywords".equals(localName))
+ {
+ md.setKeywords(value);
+ }
+ }
+
+ // portlet-preferences
+ if (object instanceof PortletPreferencesMetaData)
+ {
+ PortletPreferencesMetaData md = (PortletPreferencesMetaData)object;
+ if ("preferences-validator".equals(localName))
+ {
+ md.setPreferenceValidator(value);
+ }
+ }
+
+ // preference
+ if (object instanceof PortletPreferenceMetaData)
+ {
+ PortletPreferenceMetaData md = (PortletPreferenceMetaData)object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ md.addValue(value);
+ }
+ else if ("read-only".equals(localName))
+ {
+ md.setReadOnly(Boolean.valueOf(value));
+ }
+ }
+
+ // security-role-ref
+ if (object instanceof SecurityRoleRefMetaData)
+ {
+ SecurityRoleRefMetaData md = (SecurityRoleRefMetaData)object;
+ if ("role-name".equals(localName))
+ {
+ md.setRoleName(value);
+ }
+ else if ("role-link".equals(localName))
+ {
+ md.setRoleLink(value);
+ }
+ }
+
+ // supported events
+ if (object instanceof EventDefinitionReferenceMetaData)
+ {
+ EventDefinitionReferenceMetaData md = (EventDefinitionReferenceMetaData)object;
+ if ("qname".equals(localName))
+ {
+ md.setQname(nav.resolveQName(value));
+ }
+ else if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ }
+
+ // custom-portlet-mode
+ if (object instanceof CustomPortletModeMetaData)
+ {
+ CustomPortletModeMetaData mode = (CustomPortletModeMetaData)object;
+ if ("portlet-mode".equals(localName))
+ {
+ mode.setPortletMode(value);
+ }
+ else if ("portal-managed".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ mode.setPortalManaged(Boolean.parseBoolean(value));
+ }
+ }
+
+ // custom-window-state
+ if (object instanceof CustomWindowStateMetaData)
+ {
+ CustomWindowStateMetaData md = (CustomWindowStateMetaData)object;
+ if ("window-state".equals(localName))
+ {
+ md.setWindowState(value);
+ }
+ }
+
+ // user-attribute
+ if (object instanceof UserAttributeMetaData)
+ {
+ UserAttributeMetaData md = (UserAttributeMetaData)object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ }
+
+ // user-data-constraint
+ if (object instanceof UserDataConstraintMetaData)
+ {
+ UserDataConstraintMetaData md = (UserDataConstraintMetaData)object;
+ if ("transport-guarantee".equals(localName))
+ {
+ md.setTransportQuarantee(TransportGuarantee.valueOf(value));
+ }
+ }
+
+ // portlet-collection in security-constraint
+ if (object instanceof PortletCollectionMetaData)
+ {
+ PortletCollectionMetaData md = (PortletCollectionMetaData)object;
+ if ("portlet-name".equals(localName))
+ {
+ md.addPortletname(value);
+ }
+ }
+
+ // filter
+ if (object instanceof FilterMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ FilterMetaData md = (FilterMetaData)object;
+ if ("filter-class".equals(localName))
+ {
+ md.setFilterClass(value);
+ }
+ else if ("filter-name".equals(localName))
+ {
+ md.setFilterName(value);
+ }
+ else if ("lifecycle".equals(localName))
+ {
+ int end = value.length() - "_PHASE".length();
+ String lifeCycle = value.substring(0, end > 0 ? end : 0);
+ try
+ {
+ md.addLifecycle(LifeCyclePhase.valueOf(lifeCycle));
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new IllegalArgumentException("Invalid value for lifecycle. Valid values are [RENDER_PHASE, RESOURCE_PHASE, ACTION_PHASE, EVENT_PHASE]");
+ }
+ }
+ }
+
+ // filter-mapping
+ if (object instanceof FilterMappingMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ FilterMappingMetaData md = (FilterMappingMetaData)object;
+ if ("filter-name".equals(localName))
+ {
+ md.setName(value);
+ }
+ if ("portlet-name".equals(localName))
+ {
+ md.addPortletName(value);
+ }
+ }
+
+ // event-defintion
+ if (object instanceof EventDefinitionMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ EventDefinitionMetaData md = (EventDefinitionMetaData)object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("qname".equals(localName))
+ {
+ md.setQname(nav.resolveQName(value));
+ }
+ else if ("value-type".equals(localName))
+ {
+ md.setValueType(value);
+ }
+ else if ("alias".equals(localName))
+ {
+ md.addAlias(nav.resolveQName(value));
+ }
+ }
+
+ // public-render-parameter
+ if (object instanceof PublicRenderParameterMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ PublicRenderParameterMetaData md = (PublicRenderParameterMetaData)object;
+ if ("identifier".equals(localName))
+ {
+ md.setIdentifier(value);
+ }
+ else if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("qname".equals(localName))
+ {
+ md.setQname(nav.resolveQName(value));
+ }
+ else if ("alias".equals(localName))
+ {
+ md.addAlias(nav.resolveQName(value));
+ }
+ }
+
+ // container-runtime-option
+ if (object instanceof ContainerRuntimeMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ ContainerRuntimeMetaData md = (ContainerRuntimeMetaData)object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ md.addValue(value);
+ }
+ }
+
+ // listener
+ if (object instanceof ListenerMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ ListenerMetaData md = (ListenerMetaData)object;
+ if ("listener-class".equals(localName))
+ {
+ md.setListenerClass(value);
+ }
+ }
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilder.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilder.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.deployment.jboss;
+
+import java.util.Collection;
+
+import org.jboss.portal.portlet.deployment.jboss.info.ContainerPortletInfoWrapper;
+import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface InfoBuilder
+{
+
+ void build();
+
+ Collection<org.jboss.portal.portlet.info.PortletInfo> getPortlets();
+
+ ContainerPortletApplicationInfo getApplication();
+
+}
+
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilderFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilderFactory.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/InfoBuilderFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -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.deployment.jboss;
+
+import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.server.deployment.PortalWebApp;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface InfoBuilderFactory
+{
+ public InfoBuilder createInfoBuilder(PortalWebApp webApp, JBossApplicationMetaData jbossApplicationMetaData, PortletApplication10MetaData portletApplicationMD);
+}
+
Modified: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/JBossApplicationMetaDataFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/JBossApplicationMetaDataFactory.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/JBossApplicationMetaDataFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -23,10 +23,10 @@
package org.jboss.portal.portlet.deployment.jboss;
import org.jboss.portal.common.transaction.Transactions;
-import org.jboss.portal.portlet.impl.jsr168.info.ContainerCacheInfo;
-import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-import org.jboss.portal.portlet.metadata.PolicyPermissionMetaData;
+import org.jboss.portal.portlet.deployment.jboss.info.ContainerCacheInfo;
+import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
+import org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData;
+import org.jboss.portal.portlet.deployment.jboss.metadata.PolicyPermissionMetaData;
import org.jboss.xb.binding.GenericObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
Modified: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -22,38 +22,48 @@
******************************************************************************/
package org.jboss.portal.portlet.deployment.jboss;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.servlet.ServletContext;
+
import org.jboss.deployment.DeploymentException;
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.xml.NullEntityResolver;
-import org.jboss.portal.portlet.impl.container.PortletApplicationContextImpl;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-import org.jboss.portal.portlet.metadata.PolicyPermissionMetaData;
-import org.jboss.portal.portlet.metadata.SecurityConstraintMetaData;
-import org.jboss.portal.portlet.security.PortletSecurityService;
-import org.jboss.portal.security.RoleSecurityBinding;
-import org.jboss.portal.security.SecurityConstants;
-import org.jboss.portal.security.spi.provider.AuthorizationDomain;
-import org.jboss.portal.security.spi.provider.DomainConfigurator;
-import org.jboss.portal.security.spi.provider.SecurityConfigurationException;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
+import org.jboss.portal.portlet.container.PortletContainerContext;
+import org.jboss.portal.portlet.container.PortletFilterContext;
+import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEventListener;
+import org.jboss.portal.portlet.container.object.PortletApplicationObject;
+import org.jboss.portal.portlet.container.object.PortletContainerObject;
+import org.jboss.portal.portlet.container.object.PortletFilterObject;
+import org.jboss.portal.portlet.deployment.CorePortletInvoker;
+import org.jboss.portal.portlet.deployment.PortletApplicationModelFactory;
+import org.jboss.portal.portlet.deployment.jboss.info.ContainerPortletInfoWrapper;
+import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
+import org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData;
+import org.jboss.portal.portlet.impl.container.PortletApplicationLifeCycle;
+import org.jboss.portal.portlet.impl.container.PortletContainerLifeCycle;
+import org.jboss.portal.portlet.impl.container.PortletFilterLifeCycle;
+import org.jboss.portal.portlet.impl.info.ContainerFilterInfo;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletFilterImpl;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.server.deployment.PortalWebApp;
import org.jboss.portal.server.deployment.jboss.Deployment;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.xml.sax.EntityResolver;
-import javax.management.MBeanServer;
-import javax.servlet.ServletContext;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -65,7 +75,7 @@
protected Map configurations;
/** . */
- protected PortletApplicationMetaData portletAppMD;
+ protected PortletApplication10MetaData portletAppMD;
/** . */
protected JBossApplicationMetaData jbossAppMD;
@@ -75,13 +85,19 @@
/** . */
protected PortletApplicationContextImpl portletApplicationContext;
+
+ /** . */
+ private PortletApplicationLifeCycle portletApplicationLifeCycle;
+
+ private ManagedObjectRegistryEventListener listener;
- public PortletAppDeployment(URL url, PortalWebApp pwa, MBeanServer mbeanServer, PortletAppDeploymentFactory factory)
+ public PortletAppDeployment(URL url, PortalWebApp pwa, ManagedObjectRegistryEventListener listener, MBeanServer mbeanServer, PortletAppDeploymentFactory factory)
{
super(url, pwa, mbeanServer);
this.factory = factory;
+ this.listener = listener;
}
-
+
public void create() throws DeploymentException
{
importTLD();
@@ -102,17 +118,17 @@
log.debug("Found default jboss portlet meta data");
if (defaultJBossPortletMD != null)
{
- for (Iterator i = portletAppMD.getPortlets().iterator(); i.hasNext();)
+ for (Iterator i = portletAppMD.getPortlets().values().iterator(); i.hasNext();)
{
PortletMetaData portletMD = (PortletMetaData)i.next();
- String name = portletMD.getName();
+ String name = portletMD.getPortletName();
JBossPortletMetaData jbossPortletMD = (JBossPortletMetaData)jbossAppMD.getPortlets().get(name);
if (jbossPortletMD != null)
{
log.debug("Merging default jboss portlet meta data for " + name);
// Merge with app settings
- jbossPortletMD.merge(jbossAppMD); // todo: remove since it shouldn't be needed anymore with the adding of merge in factory...
+// jbossPortletMD.merge(jbossAppMD); // todo: remove since it shouldn't be needed anymore with the adding of merge in factory...
// Merge with default portlet
jbossPortletMD.merge(defaultJBossPortletMD);
@@ -134,6 +150,91 @@
public void start() throws DeploymentException
{
+
+ log.debug("Starting installation");
+
+ //
+ InfoBuilder infoBuilder = factory.getCoreInfoBuilderFactory().createInfoBuilder(pwa, jbossAppMD, portletAppMD);
+
+ infoBuilder.build();
+ /*
+ ContainerInfoBuilderContext builderContext = new ContainerInfoBuilderContextImpl(portletAppMD, pwa);
+ ContainerInfoBuilder builder = new ContainerInfoBuilder(pwa.getContextPath(), portletAppMD, builderContext);
+ builder.build();
+ */
+ //
+ PortletApplicationObject portletApplicationObject = new PortletApplicationImpl(infoBuilder.getApplication());
+ PortletApplicationContext portletApplicationContext = new PortletApplicationContextImpl(pwa);
+
+
+ //
+ portletApplicationLifeCycle = new PortletApplicationLifeCycle(
+ listener,
+ portletApplicationContext,
+ portletApplicationObject);
+
+ //
+ for (ContainerFilterInfo filterInfo : infoBuilder.getApplication().getFilters().values())
+ {
+ PortletFilterObject portletFilterObject = new PortletFilterImpl(filterInfo);
+ PortletFilterContext portletFilterContext = new PortletFilterContextImpl();
+
+ //
+ portletApplicationLifeCycle.addPortletFilter(portletFilterContext, portletFilterObject);
+ }
+
+ //
+ for (PortletInfo portletInfo : infoBuilder.getPortlets())
+ {
+ ContainerPortletInfo cpi = null;
+ if (portletInfo instanceof ContainerPortletInfoWrapper)
+ {
+ cpi = ((ContainerPortletInfoWrapper)portletInfo).getContainerPortletInfo();
+ }
+ else
+ {
+ cpi = (ContainerPortletInfo)portletInfo;
+ }
+
+ PortletContainerObject portletContainerObject = new PortletContainerImpl(cpi);
+ PortletContainerContext portletContainerContext = new PortletContainerContextImpl();
+
+ //
+ PortletContainerLifeCycle portletContainerLifeCycle = portletApplicationLifeCycle.addPortletContainer(portletContainerContext, portletContainerObject);
+
+ ((CorePortletInvoker)factory.getCorePortletInvoker()).addPortletInfo(portletInfo.getApplicationName(), portletInfo.getName(), portletInfo);
+
+
+
+ // Now create deps
+ for (String filterRef : cpi.getFilterRefs())
+ {
+ PortletFilterLifeCycle portletFilterLifeCycle = portletApplicationLifeCycle.getManagedPortletFilter(filterRef);
+
+ //
+ if (portletFilterLifeCycle != null)
+ {
+ portletApplicationLifeCycle.addDependency(portletFilterLifeCycle, portletContainerLifeCycle);
+ }
+ else
+ {
+ // todo
+ }
+ }
+ }
+
+ //
+ portletApplicationLifeCycle.create();
+
+ //
+ portletApplicationLifeCycle.managedStart();
+
+ //
+
+
+
+
+ /*
try
{
portletApplicationContext = new PortletApplicationContextImpl(
@@ -200,25 +301,28 @@
}
}
+*/
//
super.start();
}
public void stop() throws DeploymentException
{
+
+ /*
PortletSecurityService portletSecurityService = factory.getPortletSecurityService();
if (portletSecurityService != null)
{
AuthorizationDomain authDomain = portletSecurityService.getAuthorizationDomain();
DomainConfigurator domainConfigurator = authDomain.getConfigurator();
- for (Iterator i = portletAppMD.getPortlets().iterator(); i.hasNext();)
+ for (Iterator i = portletAppMD.getPortlets().values().iterator(); i.hasNext();)
{
PortletMetaData portletMD = (PortletMetaData)i.next();
//
try
{
- String portletId = pwa.getId() + "." + portletMD.getName();
+ String portletId = pwa.getId() + "." + portletMD.getId();
domainConfigurator.removeSecurityBindings(portletId);
}
catch (SecurityConfigurationException e)
@@ -227,14 +331,16 @@
}
}
}
-
+*/
//
super.stop();
}
public void destroy() throws DeploymentException
{
- portletApplicationContext.stopPortletApplication();
+ portletApplicationLifeCycle.destroy();
+
+// portletApplicationContext.stopPortletApplication();
}
/** Import the portlet jsp tag TLD in the deployed application. */
@@ -243,7 +349,14 @@
InputStream sourceTLD = null;
try
{
- sourceTLD = IOTools.safeBufferedWrapper(Thread.currentThread().getContextClassLoader().getResourceAsStream("org/jboss/portal/portlet/portlet.tld"));
+ if (portletAppMD instanceof PortletApplication20MetaData)
+ {
+ sourceTLD = IOTools.safeBufferedWrapper(Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/portlet_2_0.tld"));
+ }
+ else
+ {
+ sourceTLD = IOTools.safeBufferedWrapper(Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/portlet.tld"));
+ }
pwa.importFile("/WEB-INF", "portlet.tld", sourceTLD, false);
}
catch (IOException e)
@@ -256,15 +369,15 @@
}
}
- protected PortletApplicationMetaData buildPortletApplicationMetaData() throws Exception
+ protected PortletApplication10MetaData buildPortletApplicationMetaData() throws Exception
{
InputStream in = null;
try
{
in = IOTools.safeBufferedWrapper(url.openStream());
- PortletApplicationMetaDataFactory factory = new PortletApplicationMetaDataFactory();
+ PortletApplicationModelFactory factory = new PortletApplicationModelFactory();
Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- PortletApplicationMetaData portletAppMD = (PortletApplicationMetaData)unmarshaller.unmarshal(in, new ValueTrimmingFilter(factory), null);
+ PortletApplication10MetaData portletAppMD = (PortletApplication10MetaData)unmarshaller.unmarshal(in, new ValueTrimmingFilter(factory), null);
portletAppMD.setId(pwa.getId());
return portletAppMD;
}
Modified: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -22,14 +22,26 @@
******************************************************************************/
package org.jboss.portal.portlet.deployment.jboss;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.management.MBeanServer;
+
import org.jboss.deployment.DeploymentException;
import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.portlet.container.PortletApplicationRegistry;
-import org.jboss.portal.portlet.impl.jsr168.PortletAPIFactoryImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletInfoFactoryImpl;
-import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
-import org.jboss.portal.portlet.impl.jsr168.spi.PortletInfoFactory;
-import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.managed.LifeCycleStatus;
+import org.jboss.portal.portlet.container.managed.ManagedObject;
+import org.jboss.portal.portlet.container.managed.ManagedObjectEvent;
+import org.jboss.portal.portlet.container.managed.ManagedObjectLifeCycleEvent;
+import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEvent;
+import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEventListener;
+import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
+import org.jboss.portal.portlet.impl.container.PortletContainerLifeCycle;
import org.jboss.portal.portlet.security.PortletSecurityService;
import org.jboss.portal.server.config.ServerConfig;
import org.jboss.portal.server.deployment.PortalWebApp;
@@ -39,12 +51,6 @@
import org.jboss.xb.binding.UnmarshallerFactory;
import org.xml.sax.EntityResolver;
-import javax.management.MBeanServer;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
/**
* todo : remove unused ConfigService
*
@@ -58,21 +64,9 @@
protected static final Pattern urlPattern = Pattern.compile(".*/portlet\\.xml");
/** . */
- protected PortletApplicationRegistry portletApplicationRegistry;
-
- /** . */
protected ServerConfig config;
/** . */
- protected String portletAPIFactoryClassName;
-
- /** . */
- protected String portletInfoFactoryClassName;
-
- /** . */
- protected PortletAPIFactory portletAPIFactory;
-
- /** . */
protected PortletSecurityService portletSecurityService;
/** . */
@@ -84,9 +78,12 @@
/** . */
protected EntityResolver jbossPortletEntityResolver;
- /** . */
- protected PortletInfoFactory portletInfoFactory;
+ private PortletInvoker portletContainerInvoker;
+ private PortletInvoker corePortletInvoker;
+
+ private InfoBuilderFactory coreInfoBuilderFactory;
+
public EntityResolver getJBossPortletEntityResolver()
{
return jbossPortletEntityResolver;
@@ -96,6 +93,16 @@
{
this.jbossPortletEntityResolver = jbossPortletEntityResolver;
}
+
+ public void setCoreInfoBuilderFactory(InfoBuilderFactory coreInfoBuilderFactory)
+ {
+ this.coreInfoBuilderFactory = coreInfoBuilderFactory;
+ }
+
+ public InfoBuilderFactory getCoreInfoBuilderFactory()
+ {
+ return coreInfoBuilderFactory;
+ }
public ServerConfig getConfig()
{
@@ -107,36 +114,6 @@
this.config = config;
}
- public String getPortletAPIFactoryClassName()
- {
- return portletAPIFactoryClassName;
- }
-
- public void setPortletAPIFactoryClassName(String apiFactoryClassName)
- {
- this.portletAPIFactoryClassName = apiFactoryClassName;
- }
-
- public String getPortletInfoFactoryClassName()
- {
- return portletInfoFactoryClassName;
- }
-
- public void setPortletInfoFactoryClassName(String portletInfoFactoryClassName)
- {
- this.portletInfoFactoryClassName = portletInfoFactoryClassName;
- }
-
- public PortletApplicationRegistry getWebAppRegistry()
- {
- return portletApplicationRegistry;
- }
-
- public void setWebAppRegistry(PortletApplicationRegistry portletApplicationRegistry)
- {
- this.portletApplicationRegistry = portletApplicationRegistry;
- }
-
public String getStandardJBossApplicationMetaDataLocation()
{
return standardJBossApplicationMetaDataLocation;
@@ -152,16 +129,6 @@
return standardJBossApplicationMetaData;
}
- public PortletAPIFactory getPortletAPIFactory()
- {
- return portletAPIFactory;
- }
-
- public PortletInfoFactory getPortletInfoFactory()
- {
- return portletInfoFactory;
- }
-
public boolean acceptFile(URL url)
{
String urlAsFile = url.getFile();
@@ -169,48 +136,14 @@
return matcher.matches();
}
- public Deployment newInstance(URL url, PortalWebApp pwa, MBeanServer mbeanServer) throws DeploymentException
+ public Deployment newInstance(URL url, PortalWebApp pwa, ManagedObjectRegistryEventListener listener, MBeanServer mbeanServer) throws DeploymentException
{
- return new PortletAppDeployment(url, pwa, mbeanServer, this);
+ return new PortletAppDeployment(url, pwa, listener, mbeanServer, this);
}
public void start() throws Exception
{
//
- try
- {
- portletAPIFactory = new PortletAPIFactoryImpl();
-
- // Try to load
- if (portletAPIFactoryClassName != null)
- {
- Class portletAPIFactoryClass = Thread.currentThread().getContextClassLoader().loadClass(portletAPIFactoryClassName);
- portletAPIFactory = (PortletAPIFactory)portletAPIFactoryClass.newInstance();
- }
- }
- catch (Exception e)
- {
- log.error("Cannot create portlet PortletAPIFactory=" + portletAPIFactoryClassName + " will use default one instead", e);
- }
-
- //
- try
- {
- portletInfoFactory = new PortletInfoFactoryImpl();
-
- // Try to load
- if (portletInfoFactoryClassName != null)
- {
- Class portletInfoFactoryClass = Thread.currentThread().getContextClassLoader().loadClass(portletInfoFactoryClassName);
- portletInfoFactory = (PortletInfoFactory)portletInfoFactoryClass.newInstance();
- }
- }
- catch (Exception e)
- {
- log.error("Cannot create portlet PortletInfoFactory=" + portletInfoFactoryClassName + " will use default one instead", e);
- }
-
- //
loadStandardJBossApplicationMetaData();
//
@@ -246,9 +179,6 @@
public void stop()
{
super.stop();
-
- //
- portletAPIFactory = null;
}
public PortletSecurityService getPortletSecurityService()
@@ -266,4 +196,65 @@
{
return new JBossApplicationMetaDataFactory();
}
+
+ public PortletInvoker getPortletContainerInvoker()
+ {
+ return portletContainerInvoker;
+ }
+
+ public void setPortletContainerInvoker(PortletInvoker portletContainerInvoker)
+ {
+ this.portletContainerInvoker = portletContainerInvoker;
+ }
+
+ public PortletInvoker getCorePortletInvoker()
+ {
+ return corePortletInvoker;
+ }
+
+ public void setCorePortletInvoker(PortletInvoker corePortletInvoker)
+ {
+ this.corePortletInvoker = corePortletInvoker;
+ }
+
+ /**
+ * Bridge managed object event to add/remove portlet container in portlet container invoker.
+ */
+ protected final ManagedObjectRegistryEventListener bridgeToInvoker = new ManagedObjectRegistryEventListener()
+ {
+ public void onEvent(ManagedObjectRegistryEvent event)
+ {
+ if (event instanceof ManagedObjectEvent)
+ {
+ ManagedObjectEvent managedObjectEvent = (ManagedObjectEvent)event;
+ ManagedObject managedObject = managedObjectEvent.getManagedObject();
+
+ //
+ if (managedObject instanceof PortletContainerLifeCycle)
+ {
+ PortletContainerLifeCycle portletContainerLifeCycle = (PortletContainerLifeCycle)managedObject;
+ PortletContainer portletContainer = portletContainerLifeCycle.getPortletContainer();
+
+ //
+ if (managedObjectEvent instanceof ManagedObjectLifeCycleEvent)
+ {
+ ManagedObjectLifeCycleEvent lifeCycleEvent = (ManagedObjectLifeCycleEvent)managedObjectEvent;
+
+ //
+ LifeCycleStatus status = lifeCycleEvent.getStatus();
+ //
+ if (status == LifeCycleStatus.STARTED)
+ {
+ ((PortletContainerInvoker)portletContainerInvoker).addPortletContainer(portletContainer);
+ }
+ else
+ {
+ ((PortletContainerInvoker)portletContainerInvoker).removePortletContainer(portletContainer);
+ }
+ }
+ }
+ }
+ }
+ };
+
}
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletApplicationContextImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletApplicationContextImpl.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletApplicationContextImpl.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * 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.deployment.jboss;
+
+import org.jboss.portal.portlet.container.PortletApplicationContext;
+import org.jboss.portal.web.WebApp;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletApplicationContextImpl implements PortletApplicationContext
+{
+
+ /** . */
+ private final WebApp webApp;
+
+ public PortletApplicationContextImpl(WebApp webApp)
+ {
+ this.webApp = webApp;
+ }
+
+ public ServletContext getServletContext()
+ {
+ return webApp.getServletContext();
+ }
+
+ public String getContextPath()
+ {
+ return webApp.getContextPath();
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return webApp.getClassLoader();
+ }
+
+ public void managedStart()
+ {
+ // FIXME managedStart
+
+ }
+
+ public void managedStop()
+ {
+ // FIXME managedStop
+
+ }
+}
Deleted: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletApplicationMetaDataFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletApplicationMetaDataFactory.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletApplicationMetaDataFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -1,405 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.deployment.jboss;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.Mode;
-import org.jboss.portal.common.i18n.LocaleFormat;
-import org.jboss.portal.common.util.ConversionException;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.portlet.TransportGuarantee;
-import org.jboss.portal.portlet.impl.jsr168.metadata.CacheConfigMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.ContentTypeMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.DescribableObjectMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.DescriptionMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.DisplayNameMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.LanguagesMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.LocalizedValueMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.ParameterMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PreferenceMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.SecurityConstraintMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.SecurityRoleRefMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.TransportGuaranteesMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.UserAttributeMetaData;
-import org.jboss.xb.binding.GenericObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletApplicationMetaDataFactory implements GenericObjectModelFactory
-{
-
- /** . */
- private static final Logger log = Logger.getLogger(PortletApplicationMetaDataFactory.class);
-
- public Object newRoot(Object root, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
- {
- return new PortletApplicationMetaData();
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String nsURI, String name)
- {
- return root;
- }
-
- public Object newChild(Object object, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
- {
- if (object instanceof DescribableObjectMetaData)
- {
- if ("description".equals(localName))
- {
- String lang = attrs.getValue("xml:lang");
- DescriptionMetaData value = new DescriptionMetaData();
- if (lang != null)
- {
- try
- {
- Locale locale = LocaleFormat.DEFAULT.getLocale(lang);
- value.setLocale(locale);
- }
- catch (ConversionException e)
- {
- log.error("Cannot obtain language value", e);
- return null;
- }
- }
- return value;
- }
- }
- if (object instanceof PortletApplicationMetaData)
- {
- if ("portlet".equals(localName))
- {
- return new PortletMetaData();
- }
- else if ("user-attribute".equals(localName))
- {
- return new UserAttributeMetaData();
- }
- else if ("security-constraint".equals(localName))
- {
- return new SecurityConstraintMetaData();
- }
- }
- if (object instanceof PortletMetaData)
- {
- if ("init-param".equals(localName))
- {
- return new ParameterMetaData();
- }
- else if ("supports".equals(localName))
- {
- return new ContentTypeMetaData();
- }
- else if ("portlet-info".equals(localName))
- {
- return new LanguagesMetaData.InfoMetaData();
- }
- else if ("security-role-ref".equals(localName))
- {
- return new SecurityRoleRefMetaData();
- }
- else if ("preference".equals(localName))
- {
- return new PreferenceMetaData();
- }
- else if ("display-name".equals(localName))
- {
- String lang = attrs.getValue("xml:lang");
- DisplayNameMetaData value = new DisplayNameMetaData();
- if (lang != null)
- {
- try
- {
- Locale locale = LocaleFormat.DEFAULT.getLocale(lang);
- value.setLocale(locale);
- }
- catch (ConversionException e)
- {
- log.error("Cannot obtain language value", e);
- return null;
- }
- }
- return value;
- }
- }
- return null;
- }
-
- public void addChild(Object parent, Object child, UnmarshallingContext nav, String nsURI, String localName)
- {
- if (parent instanceof DescribableObjectMetaData)
- {
- DescribableObjectMetaData describable = (DescribableObjectMetaData)parent;
- if (child instanceof DescriptionMetaData)
- {
- describable.getDescription().getValues().add(child);
- }
- }
- if (parent instanceof PortletApplicationMetaData)
- {
- PortletApplicationMetaData pa = (PortletApplicationMetaData)parent;
- if (child instanceof PortletMetaData)
- {
- pa.addPortlet((PortletMetaData)child);
- }
- else if (child instanceof UserAttributeMetaData)
- {
- UserAttributeMetaData userAttribute = (UserAttributeMetaData)child;
- pa.getUserAttributes().put(userAttribute.getName(), userAttribute);
- }
- else if (child instanceof SecurityConstraintMetaData)
- {
- SecurityConstraintMetaData security = (SecurityConstraintMetaData)child;
- for (Iterator i = security.getPortlets().iterator(); i.hasNext();)
- {
- String portletName = (String)i.next();
- PortletMetaData portlet = pa.getPortlet(portletName);
- if (portlet.getTransportGuarantees() == null)
- {
- portlet.setTransportGuarantees(new TransportGuaranteesMetaData());
- }
- portlet.getTransportGuarantees().add(security.getTransportGuarantee());
- }
-
- }
- }
- if (parent instanceof PortletMetaData)
- {
- PortletMetaData portlet = (PortletMetaData)parent;
- if (child instanceof ParameterMetaData)
- {
- ParameterMetaData parameter = (ParameterMetaData)child;
- portlet.getParameters().put(parameter.getName(), parameter);
- }
- else if (child instanceof ContentTypeMetaData)
- {
- portlet.getContentTypes().addContentType((ContentTypeMetaData)child);
- }
- else if (child instanceof LanguagesMetaData.InfoMetaData)
- {
-
- LanguagesMetaData.InfoMetaData info = (LanguagesMetaData.InfoMetaData)child;
- if (info.getTitle() == null)
- {
- // JBossXB won't populate <title></title>
- info.setTitle("");
- }
- portlet.getLanguages().setInfo(info);
- }
- else if (child instanceof SecurityRoleRefMetaData)
- {
- portlet.getSecurityRoleRefs().add(child);
- }
- else if (child instanceof DisplayNameMetaData)
- {
- portlet.getDisplayName().getValues().add(child);
- }
- }
- if (parent instanceof PortletMetaData)
- {
- PortletMetaData preferences = (PortletMetaData)parent;
- if (child instanceof PreferenceMetaData)
- {
- preferences.getPreferences().addPreference((PreferenceMetaData)child);
- }
- }
- }
-
- public void setValue(Object object, UnmarshallingContext nav, String nsURI, String localName, String value)
- {
- if (object instanceof PortletApplicationMetaData)
- {
- PortletApplicationMetaData app = (PortletApplicationMetaData)object;
- if ("version".equals(localName))
- {
- app.setVersion(value);
- }
- }
- if (object instanceof LocalizedValueMetaData)
- {
- LocalizedValueMetaData localizedValue = (LocalizedValueMetaData)object;
- if ("description".equals(localName))
- {
- localizedValue.setValue(value);
- }
- else if ("display-name".equals(localName))
- {
- localizedValue.setValue(value);
- }
- }
- if (object instanceof PortletMetaData)
- {
- PortletMetaData portlet = (PortletMetaData)object;
- if ("portlet-name".equals(localName))
- {
- portlet.setName(value);
- }
- else if ("portlet-class".equals(localName))
- {
- portlet.setClassName(value);
- }
- else if ("expiration-cache".equals(localName))
- {
- CacheConfigMetaData cacheConfig = portlet.getCacheConfig();
- if (cacheConfig == null)
- {
- cacheConfig = new CacheConfigMetaData();
- portlet.setCacheConfig(cacheConfig);
- }
- int timeMillis = Integer.parseInt(value);
- cacheConfig.setExpirationTime(timeMillis);
- }
- else if ("resource-bundle".equals(localName))
- {
- portlet.getLanguages().setResourceBundle(value);
- }
- else if ("supported-locale".equals(localName))
- {
- try
- {
- Locale locale = LocaleFormat.DEFAULT.getLocale(value);
- portlet.getLanguages().getSupportedLocales().add(locale);
- }
- catch (ConversionException e)
- {
- log.error("Cannot obtain language value", e);
- }
- }
- else if ("preferences-validator".equals(localName))
- {
- portlet.getPreferences().setValidator(value);
- }
- }
- if (object instanceof ParameterMetaData)
- {
- ParameterMetaData parameter = (ParameterMetaData)object;
- if ("name".equals(localName))
- {
- parameter.setName(value);
- }
- else if ("value".equals(localName))
- {
- parameter.setValue(value);
- }
- }
- if (object instanceof ContentTypeMetaData)
- {
- ContentTypeMetaData contentType = (ContentTypeMetaData)object;
- if ("mime-type".equals(localName))
- {
- contentType.setContentType(value);
- }
- else if ("portlet-mode".equals(localName))
- {
- contentType.getModes().add(Mode.create(value));
- }
- }
- if (object instanceof LanguagesMetaData.InfoMetaData)
- {
- LanguagesMetaData.InfoMetaData info = (LanguagesMetaData.InfoMetaData)object;
- if ("title".equals(localName))
- {
- info.setTitle(value);
- }
- else if ("short-title".equals(localName))
- {
- info.setShortTitle(value);
- }
- else if ("keywords".equals(localName))
- {
- info.setKeywords(value);
- }
- }
- if (object instanceof PreferenceMetaData)
- {
- PreferenceMetaData preference = (PreferenceMetaData)object;
- if ("name".equals(localName))
- {
- preference.setName(value);
- }
- else if ("value".equals(localName))
- {
- List tmp = Tools.toList(preference.getValues());
- tmp.add(value);
- preference.setValues((String[])tmp.toArray(new String[tmp.size()]));
- }
- else if ("read-only".equals(localName))
- {
- if ("true".equalsIgnoreCase(value))
- {
- preference.setReadOnly(true);
- }
- else if ("false".equalsIgnoreCase(value))
- {
- preference.setReadOnly(false);
- }
- else
- {
- throw new RuntimeException("Unrecognized read only value" + value);
- }
- }
- }
- if (object instanceof SecurityRoleRefMetaData)
- {
- SecurityRoleRefMetaData srr = (SecurityRoleRefMetaData)object;
- if ("role-name".equals(localName))
- {
- srr.setRoleName(value);
- }
- else if ("role-link".equals(localName))
- {
- srr.setRoleLink(value);
- }
- }
- if (object instanceof UserAttributeMetaData)
- {
- UserAttributeMetaData userAttribute = (UserAttributeMetaData)object;
- if ("name".equals(localName))
- {
- userAttribute.setName(value);
- }
- }
- else if (object instanceof SecurityConstraintMetaData)
- {
- SecurityConstraintMetaData security = (SecurityConstraintMetaData)object;
- if ("portlet-name".equals(localName))
- {
- security.addPortlet(value);
- }
- if ("transport-guarantee".equals(localName))
- {
- security.setTransportGuarantee(TransportGuarantee.decode(value));
- }
- }
- }
-}
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerContextImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerContextImpl.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerContextImpl.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * 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.deployment.jboss;
+
+import org.jboss.portal.portlet.container.PortletContainerContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletContainerContextImpl implements PortletContainerContext
+{
+
+ public void managedStart()
+ {
+ // FIXME managedStart
+
+ }
+
+ public void managedStop()
+ {
+ // FIXME managedStop
+
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletFilterContextImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletFilterContextImpl.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletFilterContextImpl.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * 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.deployment.jboss;
+
+import org.jboss.portal.portlet.container.PortletFilterContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletFilterContextImpl implements PortletFilterContext
+{
+
+ public void managedStart()
+ {
+ // FIXME managedStart
+
+ }
+
+ public void managedStop()
+ {
+ // FIXME managedStop
+
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/ContainerCacheInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/ContainerCacheInfo.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/ContainerCacheInfo.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,77 @@
+/******************************************************************************
+ * 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.deployment.jboss.info;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.portal.portlet.info.CacheInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6697 $
+ */
+public class ContainerCacheInfo implements CacheInfo
+{
+
+ /** Cache uses strong references. */
+ public static int REF_STRONG = 0;
+
+ /** Cache uses soft references. */
+ public static int REF_SOFT = 1;
+
+ /** . */
+ private static Logger log = Logger.getLogger(ContainerCacheInfo.class);
+
+ /** . */
+ private int expirationTimeSecs;
+
+ /** . */
+ private int referenceType;
+
+ public ContainerCacheInfo(PortletMetaData portletMD, JBossPortletMetaData jbossPortletMD)
+ {
+ expirationTimeSecs = portletMD.getExpirationCache();
+ if (expirationTimeSecs < 0 && expirationTimeSecs != -1)
+ {
+ log.warn("Seen bad caching expiration value " + expirationTimeSecs + " disable caching instead");
+ expirationTimeSecs = 0;
+ }
+
+ referenceType = REF_STRONG;
+ if (jbossPortletMD != null)
+ {
+ referenceType = jbossPortletMD.getCacheRefType() == null ? REF_STRONG : jbossPortletMD.getCacheRefType().intValue();
+ }
+ }
+
+ public int getExpirationSecs()
+ {
+ return expirationTimeSecs;
+ }
+
+ public int getReferenceType()
+ {
+ return referenceType;
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/ContainerPortletInfoWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/ContainerPortletInfoWrapper.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/ContainerPortletInfoWrapper.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.deployment.jboss.info;
+
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface ContainerPortletInfoWrapper extends PortletInfo
+{
+ public ContainerPortletInfo getContainerPortletInfo();
+}
+
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/PortletInfoFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/PortletInfoFactory.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/info/PortletInfoFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * 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.deployment.jboss.info;
+
+import org.jboss.portal.common.i18n.ResourceBundleManager;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
+import org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.portal.portlet.info.PortletInfo;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface PortletInfoFactory
+{
+ public PortletInfo createPortletInfo(
+ PortletApplicationContext portletApplicationContext,
+ PortletMetaData portletMD,
+ JBossPortletMetaData jbossPortletMD,
+ ResourceBundleManager resourceBundleManager);
+}
+
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossApplicationMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossApplicationMetaData.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossApplicationMetaData.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -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.deployment.jboss.metadata;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class JBossApplicationMetaData
+{
+
+ /** . */
+ protected Boolean remotable;
+
+ /** . */
+ protected Map portlets;
+
+ public JBossApplicationMetaData()
+ {
+ portlets = new LinkedHashMap();
+ }
+
+ public Map getPortlets()
+ {
+ return portlets;
+ }
+
+ public Boolean getRemotable()
+ {
+ return remotable;
+ }
+
+ public void setRemotable(Boolean remotable)
+ {
+ this.remotable = remotable;
+ }
+}
Property changes on: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossApplicationMetaData.java
___________________________________________________________________
Name: svn:executable
+ *
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossPortletMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossPortletMetaData.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossPortletMetaData.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,163 @@
+/******************************************************************************
+ * 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.deployment.jboss.metadata;
+
+import org.jboss.portal.common.transaction.Transactions;
+
+/**
+ * Specific metadata specified to jboss portlet container.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7226 $
+ */
+public class JBossPortletMetaData implements Cloneable
+{
+
+ /** . */
+ private String name;
+
+ /** . */
+ private Boolean remotable;
+
+ /** . */
+ private SecurityConstraintMetaData securityConstraint;
+
+ /** . */
+ private Integer cacheRefType;
+
+ /** . */
+ private Transactions.Type txType;
+
+ /** . */
+ private Boolean distributed;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Boolean getRemotable()
+ {
+ return remotable;
+ }
+
+ public void setRemotable(Boolean remotable)
+ {
+ this.remotable = remotable;
+ }
+
+ public Boolean getDistributed()
+ {
+ return distributed;
+ }
+
+ public void setDistributed(Boolean distributed)
+ {
+ this.distributed = distributed;
+ }
+
+ public SecurityConstraintMetaData getSecurityConstraint()
+ {
+ return securityConstraint;
+ }
+
+ public void setSecurityConstraint(SecurityConstraintMetaData securityConstraint)
+ {
+ this.securityConstraint = securityConstraint;
+ }
+
+ public Integer getCacheRefType()
+ {
+ return cacheRefType;
+ }
+
+ public void setCacheRefType(Integer cacheRefType)
+ {
+ this.cacheRefType = cacheRefType;
+ }
+
+ public Transactions.Type getTxType()
+ {
+ return txType;
+ }
+
+ public void setTxType(Transactions.Type txType)
+ {
+ this.txType = txType;
+ }
+
+ /**
+ * Merge the current meta data with portlet application.
+ */
+ public void merge(JBossApplicationMetaData application)
+ {
+ if (remotable == null)
+ {
+ remotable = application.getRemotable();
+ }
+ }
+
+ /**
+ * Merge the current meta data with a specified one.
+ */
+ public void merge(JBossPortletMetaData portlet)
+ {
+ if (remotable == null)
+ {
+ remotable = portlet.getRemotable();
+ }
+ if (txType == null)
+ {
+ txType = portlet.getTxType();
+ }
+ if (cacheRefType == null)
+ {
+ cacheRefType = portlet.getCacheRefType();
+ }
+ if (securityConstraint == null)
+ {
+ securityConstraint = portlet.getSecurityConstraint();
+ }
+ if (distributed == null)
+ {
+ distributed = portlet.getDistributed();
+ }
+ }
+
+ public Object clone()
+ {
+ try
+ {
+ return super.clone();
+ }
+ catch (CloneNotSupportedException e)
+ {
+ throw new Error(e);
+ }
+ }
+}
Property changes on: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/JBossPortletMetaData.java
___________________________________________________________________
Name: svn:executable
+ *
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/PolicyPermissionMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/PolicyPermissionMetaData.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/PolicyPermissionMetaData.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -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.deployment.jboss.metadata;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PolicyPermissionMetaData
+{
+
+ private String roleName;
+ private Set actions;
+
+ public PolicyPermissionMetaData()
+ {
+ actions = new HashSet();
+ }
+
+ public String getRoleName()
+ {
+ return roleName;
+ }
+
+ public void setRoleName(String roleName)
+ {
+ this.roleName = roleName;
+ }
+
+ public Set getActions()
+ {
+ return actions;
+ }
+
+ public void setActions(Set actions)
+ {
+ this.actions = actions;
+ }
+}
Property changes on: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/PolicyPermissionMetaData.java
___________________________________________________________________
Name: svn:executable
+ *
Added: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/SecurityConstraintMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/SecurityConstraintMetaData.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/SecurityConstraintMetaData.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -0,0 +1,51 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.deployment.jboss.metadata;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class SecurityConstraintMetaData
+{
+
+ private Map policyPermissions;
+
+ public SecurityConstraintMetaData()
+ {
+ policyPermissions = new LinkedHashMap();
+ }
+
+ public Map getPolicyPermissions()
+ {
+ return policyPermissions;
+ }
+
+ public void setPolicyPermissions(Map policyPermissions)
+ {
+ this.policyPermissions = policyPermissions;
+ }
+}
Property changes on: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/metadata/SecurityConstraintMetaData.java
___________________________________________________________________
Name: svn:executable
+ *
Modified: branches/JBoss_Portal_Branch_2_7/server/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/server/.classpath 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/server/.classpath 2008-03-06 11:10:42 UTC (rev 10228)
@@ -16,5 +16,7 @@
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/web/lib/portal-web-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/test/lib/portal-test-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/test/lib/portal-test-jboss-lib.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/module-portlet"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar" sourcepath="/module-portlet"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/server/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/server/build.xml 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/server/build.xml 2008-03-06 11:10:42 UTC (rev 10228)
@@ -91,6 +91,7 @@
<echo message="${sun.servlet.lib}"/>
<path id="library.classpath">
<path refid="jboss.portal/modules/common.classpath"/>
+ <path refid="jboss.portal/modules/portlet.classpath"/>
<path refid="jboss.portal/modules/web.classpath"/>
<path refid="jboss.portal/modules/test.classpath"/>
<pathelement location="${jboss.portal/modules/test.lib}/portal-test-jboss-lib.jar"/>
Modified: branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/deployment/PortalWebApp.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/deployment/PortalWebApp.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/deployment/PortalWebApp.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -26,6 +26,7 @@
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.xml.NullEntityResolver;
import org.jboss.portal.common.xml.XMLTools;
+import org.jboss.portal.web.WebApp;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.EntityResolver;
@@ -47,7 +48,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public abstract class PortalWebApp
+public abstract class PortalWebApp implements WebApp
{
/** The logger. */
Modified: branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/deployment/jboss/AbstractDeploymentFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/deployment/jboss/AbstractDeploymentFactory.java 2008-03-06 01:31:53 UTC (rev 10227)
+++ branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/deployment/jboss/AbstractDeploymentFactory.java 2008-03-06 11:10:42 UTC (rev 10228)
@@ -22,12 +22,17 @@
******************************************************************************/
package org.jboss.portal.server.deployment.jboss;
+import org.jboss.deployment.DeploymentException;
import org.jboss.logging.Logger;
import org.jboss.portal.common.net.URLFilter;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.server.deployment.PortalWebApp;
+import org.jboss.portal.web.WebApp;
import java.net.URL;
+import javax.management.MBeanServer;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -167,4 +172,14 @@
{
setupURL = null;
}
+
+ public Deployment newInstance(URL url, PortalWebApp pwa, MBeanServer mbeanServer) throws DeploymentException
+ {
+ return newInstance(url, pwa, null, mbeanServer);
+ }
+
+ public Deployment newInstance(URL url, PortalWebApp pwa, WebApp webApp, MBeanServer mbeanServer) throws DeploymentException
+ {
+ return newInstance(url, pwa, null, mbeanServer);
+ }
}
16 years, 3 months