// retrieve federating portlet invoker from container
FederatingPortletInvoker federatingPortletInvoker = (FederatingPortletInvoker) container
.getComponentInstanceOfType(FederatingPortletInvoker.class);
// add our Session event listener to the ListenerService for use in org.exoplatform.web.GenericHttpListener
ListenerService listenerService = (ListenerService) container.getComponentInstanceOfType(ListenerService.class);
SessionEventListenerAndBroadcaster sessionEventBroadcaster = new SessionEventListenerAndBroadcaster();
// events from org.exoplatform.web.GenericHttpListener
listenerService.addListener("org.exoplatform.web.GenericHttpListener.sessionCreated", sessionEventBroadcaster);
listenerService.addListener("org.exoplatform.web.GenericHttpListener.sessionDestroyed", sessionEventBroadcaster);
try {
JCRPersister persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
persister.initializeBuilderFor(JCRConsumerRegistry.mappingClasses);
consumerRegistry = new JCRConsumerRegistry(persister);
consumerRegistry.setFederatingPortletInvoker(federatingPortletInvoker);
consumerRegistry.setSessionEventBroadcaster(sessionEventBroadcaster);
consumerRegistry.setConfigurationIS(consumersConfigurationIS);
// if we run in a cluster, use a distributed cache for consumers
/*
* if (ExoContainer.getProfiles().contains("cluster")) { CacheService cacheService =
* (CacheService)container.getComponentInstanceOfType(CacheService.class); DistributedConsumerCache consumerCache =
* new DistributedConsumerCache(cacheService); consumerRegistry.setConsumerCache(consumerCache); }
*/
// create ConsumerStructureProvider and register it to listen to page events
POMSessionManager sessionManager = (POMSessionManager) container
.getComponentInstanceOfType(POMSessionManager.class);
PortalStructureAccess structureAccess = new MOPPortalStructureAccess(sessionManager);
MOPConsumerStructureProvider structureprovider = new MOPConsumerStructureProvider(structureAccess);
listenerService.addListener(EventType.PAGE_CREATED, structureprovider);
listenerService.addListener(EventType.PAGE_DESTROYED, structureprovider);
listenerService.addListener(EventType.PAGE_UPDATED, structureprovider);
listenerService.addListener(DataStorage.PAGE_UPDATED, structureprovider);
// migration service
persister = new JCRPersister(container, JCRPersister.WSRP_WORKSPACE_NAME);
persister.initializeBuilderFor(JCRMigrationService.mappingClasses);