Package com.caucho.config.inject

Examples of com.caucho.config.inject.InjectManager$InjectBean


  }
 
  @Override
  protected AspectFactory<X> createAspectFactory()
  {
    InjectManager manager = InjectManager.getCurrent();
   
    AspectFactory<X> next = new StatelessMethodTailFactory<X>(this);
   
    next = new InterceptorFactory<X>(this, next, manager);
    next = new XaFactory<X>(this, next);
View Full Code Here


  }
 
  @Override
  protected AspectFactory<X> createAspectFactory()
  {
    InjectManager manager = InjectManager.getCurrent();
   
    AspectFactory<X> next = new MessageMethodTailFactory<X>(this);
   
    next = new InterceptorFactory<X>(this, next, manager);
    next = new XaFactory<X>(this, next);
View Full Code Here

        _decoratorClass = method.invoke(null);
     
        Annotation []qualifiers = new Annotation[getBean().getQualifiers().size()];
        getBean().getQualifiers().toArray(qualifiers);
       
        InjectManager moduleBeanManager = InjectManager.create();

        _decoratorBeans = moduleBeanManager.resolveDecorators(getBean().getTypes(), qualifiers);
     
        method = instanceClass.getMethod("__caucho_init_decorators",
                                         List.class);
       
     
View Full Code Here

                                         api, this));
   
    SessionBeanImpl<X,T> statefulBean
      = new SessionBeanImpl<X,T>(context, mBean, apiList, extAnnType);
   
    InjectManager manager = getModuleInjectManager();

    if (manager.isNormalScope(statefulBean.getScope())
        && ApplicationScoped.class != statefulBean.getScope()) {
      throw new ConfigException(L.l("{0} is an invalid @Singleton EJB because it has @{1} scope.",
                                    api.getName(),
                                    statefulBean.getScope()));
    }
View Full Code Here

    ClassLoader loader = thread.getContextClassLoader();
   
    try {
      thread.setContextClassLoader(_manager.getClassLoader());
     
      InjectManager cdiManager = InjectManager.create();

      ManagedBeanImpl<T> managedBean
        = cdiManager.createManagedBean(_annotatedType);

      _bean = managedBean;

      _timeoutMethod = getTimeoutMethod(_bean.getBeanClass());

      if (_timeoutMethod != null)
        _timerService = new EjbTimerService(_manager);

      // Injection binding occurs in the start phase

      // _resourceProgram = _manager.getResourceProgram(_ejbClass);

      if (_timerService != null) {
        BeanBuilder<TimerService> factory = cdiManager.createBeanFactory(TimerService.class);
        cdiManager.addBean(factory.singleton(_timerService));
      }
    } finally {
      thread.setContextClassLoader(loader);
    }
  }
View Full Code Here

    ClassLoader loader = thread.getContextClassLoader();
   
    try {
      thread.setContextClassLoader(_manager.getClassLoader());

      InjectManager cdiManager= InjectManager.create();

      setInjectionTarget(_bean.getInjectionTarget());

      // server/4751
      if (_injectionTarget == null) {
        _injectionTarget = cdiManager.createInjectionTarget(_ejbClass);
        _injectionTarget.getInjectionPoints();
      }
    } finally {
      thread.setContextClassLoader(loader);
    }
View Full Code Here

                            ArrayList<AnnotatedType<? super X>> remoteApi)
  {
    super(ejbName, ejbClass, localApi, localBean, remoteApi,
          Singleton.class.getSimpleName());
   
    InjectManager manager = InjectManager.create();
   
    _aspectBeanFactory = new SingletonAspectBeanFactory<X>(manager, getBeanType());
    _lifecycleAspectFactory = new LifecycleAspectBeanFactory<X>(_aspectBeanFactory, manager, getBeanType());
  }
View Full Code Here

    if (_contextMap.get(api) != null)
      throw new IllegalStateException(String.valueOf(api));
   
    AbstractSessionContext<X,T> context = createSessionContext(api);
   
    InjectManager injectManager = context.getInjectManager();
   
    BeanBuilder<SessionContext> factory
    = injectManager.createBeanFactory(SessionContext.class);

    context.setDeclaredRoles(_declaredRoles);

    // XXX: separate additions?
    if (injectManager.getBeans(SessionContext.class).size() == 0)
      injectManager.addBean(factory.singleton(context));
  
    _contextMap.put(context.getApi(), context);
   
    try {
      String beanName = getAnnotatedType().getJavaClass().getName();
     
      Jndi.bindDeep("java:comp/EJBContext", context);
      Jndi.bindDeep("java:comp/" + beanName + "/ejbContext", context);
      Jndi.bindDeep("java:comp/" + beanName + "/sessionContext", context);
    } catch (Exception e) {
      log.log(Level.FINER, e.toString(), e);
    }
   
    try {
      TimerService timer = context.getTimerService();
     
      BeanBuilder<TimerService> timerBuilder
        = injectManager.createBeanFactory(TimerService.class);
     
      if (injectManager.getBeans(TimerService.class).size() == 0)
        injectManager.addBean(timerBuilder.singleton(timer));
    } catch (Exception e) {
      log.log(Level.ALL, e.toString(), e);
    }
   
    /*
 
View Full Code Here

    AnnotatedType<X> rawAnnType = getRawAnnotatedType();
    AnnotatedType<X> annType = getAnnotatedType();
   
    AnnotatedType<X> extAnnType = createExternalAnnotatedType(annType, localApiList);

    InjectManager moduleBeanManager = InjectManager.create();

    ManagedBeanImpl<X> mBean
      = new ManagedBeanImpl<X>(getInjectManager(), getAnnotatedType(), true);
    mBean.introspect();
   
    InjectionTarget<X> target = mBean.getInjectionTarget();
    target = moduleBeanManager.processInjectionTarget(target, getRawAnnotatedType());
    mBean.setInjectionTarget(target);
   
    Class<?> baseApi = annType.getJavaClass();
     
    Set<Type> apiList = new LinkedHashSet<Type>();

    AnnotatedType<X> baseType = getLocalBean();
   
    if (baseType != null) {
      BaseType sourceApi = moduleBeanManager.createSourceBaseType(baseType.getBaseType());
       
      apiList.addAll(sourceApi.getTypeClosure(moduleBeanManager));
    }
     
    if (localApiList != null) {
      for (AnnotatedType<? super X> api : localApiList) {
        baseApi = api.getJavaClass();
       
        BaseType sourceApi = moduleBeanManager.createSourceBaseType(api.getJavaClass());
         
        apiList.addAll(sourceApi.getTypeClosure(moduleBeanManager));
      }
    }
     
    apiList.add(Object.class);
   
    // ioc/024p
    /*
    if (remoteApiList != null) {
      for (AnnotatedType<? super X> api : remoteApiList) {
        if (baseApi == null)
          baseApi = api.getJavaClass();
       
        BaseType sourceApi = moduleBeanManager.createSourceBaseType(api.getJavaClass());
         
        apiList.addAll(sourceApi.getTypeClosure(moduleBeanManager));
      }
    }
    */
   
    if (baseApi == null)
      throw new NullPointerException();

    _bean = (Bean<X>) createBean(mBean, baseApi, apiList, extAnnType);
     
    // CDI TCK requires the rawAnnType, not the processed one
    ProcessSessionBeanImpl process
      = new ProcessSessionBeanImpl(moduleBeanManager,
                                   _bean,
                                   rawAnnType,
                                   getEJBName(),
                                   getSessionBeanType());

    moduleBeanManager.addBean(_bean, process);
   
    if (! moduleBeanManager.isSpecialized(annType.getJavaClass())) {
      moduleBeanManager.addProduces(_bean, extAnnType);
    }

    for (AnnotatedType<?> localApi : getLocalApi()) {
      registerLocalSession(moduleBeanManager, localApi.getJavaClass());
    }
View Full Code Here

  }
 
  @Override
  protected AspectFactory<X> createAspectFactory()
  {
    InjectManager manager = InjectManager.getCurrent();
   
    AspectFactory<X> next = new MethodTailFactory<X>(this);
   
    next = new InterceptorFactory<X>(this, next, manager);
    next = new XaFactory<X>(this, next);
View Full Code Here

TOP

Related Classes of com.caucho.config.inject.InjectManager$InjectBean

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.