Package com.caucho.config.inject

Examples of com.caucho.config.inject.BeanBuilder


    if (_var != null) {
      validateClass(true);

      Object servlet = createServlet(false);

      BeanBuilder factory = cdiManager.createBeanFactory(servlet.getClass());
      if (_var != null)
        factory.name(_var);

      cdiManager.addBean(factory.singleton(servlet));
    }
  }
View Full Code Here


      _init.configure(_ra);

    ResourceManagerImpl.addResource(_ra);

    InjectManager manager = InjectManager.create();
    BeanBuilder beanFactory = manager.createBeanFactory(_ra.getClass());
   
    if (_resourceAdapter.getName() != null) {
      Jndi.bindDeepShort(_resourceAdapter.getName(), _ra);

      beanFactory.name(_resourceAdapter.getName());
    }

    manager.addBean(beanFactory.singleton(_ra));

    // create a default outbound factory
    if (_outboundList.size() == 0 && _jndiName != null && _rar != null) {
      ObjectConfig factoryConfig = _rar.getConnectionDefinition(null);
View Full Code Here

      Object connectionFactory = cm.init(managedFactory);
      cm.start();

      InjectManager beanManager = InjectManager.create();
      BeanBuilder factory
        = beanManager.createBeanFactory(connectionFactory.getClass());
     
      if (getName() != null) {
        Jndi.bindDeepShort(getName(), connectionFactory);

        beanManager.addBean(factory.name(getName())
                            .singleton(connectionFactory));
      }
      else
        beanManager.addBean(factory.singleton(connectionFactory));
    }
View Full Code Here

    if (_name == null)
      name = _jndiName;
   
    InjectManager beanManager = InjectManager.create();

    BeanBuilder factory = beanManager.createBeanFactory(_object.getClass());

    if (name != null) {
      factory.name(name);
      factory.qualifier(CurrentLiteral.CURRENT);
      factory.qualifier(Names.create(name));
    }

    // server/12dt
    // for backward compatibility <resource> is always ApplicationScoped
    // factory.scope(ApplicationScoped.class);
    factory.scope(Singleton.class);

    if (_object != null)
      beanManager.addBean(factory.singleton(_object));
    else
      beanManager.addBean(factory.bean());

    if (log.isLoggable(Level.CONFIG))
      logConfig();
  }
View Full Code Here

      if (_ra != null && resourceObject instanceof ResourceAdapterAssociation)
        ((ResourceAdapterAssociation) resourceObject).setResourceAdapter(_ra);

      InjectManager beanManager = InjectManager.create();

      BeanBuilder factory = beanManager.createBeanFactory(resourceObject.getClass());
     
      if (getName() != null) {
        Jndi.bindDeepShort(getName(), resourceObject);

        beanManager.addBean(factory.name(getName()).singleton(resourceObject));
      }
      else {
        beanManager.addBean(factory.singleton(resourceObject));
      }
    }
View Full Code Here

    try {
      connectionFactory = cm.init(managedFactory);
      cm.start();

      BeanBuilder factory
        = cdiManager.createBeanFactory(connectionFactory.getClass());

      if (getName() != null) {
        Jndi.bindDeepShort(getName(), connectionFactory);

        factory.name(getName());
        factory.qualifier(Names.create(getName()));
        // server/30i0
        factory.qualifier(CurrentLiteral.CURRENT);
      }
     
      factory.qualifier(DefaultLiteral.DEFAULT);

      Bean bean = factory.singleton(connectionFactory);

      cdiManager.addBean(bean);
    } catch (Exception e) {
      throw ConfigException.create(e);
    }
View Full Code Here

    ResourceManagerImpl.addResource(_ra);

    InjectManager beanManager = InjectManager.create();

    BeanBuilder factory = beanManager.createBeanFactory(_ra.getClass());
   
    if (_resourceAdapter.getName() != null) {
      Jndi.bindDeepShort(_resourceAdapter.getName(), _ra);

      beanManager.addBean(factory.name(_resourceAdapter.getName())
                          .singleton(_ra));
    }
    else {
      beanManager.addBean(factory.name(_name).singleton(_ra));
    }

    // create a default outbound factory
    if (_outboundList.size() == 0 && _jndiName != null && _rar != null) {
      ObjectConfig factoryConfig = _rar.getConnectionDefinition(null);
View Full Code Here

      Object connectionFactory = cm.init(managedFactory);
      cm.start();

      InjectManager manager = InjectManager.create();
      BeanBuilder factory
        = manager.createBeanFactory(connectionFactory.getClass());
     
      if (getName() != null) {
        Jndi.bindDeepShort(getName(), connectionFactory);

        factory.name(getName());
        // server/30b4
        factory.qualifier(Names.create(getName()));
        factory.qualifier(CurrentLiteral.CURRENT);
      }
     
      manager.addBean(factory.singleton(connectionFactory));
    }
View Full Code Here

      if (_ra != null && resourceObject instanceof ResourceAdapterAssociation)
        ((ResourceAdapterAssociation) resourceObject).setResourceAdapter(_ra);

      InjectManager manager = InjectManager.create();

      BeanBuilder factory
        = manager.createBeanFactory(resourceObject.getClass());
     
      if (getName() != null) {
        Jndi.bindDeepShort(getName(), resourceObject);

        manager.addBean(factory.name(getName()).singleton(resourceObject));
      }
      else
        manager.addBean(factory.singleton(resourceObject));
    }
View Full Code Here

                                    getTagName()));

    introspect();

    InjectManager beanManager = InjectManager.create();
    BeanBuilder builder =  beanManager.createBeanFactory(_cl);

    if (builder == null)
      return;
    _annotatedType = builder.getAnnotatedType();

    if (_name != null) {
      // server/2n00
      if (! Map.class.isAssignableFrom(_cl))
        addOptionalStringProperty("name", _name);
    }
   
    if (getCdiNamed() != null) {
      // env/02s7
      builder.name(getCdiNamed());
    }

    if (_annotatedType.isAnnotationPresent(javax.ejb.Singleton.class)
        || _annotatedType.isAnnotationPresent(Stateful.class)
        || _annotatedType.isAnnotationPresent(Stateless.class)
        || _annotatedType.isAnnotationPresent(MessageDriven.class)) {
      throw new ConfigException(L.l("{0} cannot be configured by <bean> because it has an EJB annotation.  Use CDI syntax instead.",
                                    _annotatedType));
    }

    // server/21q1
    if (isStartup()
        && ! _annotatedType.isAnnotationPresent(Stateful.class)
        && ! _annotatedType.isAnnotationPresent(Stateless.class)
        && ! _annotatedType.isAnnotationPresent(MessageDriven.class)) {
      builder.annotation(new StartupLiteral());
    }

    for (Annotation qualifier : _qualifierList) {
      builder.qualifier(qualifier);
    }
   
    if (_name != null) {
      builder.qualifier(Names.create(_name));
    }
   
    if (_qualifierList.size() == 0)
      builder.qualifier(DefaultLiteral.DEFAULT);

    for (Annotation stereotype : _stereotypeList) {
      builder.stereotype(stereotype.annotationType());
    }

    if (_scope != null) {
      builder.scope(_scope);
      // comp.setScope(_beanManager.getScopeContext(_scope));
    }
   
    if (Singleton.class == _scope) {
      builder.annotation(new StartupLiteral());
    }
   
    builder.annotation(_cdiManager.generateXmlCookie());

    if (_init != null)
      builder.init(_init);

    _bean = builder.bean();
    _extAnnotated = builder.getExtendedAnnotated();
   
    introspectPostInit();

    deploy();
View Full Code Here

TOP

Related Classes of com.caucho.config.inject.BeanBuilder

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.