@Override public boolean isActive() { PortletSessionBeanHolder holder = PortletSessionBeanHolder.getBeanHolder(); return (holder != null); }
@Override public <T> T get(Contextual<T> bean) { PortletSessionBeanHolder holder = PortletSessionBeanHolder.getBeanHolder(); if (holder == null) { throw new ContextNotActiveException("The portlet session context is not active."); } return holder.getBean(bean); }
@Override public <T> T get(Contextual<T> bean, CreationalContext<T> crco) { PortletSessionBeanHolder holder = PortletSessionBeanHolder.getBeanHolder(); if (holder == null) { throw new ContextNotActiveException("The portlet session context is not active."); } T inst = holder.getBean(bean); if (inst == null) { inst = bean.create(crco); holder.putBeanInstance(bean, crco, inst); } return inst; }