Package com.caucho.config.inject

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


      instance.preConfigInit();

      fillInitList(initList);
     
      InjectManager cdiManager = InjectManager.getCurrent();

      cdiManager.setEnableAutoUpdate(false);
     
      try {
        for (DeployConfig config : initList) {
          ConfigProgram program = config.getClassLoaderProgram();

          if (program != null)
            program.configure(instance);
        }
      } finally {
        cdiManager.setEnableAutoUpdate(true);
      }

      for (DeployConfig config : initList) {
        ConfigProgram program = config.getBuilderProgram();
View Full Code Here


  {
    if (name == null)
      return null;
   
    Named named = Names.create(name);
    InjectManager beanManager = InjectManager.create();
   
    Set<Bean<?>> beans = beanManager.getBeans(DataSource.class, named);
   
    if (beans != null && beans.size() > 0) {
      return (DataSource) beanManager.getReference(beanManager.resolve(beans));
    }
   
    Object value = Jndi.lookup(name);
   
    if (value instanceof DataSource)
View Full Code Here

      _name = name;
    }
   
    private Object readResolve()
    {
      InjectManager beanManager = InjectManager.getCurrent();
     
      return beanManager.getReference(EntityManagerFactory.class,
                                      Names.create(_name));
    }
View Full Code Here

      String name = _jndiName;

      Jndi.bindDeepShort(name, this);
    }

    InjectManager manager = InjectManager.create();
    BeanBuilder<?> factory = manager.createBeanFactory(DataSource.class);

    String name = _name;
   
    if (name == null)
      name = _jndiName;
   
    if (name == null)
      name = _var;

    if (_bindingList.size() > 0) {
      factory.binding(_bindingList);
    }
    else {
      if (name != null)
        factory.qualifier(Names.create(name));
     
      factory.qualifier(CurrentLiteral.CURRENT);
    }

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

    // factory.stereotype(CauchoDeployment.class);

    manager.addBean(factory.singleton(this));
   

    _queryAdmin.register();
    _databaseAdmin.register();
  }
View Full Code Here

  }

  private void registerPersistenceUnit(PersistenceUnitManager pUnit)
  {
    try {
      InjectManager beanManager = InjectManager.create(_classLoader);
     
      BeanBuilder<EntityManagerFactory> emfFactory;
      emfFactory = beanManager.createBeanFactory(EntityManagerFactory.class);

      emfFactory.qualifier(CurrentLiteral.CURRENT);
      emfFactory.qualifier(Names.create(pUnit.getName()));
      beanManager.addBean(emfFactory.singleton(pUnit.getEntityManagerFactoryProxy()));

      if (pUnit.getTransactionType() == PersistenceUnitTransactionType.JTA) {
        log.finer(L.l("register persistent-unit `{0}' with transaction-type JTA", pUnit.getName()));
        BeanBuilder<EntityManager> emFactory;
        emFactory = beanManager.createBeanFactory(EntityManager.class);

        emFactory.qualifier(CurrentLiteral.CURRENT);
        emFactory.qualifier(Names.create(pUnit.getName()));
        beanManager.addBean(emFactory.singleton(pUnit.getEntityManagerJtaProxy()));
      } else {
        log.finer(L.l("register persistent-unit `{0}' with transaction-type RESOURCE_LOCAL", pUnit.getName()));
      }

      /*
 
View Full Code Here

    if (_init != null)
      _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

      cm.setShareable(getShareable());

      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

      name = _var;
   
    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

    return createBaseType(type);
  }

  protected static BaseType createBaseType(Type type)
  {
    InjectManager cdiManager = InjectManager.getCurrent();
   
    return cdiManager.createSourceBaseType(type);
  }
View Full Code Here

  @Override
  public Set<Type> getTypeClosure()
  {
    if (_typeSet == null) {
      InjectManager cdiManager = InjectManager.getCurrent();
     
      _typeSet = _type.getTypeClosure(cdiManager);
    }

    return _typeSet;
View Full Code Here

TOP

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

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.