Examples of BeanManager


Examples of com.liferay.faces.bridge.bean.BeanManager

        // For each session attribute:
        String appConfigAttrName = ApplicationConfig.class.getName();
        ServletContext servletContext = httpSession.getServletContext();
        ApplicationConfig applicationConfig = (ApplicationConfig) servletContext.getAttribute(
            appConfigAttrName);
        BeanManager beanManager = beanManagerFactory.getBeanManager(applicationConfig.getFacesConfig());

        try {

          Enumeration<String> attributeNames = (Enumeration<String>) httpSession.getAttributeNames();

          while (attributeNames.hasMoreElements()) {

            String attributeName = attributeNames.nextElement();

            // If the current session attribute name is namespaced with the standard portlet prefix, then it
            // is an attribute that was set using PortletSession.setAttribute(String, Object).
            if ((attributeName != null) && attributeName.startsWith("javax.portlet.p.")) {
              int pos = attributeName.indexOf("?");

              if (pos > 0) {
                Object attributeValue = httpSession.getAttribute(attributeName);
                httpSession.removeAttribute(attributeName);

                if (attributeValue != null) {

                  // If the current session attribute value is a JSF managed-bean, then cleanup the
                  // bean by invoking methods annotated with {@link PreDestroy}. Note that in a
                  // webapp/servlet environment, the cleanup is handled by the Mojarra
                  // WebappLifecycleListener.sessionDestroyed(HttpSessionEvent) method. But in a
                  // portlet environment, Mojarra fails to recognize the session attribute as
                  // managed-bean because the attribute name contains the standard portlet prefix. An
                  // alternative approach would be to have the bridge rename the attribute (by
                  // stripping off the standard portlet prefix) so that Mojarra could find it. But
                  // this would not a good solution, because multiple instances of the same portlet
                  // would have the same session attribute names for managed-beans, and only the last
                  // one would get cleaned-up by Mojarra.
                  if (beanManager.isManagedBean(attributeName, attributeValue)) {
                    beanManager.invokePreDestroyMethods(attributeValue, true);
                  }

                  // Otherwise,
                  else {
View Full Code Here

Examples of com.sun.ebank.web.BeanManager

      this.context = null;
   }

   public void contextInitialized(ServletContextEvent event) {
      this.context = event.getServletContext();
      context.setAttribute("beanManager", new BeanManager());
      context.log("contextInitialized()");
   }
View Full Code Here

Examples of com.sun.faces.mgbean.BeanManager

                    session.invalidate();
                }
            }
            ApplicationAssociate associate = ApplicationAssociate.getInstance(sc);
            if (associate != null) {
                BeanManager manager = associate.getBeanManager();
                for (Map.Entry<String,BeanBuilder> entry : manager.getRegisteredBeans().entrySet()) {
                    String name = entry.getKey();
                    BeanBuilder bean = entry.getValue();
                    if (bean.getScope() == ELUtils.Scope.APPLICATION) {
                        if (LOGGER.isLoggable(Level.INFO)) {
                            LOGGER.log(Level.INFO,
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

   public void bindToJavaComp()
   {
      try
      {
         Context compContext = getJavaCompContext();
         BeanManager beanManagerContext = null;
         try
         {
            beanManagerContext = (BeanManager) compContext.lookup("BeanManager");
         } catch (NamingException e)
         {
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

      BeanDeploymentArchive archive = deployment.getBeanDeploymentArchives().iterator().next();
     
      if (deployment.getBeanDeploymentArchives().size() > 1)
         log.warn("More than one bean deployment archives, using the first " + archive);
     
      BeanManager manager = bootstrapBean.getBootstrap().getManager(archive);
      if (manager == null)
         throw new IllegalStateException("Could not find a manager for archive " + null);
     
      //When the created weld kernel controller context is installed, call installCreatedBean() which removes
      //this bean from the controller
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

      Method m = context.getTarget().getClass().getMethod("getBootstrap");
      Object o = m.invoke(context.getTarget());
      assertNotNull(o);
      assertInstanceOf(o, Bootstrap.class);
     
      BeanManager manager = ((Bootstrap)o).getManager(getBeanDeploymentArchive(unit));
      assertNotNull(manager);
      return manager;
   }
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

         assertNotNull(flatDeployment);

         //Check the bootstrap bean has been installed
         assertNotNull(getControllerContext(DeployersUtils.getBootstrapBeanName(earDU)));

         BeanManager manager = getBeanManager(earDU);
        
         if (test != null)
            test.runTest(manager, earDU);
      }
      finally
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

    *
    * @return BeanManager instance
    */
   protected BeanManager lookupBeanManager()
   {
      BeanManager beanManager = null;

      // Do a lookup for BeanManager in JNDI (this is the only *portable* way)
      beanManager = lookupBeanManagerInJndi("java:comp/BeanManager");
      if (beanManager != null)
      {
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

        if (catchUnavailable) {
            log.trace("Catch integration previously disabled");
            return parent.getExceptionHandler();
        }

        BeanManager beanManager = null;
        try {
            locator = new BeanManagerLocator();
            beanManager = locator.getBeanManager();
        } catch (BeanManagerUnavailableException e) {
            log.info("Could not location BeanManager, Catch integration disabled");
            catchUnavailable = true;
            return parent.getExceptionHandler();
        }

        // TODO this looks like a nice utility for Solder
        if (beanManager.getBeans(CatchExceptionHandler.class).isEmpty()) {
            log.info("Catch not available, Catch integration disabled");
            catchUnavailable = true;
            return parent.getExceptionHandler();
        }
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

        return parent.getNavigationCases();
    }

    @Override
    public void handleNavigation(final FacesContext context, final String fromAction, final String outcome) {
        BeanManager manager = new BeanManagerLocator().getBeanManager();
        NavigationHandler navigationHandler = context.getApplication().getNavigationHandler();

        NavigationCase navigationCase;
        if (navigationHandler instanceof ConfigurableNavigationHandler) {
            navigationCase = ((ConfigurableNavigationHandler) navigationHandler)
                    .getNavigationCase(context, fromAction, outcome);
        } else {
            navigationCase = getNavigationCase(context, fromAction, outcome);
        }
        manager.fireEvent(new PreNavigateEvent(context, fromAction, outcome, navigationCase));
        parent.handleNavigation(context, fromAction, outcome);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.