}
public void start()
{
// The portlet container invoker used by producer to dispatch to portlets
ContainerPortletInvoker containerPortletInvoker = new ContainerPortletInvoker();
// The portlet application deployer
portletApplicationRegistry = new ExoPortletApplicationDeployer();
portletApplicationRegistry.setContainerPortletInvoker(containerPortletInvoker);
// activate schema validation for portlet.xml if needed
String validation = PropertyManager.getProperty("gatein.portlet.validation");
boolean validated = validation == null || "true".equals(validation.trim().toLowerCase());
log.debug("portlet xml validation is " + (validated ? "enabled" : " disabled"));
portletApplicationRegistry.setSchemaValidated(validated);
//Container Stack
ContainerPortletDispatcher portletContainerDispatcher = new ContainerPortletDispatcher();
// Check if we already have a federating portlet invoker
final ExoContainer topContainer = ExoContainerContext.getTopContainer();
FederatingPortletInvoker federatingPortletInvoker = (FederatingPortletInvoker)topContainer.getComponentInstanceOfType(FederatingPortletInvoker.class);
if (federatingPortletInvoker == null)
{
federatingPortletInvoker = new FederatingPortletInvokerService();
topContainer.registerComponentInstance(FederatingPortletInvoker.class, federatingPortletInvoker);
}
EventPayloadInterceptor eventPayloadInterceptor = new EventPayloadInterceptor();
eventPayloadInterceptor.setNext(portletContainerDispatcher);
RequestAttributeConversationInterceptor requestAttributeConversationInterceptor =
new RequestAttributeConversationInterceptor();
requestAttributeConversationInterceptor.setNext(eventPayloadInterceptor);
CCPPInterceptor ccppInterceptor = new CCPPInterceptor();
ccppInterceptor.setNext(requestAttributeConversationInterceptor);
BridgeInterceptor bridgepInterceptor = new BridgeInterceptor();
bridgepInterceptor.setNext(ccppInterceptor);
ProducerCacheInterceptor producerCacheInterceptor = new ProducerCacheInterceptor();
producerCacheInterceptor.setNext(bridgepInterceptor);
SessionInvalidatorInterceptor sessionInvalidatorInterceptor = new SessionInvalidatorInterceptor();
sessionInvalidatorInterceptor.setNext(producerCacheInterceptor);
ContextDispatcherInterceptor contextDispatcherInterceptor = new ContextDispatcherInterceptor();
contextDispatcherInterceptor.setNext(sessionInvalidatorInterceptor);
SecureTransportInterceptor secureTransportInterceptor = new SecureTransportInterceptor();
secureTransportInterceptor.setNext(contextDispatcherInterceptor);
ValveInterceptor valveInterceptor = new ValveInterceptor();
valveInterceptor.setPortletApplicationRegistry(portletApplicationRegistry);
valveInterceptor.setNext(secureTransportInterceptor);
portletApplicationRegistry.setServletContainerFactory(DefaultServletContainerFactory.getInstance());
contextDispatcherInterceptor.setServletContainerFactory(DefaultServletContainerFactory.getInstance());
// The portlet container invoker continued
containerPortletInvoker.setNext(valveInterceptor);
// register container invoker so that WSRP can use it, WSRP uses its own ProducerPortletInvoker
container.registerComponentInstance(ContainerPortletInvoker.class, containerPortletInvoker);
// The producer persistence manager