Package org.hibernate.boot.registry

Examples of org.hibernate.boot.registry.BootstrapServiceRegistryBuilder


   * @param integrationSettings Any integration settings passed by the EE container or SE application
   *
   * @return The built BootstrapServiceRegistry
   */
  private BootstrapServiceRegistry buildBootstrapServiceRegistry(Map integrationSettings) {
    final BootstrapServiceRegistryBuilder bootstrapServiceRegistryBuilder = new BootstrapServiceRegistryBuilder();
    bootstrapServiceRegistryBuilder.with( new JpaIntegrator() );

    final IntegratorProvider integratorProvider = (IntegratorProvider) integrationSettings.get( INTEGRATOR_PROVIDER );
    if ( integratorProvider != null ) {
      for ( Integrator integrator : integratorProvider.getIntegrators() ) {
        bootstrapServiceRegistryBuilder.with( integrator );
      }
    }
   
    final StrategyRegistrationProviderList strategyRegistrationProviderList
        = (StrategyRegistrationProviderList) integrationSettings.get( STRATEGY_REGISTRATION_PROVIDERS );
    if ( strategyRegistrationProviderList != null ) {
      for ( StrategyRegistrationProvider strategyRegistrationProvider : strategyRegistrationProviderList
          .getStrategyRegistrationProviders() ) {
        bootstrapServiceRegistryBuilder.withStrategySelectors( strategyRegistrationProvider );
      }
    }

    // TODO: If providedClassLoader is present (OSGi, etc.) *and*
    // an APP_CLASSLOADER is provided, should throw an exception or
    // warn?
    ClassLoader classLoader;
    ClassLoader appClassLoader = (ClassLoader) integrationSettings.get( org.hibernate.cfg.AvailableSettings.APP_CLASSLOADER );
    if ( providedClassLoader != null ) {
      classLoader = providedClassLoader;
    }
    else if ( appClassLoader != null ) {
      classLoader = appClassLoader;
      integrationSettings.remove( org.hibernate.cfg.AvailableSettings.APP_CLASSLOADER );
    }
    else {
      classLoader = persistenceUnit.getClassLoader();
    }
    bootstrapServiceRegistryBuilder.with( classLoader );

    return bootstrapServiceRegistryBuilder.build();
  }
View Full Code Here


  protected void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
  }

  protected BootstrapServiceRegistry buildBootstrapServiceRegistry() {
    final BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
    prepareBootstrapRegistryBuilder( builder );
    return builder.build();
  }
View Full Code Here

  protected void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
  }

  protected BootstrapServiceRegistry buildBootstrapServiceRegistry() {
    final BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
    prepareBootstrapRegistryBuilder( builder );
    return builder.build();
  }
View Full Code Here

      }
      String cfgResource = "/" + cfgResources.iterator().next();
      configuration.configure( cfgResource );
    }

    final BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
    builder.with( osgiClassLoader );

    final Integrator[] integrators = osgiServiceUtil.getServiceImpls( Integrator.class );
    for ( Integrator integrator : integrators ) {
      builder.with( integrator );
    }

    final StrategyRegistrationProvider[] strategyRegistrationProviders
        = osgiServiceUtil.getServiceImpls( StrategyRegistrationProvider.class );
    for ( StrategyRegistrationProvider strategyRegistrationProvider : strategyRegistrationProviders ) {
      builder.withStrategySelectors( strategyRegistrationProvider );
    }
       
    final TypeContributor[] typeContributors = osgiServiceUtil.getServiceImpls( TypeContributor.class );
    for ( TypeContributor typeContributor : typeContributors ) {
      configuration.registerTypeContributor( typeContributor );
    }

    final ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder( builder.build() )
        .applySettings( configuration.getProperties() ).build();
    return configuration.buildSessionFactory( serviceRegistry );
  }
View Full Code Here

      }
      String cfgResource = "/" + cfgResources.iterator().next();
      configuration.configure( cfgResource );
    }

    final BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
    final OSGiClassLoaderServiceImpl classLoaderService = new OSGiClassLoaderServiceImpl( osgiClassLoader, osgiServiceUtil );
    builder.with( classLoaderService );

    final Integrator[] integrators = osgiServiceUtil.getServiceImpls( Integrator.class );
    for ( Integrator integrator : integrators ) {
      builder.with( integrator );
    }

    final StrategyRegistrationProvider[] strategyRegistrationProviders
        = osgiServiceUtil.getServiceImpls( StrategyRegistrationProvider.class );
    for ( StrategyRegistrationProvider strategyRegistrationProvider : strategyRegistrationProviders ) {
      builder.withStrategySelectors( strategyRegistrationProvider );
    }

    final TypeContributor[] typeContributors = osgiServiceUtil.getServiceImpls( TypeContributor.class );
    for ( TypeContributor typeContributor : typeContributors ) {
      configuration.registerTypeContributor( typeContributor );
    }

    final ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder( builder.build() )
        .applySettings( configuration.getProperties() ).build();
    return configuration.buildSessionFactory( serviceRegistry );
  }
View Full Code Here

   * @param integrationSettings Any integration settings passed by the EE container or SE application
   *
   * @return The built BootstrapServiceRegistry
   */
  private BootstrapServiceRegistry buildBootstrapServiceRegistry(Map integrationSettings) {
    final BootstrapServiceRegistryBuilder bootstrapServiceRegistryBuilder = new BootstrapServiceRegistryBuilder();
    bootstrapServiceRegistryBuilder.with( new JpaIntegrator() );

    final IntegratorProvider integratorProvider = (IntegratorProvider) integrationSettings.get( INTEGRATOR_PROVIDER );
    if ( integratorProvider != null ) {
      integrationSettings.remove( INTEGRATOR_PROVIDER );
      for ( Integrator integrator : integratorProvider.getIntegrators() ) {
        bootstrapServiceRegistryBuilder.with( integrator );
      }
    }

    // TODO: If providedClassLoader is present (OSGi, etc.) *and*
    // an APP_CLASSLOADER is provided, should throw an exception or
    // warn?
    ClassLoader classLoader;
    ClassLoader appClassLoader = (ClassLoader) integrationSettings.get( org.hibernate.cfg.AvailableSettings.APP_CLASSLOADER );
    if ( providedClassLoader != null ) {
      classLoader = providedClassLoader;
    }
    else if ( appClassLoader != null ) {
      classLoader = appClassLoader;
      integrationSettings.remove( org.hibernate.cfg.AvailableSettings.APP_CLASSLOADER );
    }
    else {
      classLoader = persistenceUnit.getClassLoader();
    }
    bootstrapServiceRegistryBuilder.with( classLoader );

    return bootstrapServiceRegistryBuilder.build();
  }
View Full Code Here

  protected void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
  }

  protected BootstrapServiceRegistry buildBootstrapServiceRegistry() {
    final BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
    prepareBootstrapRegistryBuilder( builder );
    return builder.build();
  }
View Full Code Here

  protected void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
  }

  protected BootstrapServiceRegistry buildBootstrapServiceRegistry() {
    final BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
    prepareBootstrapRegistryBuilder( builder );
    return builder.build();
  }
View Full Code Here

  protected void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
  }

  protected BootstrapServiceRegistry buildBootstrapServiceRegistry() {
    final BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
    prepareBootstrapRegistryBuilder( builder );
    return builder.build();
  }
View Full Code Here

   * @param integrationSettings Any integration settings passed by the EE container or SE application
   *
   * @return The built BootstrapServiceRegistry
   */
  private BootstrapServiceRegistry buildBootstrapServiceRegistry(Map integrationSettings) {
    final BootstrapServiceRegistryBuilder bootstrapServiceRegistryBuilder = new BootstrapServiceRegistryBuilder();
    bootstrapServiceRegistryBuilder.with( new JpaIntegrator() );

    final IntegratorProvider integratorProvider = (IntegratorProvider) integrationSettings.get( INTEGRATOR_PROVIDER );
    if ( integratorProvider != null ) {
      for ( Integrator integrator : integratorProvider.getIntegrators() ) {
        bootstrapServiceRegistryBuilder.with( integrator );
      }
    }
   
    final StrategyRegistrationProviderList strategyRegistrationProviderList
        = (StrategyRegistrationProviderList) integrationSettings.get( STRATEGY_REGISTRATION_PROVIDERS );
    if ( strategyRegistrationProviderList != null ) {
      for ( StrategyRegistrationProvider strategyRegistrationProvider : strategyRegistrationProviderList
          .getStrategyRegistrationProviders() ) {
        bootstrapServiceRegistryBuilder.withStrategySelectors( strategyRegistrationProvider );
      }
    }

    // TODO: If providedClassLoader is present (OSGi, etc.) *and*
    // an APP_CLASSLOADER is provided, should throw an exception or
    // warn?
    ClassLoader classLoader;
    ClassLoader appClassLoader = (ClassLoader) integrationSettings.get( org.hibernate.cfg.AvailableSettings.APP_CLASSLOADER );
    if ( providedClassLoader != null ) {
      classLoader = providedClassLoader;
    }
    else if ( appClassLoader != null ) {
      classLoader = appClassLoader;
    }
    else {
      classLoader = persistenceUnit.getClassLoader();
    }
    bootstrapServiceRegistryBuilder.with( classLoader );

    return bootstrapServiceRegistryBuilder.build();
  }
View Full Code Here

TOP

Related Classes of org.hibernate.boot.registry.BootstrapServiceRegistryBuilder

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.