Package javax.context

Examples of javax.context.Context


    @SuppressWarnings("unchecked")
    public void notify(T event)
    {
        AbstractComponent<?> baseComponent = (AbstractComponent<?>) bean;
        Object object = null;
        Context context = null;
        boolean isDependentContext = false;

        try
        {
            if (baseComponent.getScopeType().equals(Dependent.class))
            {
                isDependentContext = true;
                ContextFactory.getDependentContext().setActive(true);               
            }

            context = manager.getContext(baseComponent.getScopeType());
           
            if (ifExist)
            {
                object = context.get(baseComponent);
            }
            else
            {
                object = context.get((AbstractComponent<T>)baseComponent, new CreationalContextImpl<T>());
            }

            if (object != null)
            {
                Object[] args = null;
View Full Code Here


    {
        Asserts.assertNotNull(scopType, "scopeType paramter can not be null");

        List<Context> contexts = new ArrayList<Context>();
       
        Context standartContext = null;

        standartContext = ContextFactory.getStandartContext(scopType);

        if(standartContext != null)
        {
            if(standartContext.isActive())
            {
                contexts.add(standartContext);  
            }
        }
       
View Full Code Here

        return this;
    }

    public <T> T getInstance(Bean<T> bean)
    {
        Context context = null;
        T instance = null;

        try
        {
            ContextFactory.getDependentContext().setActive(true);

            /* @ScopeType is normal */
            if (WebBeansUtil.isScopeTypeNormal(bean.getScopeType()))
            {
                if (this.proxyMap.containsKey(bean))
                {
                    instance = (T) this.proxyMap.get(bean);
                }
                else
                {
                    instance = (T) JavassistProxyFactory.createNewProxyInstance(bean);

                    this.proxyMap.put(bean, instance);
                }
            }
            /* @ScopeType is not normal */
            else
            {
                context = getContext(bean.getScopeType());
                instance = context.get(bean, new CreationalContextImpl<T>());
            }

        }
        finally
        {
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public Object invoke(Object instance, Method method, Method proceed, Object[] arguments) throws Exception
    {
        Context webbeansContext = ManagerImpl.getManager().getContext(component.getScopeType());
        Object webbeansInstance = webbeansContext.get(this.component, new CreationalContextImpl());

        if (!ClassUtil.isObjectMethod(method.getName()) && InterceptorUtil.isWebBeansBusinessMethod(method))
        {
            if (this.calledMethod == null)
            {
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public Object invoke(Object instance, Method method, Method proceed, Object[] arguments) throws Exception
    {
        Context webbeansContext = ManagerImpl.getManager().getContext(component.getScopeType());
       
        Object webbeansInstance = webbeansContext.get((Contextual<Object>)this.component, (CreationalContext<Object>)CreationalContextFactory.getInstance().getCreationalContext(this.component));

        if (!ClassUtil.isObjectMethod(method.getName()) && InterceptorUtil.isWebBeansBusinessMethod(method))
        {
            checkDecoratorStackForSameDecorator(method);
View Full Code Here

   
    @SuppressWarnings("unchecked")
    private void configureTarget(Bean<?> bean)
    {
        Context webbeansContext = ManagerImpl.getManager().getContext(bean.getScopeType());
       
        this.target = webbeansContext.get((Contextual<Object>)bean, (CreationalContext<Object>)CreationalContextFactory.getInstance().getCreationalContext(bean));       
       
    }
View Full Code Here

    {
        Asserts.assertNotNull(scopeType, "scopeType paramter can not be null");

        List<Context> contexts = new ArrayList<Context>();
       
        Context standardContext = null;

        standardContext = ContextFactory.getStandardContext(scopeType);

        if(standardContext != null)
        {
            if(standardContext.isActive())
            {
                contexts.add(standardContext);  
            }
        }
       
View Full Code Here

        return this;
    }

    public <T> T getInstance(Bean<T> bean)
    {
        Context context = null;
        T instance = null;
        boolean dependentContext = false;
        try
        {
            if(!ContextFactory.checkDependentContextActive())
            {
                ContextFactory.activateDependentContext();
                dependentContext = true;
            }           

            CreationalContext<T> creationalContext = CreationalContextFactory.getInstance().getCreationalContext(bean);
           
            /* @ScopeType is normal */
            if (WebBeansUtil.isScopeTypeNormal(bean.getScopeType()))
            {
                if (this.proxyMap.containsKey(bean))
                {
                    instance = (T) this.proxyMap.get(bean);
                }
                else
                {
                    instance = (T) JavassistProxyFactory.createNewProxyInstance(bean);
                    this.proxyMap.put(bean, instance);
                }
               
                //Push proxy instance into the creational context
                creationalContext.push(instance);
               
            }
            /* @ScopeType is not normal */
            else
            {
                context = getContext(bean.getScopeType());
                instance = (T)context.get(bean, creationalContext);                               
            }

        }
        finally
        {
View Full Code Here

        {
            throw new IllegalArgumentException("Scope type : " + scopeType.getSimpleName() + " must be normal scope type");
           
        }       
       
        Context context = getContext(scopeType);
       
        ActivityManager.getInstance().addCurrentActivity(context, this);
       
        return this;
    }   
View Full Code Here

TOP

Related Classes of javax.context.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.