Package com.caucho.config.inject

Examples of com.caucho.config.inject.BeanFactory


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

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

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

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

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

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


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

      BeanFactory factory
        = manager.createBeanFactory(connectionFactory.getClass());

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

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

      Bean bean = factory.singleton(connectionFactory);

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

    Object proxy = proxyFactory.createProxy(_interface);

    InjectManager beanManager = InjectManager.create();

    BeanFactory factory = beanManager.createBeanFactory(_interface);

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

      addOptionalStringProperty("name", getName());
    }

    for (Annotation binding : getBindingList()) {
      factory = factory.binding(binding);
    }

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

    factory.stereotype(Configured.class);

    _bean = (AbstractBean) factory.singleton(proxy);

    beanManager.addBean(_bean);
  }
View Full Code Here

    AnnotatedTypeImpl annotatedType
      = new AnnotatedTypeImpl((Class) annotated.getBaseType());

    annotatedType.addAnnotation(EnhancedLiteral.ANNOTATION);

    BeanFactory factory
      = _beanManager.createBeanFactory(annotatedType);

    /*
    factory.name(bean.getName());

    for (Type type : bean.getTypes()) {
      factory.type(type);
    }

    */
    for (Annotation binding : annotated.getAnnotations()) {
      Class bindingType = binding.annotationType();
     
      if (bindingType.isAnnotationPresent(Qualifier.class))
        factory.binding(binding);
    }

    _beanManager.addBean(factory.singleton(proxy));

    event.veto();
  }
      }
    } catch (Exception e) {
View Full Code Here

  @Override
  protected void configureInstanceVariables(WebApp webApp)
    throws Throwable
  {
    InjectManager beanManager = InjectManager.create();
    BeanFactory factory = beanManager.createBeanFactory(WebApp.class);
    factory.type(WebApp.class);
    factory.type(ServletContext.class);
    // factory.stereotype(CauchoDeploymentLiteral.create());

    beanManager.addBean(factory.singleton(webApp));

    Config.setProperty("webApp", getVar());
    Config.setProperty("app", getVar());

    webApp.setRegexp(_regexpValues);
View Full Code Here

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

      Object servlet = createServlet(false);

      BeanFactory factory = webBeans.createBeanFactory(servlet.getClass());
      factory.name(_var);

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

      _init.configure(_ra);

    ResourceManagerImpl.addResource(_ra);

    InjectManager manager = InjectManager.create();
    BeanFactory 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();
      BeanFactory 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 (_ra != null && resourceObject instanceof ResourceAdapterAssociation)
  ((ResourceAdapterAssociation) resourceObject).setResourceAdapter(_ra);

      InjectManager beanManager = InjectManager.create();

      BeanFactory 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

    ResourceManagerImpl.addResource(_ra);

    InjectManager beanManager = InjectManager.create();

    BeanFactory 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

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.