Package org.exoplatform.container

Examples of org.exoplatform.container.ExoContainer


    public void onStartRequest(Application app, WebuiRequestContext context) throws Exception {
        if (context instanceof PortalRequestContext == false)
            throw new IllegalArgumentException("Expected PortalRequestContext, but got: " + context);

        PortalRequestContext reqCtx = (PortalRequestContext) context;
        ExoContainer container = app.getApplicationServiceContainer();

        LocaleConfigService localeConfigService = (LocaleConfigService) container
                .getComponentInstanceOfType(LocaleConfigService.class);
        LocalePolicy localePolicy = (LocalePolicy) container.getComponentInstanceOfType(LocalePolicy.class);

        LocaleContextInfo localeCtx = new LocaleContextInfo();

        Set<Locale> supportedLocales = new HashSet<Locale>();
        for (LocaleConfig lc : localeConfigService.getLocalConfigs()) {
            supportedLocales.add(lc.getLocale());
        }
        localeCtx.setSupportedLocales(supportedLocales);

        HttpServletRequest request = HttpServletRequest.class.cast(context.getRequest());
        localeCtx.setBrowserLocales(Collections.list(request.getLocales()));
        localeCtx.setCookieLocales(getCookieLocales(request));
        localeCtx.setSessionLocale(getSessionLocale(request));
        localeCtx.setUserProfileLocale(getUserProfileLocale(reqCtx));
        localeCtx.setRemoteUser(reqCtx.getRemoteUser());

        DataStorage dataStorage = (DataStorage) container.getComponentInstanceOfType(DataStorage.class);
        PortalConfig pConfig = null;
        try {
            pConfig = dataStorage.getPortalConfig(SiteType.PORTAL.getName(), reqCtx.getPortalOwner());
            if (pConfig == null)
                log.warn("No UserPortalConfig available! Portal locale set to 'en'");
View Full Code Here


    public void setAccessPermissions(String[] accessPermissions) {
        this.accessPermissions = accessPermissions;
    }

    public boolean hasPermission() {
        ExoContainer exoContainer = ExoContainerContext.getCurrentContainer();
        UserACL acl = (UserACL) exoContainer.getComponentInstanceOfType(UserACL.class);
        for (String per : accessPermissions) {
            if (acl.hasPermission(per)) {
                return true;
            }
        }
View Full Code Here

        result.replace(0, 1, result.substring(0, 1).toUpperCase());
        return result.toString();
    }

    private ResourceBundle getResourceBundle(Locale locale) {
        ExoContainer appContainer = ExoContainerContext.getCurrentContainer();
        ResourceBundleService service = (ResourceBundleService) appContainer
                .getComponentInstanceOfType(ResourceBundleService.class);
        ResourceBundle res = service.getResourceBundle("locale.portal.webui", locale);
        return res;
    }
View Full Code Here

                prqCtx.sendRedirect(url.toString());
            }
        }

        private void saveLocaleToUserProfile(PortalRequestContext context) throws Exception {
            ExoContainer container = context.getApplication().getApplicationServiceContainer();
            OrganizationService svc = (OrganizationService) container.getComponentInstanceOfType(OrganizationService.class);

            // Don't rely on UserProfileLifecycle loaded UserProfile when doing
            // an update to avoid a potential overwrite of other changes
            UserProfile userProfile = svc.getUserProfileHandler().findUserProfileByName(context.getRemoteUser());
            if (userProfile != null && userProfile.getUserInfoMap() != null) {
View Full Code Here

        this.pageSize = pageSize;
    }

    public boolean hasNext() {
        if (hasNext && currentIndex == 0) {
            ExoContainer container = PortalContainer.getInstance();
            PageService pageService = (PageService) container.getComponentInstance(PageService.class);
            QueryResult<PageContext> result = pageService.findPages(0, 1, SiteType.valueOf(ownerType.toUpperCase()), ownerId,
                    name, title);

            hasNext = result.getSize() > 0;
        }
View Full Code Here

    /**
     *
     * @return Returns a list of pages or returns null if has not any page.
     */
    public List<PageModel> next() {
        ExoContainer container = PortalContainer.getInstance();
        PageService pageService = (PageService) container.getComponentInstance(PageService.class);
        QueryResult<PageContext> result = pageService.findPages(currentIndex, pageSize + 1,
                SiteType.valueOf(ownerType.toUpperCase()), ownerId, name, title);

        int size = result.getSize();
        hasNext = size > pageSize;
View Full Code Here

        result.replace(0, 1, result.substring(0, 1).toUpperCase());
        return result.toString();
    }

    private ResourceBundle getResourceBundle(Locale locale) {
        ExoContainer appContainer = ExoContainerContext.getCurrentContainer();
        ResourceBundleService service = (ResourceBundleService) appContainer
                .getComponentInstanceOfType(ResourceBundleService.class);
        ResourceBundle res = service.getResourceBundle("locale.portal.webui", locale);
        return res;
    }
View Full Code Here

    */
   protected void renderTemplate(String template, WebuiBindingContext bcontext) throws Exception
   {
      bcontext.put("decorator", decorator_);
      WebuiRequestContext context = bcontext.getRequestContext();
      ExoContainer pcontainer = context.getApplication().getApplicationServiceContainer();
      TemplateService service = (TemplateService)pcontainer.getComponentInstanceOfType(TemplateService.class);
      ResourceResolver resolver = bcontext.getResourceResolver();

      if (PropertyManager.isDevelopping())
      {
         WebuiRequestContext rootContext = (WebuiRequestContext)context.getParentAppRequestContext();
View Full Code Here

   }

   public <T> T getApplicationComponent(Class<T> type)
   {
      WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
      ExoContainer container = context.getApplication().getApplicationServiceContainer();
      return type.cast(container.getComponentInstanceOfType(type));
   }
View Full Code Here

   static final String NAME = "JobContextConfigListener";

   public void jobToBeExecuted(JobExecutionContext context)
   {
      String containerName = extractContainerName(context);
      ExoContainer container = null;
      if (containerName != null)
      {
         if (containerName.equals(JobSchedulerServiceImpl.STANDALONE_CONTAINER_NAME))
         {
            container = ExoContainerContext.getTopContainer();           
         }
         else
         {
            RootContainer rootContainer = RootContainer.getInstance();
            container = (ExoContainer)rootContainer.getComponentInstance(containerName);           
         }
      }
      if (container != null)
      {
         ExoContainerContext.setCurrentContainer(container);           
         List<ComponentRequestLifecycle> components =
            container.getComponentInstancesOfType(ComponentRequestLifecycle.class);
         for (ComponentRequestLifecycle component : components)
         {
            component.startRequest(container);
         }
      }
View Full Code Here

TOP

Related Classes of org.exoplatform.container.ExoContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.