Package org.hibernate.service.classloading.spi

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


    if ( strategy == MultiTenancyStrategy.DATABASE || strategy == MultiTenancyStrategy.SCHEMA ) {
      // nothing to do, but given the separate hierarchies have to handle this here.
      return null;
    }

    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


  }

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

  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

    }

    final String strategyClassName = mapLegacyNames( strategy.toString() );
        LOG.transactionStrategy(strategyClassName);

    ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
    try {
      return (TransactionFactory) classLoaderService.classForName( strategyClassName ).newInstance();
    }
    catch ( Exception e ) {
      throw new HibernateException( "Unable to instantiate specified TransactionFactory class [" + strategyClassName + "]", e );
    }
  }
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

      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

    final List<DialectResolver> resolvers = new ArrayList<DialectResolver>();

    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 {
          resolvers.add( (DialectResolver) classLoaderService.classForName( resolverImplName ).newInstance() );
        }
        catch (HibernateException e) {
          throw e;
        }
        catch (Exception e) {
View Full Code Here

   * @param serviceRegistry The service registry
   *
   * @return a set of {@code ConfiguredClassHierarchy}s. One for each "leaf" entity.
   */
  public static Set<ConfiguredClassHierarchy> createEntityHierarchies(Index index, ServiceRegistry serviceRegistry) {
    ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
    Map<ClassInfo, List<ClassInfo>> processedClassInfos = new HashMap<ClassInfo, List<ClassInfo>>();

    for ( ClassInfo info : index.getKnownClasses() ) {
      if ( !isConfiguredClass( 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 = index.getClassByName( DotName.createSimple( clazz.getName() ) );
        clazz = clazz.getSuperclass();
        if ( tmpClassInfo == null ) {
          continue;
View Full Code Here

    }
  }

  private DatastoreProvider defaultDatastoreProvider(ServiceRegistryImplementor registry) {
    try {
      ClassLoaderService service = registry.getService( ClassLoaderService.class );
      Class<?> datastoreProviderClass = service.classForName( DEFAULT_DATASTORE_PROVIDER_CLASS );
      return (DatastoreProvider) datastoreProviderClass.newInstance();
    }
    catch (ClassLoadingException e) {
      throw log.noDatastoreConfigured();
    }
View Full Code Here

  private static final String PREFIX = "META-INF/services/";
  private LinkedHashMap<String, S> providers = new LinkedHashMap<String, S>();

  private ServiceLoader(Class<S> svc, ServiceRegistry serviceRegistry) {
    Class<S> service = svc;
    ClassLoaderService loader = serviceRegistry.getService( ClassLoaderService.class );
    String fullName = PREFIX + service.getName();
    service.getName();

    List<URL> configs = locateResources( loader, fullName );
    for ( URL url : configs ) {
      Iterator<String> names = parse( service, url );
      while ( names.hasNext() ) {
        String cn = names.next();
        try {
          S p = service.cast( loader.classForName( cn ).newInstance() );
          providers.put( cn, p );
        }
        catch ( Throwable x ) {
          fail( service, "Provider " + cn + " could not be instantiated: " + x, x );
        }
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.