Search in sources :

Example 1 with BeanManagerProxy

use of org.jboss.weld.bean.builtin.BeanManagerProxy in project aries by apache.

the class HttpExtension method afterDeploymentValidation.

void afterDeploymentValidation(@Observes AfterDeploymentValidation adv, BeanManager beanManager) {
    processWebClasses();
    BeanManagerImpl beanManagerImpl = ((BeanManagerProxy) beanManager).delegate();
    Dictionary<String, Object> properties = new Hashtable<>();
    properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, getSelectedContext());
    properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, Boolean.TRUE.toString());
    properties.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE - 100);
    _registrations.add(_bundle.getBundleContext().registerService(LISTENER_CLASSES, new WeldInitialListener(beanManagerImpl), properties));
}
Also used : BeanManagerImpl(org.jboss.weld.manager.BeanManagerImpl) Hashtable(java.util.Hashtable) BeanManagerProxy(org.jboss.weld.bean.builtin.BeanManagerProxy) WeldInitialListener(org.jboss.weld.servlet.WeldInitialListener)

Example 2 with BeanManagerProxy

use of org.jboss.weld.bean.builtin.BeanManagerProxy in project aries by apache.

the class ReferenceExtension method processInjectionTarget.

void processInjectionTarget(@Observes @SuppressWarnings("rawtypes") ProcessInjectionPoint pip, BeanManager manager) {
    InjectionPoint injectionPoint = pip.getInjectionPoint();
    Annotated annotated = injectionPoint.getAnnotated();
    Reference reference = annotated.getAnnotation(Reference.class);
    if (reference == null) {
        return;
    }
    try {
        BeanManagerImpl beanManagerImpl = ((BeanManagerProxy) manager).delegate();
        ReferenceDependency referenceDependency = new ReferenceDependency(beanManagerImpl, reference, injectionPoint);
        _referenceDependencies.add(referenceDependency);
        if (_log.isDebugEnabled()) {
            _log.debug("CDIe - Found OSGi service reference {}", referenceDependency);
        }
    } catch (Exception e) {
        if (_log.isErrorEnabled()) {
            _log.error("CDIe - Error on reference {}", reference, e);
        }
    }
}
Also used : Annotated(javax.enterprise.inject.spi.Annotated) ProcessInjectionPoint(javax.enterprise.inject.spi.ProcessInjectionPoint) InjectionPoint(javax.enterprise.inject.spi.InjectionPoint) BeanManagerImpl(org.jboss.weld.manager.BeanManagerImpl) Reference(org.osgi.service.cdi.annotations.Reference) BeanManagerProxy(org.jboss.weld.bean.builtin.BeanManagerProxy)

Example 3 with BeanManagerProxy

use of org.jboss.weld.bean.builtin.BeanManagerProxy in project core by weld.

the class CustomExtension method getEnhancedAnnotatedType.

protected <T> EnhancedAnnotatedType<T> getEnhancedAnnotatedType(BeanManager manager, Class<T> javaClass) {
    if (manager instanceof BeanManagerProxy) {
        BeanManagerProxy proxy = (BeanManagerProxy) manager;
        manager = proxy.delegate();
    }
    if (manager instanceof BeanManagerImpl) {
        BeanManagerImpl bmi = (BeanManagerImpl) manager;
        return ((BeanManagerImpl) manager).createEnhancedAnnotatedType(javaClass);
    } else {
        throw new IllegalStateException();
    }
}
Also used : BeanManagerImpl(org.jboss.weld.manager.BeanManagerImpl) BeanManagerProxy(org.jboss.weld.bean.builtin.BeanManagerProxy)

Example 4 with BeanManagerProxy

use of org.jboss.weld.bean.builtin.BeanManagerProxy in project core by weld.

the class ELImpl method createELContext.

public ELContext createELContext(BeanManager beanManager) {
    if (beanManager instanceof BeanManagerProxy) {
        BeanManagerProxy proxy = (BeanManagerProxy) beanManager;
        beanManager = proxy.delegate();
    }
    if (beanManager instanceof BeanManagerImpl) {
        return createELContext((BeanManagerImpl) beanManager);
    } else {
        throw new IllegalStateException("Wrong manager");
    }
}
Also used : BeanManagerImpl(org.jboss.weld.manager.BeanManagerImpl) BeanManagerProxy(org.jboss.weld.bean.builtin.BeanManagerProxy)

Example 5 with BeanManagerProxy

use of org.jboss.weld.bean.builtin.BeanManagerProxy in project wildfly by wildfly.

the class BeanManagerService method start.

@Override
public void start(final StartContext context) throws StartException {
    beanManager = new BeanManagerProxy(weldContainerSupplier.get().getBeanManager(beanDeploymentArchiveId));
    beanManagerConsumer.accept(beanManager);
}
Also used : BeanManagerProxy(org.jboss.weld.bean.builtin.BeanManagerProxy)

Aggregations

BeanManagerProxy (org.jboss.weld.bean.builtin.BeanManagerProxy)5 BeanManagerImpl (org.jboss.weld.manager.BeanManagerImpl)4 Hashtable (java.util.Hashtable)1 Annotated (javax.enterprise.inject.spi.Annotated)1 InjectionPoint (javax.enterprise.inject.spi.InjectionPoint)1 ProcessInjectionPoint (javax.enterprise.inject.spi.ProcessInjectionPoint)1 WeldInitialListener (org.jboss.weld.servlet.WeldInitialListener)1 Reference (org.osgi.service.cdi.annotations.Reference)1