Package com.caucho.config.inject

Examples of com.caucho.config.inject.BeanFactory


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

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

  factory.name(getName());
  // server/30b4
  factory.binding(Names.create(getName()));
  factory.binding(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();

      BeanFactory 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

  {
    try {
      InjectManager webBeans = InjectManager.create();
     
      if (_value != null) {
  BeanFactory factory = webBeans.createBeanFactory(_value.getClass());
 
  if (_name != null)
    factory.name(_name);

  webBeans.addBean(factory.singleton(_value));
      }
      else if (_className == null)
  throw new ConfigException(L.l("BeanEmbed must either have a value or a class"));
      else {
  ClassLoader loader = Thread.currentThread().getContextClassLoader();
 
  Class cl = Class.forName(_className, false, loader);

  BeanFactory factory = webBeans.createBeanFactory(cl);

  factory.scope(ApplicationScoped.class);

  if (_name != null)
    factory.name(_name);

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

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

      if (_auth != null) {
        _auth.init();

        InjectManager webBeans = InjectManager.create();
        BeanFactory factory = webBeans.createBeanFactory(Authenticator.class);
        factory.type(Authenticator.class);
        factory.type(AdminAuthenticator.class);

        webBeans.addBean(factory.singleton(_auth));
      }

      if (_transactionManager != null)
        _transactionManager.start();
    } catch (Exception e) {
View Full Code Here

    for (Annotation ann : _annotations) {
      beanType.addAnnotation(ann);
    }

    BeanFactory factory = beanManager.createBeanFactory(beanType);

    if (_scope != null)
      factory.scope(_scope);

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

    Object value = replaceObject();
    Bean bean = null;

    if (value != null) {
      bean = factory.singleton(value);
      beanManager.addBean(bean);
    }
    else {
      bean = factory.bean();
      beanManager.addBean(bean);
    }


    // XXXX: JNDI isn't right
View Full Code Here

    */

    introspect();

    InjectManager beanManager = InjectManager.create();
    BeanFactory factory =  beanManager.createBeanFactory(_cl);

    _annotatedType = factory.getAnnotatedType();

    if (_name != null) {
      factory.name(_name);

      // server/2n00
      if (! Map.class.isAssignableFrom(_cl))
        addOptionalStringProperty("name", _name);
    }

    /*
    if (getMBeanName() != null)
      comp.setMBeanName(getMBeanName());
    */

    // server/21q1
    if (isStartup()
        && ! _annotatedType.isAnnotationPresent(Stateful.class)
        && ! _annotatedType.isAnnotationPresent(Stateless.class)
        && ! _annotatedType.isAnnotationPresent(MessageDriven.class)) {
      factory.annotation(new Startup() {
          public Class annotationType() { return Startup.class; }
        });
    }

    for (Annotation binding : _bindingList) {
      factory.binding(binding);
    }

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

    if (_scope != null) {
      factory.scope(_scope);
      // comp.setScope(_beanManager.getScopeContext(_scope));
    }

    /*
    if (_isService) {
      comp.addAnnotation(new AnnotationLiteral<Service>() {});
    }
    */

    /*
    if (_newArgs != null)
      comp.setNewArgs(_newArgs);
    */

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

    _bean = factory.bean();

    introspectPostInit();

    deploy();

View Full Code Here

    }

    _objValue = value;

    InjectManager webBeans = InjectManager.create();
    BeanFactory factory = webBeans.createBeanFactory(value.getClass());
    factory.name(_name);
    // server/1516
    factory.binding(Names.create(_name));

    webBeans.addBean(factory.singleton(value));

    Jndi.bindDeepShort(_name, value);
  }
View Full Code Here

TOP

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

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.