io.quarkus.arc.runtime.BeanContainerListener Java Examples

The following examples show how to use io.quarkus.arc.runtime.BeanContainerListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HibernateOrmRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the JPA configuration to be used at runtime.
 * 
 * @param jtaEnabled Should JTA be enabled?
 * @param strategy Multitenancy strategy to use.
 * @param multiTenancySchemaDataSource Data source to use in case of {@link MultiTenancyStrategy#SCHEMA} approach or
 *        {@link null} in case the default data source.
 * 
 * @return
 */
public BeanContainerListener initializeJpa(boolean jtaEnabled, MultiTenancyStrategy strategy,
        String multiTenancySchemaDataSource) {
    return new BeanContainerListener() {
        @Override
        public void created(BeanContainer beanContainer) {
            JPAConfig instance = beanContainer.instance(JPAConfig.class);
            instance.setJtaEnabled(jtaEnabled);
            instance.setMultiTenancyStrategy(strategy);
            instance.setMultiTenancySchemaDataSource(multiTenancySchemaDataSource);
        }
    };
}
 
Example #2
Source File: HibernateOrmRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public BeanContainerListener registerPersistenceUnit(String unitName) {
    return new BeanContainerListener() {
        @Override
        public void created(BeanContainer beanContainer) {
            beanContainer.instance(JPAConfig.class).registerPersistenceUnit(unitName);
        }
    };
}
 
Example #3
Source File: HibernateOrmRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public BeanContainerListener initDefaultPersistenceUnit() {
    return new BeanContainerListener() {
        @Override
        public void created(BeanContainer beanContainer) {
            beanContainer.instance(JPAConfig.class).initDefaultPersistenceUnit();
        }
    };
}
 
Example #4
Source File: HibernateOrmRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public BeanContainerListener initMetadata(List<ParsedPersistenceXmlDescriptor> parsedPersistenceXmlDescriptors,
        Scanner scanner, Collection<Class<? extends Integrator>> additionalIntegrators,
        PreGeneratedProxies proxyDefinitions, MultiTenancyStrategy strategy) {
    return new BeanContainerListener() {
        @Override
        public void created(BeanContainer beanContainer) {
            PersistenceUnitsHolder.initializeJpa(parsedPersistenceXmlDescriptors, scanner, additionalIntegrators,
                    proxyDefinitions, strategy);
        }
    };
}
 
Example #5
Source File: HttpSecurityRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public BeanContainerListener initPermissions(HttpBuildTimeConfig permissions,
        Map<String, Supplier<HttpSecurityPolicy>> policies) {
    return new BeanContainerListener() {
        @Override
        public void created(BeanContainer container) {
            container.instance(PathMatchingHttpSecurityPolicy.class).init(permissions, policies);
        }
    };
}
 
Example #6
Source File: RestClientRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public BeanContainerListener hackAroundExtension() {
    return new BeanContainerListener() {
        @Override
        public void created(BeanContainer container) {
            try {
                Field f = RestClientExtension.class.getDeclaredField("manager");
                f.setAccessible(true);
                f.set(null, CDI.current().getBeanManager());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    };
}
 
Example #7
Source File: KafkaStreamsRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public BeanContainerListener configure(Properties properties) {
    return new BeanContainerListener() {

        @Override
        public void created(BeanContainer container) {
            KafkaStreamsTopologyManager instance = container.instance(KafkaStreamsTopologyManager.class);
            instance.configure(properties);
        }
    };
}
 
Example #8
Source File: KeycloakRecorder.java    From keycloak with Apache License 2.0 5 votes vote down vote up
public BeanContainerListener configureDataSource() {
    return new BeanContainerListener() {
        @Override
        public void created(BeanContainer container) {
            String driver = CONFIG.getRawValue("quarkus.datasource.driver");
            DataSourceSupport instance = container.instance(DataSourceSupport.class);
            DataSourceSupport.Entry entry = instance.entries.get(DataSourceUtil.DEFAULT_DATASOURCE_NAME);
            entry.resolvedDriverClass = driver;
        }
    };
}
 
Example #9
Source File: BeanContainerListenerBuildItem.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public BeanContainerListenerBuildItem(BeanContainerListener beanContainerListener) {
    this.beanContainerListener = beanContainerListener;
}
 
Example #10
Source File: BeanContainerListenerBuildItem.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public BeanContainerListener getBeanContainerListener() {
    return beanContainerListener;
}
 
Example #11
Source File: InfinispanRecorder.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public BeanContainerListener configureInfinispan(Properties properties) {
    return container -> {
        InfinispanClientProducer instance = container.instance(InfinispanClientProducer.class);
        instance.configure(properties);
    };
}
 
Example #12
Source File: LiquibaseRecorder.java    From tutorials with MIT License 4 votes vote down vote up
public BeanContainerListener setLiquibaseConfig(LiquibaseConfig liquibaseConfig) {
    return beanContainer -> {
        LiquibaseProducer producer = beanContainer.instance(LiquibaseProducer.class);
        producer.setLiquibaseConfig(liquibaseConfig);
    };
}