Package org.apache.webbeans.config

Examples of org.apache.webbeans.config.WebBeansContext


        if (phaseEvent.getPhaseId().equals(PhaseId.RESTORE_VIEW))
        {
            //It looks for cid parameter in the JSF request.
            //If request contains cid, then it must restore conversation
            //Otherwise create NonexistentException
            WebBeansContext webBeansContext = WebBeansContext.getInstance();
            ConversationManager conversationManager = webBeansContext.getConversationManager();
            Conversation conversation = conversationManager.getConversationBeanReference();
            String cid = JSFUtil.getConversationId();
            ContextFactory contextFactory = webBeansContext.getContextFactory();

            if (conversation.isTransient())
            {
                if (logger.isLoggable(Level.FINE))
                {
View Full Code Here


        Set<Bean<?>> beans = getBeanManager().getBeans(Object.class);
        Assert.assertNotNull(beans);
        Assert.assertTrue(beans.size() > 7);

        WebBeansContext webBeansContext = WebBeansContext.getInstance();
        for (Bean<?> bean : beans)
        {
            String id = null;
            if((id = WebBeansUtil.isPassivationCapable(bean)) != null)
            {
                bean = (Bean<?>) webBeansContext.getSerializableBeanVault().getSerializableBean(bean);
               
                byte[] serial = serializeBean(bean);
                Bean<?> b2 = deSerializeBean(serial);

                Assert.assertEquals(((SerializableBean<?>)bean).getBean(), ((SerializableBean<?>)b2).getBean());
               
            }
        }
       
        // and now we are keen and try to serialize the whole passivatable Contexts!
        PersonalDataBean pdb = getInstance(PersonalDataBean.class);
        pdb.business();
       
        // first we need to actually create a few instances

        Context sessionContext = webBeansContext.getContextFactory().getStandardContext(SessionScoped.class);
        Assert.assertNotNull(sessionContext);
        byte[] ba = serializeObject(sessionContext);
        Assert.assertNotNull(ba);
        Context sessContext2 = (Context) deSerializeObject(ba);
        Assert.assertNotNull(sessContext2);
View Full Code Here

     */
    protected <T> AbstractInjectionTargetBean<T> defineManagedBean(Class<T> clazz)
    {
        ManagedBean<T> bean;

        WebBeansContext webBeansContext = WebBeansContext.getInstance();
        bean = webBeansContext.getManagedBeanConfigurator().define(clazz, WebBeansType.MANAGED);
        if (bean != null)
        {
            DecoratorUtil.checkManagedBeanDecoratorConditions(bean,null);
            WebBeansDecoratorConfig.configureDecorators(bean);
            webBeansContext.getDefinitionUtil().defineBeanInterceptorStack(bean);

            getComponents().add((AbstractOwbBean<?>) bean);
            manager.addBean(bean);

            GProcessAnnotatedType type = new GProcessAnnotatedType(webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz));
            manager.fireEvent(type, new Annotation[0]);           
        }

        return bean;
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    protected <T> AbstractOwbBean<T> defineInterceptor(Class<T> clazz)
    {
        ManagedBean<T> component = null;

        WebBeansContext webBeansContext = WebBeansContext.getInstance();
        webBeansContext.getManagedBeanConfigurator().checkManagedBeanCondition(clazz);

        webBeansContext.getInterceptorsManager().addNewInterceptor(clazz);
        AnnotatedType annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz);
        webBeansContext.getInterceptorUtil().checkInterceptorConditions(annotatedType);
        component = webBeansContext.getManagedBeanConfigurator().define(clazz, WebBeansType.INTERCEPTOR);
        webBeansContext.getWebBeansInterceptorConfig().configureInterceptorClass((ManagedBean<Object>) component,
                                                            webBeansContext.getAnnotationManager().getInterceptorBindingMetaAnnotations(
                                                                clazz.getDeclaredAnnotations()));


        return component;
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    protected <T> AbstractOwbBean<T> defineDecorator(Class<T> clazz)
    {
        ManagedBean<T> component = null;

        WebBeansContext webBeansContext = WebBeansContext.getInstance();
        if (webBeansContext.getDecoratorsManager().isDecoratorEnabled(clazz))
        {
            DecoratorUtil.checkDecoratorConditions(clazz);
            component = webBeansContext.getManagedBeanConfigurator().define(clazz, WebBeansType.DECORATOR);

            if (component != null)
            {
                WebBeansDecoratorConfig.configureDecoratorClass((ManagedBean<Object>) component);
            }
View Full Code Here

     *
     * @param stereoClass stereotype class
     */
    protected void initializeStereoType(Class<? extends Annotation> stereoClass)
    {
        WebBeansContext webBeansContext = WebBeansContext.getInstance();
        webBeansContext.getAnnotationManager().checkStereoTypeClass(stereoClass, stereoClass.getDeclaredAnnotations());
        StereoTypeModel model = new StereoTypeModel(webBeansContext, stereoClass);
        webBeansContext.getStereoTypeManager().addStereoTypeModel(model);
    }
View Full Code Here

            if(!isOwbApplication())
            {
                return;
            }

            WebBeansContext webBeansContext = WebBeansContext.getInstance();
            ConversationManager conversationManager = webBeansContext.getConversationManager();
            Conversation conversation = conversationManager.getConversationBeanReference();

            if (conversation.isTransient())
            {
                if (logger.isLoggable(Level.FINE))
                {
                    logger.log(Level.FINE, "Destroying the conversation context with cid : [{0}]", conversation.getId());
                }
                ContextFactory contextFactory = webBeansContext.getContextFactory();
                contextFactory.destroyConversationContext();
            }
            else
            {
                //Conversation must be used by one thread at a time
View Full Code Here

        if (phaseEvent.getPhaseId().equals(PhaseId.RESTORE_VIEW) && isOwbApplication())
        {
            //It looks for cid parameter in the JSF request.
            //If request contains cid, then it must restore conversation
            //Otherwise create NonexistentException
            WebBeansContext webBeansContext = WebBeansContext.getInstance();
            ConversationManager conversationManager = webBeansContext.getConversationManager();
            Conversation conversation = conversationManager.getConversationBeanReference();
            String cid = JSFUtil.getConversationId();
            ContextFactory contextFactory = webBeansContext.getContextFactory();

            if (conversation.isTransient())
            {
                if (logger.isLoggable(Level.FINE))
                {
View Full Code Here

public class ContextsImpl implements Contexts<AbstractContext>
{

    public AbstractContext getRequestContext()
    {
        WebBeansContext webBeansContext = WebBeansContext.getInstance();
        ContextFactory contextFactory = webBeansContext.getContextFactory();

        RequestContext ctx =  (RequestContext)contextFactory.getStandardContext(RequestScoped.class);
       
        if(ctx == null)
        {
View Full Code Here

        context.setActive(false);
    }

    public AbstractContext getDependentContext()
    {
        WebBeansContext webBeansContext = WebBeansContext.getInstance();
        ContextFactory contextFactory = webBeansContext.getContextFactory();

        return (AbstractContext) contextFactory.getStandardContext(Dependent.class);
    }
View Full Code Here

TOP

Related Classes of org.apache.webbeans.config.WebBeansContext

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.