Package org.hibernate.boot.registry.classloading.spi

Examples of org.hibernate.boot.registry.classloading.spi.ClassLoaderService


    this.registry = serviceRegistry;
  }

  @Override
  public void configure(Map configurationValues) {
    ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, classLoaderService );

    sessionFactoryOptions = new OptionsServiceContextImpl( OptionValueSources.getDefaultSources( propertyReader ) );
  }
View Full Code Here


  }

  @Override
  public void configure(Map configurationValues) {
    OptionsService optionsService = serviceRegistry.getService( OptionsService.class );
    ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, classLoaderService );

    this.config = new MongoDBConfiguration( propertyReader, optionsService.context().getGlobalOptions() );
  }
View Full Code Here

    this.registry = serviceRegistry;
  }

  @Override
  public void configure(Map configurationValues) {
    ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, classLoaderService );

    sessionFactoryOptions = new OptionsServiceContextImpl( OptionValueSources.getDefaultSources( propertyReader ) );
  }
View Full Code Here

   * Build the bootstrap registry.
   *
   * @return The built bootstrap registry
   */
  public BootstrapServiceRegistry build() {
    final ClassLoaderService classLoaderService;
    if ( providedClassLoaderService == null ) {
      // Use a set.  As an example, in JPA, OsgiClassLoader may be in both
      // the providedClassLoaders and the overridenClassLoader.
      final Set<ClassLoader> classLoaders = new HashSet<ClassLoader>();

View Full Code Here

  }

  // todo : remove this once the state objects are cleaned up

  public static Class classForName(String className, ServiceRegistry serviceRegistry) {
    ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
    try {
      return classLoaderService.classForName( className );
    }
    catch ( ClassLoadingException e ) {
      throw new MappingException( "Could not find class: " + className );
    }
  }
View Full Code Here

    else if ( StatisticsFactory.class.isInstance( configValue ) ) {
      statisticsFactory = (StatisticsFactory) configValue;
    }
    else {
      // assume it names the factory class
      final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
      try {
        statisticsFactory = (StatisticsFactory) classLoaderService.classForName( configValue.toString() ).newInstance();
      }
      catch (HibernateException e) {
        throw e;
      }
      catch (Exception e) {
View Full Code Here

  @Override
  public void generateSchema() {
    processProperties();

    final ServiceRegistry serviceRegistry = buildServiceRegistry();
    final ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );

    // IMPL NOTE : TCCL handling here is temporary.
    //    It is needed because this code still uses Hibernate Configuration and Hibernate commons-annotations
    //     in turn which relies on TCCL being set.
View Full Code Here

  @SuppressWarnings("unchecked")
  public EntityManagerFactory build() {
    processProperties();

    final ServiceRegistry serviceRegistry = buildServiceRegistry();
    final ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );

    // IMPL NOTE : TCCL handling here is temporary.
    //    It is needed because this code still uses Hibernate Configuration and Hibernate commons-annotations
    //     in turn which relies on TCCL being set.
View Full Code Here

  public ImportSqlCommandExtractor initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
    String extractorClassName = (String) configurationValues.get( Environment.HBM2DDL_IMPORT_FILES_SQL_EXTRACTOR );
    if ( StringHelper.isEmpty( extractorClassName ) ) {
      return DEFAULT_EXTRACTOR;
    }
    final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
    return instantiateExplicitCommandExtractor( extractorClassName, classLoaderService );
  }
View Full Code Here

  private static final Logger log = Logger.getLogger( StandardJtaPlatformResolver.class );

  @Override
  public JtaPlatform resolveJtaPlatform(Map configurationValues, ServiceRegistryImplementor registry) {
    final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );

    // Initially look for a JtaPlatformProvider
    for ( JtaPlatformProvider provider : classLoaderService.loadJavaServices( JtaPlatformProvider.class ) ) {
      final JtaPlatform providedPlatform = provider.getProvidedJtaPlatform();
      if ( providedPlatform!= null ) {
        return providedPlatform;
      }
    }


    // look for classes on the ClassLoader (via service) that we know indicate certain JTA impls or
    // indicate running in certain environments with known JTA impls.
    //
    // IMPL NOTE : essentially we attempt Class lookups and use the exceptions from the class(es) not
    // being found as the indicator


    // JBoss ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    try {
      classLoaderService.classForName( JBossStandAloneJtaPlatform.JBOSS_TM_CLASS_NAME );
      classLoaderService.classForName( JBossStandAloneJtaPlatform.JBOSS_UT_CLASS_NAME );

      // we know that the JBoss TS classes are available
      // if neither of these look-ups resulted in an error (no such class), then JBossTM is available on
      // the classpath
      //
      // todo : we cannot really distinguish between the need for JBossStandAloneJtaPlatform versus JBossApServerJtaPlatform
      // but discussions with David led to the JtaPlatformProvider solution above, so inside JBoss AS we
      // should be relying on that
      return new JBossStandAloneJtaPlatform();
    }
    catch (ClassLoadingException ignore) {
    }

    // Bitronix ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    try {
      classLoaderService.classForName( BitronixJtaPlatform.TM_CLASS_NAME );
      return new BitronixJtaPlatform();
    }
    catch (ClassLoadingException ignore) {
    }

    // JOnAS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    try {
      classLoaderService.classForName( JOnASJtaPlatform.TM_CLASS_NAME );
      return new JOnASJtaPlatform();
    }
    catch (ClassLoadingException ignore) {
    }

    // JOTM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    try {
      classLoaderService.classForName( JOTMJtaPlatform.TM_CLASS_NAME );
      return new JOTMJtaPlatform();
    }
    catch (ClassLoadingException ignore) {
    }

    // WebSphere ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    for ( WebSphereJtaPlatform.WebSphereEnvironment webSphereEnvironment
        : WebSphereJtaPlatform.WebSphereEnvironment.values() ) {
      try {
        Class accessClass = classLoaderService.classForName( webSphereEnvironment.getTmAccessClassName() );
        return new WebSphereJtaPlatform( accessClass, webSphereEnvironment );
      }
      catch (ClassLoadingException ignore) {
      }
    }
View Full Code Here

TOP

Related Classes of org.hibernate.boot.registry.classloading.spi.ClassLoaderService

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.