/** * To be called by the CDI extension afterDeploymentValidation method to * verify that the stored methods are consistent and to create the bean references. * * @param bm BeanManager needed to activate the beans. * @throws InvalidAnnotationException If the deployment is inconsistent or if the * beans cannot be instantiated. */ @Override protected void activateCustomScopes(BeanManager bm) { // Activate the custom scoped beans stateScopedConfig.activate(bm); sessionScopedConfig.activate(bm); }
/** * Gets the concrete contextual for the bean and puts it into the context map. * Called after bean discovery during the activation process. * Finishes up the configuration process and provides a debug summary. * * @param bm The bean manager */ public void activate(BeanManager bm) { // Activate the beans for (Class<?> cls : class2Anno.keySet()) { Set<Bean<?>> beans = bm.getBeans(cls); Bean<?> bean = bm.resolve(beans); assert bean != null; context2Anno.put(bean, class2Anno.get(cls)); } // dump configuration data to trace if (isTrace) { StringBuilder txt = new StringBuilder(128); txt.append("PortletSessionScopedBeanHolder configuration. "); txt.append(" AnnotatedBeans: "); txt.append(getConfigAsString()); LOG.debug(txt.toString()); } }
/** * Returns an instance for the contextual type, or null if none available. * * @param bean * Contextual type (Bean) for which an instance is desired * @return The instance, or null if none exists */ public <T> T getBean(Contextual<T> bean) { String id = null; if (config.isPortletScoped(bean)) { id = windowId; } return beans.getBeanInstance(id, bean); }
summary.addSessionBeanErrorString(theClass, txt.toString()); } else { sessionScopedConfig.addAnnotation(theClass, pss); sessionScopedConfig.addAnnotation(theClass, pss); summary.addAppScopedType(at); return at;
acb = (AnnotatedConfigBean) beanmgr.getReference(bean, bean.getBeanClass(), beanmgr.createCreationalContext(bean)); LOG.debug("ACB instance: " + acb + ", RS config: " + ((acb==null) ? "null" : acb.getSessionScopedConfig())); acb.getSessionScopedConfig().activate(beanmgr); acb.getStateScopedConfig().activate(beanmgr); } catch (Throwable t) {
/** * Adds a bean instance with associated creational context to the store for the given contextual object (bean). * * @param bean * The bean type * @param crco * The creational context * @param instance * The bean instance */ public <T> void putBeanInstance(Contextual<T> bean, CreationalContext<T> crco, T instance) { String id = null; if (config.isPortletScoped(bean)) { id = windowId; } beans.putBeanInstance(id, bean, crco, instance); } }