Package javax.enterprise.context.spi

Examples of javax.enterprise.context.spi.Context


   */
  public void addContext(Context context)
  {
    Class<? extends Annotation> scopeType = context.getScope();
   
    Context oldContext = _contextMap.get(scopeType);
   
    if (oldContext == null) {
      _contextMap.put(context.getScope(), context);
    }
    else {
View Full Code Here


   * Returns the scope context for the given type
   */
  @Override
  public Context getContext(Class<? extends Annotation> scopeType)
  {
    Context context = _contextMap.get(scopeType);

    if (context != null && context.isActive()) {
      return context;
    }
   
    if (context instanceof ErrorContext) {
      ErrorContext cxt = (ErrorContext) context;
View Full Code Here

        if (logger.isDebugEnabled()) {
            logger.debug(">lazyStartSessionContext");
        }

        Context webContext = null;
        Context context = getCurrentContext(RequestScoped.class);
        if (context instanceof ServletRequestContext) {
            ServletRequestContext requestContext = (ServletRequestContext) context;
            HttpServletRequest servletRequest = requestContext.getServletRequest();
            if (null != servletRequest) { // this could be null if there is no active request context
                try {
View Full Code Here

  }

  @Override
   public Object getSessionBeanProxy(Bean<?> bean, Class<?> interfce, CreationalContext<?> creationalContext) {

        final Context context = webBeansContext.getBeanManagerImpl().getContext(bean.getScope());

        final CreationalContext<Object> cc = (CreationalContext<Object>) creationalContext;
        final Contextual<Object> component = (Contextual<Object>) bean;

        return context.get(component, cc);

  }
View Full Code Here

        PersonalDataBean pdb = getInstance(PersonalDataBean.class);
        pdb.business();
       
        // first we need to actually create a few instances
       
        Context sessionContext = ContextFactory.getStandardContext(ContextTypes.SESSION);
        Assert.assertNotNull(sessionContext);
        byte[] ba = serializeObject(sessionContext);
        Assert.assertNotNull(ba);
        Context sessContext2 = (Context) deSerializeObject(ba);
        Assert.assertNotNull(sessContext2);
    }
View Full Code Here

            }
            else
            {
                BeanManagerImpl manager = BeanManagerImpl.getManager();
                specializedComponent = (AbstractOwbBean<Object>)WebBeansUtil.getMostSpecializedBean(manager, baseComponent);       
                Context context = null;
                try
                {
                    context = manager.getContext(specializedComponent.getScope());
                }
                catch (ContextNotActiveException cnae)
                {
                    // this may happen if we try to e.g. send an event to a @ConversationScoped bean from a ServletListener
                    logger.info(OWBLogConst.INFO_0010, bean);
                    return;
                }
               
                creationalContext = manager.createCreationalContext(specializedComponent);
               
                // on Reception.IF_EXISTS: ignore this bean if a the contextual instance doesn't already exist
                if (ifExist && context.get(specializedComponent) == null)
                {
                    return;
                }
               
                // on Reception.ALWAYS we must get a contextual reference if we didn't find the contextual instance
View Full Code Here

        if(this.customDecorator != null)
        {
            return this.customDecorator.create(creationalContext);
        }
       
        Context context = BeanManagerImpl.getManager().getContext(getScope());
        Object actualInstance = context.get((Bean<Object>)this.wrappedBean, (CreationalContext<Object>)creationalContext);
        T proxy = (T)JavassistProxyFactory.getInstance().createDependentScopedBeanProxy(this.wrappedBean, actualInstance, creationalContext);
       
        return proxy;       
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable
    {
        BeanManager beanManager = BeanManagerImpl.getManager();
       
        Context context = beanManager.getContext(bean.getScope());
       
        return context.get((Bean<Object>)bean, (CreationalContext<Object>)beanManager.createCreationalContext(bean));
       
    }
View Full Code Here

        return getStandardContext(contextService, type);
    }

    public static Context getStandardContext(ContextsService contextService, ContextTypes type) throws ContextNotActiveException
    {
        Context context = null;
        switch (type.getCardinal())
        {
            case 0:
                context = contextService.getCurrentContext(RequestScoped.class);
                break;
View Full Code Here

     */
    public Context getContext(Class<? extends Annotation> scopeType)
    {
        Asserts.assertNotNull(scopeType, "scopeType paramter can not be null");

        Context standardContext = null;

        standardContext = ContextFactory.getStandardContext(scopeType);

        if(standardContext != null && standardContext.isActive())
        {
            return standardContext;
        }
       
        List<Context> others = contextMap.get(scopeType);
        Context found = null;

        if(others != null)
        {
            for(Context otherContext : others)
            {
View Full Code Here

TOP

Related Classes of javax.enterprise.context.spi.Context

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.