Package org.hibernate.service.classloading.spi

Examples of org.hibernate.service.classloading.spi.ClassLoaderService


    if ( Class.class.isInstance( platform ) ) {
      jtaPlatformImplClass = (Class<JtaPlatform>) platform;
    }
    else {
      final String platformImplName = platform.toString();
      final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
      try {
        jtaPlatformImplClass = classLoaderService.classForName( platformImplName );
      }
      catch ( Exception e ) {
        throw new HibernateException( "Unable to locate specified JtaPlatform class [" + platformImplName + "]", e );
      }
    }
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 ConnectionProvider initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
    if ( MultiTenancyStrategy.determineMultiTenancyStrategy( configurationValues ) != MultiTenancyStrategy.NONE ) {
      // nothing to do, but given the separate hierarchies have to handle this here.
    }

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

    ConnectionProvider connectionProvider = null;
    String providerClassName = getConfiguredConnectionProviderName( configurationValues );
    if ( providerClassName != null ) {
      connectionProvider = instantiateExplicitConnectionProvider( providerClassName, classLoaderService );
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

   * @param context the annotation binding context with access to the service registry and the annotation index
   *
   * @return a set of {@code ConfiguredClassHierarchy}s. One for each "leaf" entity.
   */
  public static Set<ConfiguredClassHierarchy<EntityClass>> createEntityHierarchies(AnnotationBindingContext context) {
    ClassLoaderService classLoaderService = context.classLoaderService();
    Map<ClassInfo, List<ClassInfo>> processedClassInfos = new HashMap<ClassInfo, List<ClassInfo>>();

    for ( ClassInfo info : context.getIndex().getKnownClasses() ) {
      if ( !isEntityClass( info ) ) {
        continue;
      }

      if ( processedClassInfos.containsKey( info ) ) {
        continue;
      }

      List<ClassInfo> configuredClassList = new ArrayList<ClassInfo>();
      ClassInfo tmpClassInfo = info;
      Class<?> clazz = classLoaderService.classForName( tmpClassInfo.toString() );
      while ( clazz != null && !clazz.equals( Object.class ) ) {
        tmpClassInfo = context.getIndex().getClassByName( DotName.createSimple( clazz.getName() ) );
        clazz = clazz.getSuperclass();
        if ( tmpClassInfo == null ) {
          continue;
View Full Code Here

      return tokens;
    }
  }

  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

      SessionFactoryImplementor sessionFactory,
      SessionFactoryServiceRegistry serviceRegistry) {
    // determine requested validation modes.
    final Set<ValidationMode> modes = ValidationMode.getModes( configuration.getProperties().get( MODE_PROPERTY ) );

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

    // try to locate a BV class to see if it is available on the classpath
    boolean isBeanValidationAvailable;
    try {
      classLoaderService.classForName( BV_CHECK_CLASS );
      isBeanValidationAvailable = true;
    }
    catch ( Exception e ) {
      isBeanValidationAvailable = false;
    }
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

    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

    // 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

TOP

Related Classes of org.hibernate.service.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.