1 5 package org.exoplatform.portal; 6 7 import org.exoplatform.container.SessionContainer; 8 import org.exoplatform.portal.session.RequestInfo; 9 import org.exoplatform.container.SessionContainerInitializer; 10 import org.exoplatform.services.log.LogUtil; 11 import org.exoplatform.services.organization.OrganizationService; 12 import org.exoplatform.services.organization.UserProfile; 13 import org.exoplatform.portal.session.ExoPortal ; 14 import org.exoplatform.portal.faces.component.UIPortal ; 15 import org.exoplatform.portal.faces.component.PortalComponentCache ; 16 21 public class PortalSessionInitializer implements SessionContainerInitializer { 22 23 public void initialize(SessionContainer container) { 24 try { 25 OrganizationService orgService = 27 (OrganizationService) container.getComponentInstanceOfType(OrganizationService.class) ; 28 UserProfile userProfile = orgService.findUserProfileByName(container.getOwner()); 29 if(userProfile == null) userProfile = orgService.createUserProfileInstance() ; 30 container.registerComponentInstance(userProfile.getClass(), userProfile) ; 31 32 container.registerComponentInstance(new RequestInfo()) ; 33 container.registerComponentImplementation(PortalComponentCache.class) ; 34 container.registerComponentImplementation(ExoPortal.class, UIPortal.class) ; 35 } catch (Exception ex) { 36 LogUtil.getLog(getClass()).error("Error in PortalSessionInitializer", ex) ; 37 } 38 } 39 } 40 | Popular Tags |