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

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


      if ( Class.class.isInstance( configValue ) ) {
        implClass = (Class) configValue;
      }
      else {
        final String className = configValue.toString();
        final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
        try {
          implClass = classLoaderService.classForName( className );
        }
        catch (ClassLoadingException cle) {
          log.warn( "Unable to locate specified class [" + className + "]", cle );
          throw new ServiceException( "Unable to locate specified multi-tenant connection provider [" + 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

  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

    // add Dialect contributed types
    final Dialect dialect = serviceRegistry.getService( JdbcServices.class ).getDialect();
    dialect.contributeTypes( typeContributions, serviceRegistry );

    // add TypeContributor contributed types.
    ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
    for ( TypeContributor contributor : classLoaderService.loadJavaServices( TypeContributor.class ) ) {
      contributor.contribute( typeContributions, serviceRegistry );
    }
    // from app registrations
    for ( TypeContributor contributor : typeContributorRegistrations ) {
      contributor.contribute( typeContributions, serviceRegistry );
View Full Code Here

      ServiceRegistryImplementor registry,
      Map configurationValues) {
    final String resolverImplNames = (String) configurationValues.get( AvailableSettings.DIALECT_RESOLVERS );

    if ( StringHelper.isNotEmpty( resolverImplNames ) ) {
      final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
      for ( String resolverImplName : StringHelper.split( ", \n\r\f\t", resolverImplNames ) ) {
        try {
          resolver.addResolver(
              (DialectResolver) classLoaderService.classForName( resolverImplName ).newInstance()
          );
        }
        catch (HibernateException e) {
          throw 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

    // add Dialect contributed types
    final Dialect dialect = serviceRegistry.getService( JdbcServices.class ).getDialect();
    dialect.contributeTypes( typeContributions, serviceRegistry );

    // add TypeContributor contributed types.
    ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
    for ( TypeContributor contributor : classLoaderService.loadJavaServices( TypeContributor.class ) ) {
      contributor.contribute( typeContributions, serviceRegistry );
    }
    // from app registrations
    for ( TypeContributor contributor : typeContributorRegistrations ) {
      contributor.contribute( typeContributions, serviceRegistry );
View Full Code Here

    if ( modes.size() == 1 && modes.contains( ValidationMode.NONE ) ) {
      // we have nothing to do; just return
      return;
    }

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

    // see if the Bean Validation API is available on the classpath
    if ( isBeanValidationApiAvailable( classLoaderService ) ) {
      // and if so, call out to the TypeSafeActivator
      try {
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.