Examples of BeanManager


Examples of javax.enterprise.inject.spi.BeanManager

        }
        return currentContext;
    }

    private RenderContext getCurrentRenderContext() {
        BeanManager manager = new BeanManagerLocator().getBeanManager();
        return BeanManagerUtils.getContextualInstance(manager, RenderContext.class);
    }
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

        } catch (IOException ex) {
            throw new RuntimeException(ex);
        } catch (SAXException ex) {
            throw new RuntimeException(ex);
        }
        BeanManager beanManager = (BeanManager) sc.getAttribute(BeanManagerServletContextListener.BEANMANAGER_SERVLETCONTEXT_KEY);
        ViewConfigStore store = BeanManagerUtils.getContextualInstance(beanManager, ViewConfigStore.class);
        List<UrlMapping> mappings = loadUrlMappings(store, webXmlParser.getFacesMapping());
        PrettyConfig prettyConfig = new PrettyConfig();
        prettyConfig.setMappings(mappings);
        return prettyConfig;
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

    @Override
    public ExternalContext getExternalContext(final Object context, final Object request, final Object response)
            throws FacesException {
        try {
            BeanManager manager = new BeanManagerLocator().getBeanManager();

            SeamExternalContext seamExternalContext = BeanManagerUtils
                    .getContextualInstance(manager, SeamExternalContext.class);
            seamExternalContext.setWrapped(parent.getExternalContext(context, request, response));
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

    @Override
    public Application getApplication() {

        // retrieve SeamApplicationWrapper and set parent correctly
        if (applicationWrapper == null) {
            BeanManager beanManager = new BeanManagerLocator().getBeanManager();
            applicationWrapper = BeanManagerUtils.getContextualInstance(beanManager, SeamApplicationWrapper.class);
            applicationWrapper.setParent(delegate.getApplication());
        }

        return applicationWrapper;
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

    }

    @Override
    public void validate(final FacesContext context) {
        context.getApplication().publishEvent(context, PreValidateEvent.class, UIValidateForm.class, this);
        BeanManager manager = new BeanManagerLocator().getBeanManager();
        manager.fireEvent(this, BEFORE);

        Validator validator = null;
        try {
            validator = context.getApplication().createValidator(getValidatorId());
            if (validator == null) {
                throw new IllegalArgumentException("Seam UIValidateForm - Could not create Validator with id: ["
                        + getValidatorId() + "]");
            }
        } catch (Exception e) {
            throw new IllegalStateException("Seam UIValidateForm - Could not create validator with id [" + getValidatorId()
                    + "] because: nested exception is:" + e.getMessage(), e);
        }

        Map<String, UIInput> components = getComponents();
        try {
            UIComponent parent = this.getParent();
            validator.validate(context, parent, components);
        } catch (ValidatorException e) {
            setValid(false);
            for (UIInput comp : components.values()) {
                comp.setValid(false);
                if (isShowFieldMessages()) {
                    context.addMessage(comp.getClientId(), e.getFacesMessage());
                }
            }
            if (isShowGlobalMessages()) {
                context.addMessage(null, e.getFacesMessage());
            }
            if(!isShowGlobalMessages() && !isShowFieldMessages()) {
                log.warn("The form validation failed but neither 'showFieldMessages' nor 'showGlobalMessages' " +
                        "is true. The validation messages will be dropped.");
            }
        }

        manager.fireEvent(this, AFTER);
        context.getApplication().publishEvent(context, PostValidateEvent.class, UIValidateForm.class, this);
    }
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

        ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext();
        return getBeanManager(servletContext);
    }

    private BeanManager getBeanManager(ServletContext servletContext) {
        BeanManager beanManager = null;
        for (String key : SERVLET_CONTEXT_KEYS) {
            beanManager = (BeanManager) servletContext.getAttribute(key);
            if (beanManager != null) {
                break;
            }
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

*
* @author Marcel Kolsteren
*/
public class DialogueBeanProvider {
    public static Dialogue dialogue(ServletContext servletContext) {
        BeanManager beanManager = new BeanManagerLocator().getBeanManager();
        Bean<?> bean = beanManager.resolve(beanManager.getBeans(Dialogue.class));
        return (Dialogue) beanManager.getReference(bean, Dialogue.class, beanManager.createCreationalContext(bean));
    }
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

        Bean<?> bean = beanManager.resolve(beanManager.getBeans(Dialogue.class));
        return (Dialogue) beanManager.getReference(bean, Dialogue.class, beanManager.createCreationalContext(bean));
    }

    public static DialogueManager dialogueManager(ServletContext servletContext) {
        BeanManager beanManager = new BeanManagerLocator().getBeanManager();
        Bean<?> bean = beanManager.resolve(beanManager.getBeans(DialogueManager.class));
        return (DialogueManager) beanManager.getReference(bean, DialogueManager.class, beanManager.createCreationalContext(bean));
    }
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

        }

        Authenticator selectedAuth = null;

        // Hack to workaround glassfish visibility issue
        BeanManager bm = new BeanManagerLocator().getBeanManager();

//    for (Authenticator auth : authenticators)
        for (Authenticator auth : getReferences(bm, Authenticator.class)) {
            // If the user has provided their own custom authenticator then use it -
            // a custom authenticator is one that isn't one of the known authenticators;
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager

    @Override
    protected void init() {
        super.init();

        // Enable CDI
        BeanManager bm;
        try {
            bm = (BeanManager) new InitialContext().lookup("java:comp/BeanManager");
        } catch (NamingException e) {
            throw new IllegalStateException("Unable to obtain CDI BeanManager", e);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.